All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
@ 2015-12-15 16:59 ` Toshi Kani
  0 siblings, 0 replies; 14+ messages in thread
From: Toshi Kani @ 2015-12-15 16:59 UTC (permalink / raw)
  To: rjw, dan.j.williams
  Cc: elliott, linux-nvdimm, linux-acpi, linux-kernel, Toshi Kani

ACPI 6.0 defines NFIT table and new persistent memory types for
EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table (E820_PMEM).

setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
E820_PMEM for the e820_map table on x86 EFI platforms.  When EFI_STUB
is disabled, x86 kernels rely on the bootloader to perform this
conversion.

It was found that the upstream grub bootloader since 2012 has a bug
that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
which causes the kernel to use persistent memory ranges as regular
memory and corrupts the data in NVDIMM.

Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
This assures that ACPI_NFIT kernels are self-contained and are
protected from the upstream grub bug on x86.

Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.

References: http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
Reported-by: Robert Elliott <elliott@hpe.com>
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/Kconfig |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5eef4cb..5368baa 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -441,6 +441,7 @@ config ACPI_NFIT
 	depends on PHYS_ADDR_T_64BIT
 	depends on BLK_DEV
 	depends on ARCH_HAS_MMIO_FLUSH
+	depends on !X86 || (X86 && EFI_STUB)
 	select LIBNVDIMM
 	help
 	  Infrastructure to probe ACPI 6 compliant platforms for

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

* [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
@ 2015-12-15 16:59 ` Toshi Kani
  0 siblings, 0 replies; 14+ messages in thread
From: Toshi Kani @ 2015-12-15 16:59 UTC (permalink / raw)
  To: rjw, dan.j.williams
  Cc: elliott, linux-nvdimm, linux-acpi, linux-kernel, Toshi Kani

ACPI 6.0 defines NFIT table and new persistent memory types for
EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table (E820_PMEM).

setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
E820_PMEM for the e820_map table on x86 EFI platforms.  When EFI_STUB
is disabled, x86 kernels rely on the bootloader to perform this
conversion.

It was found that the upstream grub bootloader since 2012 has a bug
that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
which causes the kernel to use persistent memory ranges as regular
memory and corrupts the data in NVDIMM.

Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
This assures that ACPI_NFIT kernels are self-contained and are
protected from the upstream grub bug on x86.

Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.

References: http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
Reported-by: Robert Elliott <elliott@hpe.com>
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/Kconfig |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 5eef4cb..5368baa 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -441,6 +441,7 @@ config ACPI_NFIT
 	depends on PHYS_ADDR_T_64BIT
 	depends on BLK_DEV
 	depends on ARCH_HAS_MMIO_FLUSH
+	depends on !X86 || (X86 && EFI_STUB)
 	select LIBNVDIMM
 	help
 	  Infrastructure to probe ACPI 6 compliant platforms for

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
  2015-12-15 16:59 ` Toshi Kani
@ 2015-12-15 17:21   ` Dan Williams
  -1 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2015-12-15 17:21 UTC (permalink / raw)
  To: Toshi Kani
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm, Linux ACPI, linux-kernel

On Tue, Dec 15, 2015 at 8:59 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> ACPI 6.0 defines NFIT table and new persistent memory types for
> EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table (E820_PMEM).
>
> setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
> E820_PMEM for the e820_map table on x86 EFI platforms.  When EFI_STUB
> is disabled, x86 kernels rely on the bootloader to perform this
> conversion.
>
> It was found that the upstream grub bootloader since 2012 has a bug
> that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
> which causes the kernel to use persistent memory ranges as regular
> memory and corrupts the data in NVDIMM.
>
> Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
> This assures that ACPI_NFIT kernels are self-contained and are
> protected from the upstream grub bug on x86.
>
> Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
> pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.
>
> References: http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
> Reported-by: Robert Elliott <elliott@hpe.com>
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/acpi/Kconfig |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 5eef4cb..5368baa 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -441,6 +441,7 @@ config ACPI_NFIT
>         depends on PHYS_ADDR_T_64BIT
>         depends on BLK_DEV
>         depends on ARCH_HAS_MMIO_FLUSH
> +       depends on !X86 || (X86 && EFI_STUB)
>         select LIBNVDIMM
>         help
>           Infrastructure to probe ACPI 6 compliant platforms for

This seems wrong to me.

In general Kconfig "depends on" are only about compile-time code
dependency, not about working around random bugs in external projects.

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
@ 2015-12-15 17:21   ` Dan Williams
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2015-12-15 17:21 UTC (permalink / raw)
  To: Toshi Kani
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm@lists.01.org, Linux ACPI, linux-kernel

On Tue, Dec 15, 2015 at 8:59 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> ACPI 6.0 defines NFIT table and new persistent memory types for
> EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table (E820_PMEM).
>
> setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
> E820_PMEM for the e820_map table on x86 EFI platforms.  When EFI_STUB
> is disabled, x86 kernels rely on the bootloader to perform this
> conversion.
>
> It was found that the upstream grub bootloader since 2012 has a bug
> that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
> which causes the kernel to use persistent memory ranges as regular
> memory and corrupts the data in NVDIMM.
>
> Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
> This assures that ACPI_NFIT kernels are self-contained and are
> protected from the upstream grub bug on x86.
>
> Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
> pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.
>
> References: http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
> Reported-by: Robert Elliott <elliott@hpe.com>
> Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/acpi/Kconfig |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 5eef4cb..5368baa 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -441,6 +441,7 @@ config ACPI_NFIT
>         depends on PHYS_ADDR_T_64BIT
>         depends on BLK_DEV
>         depends on ARCH_HAS_MMIO_FLUSH
> +       depends on !X86 || (X86 && EFI_STUB)
>         select LIBNVDIMM
>         help
>           Infrastructure to probe ACPI 6 compliant platforms for

This seems wrong to me.

In general Kconfig "depends on" are only about compile-time code
dependency, not about working around random bugs in external projects.

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
  2015-12-15 17:21   ` Dan Williams
@ 2015-12-15 17:49     ` Toshi Kani
  -1 siblings, 0 replies; 14+ messages in thread
From: Toshi Kani @ 2015-12-15 17:49 UTC (permalink / raw)
  To: Dan Williams
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm, Linux ACPI, linux-kernel

On Tue, 2015-12-15 at 09:21 -0800, Dan Williams wrote:
> On Tue, Dec 15, 2015 at 8:59 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > ACPI 6.0 defines NFIT table and new persistent memory types for
> > EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table (E820_PMEM).
> > 
> > setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
> > E820_PMEM for the e820_map table on x86 EFI platforms.  When EFI_STUB
> > is disabled, x86 kernels rely on the bootloader to perform this
> > conversion.
> > 
> > It was found that the upstream grub bootloader since 2012 has a bug
> > that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
> > which causes the kernel to use persistent memory ranges as regular
> > memory and corrupts the data in NVDIMM.
> > 
> > Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
> > This assures that ACPI_NFIT kernels are self-contained and are
> > protected from the upstream grub bug on x86.
> > 
> > Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
> > pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.
> > 
> > References: 
> > http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
> > Reported-by: Robert Elliott <elliott@hpe.com>
> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > ---
> >  drivers/acpi/Kconfig |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index 5eef4cb..5368baa 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -441,6 +441,7 @@ config ACPI_NFIT
> >         depends on PHYS_ADDR_T_64BIT
> >         depends on BLK_DEV
> >         depends on ARCH_HAS_MMIO_FLUSH
> > +       depends on !X86 || (X86 && EFI_STUB)
> >         select LIBNVDIMM
> >         help
> >           Infrastructure to probe ACPI 6 compliant platforms for
> 
> This seems wrong to me.
> 
> In general Kconfig "depends on" are only about compile-time code
> dependency, not about working around random bugs in external projects.

I agree that they do not have a compile dependency, and it looks rather
odd.  On the other hand, proper support of the ACPI NFIT extensions has a
functional dependency to setup_e820() as this is the only code that can
handle the EFI_PERSISTENT_MEMORY type today.

Thanks,
-Toshi

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
@ 2015-12-15 17:49     ` Toshi Kani
  0 siblings, 0 replies; 14+ messages in thread
From: Toshi Kani @ 2015-12-15 17:49 UTC (permalink / raw)
  To: Dan Williams
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm@lists.01.org, Linux ACPI, linux-kernel

On Tue, 2015-12-15 at 09:21 -0800, Dan Williams wrote:
> On Tue, Dec 15, 2015 at 8:59 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > ACPI 6.0 defines NFIT table and new persistent memory types for
> > EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table (E820_PMEM).
> > 
> > setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
> > E820_PMEM for the e820_map table on x86 EFI platforms.  When EFI_STUB
> > is disabled, x86 kernels rely on the bootloader to perform this
> > conversion.
> > 
> > It was found that the upstream grub bootloader since 2012 has a bug
> > that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
> > which causes the kernel to use persistent memory ranges as regular
> > memory and corrupts the data in NVDIMM.
> > 
> > Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
> > This assures that ACPI_NFIT kernels are self-contained and are
> > protected from the upstream grub bug on x86.
> > 
> > Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
> > pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.
> > 
> > References: 
> > http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
> > Reported-by: Robert Elliott <elliott@hpe.com>
> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > ---
> >  drivers/acpi/Kconfig |    1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index 5eef4cb..5368baa 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -441,6 +441,7 @@ config ACPI_NFIT
> >         depends on PHYS_ADDR_T_64BIT
> >         depends on BLK_DEV
> >         depends on ARCH_HAS_MMIO_FLUSH
> > +       depends on !X86 || (X86 && EFI_STUB)
> >         select LIBNVDIMM
> >         help
> >           Infrastructure to probe ACPI 6 compliant platforms for
> 
> This seems wrong to me.
> 
> In general Kconfig "depends on" are only about compile-time code
> dependency, not about working around random bugs in external projects.

I agree that they do not have a compile dependency, and it looks rather
odd.  On the other hand, proper support of the ACPI NFIT extensions has a
functional dependency to setup_e820() as this is the only code that can
handle the EFI_PERSISTENT_MEMORY type today.

Thanks,
-Toshi

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
  2015-12-15 17:49     ` Toshi Kani
@ 2015-12-15 17:53       ` Dan Williams
  -1 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2015-12-15 17:53 UTC (permalink / raw)
  To: Toshi Kani
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm, Linux ACPI, linux-kernel

On Tue, Dec 15, 2015 at 9:49 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> On Tue, 2015-12-15 at 09:21 -0800, Dan Williams wrote:
>> On Tue, Dec 15, 2015 at 8:59 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
>> > ACPI 6.0 defines NFIT table and new persistent memory types for
>> > EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table (E820_PMEM).
>> >
>> > setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
>> > E820_PMEM for the e820_map table on x86 EFI platforms.  When EFI_STUB
>> > is disabled, x86 kernels rely on the bootloader to perform this
>> > conversion.
>> >
>> > It was found that the upstream grub bootloader since 2012 has a bug
>> > that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
>> > which causes the kernel to use persistent memory ranges as regular
>> > memory and corrupts the data in NVDIMM.
>> >
>> > Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
>> > This assures that ACPI_NFIT kernels are self-contained and are
>> > protected from the upstream grub bug on x86.
>> >
>> > Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
>> > pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.
>> >
>> > References:
>> > http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
>> > Reported-by: Robert Elliott <elliott@hpe.com>
>> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
>> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
>> > Cc: Dan Williams <dan.j.williams@intel.com>
>> > ---
>> >  drivers/acpi/Kconfig |    1 +
>> >  1 file changed, 1 insertion(+)
>> >
>> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>> > index 5eef4cb..5368baa 100644
>> > --- a/drivers/acpi/Kconfig
>> > +++ b/drivers/acpi/Kconfig
>> > @@ -441,6 +441,7 @@ config ACPI_NFIT
>> >         depends on PHYS_ADDR_T_64BIT
>> >         depends on BLK_DEV
>> >         depends on ARCH_HAS_MMIO_FLUSH
>> > +       depends on !X86 || (X86 && EFI_STUB)
>> >         select LIBNVDIMM
>> >         help
>> >           Infrastructure to probe ACPI 6 compliant platforms for
>>
>> This seems wrong to me.
>>
>> In general Kconfig "depends on" are only about compile-time code
>> dependency, not about working around random bugs in external projects.
>
> I agree that they do not have a compile dependency, and it looks rather
> odd.  On the other hand, proper support of the ACPI NFIT extensions has a
> functional dependency to setup_e820() as this is the only code that can
> handle the EFI_PERSISTENT_MEMORY type today.

What about non-EFI/legeacy-boot systems that only emit e820-type-7?
We lose support for them with this patch, right?

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
@ 2015-12-15 17:53       ` Dan Williams
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2015-12-15 17:53 UTC (permalink / raw)
  To: Toshi Kani
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm@lists.01.org, Linux ACPI, linux-kernel

On Tue, Dec 15, 2015 at 9:49 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> On Tue, 2015-12-15 at 09:21 -0800, Dan Williams wrote:
>> On Tue, Dec 15, 2015 at 8:59 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
>> > ACPI 6.0 defines NFIT table and new persistent memory types for
>> > EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table (E820_PMEM).
>> >
>> > setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
>> > E820_PMEM for the e820_map table on x86 EFI platforms.  When EFI_STUB
>> > is disabled, x86 kernels rely on the bootloader to perform this
>> > conversion.
>> >
>> > It was found that the upstream grub bootloader since 2012 has a bug
>> > that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
>> > which causes the kernel to use persistent memory ranges as regular
>> > memory and corrupts the data in NVDIMM.
>> >
>> > Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
>> > This assures that ACPI_NFIT kernels are self-contained and are
>> > protected from the upstream grub bug on x86.
>> >
>> > Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
>> > pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.
>> >
>> > References:
>> > http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
>> > Reported-by: Robert Elliott <elliott@hpe.com>
>> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
>> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
>> > Cc: Dan Williams <dan.j.williams@intel.com>
>> > ---
>> >  drivers/acpi/Kconfig |    1 +
>> >  1 file changed, 1 insertion(+)
>> >
>> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>> > index 5eef4cb..5368baa 100644
>> > --- a/drivers/acpi/Kconfig
>> > +++ b/drivers/acpi/Kconfig
>> > @@ -441,6 +441,7 @@ config ACPI_NFIT
>> >         depends on PHYS_ADDR_T_64BIT
>> >         depends on BLK_DEV
>> >         depends on ARCH_HAS_MMIO_FLUSH
>> > +       depends on !X86 || (X86 && EFI_STUB)
>> >         select LIBNVDIMM
>> >         help
>> >           Infrastructure to probe ACPI 6 compliant platforms for
>>
>> This seems wrong to me.
>>
>> In general Kconfig "depends on" are only about compile-time code
>> dependency, not about working around random bugs in external projects.
>
> I agree that they do not have a compile dependency, and it looks rather
> odd.  On the other hand, proper support of the ACPI NFIT extensions has a
> functional dependency to setup_e820() as this is the only code that can
> handle the EFI_PERSISTENT_MEMORY type today.

What about non-EFI/legeacy-boot systems that only emit e820-type-7?
We lose support for them with this patch, right?

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
  2015-12-15 17:53       ` Dan Williams
@ 2015-12-15 17:56         ` Toshi Kani
  -1 siblings, 0 replies; 14+ messages in thread
From: Toshi Kani @ 2015-12-15 17:56 UTC (permalink / raw)
  To: Dan Williams
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm, Linux ACPI, linux-kernel

On Tue, 2015-12-15 at 09:53 -0800, Dan Williams wrote:
> On Tue, Dec 15, 2015 at 9:49 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > On Tue, 2015-12-15 at 09:21 -0800, Dan Williams wrote:
> > > On Tue, Dec 15, 2015 at 8:59 AM, Toshi Kani <toshi.kani@hpe.com>
> > > wrote:
> > > > ACPI 6.0 defines NFIT table and new persistent memory types for
> > > > EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table
> > > > (E820_PMEM).
> > > > 
> > > > setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
> > > > E820_PMEM for the e820_map table on x86 EFI platforms.  When
> > > > EFI_STUB
> > > > is disabled, x86 kernels rely on the bootloader to perform this
> > > > conversion.
> > > > 
> > > > It was found that the upstream grub bootloader since 2012 has a bug
> > > > that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
> > > > which causes the kernel to use persistent memory ranges as regular
> > > > memory and corrupts the data in NVDIMM.
> > > > 
> > > > Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
> > > > This assures that ACPI_NFIT kernels are self-contained and are
> > > > protected from the upstream grub bug on x86.
> > > > 
> > > > Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
> > > > pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.
> > > > 
> > > > References:
> > > > http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
> > > > Reported-by: Robert Elliott <elliott@hpe.com>
> > > > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > > > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> > > > Cc: Dan Williams <dan.j.williams@intel.com>
> > > > ---
> > > >  drivers/acpi/Kconfig |    1 +
> > > >  1 file changed, 1 insertion(+)
> > > > 
> > > > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > > > index 5eef4cb..5368baa 100644
> > > > --- a/drivers/acpi/Kconfig
> > > > +++ b/drivers/acpi/Kconfig
> > > > @@ -441,6 +441,7 @@ config ACPI_NFIT
> > > >         depends on PHYS_ADDR_T_64BIT
> > > >         depends on BLK_DEV
> > > >         depends on ARCH_HAS_MMIO_FLUSH
> > > > +       depends on !X86 || (X86 && EFI_STUB)
> > > >         select LIBNVDIMM
> > > >         help
> > > >           Infrastructure to probe ACPI 6 compliant platforms for
> > > 
> > > This seems wrong to me.
> > > 
> > > In general Kconfig "depends on" are only about compile-time code
> > > dependency, not about working around random bugs in external
> > > projects.
> > 
> > I agree that they do not have a compile dependency, and it looks rather
> > odd.  On the other hand, proper support of the ACPI NFIT extensions has
> > a
> > functional dependency to setup_e820() as this is the only code that can
> > handle the EFI_PERSISTENT_MEMORY type today.
> 
> What about non-EFI/legeacy-boot systems that only emit e820-type-7?
> We lose support for them with this patch, right?

No, having EFI_STUB does not break the legacy BIOS boot.

Thanks,
-Toshi


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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
@ 2015-12-15 17:56         ` Toshi Kani
  0 siblings, 0 replies; 14+ messages in thread
From: Toshi Kani @ 2015-12-15 17:56 UTC (permalink / raw)
  To: Dan Williams
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm@lists.01.org, Linux ACPI, linux-kernel

On Tue, 2015-12-15 at 09:53 -0800, Dan Williams wrote:
> On Tue, Dec 15, 2015 at 9:49 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > On Tue, 2015-12-15 at 09:21 -0800, Dan Williams wrote:
> > > On Tue, Dec 15, 2015 at 8:59 AM, Toshi Kani <toshi.kani@hpe.com>
> > > wrote:
> > > > ACPI 6.0 defines NFIT table and new persistent memory types for
> > > > EFI memory table (EFI_PERSISTENT_MEMORY) and e820 table
> > > > (E820_PMEM).
> > > > 
> > > > setup_e820() enabled by EFI_STUB converts EFI_PERSISTENT_MEMORY to
> > > > E820_PMEM for the e820_map table on x86 EFI platforms.  When
> > > > EFI_STUB
> > > > is disabled, x86 kernels rely on the bootloader to perform this
> > > > conversion.
> > > > 
> > > > It was found that the upstream grub bootloader since 2012 has a bug
> > > > that converts EFI_PERSISTENT_MEMORY (or any new type) to E820_RAM,
> > > > which causes the kernel to use persistent memory ranges as regular
> > > > memory and corrupts the data in NVDIMM.
> > > > 
> > > > Therefore, this patch sets ACPI_NFIT to depend on EFI_STUB on x86.
> > > > This assures that ACPI_NFIT kernels are self-contained and are
> > > > protected from the upstream grub bug on x86.
> > > > 
> > > > Note, X86_PMEM_LEGACY allows the kernel to use the pmem driver on
> > > > pre-ACPI 6.0 platforms, and does not require ACPI_NFIT enabled.
> > > > 
> > > > References:
> > > > http://www.mail-archive.com/grub-devel@gnu.org/msg23961.html
> > > > Reported-by: Robert Elliott <elliott@hpe.com>
> > > > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > > > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> > > > Cc: Dan Williams <dan.j.williams@intel.com>
> > > > ---
> > > >  drivers/acpi/Kconfig |    1 +
> > > >  1 file changed, 1 insertion(+)
> > > > 
> > > > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > > > index 5eef4cb..5368baa 100644
> > > > --- a/drivers/acpi/Kconfig
> > > > +++ b/drivers/acpi/Kconfig
> > > > @@ -441,6 +441,7 @@ config ACPI_NFIT
> > > >         depends on PHYS_ADDR_T_64BIT
> > > >         depends on BLK_DEV
> > > >         depends on ARCH_HAS_MMIO_FLUSH
> > > > +       depends on !X86 || (X86 && EFI_STUB)
> > > >         select LIBNVDIMM
> > > >         help
> > > >           Infrastructure to probe ACPI 6 compliant platforms for
> > > 
> > > This seems wrong to me.
> > > 
> > > In general Kconfig "depends on" are only about compile-time code
> > > dependency, not about working around random bugs in external
> > > projects.
> > 
> > I agree that they do not have a compile dependency, and it looks rather
> > odd.  On the other hand, proper support of the ACPI NFIT extensions has
> > a
> > functional dependency to setup_e820() as this is the only code that can
> > handle the EFI_PERSISTENT_MEMORY type today.
> 
> What about non-EFI/legeacy-boot systems that only emit e820-type-7?
> We lose support for them with this patch, right?

No, having EFI_STUB does not break the legacy BIOS boot.

Thanks,
-Toshi


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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
  2015-12-15 17:56         ` Toshi Kani
@ 2015-12-15 18:05           ` Dan Williams
  -1 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2015-12-15 18:05 UTC (permalink / raw)
  To: Toshi Kani
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm, Linux ACPI, linux-kernel

On Tue, Dec 15, 2015 at 9:56 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> On Tue, 2015-12-15 at 09:53 -0800, Dan Williams wrote:
[..]
>> > > > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>> > > > index 5eef4cb..5368baa 100644
>> > > > --- a/drivers/acpi/Kconfig
>> > > > +++ b/drivers/acpi/Kconfig
>> > > > @@ -441,6 +441,7 @@ config ACPI_NFIT
>> > > >         depends on PHYS_ADDR_T_64BIT
>> > > >         depends on BLK_DEV
>> > > >         depends on ARCH_HAS_MMIO_FLUSH
>> > > > +       depends on !X86 || (X86 && EFI_STUB)
>> > > >         select LIBNVDIMM
>> > > >         help
>> > > >           Infrastructure to probe ACPI 6 compliant platforms for
>> > >
>> > > This seems wrong to me.
>> > >
>> > > In general Kconfig "depends on" are only about compile-time code
>> > > dependency, not about working around random bugs in external
>> > > projects.
>> >
>> > I agree that they do not have a compile dependency, and it looks rather
>> > odd.  On the other hand, proper support of the ACPI NFIT extensions has
>> > a
>> > functional dependency to setup_e820() as this is the only code that can
>> > handle the EFI_PERSISTENT_MEMORY type today.
>>
>> What about non-EFI/legeacy-boot systems that only emit e820-type-7?
>> We lose support for them with this patch, right?
>
> No, having EFI_STUB does not break the legacy BIOS boot.
>

Sorry let me clarify.  A kernel compiled without EFI_STUB loses NFIT
support.  Non-EFI and legacy-boot systems don't have this grub bug to
worry about, so the dependency is overly restrictive, "breaks", those
environments.

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
@ 2015-12-15 18:05           ` Dan Williams
  0 siblings, 0 replies; 14+ messages in thread
From: Dan Williams @ 2015-12-15 18:05 UTC (permalink / raw)
  To: Toshi Kani
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm@lists.01.org, Linux ACPI, linux-kernel

On Tue, Dec 15, 2015 at 9:56 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> On Tue, 2015-12-15 at 09:53 -0800, Dan Williams wrote:
[..]
>> > > > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>> > > > index 5eef4cb..5368baa 100644
>> > > > --- a/drivers/acpi/Kconfig
>> > > > +++ b/drivers/acpi/Kconfig
>> > > > @@ -441,6 +441,7 @@ config ACPI_NFIT
>> > > >         depends on PHYS_ADDR_T_64BIT
>> > > >         depends on BLK_DEV
>> > > >         depends on ARCH_HAS_MMIO_FLUSH
>> > > > +       depends on !X86 || (X86 && EFI_STUB)
>> > > >         select LIBNVDIMM
>> > > >         help
>> > > >           Infrastructure to probe ACPI 6 compliant platforms for
>> > >
>> > > This seems wrong to me.
>> > >
>> > > In general Kconfig "depends on" are only about compile-time code
>> > > dependency, not about working around random bugs in external
>> > > projects.
>> >
>> > I agree that they do not have a compile dependency, and it looks rather
>> > odd.  On the other hand, proper support of the ACPI NFIT extensions has
>> > a
>> > functional dependency to setup_e820() as this is the only code that can
>> > handle the EFI_PERSISTENT_MEMORY type today.
>>
>> What about non-EFI/legeacy-boot systems that only emit e820-type-7?
>> We lose support for them with this patch, right?
>
> No, having EFI_STUB does not break the legacy BIOS boot.
>

Sorry let me clarify.  A kernel compiled without EFI_STUB loses NFIT
support.  Non-EFI and legacy-boot systems don't have this grub bug to
worry about, so the dependency is overly restrictive, "breaks", those
environments.

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
  2015-12-15 18:05           ` Dan Williams
@ 2015-12-15 20:04             ` Toshi Kani
  -1 siblings, 0 replies; 14+ messages in thread
From: Toshi Kani @ 2015-12-15 20:04 UTC (permalink / raw)
  To: Dan Williams
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm, Linux ACPI, linux-kernel

On Tue, 2015-12-15 at 10:05 -0800, Dan Williams wrote:
> On Tue, Dec 15, 2015 at 9:56 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > On Tue, 2015-12-15 at 09:53 -0800, Dan Williams wrote:
> [..]
> > > > > > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > > > > > index 5eef4cb..5368baa 100644
> > > > > > --- a/drivers/acpi/Kconfig
> > > > > > +++ b/drivers/acpi/Kconfig
> > > > > > @@ -441,6 +441,7 @@ config ACPI_NFIT
> > > > > >         depends on PHYS_ADDR_T_64BIT
> > > > > >         depends on BLK_DEV
> > > > > >         depends on ARCH_HAS_MMIO_FLUSH
> > > > > > +       depends on !X86 || (X86 && EFI_STUB)
> > > > > >         select LIBNVDIMM
> > > > > >         help
> > > > > >           Infrastructure to probe ACPI 6 compliant platforms
> > > > > > for
> > > > > 
> > > > > This seems wrong to me.
> > > > > 
> > > > > In general Kconfig "depends on" are only about compile-time code
> > > > > dependency, not about working around random bugs in external
> > > > > projects.
> > > > 
> > > > I agree that they do not have a compile dependency, and it looks 
> > > > rather odd.  On the other hand, proper support of the ACPI NFIT 
> > > > extensions has a functional dependency to setup_e820() as this is 
> > > > the only code that can handle the EFI_PERSISTENT_MEMORY type today.
> > > 
> > > What about non-EFI/legeacy-boot systems that only emit e820-type-7?
> > > We lose support for them with this patch, right?
> > 
> > No, having EFI_STUB does not break the legacy BIOS boot.
> > 
> 
> Sorry let me clarify.  A kernel compiled without EFI_STUB loses NFIT
> support.  

I think it is the other way around.  When NFIT is needed, one will enable
all dependent options.  So, an NFIT kernel will have to have EFI code as a
result, even though it runs on the legacy BIOS.  I believe distributed
kernels enable EFI already so that they run on both legacy and EFI
platforms.  Of course, one may wish to build a smallest kernel specific to
NFIT & legacy BIOS platforms and want to disable EFI code, but that seems
to be a special case to me.

> Non-EFI and legacy-boot systems don't have this grub bug to
> worry about, so the dependency is overly restrictive, "breaks", those
> environments.

Yes, we do not have the grub bug on legacy BIOS (although PMEM ranges will
show up as Reserved in the iomem table).  I do not think NFIT being
dependent on EFI is overly restrictive, but I may be wrong and I agree to
drop this patch if that is indeed the case.

Thanks,
-Toshi

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

* Re: [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86
@ 2015-12-15 20:04             ` Toshi Kani
  0 siblings, 0 replies; 14+ messages in thread
From: Toshi Kani @ 2015-12-15 20:04 UTC (permalink / raw)
  To: Dan Williams
  Cc: Rafael J. Wysocki, Elliott, Robert (Persistent Memory),
	linux-nvdimm@lists.01.org, Linux ACPI, linux-kernel

On Tue, 2015-12-15 at 10:05 -0800, Dan Williams wrote:
> On Tue, Dec 15, 2015 at 9:56 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > On Tue, 2015-12-15 at 09:53 -0800, Dan Williams wrote:
> [..]
> > > > > > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > > > > > index 5eef4cb..5368baa 100644
> > > > > > --- a/drivers/acpi/Kconfig
> > > > > > +++ b/drivers/acpi/Kconfig
> > > > > > @@ -441,6 +441,7 @@ config ACPI_NFIT
> > > > > >         depends on PHYS_ADDR_T_64BIT
> > > > > >         depends on BLK_DEV
> > > > > >         depends on ARCH_HAS_MMIO_FLUSH
> > > > > > +       depends on !X86 || (X86 && EFI_STUB)
> > > > > >         select LIBNVDIMM
> > > > > >         help
> > > > > >           Infrastructure to probe ACPI 6 compliant platforms
> > > > > > for
> > > > > 
> > > > > This seems wrong to me.
> > > > > 
> > > > > In general Kconfig "depends on" are only about compile-time code
> > > > > dependency, not about working around random bugs in external
> > > > > projects.
> > > > 
> > > > I agree that they do not have a compile dependency, and it looks 
> > > > rather odd.  On the other hand, proper support of the ACPI NFIT 
> > > > extensions has a functional dependency to setup_e820() as this is 
> > > > the only code that can handle the EFI_PERSISTENT_MEMORY type today.
> > > 
> > > What about non-EFI/legeacy-boot systems that only emit e820-type-7?
> > > We lose support for them with this patch, right?
> > 
> > No, having EFI_STUB does not break the legacy BIOS boot.
> > 
> 
> Sorry let me clarify.  A kernel compiled without EFI_STUB loses NFIT
> support.  

I think it is the other way around.  When NFIT is needed, one will enable
all dependent options.  So, an NFIT kernel will have to have EFI code as a
result, even though it runs on the legacy BIOS.  I believe distributed
kernels enable EFI already so that they run on both legacy and EFI
platforms.  Of course, one may wish to build a smallest kernel specific to
NFIT & legacy BIOS platforms and want to disable EFI code, but that seems
to be a special case to me.

> Non-EFI and legacy-boot systems don't have this grub bug to
> worry about, so the dependency is overly restrictive, "breaks", those
> environments.

Yes, we do not have the grub bug on legacy BIOS (although PMEM ranges will
show up as Reserved in the iomem table).  I do not think NFIT being
dependent on EFI is overly restrictive, but I may be wrong and I agree to
drop this patch if that is indeed the case.

Thanks,
-Toshi

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

end of thread, other threads:[~2015-12-15 20:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-15 16:59 [PATCH RESEND] ACPI/Kconfig: Make ACPI_NFIT depend on EFI_STUB on X86 Toshi Kani
2015-12-15 16:59 ` Toshi Kani
2015-12-15 17:21 ` Dan Williams
2015-12-15 17:21   ` Dan Williams
2015-12-15 17:49   ` Toshi Kani
2015-12-15 17:49     ` Toshi Kani
2015-12-15 17:53     ` Dan Williams
2015-12-15 17:53       ` Dan Williams
2015-12-15 17:56       ` Toshi Kani
2015-12-15 17:56         ` Toshi Kani
2015-12-15 18:05         ` Dan Williams
2015-12-15 18:05           ` Dan Williams
2015-12-15 20:04           ` Toshi Kani
2015-12-15 20:04             ` Toshi Kani

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.