public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3 0/1] MdeModulePkg/XhciDxe: Fix Broken Timeouts
@ 2020-09-23 19:36 Henz, Patrick
  2020-09-23 19:36 ` [PATCH v3 1/1] " Henz, Patrick
  0 siblings, 1 reply; 7+ messages in thread
From: Henz, Patrick @ 2020-09-23 19:36 UTC (permalink / raw)
  To: devel; +Cc: Patrick Henz, Jian J Wang, Hao A Wu, Ray Ni

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   | 59 +++++++++++++++++-----
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 63 ++++++++++++++++++------
 2 files changed, 94 insertions(+), 28 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-08 16:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-23 19:36 [PATCH v3 0/1] MdeModulePkg/XhciDxe: Fix Broken Timeouts Henz, Patrick
2020-09-23 19:36 ` [PATCH v3 1/1] " Henz, Patrick
2020-09-24  1:22   ` [edk2-devel] " Wu, Hao A
2020-09-29  1:31     ` Wu, Hao A
2023-06-07 21:37   ` Jessica Clarke
2023-06-08 10:32     ` Leif Lindholm
2023-06-08 16:51     ` Henz, Patrick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox