* Re: [PATCH] tsc: Change default tsc calibration method to EFI on EFI systems
2017-09-06 20:20 [PATCH] tsc: Change default tsc calibration method to EFI on EFI systems David E. Box
@ 2017-09-06 20:56 ` Joe Konno
2017-09-12 7:10 ` Paul Menzel
2017-09-12 23:46 ` Vladimir 'phcoder' Serbinenko
2 siblings, 0 replies; 6+ messages in thread
From: Joe Konno @ 2017-09-06 20:56 UTC (permalink / raw)
To: grub-devel; +Cc: david.e.box
[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]
On Wed, 6 Sep 2017 13:20:54 -0700
"David E. Box" <david.e.box@linux.intel.com> wrote:
> On efi systems, make efi based tsc calibration the default, followed by
> the pmtimer before using the pit. This prevents Grub boot failure on
> newer x86 systems that power gate the pit.
>
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
> grub-core/kern/i386/tsc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c
> index 2e85289d8..de4057ddb 100644
> --- a/grub-core/kern/i386/tsc.c
> +++ b/grub-core/kern/i386/tsc.c
> @@ -68,7 +68,7 @@ grub_tsc_init (void)
> #ifdef GRUB_MACHINE_XEN
> (void) (grub_tsc_calibrate_from_xen () || calibrate_tsc_hardcode());
> #elif defined (GRUB_MACHINE_EFI)
> - (void) (grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode());
> + (void) (grub_tsc_calibrate_from_efi () || grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
> #elif defined (GRUB_MACHINE_COREBOOT)
> (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
> #else
Good catch!
Noted the baked-in, minor style cleanup:
grub_tsc_calibrate_from_efi() -> grub_tsc_calibrate_from_efi ()
You have my:
Reviewed-by: Joe Konno <joe.konno@intel.com>
Cheers
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tsc: Change default tsc calibration method to EFI on EFI systems
2017-09-06 20:20 [PATCH] tsc: Change default tsc calibration method to EFI on EFI systems David E. Box
2017-09-06 20:56 ` Joe Konno
@ 2017-09-12 7:10 ` Paul Menzel
2017-09-12 23:40 ` David E. Box
2017-09-12 23:46 ` Vladimir 'phcoder' Serbinenko
2 siblings, 1 reply; 6+ messages in thread
From: Paul Menzel @ 2017-09-12 7:10 UTC (permalink / raw)
To: David E. Box; +Cc: grub-devel
[-- Attachment #1: Type: text/plain, Size: 1467 bytes --]
Dear David,
Am Mittwoch, den 06.09.2017, 13:20 -0700 schrieb David E. Box:
> On efi systems, make efi based tsc calibration the default, followed by
> the pmtimer before using the pit. This prevents Grub boot failure on
> newer x86 systems that power gate the pit.
Could you please be specific, what “newer x86 systems” are? Also, what
is the “GRUB boot failure”? A hang?
What about older EFI x86 systems? Is there a chance, that they hang
now?
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
> grub-core/kern/i386/tsc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c
> index 2e85289d8..de4057ddb 100644
> --- a/grub-core/kern/i386/tsc.c
> +++ b/grub-core/kern/i386/tsc.c
> @@ -68,7 +68,7 @@ grub_tsc_init (void)
> #ifdef GRUB_MACHINE_XEN
> (void) (grub_tsc_calibrate_from_xen () || calibrate_tsc_hardcode());
> #elif defined (GRUB_MACHINE_EFI)
> - (void) (grub_tsc_calibrate_from_pit () || grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi() || calibrate_tsc_hardcode());
> + (void) (grub_tsc_calibrate_from_efi () || grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
> #elif defined (GRUB_MACHINE_COREBOOT)
> (void) (grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
> #else
Thanks,
Paul
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tsc: Change default tsc calibration method to EFI on EFI systems
2017-09-12 7:10 ` Paul Menzel
@ 2017-09-12 23:40 ` David E. Box
0 siblings, 0 replies; 6+ messages in thread
From: David E. Box @ 2017-09-12 23:40 UTC (permalink / raw)
To: Paul Menzel; +Cc: grub-devel
Hi Paul,
On Tue, 2017-09-12 at 09:10 +0200, Paul Menzel wrote:
> Dear David,
>
>
> Am Mittwoch, den 06.09.2017, 13:20 -0700 schrieb David E. Box:
> > On efi systems, make efi based tsc calibration the default,
> > followed by
> > the pmtimer before using the pit. This prevents Grub boot failure
> > on
> > newer x86 systems that power gate the pit.
>
> Could you please be specific, what “newer x86 systems” are? Also,
> what
> is the “GRUB boot failure”? A hang?
Intel SoC's supporting the S0ix feature require the 8254 to be power
gated. This feature as been around as early as the Cherry Trail line.
In order to support this some firmware configurations clock gate the
8254 by default. This causes grub to hang on these systems when they
attempt to use it to calibrate the tsc.
See section 18.9.2.4 in https://www.intel.com/content/www/us/en/process
ors/atom/atom-z8000-datasheet-vol-1.html
>
> What about older EFI x86 systems? Is there a chance, that they hang
> now?support this some firmware configurations clock gate the 8254 by
> default. This causes grub to hang on t
Can't say for sure. I have no reason to suspect so. Such a system would
have to have no (or broken) support for the EFI_STALL boot service
command, which has been around since EFI 1.0.
>
> > Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> > ---
> > grub-core/kern/i386/tsc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c
> > index 2e85289d8..de4057ddb 100644
> > --- a/grub-core/kern/i386/tsc.c
> > +++ b/grub-core/kern/i386/tsc.c
> > @@ -68,7 +68,7 @@ grub_tsc_init (void)
> > #ifdef GRUB_MACHINE_XEN
> > (void) (grub_tsc_calibrate_from_xen () ||
> > calibrate_tsc_hardcode());
> > #elif defined (GRUB_MACHINE_EFI)
> > - (void) (grub_tsc_calibrate_from_pit () ||
> > grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi()
> > || calibrate_tsc_hardcode());
> > + (void) (grub_tsc_calibrate_from_efi () ||
> > grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit
> > () || calibrate_tsc_hardcode());
> > #elif defined (GRUB_MACHINE_COREBOOT)
> > (void) (grub_tsc_calibrate_from_pmtimer () ||
> > grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
> > #else
>
>
> Thanks,
>
> Paul
Dave
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tsc: Change default tsc calibration method to EFI on EFI systems
2017-09-06 20:20 [PATCH] tsc: Change default tsc calibration method to EFI on EFI systems David E. Box
2017-09-06 20:56 ` Joe Konno
2017-09-12 7:10 ` Paul Menzel
@ 2017-09-12 23:46 ` Vladimir 'phcoder' Serbinenko
2017-09-15 22:06 ` David E. Box
2 siblings, 1 reply; 6+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2017-09-12 23:46 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 1613 bytes --]
On Wed, Sep 6, 2017, 22:21 David E. Box <david.e.box@linux.intel.com> wrote:
> On efi systems, make efi based tsc calibration the default, followed by
> the pmtimer before using the pit. This prevents Grub boot failure on
> newer x86 systems that power gate the pit.
>
Why does put code fail? I think it was changed to detect gated pit.
Also I'd prefer to use pmtimer first as we had problems with event and time
routines on some Macs. Any reason not to use pmtimer first?
>
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
> grub-core/kern/i386/tsc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c
> index 2e85289d8..de4057ddb 100644
> --- a/grub-core/kern/i386/tsc.c
> +++ b/grub-core/kern/i386/tsc.c
> @@ -68,7 +68,7 @@ grub_tsc_init (void)
> #ifdef GRUB_MACHINE_XEN
> (void) (grub_tsc_calibrate_from_xen () || calibrate_tsc_hardcode());
> #elif defined (GRUB_MACHINE_EFI)
> - (void) (grub_tsc_calibrate_from_pit () ||
> grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi() ||
> calibrate_tsc_hardcode());
> + (void) (grub_tsc_calibrate_from_efi () ||
> grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit () ||
> calibrate_tsc_hardcode());
> #elif defined (GRUB_MACHINE_COREBOOT)
> (void) (grub_tsc_calibrate_from_pmtimer () ||
> grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
> #else
> --
> 2.13.5
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
[-- Attachment #2: Type: text/html, Size: 2334 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] tsc: Change default tsc calibration method to EFI on EFI systems
2017-09-12 23:46 ` Vladimir 'phcoder' Serbinenko
@ 2017-09-15 22:06 ` David E. Box
0 siblings, 0 replies; 6+ messages in thread
From: David E. Box @ 2017-09-15 22:06 UTC (permalink / raw)
To: grub-devel
On Tue, 2017-09-12 at 23:46 +0000, Vladimir 'phcoder' Serbinenko wrote:
>
>
> On Wed, Sep 6, 2017, 22:21 David E. Box <david.e.box@linux.intel.com>
> wrote:
> > On efi systems, make efi based tsc calibration the default,
> > followed by
> > the pmtimer before using the pit. This prevents Grub boot failure
> > on
> > newer x86 systems that power gate the pit.
>
> Why does put code fail? I think it was changed to detect gated pit.
On these systems, even though the pit is gated the timer2 latch logic
still works. So when the tics are set the latch still goes from high to
active low as expected for a functional timer. But since the device is
clock gated it never counts down and the bit never gets reset, leading
to an infinite loop.
> Also I'd prefer to use pmtimer first as we had problems with event
> and time routines on some Macs. Any reason not to use pmtimer first?
No reason not to use pmtimer first. I had not considered boot speed as
well which must be prioritized. I'll submit a new patch.
> > Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> > ---
> > grub-core/kern/i386/tsc.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/grub-core/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c
> > index 2e85289d8..de4057ddb 100644
> > --- a/grub-core/kern/i386/tsc.c
> > +++ b/grub-core/kern/i386/tsc.c
> > @@ -68,7 +68,7 @@ grub_tsc_init (void)
> > #ifdef GRUB_MACHINE_XEN
> > (void) (grub_tsc_calibrate_from_xen () ||
> > calibrate_tsc_hardcode());
> > #elif defined (GRUB_MACHINE_EFI)
> > - (void) (grub_tsc_calibrate_from_pit () ||
> > grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_efi()
> > || calibrate_tsc_hardcode());
> > + (void) (grub_tsc_calibrate_from_efi () ||
> > grub_tsc_calibrate_from_pmtimer () || grub_tsc_calibrate_from_pit
> > () || calibrate_tsc_hardcode());
> > #elif defined (GRUB_MACHINE_COREBOOT)
> > (void) (grub_tsc_calibrate_from_pmtimer () ||
> > grub_tsc_calibrate_from_pit () || calibrate_tsc_hardcode());
> > #else
> > --
> > 2.13.5
> >
> >
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > https://lists.gnu.org/mailman/listinfo/grub-devel
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 6+ messages in thread