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

Wu, Hao A hao.a.wu at intel.com
Wed Sep 2 05:08:38 UTC 2020


> -----Original Message-----
> From: patrick.henz at hpe.com <patrick.henz at hpe.com>
> Sent: Wednesday, September 2, 2020 2:55 AM
> To: devel at edk2.groups.io
> Cc: henz <patrick.henz at hpe.com>; Wang, Jian J <jian.j.wang at intel.com>; Wu,
> Hao A <hao.a.wu at intel.com>; Ni, Ray <ray.ni at intel.com>
> Subject: [PATCH 0/1] Fix XhciDxe Timeouts
> 
> From: henz <patrick.henz at 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(TimerStatus) && 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.


Hello Patrick,

Besides the comments made by Ray in patch 1, could you help to provide 2 more patches for UHCI and EHCI drivers as well for complete enhancement?
Thanks in advance.

Best Regards,
Hao Wu


> 
> Cc: Jian J Wang <jian.j.wang at intel.com>
> Cc: Hao A Wu <hao.a.wu at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Signed-off-by: Patrick Henz <patrick.henz at hpe.com>
> 
> Patrick Henz (1):
>   MdeModulePkg/XhciDxe: Fix Broken Timeouts
> 
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c   | 28 ++++++++++++++++---
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 34 +++++++++++++++++-------
>  2 files changed, 49 insertions(+), 13 deletions(-)
> 
> --
> 2.27.0


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

View/Reply Online (#64939): https://edk2.groups.io/g/devel/message/64939
Mute This Topic: https://groups.io/mt/76576825/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list