lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45a40d3e-e534-4704-a928-cb36682133dc@linux.intel.com>
Date: Thu, 16 Jan 2025 17:15:23 +0200
From: Mathias Nyman <mathias.nyman@...ux.intel.com>
To: Wesley Cheng <quic_wcheng@...cinc.com>,
 Michał Pecio <michal.pecio@...il.com>
Cc: Thinh.Nguyen@...opsys.com, broonie@...nel.org, conor+dt@...nel.org,
 corbet@....net, devicetree@...r.kernel.org, dmitry.torokhov@...il.com,
 gregkh@...uxfoundation.org, krzk+dt@...nel.org, lgirdwood@...il.com,
 linux-arm-msm@...r.kernel.org, linux-doc@...r.kernel.org,
 linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-sound@...r.kernel.org, linux-usb@...r.kernel.org,
 mathias.nyman@...el.com, perex@...ex.cz,
 pierre-louis.bossart@...ux.intel.com, robh@...nel.org,
 srinivas.kandagatla@...aro.org, tiwai@...e.com
Subject: Re: [PATCH v32 01/32] usb: host: xhci: Repurpose event handler for
 skipping interrupter events

On 14.1.2025 22.42, Wesley Cheng wrote:
> Hi Michal,
> 
> On 1/14/2025 6:08 AM, Michał Pecio wrote:
>> Thanks, I think I now see how this is meant to work.
>>
>>
>> Cover leter mostly discusses the ALSA side of things, but not low level
>> details of xHCI operation, such as who will be ringing doorbells and
>> how, handling IRQs, updating event ring dequeue, or handling halted EPs.
>>
>> So for the record, as far as I see:
>> 1. There is no API for ringing doorbells or even getting a pointer,
>>     the coprocessor needs to have its own access. Fair enough.
>> 2. Same for event ring dequeue, but the driver must clean up leftover
>>     unacknowledged events after sideband operation stops.
>> 3. Linux IRQ handler never needs to worry about sideband interrupts.
>> 4. Resetting halted endpoints is not implemented at all, I think?
>>     So this code is currently mostly useful with isochronous.
> 
> 
> Yep, all your points about the code with respects to the xHCI perspective is correct.
> 
> 
>>
>> And the 'skip_events' flag only exists to enable ring cleanup when the
>> interrupter is removed? In such case I think it's overkill.
>>
>> The code would be simpler and its intent more visible if 'skip_events'
>> were a new parameter of xhci_handle_events(). Existing IRQ would call
>> the function normally, while xhci_skip_sec_intr_events() would use the
>> new parameter to suppress event handling in this one special case.
>>
>> It would be immediately clear that skipping only applies on removal.
>>
>> You could completely get rid of PATCH 01/32 because 02/32 would no
>> longer need to set this flag on the interrupter, and the 'if' branch
>> adedd by 01/32 could go into 03/32 where it logically belongs.
>>
>> Just a suggestion. I simply don't see any need to have a flag which
>> causes events on a ring to always be skipped as a matter of policy.
>> Your code doesn't seem to require it. Probably nobody ever will.

Yes, this should works as well, and is maybe a bit cleaner than current
flag approach.

>>
> 
> In my previous discussions with Mathias, I think the plan was that he wanted it to be built in a way where we should be able to accommodate a use case where the secondary interrupter was going to be actually handled by the Linux side.  This is why the skip_events is populated/defined by the xHCI sideband calls, so that we can differentiate between the secondary interrupter use cases.  Although, it is the correct assumption that this series doesn't actually implement that functionality.
> 

Idea is to support xhci virtualization at some point, but also benefit from
moving noisy devices with a lot of events away from filling up the primary
event ring.

Once a usb device gets its own xhci secondary interrupter with a dedicated
event ring for transfer events, and its own MSI/MSI-X interrupt with dedicated
interrupt handler, it is easier to support xhci virtualization.

In short, support passing one USB device to a virtual machine client.

But this is out of scope for this series, so flag or parameter will do.

For this "vendor" sideband case we use the secondary interrupter to prevent
xCH controller from triggering interrupts for this device. CPU can
"sleep" while the audio chip reads and writes TRBs on transfer rings,
and  polls dedicated event ring for transfer events.

Thanks
-Mathias


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ