mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dingyan Li" <18500469033@163.com>
To: stern@rowland.harvard.edu, "Greg KH" <gregkh@linuxfoundation.org>
Cc: "Hans de Goede" <hdegoede@redhat.com>,
	"Xiaofan Chen" <xiaofanc@gmail.com>,
	"Oliver Neukum" <oneukum@suse.com>,
	"Tormod Volden" <lists.tormod@gmail.com>,
	sebastian.reichel@collabora.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re:Re: [PATCH] USB: add usbfs ioctl to get specific superspeedplus rates
Date: Thu, 3 Aug 2023 14:13:33 +0800 (CST)	[thread overview]
Message-ID: <151a5748.3e99.189ba07b110.Coremail.18500469033@163.com> (raw)
In-Reply-To: <2a82ba01-38dd-fad9-98b9-ac8591107921@redhat.com>


At 2023-07-26 22:39:32, "Hans de Goede" <hdegoede@redhat.com> wrote:
>Hi All,
>
>On 7/26/23 05:20, Xiaofan Chen wrote:
>> On Wed, Jul 26, 2023 at 5:38 PM Oliver Neukum <oneukum@suse.com> wrote:
>>>
>>> On 26.07.23 03:37, Xiaofan Chen wrote:
>>>> On Tue, Jul 25, 2023 at 10:23 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>>>
>>> Hi,
>>>
>>>>> So unless there is some actual need from userspace tools like libusb (or
>>>>> anything else?) that requires this new ioctl, let's not add it otherwise
>>>>> we are signing ourselves up to support it for forever.
>>>>
>>>> Interestingly there is PR in libusb now, which uses sysfs for 20Gbps.
>>>
>>> True. Now would you write a patch for libusb?
>>> This looks to be turning into a chicken and egg problem.
>>>
>>>> Maybe this new usbfs IOCTL is indeed good to have if we can not extend
>>>
>>> Looking at the code of libusb you can see that libusb has two modes
>>> of operation. Either it finds sysfs, then it uses it, if not it
>>> goes for the ioctl.
>>>
>>> Now, how well shall it work without sysfs? That is a design decision
>>> and we should not be having this discussion again and again.
>>>
>>> BTW, that is not aimed at anybody personally, we are just trying to
>>> avoid a basic decision and it will come back.
>>>
>>>> the existing IOCTL USBDEVFS_GET_SPEED (but why not?).
>>>
>>> It does not include the lane count.
>>> And sort of fudging this into speed is a bad idea in the long
>>> run because we are likely to have collisions in the future.
>>>
>>> We have a basic issue here. Do we require libusb to use sysfs or not?
>> 
>> Adding Hans de Goede and Tormod Volder (libusb admins) here in the discussions
>> as I am more into the testing and support side of libusb and not a
>> real developer.
>> 
>> libusb does work with or without sysfs and there are multiple commits related
>> to sysfs vs usbfs.
>> 
>> An example commit from Hans in Sept 202 which is related to this discussion.
>> https://github.com/libusb/libusb/commit/f6068e83c4f5e5fba16b23b6a87f1f6d7ab7200a
>> ++++++++++++++++
>> linux: Fix libusb_get_device_speed() not working on wrapped devices
>> 
>> We don't have a sysfs_dir for wrapped devices, so we cannot read the speed
>> from sysfs.
>> 
>> The Linux kernel has supported a new ioctl to get the speed directly from
>> the fd for a while now, use that when we don't have sysfs access.
>> 
>> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1871818
>> Reported-by: Gerd Hoffmann <kraxel@redhat.com>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> +++++++++++++++++
>> 
>> To Hans and Tormod:
>> Discussion thread for reference:
>> https://lore.kernel.org/linux-usb/da536c80-7398-dae0-a22c-16e521be697a@suse.com/T/#t
>
>Right, so the reason why IOCTL USBDEVFS_GET_SPEED was added is so that a confined qemu process which gets just a fd for a /dev/bus/usb/ device passed by a more privileged process can still get the speed despite it not having sysfs access. This is necessary for correct pass-through of USB devices.
>
>Since USBDEVFS_GET_SPEED now no longer tells the full story I believe that the proposed USBDEVFS_GET_SSP_RATE ioctl makes sense.
>
>The current patch however misses moving the enum usb_ssp_rate declaration from include/linux/usb/ch9.h to include/uapi/linux/usb/ch9.h so that needs to be fixed in a version 2. Assuming that with the above explanation of why this is necessary Greg and Alan are ok with adding the ioctl.
>
>Regards,
>
>Hans
>

Hi Greg and Alan,

Could you please share your opinions about Hans' justification?

Regards,
Dingyan

  reply	other threads:[~2023-08-03  6:14 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21  8:40 Dingyan Li
2023-07-21 11:04 ` Greg KH
     [not found]   ` <550dbb46.5bc4.189785b0360.Coremail.18500469033@163.com>
2023-07-21 12:11     ` Greg KH
2023-07-21 12:35   ` Dingyan Li
2023-07-21 14:51     ` Greg KH
2023-07-21 15:43       ` Dingyan Li
2023-07-21 17:26         ` Alan Stern
2023-07-24  9:47       ` Oliver Neukum
2023-07-25 13:24         ` Greg KH
2023-07-25 13:54           ` Dingyan Li
2023-07-25 14:08             ` Oliver Neukum
2023-07-25 14:40               ` Dingyan Li
2023-07-25 15:12                 ` Greg KH
2023-07-25 16:11                   ` Dingyan Li
2023-07-26  8:33                     ` Oliver Neukum
2023-07-26  9:36                       ` Dingyan Li
2023-07-26  9:49                         ` Oliver Neukum
2023-07-26 10:10                           ` Dingyan Li
2023-07-26  1:37           ` Xiaofan Chen
2023-07-26  9:38             ` Oliver Neukum
2023-07-26  3:20               ` Xiaofan Chen
2023-07-26 14:39                 ` Hans de Goede
2023-08-03  6:13                   ` Dingyan Li [this message]
2023-08-03 15:10                     ` Alan Stern
2023-08-03 15:39                       ` Hans de Goede
2023-08-03 16:06                         ` Dingyan Li
2023-08-03 17:56                           ` Alan Stern
2023-08-04  4:16                             ` Dingyan Li
2023-08-04 14:55                               ` Alan Stern
2023-08-19  4:32                                 ` Dingyan Li
2023-08-19  5:46                                   ` [PATCH v2] USB: Support 20Gbps speed for ioctl USBDEVFS_GET_SPEED Dingyan Li
2023-08-19 19:03                                     ` Alan Stern
2023-08-20  5:29                                       ` Dingyan Li
2023-08-19 18:46                                   ` Re: Re: Re: [PATCH] USB: add usbfs ioctl to get specific superspeedplus rates Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=151a5748.3e99.189ba07b110.Coremail.18500469033@163.com \
    --to=18500469033@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lists.tormod@gmail.com \
    --cc=oneukum@suse.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=stern@rowland.harvard.edu \
    --cc=xiaofanc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®