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]
Date: Tue, 30 Apr 2024 14:02:59 +0300
From: Mathias Nyman <mathias.nyman@...ux.intel.com>
To: Wesley Cheng <quic_wcheng@...cinc.com>, srinivas.kandagatla@...aro.org,
 mathias.nyman@...el.com, perex@...ex.cz, conor+dt@...nel.org,
 corbet@....net, lgirdwood@...il.com, andersson@...nel.org,
 krzysztof.kozlowski+dt@...aro.org, gregkh@...uxfoundation.org,
 Thinh.Nguyen@...opsys.com, broonie@...nel.org, bgoswami@...cinc.com,
 tiwai@...e.com, robh@...nel.org, konrad.dybcio@...aro.org
Cc: linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
 linux-sound@...r.kernel.org, linux-usb@...r.kernel.org,
 linux-arm-msm@...r.kernel.org, linux-doc@...r.kernel.org,
 alsa-devel@...a-project.org
Subject: Re: [PATCH v20 03/41] usb: host: xhci: Repurpose event handler for
 skipping interrupter events

On 26.4.2024 0.50, Wesley Cheng wrote:
> Depending on the interrupter use case, the OS may only be used to handle
> the interrupter event ring clean up.  In these scenarios, event TRBs don't
> need to be handled by the OS, so introduce an xhci interrupter flag to tag
> if the events from an interrupter needs to be handled or not.

Could you elaborate on this a bit.

If I understood correctly the whole point of requesting a secondary xhci interrupter
for the sideband device without ever requesting a real interrupt for it was to avoid
waking up the cpu and calling the interrupt handler.

with this flag is seems the normal xhci interrupt handler does get called for
sideband transfer events.

> 
> Signed-off-by: Wesley Cheng <quic_wcheng@...cinc.com>
> ---
>   drivers/usb/host/xhci-ring.c | 17 +++++++++++++----
>   drivers/usb/host/xhci.h      |  1 +
>   2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 52278afea94b..6c7a21f522cd 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -2973,14 +2973,22 @@ static int handle_tx_event(struct xhci_hcd *xhci,
>   }
>   
>   /*
> - * This function handles one OS-owned event on the event ring. It may drop
> - * xhci->lock between event processing (e.g. to pass up port status changes).
> + * This function handles one OS-owned event on the event ring, or ignores one event
> + * on interrupters which are non-OS owned. It may drop xhci->lock between event
> + * processing (e.g. to pass up port status changes).
>    */
>   static int xhci_handle_event_trb(struct xhci_hcd *xhci, struct xhci_interrupter *ir,
>   				 union xhci_trb *event)
>   {
>   	u32 trb_type;
>   
> +	/*
> +	 * Some interrupters do not need to handle event TRBs, as they may be
> +	 * managed by another entity, but rely on the OS to clean up.
> +	 */
> +	if (ir->skip_events)
> +		return 0;
> +

I think we need another solution than a skip_events flag.

To make secondary xhci interrupters more useful in general it would make more
sense to add an interrupt handler function pointer to struct xhci_interrupter.

Then call that function instead of xhci_handle_event_trb()

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3098,8 +3098,8 @@ static int xhci_handle_events(struct xhci_hcd *xhci, struct xhci_interrupter *ir
  
         /* Process all OS owned event TRBs on this event ring */
         while (unhandled_event_trb(ir->event_ring)) {
-               err = xhci_handle_event_trb(xhci, ir, ir->event_ring->dequeue);
-
+               if (ir->handle_event_trb)
+                       err = ir->handle_event_trb(xhci, ir, ir->event_ring->dequeue);
                 /*
                  * If half a segment of events have been handled in one go then
                  * update ERDP, and force isoc trbs to interrupt more often

The handler function would be passed to, and function pointer set in
xhci_create_secondary_interrupter()

For primary interrupter it would always be set to xhci_handle_event_trb()

Thanks
Mathias


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ