[edk2-devel] [PATCH v2 0/1] Fix XhciDxe Timeouts

patrick.henz@hpe.com posted 1 patch 3 years, 7 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 35 ++++++++++++++++---
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 43 +++++++++++++++++++-----
2 files changed, 65 insertions(+), 13 deletions(-)
[edk2-devel] [PATCH v2 0/1] Fix XhciDxe Timeouts
Posted by patrick.henz@hpe.com 3 years, 7 months ago
From: Patrick Henz <patrick.henz@hpe.com>

Timeouts in the XhciDxe driver are taking longer than
expected due to the timeout loops not accounting for
code execution time. As en example, 5 second timeouts
have been observed to take around 36 seconds to complete.
Use SetTimer and Create/CheckEvent from Boot Services to
determine when timeout occurred. This patch was tested
using forced timeouts and print statements with QEmu as
well as phycial hardware. The forced timeouts were
implemented in code via static variables that guaranteed
a timeout the first time the function with the broken
timeout was called.

Example:

XhcExecTransfer (
  .
  .
 )
{
  .
  .
  static int do_once = 1;  // test line
  .
  .
  do {
    Finished = XhcCheckUrbResult (Xhc, Urb);
    if (do_once) Finished = 0; // test line
    if (Finished) {
      break;
    }
    gBS->Stall (XHC_1_MICROSECOND);
  } while (EFI_ERROR(gBS->CheckEvent (TimeoutEvent)));

  do_once = 0; // test line

Using this forced timeout approach the correct timeouts
were observed on both hardware and in QEmu.

Similar broken timeout loops have been found in the Uhci
and Ehci drivers. This patch does not fix those issues.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Patrick Henz <patrick.henz@hpe.com>

Patrick Henz (1):
  MdeModulePkg/XhciDxe: Fix Broken Timeouts

 MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 35 ++++++++++++++++---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 43 +++++++++++++++++++-----
 2 files changed, 65 insertions(+), 13 deletions(-)

-- 
2.28.0


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64983): https://edk2.groups.io/g/devel/message/64983
Mute This Topic: https://groups.io/mt/76587249/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-