linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/10] EFI updates for v4.11
@ 2017-01-31 13:21 Ard Biesheuvel
  2017-01-31 13:21 ` [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code Ard Biesheuvel
  0 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2017-01-31 13:21 UTC (permalink / raw)
  To: linux-kernel, Ingo Molnar, Thomas Gleixner, H . Peter Anvin
  Cc: Ard Biesheuvel, linux-efi, Bhupesh Sharma, Borislav Petkov,
	Colin Ian King, Dave Young, Fenghua Yu, Lee, Chun-Yi, Len Brown,
	linux-acpi, Lukas Wunner, Matt Fleming, Nicolai Stange,
	Rafael J. Wysocki, Ravi Shankar, Ricardo Neri,
	Sai Praneeth Prakhya

The following changes since commit 49def1853334396f948dcb4cedb9347abb318df5:

  Linux 4.10-rc4 (2017-01-15 16:21:59 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-next

for you to fetch changes up to 39d6b56c4c2a41cf4d11c720c05c1396b74920a0:

  efi: libstub: Preserve .debug sections after absolute relocation check (2017-01-31 13:11:19 +0000)

NOTE: the BGRT patch touches drivers/acpi, but lacks an ack from the ACPI
      maintainers. They have been cc'ed on the patch (and on this pull
      request).

----------------------------------------------------------------
* Wire up the UEFI memory attributes table for x86. This eliminates any
  runtime memory regions that are both writable and executable on recent
  firmware versions. (Sai Praneeth)

* Move the BGRT init code to an earlier stage so that we can still use
  efi_mem_reserve() (Dave Young)

* Preserve debug symbols in the ARM/arm64 UEFI stub (Ard)

* Some deduplication work and various other cleanups

----------------------------------------------------------------
Ard Biesheuvel (2):
      efi: Use typed function pointers for runtime services table
      efi: libstub: Preserve .debug sections after absolute relocation check

Colin Ian King (1):
      efi/esrt: Fix spelling mistake "doen't"

Dave Young (2):
      efi/x86: Move EFI BGRT init code to early init code
      efi/x86: Add debug code to print cooked memmap

Lukas Wunner (2):
      efi: Deduplicate efi_file_size() / _read() / _close()
      x86/efi: Deduplicate efi_char16_printk()

Sai Praneeth (3):
      efi: Make EFI_MEMORY_ATTRIBUTES_TABLE initialization common across all architectures
      efi: Introduce EFI_MEM_ATTR bit and set it from memory attributes table
      x86/efi: Add support for EFI_MEMORY_ATTRIBUTES_TABLE

 arch/x86/boot/compressed/eboot.c               | 174 +------------------------
 arch/x86/kernel/acpi/boot.c                    |   9 ++
 arch/x86/platform/efi/efi-bgrt.c               |  59 ++++-----
 arch/x86/platform/efi/efi.c                    |  10 +-
 arch/x86/platform/efi/efi_64.c                 |  64 +++++++--
 drivers/acpi/bgrt.c                            |  28 ++--
 drivers/firmware/efi/arm-init.c                |   1 -
 drivers/firmware/efi/efi.c                     |   2 +
 drivers/firmware/efi/esrt.c                    |   2 +-
 drivers/firmware/efi/libstub/Makefile          |  24 ++--
 drivers/firmware/efi/libstub/arm-stub.c        |  69 ----------
 drivers/firmware/efi/libstub/efi-stub-helper.c |  63 +++++++++
 drivers/firmware/efi/libstub/efistub.h         |   8 --
 drivers/firmware/efi/memattr.c                 |   6 +-
 include/linux/efi-bgrt.h                       |  11 +-
 include/linux/efi.h                            |  45 +++----
 init/main.c                                    |   1 -
 17 files changed, 230 insertions(+), 346 deletions(-)

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

* [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code
  2017-01-31 13:21 [GIT PULL 00/10] EFI updates for v4.11 Ard Biesheuvel
@ 2017-01-31 13:21 ` Ard Biesheuvel
  2017-05-13 23:18   ` Sabrina Dubroca
  0 siblings, 1 reply; 7+ messages in thread
From: Ard Biesheuvel @ 2017-01-31 13:21 UTC (permalink / raw)
  To: linux-kernel, Ingo Molnar, Thomas Gleixner, H . Peter Anvin
  Cc: Dave Young, Ard Biesheuvel, linux-efi, Matt Fleming,
	Rafael J. Wysocki, Len Brown, linux-acpi

From: Dave Young <dyoung@redhat.com>

Before invoking the arch specific handler, efi_mem_reserve() reserves
the given memory region through memblock.

efi_bgrt_init() will call efi_mem_reserve() after mm_init(), at which
time memblock is dead and should not be used anymore.

The EFI BGRT code depends on ACPI initialization to get the BGRT ACPI
table, so move parsing of the BGRT table to ACPI early boot code to
ensure that efi_mem_reserve() in EFI BGRT code still use memblock safely.

Signed-off-by: Dave Young <dyoung@redhat.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/x86/kernel/acpi/boot.c      |  9 ++++++
 arch/x86/platform/efi/efi-bgrt.c | 59 +++++++++++++++++-----------------------
 arch/x86/platform/efi/efi.c      |  5 ----
 drivers/acpi/bgrt.c              | 28 +++++++++++++------
 include/linux/efi-bgrt.h         | 11 ++++----
 init/main.c                      |  1 -
 6 files changed, 59 insertions(+), 54 deletions(-)

diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 64422f850e95..7ff007ed899d 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -35,6 +35,7 @@
 #include <linux/bootmem.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
+#include <linux/efi-bgrt.h>
 
 #include <asm/irqdomain.h>
 #include <asm/pci_x86.h>
@@ -1557,6 +1558,12 @@ int __init early_acpi_boot_init(void)
 	return 0;
 }
 
+static int __init acpi_parse_bgrt(struct acpi_table_header *table)
+{
+	efi_bgrt_init(table);
+	return 0;
+}
+
 int __init acpi_boot_init(void)
 {
 	/* those are executed after early-quirks are executed */
@@ -1581,6 +1588,8 @@ int __init acpi_boot_init(void)
 	acpi_process_madt();
 
 	acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
+	if (IS_ENABLED(CONFIG_ACPI_BGRT))
+		acpi_table_parse(ACPI_SIG_BGRT, acpi_parse_bgrt);
 
 	if (!acpi_noirq)
 		x86_init.pci.init = pci_acpi_init;
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index 6aad870e8962..04ca8764f0c0 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -19,8 +19,7 @@
 #include <linux/efi.h>
 #include <linux/efi-bgrt.h>
 
-struct acpi_table_bgrt *bgrt_tab;
-void *__initdata bgrt_image;
+struct acpi_table_bgrt bgrt_tab;
 size_t __initdata bgrt_image_size;
 
 struct bmp_header {
@@ -28,66 +27,58 @@ struct bmp_header {
 	u32 size;
 } __packed;
 
-void __init efi_bgrt_init(void)
+void __init efi_bgrt_init(struct acpi_table_header *table)
 {
-	acpi_status status;
 	void *image;
 	struct bmp_header bmp_header;
+	struct acpi_table_bgrt *bgrt = &bgrt_tab;
 
 	if (acpi_disabled)
 		return;
 
-	status = acpi_get_table("BGRT", 0,
-	                        (struct acpi_table_header **)&bgrt_tab);
-	if (ACPI_FAILURE(status))
-		return;
-
-	if (bgrt_tab->header.length < sizeof(*bgrt_tab)) {
+	if (table->length < sizeof(bgrt_tab)) {
 		pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
-		       bgrt_tab->header.length, sizeof(*bgrt_tab));
+		       table->length, sizeof(bgrt_tab));
 		return;
 	}
-	if (bgrt_tab->version != 1) {
+	*bgrt = *(struct acpi_table_bgrt *)table;
+	if (bgrt->version != 1) {
 		pr_notice("Ignoring BGRT: invalid version %u (expected 1)\n",
-		       bgrt_tab->version);
-		return;
+		       bgrt->version);
+		goto out;
 	}
-	if (bgrt_tab->status & 0xfe) {
+	if (bgrt->status & 0xfe) {
 		pr_notice("Ignoring BGRT: reserved status bits are non-zero %u\n",
-		       bgrt_tab->status);
-		return;
+		       bgrt->status);
+		goto out;
 	}
-	if (bgrt_tab->image_type != 0) {
+	if (bgrt->image_type != 0) {
 		pr_notice("Ignoring BGRT: invalid image type %u (expected 0)\n",
-		       bgrt_tab->image_type);
-		return;
+		       bgrt->image_type);
+		goto out;
 	}
-	if (!bgrt_tab->image_address) {
+	if (!bgrt->image_address) {
 		pr_notice("Ignoring BGRT: null image address\n");
-		return;
+		goto out;
 	}
 
-	image = memremap(bgrt_tab->image_address, sizeof(bmp_header), MEMREMAP_WB);
+	image = early_memremap(bgrt->image_address, sizeof(bmp_header));
 	if (!image) {
 		pr_notice("Ignoring BGRT: failed to map image header memory\n");
-		return;
+		goto out;
 	}
 
 	memcpy(&bmp_header, image, sizeof(bmp_header));
-	memunmap(image);
+	early_memunmap(image, sizeof(bmp_header));
 	if (bmp_header.id != 0x4d42) {
 		pr_notice("Ignoring BGRT: Incorrect BMP magic number 0x%x (expected 0x4d42)\n",
 			bmp_header.id);
-		return;
+		goto out;
 	}
 	bgrt_image_size = bmp_header.size;
+	efi_mem_reserve(bgrt->image_address, bgrt_image_size);
 
-	bgrt_image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
-	if (!bgrt_image) {
-		pr_notice("Ignoring BGRT: failed to map image memory\n");
-		bgrt_image = NULL;
-		return;
-	}
-
-	efi_mem_reserve(bgrt_tab->image_address, bgrt_image_size);
+	return;
+out:
+	memset(bgrt, 0, sizeof(bgrt_tab));
 }
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 274dfc481849..0d4becfc5145 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -542,11 +542,6 @@ void __init efi_init(void)
 		efi_print_memmap();
 }
 
-void __init efi_late_init(void)
-{
-	efi_bgrt_init();
-}
-
 void __init efi_set_executable(efi_memory_desc_t *md, bool executable)
 {
 	u64 addr, npages;
diff --git a/drivers/acpi/bgrt.c b/drivers/acpi/bgrt.c
index 75f128e766a9..ca28aa572aa9 100644
--- a/drivers/acpi/bgrt.c
+++ b/drivers/acpi/bgrt.c
@@ -15,40 +15,41 @@
 #include <linux/sysfs.h>
 #include <linux/efi-bgrt.h>
 
+static void *bgrt_image;
 static struct kobject *bgrt_kobj;
 
 static ssize_t show_version(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->version);
+	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.version);
 }
 static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
 
 static ssize_t show_status(struct device *dev,
 			   struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->status);
+	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.status);
 }
 static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
 
 static ssize_t show_type(struct device *dev,
 			 struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_type);
+	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_type);
 }
 static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
 
 static ssize_t show_xoffset(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_offset_x);
+	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_x);
 }
 static DEVICE_ATTR(xoffset, S_IRUGO, show_xoffset, NULL);
 
 static ssize_t show_yoffset(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_offset_y);
+	return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab.image_offset_y);
 }
 static DEVICE_ATTR(yoffset, S_IRUGO, show_yoffset, NULL);
 
@@ -84,15 +85,24 @@ static int __init bgrt_init(void)
 {
 	int ret;
 
-	if (!bgrt_image)
+	if (!bgrt_tab.image_address)
 		return -ENODEV;
 
+	bgrt_image = memremap(bgrt_tab.image_address, bgrt_image_size,
+			      MEMREMAP_WB);
+	if (!bgrt_image) {
+		pr_notice("Ignoring BGRT: failed to map image memory\n");
+		return -ENOMEM;
+	}
+
 	bin_attr_image.private = bgrt_image;
 	bin_attr_image.size = bgrt_image_size;
 
 	bgrt_kobj = kobject_create_and_add("bgrt", acpi_kobj);
-	if (!bgrt_kobj)
-		return -EINVAL;
+	if (!bgrt_kobj) {
+		ret = -EINVAL;
+		goto out_memmap;
+	}
 
 	ret = sysfs_create_group(bgrt_kobj, &bgrt_attribute_group);
 	if (ret)
@@ -102,6 +112,8 @@ static int __init bgrt_init(void)
 
 out_kobject:
 	kobject_put(bgrt_kobj);
+out_memmap:
+	memunmap(bgrt_image);
 	return ret;
 }
 device_initcall(bgrt_init);
diff --git a/include/linux/efi-bgrt.h b/include/linux/efi-bgrt.h
index 051b21fedf68..2fd3993c370b 100644
--- a/include/linux/efi-bgrt.h
+++ b/include/linux/efi-bgrt.h
@@ -1,20 +1,19 @@
 #ifndef _LINUX_EFI_BGRT_H
 #define _LINUX_EFI_BGRT_H
 
-#ifdef CONFIG_ACPI_BGRT
-
 #include <linux/acpi.h>
 
-void efi_bgrt_init(void);
+#ifdef CONFIG_ACPI_BGRT
+
+void efi_bgrt_init(struct acpi_table_header *table);
 
 /* The BGRT data itself; only valid if bgrt_image != NULL. */
-extern void *bgrt_image;
 extern size_t bgrt_image_size;
-extern struct acpi_table_bgrt *bgrt_tab;
+extern struct acpi_table_bgrt bgrt_tab;
 
 #else /* !CONFIG_ACPI_BGRT */
 
-static inline void efi_bgrt_init(void) {}
+static inline void efi_bgrt_init(struct acpi_table_header *table) {}
 
 #endif /* !CONFIG_ACPI_BGRT */
 
diff --git a/init/main.c b/init/main.c
index b0c9d6facef9..9648d707eea5 100644
--- a/init/main.c
+++ b/init/main.c
@@ -663,7 +663,6 @@ asmlinkage __visible void __init start_kernel(void)
 	sfi_init_late();
 
 	if (efi_enabled(EFI_RUNTIME_SERVICES)) {
-		efi_late_init();
 		efi_free_boot_services();
 	}
 
-- 
2.7.4

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

* Re: [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code
  2017-01-31 13:21 ` [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code Ard Biesheuvel
@ 2017-05-13 23:18   ` Sabrina Dubroca
  2017-05-15  8:37     ` Dave Young
  0 siblings, 1 reply; 7+ messages in thread
From: Sabrina Dubroca @ 2017-05-13 23:18 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-kernel, Ingo Molnar, Thomas Gleixner, H . Peter Anvin,
	Dave Young, linux-efi, Matt Fleming, Rafael J. Wysocki,
	Len Brown, linux-acpi

2017-01-31, 13:21:40 +0000, Ard Biesheuvel wrote:
> From: Dave Young <dyoung@redhat.com>
> 
> Before invoking the arch specific handler, efi_mem_reserve() reserves
> the given memory region through memblock.
> 
> efi_bgrt_init() will call efi_mem_reserve() after mm_init(), at which
> time memblock is dead and should not be used anymore.
> 
> The EFI BGRT code depends on ACPI initialization to get the BGRT ACPI
> table, so move parsing of the BGRT table to ACPI early boot code to
> ensure that efi_mem_reserve() in EFI BGRT code still use memblock safely.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: linux-acpi@vger.kernel.org
> Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

I have a box that panics in early boot after this patch. The kernel
config is based on a Fedora 25 kernel + localmodconfig.

BUG: unable to handle kernel paging request at ffffffffff240001
IP: efi_bgrt_init+0xdc/0x134
PGD 1ac0c067
PUD 1ac0e067
PMD 1aee9067
PTE 9380701800000163

Oops: 0009 [#1] SMP
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.10.0-rc5-00116-g7b0a911 #19
Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.02 05/03/2012
task: ffffffff9fc10500 task.stack: ffffffff9fc00000
RIP: 0010:efi_bgrt_init+0xdc/0x134
RSP: 0000:ffffffff9fc03d58 EFLAGS: 00010082
RAX: ffffffffff240001 RBX: 0000000000000000 RCX: 1380701800000006
RDX: 8000000000000163 RSI: 9380701800000163 RDI: 00000000000005be
RBP: ffffffff9fc03d70 R08: 1380701800001000 R09: 0000000000000002
R10: 000000000002d000 R11: ffff98a3dedd2fc6 R12: ffffffff9f9f22b6
R13: ffffffff9ff49480 R14: 0000000000000010 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffffffff9fd20000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffff240001 CR3: 000000001ac09000 CR4: 00000000000406b0
Call Trace:
 ? acpi_parse_ioapic+0x98/0x98
 acpi_parse_bgrt+0x9/0xd
 acpi_table_parse+0x7a/0xa9
 acpi_boot_init+0x3c7/0x4f9
 ? acpi_parse_x2apic+0x74/0x74
 ? acpi_parse_x2apic_nmi+0x46/0x46
 setup_arch+0xb4b/0xc6f
 ? printk+0x52/0x6e
 start_kernel+0xb2/0x47b
 ? early_idt_handler_array+0x120/0x120
 x86_64_start_reservations+0x24/0x26
 x86_64_start_kernel+0xf7/0x11a
 start_cpu+0x14/0x14
Code: 48 c7 c7 10 16 a0 9f e8 4e 94 40 ff eb 62 be 06 00 00 00 e8 f9 ff 00 00 48 85 c0 75 0e 48 c7 c7 40 16 a0 9f e8 31 94 40 ff eb 45 <66> 44 8b 20 be 06 00 00 00 48 89 c7 8b 58 02 e8 87 00 01 00 66
RIP: efi_bgrt_init+0xdc/0x134 RSP: ffffffff9fc03d58
CR2: ffffffffff240001
---[ end trace f68728a0d3053b52 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task!


That code is:


All code
========
   0:	48 c7 c7 10 16 a0 9f 	mov    $0xffffffff9fa01610,%rdi
   7:	e8 4e 94 40 ff       	callq  0xffffffffff40945a
   c:	eb 62                	jmp    0x70
   e:	be 06 00 00 00       	mov    $0x6,%esi
  13:	e8 f9 ff 00 00       	callq  0x10011
  18:	48 85 c0             	test   %rax,%rax
  1b:	75 0e                	jne    0x2b
  1d:	48 c7 c7 40 16 a0 9f 	mov    $0xffffffff9fa01640,%rdi
  24:	e8 31 94 40 ff       	callq  0xffffffffff40945a
  29:	eb 45                	jmp    0x70
  2b:*	66 44 8b 20          	mov    (%rax),%r12w		<-- trapping instruction
  2f:	be 06 00 00 00       	mov    $0x6,%esi
  34:	48 89 c7             	mov    %rax,%rdi
  37:	8b 58 02             	mov    0x2(%rax),%ebx
  3a:	e8 87 00 01 00       	callq  0x100c6
  3f:	66                   	data16

Code starting with the faulting instruction
===========================================
   0:	66 44 8b 20          	mov    (%rax),%r12w
   4:	be 06 00 00 00       	mov    $0x6,%esi
   9:	48 89 c7             	mov    %rax,%rdi
   c:	8b 58 02             	mov    0x2(%rax),%ebx
   f:	e8 87 00 01 00       	callq  0x1009b
  14:	66                   	data16


which is just after the early_memremap() call.

I enabled early_ioremap_debug and the last warning had:

__early_ioremap(1380701800001000, 00001000) [1] => 00000001 + ffffffffff240000



Rest of the log, in case there's anything useful in there:


Linux version 4.10.0-rc5-00116-g7b0a911 (root@netdev4) (gcc version 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC) ) #19 SMP Sat May 13 23:16:09 CEST 2017
Command line: BOOT_IMAGE=/vmlinuz-4.10.0-rc5-00116-g7b0a911 root=UUID=3b849e12-46bd-4406-a2ec-f44238a55d56 ro console=ttyS0,115200 earlyprintk=serial,0x000003F8,115200
x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
e820: BIOS-provided physical RAM map:
BIOS-e820: [mem 0x0000000000000000-0x0000000000093bff] usable
BIOS-e820: [mem 0x0000000000093c00-0x000000000009ffff] reserved
BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
BIOS-e820: [mem 0x0000000000100000-0x000000001fffffff] usable
BIOS-e820: [mem 0x0000000020000000-0x00000000201fffff] reserved
BIOS-e820: [mem 0x0000000020200000-0x0000000040003fff] usable
BIOS-e820: [mem 0x0000000040004000-0x0000000040004fff] reserved
BIOS-e820: [mem 0x0000000040005000-0x00000000d9362fff] usable
BIOS-e820: [mem 0x00000000d9363000-0x00000000d9940fff] reserved
BIOS-e820: [mem 0x00000000d9941000-0x00000000d9ba7fff] ACPI NVS
BIOS-e820: [mem 0x00000000d9ba8000-0x00000000d9bb7fff] ACPI data
BIOS-e820: [mem 0x00000000d9bb8000-0x00000000d9bc0fff] ACPI NVS
BIOS-e820: [mem 0x00000000d9bc1000-0x00000000d9bc5fff] ACPI data
BIOS-e820: [mem 0x00000000d9bc6000-0x00000000d9c08fff] ACPI NVS
BIOS-e820: [mem 0x00000000d9c09000-0x00000000d9ffffff] usable
BIOS-e820: [mem 0x00000000db000000-0x00000000df1fffff] reserved
BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
BIOS-e820: [mem 0x00000000fed00000-0x00000000fed03fff] reserved
BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed44fff] reserved
BIOS-e820: [mem 0x00000000fed90000-0x00000000fed93fff] reserved
BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
BIOS-e820: [mem 0x0000000100000000-0x000000011edfffff] usable
bootconsole [earlyser0] enabled
NX (Execute Disable) protection: active
SMBIOS 2.7 present.
DMI: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.02 05/03/2012
e820: last_pfn = 0x11ee00 max_arch_pfn = 0x400000000
x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT
ing RDTSC...
e820: last_pfn = 0xda000 max_arch_pfn = 0x400000000
found SMP MP-table at [mem 0x000f4ea0-0x000f4eaf] mapped at [ffff98a2c00f4ea0]
RAMDISK: [mem 0x366ed000-0x3736efff]
ACPI: Early table checksum verification disabled
ACPI: RSDP 0x00000000000F9810 000024 (v02 HPQOEM)
ACPI: XSDT 0x00000000D9BA8080 00007C (v01 HPQOEM SLIC-WKS 01072009 AMI  00010013)
ACPI: FACP 0x00000000D9BB10F0 0000F4 (v04 HPQOEM SLIC-WKS 01072009 AMI  00010013)
ACPI: DSDT 0x00000000D9BA8188 008F67 (v02 HPQOEM SLIC-WKS 00000051 INTL 20051117)
ACPI: FACS 0x00000000D9BB8F80 000040
ACPI: APIC 0x00000000D9BB11E8 000084 (v03 HPQOEM SLIC-WKS 01072009 AMI  00010013)
ACPI: MCFG 0x00000000D9BB1270 00003C (v01 HPQOEM SLIC-WKS 01072009 MSFT 00000097)
ACPI: HPET 0x00000000D9BB12B0 000038 (v01 HPQOEM SLIC-WKS 01072009 AMI. 00000005)
ACPI: SSDT 0x00000000D9BB12E8 00036D (v01 SataRe SataTabl 00001000 INTL 20091112)
ACPI: SSDT 0x00000000D9BB1658 005270 (v01 COMPAQ WMI      00000001 MSFT 03000001)
ACPI: SLIC 0x00000000D9BB68C8 000176 (v01 HPQOEM SLIC-WKS 00000001      00000000)
ACPI: SSDT 0x00000000D9BB6A40 0009AA (v01 PmRef  Cpu0Ist  00003000 INTL 20051117)
ACPI: SSDT 0x00000000D9BB73F0 000A92 (v01 PmRef  CpuPm    00003000 INTL 20051117)
ACPI: ASF! 0x00000000D9BB7E88 0000A5 (v32 INTEL   HCG     00000001 TFSM 000F4240)
ACPI: BGRT 0x00000000D9BB7F30 00003C (v00 HPQOEM SLIC-WKS 01072009 AMI  00010013)
No NUMA configuration found
Faking a node at [mem 0x0000000000000000-0x000000011edfffff]
NODE_DATA(0) allocated [mem 0x11edd5000-0x11edfffff]
Zone ranges:
  DMA      [mem 0x0000000000001000-0x0000000000ffffff]
  DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
  Normal   [mem 0x0000000100000000-0x000000011edfffff]
  Device   empty
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000000001000-0x0000000000092fff]
  node   0: [mem 0x0000000000100000-0x000000001fffffff]
  node   0: [mem 0x0000000020200000-0x0000000040003fff]
  node   0: [mem 0x0000000040005000-0x00000000d9362fff]
  node   0: [mem 0x00000000d9c09000-0x00000000d9ffffff]
  node   0: [mem 0x0000000100000000-0x000000011edfffff]
Initmem setup node 0 [mem 0x0000000000001000-0x000000011edfffff]
Reserving Intel graphics memory at 0x00000000db200000-0x00000000df1fffff
ACPI: PM-Timer IO Port: 0x408
ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
ACPI: LAPIC_NMI (acpi_id[0x02] high edge lint[0x1])
ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
ACPI: LAPIC_NMI (acpi_id[0x03] high edge lint[0x1])
IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
Using ACPI (MADT) for SMP configuration information
ACPI: HPET id: 0x8086a701 base: 0xfed00000
BUG: unable to handle kernel paging request at ffffffffff240001
IP: efi_bgrt_init+0xdc/0x134
PGD 1ac0c067
PUD 1ac0e067
PMD 1aee9067
PTE 9380701800000163

Oops: 0009 [#1] SMP
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.10.0-rc5-00116-g7b0a911 #19
Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.02 05/03/2012
task: ffffffff9fc10500 task.stack: ffffffff9fc00000
RIP: 0010:efi_bgrt_init+0xdc/0x134
RSP: 0000:ffffffff9fc03d58 EFLAGS: 00010082
RAX: ffffffffff240001 RBX: 0000000000000000 RCX: 1380701800000006
RDX: 8000000000000163 RSI: 9380701800000163 RDI: 00000000000005be
RBP: ffffffff9fc03d70 R08: 1380701800001000 R09: 0000000000000002
R10: 000000000002d000 R11: ffff98a3dedd2fc6 R12: ffffffff9f9f22b6
R13: ffffffff9ff49480 R14: 0000000000000010 R15: 0000000000000000
FS:  0000000000000000(0000) GS:ffffffff9fd20000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffff240001 CR3: 000000001ac09000 CR4: 00000000000406b0
Call Trace:
 ? acpi_parse_ioapic+0x98/0x98
 acpi_parse_bgrt+0x9/0xd
 acpi_table_parse+0x7a/0xa9
 acpi_boot_init+0x3c7/0x4f9
 ? acpi_parse_x2apic+0x74/0x74
 ? acpi_parse_x2apic_nmi+0x46/0x46
 setup_arch+0xb4b/0xc6f
 ? printk+0x52/0x6e
 start_kernel+0xb2/0x47b
 ? early_idt_handler_array+0x120/0x120
 x86_64_start_reservations+0x24/0x26
 x86_64_start_kernel+0xf7/0x11a
 start_cpu+0x14/0x14
Code: 48 c7 c7 10 16 a0 9f e8 4e 94 40 ff eb 62 be 06 00 00 00 e8 f9 ff 00 00 48 85 c0 75 0e 48 c7 c7 40 16 a0 9f e8 31 94 40 ff eb 45 <66> 44 8b 20 be 06 00 00 00 48 89 c7 8b 58 02 e8 87 00 01 00 66
RIP: efi_bgrt_init+0xdc/0x134 RSP: ffffffff9fc03d58
CR2: ffffffffff240001
---[ end trace f68728a0d3053b52 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task!


-- 
Sabrina

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

* Re: [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code
  2017-05-13 23:18   ` Sabrina Dubroca
@ 2017-05-15  8:37     ` Dave Young
  2017-05-15 11:10       ` Sabrina Dubroca
  0 siblings, 1 reply; 7+ messages in thread
From: Dave Young @ 2017-05-15  8:37 UTC (permalink / raw)
  To: Sabrina Dubroca
  Cc: Ard Biesheuvel, linux-kernel, Ingo Molnar, Thomas Gleixner,
	H . Peter Anvin, linux-efi, Matt Fleming, Rafael J. Wysocki,
	Len Brown, linux-acpi

Hi,

Thanks for the report.
On 05/14/17 at 01:18am, Sabrina Dubroca wrote:
> 2017-01-31, 13:21:40 +0000, Ard Biesheuvel wrote:
> > From: Dave Young <dyoung@redhat.com>
> > 
> > Before invoking the arch specific handler, efi_mem_reserve() reserves
> > the given memory region through memblock.
> > 
> > efi_bgrt_init() will call efi_mem_reserve() after mm_init(), at which
> > time memblock is dead and should not be used anymore.
> > 
> > The EFI BGRT code depends on ACPI initialization to get the BGRT ACPI
> > table, so move parsing of the BGRT table to ACPI early boot code to
> > ensure that efi_mem_reserve() in EFI BGRT code still use memblock safely.
> > 
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > Cc: Matt Fleming <matt@codeblueprint.co.uk>
> > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > Cc: Len Brown <lenb@kernel.org>
> > Cc: linux-acpi@vger.kernel.org
> > Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> I have a box that panics in early boot after this patch. The kernel
> config is based on a Fedora 25 kernel + localmodconfig.
> 
> BUG: unable to handle kernel paging request at ffffffffff240001
> IP: efi_bgrt_init+0xdc/0x134
> PGD 1ac0c067
> PUD 1ac0e067
> PMD 1aee9067
> PTE 9380701800000163
> 
> Oops: 0009 [#1] SMP
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper Not tainted 4.10.0-rc5-00116-g7b0a911 #19
> Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.02 05/03/2012
> task: ffffffff9fc10500 task.stack: ffffffff9fc00000
> RIP: 0010:efi_bgrt_init+0xdc/0x134
> RSP: 0000:ffffffff9fc03d58 EFLAGS: 00010082
> RAX: ffffffffff240001 RBX: 0000000000000000 RCX: 1380701800000006
> RDX: 8000000000000163 RSI: 9380701800000163 RDI: 00000000000005be
> RBP: ffffffff9fc03d70 R08: 1380701800001000 R09: 0000000000000002
> R10: 000000000002d000 R11: ffff98a3dedd2fc6 R12: ffffffff9f9f22b6
> R13: ffffffff9ff49480 R14: 0000000000000010 R15: 0000000000000000
> FS:  0000000000000000(0000) GS:ffffffff9fd20000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: ffffffffff240001 CR3: 000000001ac09000 CR4: 00000000000406b0
> Call Trace:
>  ? acpi_parse_ioapic+0x98/0x98
>  acpi_parse_bgrt+0x9/0xd
>  acpi_table_parse+0x7a/0xa9
>  acpi_boot_init+0x3c7/0x4f9
>  ? acpi_parse_x2apic+0x74/0x74
>  ? acpi_parse_x2apic_nmi+0x46/0x46
>  setup_arch+0xb4b/0xc6f
>  ? printk+0x52/0x6e
>  start_kernel+0xb2/0x47b
>  ? early_idt_handler_array+0x120/0x120
>  x86_64_start_reservations+0x24/0x26
>  x86_64_start_kernel+0xf7/0x11a
>  start_cpu+0x14/0x14
> Code: 48 c7 c7 10 16 a0 9f e8 4e 94 40 ff eb 62 be 06 00 00 00 e8 f9 ff 00 00 48 85 c0 75 0e 48 c7 c7 40 16 a0 9f e8 31 94 40 ff eb 45 <66> 44 8b 20 be 06 00 00 00 48 89 c7 8b 58 02 e8 87 00 01 00 66
> RIP: efi_bgrt_init+0xdc/0x134 RSP: ffffffff9fc03d58
> CR2: ffffffffff240001
> ---[ end trace f68728a0d3053b52 ]---
> Kernel panic - not syncing: Attempted to kill the idle task!
> ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
> 
> 
> That code is:
> 
> 
> All code
> ========
>    0:	48 c7 c7 10 16 a0 9f 	mov    $0xffffffff9fa01610,%rdi
>    7:	e8 4e 94 40 ff       	callq  0xffffffffff40945a
>    c:	eb 62                	jmp    0x70
>    e:	be 06 00 00 00       	mov    $0x6,%esi
>   13:	e8 f9 ff 00 00       	callq  0x10011
>   18:	48 85 c0             	test   %rax,%rax
>   1b:	75 0e                	jne    0x2b
>   1d:	48 c7 c7 40 16 a0 9f 	mov    $0xffffffff9fa01640,%rdi
>   24:	e8 31 94 40 ff       	callq  0xffffffffff40945a
>   29:	eb 45                	jmp    0x70
>   2b:*	66 44 8b 20          	mov    (%rax),%r12w		<-- trapping instruction
>   2f:	be 06 00 00 00       	mov    $0x6,%esi
>   34:	48 89 c7             	mov    %rax,%rdi
>   37:	8b 58 02             	mov    0x2(%rax),%ebx
>   3a:	e8 87 00 01 00       	callq  0x100c6
>   3f:	66                   	data16
> 
> Code starting with the faulting instruction
> ===========================================
>    0:	66 44 8b 20          	mov    (%rax),%r12w
>    4:	be 06 00 00 00       	mov    $0x6,%esi
>    9:	48 89 c7             	mov    %rax,%rdi
>    c:	8b 58 02             	mov    0x2(%rax),%ebx
>    f:	e8 87 00 01 00       	callq  0x1009b
>   14:	66                   	data16
> 
> 
> which is just after the early_memremap() call.
> 
> I enabled early_ioremap_debug and the last warning had:
> 
> __early_ioremap(1380701800001000, 00001000) [1] => 00000001 + ffffffffff240000

The phys addr looks odd..

>From the kernel log, I do not see any efi messages so can you check if
you are booting with legacy mode or efi boot?

I suppose bgrt are efi only, if you are test with legacy boot it is odd
that there is BGRT table populated.

For debugging purpose maybe you can add some printk to dump the acpi
table header in efi_bgrt_init function, just print the version, status,
image_type, image_address.

If you can prove it is a non-efi boot, then maybe you can test below
patch:


diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index 04ca876..b986e26 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -36,6 +36,9 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
 	if (acpi_disabled)
 		return;
 
+	if (!efi_enabled(EFI_CONFIG_TABLES))
+		return;
+
 	if (table->length < sizeof(bgrt_tab)) {
 		pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
 		       table->length, sizeof(bgrt_tab));

> 
> 
> 
> Rest of the log, in case there's anything useful in there:
> 
> 
> Linux version 4.10.0-rc5-00116-g7b0a911 (root@netdev4) (gcc version 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC) ) #19 SMP Sat May 13 23:16:09 CEST 2017
> Command line: BOOT_IMAGE=/vmlinuz-4.10.0-rc5-00116-g7b0a911 root=UUID=3b849e12-46bd-4406-a2ec-f44238a55d56 ro console=ttyS0,115200 earlyprintk=serial,0x000003F8,115200
> x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
> x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
> x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
> x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
> x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
> e820: BIOS-provided physical RAM map:
> BIOS-e820: [mem 0x0000000000000000-0x0000000000093bff] usable
> BIOS-e820: [mem 0x0000000000093c00-0x000000000009ffff] reserved
> BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
> BIOS-e820: [mem 0x0000000000100000-0x000000001fffffff] usable
> BIOS-e820: [mem 0x0000000020000000-0x00000000201fffff] reserved
> BIOS-e820: [mem 0x0000000020200000-0x0000000040003fff] usable
> BIOS-e820: [mem 0x0000000040004000-0x0000000040004fff] reserved
> BIOS-e820: [mem 0x0000000040005000-0x00000000d9362fff] usable
> BIOS-e820: [mem 0x00000000d9363000-0x00000000d9940fff] reserved
> BIOS-e820: [mem 0x00000000d9941000-0x00000000d9ba7fff] ACPI NVS
> BIOS-e820: [mem 0x00000000d9ba8000-0x00000000d9bb7fff] ACPI data
> BIOS-e820: [mem 0x00000000d9bb8000-0x00000000d9bc0fff] ACPI NVS
> BIOS-e820: [mem 0x00000000d9bc1000-0x00000000d9bc5fff] ACPI data
> BIOS-e820: [mem 0x00000000d9bc6000-0x00000000d9c08fff] ACPI NVS
> BIOS-e820: [mem 0x00000000d9c09000-0x00000000d9ffffff] usable
> BIOS-e820: [mem 0x00000000db000000-0x00000000df1fffff] reserved
> BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
> BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
> BIOS-e820: [mem 0x00000000fed00000-0x00000000fed03fff] reserved
> BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed44fff] reserved
> BIOS-e820: [mem 0x00000000fed90000-0x00000000fed93fff] reserved
> BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
> BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
> BIOS-e820: [mem 0x0000000100000000-0x000000011edfffff] usable
> bootconsole [earlyser0] enabled
> NX (Execute Disable) protection: active
> SMBIOS 2.7 present.
> DMI: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.02 05/03/2012
> e820: last_pfn = 0x11ee00 max_arch_pfn = 0x400000000
> x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT
> ing RDTSC...
> e820: last_pfn = 0xda000 max_arch_pfn = 0x400000000
> found SMP MP-table at [mem 0x000f4ea0-0x000f4eaf] mapped at [ffff98a2c00f4ea0]
> RAMDISK: [mem 0x366ed000-0x3736efff]
> ACPI: Early table checksum verification disabled
> ACPI: RSDP 0x00000000000F9810 000024 (v02 HPQOEM)
> ACPI: XSDT 0x00000000D9BA8080 00007C (v01 HPQOEM SLIC-WKS 01072009 AMI  00010013)
> ACPI: FACP 0x00000000D9BB10F0 0000F4 (v04 HPQOEM SLIC-WKS 01072009 AMI  00010013)
> ACPI: DSDT 0x00000000D9BA8188 008F67 (v02 HPQOEM SLIC-WKS 00000051 INTL 20051117)
> ACPI: FACS 0x00000000D9BB8F80 000040
> ACPI: APIC 0x00000000D9BB11E8 000084 (v03 HPQOEM SLIC-WKS 01072009 AMI  00010013)
> ACPI: MCFG 0x00000000D9BB1270 00003C (v01 HPQOEM SLIC-WKS 01072009 MSFT 00000097)
> ACPI: HPET 0x00000000D9BB12B0 000038 (v01 HPQOEM SLIC-WKS 01072009 AMI. 00000005)
> ACPI: SSDT 0x00000000D9BB12E8 00036D (v01 SataRe SataTabl 00001000 INTL 20091112)
> ACPI: SSDT 0x00000000D9BB1658 005270 (v01 COMPAQ WMI      00000001 MSFT 03000001)
> ACPI: SLIC 0x00000000D9BB68C8 000176 (v01 HPQOEM SLIC-WKS 00000001      00000000)
> ACPI: SSDT 0x00000000D9BB6A40 0009AA (v01 PmRef  Cpu0Ist  00003000 INTL 20051117)
> ACPI: SSDT 0x00000000D9BB73F0 000A92 (v01 PmRef  CpuPm    00003000 INTL 20051117)
> ACPI: ASF! 0x00000000D9BB7E88 0000A5 (v32 INTEL   HCG     00000001 TFSM 000F4240)
> ACPI: BGRT 0x00000000D9BB7F30 00003C (v00 HPQOEM SLIC-WKS 01072009 AMI  00010013)
> No NUMA configuration found
> Faking a node at [mem 0x0000000000000000-0x000000011edfffff]
> NODE_DATA(0) allocated [mem 0x11edd5000-0x11edfffff]
> Zone ranges:
>   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
>   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
>   Normal   [mem 0x0000000100000000-0x000000011edfffff]
>   Device   empty
> Movable zone start for each node
> Early memory node ranges
>   node   0: [mem 0x0000000000001000-0x0000000000092fff]
>   node   0: [mem 0x0000000000100000-0x000000001fffffff]
>   node   0: [mem 0x0000000020200000-0x0000000040003fff]
>   node   0: [mem 0x0000000040005000-0x00000000d9362fff]
>   node   0: [mem 0x00000000d9c09000-0x00000000d9ffffff]
>   node   0: [mem 0x0000000100000000-0x000000011edfffff]
> Initmem setup node 0 [mem 0x0000000000001000-0x000000011edfffff]
> Reserving Intel graphics memory at 0x00000000db200000-0x00000000df1fffff
> ACPI: PM-Timer IO Port: 0x408
> ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
> ACPI: LAPIC_NMI (acpi_id[0x02] high edge lint[0x1])
> ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
> ACPI: LAPIC_NMI (acpi_id[0x03] high edge lint[0x1])
> IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
> ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
> ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
> Using ACPI (MADT) for SMP configuration information
> ACPI: HPET id: 0x8086a701 base: 0xfed00000
> BUG: unable to handle kernel paging request at ffffffffff240001
> IP: efi_bgrt_init+0xdc/0x134
> PGD 1ac0c067
> PUD 1ac0e067
> PMD 1aee9067
> PTE 9380701800000163
> 
> Oops: 0009 [#1] SMP
> Modules linked in:
> CPU: 0 PID: 0 Comm: swapper Not tainted 4.10.0-rc5-00116-g7b0a911 #19
> Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.02 05/03/2012
> task: ffffffff9fc10500 task.stack: ffffffff9fc00000
> RIP: 0010:efi_bgrt_init+0xdc/0x134
> RSP: 0000:ffffffff9fc03d58 EFLAGS: 00010082
> RAX: ffffffffff240001 RBX: 0000000000000000 RCX: 1380701800000006
> RDX: 8000000000000163 RSI: 9380701800000163 RDI: 00000000000005be
> RBP: ffffffff9fc03d70 R08: 1380701800001000 R09: 0000000000000002
> R10: 000000000002d000 R11: ffff98a3dedd2fc6 R12: ffffffff9f9f22b6
> R13: ffffffff9ff49480 R14: 0000000000000010 R15: 0000000000000000
> FS:  0000000000000000(0000) GS:ffffffff9fd20000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: ffffffffff240001 CR3: 000000001ac09000 CR4: 00000000000406b0
> Call Trace:
>  ? acpi_parse_ioapic+0x98/0x98
>  acpi_parse_bgrt+0x9/0xd
>  acpi_table_parse+0x7a/0xa9
>  acpi_boot_init+0x3c7/0x4f9
>  ? acpi_parse_x2apic+0x74/0x74
>  ? acpi_parse_x2apic_nmi+0x46/0x46
>  setup_arch+0xb4b/0xc6f
>  ? printk+0x52/0x6e
>  start_kernel+0xb2/0x47b
>  ? early_idt_handler_array+0x120/0x120
>  x86_64_start_reservations+0x24/0x26
>  x86_64_start_kernel+0xf7/0x11a
>  start_cpu+0x14/0x14
> Code: 48 c7 c7 10 16 a0 9f e8 4e 94 40 ff eb 62 be 06 00 00 00 e8 f9 ff 00 00 48 85 c0 75 0e 48 c7 c7 40 16 a0 9f e8 31 94 40 ff eb 45 <66> 44 8b 20 be 06 00 00 00 48 89 c7 8b 58 02 e8 87 00 01 00 66
> RIP: efi_bgrt_init+0xdc/0x134 RSP: ffffffff9fc03d58
> CR2: ffffffffff240001
> ---[ end trace f68728a0d3053b52 ]---
> Kernel panic - not syncing: Attempted to kill the idle task!
> ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
> 
> 
> -- 
> Sabrina

Thanks
Dave

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

* Re: [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code
  2017-05-15  8:37     ` Dave Young
@ 2017-05-15 11:10       ` Sabrina Dubroca
  2017-05-15 13:18         ` Dave Young
  0 siblings, 1 reply; 7+ messages in thread
From: Sabrina Dubroca @ 2017-05-15 11:10 UTC (permalink / raw)
  To: Dave Young
  Cc: Ard Biesheuvel, linux-kernel, Ingo Molnar, Thomas Gleixner,
	H . Peter Anvin, linux-efi, Matt Fleming, Rafael J. Wysocki,
	Len Brown, linux-acpi

2017-05-15, 16:37:40 +0800, Dave Young wrote:
> Hi,
> 
> Thanks for the report.
> On 05/14/17 at 01:18am, Sabrina Dubroca wrote:
> > 2017-01-31, 13:21:40 +0000, Ard Biesheuvel wrote:
> > > From: Dave Young <dyoung@redhat.com>
> > > 
> > > Before invoking the arch specific handler, efi_mem_reserve() reserves
> > > the given memory region through memblock.
> > > 
> > > efi_bgrt_init() will call efi_mem_reserve() after mm_init(), at which
> > > time memblock is dead and should not be used anymore.
> > > 
> > > The EFI BGRT code depends on ACPI initialization to get the BGRT ACPI
> > > table, so move parsing of the BGRT table to ACPI early boot code to
> > > ensure that efi_mem_reserve() in EFI BGRT code still use memblock safely.
> > > 
> > > Signed-off-by: Dave Young <dyoung@redhat.com>
> > > Cc: Matt Fleming <matt@codeblueprint.co.uk>
> > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > > Cc: Len Brown <lenb@kernel.org>
> > > Cc: linux-acpi@vger.kernel.org
> > > Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
> > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > 
> > I have a box that panics in early boot after this patch. The kernel
> > config is based on a Fedora 25 kernel + localmodconfig.
> > 
> > BUG: unable to handle kernel paging request at ffffffffff240001
> > IP: efi_bgrt_init+0xdc/0x134
> > PGD 1ac0c067
> > PUD 1ac0e067
> > PMD 1aee9067
> > PTE 9380701800000163
> > 
> > Oops: 0009 [#1] SMP
> > Modules linked in:
> > CPU: 0 PID: 0 Comm: swapper Not tainted 4.10.0-rc5-00116-g7b0a911 #19
> > Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.02 05/03/2012
> > task: ffffffff9fc10500 task.stack: ffffffff9fc00000
> > RIP: 0010:efi_bgrt_init+0xdc/0x134
> > RSP: 0000:ffffffff9fc03d58 EFLAGS: 00010082
> > RAX: ffffffffff240001 RBX: 0000000000000000 RCX: 1380701800000006
> > RDX: 8000000000000163 RSI: 9380701800000163 RDI: 00000000000005be
> > RBP: ffffffff9fc03d70 R08: 1380701800001000 R09: 0000000000000002
> > R10: 000000000002d000 R11: ffff98a3dedd2fc6 R12: ffffffff9f9f22b6
> > R13: ffffffff9ff49480 R14: 0000000000000010 R15: 0000000000000000
> > FS:  0000000000000000(0000) GS:ffffffff9fd20000(0000) knlGS:0000000000000000
> > CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: ffffffffff240001 CR3: 000000001ac09000 CR4: 00000000000406b0
> > Call Trace:
> >  ? acpi_parse_ioapic+0x98/0x98
> >  acpi_parse_bgrt+0x9/0xd
> >  acpi_table_parse+0x7a/0xa9
> >  acpi_boot_init+0x3c7/0x4f9
> >  ? acpi_parse_x2apic+0x74/0x74
> >  ? acpi_parse_x2apic_nmi+0x46/0x46
> >  setup_arch+0xb4b/0xc6f
> >  ? printk+0x52/0x6e
> >  start_kernel+0xb2/0x47b
> >  ? early_idt_handler_array+0x120/0x120
> >  x86_64_start_reservations+0x24/0x26
> >  x86_64_start_kernel+0xf7/0x11a
> >  start_cpu+0x14/0x14
> > Code: 48 c7 c7 10 16 a0 9f e8 4e 94 40 ff eb 62 be 06 00 00 00 e8 f9 ff 00 00 48 85 c0 75 0e 48 c7 c7 40 16 a0 9f e8 31 94 40 ff eb 45 <66> 44 8b 20 be 06 00 00 00 48 89 c7 8b 58 02 e8 87 00 01 00 66
> > RIP: efi_bgrt_init+0xdc/0x134 RSP: ffffffff9fc03d58
> > CR2: ffffffffff240001
> > ---[ end trace f68728a0d3053b52 ]---
> > Kernel panic - not syncing: Attempted to kill the idle task!
> > ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
> > 
> > 
> > That code is:
> > 
> > 
> > All code
> > ========
> >    0:	48 c7 c7 10 16 a0 9f 	mov    $0xffffffff9fa01610,%rdi
> >    7:	e8 4e 94 40 ff       	callq  0xffffffffff40945a
> >    c:	eb 62                	jmp    0x70
> >    e:	be 06 00 00 00       	mov    $0x6,%esi
> >   13:	e8 f9 ff 00 00       	callq  0x10011
> >   18:	48 85 c0             	test   %rax,%rax
> >   1b:	75 0e                	jne    0x2b
> >   1d:	48 c7 c7 40 16 a0 9f 	mov    $0xffffffff9fa01640,%rdi
> >   24:	e8 31 94 40 ff       	callq  0xffffffffff40945a
> >   29:	eb 45                	jmp    0x70
> >   2b:*	66 44 8b 20          	mov    (%rax),%r12w		<-- trapping instruction
> >   2f:	be 06 00 00 00       	mov    $0x6,%esi
> >   34:	48 89 c7             	mov    %rax,%rdi
> >   37:	8b 58 02             	mov    0x2(%rax),%ebx
> >   3a:	e8 87 00 01 00       	callq  0x100c6
> >   3f:	66                   	data16
> > 
> > Code starting with the faulting instruction
> > ===========================================
> >    0:	66 44 8b 20          	mov    (%rax),%r12w
> >    4:	be 06 00 00 00       	mov    $0x6,%esi
> >    9:	48 89 c7             	mov    %rax,%rdi
> >    c:	8b 58 02             	mov    0x2(%rax),%ebx
> >    f:	e8 87 00 01 00       	callq  0x1009b
> >   14:	66                   	data16
> > 
> > 
> > which is just after the early_memremap() call.
> > 
> > I enabled early_ioremap_debug and the last warning had:
> > 
> > __early_ioremap(1380701800001000, 00001000) [1] => 00000001 + ffffffffff240000
> 
> The phys addr looks odd..
> 
> From the kernel log, I do not see any efi messages so can you check if
> you are booting with legacy mode or efi boot?

I don't have physical access to the machine, but even from a succesful
boot there's no efi message. No /sys/firmware/efi as well, and
efivarfs isn't registered despite it being compiled in
(on kernel 4.10.14-200.fc25.x86_64):

    # mount -t efivarfs none /mnt/foo
    mount: unknown filesystem type 'efivarfs'

So I suppose it's legacy mode and the
    !efi_enabled(EFI_RUNTIME_SERVICES)
check kicking in.


> I suppose bgrt are efi only, if you are test with legacy boot it is odd
> that there is BGRT table populated.
> 
> For debugging purpose maybe you can add some printk to dump the acpi
> table header in efi_bgrt_init function, just print the version, status,
> image_type, image_address.

Added:

       pr_info("%s acpi_table_bgrt.version %hu\n", __func__, bgrt->version);
       pr_info("%s acpi_table_bgrt.status %hhu\n", __func__, bgrt->status);
       pr_info("%s acpi_table_bgrt.image_type %hhu\n", __func__, bgrt->image_type);
       pr_info("%s acpi_table_bgrt.image_address %llx\n", __func__, bgrt->image_address);
       print_hex_dump(KERN_INFO, "efi_bgrt_init acpi_table_bgrt", DUMP_PREFIX_OFFSET, 16, 1, bgrt, sizeof(*bgrt), false);

efi_bgrt: efi_bgrt_init acpi_table_bgrt.version 1
efi_bgrt: efi_bgrt_init acpi_table_bgrt.status 0
efi_bgrt: efi_bgrt_init acpi_table_bgrt.image_type 0
efi_bgrt: efi_bgrt_init acpi_table_bgrt.image_address 1380701800000001
efi_bgrt_init acpi_table_bgrt: 00000000: 42 47 52 54 3c 00 00 00 00 8b 48 50 51 4f 45 4d
efi_bgrt_init acpi_table_bgrt: 00000010: 53 4c 49 43 2d 57 4b 53 09 20 07 01 41 4d 49 20
efi_bgrt_init acpi_table_bgrt: 00000020: 13 00 01 00 01 00 00 00 01 00 00 00 18 70 80 13
efi_bgrt_init acpi_table_bgrt: 00000030: 00 00 00 00 ff 00 00 00


> If you can prove it is a non-efi boot, then maybe you can test below
> patch:

Yeah, that works.  I guess that makes sense, since before this patch,
efi_bgrt_init() wasn't called on that box (because of the
EFI_RUNTIME_SERVICES check in start_kernel()).

Thanks!

> diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
> index 04ca876..b986e26 100644
> --- a/arch/x86/platform/efi/efi-bgrt.c
> +++ b/arch/x86/platform/efi/efi-bgrt.c
> @@ -36,6 +36,9 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
>  	if (acpi_disabled)
>  		return;
>  
> +	if (!efi_enabled(EFI_CONFIG_TABLES))
> +		return;
> +
>  	if (table->length < sizeof(bgrt_tab)) {
>  		pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
>  		       table->length, sizeof(bgrt_tab));
> 

-- 
Sabrina

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

* Re: [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code
  2017-05-15 11:10       ` Sabrina Dubroca
@ 2017-05-15 13:18         ` Dave Young
  2017-05-15 13:44           ` Sabrina Dubroca
  0 siblings, 1 reply; 7+ messages in thread
From: Dave Young @ 2017-05-15 13:18 UTC (permalink / raw)
  To: Sabrina Dubroca
  Cc: Ard Biesheuvel, linux-kernel, Ingo Molnar, Thomas Gleixner,
	H . Peter Anvin, linux-efi, Matt Fleming, Rafael J. Wysocki,
	Len Brown, linux-acpi

On 05/15/17 at 01:10pm, Sabrina Dubroca wrote:
> 2017-05-15, 16:37:40 +0800, Dave Young wrote:
> > Hi,
> > 
> > Thanks for the report.
> > On 05/14/17 at 01:18am, Sabrina Dubroca wrote:
> > > 2017-01-31, 13:21:40 +0000, Ard Biesheuvel wrote:
> > > > From: Dave Young <dyoung@redhat.com>
> > > > 
> > > > Before invoking the arch specific handler, efi_mem_reserve() reserves
> > > > the given memory region through memblock.
> > > > 
> > > > efi_bgrt_init() will call efi_mem_reserve() after mm_init(), at which
> > > > time memblock is dead and should not be used anymore.
> > > > 
> > > > The EFI BGRT code depends on ACPI initialization to get the BGRT ACPI
> > > > table, so move parsing of the BGRT table to ACPI early boot code to
> > > > ensure that efi_mem_reserve() in EFI BGRT code still use memblock safely.
> > > > 
> > > > Signed-off-by: Dave Young <dyoung@redhat.com>
> > > > Cc: Matt Fleming <matt@codeblueprint.co.uk>
> > > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > > > Cc: Len Brown <lenb@kernel.org>
> > > > Cc: linux-acpi@vger.kernel.org
> > > > Tested-by: Bhupesh Sharma <bhsharma@redhat.com>
> > > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > > 
> > > I have a box that panics in early boot after this patch. The kernel
> > > config is based on a Fedora 25 kernel + localmodconfig.
> > > 
> > > BUG: unable to handle kernel paging request at ffffffffff240001
> > > IP: efi_bgrt_init+0xdc/0x134
> > > PGD 1ac0c067
> > > PUD 1ac0e067
> > > PMD 1aee9067
> > > PTE 9380701800000163
> > > 
> > > Oops: 0009 [#1] SMP
> > > Modules linked in:
> > > CPU: 0 PID: 0 Comm: swapper Not tainted 4.10.0-rc5-00116-g7b0a911 #19
> > > Hardware name: Hewlett-Packard HP Z220 CMT Workstation/1790, BIOS K51 v01.02 05/03/2012
> > > task: ffffffff9fc10500 task.stack: ffffffff9fc00000
> > > RIP: 0010:efi_bgrt_init+0xdc/0x134
> > > RSP: 0000:ffffffff9fc03d58 EFLAGS: 00010082
> > > RAX: ffffffffff240001 RBX: 0000000000000000 RCX: 1380701800000006
> > > RDX: 8000000000000163 RSI: 9380701800000163 RDI: 00000000000005be
> > > RBP: ffffffff9fc03d70 R08: 1380701800001000 R09: 0000000000000002
> > > R10: 000000000002d000 R11: ffff98a3dedd2fc6 R12: ffffffff9f9f22b6
> > > R13: ffffffff9ff49480 R14: 0000000000000010 R15: 0000000000000000
> > > FS:  0000000000000000(0000) GS:ffffffff9fd20000(0000) knlGS:0000000000000000
> > > CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > > CR2: ffffffffff240001 CR3: 000000001ac09000 CR4: 00000000000406b0
> > > Call Trace:
> > >  ? acpi_parse_ioapic+0x98/0x98
> > >  acpi_parse_bgrt+0x9/0xd
> > >  acpi_table_parse+0x7a/0xa9
> > >  acpi_boot_init+0x3c7/0x4f9
> > >  ? acpi_parse_x2apic+0x74/0x74
> > >  ? acpi_parse_x2apic_nmi+0x46/0x46
> > >  setup_arch+0xb4b/0xc6f
> > >  ? printk+0x52/0x6e
> > >  start_kernel+0xb2/0x47b
> > >  ? early_idt_handler_array+0x120/0x120
> > >  x86_64_start_reservations+0x24/0x26
> > >  x86_64_start_kernel+0xf7/0x11a
> > >  start_cpu+0x14/0x14
> > > Code: 48 c7 c7 10 16 a0 9f e8 4e 94 40 ff eb 62 be 06 00 00 00 e8 f9 ff 00 00 48 85 c0 75 0e 48 c7 c7 40 16 a0 9f e8 31 94 40 ff eb 45 <66> 44 8b 20 be 06 00 00 00 48 89 c7 8b 58 02 e8 87 00 01 00 66
> > > RIP: efi_bgrt_init+0xdc/0x134 RSP: ffffffff9fc03d58
> > > CR2: ffffffffff240001
> > > ---[ end trace f68728a0d3053b52 ]---
> > > Kernel panic - not syncing: Attempted to kill the idle task!
> > > ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
> > > 
> > > 
> > > That code is:
> > > 
> > > 
> > > All code
> > > ========
> > >    0:	48 c7 c7 10 16 a0 9f 	mov    $0xffffffff9fa01610,%rdi
> > >    7:	e8 4e 94 40 ff       	callq  0xffffffffff40945a
> > >    c:	eb 62                	jmp    0x70
> > >    e:	be 06 00 00 00       	mov    $0x6,%esi
> > >   13:	e8 f9 ff 00 00       	callq  0x10011
> > >   18:	48 85 c0             	test   %rax,%rax
> > >   1b:	75 0e                	jne    0x2b
> > >   1d:	48 c7 c7 40 16 a0 9f 	mov    $0xffffffff9fa01640,%rdi
> > >   24:	e8 31 94 40 ff       	callq  0xffffffffff40945a
> > >   29:	eb 45                	jmp    0x70
> > >   2b:*	66 44 8b 20          	mov    (%rax),%r12w		<-- trapping instruction
> > >   2f:	be 06 00 00 00       	mov    $0x6,%esi
> > >   34:	48 89 c7             	mov    %rax,%rdi
> > >   37:	8b 58 02             	mov    0x2(%rax),%ebx
> > >   3a:	e8 87 00 01 00       	callq  0x100c6
> > >   3f:	66                   	data16
> > > 
> > > Code starting with the faulting instruction
> > > ===========================================
> > >    0:	66 44 8b 20          	mov    (%rax),%r12w
> > >    4:	be 06 00 00 00       	mov    $0x6,%esi
> > >    9:	48 89 c7             	mov    %rax,%rdi
> > >    c:	8b 58 02             	mov    0x2(%rax),%ebx
> > >    f:	e8 87 00 01 00       	callq  0x1009b
> > >   14:	66                   	data16
> > > 
> > > 
> > > which is just after the early_memremap() call.
> > > 
> > > I enabled early_ioremap_debug and the last warning had:
> > > 
> > > __early_ioremap(1380701800001000, 00001000) [1] => 00000001 + ffffffffff240000
> > 
> > The phys addr looks odd..
> > 
> > From the kernel log, I do not see any efi messages so can you check if
> > you are booting with legacy mode or efi boot?
> 
> I don't have physical access to the machine, but even from a succesful
> boot there's no efi message. No /sys/firmware/efi as well, and
> efivarfs isn't registered despite it being compiled in
> (on kernel 4.10.14-200.fc25.x86_64):
> 
>     # mount -t efivarfs none /mnt/foo
>     mount: unknown filesystem type 'efivarfs'
> 
> So I suppose it's legacy mode and the
>     !efi_enabled(EFI_RUNTIME_SERVICES)
> check kicking in.
> 
> 
> > I suppose bgrt are efi only, if you are test with legacy boot it is odd
> > that there is BGRT table populated.
> > 
> > For debugging purpose maybe you can add some printk to dump the acpi
> > table header in efi_bgrt_init function, just print the version, status,
> > image_type, image_address.
> 
> Added:
> 
>        pr_info("%s acpi_table_bgrt.version %hu\n", __func__, bgrt->version);
>        pr_info("%s acpi_table_bgrt.status %hhu\n", __func__, bgrt->status);
>        pr_info("%s acpi_table_bgrt.image_type %hhu\n", __func__, bgrt->image_type);
>        pr_info("%s acpi_table_bgrt.image_address %llx\n", __func__, bgrt->image_address);
>        print_hex_dump(KERN_INFO, "efi_bgrt_init acpi_table_bgrt", DUMP_PREFIX_OFFSET, 16, 1, bgrt, sizeof(*bgrt), false);
> 
> efi_bgrt: efi_bgrt_init acpi_table_bgrt.version 1
> efi_bgrt: efi_bgrt_init acpi_table_bgrt.status 0
> efi_bgrt: efi_bgrt_init acpi_table_bgrt.image_type 0
> efi_bgrt: efi_bgrt_init acpi_table_bgrt.image_address 1380701800000001
> efi_bgrt_init acpi_table_bgrt: 00000000: 42 47 52 54 3c 00 00 00 00 8b 48 50 51 4f 45 4d
> efi_bgrt_init acpi_table_bgrt: 00000010: 53 4c 49 43 2d 57 4b 53 09 20 07 01 41 4d 49 20
> efi_bgrt_init acpi_table_bgrt: 00000020: 13 00 01 00 01 00 00 00 01 00 00 00 18 70 80 13
> efi_bgrt_init acpi_table_bgrt: 00000030: 00 00 00 00 ff 00 00 00
> 
> 
> > If you can prove it is a non-efi boot, then maybe you can test below
> > patch:
> 
> Yeah, that works.  I guess that makes sense, since before this patch,
> efi_bgrt_init() wasn't called on that box (because of the
> EFI_RUNTIME_SERVICES check in start_kernel()).

Ok, thanks for the testing, from your debug log, it proved this is the
root cause.

> 
> Thanks!
> 
> > diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
> > index 04ca876..b986e26 100644
> > --- a/arch/x86/platform/efi/efi-bgrt.c
> > +++ b/arch/x86/platform/efi/efi-bgrt.c
> > @@ -36,6 +36,9 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
> >  	if (acpi_disabled)
> >  		return;
> >  
> > +	if (!efi_enabled(EFI_CONFIG_TABLES))

A better version should be checking EFI_BOOT, could you retest with
below instead? If it works I can send a patch with your Tested-by:
if (!efi_enabled(EFI_BOOT))

> > +		return;
> > +
> >  	if (table->length < sizeof(bgrt_tab)) {
> >  		pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
> >  		       table->length, sizeof(bgrt_tab));
> > 
> 
> -- 
> Sabrina

Thanks
Dave

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

* Re: [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code
  2017-05-15 13:18         ` Dave Young
@ 2017-05-15 13:44           ` Sabrina Dubroca
  0 siblings, 0 replies; 7+ messages in thread
From: Sabrina Dubroca @ 2017-05-15 13:44 UTC (permalink / raw)
  To: Dave Young
  Cc: Ard Biesheuvel, linux-kernel, Ingo Molnar, Thomas Gleixner,
	H . Peter Anvin, linux-efi, Matt Fleming, Rafael J. Wysocki,
	Len Brown, linux-acpi

2017-05-15, 21:18:35 +0800, Dave Young wrote:
> On 05/15/17 at 01:10pm, Sabrina Dubroca wrote:
> > 2017-05-15, 16:37:40 +0800, Dave Young wrote:
> > > diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
> > > index 04ca876..b986e26 100644
> > > --- a/arch/x86/platform/efi/efi-bgrt.c
> > > +++ b/arch/x86/platform/efi/efi-bgrt.c
> > > @@ -36,6 +36,9 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
> > >  	if (acpi_disabled)
> > >  		return;
> > >  
> > > +	if (!efi_enabled(EFI_CONFIG_TABLES))
> 
> A better version should be checking EFI_BOOT, could you retest with
> below instead? If it works I can send a patch with your Tested-by:
> if (!efi_enabled(EFI_BOOT))

Yes, that works. Thanks for the fix :)

> > > +		return;
> > > +
> > >  	if (table->length < sizeof(bgrt_tab)) {
> > >  		pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
> > >  		       table->length, sizeof(bgrt_tab));
> > > 
> > 
> > -- 
> > Sabrina
> 
> Thanks
> Dave

-- 
Sabrina

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

end of thread, other threads:[~2017-05-15 13:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31 13:21 [GIT PULL 00/10] EFI updates for v4.11 Ard Biesheuvel
2017-01-31 13:21 ` [PATCH 08/10] efi/x86: Move EFI BGRT init code to early init code Ard Biesheuvel
2017-05-13 23:18   ` Sabrina Dubroca
2017-05-15  8:37     ` Dave Young
2017-05-15 11:10       ` Sabrina Dubroca
2017-05-15 13:18         ` Dave Young
2017-05-15 13:44           ` Sabrina Dubroca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).