Re: [PATCH v32 01/32] usb: host: xhci: Repurpose event handler for skipping interrupter events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux