public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Henz, Patrick" <patrick.henz@hpe.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"mcb30@ipxe.org" <mcb30@ipxe.org>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Use Performance Timer for XHCI Timeouts
Date: Thu, 6 Jul 2023 14:19:58 +0000	[thread overview]
Message-ID: <PH0PR84MB14786A4B6A788AA05F8246B1892CA@PH0PR84MB1478.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <010201892b4badcf-078f8af5-8d8c-4e1e-903b-60c005a5b8a8-000000@eu-west-1.amazonses.com>

Hi Michael,

I agree that XhcGetElapsedTime() would be better off in TimerLib, but I wasn't sure how the community would feel about adding to the interface.

As for your question, I was wondering the same thing, I'm not sure if there are any platforms that do not have a free-running timer that would be accessed through TimerLib. Because of this unknown I included a check on the return value from XhcGetElapsedTime(), if that value is 0 ElapsedTime is incremented regardless to avoid a potential hang. The behavior of the function essentially reverts to the pre "MdeModulePkg/XhciDxe: Fix Broken Timeouts" commit implementation.

Thanks,
Patrick Henz

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael Brown
Sent: Thursday, July 6, 2023 8:02 AM
To: devel@edk2.groups.io; Henz, Patrick <patrick.henz@hpe.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Use Performance Timer for XHCI Timeouts

On 05/07/2023 21:15, Henz, Patrick wrote:
> REF:INVALID URI REMOVED
> g.cgi?id=2948__;!!NpxR!mnYVFUERkrUcRiNbM7pejt6qy6h5tilkuGydeM0skcGMAzS
> 1oEy1DSDT720vj4Le2cGtf_kmPYFIng$
> 
> XhciDxe uses the timer functionality provided by the boot services 
> table to detect timeout conditions. This breaks the driver's 
> ExitBootServices call back, as CoreExitBootServices halts the timer 
> before signaling the ExitBootServices event. If the host controller 
> fails to halt in the call back, the timeout condition will never occur 
> and the boot gets stuck in an indefinite spin loop. Use the free 
> running timer provided by TimerLib to calculate timeouts, avoiding the 
> potential hang.

Two points:

1. The XhcGetElapsedTime() function feels like a generally reusable abstraction that should exist within TimerLib, rather than being open-coded within XhciDxe.

2. Is the performance counter guaranteed to exist and work as expected on all platforms and CPU architectures?  (For example: what if the CPU does not support a constant TSC?)

Thanks,

Michael







  reply	other threads:[~2023-07-06 14:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05 20:15 [PATCH] MdeModulePkg/XhciDxe: Use Performance Timer for XHCI Timeouts Henz, Patrick
2023-07-06 13:02 ` [edk2-devel] " Michael Brown
2023-07-06 14:19   ` Henz, Patrick [this message]
2023-07-06 15:47     ` Michael Brown
2023-07-06 18:01       ` Michael D Kinney
2023-07-31  2:57 ` Wu, Hao A
2023-08-10 22:44   ` Henz, Patrick
2023-08-11  1:43     ` Wu, Hao A
2023-10-30 20:36       ` Henz, Patrick
2023-10-31  1:41         ` Wu, Hao A
2023-10-31 12:14           ` Laszlo Ersek
2023-10-31 12:16           ` Laszlo Ersek
2023-10-31 13:38             ` Henz, Patrick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR84MB14786A4B6A788AA05F8246B1892CA@PH0PR84MB1478.NAMPRD84.PROD.OUTLOOK.COM \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox