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: <b82f9543-2730-48af-81e8-1612b0d30ed9@linux.intel.com>
Date: Tue, 25 Feb 2025 16:55:49 +0200
From: Mathias Nyman <mathias.nyman@...ux.intel.com>
To: Michal Pecio <michal.pecio@...il.com>,
 Mathias Nyman <mathias.nyman@...el.com>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] usb: xhci: Simplify moving HW Dequeue Pointer past
 cancelled TDs

On 25.2.2025 13.59, Michal Pecio wrote:
> xhci_move_dequeue_past_td() uses a relatively complex and inefficient
> procedure to find new dequeue position after the cancelled TD.
> 
> Replace it with a simpler function which moves dequeue immediately to
> the first pending TD, or to enqueue if the ring is empty.
> 
> The outcome should be basically equivalent, because we only clear xHC
> cache if it stopped or halted on some cancelled TD and moving past the
> TD effectively means moving to the first remaining TD, if any.

This new way relies on td_list being in sync and up to date.
i.e. hardware dequeue can't be ahead of first TD in list.

One bad scenario could be something like:

class driver queues TD1
class driver queues TD2
Class driver cancels TD2, queue stop endpoint command
(Class driver cancels TD1) (optional)

xHC hardware just completed TD1 and stop endpoint command at the same time,
xHC hw may have advanced the hw dequeue to TD2, write event for stop endpoint command, and
then write transfer event for TD1 completion. (xHC hardware may do things in odd order)

Now we detect that hw dequeue is in the cancelled TD2 but with TD1 is till in the td_list.
This new solution would move dequeue back to TD1 beginning, and process it again.

Thanks
Mathias


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ