2014-01-12 00:16:33

by Rafael J. Wysocki

[permalink] [raw]
Subject: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode() (was: Re: [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME)

On Saturday, December 21, 2013 12:21:48 PM Matt Fleming wrote:
> On Fri, 20 Dec, at 11:18:56PM, Rafael J. Wysocki wrote:
> >
> > I'm not sure 100%, but I *think* we need to do that with interrupts enabled.
> > At least after mm_init(), because it relies on things initialized there if I
> > remember correctly.
> >
> > From what I can tell at the moment, it might be possible to move it before
> > efi_enter_virtual_mode() if that would help.
>
> Actually yeah, that would be super useful, and I think we'd be able to
> get rid of the whole efi_late_init() stuff because we'd no longer need
> to hang on to the EFI_BOOT_SERVICES* regions after
> SetVirtualAddressMap().

OK

I don't see any adverse effects of the patch below on a couple of my test
boxes, but (a) they are Intel-based and (b) they are non-EFI, so it would be
good to give it a go on as many machines as reasonably possible.

Thanks,
Rafael

---
From: Rafael J. Wysocki <[email protected]>
Subject: ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode()

According to Matt Fleming, if acpi_early_init() was executed befpre
efi_enter_virtual_mode(), the EFI initialization could benefit from
it, so make that happen.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
init/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-pm/init/main.c
===================================================================
--- linux-pm.orig/init/main.c
+++ linux-pm/init/main.c
@@ -615,6 +615,7 @@ asmlinkage void __init start_kernel(void
calibrate_delay();
pidmap_init();
anon_vma_init();
+ acpi_early_init();
#ifdef CONFIG_X86
if (efi_enabled(EFI_RUNTIME_SERVICES))
efi_enter_virtual_mode();
@@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void

check_bugs();

- acpi_early_init(); /* before LAPIC and SMP init */
sfi_init_late();

if (efi_enabled(EFI_RUNTIME_SERVICES)) {


2014-01-12 09:06:56

by Borislav Petkov

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode() (was: Re: [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME)

On Sun, Jan 12, 2014 at 01:30:23AM +0100, Rafael J. Wysocki wrote:
> I don't see any adverse effects of the patch below on a couple of my test
> boxes, but (a) they are Intel-based and (b) they are non-EFI, so it would be
> good to give it a go on as many machines as reasonably possible.
>
> Thanks,
> Rafael
>
> ---
> From: Rafael J. Wysocki <[email protected]>
> Subject: ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode()
>
> According to Matt Fleming, if acpi_early_init() was executed befpre
> efi_enter_virtual_mode(), the EFI initialization could benefit from
> it, so make that happen.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>
> ---
> init/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-pm/init/main.c
> ===================================================================
> --- linux-pm.orig/init/main.c
> +++ linux-pm/init/main.c
> @@ -615,6 +615,7 @@ asmlinkage void __init start_kernel(void
> calibrate_delay();
> pidmap_init();
> anon_vma_init();
> + acpi_early_init();
> #ifdef CONFIG_X86
> if (efi_enabled(EFI_RUNTIME_SERVICES))
> efi_enter_virtual_mode();
> @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void
>
> check_bugs();
>
> - acpi_early_init(); /* before LAPIC and SMP init */
> sfi_init_late();
>
> if (efi_enabled(EFI_RUNTIME_SERVICES)) {
>

Looks good both on kvm+OVMF and on my Dell EFI box.

Tested-by: Borislav Petkov <[email protected]>

Toshi has a big EFI box though - if he could run it too, that would be
great :-)

Thanks.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

2014-01-12 11:05:57

by Matt Fleming

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode() (was: Re: [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME)

On Sun, 12 Jan, at 01:30:23AM, Rafael J. Wysocki wrote:
> On Saturday, December 21, 2013 12:21:48 PM Matt Fleming wrote:
> > On Fri, 20 Dec, at 11:18:56PM, Rafael J. Wysocki wrote:
> > >
> > > I'm not sure 100%, but I *think* we need to do that with interrupts enabled.
> > > At least after mm_init(), because it relies on things initialized there if I
> > > remember correctly.
> > >
> > > From what I can tell at the moment, it might be possible to move it before
> > > efi_enter_virtual_mode() if that would help.
> >
> > Actually yeah, that would be super useful, and I think we'd be able to
> > get rid of the whole efi_late_init() stuff because we'd no longer need
> > to hang on to the EFI_BOOT_SERVICES* regions after
> > SetVirtualAddressMap().
>
> OK
>
> I don't see any adverse effects of the patch below on a couple of my test
> boxes, but (a) they are Intel-based and (b) they are non-EFI, so it would be
> good to give it a go on as many machines as reasonably possible.

Thanks Rafael, I'll give this a spin on my test machines here.

--
Matt Fleming, Intel Open Source Technology Center

2014-01-14 02:10:59

by Toshi Kani

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode() (was: Re: [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME)

On Sun, 2014-01-12 at 10:06 +0100, Borislav Petkov wrote:
> On Sun, Jan 12, 2014 at 01:30:23AM +0100, Rafael J. Wysocki wrote:
> > I don't see any adverse effects of the patch below on a couple of my test
> > boxes, but (a) they are Intel-based and (b) they are non-EFI, so it would be
> > good to give it a go on as many machines as reasonably possible.
> >
> > Thanks,
> > Rafael
> >
> > ---
> > From: Rafael J. Wysocki <[email protected]>
> > Subject: ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode()
> >
> > According to Matt Fleming, if acpi_early_init() was executed befpre
> > efi_enter_virtual_mode(), the EFI initialization could benefit from
> > it, so make that happen.
> >
> > Signed-off-by: Rafael J. Wysocki <[email protected]>
> > ---
> > init/main.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Index: linux-pm/init/main.c
> > ===================================================================
> > --- linux-pm.orig/init/main.c
> > +++ linux-pm/init/main.c
> > @@ -615,6 +615,7 @@ asmlinkage void __init start_kernel(void
> > calibrate_delay();
> > pidmap_init();
> > anon_vma_init();
> > + acpi_early_init();
> > #ifdef CONFIG_X86
> > if (efi_enabled(EFI_RUNTIME_SERVICES))
> > efi_enter_virtual_mode();
> > @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void
> >
> > check_bugs();
> >
> > - acpi_early_init(); /* before LAPIC and SMP init */
> > sfi_init_late();
> >
> > if (efi_enabled(EFI_RUNTIME_SERVICES)) {
> >
>
> Looks good both on kvm+OVMF and on my Dell EFI box.
>
> Tested-by: Borislav Petkov <[email protected]>
>
> Toshi has a big EFI box though - if he could run it too, that would be
> great :-)

Yes, I will test the change.

Thanks,
-Toshi

2014-01-14 04:11:03

by joeyli

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode() (was: Re: [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME)

於 日,2014-01-12 於 01:30 +0100,Rafael J. Wysocki 提到:
> OK
>
> I don't see any adverse effects of the patch below on a couple of my
> test
> boxes, but (a) they are Intel-based and (b) they are non-EFI, so it
> would be
> good to give it a go on as many machines as reasonably possible.
>
> Thanks,
> Rafael
>
> ---
> From: Rafael J. Wysocki <[email protected]>
> Subject: ACPI / init: Run acpi_early_init() before
> efi_enter_virtual_mode()
>
> According to Matt Fleming, if acpi_early_init() was executed befpre
> efi_enter_virtual_mode(), the EFI initialization could benefit from
> it, so make that happen.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>
> ---
> init/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-pm/init/main.c
> ===================================================================
> --- linux-pm.orig/init/main.c
> +++ linux-pm/init/main.c
> @@ -615,6 +615,7 @@ asmlinkage void __init start_kernel(void
> calibrate_delay();
> pidmap_init();
> anon_vma_init();
> + acpi_early_init();
> #ifdef CONFIG_X86
> if (efi_enabled(EFI_RUNTIME_SERVICES))
> efi_enter_virtual_mode();
> @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void
>
> check_bugs();
>
> - acpi_early_init(); /* before LAPIC and SMP init */
> sfi_init_late();
>
> if (efi_enabled(EFI_RUNTIME_SERVICES)) {
>
>
>

This patch works to me on Acer Gateway Z5WT2 UEFI notebook and Intel
UEFI development board.

Does it possible move acpi_early_init() to before timekeeping_init()?
The position is also before efi_enter_virtual_mode() and that will be
useful for parsing ACPI TAD to set system clock:

diff --git a/init/main.c b/init/main.c
index febc511..b6d93c8 100644
--- a/init/main.c
+++ b/init/main.c
@@ -565,6 +565,7 @@ asmlinkage void __init start_kernel(void)
init_timers();
hrtimers_init();
softirq_init();
+ acpi_early_init();
timekeeping_init();
time_init();
sched_clock_postinit();
@@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void)

check_bugs();

- acpi_early_init(); /* before LAPIC and SMP init */
sfi_init_late();

if (efi_enabled(EFI_RUNTIME_SERVICES)) {


Thanks a lot!
Joey Lee

2014-01-14 16:32:01

by Toshi Kani

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode() (was: Re: [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME)

On Mon, 2014-01-13 at 19:04 -0700, Toshi Kani wrote:
> On Sun, 2014-01-12 at 10:06 +0100, Borislav Petkov wrote:
> > On Sun, Jan 12, 2014 at 01:30:23AM +0100, Rafael J. Wysocki wrote:
> > > I don't see any adverse effects of the patch below on a couple of my test
> > > boxes, but (a) they are Intel-based and (b) they are non-EFI, so it would be
> > > good to give it a go on as many machines as reasonably possible.
> > >
> > > Thanks,
> > > Rafael
> > >
> > > ---
> > > From: Rafael J. Wysocki <[email protected]>
> > > Subject: ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode()
> > >
> > > According to Matt Fleming, if acpi_early_init() was executed befpre
> > > efi_enter_virtual_mode(), the EFI initialization could benefit from
> > > it, so make that happen.
> > >
> > > Signed-off-by: Rafael J. Wysocki <[email protected]>
> > > ---
> > > init/main.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > Index: linux-pm/init/main.c
> > > ===================================================================
> > > --- linux-pm.orig/init/main.c
> > > +++ linux-pm/init/main.c
> > > @@ -615,6 +615,7 @@ asmlinkage void __init start_kernel(void
> > > calibrate_delay();
> > > pidmap_init();
> > > anon_vma_init();
> > > + acpi_early_init();
> > > #ifdef CONFIG_X86
> > > if (efi_enabled(EFI_RUNTIME_SERVICES))
> > > efi_enter_virtual_mode();
> > > @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void
> > >
> > > check_bugs();
> > >
> > > - acpi_early_init(); /* before LAPIC and SMP init */
> > > sfi_init_late();
> > >
> > > if (efi_enabled(EFI_RUNTIME_SERVICES)) {
> > >
> >
> > Looks good both on kvm+OVMF and on my Dell EFI box.
> >
> > Tested-by: Borislav Petkov <[email protected]>
> >
> > Toshi has a big EFI box though - if he could run it too, that would be
> > great :-)
>
> Yes, I will test the change.

Tested-by: Toshi Kani <[email protected]>

Thanks,
-Toshi

2014-01-14 16:36:14

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode() (was: Re: [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME)

On Tuesday, January 14, 2014 12:09:08 PM joeyli wrote:
> 於 日,2014-01-12 於 01:30 +0100,Rafael J. Wysocki 提到:
> > OK
> >
> > I don't see any adverse effects of the patch below on a couple of my
> > test
> > boxes, but (a) they are Intel-based and (b) they are non-EFI, so it
> > would be
> > good to give it a go on as many machines as reasonably possible.
> >
> > Thanks,
> > Rafael
> >
> > ---
> > From: Rafael J. Wysocki <[email protected]>
> > Subject: ACPI / init: Run acpi_early_init() before
> > efi_enter_virtual_mode()
> >
> > According to Matt Fleming, if acpi_early_init() was executed befpre
> > efi_enter_virtual_mode(), the EFI initialization could benefit from
> > it, so make that happen.
> >
> > Signed-off-by: Rafael J. Wysocki <[email protected]>
> > ---
> > init/main.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Index: linux-pm/init/main.c
> > ===================================================================
> > --- linux-pm.orig/init/main.c
> > +++ linux-pm/init/main.c
> > @@ -615,6 +615,7 @@ asmlinkage void __init start_kernel(void
> > calibrate_delay();
> > pidmap_init();
> > anon_vma_init();
> > + acpi_early_init();
> > #ifdef CONFIG_X86
> > if (efi_enabled(EFI_RUNTIME_SERVICES))
> > efi_enter_virtual_mode();
> > @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void
> >
> > check_bugs();
> >
> > - acpi_early_init(); /* before LAPIC and SMP init */
> > sfi_init_late();
> >
> > if (efi_enabled(EFI_RUNTIME_SERVICES)) {
> >
> >
> >
>
> This patch works to me on Acer Gateway Z5WT2 UEFI notebook and Intel
> UEFI development board.
>
> Does it possible move acpi_early_init() to before timekeeping_init()?

We can do that if it doesn't cause any problems to happen.

Please resubmit your patch with a changelog and we'll ask everyone to try it.

Thanks!

> The position is also before efi_enter_virtual_mode() and that will be
> useful for parsing ACPI TAD to set system clock:
>
> diff --git a/init/main.c b/init/main.c
> index febc511..b6d93c8 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -565,6 +565,7 @@ asmlinkage void __init start_kernel(void)
> init_timers();
> hrtimers_init();
> softirq_init();
> + acpi_early_init();
> timekeeping_init();
> time_init();
> sched_clock_postinit();
> @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void)
>
> check_bugs();
>
> - acpi_early_init(); /* before LAPIC and SMP init */
> sfi_init_late();
>
> if (efi_enabled(EFI_RUNTIME_SERVICES)) {
>
>
> Thanks a lot!
> Joey Lee
>

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

2014-01-14 18:01:49

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode()

On 01/13/2014 08:09 PM, joeyli wrote:
>
> This patch works to me on Acer Gateway Z5WT2 UEFI notebook and Intel
> UEFI development board.
>
> Does it possible move acpi_early_init() to before timekeeping_init()?
> The position is also before efi_enter_virtual_mode() and that will be
> useful for parsing ACPI TAD to set system clock:
>
> diff --git a/init/main.c b/init/main.c
> index febc511..b6d93c8 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -565,6 +565,7 @@ asmlinkage void __init start_kernel(void)
> init_timers();
> hrtimers_init();
> softirq_init();
> + acpi_early_init();
> timekeeping_init();
> time_init();
> sched_clock_postinit();
> @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void)
>
> check_bugs();
>
> - acpi_early_init(); /* before LAPIC and SMP init */
> sfi_init_late();
>
> if (efi_enabled(EFI_RUNTIME_SERVICES)) {
>

Hi Toshi,

Could you try this variant, too? If this works as well then we end up
solving two problems in one patch...

-hpa


2014-01-14 20:38:32

by Toshi Kani

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode()

On Tue, 2014-01-14 at 10:00 -0800, H. Peter Anvin wrote:
> On 01/13/2014 08:09 PM, joeyli wrote:
> >
> > This patch works to me on Acer Gateway Z5WT2 UEFI notebook and Intel
> > UEFI development board.
> >
> > Does it possible move acpi_early_init() to before timekeeping_init()?
> > The position is also before efi_enter_virtual_mode() and that will be
> > useful for parsing ACPI TAD to set system clock:
> >
> > diff --git a/init/main.c b/init/main.c
> > index febc511..b6d93c8 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -565,6 +565,7 @@ asmlinkage void __init start_kernel(void)
> > init_timers();
> > hrtimers_init();
> > softirq_init();
> > + acpi_early_init();
> > timekeeping_init();
> > time_init();
> > sched_clock_postinit();
> > @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void)
> >
> > check_bugs();
> >
> > - acpi_early_init(); /* before LAPIC and SMP init */
> > sfi_init_late();
> >
> > if (efi_enabled(EFI_RUNTIME_SERVICES)) {
> >
>
> Hi Toshi,
>
> Could you try this variant, too? If this works as well then we end up
> solving two problems in one patch...

Hi Peter,

Yes, this version works fine as well.

Tested-by: Toshi Kani <[email protected]>

Thanks,
-Toshi

2014-01-15 07:20:00

by joeyli

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode()

於 二,2014-01-14 於 13:32 -0700,Toshi Kani 提到:
> > > + acpi_early_init();
> > > timekeeping_init();
> > > time_init();
> > > sched_clock_postinit();
> > > @@ -641,7 +642,6 @@ asmlinkage void __init start_kernel(void)
> > >
> > > check_bugs();
> > >
> > > - acpi_early_init(); /* before LAPIC and SMP init */
> > > sfi_init_late();
> > >
> > > if (efi_enabled(EFI_RUNTIME_SERVICES)) {
> > >
> >
> > Hi Toshi,
> >
> > Could you try this variant, too? If this works as well then we end
> up
> > solving two problems in one patch...
>
> Hi Peter,
>
> Yes, this version works fine as well.
>
> Tested-by: Toshi Kani <[email protected]>
>
> Thanks,
> -Toshi

Thanks a lot for your testing.

I will re-send a formal patch with changelog to everybody.

Regards
Joey Lee


2014-01-17 12:21:07

by Matt Fleming

[permalink] [raw]
Subject: Re: [RFT][PATCH] ACPI / init: Run acpi_early_init() before efi_enter_virtual_mode() (was: Re: [RFC PATCH 00/14] Support timezone of ACPI TAD and EFI TIME)

On Sun, 12 Jan, at 11:05:46AM, Matt Fleming wrote:
> On Sun, 12 Jan, at 01:30:23AM, Rafael J. Wysocki wrote:
> > On Saturday, December 21, 2013 12:21:48 PM Matt Fleming wrote:
> > > On Fri, 20 Dec, at 11:18:56PM, Rafael J. Wysocki wrote:
> > > >
> > > > I'm not sure 100%, but I *think* we need to do that with interrupts enabled.
> > > > At least after mm_init(), because it relies on things initialized there if I
> > > > remember correctly.
> > > >
> > > > From what I can tell at the moment, it might be possible to move it before
> > > > efi_enter_virtual_mode() if that would help.
> > >
> > > Actually yeah, that would be super useful, and I think we'd be able to
> > > get rid of the whole efi_late_init() stuff because we'd no longer need
> > > to hang on to the EFI_BOOT_SERVICES* regions after
> > > SetVirtualAddressMap().
> >
> > OK
> >
> > I don't see any adverse effects of the patch below on a couple of my test
> > boxes, but (a) they are Intel-based and (b) they are non-EFI, so it would be
> > good to give it a go on as many machines as reasonably possible.
>
> Thanks Rafael, I'll give this a spin on my test machines here.

(Sorry for replying so late)

As various other people have reported, this works fine.

--
Matt Fleming, Intel Open Source Technology Center