linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
@ 2017-04-27 12:07 Baoquan He
  2017-05-01 14:21 ` Thomas Garnier
  2017-05-05 20:42 ` Matt Fleming
  0 siblings, 2 replies; 11+ messages in thread
From: Baoquan He @ 2017-04-27 12:07 UTC (permalink / raw)
  To: linux-kernel
  Cc: Baoquan He, Dave Young, Matt Fleming, Ard Biesheuvel,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Thomas Garnier,
	Kees Cook, x86, linux-efi

For EFI with old_map enabled, Kernel will panic when kaslr is enabled.

The root cause is the ident mapping is not built correctly in this case.

For nokaslr kernel, PAGE_OFFSET is 0xffff880000000000 which is PGDIR_SIZE
aligned. We can borrow the pud table from direct mapping safely. Given a
physical address X, we have pud_index(X) == pud_index(__va(X)). However,
for kaslr kernel, PAGE_OFFSET is PUD_SIZE aligned. For a given physical
address X, pud_index(X) != pud_index(__va(X)). We can't only copy pgd entry
from direct mapping to build ident mapping, instead need copy pud entry
one by one from direct mapping.

So fix it in this patch.

The panic message is like below, an emty PUD or a wrong PUD.

[    0.233007] BUG: unable to handle kernel paging request at 000000007febd57e
[    0.233899] IP: 0x7febd57e
[    0.234000] PGD 1025a067
[    0.234000] PUD 0
[    0.234000]
[    0.234000] Oops: 0010 [#1] SMP
[    0.234000] Modules linked in:
[    0.234000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc8+ #125
[    0.234000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
[    0.234000] task: ffffffffafe104c0 task.stack: ffffffffafe00000
[    0.234000] RIP: 0010:0x7febd57e
[    0.234000] RSP: 0000:ffffffffafe03d98 EFLAGS: 00010086
[    0.234000] RAX: ffff8c9e3fff9540 RBX: 000000007c4b6000 RCX: 0000000000000480
[    0.234000] RDX: 0000000000000030 RSI: 0000000000000480 RDI: 000000007febd57e
[    0.234000] RBP: ffffffffafe03e40 R08: 0000000000000001 R09: 000000007c4b6000
[    0.234000] R10: ffffffffafa71a40 R11: 20786c6c2478303d R12: 0000000000000030
[    0.234000] R13: 0000000000000246 R14: ffff8c9e3c4198d8 R15: 0000000000000480
[    0.234000] FS:  0000000000000000(0000) GS:ffff8c9e3fa00000(0000) knlGS:0000000000000000
[    0.234000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.234000] CR2: 000000007febd57e CR3: 000000000fe09000 CR4: 00000000000406b0
[    0.234000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    0.234000] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[    0.234000] Call Trace:
[    0.234000]  ? efi_call+0x58/0x90
[    0.234000]  ? printk+0x58/0x6f
[    0.234000]  efi_enter_virtual_mode+0x3c5/0x50d
[    0.234000]  start_kernel+0x40f/0x4b8
[    0.234000]  ? set_init_arg+0x55/0x55
[    0.234000]  ? early_idt_handler_array+0x120/0x120
[    0.234000]  x86_64_start_reservations+0x24/0x26
[    0.234000]  x86_64_start_kernel+0x14c/0x16f
[    0.234000]  start_cpu+0x14/0x14
[    0.234000] Code:  Bad RIP value.
[    0.234000] RIP: 0x7febd57e RSP: ffffffffafe03d98
[    0.234000] CR2: 000000007febd57e
[    0.234000] ---[ end trace d4ded46ab8ab8ba9 ]---
[    0.234000] Kernel panic - not syncing: Attempted to kill the idle task!
[    0.234000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task!

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Dave Young <dyoung@redhat.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: x86@kernel.org
Cc: linux-efi@vger.kernel.org
---
v1->v2:
    Change code and add description according to Thomas's suggestion as below:

    1. Add checking if pud table is allocated successfully. If not just break
    the for loop.

    2. Add code comment to explain how the 1:1 mapping is built in efi_call_phys_prolog

    3. Other minor change

 arch/x86/platform/efi/efi_64.c | 72 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 64 insertions(+), 8 deletions(-)

diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 2ee7694..48de7fd 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -71,11 +71,13 @@ static void __init early_code_mapping_set_exec(int executable)
 
 pgd_t * __init efi_call_phys_prolog(void)
 {
-	unsigned long vaddress;
+	unsigned long vaddr, left_vaddr;
+	unsigned int num_entries;
 	pgd_t *save_pgd;
-
-	int pgd;
+	pud_t *pud, *pud_k;
+	int pud_idx;
 	int n_pgds;
+	int i;
 
 	if (!efi_enabled(EFI_OLD_MEMMAP)) {
 		save_pgd = (pgd_t *)read_cr3();
@@ -88,10 +90,51 @@ pgd_t * __init efi_call_phys_prolog(void)
 	n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
 	save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
 
-	for (pgd = 0; pgd < n_pgds; pgd++) {
-		save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
-		vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
-		set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
+	/*
+	 * We try to build 1:1 ident mapping for efi old_map usage. However,
+	 * whether kaslr is enabled or not, PAGE_OFFSET must be PUD_SIZE
+	 * aligned. Given a physical address X, we can copy its pud entry
+	 * of __va(X) to fill in its pud entry of 1:1 mapping since both
+	 * of them relate to the same physical memory position.
+	 *
+	 * And copying those pud entries one by one is inefficient. We copy
+	 * memory. Assume PAGE_OFFSET is not PGDIR_SIZE aligned, say it's
+	 * 0xffff880080000000, and we have memory bigger than 512G. Then the
+	 * first 512G will cross two pgd entries. We need copy memory twice.
+	 * The 1st pud entry will be in the 3rd slot of pud table, so we copy
+	 * pud[2] to pud[511] of the 1st pud table pointed by the 1st pgd entry
+	 * firstly, then copy pud[0] to pud[1] of the 2nd pud table pointed by
+	 * 2nd pgd entry at the second time.
+	 */
+	for (i = 0; i < n_pgds; i++) {
+		save_pgd[i] = *pgd_offset_k(i * PGDIR_SIZE);
+
+		vaddr = (unsigned long)__va(i * PGDIR_SIZE);
+
+		/*
+		 * Though it may fail to allocate page in the middle, just
+		 * leave those allocated pages there since 1:1 mapping has
+		 * been built. And efi region could be located there, efi_call
+		 * still can work.
+		 */
+		pud = pud_alloc_one(NULL, 0);
+		if (!pud) {
+			pr_err("Failed to allocate page for %d-th pud table "
+				"to build 1:1 mapping!\n", i);
+			break;
+		}
+
+		pud_idx = pud_index(vaddr);
+		num_entries = PTRS_PER_PUD - pud_idx;
+		pud_k = pud_offset(pgd_offset_k(vaddr), vaddr);
+		memcpy(pud, pud_k, num_entries);
+		if (pud_idx > 0) {
+			left_vaddr = vaddr + (num_entries * PUD_SIZE);
+			pud_k = pud_offset(pgd_offset_k(left_vaddr),
+					   left_vaddr);
+			memcpy(pud + num_entries, pud_k, pud_idx);
+		}
+		pgd_populate(NULL, pgd_offset_k(i * PGDIR_SIZE), pud);
 	}
 out:
 	__flush_tlb_all();
@@ -106,6 +149,8 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
 	 */
 	int pgd_idx;
 	int nr_pgds;
+	pud_t *pud;
+	pgd_t *pgd;
 
 	if (!efi_enabled(EFI_OLD_MEMMAP)) {
 		write_cr3((unsigned long)save_pgd);
@@ -115,8 +160,19 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
 
 	nr_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);
 
-	for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++)
+	for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++) {
+		pgd = pgd_offset_k(pgd_idx * PGDIR_SIZE);
+
+		/*
+		 * We need check if the pud table was really allocated
+		 * successfully. Otherwise no need to free.
+		 * */
+		if (pgd_val(*pgd) != pgd_val(save_pgd[pgd_idx])) {
+			pud = (pud_t *)pgd_page_vaddr(*pgd);
+			pud_free(NULL, pud);
+		}
 		set_pgd(pgd_offset_k(pgd_idx * PGDIR_SIZE), save_pgd[pgd_idx]);
+	}
 
 	kfree(save_pgd);
 
-- 
2.5.5

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-04-27 12:07 [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled Baoquan He
@ 2017-05-01 14:21 ` Thomas Garnier
  2017-05-05 20:42 ` Matt Fleming
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Garnier @ 2017-05-01 14:21 UTC (permalink / raw)
  To: Baoquan He
  Cc: LKML, Dave Young, Matt Fleming, Ard Biesheuvel, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, Kees Cook, the arch/x86 maintainers,
	linux-efi

On Thu, Apr 27, 2017 at 5:07 AM, Baoquan He <bhe@redhat.com> wrote:
> For EFI with old_map enabled, Kernel will panic when kaslr is enabled.
>
> The root cause is the ident mapping is not built correctly in this case.
>
> For nokaslr kernel, PAGE_OFFSET is 0xffff880000000000 which is PGDIR_SIZE
> aligned. We can borrow the pud table from direct mapping safely. Given a
> physical address X, we have pud_index(X) == pud_index(__va(X)). However,
> for kaslr kernel, PAGE_OFFSET is PUD_SIZE aligned. For a given physical
> address X, pud_index(X) != pud_index(__va(X)). We can't only copy pgd entry
> from direct mapping to build ident mapping, instead need copy pud entry
> one by one from direct mapping.
>
> So fix it in this patch.
>
> The panic message is like below, an emty PUD or a wrong PUD.
>
> [    0.233007] BUG: unable to handle kernel paging request at 000000007febd57e
> [    0.233899] IP: 0x7febd57e
> [    0.234000] PGD 1025a067
> [    0.234000] PUD 0
> [    0.234000]
> [    0.234000] Oops: 0010 [#1] SMP
> [    0.234000] Modules linked in:
> [    0.234000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc8+ #125
> [    0.234000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
> [    0.234000] task: ffffffffafe104c0 task.stack: ffffffffafe00000
> [    0.234000] RIP: 0010:0x7febd57e
> [    0.234000] RSP: 0000:ffffffffafe03d98 EFLAGS: 00010086
> [    0.234000] RAX: ffff8c9e3fff9540 RBX: 000000007c4b6000 RCX: 0000000000000480
> [    0.234000] RDX: 0000000000000030 RSI: 0000000000000480 RDI: 000000007febd57e
> [    0.234000] RBP: ffffffffafe03e40 R08: 0000000000000001 R09: 000000007c4b6000
> [    0.234000] R10: ffffffffafa71a40 R11: 20786c6c2478303d R12: 0000000000000030
> [    0.234000] R13: 0000000000000246 R14: ffff8c9e3c4198d8 R15: 0000000000000480
> [    0.234000] FS:  0000000000000000(0000) GS:ffff8c9e3fa00000(0000) knlGS:0000000000000000
> [    0.234000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [    0.234000] CR2: 000000007febd57e CR3: 000000000fe09000 CR4: 00000000000406b0
> [    0.234000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [    0.234000] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> [    0.234000] Call Trace:
> [    0.234000]  ? efi_call+0x58/0x90
> [    0.234000]  ? printk+0x58/0x6f
> [    0.234000]  efi_enter_virtual_mode+0x3c5/0x50d
> [    0.234000]  start_kernel+0x40f/0x4b8
> [    0.234000]  ? set_init_arg+0x55/0x55
> [    0.234000]  ? early_idt_handler_array+0x120/0x120
> [    0.234000]  x86_64_start_reservations+0x24/0x26
> [    0.234000]  x86_64_start_kernel+0x14c/0x16f
> [    0.234000]  start_cpu+0x14/0x14
> [    0.234000] Code:  Bad RIP value.
> [    0.234000] RIP: 0x7febd57e RSP: ffffffffafe03d98
> [    0.234000] CR2: 000000007febd57e
> [    0.234000] ---[ end trace d4ded46ab8ab8ba9 ]---
> [    0.234000] Kernel panic - not syncing: Attempted to kill the idle task!
> [    0.234000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Signed-off-by: Dave Young <dyoung@redhat.com>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Thomas Garnier <thgarnie@google.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: x86@kernel.org
> Cc: linux-efi@vger.kernel.org
> ---
> v1->v2:
>     Change code and add description according to Thomas's suggestion as below:
>
>     1. Add checking if pud table is allocated successfully. If not just break
>     the for loop.
>
>     2. Add code comment to explain how the 1:1 mapping is built in efi_call_phys_prolog
>
>     3. Other minor change
>

Thanks for the changes.

Acked-by: Thomas Garnier <thgarnie@google.com>

>  arch/x86/platform/efi/efi_64.c | 72 +++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 64 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index 2ee7694..48de7fd 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -71,11 +71,13 @@ static void __init early_code_mapping_set_exec(int executable)
>
>  pgd_t * __init efi_call_phys_prolog(void)
>  {
> -       unsigned long vaddress;
> +       unsigned long vaddr, left_vaddr;
> +       unsigned int num_entries;
>         pgd_t *save_pgd;
> -
> -       int pgd;
> +       pud_t *pud, *pud_k;
> +       int pud_idx;
>         int n_pgds;
> +       int i;
>
>         if (!efi_enabled(EFI_OLD_MEMMAP)) {
>                 save_pgd = (pgd_t *)read_cr3();
> @@ -88,10 +90,51 @@ pgd_t * __init efi_call_phys_prolog(void)
>         n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
>         save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
>
> -       for (pgd = 0; pgd < n_pgds; pgd++) {
> -               save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
> -               vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
> -               set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
> +       /*
> +        * We try to build 1:1 ident mapping for efi old_map usage. However,
> +        * whether kaslr is enabled or not, PAGE_OFFSET must be PUD_SIZE
> +        * aligned. Given a physical address X, we can copy its pud entry
> +        * of __va(X) to fill in its pud entry of 1:1 mapping since both
> +        * of them relate to the same physical memory position.
> +        *
> +        * And copying those pud entries one by one is inefficient. We copy
> +        * memory. Assume PAGE_OFFSET is not PGDIR_SIZE aligned, say it's
> +        * 0xffff880080000000, and we have memory bigger than 512G. Then the
> +        * first 512G will cross two pgd entries. We need copy memory twice.
> +        * The 1st pud entry will be in the 3rd slot of pud table, so we copy
> +        * pud[2] to pud[511] of the 1st pud table pointed by the 1st pgd entry
> +        * firstly, then copy pud[0] to pud[1] of the 2nd pud table pointed by
> +        * 2nd pgd entry at the second time.
> +        */
> +       for (i = 0; i < n_pgds; i++) {
> +               save_pgd[i] = *pgd_offset_k(i * PGDIR_SIZE);
> +
> +               vaddr = (unsigned long)__va(i * PGDIR_SIZE);
> +
> +               /*
> +                * Though it may fail to allocate page in the middle, just
> +                * leave those allocated pages there since 1:1 mapping has
> +                * been built. And efi region could be located there, efi_call
> +                * still can work.
> +                */
> +               pud = pud_alloc_one(NULL, 0);
> +               if (!pud) {
> +                       pr_err("Failed to allocate page for %d-th pud table "
> +                               "to build 1:1 mapping!\n", i);
> +                       break;
> +               }
> +
> +               pud_idx = pud_index(vaddr);
> +               num_entries = PTRS_PER_PUD - pud_idx;
> +               pud_k = pud_offset(pgd_offset_k(vaddr), vaddr);
> +               memcpy(pud, pud_k, num_entries);
> +               if (pud_idx > 0) {
> +                       left_vaddr = vaddr + (num_entries * PUD_SIZE);
> +                       pud_k = pud_offset(pgd_offset_k(left_vaddr),
> +                                          left_vaddr);
> +                       memcpy(pud + num_entries, pud_k, pud_idx);
> +               }
> +               pgd_populate(NULL, pgd_offset_k(i * PGDIR_SIZE), pud);
>         }
>  out:
>         __flush_tlb_all();
> @@ -106,6 +149,8 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
>          */
>         int pgd_idx;
>         int nr_pgds;
> +       pud_t *pud;
> +       pgd_t *pgd;
>
>         if (!efi_enabled(EFI_OLD_MEMMAP)) {
>                 write_cr3((unsigned long)save_pgd);
> @@ -115,8 +160,19 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
>
>         nr_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);
>
> -       for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++)
> +       for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++) {
> +               pgd = pgd_offset_k(pgd_idx * PGDIR_SIZE);
> +
> +               /*
> +                * We need check if the pud table was really allocated
> +                * successfully. Otherwise no need to free.
> +                * */
> +               if (pgd_val(*pgd) != pgd_val(save_pgd[pgd_idx])) {
> +                       pud = (pud_t *)pgd_page_vaddr(*pgd);
> +                       pud_free(NULL, pud);
> +               }
>                 set_pgd(pgd_offset_k(pgd_idx * PGDIR_SIZE), save_pgd[pgd_idx]);
> +       }
>
>         kfree(save_pgd);
>
> --
> 2.5.5
>



-- 
Thomas

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-04-27 12:07 [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled Baoquan He
  2017-05-01 14:21 ` Thomas Garnier
@ 2017-05-05 20:42 ` Matt Fleming
  2017-05-05 23:36   ` Borislav Petkov
  2017-05-11  9:32   ` Baoquan He
  1 sibling, 2 replies; 11+ messages in thread
From: Matt Fleming @ 2017-05-05 20:42 UTC (permalink / raw)
  To: Baoquan He
  Cc: linux-kernel, Dave Young, Ard Biesheuvel, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, Thomas Garnier, Kees Cook, x86,
	linux-efi, Alex Thorlton, Russ Anderson, Dimitri Sivanich,
	Mike Travis, Borislav Petkov

(Including the folks from SGI since this was hit on a UV system)

On Thu, 27 Apr, at 08:07:03PM, Baoquan He wrote:
> For EFI with old_map enabled, Kernel will panic when kaslr is enabled.
> 
> The root cause is the ident mapping is not built correctly in this case.
> 
> For nokaslr kernel, PAGE_OFFSET is 0xffff880000000000 which is PGDIR_SIZE
> aligned. We can borrow the pud table from direct mapping safely. Given a
> physical address X, we have pud_index(X) == pud_index(__va(X)). However,
> for kaslr kernel, PAGE_OFFSET is PUD_SIZE aligned. For a given physical
> address X, pud_index(X) != pud_index(__va(X)). We can't only copy pgd entry
> from direct mapping to build ident mapping, instead need copy pud entry
> one by one from direct mapping.
> 
> So fix it in this patch.
> 
> The panic message is like below, an emty PUD or a wrong PUD.
> 
> [    0.233007] BUG: unable to handle kernel paging request at 000000007febd57e
> [    0.233899] IP: 0x7febd57e
> [    0.234000] PGD 1025a067
> [    0.234000] PUD 0
> [    0.234000]
> [    0.234000] Oops: 0010 [#1] SMP
> [    0.234000] Modules linked in:
> [    0.234000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc8+ #125
> [    0.234000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
> [    0.234000] task: ffffffffafe104c0 task.stack: ffffffffafe00000
> [    0.234000] RIP: 0010:0x7febd57e
> [    0.234000] RSP: 0000:ffffffffafe03d98 EFLAGS: 00010086
> [    0.234000] RAX: ffff8c9e3fff9540 RBX: 000000007c4b6000 RCX: 0000000000000480
> [    0.234000] RDX: 0000000000000030 RSI: 0000000000000480 RDI: 000000007febd57e
> [    0.234000] RBP: ffffffffafe03e40 R08: 0000000000000001 R09: 000000007c4b6000
> [    0.234000] R10: ffffffffafa71a40 R11: 20786c6c2478303d R12: 0000000000000030
> [    0.234000] R13: 0000000000000246 R14: ffff8c9e3c4198d8 R15: 0000000000000480
> [    0.234000] FS:  0000000000000000(0000) GS:ffff8c9e3fa00000(0000) knlGS:0000000000000000
> [    0.234000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [    0.234000] CR2: 000000007febd57e CR3: 000000000fe09000 CR4: 00000000000406b0
> [    0.234000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [    0.234000] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> [    0.234000] Call Trace:
> [    0.234000]  ? efi_call+0x58/0x90
> [    0.234000]  ? printk+0x58/0x6f
> [    0.234000]  efi_enter_virtual_mode+0x3c5/0x50d
> [    0.234000]  start_kernel+0x40f/0x4b8
> [    0.234000]  ? set_init_arg+0x55/0x55
> [    0.234000]  ? early_idt_handler_array+0x120/0x120
> [    0.234000]  x86_64_start_reservations+0x24/0x26
> [    0.234000]  x86_64_start_kernel+0x14c/0x16f
> [    0.234000]  start_cpu+0x14/0x14
> [    0.234000] Code:  Bad RIP value.
> [    0.234000] RIP: 0x7febd57e RSP: ffffffffafe03d98
> [    0.234000] CR2: 000000007febd57e
> [    0.234000] ---[ end trace d4ded46ab8ab8ba9 ]---
> [    0.234000] Kernel panic - not syncing: Attempted to kill the idle task!
> [    0.234000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Signed-off-by: Dave Young <dyoung@redhat.com>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Thomas Garnier <thgarnie@google.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: x86@kernel.org
> Cc: linux-efi@vger.kernel.org
> ---
> v1->v2:
>     Change code and add description according to Thomas's suggestion as below:
> 
>     1. Add checking if pud table is allocated successfully. If not just break
>     the for loop.
> 
>     2. Add code comment to explain how the 1:1 mapping is built in efi_call_phys_prolog
> 
>     3. Other minor change
> 
>  arch/x86/platform/efi/efi_64.c | 72 +++++++++++++++++++++++++++++++++++++-----
>  1 file changed, 64 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index 2ee7694..48de7fd 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -71,11 +71,13 @@ static void __init early_code_mapping_set_exec(int executable)
>  
>  pgd_t * __init efi_call_phys_prolog(void)
>  {
> -	unsigned long vaddress;
> +	unsigned long vaddr, left_vaddr;
> +	unsigned int num_entries;
>  	pgd_t *save_pgd;
> -
> -	int pgd;
> +	pud_t *pud, *pud_k;
> +	int pud_idx;
>  	int n_pgds;
> +	int i;
>  
>  	if (!efi_enabled(EFI_OLD_MEMMAP)) {
>  		save_pgd = (pgd_t *)read_cr3();
> @@ -88,10 +90,51 @@ pgd_t * __init efi_call_phys_prolog(void)
>  	n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
>  	save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
>  
> -	for (pgd = 0; pgd < n_pgds; pgd++) {
> -		save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
> -		vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
> -		set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
> +	/*
> +	 * We try to build 1:1 ident mapping for efi old_map usage. However,
> +	 * whether kaslr is enabled or not, PAGE_OFFSET must be PUD_SIZE
> +	 * aligned. Given a physical address X, we can copy its pud entry
> +	 * of __va(X) to fill in its pud entry of 1:1 mapping since both
> +	 * of them relate to the same physical memory position.
> +	 *
> +	 * And copying those pud entries one by one is inefficient. We copy
> +	 * memory. Assume PAGE_OFFSET is not PGDIR_SIZE aligned, say it's
> +	 * 0xffff880080000000, and we have memory bigger than 512G. Then the
> +	 * first 512G will cross two pgd entries. We need copy memory twice.
> +	 * The 1st pud entry will be in the 3rd slot of pud table, so we copy
> +	 * pud[2] to pud[511] of the 1st pud table pointed by the 1st pgd entry
> +	 * firstly, then copy pud[0] to pud[1] of the 2nd pud table pointed by
> +	 * 2nd pgd entry at the second time.
> +	 */
> +	for (i = 0; i < n_pgds; i++) {
> +		save_pgd[i] = *pgd_offset_k(i * PGDIR_SIZE);
> +
> +		vaddr = (unsigned long)__va(i * PGDIR_SIZE);
> +
> +		/*
> +		 * Though it may fail to allocate page in the middle, just
> +		 * leave those allocated pages there since 1:1 mapping has
> +		 * been built. And efi region could be located there, efi_call
> +		 * still can work.
> +		 */
> +		pud = pud_alloc_one(NULL, 0);
> +		if (!pud) {
> +			pr_err("Failed to allocate page for %d-th pud table "
> +				"to build 1:1 mapping!\n", i);
> +			break;
> +		}
> +
> +		pud_idx = pud_index(vaddr);
> +		num_entries = PTRS_PER_PUD - pud_idx;
> +		pud_k = pud_offset(pgd_offset_k(vaddr), vaddr);
> +		memcpy(pud, pud_k, num_entries);
> +		if (pud_idx > 0) {
> +			left_vaddr = vaddr + (num_entries * PUD_SIZE);
> +			pud_k = pud_offset(pgd_offset_k(left_vaddr),
> +					   left_vaddr);
> +			memcpy(pud + num_entries, pud_k, pud_idx);
> +		}
> +		pgd_populate(NULL, pgd_offset_k(i * PGDIR_SIZE), pud);
>  	}
>  out:
>  	__flush_tlb_all();
> @@ -106,6 +149,8 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
>  	 */
>  	int pgd_idx;
>  	int nr_pgds;
> +	pud_t *pud;
> +	pgd_t *pgd;
>  
>  	if (!efi_enabled(EFI_OLD_MEMMAP)) {
>  		write_cr3((unsigned long)save_pgd);
> @@ -115,8 +160,19 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
>  
>  	nr_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);
>  
> -	for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++)
> +	for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++) {
> +		pgd = pgd_offset_k(pgd_idx * PGDIR_SIZE);
> +
> +		/*
> +		 * We need check if the pud table was really allocated
> +		 * successfully. Otherwise no need to free.
> +		 * */
> +		if (pgd_val(*pgd) != pgd_val(save_pgd[pgd_idx])) {
> +			pud = (pud_t *)pgd_page_vaddr(*pgd);
> +			pud_free(NULL, pud);
> +		}
>  		set_pgd(pgd_offset_k(pgd_idx * PGDIR_SIZE), save_pgd[pgd_idx]);
> +	}
>  
>  	kfree(save_pgd);

This seems like a lot of code for a really simple problem. Do other
1:1 users require this change? I'm thinking of the realmode trampoline
code.

If the SGI folks think this looks OK then I'll apply it with Thomas'
ACK.

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-05-05 20:42 ` Matt Fleming
@ 2017-05-05 23:36   ` Borislav Petkov
  2017-05-07 18:37     ` Bhupesh Sharma
  2017-05-08  3:18     ` Russ Anderson
  2017-05-11  9:32   ` Baoquan He
  1 sibling, 2 replies; 11+ messages in thread
From: Borislav Petkov @ 2017-05-05 23:36 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Baoquan He, linux-kernel, Dave Young, Ard Biesheuvel,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Thomas Garnier,
	Kees Cook, x86, linux-efi, Alex Thorlton, Russ Anderson,
	Dimitri Sivanich, Mike Travis

On Fri, May 05, 2017 at 09:42:14PM +0100, Matt Fleming wrote:
> (Including the folks from SGI since this was hit on a UV system)

Wasn't there a BIOS fix supplied at some point which obviated the need
to boot with efi=old_map on SGI boxes?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-05-05 23:36   ` Borislav Petkov
@ 2017-05-07 18:37     ` Bhupesh Sharma
  2017-05-08  1:36       ` Baoquan He
  2017-05-08  3:18     ` Russ Anderson
  1 sibling, 1 reply; 11+ messages in thread
From: Bhupesh Sharma @ 2017-05-07 18:37 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Matt Fleming, Baoquan He, linux-kernel, Dave Young,
	Ard Biesheuvel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Thomas Garnier, Kees Cook, x86, linux-efi, Alex Thorlton,
	Russ Anderson, Dimitri Sivanich, Mike Travis

On Sat, May 6, 2017 at 5:06 AM, Borislav Petkov <bp@alien8.de> wrote:
> On Fri, May 05, 2017 at 09:42:14PM +0100, Matt Fleming wrote:
>> (Including the folks from SGI since this was hit on a UV system)
>
> Wasn't there a BIOS fix supplied at some point which obviated the need
> to boot with efi=old_map on SGI boxes?
>

AFAICR, the bios fixes were provided only for SGI boxes with BIOS
version greater than or equal to UV2 (so upstream with recent bios
works on UV2, UV3, and UV4 hardware platforms, both with old and new
mapping, with new mapping being the default), however the UV1
platforms still use efi=old_map

Also as mentioned above since commit
caef78b6cdeddf4ad364f95910bba6b43b8eb9bf fixed the efi=old_map support
on UV systems even with new bios, they should ideally all boot up
properly in upstream both with 'nokaslr' and without 'nokaslr' in the
bootargs when efi=old_map is used.

Regards,
Bhupesh

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-05-07 18:37     ` Bhupesh Sharma
@ 2017-05-08  1:36       ` Baoquan He
  2017-05-08 15:25         ` Borislav Petkov
  0 siblings, 1 reply; 11+ messages in thread
From: Baoquan He @ 2017-05-08  1:36 UTC (permalink / raw)
  To: Bhupesh Sharma, Borislav Petkov, Matt Fleming
  Cc: linux-kernel, Dave Young, Ard Biesheuvel, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, Thomas Garnier, Kees Cook, x86,
	linux-efi, Alex Thorlton, Russ Anderson, Dimitri Sivanich,
	Mike Travis

Thanks for explaining, Bhupesh. 

BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to
use efi old map:

void __init efi_apply_memmap_quirks(void)
{
	...
	...
        /* UV2+ BIOS has a fix for this issue.  UV1 still needs the quirk. */
        if (dmi_check_system(sgi_uv1_dmi))
                set_bit(EFI_OLD_MEMMAP, &efi.flags);
}

And because of some reasons, redhat also need efi old_map now.

Hi Matt,

This v2 patch works on my kvm guest, however there's still problem on
SGI system. I will post v3 later after it's handled. So nack this v2
patch.

Thanks
Baoquan

On 05/08/17 at 12:07am, Bhupesh Sharma wrote:
> On Sat, May 6, 2017 at 5:06 AM, Borislav Petkov <bp@alien8.de> wrote:
> > On Fri, May 05, 2017 at 09:42:14PM +0100, Matt Fleming wrote:
> >> (Including the folks from SGI since this was hit on a UV system)
> >
> > Wasn't there a BIOS fix supplied at some point which obviated the need
> > to boot with efi=old_map on SGI boxes?
> >
> 
> AFAICR, the bios fixes were provided only for SGI boxes with BIOS
> version greater than or equal to UV2 (so upstream with recent bios
> works on UV2, UV3, and UV4 hardware platforms, both with old and new
> mapping, with new mapping being the default), however the UV1
> platforms still use efi=old_map
> 
> Also as mentioned above since commit
> caef78b6cdeddf4ad364f95910bba6b43b8eb9bf fixed the efi=old_map support
> on UV systems even with new bios, they should ideally all boot up
> properly in upstream both with 'nokaslr' and without 'nokaslr' in the
> bootargs when efi=old_map is used.
> 
> Regards,
> Bhupesh

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-05-05 23:36   ` Borislav Petkov
  2017-05-07 18:37     ` Bhupesh Sharma
@ 2017-05-08  3:18     ` Russ Anderson
  1 sibling, 0 replies; 11+ messages in thread
From: Russ Anderson @ 2017-05-08  3:18 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Matt Fleming, Baoquan He, linux-kernel, Dave Young,
	Ard Biesheuvel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Thomas Garnier, Kees Cook, x86, linux-efi, Alex Thorlton,
	Russ Anderson, Dimitri Sivanich, Mike Travis

On Sat, May 06, 2017 at 01:36:20AM +0200, Borislav Petkov wrote:
> On Fri, May 05, 2017 at 09:42:14PM +0100, Matt Fleming wrote:
> > (Including the folks from SGI since this was hit on a UV system)
> 
> Wasn't there a BIOS fix supplied at some point which obviated the need
> to boot with efi=old_map on SGI boxes?

Yes, and other fixes to get new and old mapping working (except
for UV1 hardware).  The kaslr patchset broke booting with old
mapping.  That is the issue Baoquan, Bhupesh, and legacy SGI
engineers are trying to fix.


For those that want a more detailed summary:

In early 2014 upstream EFI changed the mapping, which lead to setting EFI_OLD_MEMMAP on all UV systems.

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5d90c923bcfb9632d998ed06e9569216ad695f3

Later upstream fixes, plus a bios fix, got new mapping working.
Here are a couple of the fixes.

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=08914f436bdd2ed60923f49cbc402307aba20fe4
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/x86/platform/uv/bios_uv.c?id=f72075c9eda8a43aeea2f9dbb8d187afd4a76f0b

This patch enabled new EFI mapping on UV2+ platforms (all but UV1).
Note this is not bios version checking, it is hardware platform checking.

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/x86/platform/efi/quirks.c?id=d394f2d9d8e1e7b4959819344baf67b5995da9b0

One of the fixes to get new map to work broke old map.  This patch fixed it.

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/x86/platform/uv/bios_uv.c?id=caef78b6cdeddf4ad364f95910bba6b43b8eb9bf

So upstream with recent bios works on UV2, UV3, and UV4 hardware platforms,
both old and new mapping, with new mapping being the default.

Thanks.
-- 
Russ Anderson,  Hawks 2 Linux Kernel Group Manager
HPE - Hewlett Packard Enterprise (formerly SGI)  rja@hpe.com  (rja@sgi.com)

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-05-08  1:36       ` Baoquan He
@ 2017-05-08 15:25         ` Borislav Petkov
  2017-05-09  3:30           ` Baoquan He
  2017-05-10  2:30           ` Baoquan He
  0 siblings, 2 replies; 11+ messages in thread
From: Borislav Petkov @ 2017-05-08 15:25 UTC (permalink / raw)
  To: Baoquan He
  Cc: Bhupesh Sharma, Matt Fleming, linux-kernel, Dave Young,
	Ard Biesheuvel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Thomas Garnier, Kees Cook, x86, linux-efi, Alex Thorlton,
	Russ Anderson, Dimitri Sivanich, Mike Travis

On Mon, May 08, 2017 at 09:36:49AM +0800, Baoquan He wrote:
> Thanks for explaining, Bhupesh. 
> 
> BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to
> use efi old map:
> 
> void __init efi_apply_memmap_quirks(void)
> {
> 	...
> 	...
>         /* UV2+ BIOS has a fix for this issue.  UV1 still needs the quirk. */
>         if (dmi_check_system(sgi_uv1_dmi))
>                 set_bit(EFI_OLD_MEMMAP, &efi.flags);
> }
> 
> And because of some reasons, redhat also need efi old_map now.
> 
> Hi Matt,
> 
> This v2 patch works on my kvm guest, however there's still problem on
> SGI system. I will post v3 later after it's handled. So nack this v2
> patch.

Please do not top-post, you should know better.

Can you apply this debug patch and upload full dmesg?

---
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index c488625c9712..ca9df6283040 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -88,9 +88,18 @@ pgd_t * __init efi_call_phys_prolog(void)
 	n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
 	save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
 
+	pr_info("%s: PAGE_OFFSET: 0x%lx\n", __func__, PAGE_OFFSET);
+
 	for (pgd = 0; pgd < n_pgds; pgd++) {
 		save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
 		vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
+
+		pr_info("%s: pgd: 0x%x: va: 0x%lx, 0x%lx -> 0x%lx\n",
+			__func__, pgd,
+			vaddress,
+			pgd_val(*pgd_offset_k(pgd * PGDIR_SIZE)),
+			pgd_val(*pgd_offset_k(vaddress)));
+
 		set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
 	}
 out:
---

Thanks.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-05-08 15:25         ` Borislav Petkov
@ 2017-05-09  3:30           ` Baoquan He
  2017-05-10  2:30           ` Baoquan He
  1 sibling, 0 replies; 11+ messages in thread
From: Baoquan He @ 2017-05-09  3:30 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Bhupesh Sharma, Matt Fleming, linux-kernel, Dave Young,
	Ard Biesheuvel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Thomas Garnier, Kees Cook, x86, linux-efi, Alex Thorlton,
	Russ Anderson, Dimitri Sivanich, Mike Travis

[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]

On 05/08/17 at 05:25pm, Borislav Petkov wrote:
> On Mon, May 08, 2017 at 09:36:49AM +0800, Baoquan He wrote:
> > Thanks for explaining, Bhupesh. 
> > 
> > BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to
> > use efi old map:
> > 
> > void __init efi_apply_memmap_quirks(void)
> > {
> > 	...
> > 	...
> >         /* UV2+ BIOS has a fix for this issue.  UV1 still needs the quirk. */
> >         if (dmi_check_system(sgi_uv1_dmi))
> >                 set_bit(EFI_OLD_MEMMAP, &efi.flags);
> > }
> > 
> > And because of some reasons, redhat also need efi old_map now.
> > 
> > Hi Matt,
> > 
> > This v2 patch works on my kvm guest, however there's still problem on
> > SGI system. I will post v3 later after it's handled. So nack this v2
> > patch.
> 
> Please do not top-post, you should know better.
> 
> Can you apply this debug patch and upload full dmesg?

Please check the attachment.

> 
> ---
> diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> index c488625c9712..ca9df6283040 100644
> --- a/arch/x86/platform/efi/efi_64.c
> +++ b/arch/x86/platform/efi/efi_64.c
> @@ -88,9 +88,18 @@ pgd_t * __init efi_call_phys_prolog(void)
>  	n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
>  	save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
>  
> +	pr_info("%s: PAGE_OFFSET: 0x%lx\n", __func__, PAGE_OFFSET);
> +
>  	for (pgd = 0; pgd < n_pgds; pgd++) {
>  		save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
>  		vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
> +
> +		pr_info("%s: pgd: 0x%x: va: 0x%lx, 0x%lx -> 0x%lx\n",
> +			__func__, pgd,
> +			vaddress,
> +			pgd_val(*pgd_offset_k(pgd * PGDIR_SIZE)),
> +			pgd_val(*pgd_offset_k(vaddress)));
> +
>  		set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
>  	}
>  out:
> ---
> 
> Thanks.
> 
> -- 
> Regards/Gruss,
>     Boris.
> 
> Good mailing practices for 400: avoid top-posting and trim the reply.

[-- Attachment #2: debug_for_boris.log --]
[-- Type: text/plain, Size: 39255 bytes --]

[    0.000000] microcode: microcode updated early to revision 0xb00001d, date = 2016-06-06
[    0.000000] Linux version 4.11.0+ (root@sgi-uv300-03.rhts.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-14) (GCC) ) #8 SMP Mon May 8 20:59:49 EDT 2017
[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.11.0+ root=/dev/mapper/rhel_sgi--uv300--03-root ro add_efi_memmap earlyprintk=ttyS0,115200n8 intel_idle.max_cstate=1 loglevel=9 nmi_watchdog=0 nobau processor.max_cstate=1 crashkernel=auto rd.lvm.lv=rhel_sgi-uv300-03/root rd.lvm.lv=rhel_sgi-uv300-03/swap console=ttyS0,115200n8 LANG=en_US.UTF-8 efi=old_map efi=debug
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x0000000000051fff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000052000-0x000000000005afff] reserved
[    0.000000] BIOS-e820: [mem 0x000000000005b000-0x000000000009ffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000072829fff] usable
[    0.000000] BIOS-e820: [mem 0x000000007282a000-0x000000007282afff] reserved
[    0.000000] BIOS-e820: [mem 0x000000007282b000-0x0000000072837fff] usable
[    0.000000] BIOS-e820: [mem 0x0000000072838000-0x0000000072a77fff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000072a78000-0x00000000751fefff] usable
[    0.000000] BIOS-e820: [mem 0x00000000751ff000-0x0000000075efefff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000075eff000-0x0000000076efefff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x0000000076eff000-0x0000000076ffefff] ACPI data
[    0.000000] BIOS-e820: [mem 0x0000000076fff000-0x000000007effffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000080000000-0x000000008fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x0000001effffffff] usable
[    0.000000] BIOS-e820: [mem 0x0000002000000000-0x000000207fffffff] usable
[    0.000000] BIOS-e820: [mem 0x0000004000000000-0x0000005efeffffff] usable
[    0.000000] BIOS-e820: [mem 0x0000008000000000-0x0000009efeffffff] usable
[    0.000000] BIOS-e820: [mem 0x000000c000000000-0x000000defeffffff] usable
[    0.000000] BIOS-e820: [mem 0x00000ff800000000-0x00000ff803dfffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000ff803f00000-0x00000ff803ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000ff807f00000-0x00000ff807ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000ff80bf00000-0x00000ff80bffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000ff80ff00000-0x00000ff80fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000ffa00000000-0x00000ffa02ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000ffa04000000-0x00000ffa06ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000ffa08000000-0x00000ffa0affffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000ffa0c000000-0x00000ffa0effffff] reserved
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] bootconsole [earlyser0] enabled
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] e820: update [mem 0x73bf1018-0x73c05c57] usable ==> usable
[    0.000000] extended physical RAM map:
[    0.000000] reserve setup_data: [mem 0x0000000000000000-0x0000000000051fff] usable
[    0.000000] reserve setup_data: [mem 0x0000000000052000-0x000000000005afff] reserved
[    0.000000] reserve setup_data: [mem 0x000000000005b000-0x000000000009ffff] usable
[    0.000000] reserve setup_data: [mem 0x0000000000100000-0x0000000072829fff] usable
[    0.000000] reserve setup_data: [mem 0x000000007282a000-0x000000007282afff] reserved
[    0.000000] reserve setup_data: [mem 0x000000007282b000-0x0000000072837fff] usable
[    0.000000] reserve setup_data: [mem 0x0000000072838000-0x0000000072a77fff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000072a78000-0x0000000073bf1017] usable
[    0.000000] reserve setup_data: [mem 0x0000000073bf1018-0x0000000073c05c57] usable
[    0.000000] reserve setup_data: [mem 0x0000000073c05c58-0x00000000751fefff] usable
[    0.000000] reserve setup_data: [mem 0x00000000751ff000-0x0000000075efefff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000075eff000-0x0000000076efefff] ACPI NVS
[    0.000000] reserve setup_data: [mem 0x0000000076eff000-0x0000000076ffefff] ACPI data
[    0.000000] reserve setup_data: [mem 0x0000000076fff000-0x000000007effffff] usable
[    0.000000] reserve setup_data: [mem 0x0000000080000000-0x000000008fffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
[    0.000000] reserve setup_data: [mem 0x0000000100000000-0x0000001effffffff] usable
[    0.000000] reserve setup_data: [mem 0x0000002000000000-0x000000207fffffff] usable
[    0.000000] reserve setup_data: [mem 0x0000004000000000-0x0000005efeffffff] usable
[    0.000000] reserve setup_data: [mem 0x0000008000000000-0x0000009efeffffff] usable
[    0.000000] reserve setup_data: [mem 0x000000c000000000-0x000000defeffffff] usable
[    0.000000] reserve setup_data: [mem 0x00000ff800000000-0x00000ff803dfffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000ff803f00000-0x00000ff803ffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000ff807f00000-0x00000ff807ffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000ff80bf00000-0x00000ff80bffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000ff80ff00000-0x00000ff80fffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000ffa00000000-0x00000ffa02ffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000ffa04000000-0x00000ffa06ffffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000ffa08000000-0x00000ffa0affffff] reserved
[    0.000000] reserve setup_data: [mem 0x00000ffa0c000000-0x00000ffa0effffff] reserved
[    0.000000] efi: EFI v2.40 by EDK II
[    0.000000]                              BIOS ID: 0 BIOS ID:\x02
[    0.000000] efi:  SMBIOS=0x753f0000  ACPI=0x76ffe000  ACPI 2.0=0x76ffe014  UVsystab=0x753e5000 
[    0.000000] efi: mem00: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000000000-0x0000000000000fff] (0MB)
[    0.000000] efi: mem01: [Loader Data        |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000001000-0x0000000000001fff] (0MB)
[    0.000000] efi: mem02: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000002000-0x0000000000051fff] (0MB)
[    0.000000] efi: mem03: [Reserved           |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000052000-0x000000000005afff] (0MB)
[    0.000000] efi: mem04: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000000005b000-0x000000000009ffff] (0MB)
[    0.000000] efi: mem05: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000000100000-0x0000000000ffffff] (15MB)
[    0.000000] efi: mem06: [Loader Data        |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000001000000-0x00000000024c5fff] (20MB)
[    0.000000] efi: mem07: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000024c6000-0x000000003d464fff] (943MB)
[    0.000000] efi: mem08: [Loader Data        |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000003d465000-0x000000003fffffff] (43MB)
[    0.000000] efi: mem09: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000040000000-0x0000000045c73fff] (92MB)
[    0.000000] efi: mem10: [Loader Data        |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000045c74000-0x00000000601fffff] (421MB)
[    0.000000] efi: mem11: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000060200000-0x000000006027ffff] (0MB)
[    0.000000] efi: mem12: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000060280000-0x0000000062764fff] (36MB)
[    0.000000] efi: mem13: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000062765000-0x0000000072829fff] (256MB)
[    0.000000] efi: mem14: [Runtime Data       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007282a000-0x000000007282afff] (0MB)
[    0.000000] efi: mem15: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007282b000-0x0000000072837fff] (0MB)
[    0.000000] efi: mem16: [Runtime Data       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000072838000-0x0000000072a77fff] (2MB)
[    0.000000] efi: mem17: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000072a78000-0x00000000739fafff] (15MB)
[    0.000000] efi: mem18: [Boot Code          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000739fb000-0x00000000739fbfff] (0MB)
[    0.000000] efi: mem19: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000739fc000-0x0000000073bf0fff] (1MB)
[    0.000000] efi: mem20: [Loader Data        |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000073bf1000-0x0000000073dfefff] (2MB)
[    0.000000] efi: mem21: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000073dff000-0x00000000740acfff] (2MB)
[    0.000000] efi: mem22: [Loader Code        |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000740ad000-0x00000000741fefff] (1MB)
[    0.000000] efi: mem23: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000741ff000-0x0000000074a72fff] (8MB)
[    0.000000] efi: mem24: [Boot Code          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000074a73000-0x00000000751fefff] (7MB)
[    0.000000] efi: mem25: [Runtime Data       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000751ff000-0x00000000755fefff] (4MB)
[    0.000000] efi: mem26: [Runtime Code       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000755ff000-0x0000000075dfefff] (8MB)
[    0.000000] efi: mem27: [Reserved           |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000075dff000-0x0000000075efefff] (1MB)
[    0.000000] efi: mem28: [ACPI Memory NVS    |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000075eff000-0x0000000076efefff] (16MB)
[    0.000000] efi: mem29: [ACPI Reclaim Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000076eff000-0x0000000076ffefff] (1MB)
[    0.000000] efi: mem30: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000076fff000-0x000000007d302fff] (99MB)
[    0.000000] efi: mem31: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007d303000-0x000000007d303fff] (0MB)
[    0.000000] efi: mem32: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007d304000-0x000000007d324fff] (0MB)
[    0.000000] efi: mem33: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007d325000-0x000000007effffff] (28MB)
[    0.000000] efi: mem34: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000100000000-0x0000001effffffff] (122880MB)
[    0.000000] efi: mem35: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000002000000000-0x000000207fffffff] (2048MB)
[    0.000000] efi: mem36: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000004000000000-0x0000005efeffffff] (126960MB)
[    0.000000] efi: mem37: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000008000000000-0x0000009efeffffff] (126960MB)
[    0.000000] efi: mem38: [Conventional Memory|   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000c000000000-0x000000defeffffff] (126960MB)
[    0.000000] efi: mem39: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |  ] range=[0x0000000080000000-0x000000008fffffff] (256MB)
[    0.000000] efi: mem40: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000000f8000000-0x00000000fbffffff] (64MB)
[    0.000000] efi: mem41: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff800000000-0x00000ff803dfffff] (62MB)
[    0.000000] efi: mem42: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff803f00000-0x00000ff803ffffff] (1MB)
[    0.000000] efi: mem43: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff807f00000-0x00000ff807ffffff] (1MB)
[    0.000000] efi: mem44: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff80bf00000-0x00000ff80bffffff] (1MB)
[    0.000000] efi: mem45: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff80ff00000-0x00000ff80fffffff] (1MB)
[    0.000000] efi: mem46: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ffa00000000-0x00000ffa02ffffff] (48MB)
[    0.000000] efi: mem47: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ffa04000000-0x00000ffa06ffffff] (48MB)
[    0.000000] efi: mem48: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ffa08000000-0x00000ffa0affffff] (48MB)
[    0.000000] efi: mem49: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ffa0c000000-0x00000ffa0effffff] (48MB)
[    0.000000] SMBIOS 3.0 present.
[    0.000000] DMI: SGI UV300/UV300, BIOS SGI UV 300 series BIOS 05/25/2016
[    0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.000000] e820: last_pfn = 0xdeff000 max_arch_pfn = 0x400000000
[    0.000000] MTRR default type: write-back
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF uncachable
[    0.000000]   C0000-DFFFF write-protect
[    0.000000]   E0000-FFFFF uncachable
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 000080000000 mask 3FFF80000000 uncachable
[    0.000000]   1 base 0FF800000000 mask 3FF800000000 uncachable
[    0.000000]   2 base 100000000000 mask 300000000000 uncachable
[    0.000000]   3 base 00007F800000 mask 3FFFFFC00000 uncachable
[    0.000000]   4 disabled
[    0.000000]   5 disabled
[    0.000000]   6 disabled
[    0.000000]   7 disabled
[    0.000000]   8 disabled
[    0.000000]   9 disabled
[    0.000000] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT  
Memory KASLR using RDRAND RDTSC...
[    0.000000] e820: last_pfn = 0x7f000 max_arch_pfn = 0x400000000
[    0.000000] Base memory trampoline at [ffff9469c0099000] 99000 size 24576
[    0.000000] Using GB pages for direct mapping
[    0.000000] BRK [0x93e1488000, 0x93e1488fff] PGTABLE
[    0.000000] BRK [0x93e1489000, 0x93e1489fff] PGTABLE
[    0.000000] BRK [0x93e148a000, 0x93e148afff] PGTABLE
[    0.000000] BRK [0x93e148b000, 0x93e148bfff] PGTABLE
[    0.000000] BRK [0x93e148c000, 0x93e148cfff] PGTABLE
[    0.000000] BRK [0x93e148d000, 0x93e148dfff] PGTABLE
[    0.000000] BRK [0x93e148e000, 0x93e148efff] PGTABLE
[    0.000000] BRK [0x93e148f000, 0x93e148ffff] PGTABLE
[    0.000000] BRK [0x93e1490000, 0x93e1490fff] PGTABLE
[    0.000000] BRK [0x93e1491000, 0x93e1491fff] PGTABLE
[    0.000000] BRK [0x93e1492000, 0x93e1492fff] PGTABLE
[    0.000000] BRK [0x93e1493000, 0x93e1493fff] PGTABLE
[    0.000000] Secure boot could not be determined
[    0.000000] RAMDISK: [mem 0x3d465000-0x3fffafff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x0000000076FFE014 000024 (v02 INTEL )
[    0.000000] ACPI: XSDT 0x0000000076FFD0E8 000074 (v01 INTEL  TIANO    00000000      01000013)
[    0.000000] ACPI: FACP 0x0000000076FFC000 0000F4 (v04 INTEL  TIANO    00000000 MSFT 01000013)
[    0.000000] ACPI: DSDT 0x0000000076FF3000 007857 (v02 INTEL  TIANO    00000003 MSFT 01000013)
[    0.000000] ACPI: FACS 0x0000000076EFA000 000040
[    0.000000] ACPI: UEFI 0x0000000076EFC000 00005C (v01 INTEL  RstSataV 00000000      00000000)
[    0.000000] ACPI: HPET 0x0000000076FFB000 000038 (v01 INTEL  TIANO    00000001 MSFT 01000013)
[    0.000000] ACPI: SLIT 0x0000000076FF1000 00003C (v01 SGI3X  UVL      00000002 MSFT 00000001)
[    0.000000] ACPI: APIC 0x0000000076FEF000 000458 (v03 SGI3X  UVL      00000002 MSFT 00000001)
[    0.000000] ACPI: SRAT 0x0000000076FED000 000CF8 (v03 SGI3X  UVL      00000002 MSFT 00000001)
[    0.000000] ACPI: SSDT 0x0000000076FBF000 02D367 (v02 SGI3X  UVL      00000002 MSFT 01000013)
[    0.000000] ACPI: MCFG 0x0000000076FBE000 00007C (v01 SGI3X  UVL      00000002 MSFT 00000001)
[    0.000000] ACPI: SPCR 0x0000000076FBD000 000050 (v01                 00000000      00000000)
[    0.000000] ACPI: DMAR 0x0000000076FBC000 0000C4 (v01 INTEL  TIANO    00000001 MSFT 01000013)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] UV: rev:1 part#:9578 nodeid:0000 n_skt:7 pnmsk:7f pn:0
[    0.000000] UV: apicid_shift:0 apicid_mask:0x1f
[    0.000000] UV: socketid_shift:5 pnode_mask:0x7f
[    0.000000] UV: OEM IDs SGI3X/UVL, System/HUB Types 1/6, uv_apic 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0000 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0002 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0004 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0006 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0008 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x000a -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x000c -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x000e -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0010 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0012 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0014 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0016 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0018 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x001a -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x001c -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x001e -> Node 0
[    0.000000] SRAT: PXM 1 -> APIC 0x0020 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0022 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0024 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0026 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0028 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x002a -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x002c -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x002e -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0030 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0032 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0034 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0036 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0038 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x003a -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x003c -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x003e -> Node 1
[    0.000000] SRAT: PXM 2 -> APIC 0x0040 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0042 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0044 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0046 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0048 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x004a -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x004c -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x004e -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0050 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0052 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0054 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0056 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0058 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x005a -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x005c -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x005e -> Node 2
[    0.000000] SRAT: PXM 3 -> APIC 0x0060 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0062 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0064 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0066 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0068 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x006a -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x006c -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x006e -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0070 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0072 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0074 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0076 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0078 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x007a -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x007c -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x007e -> Node 3
[    0.000000] SRAT: PXM 0 -> APIC 0x0001 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0003 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0005 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0007 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0009 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x000b -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x000d -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x000f -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0011 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0013 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0015 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0017 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x0019 -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x001b -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x001d -> Node 0
[    0.000000] SRAT: PXM 0 -> APIC 0x001f -> Node 0
[    0.000000] SRAT: PXM 1 -> APIC 0x0021 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0023 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0025 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0027 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0029 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x002b -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x002d -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x002f -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0031 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0033 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0035 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0037 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x0039 -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x003b -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x003d -> Node 1
[    0.000000] SRAT: PXM 1 -> APIC 0x003f -> Node 1
[    0.000000] SRAT: PXM 2 -> APIC 0x0041 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0043 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0045 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0047 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0049 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x004b -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x004d -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x004f -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0051 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0053 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0055 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0057 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x0059 -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x005b -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x005d -> Node 2
[    0.000000] SRAT: PXM 2 -> APIC 0x005f -> Node 2
[    0.000000] SRAT: PXM 3 -> APIC 0x0061 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0063 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0065 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0067 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0069 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x006b -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x006d -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x006f -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0071 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0073 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0075 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0077 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x0079 -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x007b -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x007d -> Node 3
[    0.000000] SRAT: PXM 3 -> APIC 0x007f -> Node 3
[    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0x7fffffff]
[    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x100000000-0x207fffffff]
[    0.000000] ACPI: SRAT: Node 1 PXM 1 [mem 0x4000000000-0x5fffffffff]
[    0.000000] ACPI: SRAT: Node 2 PXM 2 [mem 0x8000000000-0x9fffffffff]
[    0.000000] ACPI: SRAT: Node 3 PXM 3 [mem 0xc000000000-0xdfffffffff]
[    0.000000] NUMA: Initialized distance table, cnt=4
[    0.000000] NUMA: Node 0 [mem 0x00000000-0x7fffffff] + [mem 0x100000000-0x207fffffff] -> [mem 0x00000000-0x207fffffff]
[    0.000000] NODE_DATA(0) allocated [mem 0x207ffd5000-0x207fffffff]
[    0.000000] NODE_DATA(1) allocated [mem 0x5efefd5000-0x5efeffffff]
[    0.000000] NODE_DATA(2) allocated [mem 0x9efefd5000-0x9efeffffff]
[    0.000000] NODE_DATA(3) allocated [mem 0xdefefd2000-0xdefeffcfff]
[    0.000000] kexec_core: crashkernel: memory value expected
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.000000]   DMA32    [mem 0x0000000001000000-0x00000000ffffffff]
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000defeffffff]
[    0.000000]   Device   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x0000000000051fff]
[    0.000000]   node   0: [mem 0x000000000005b000-0x000000000009ffff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x0000000072829fff]
[    0.000000]   node   0: [mem 0x000000007282b000-0x0000000072837fff]
[    0.000000]   node   0: [mem 0x0000000072a78000-0x00000000751fefff]
[    0.000000]   node   0: [mem 0x0000000076fff000-0x000000007effffff]
[    0.000000]   node   0: [mem 0x0000000100000000-0x0000001effffffff]
[    0.000000]   node   0: [mem 0x0000002000000000-0x000000207fffffff]
[    0.000000]   node   1: [mem 0x0000004000000000-0x0000005efeffffff]
[    0.000000]   node   2: [mem 0x0000008000000000-0x0000009efeffffff]
[    0.000000]   node   3: [mem 0x000000c000000000-0x000000defeffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000207fffffff]
[    0.000000] On node 0 totalpages: 32493397
[    0.000000]   DMA zone: 64 pages used for memmap
[    0.000000]   DMA zone: 22 pages reserved
[    0.000000]   DMA zone: 3990 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 7935 pages used for memmap
[    0.000000]   DMA32 zone: 507839 pages, LIFO batch:31
[    0.000000]   Normal zone: 516096 pages used for memmap
[    0.000000]   Normal zone: 31981568 pages, LIFO batch:31
[    0.000000] Initmem setup node 1 [mem 0x0000004000000000-0x0000005efeffffff]
[    0.000000] On node 1 totalpages: 32501760
[    0.000000]   Normal zone: 507840 pages used for memmap
[    0.000000]   Normal zone: 32501760 pages, LIFO batch:31
[    0.000000] Initmem setup node 2 [mem 0x0000008000000000-0x0000009efeffffff]
[    0.000000] On node 2 totalpages: 32501760
[    0.000000]   Normal zone: 507840 pages used for memmap
[    0.000000]   Normal zone: 32501760 pages, LIFO batch:31
[    0.000000] Initmem setup node 3 [mem 0x000000c000000000-0x000000defeffffff]
[    0.000000] On node 3 totalpages: 32501760
[    0.000000]   Normal zone: 507840 pages used for memmap
[    0.000000]   Normal zone: 32501760 pages, LIFO batch:31
[    0.000000] tboot: non-0 tboot_addr but it is not of type E820_TYPE_RESERVED
[    0.000000] ACPI: PM-Timer IO Port: 0x408
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] UV: rev:1 part#:9578 nodeid:0000 n_skt:7 pnmsk:7f pn:0
[    0.000000] UV: apicid_shift:0 apicid_mask:0x1f
[    0.000000] UV: socketid_shift:5 pnode_mask:0x7f
[    0.000000] UV: OEM IDs SGI3X/UVL, System/HUB Types 1/6, uv_apic 0
[    0.000000] IOAPIC[0]: apic_id 8, version 32, address 0xfec00000, GSI 0-23
[    0.000000] IOAPIC[1]: apic_id 9, version 32, address 0xfec01000, GSI 24-47
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a301 base: 0xfed00000
[    0.000000] smpboot: Allowing 128 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: Registered nosave memory: [mem 0x00052000-0x0005afff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000fffff]
[    0.000000] PM: Registered nosave memory: [mem 0x7282a000-0x7282afff]
[    0.000000] PM: Registered nosave memory: [mem 0x72838000-0x72a77fff]
[    0.000000] PM: Registered nosave memory: [mem 0x73bf1000-0x73bf1fff]
[    0.000000] PM: Registered nosave memory: [mem 0x73c05000-0x73c05fff]
[    0.000000] PM: Registered nosave memory: [mem 0x751ff000-0x75efefff]
[    0.000000] PM: Registered nosave memory: [mem 0x75eff000-0x76efefff]
[    0.000000] PM: Registered nosave memory: [mem 0x76eff000-0x76ffefff]
[    0.000000] PM: Registered nosave memory: [mem 0x7f000000-0x7fffffff]
[    0.000000] PM: Registered nosave memory: [mem 0x80000000-0x8fffffff]
[    0.000000] PM: Registered nosave memory: [mem 0x90000000-0xf7ffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xf8000000-0xfbffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfc000000-0xffffffff]
[    0.000000] PM: Registered nosave memory: [mem 0x1f00000000-0x1fffffffff]
[    0.000000] PM: Registered nosave memory: [mem 0x2080000000-0x3fffffffff]
[    0.000000] PM: Registered nosave memory: [mem 0x5eff000000-0x7fffffffff]
[    0.000000] PM: Registered nosave memory: [mem 0x9eff000000-0xbfffffffff]
[    0.000000] e820: [mem 0x90000000-0xf7ffffff] available for PCI devices
[    0.000000] Booting paravirtualized kernel on bare hardware
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    0.000000] setup_percpu: NR_CPUS:8192 nr_cpumask_bits:128 nr_cpu_ids:128 nr_node_ids:4
[    0.000000] percpu: Embedded 38 pages/cpu @ffff9489c3600000 s116376 r8192 d31080 u262144
[    0.000000] pcpu-alloc: s116376 r8192 d31080 u262144 alloc=1*2097152
[    0.000000] pcpu-alloc: [0] 000 001 002 003 004 005 006 007 
[    0.000000] pcpu-alloc: [0] 008 009 010 011 012 013 014 015 
[    0.000000] pcpu-alloc: [0] 064 065 066 067 068 069 070 071 
[    0.000000] pcpu-alloc: [0] 072 073 074 075 076 077 078 079 
[    0.000000] pcpu-alloc: [1] 016 017 018 019 020 021 022 023 
[    0.000000] pcpu-alloc: [1] 024 025 026 027 028 029 030 031 
[    0.000000] pcpu-alloc: [1] 080 081 082 083 084 085 086 087 
[    0.000000] pcpu-alloc: [1] 088 089 090 091 092 093 094 095 
[    0.000000] pcpu-alloc: [2] 032 033 034 035 036 037 038 039 
[    0.000000] pcpu-alloc: [2] 040 041 042 043 044 045 046 047 
[    0.000000] pcpu-alloc: [2] 096 097 098 099 100 101 102 103 
[    0.000000] pcpu-alloc: [2] 104 105 106 107 108 109 110 111 
[    0.000000] pcpu-alloc: [3] 048 049 050 051 052 053 054 055 
[    0.000000] pcpu-alloc: [3] 056 057 058 059 060 061 062 063 
[    0.000000] pcpu-alloc: [3] 112 113 114 115 116 117 118 119 
[    0.000000] pcpu-alloc: [3] 120 121 122 123 124 125 126 127 
[    0.000000] Built 4 zonelists in Node order, mobility grouping on.  Total pages: 127951040
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-4.11.0+ root=/dev/mapper/rhel_sgi--uv300--03-root ro add_efi_memmap earlyprintk=ttyS0,115200n8 intel_idle.max_cstate=1 loglevel=9 nmi_watchdog=0 nobau processor.max_cstate=1 crashkernel=auto rd.lvm.lv=rhel_sgi-uv300-03/root rd.lvm.lv=rhel_sgi-uv300-03/swap console=ttyS0,115200n8 LANG=en_US.UTF-8 efi=old_map efi=debug
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Memory: 10008884K/519994708K available (7546K kernel code, 1506K rwdata, 3336K rodata, 2160K init, 2920K bss, 8593352K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=128, Nodes=4
[    0.000000] ftrace: allocating 31399 entries in 123 pages
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	Build-time adjustment of leaf fanout to 64.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=8192 to nr_cpu_ids=128.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=128
[    0.000000] NR_IRQS:524544 nr_irqs:1856 16
[    0.000000] Console: colour dummy device 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] console [ttyS0] enabled
[    0.000000] bootconsole [earlyser0] disabled
[    0.000000] bootconsole [earlyser0] disabled
[    0.000000] mempolicy: Enabling automatic NUMA balancing. Configure with numa_balancing= or the kernel.numa_balancing sysctl
[    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 133484882848 ns
[    0.000000] hpet clockevent registered
[    0.001000] tsc: Fast TSC calibration using PIT
[    0.002000] tsc: Detected 2099.972 MHz processor
[    0.003000] Calibrating delay loop (skipped), value calculated using timer frequency.. 4199.94 BogoMIPS (lpj=2099972)
[    0.004003] pid_max: default: 131072 minimum: 1024
[    0.005129] ACPI: Core revision 20170119
[    0.018125] ACPI: 2 ACPI AML tables successfully acquired and loaded
[    0.019151] efi: EFI runtime memory map:
[    0.020008] efi: mem00: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000060200000-0x000000006027ffff] (0MB)
[    0.021003] efi: mem01: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000062765000-0x0000000072829fff] (256MB)
[    0.022004] efi: mem02: [Runtime Data       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007282a000-0x000000007282afff] (0MB)
[    0.023003] efi: mem03: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007282b000-0x0000000072837fff] (0MB)
[    0.024003] efi: mem04: [Runtime Data       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000072838000-0x0000000072a77fff] (2MB)
[    0.025003] efi: mem05: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000072a78000-0x00000000739fafff] (15MB)
[    0.026003] efi: mem06: [Boot Code          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000739fb000-0x00000000739fbfff] (0MB)
[    0.027003] efi: mem07: [Boot Code          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x0000000074a73000-0x00000000751fefff] (7MB)
[    0.028003] efi: mem08: [Runtime Data       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000751ff000-0x00000000755fefff] (4MB)
[    0.029003] efi: mem09: [Runtime Code       |RUN|  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x00000000755ff000-0x0000000075dfefff] (8MB)
[    0.030003] efi: mem10: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007d303000-0x000000007d303fff] (0MB)
[    0.031003] efi: mem11: [Boot Data          |   |  |  |  |  |  |  |   |WB|WT|WC|UC] range=[0x000000007d325000-0x000000007effffff] (28MB)
[    0.032003] efi: mem12: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |  ] range=[0x0000000080000000-0x000000008fffffff] (256MB)
[    0.033003] efi: mem13: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000000f8000000-0x00000000fbffffff] (64MB)
[    0.034003] efi: mem14: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff800000000-0x00000ff803dfffff] (62MB)
[    0.035003] efi: mem15: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff803f00000-0x00000ff803ffffff] (1MB)
[    0.036003] efi: mem16: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff807f00000-0x00000ff807ffffff] (1MB)
[    0.037003] efi: mem17: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff80bf00000-0x00000ff80bffffff] (1MB)
[    0.038003] efi: mem18: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ff80ff00000-0x00000ff80fffffff] (1MB)
[    0.039003] efi: mem19: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ffa00000000-0x00000ffa02ffffff] (48MB)
[    0.040003] efi: mem20: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ffa04000000-0x00000ffa06ffffff] (48MB)
[    0.041003] efi: mem21: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ffa08000000-0x00000ffa0affffff] (48MB)
[    0.042003] efi: mem22: [Memory Mapped I/O  |RUN|  |  |  |  |  |  |   |  |  |  |UC] range=[0x00000ffa0c000000-0x00000ffa0effffff] (48MB)
[    0.043139] efi: efi_call_phys_prolog: PAGE_OFFSET: 0xffff9469c0000000
[    0.044003] efi: efi_call_phys_prolog: pgd: 0x0: va: 0xffff9469c0000000, 0x0 -> 0x93e1488067
[    0.045002] efi: efi_call_phys_prolog: pgd: 0x1: va: 0xffff94e9c0000000, 0x0 -> 0xdefefff067
[    0.046010] BUG: unable to handle kernel paging request at 0000000075dc4850
[    0.047000] IP: 0x75dc4850
[    0.047000] PGD 93e1488067 
[    0.047000] P4D 93e1488067 
[    0.047000] PUD 0 
[    0.047000] 
[    0.047000] Oops: 0010 [#1] SMP
[    0.047000] Modules linked in:
[    0.047000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0+ #8
[    0.047000] Hardware name: SGI UV300/UV300, BIOS SGI UV 300 series BIOS 05/25/2016
[    0.047000] task: ffffffff9a0104c0 task.stack: ffffffff9a000000
[    0.047000] RIP: 0010:0x75dc4850
[    0.047000] RSP: 0000:ffffffff9a003d98 EFLAGS: 00010086
[    0.047000] RAX: ffff9548befcc000 RBX: 000000c07fc22000 RCX: 0000000000000450
[    0.047000] RDX: 0000000000000030 RSI: 0000000000000450 RDI: 0000000075dc4850
[    0.047000] RBP: ffffffff9a003e40 R08: 0000000000000001 R09: 000000c07fc22000
[    0.047000] R10: 65647830203e2d20 R11: 3736306666666566 R12: 0000000000000030
[    0.047000] R13: 0000000000000246 R14: ffff946b3fcb0ce0 R15: 0000000000000450
[    0.047000] FS:  0000000000000000(0000) GS:ffff9489c3600000(0000) knlGS:0000000000000000
[    0.047000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    0.047000] CR2: 0000000075dc4850 CR3: 00000093e0e09000 CR4: 00000000000406b0
[    0.047000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    0.047000] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[    0.047000] Call Trace:
[    0.047000]  ? efi_call+0x58/0x90
[    0.047000]  ? vprintk_func+0x20/0x50
[    0.047000]  ? printk+0x58/0x6f
[    0.047000]  efi_enter_virtual_mode+0x3ca/0x512
[    0.047000]  start_kernel+0x424/0x4c8
[    0.047000]  ? set_init_arg+0x5a/0x5a
[    0.047000]  ? early_idt_handler_array+0x120/0x120
[    0.047000]  x86_64_start_reservations+0x29/0x2b
[    0.047000]  x86_64_start_kernel+0x151/0x174
[    0.047000]  secondary_startup_64+0x9f/0x9f
[    0.047000] Code:  Bad RIP value.
[    0.047000] RIP: 0x75dc4850 RSP: ffffffff9a003d98
[    0.047000] CR2: 0000000075dc4850
[    0.047000] ---[ end trace 5f12edd1f8c1b98e ]---
[    0.047000] Kernel panic - not syncing: Fatal exception
[    0.047000] ---[ end Kernel panic - not syncing: Fatal exception

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-05-08 15:25         ` Borislav Petkov
  2017-05-09  3:30           ` Baoquan He
@ 2017-05-10  2:30           ` Baoquan He
  1 sibling, 0 replies; 11+ messages in thread
From: Baoquan He @ 2017-05-10  2:30 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Bhupesh Sharma, Matt Fleming, linux-kernel, Dave Young,
	Ard Biesheuvel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Thomas Garnier, Kees Cook, x86, linux-efi, Alex Thorlton,
	Russ Anderson, Dimitri Sivanich, Mike Travis

On 05/08/17 at 05:25pm, Borislav Petkov wrote:
> On Mon, May 08, 2017 at 09:36:49AM +0800, Baoquan He wrote:
> > Thanks for explaining, Bhupesh. 
> > 
> > BIOS issue of SGI uv1 is still not fixed. There's a quirk for uv1 to
> > use efi old map:
> > 
> > void __init efi_apply_memmap_quirks(void)
> > {
> > 	...
> > 	...
> >         /* UV2+ BIOS has a fix for this issue.  UV1 still needs the quirk. */
> >         if (dmi_check_system(sgi_uv1_dmi))
> >                 set_bit(EFI_OLD_MEMMAP, &efi.flags);
> > }
> > 
> > And because of some reasons, redhat also need efi old_map now.
> > 
> > Hi Matt,
> > 
> > This v2 patch works on my kvm guest, however there's still problem on
> > SGI system. I will post v3 later after it's handled. So nack this v2
> > patch.
> 

I have rewrote patch with p4d considered. Now with the patch applied,
nokaslr works, means the pud copying is right. While another crash
occured, from back trace it's different reason. Will arrange patch and
paste it with boot log.

Thanks
Baoquan

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

* Re: [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled
  2017-05-05 20:42 ` Matt Fleming
  2017-05-05 23:36   ` Borislav Petkov
@ 2017-05-11  9:32   ` Baoquan He
  1 sibling, 0 replies; 11+ messages in thread
From: Baoquan He @ 2017-05-11  9:32 UTC (permalink / raw)
  To: Matt Fleming, Borislav Petkov, Russ Anderson, Alex Thorlton,
	Dimitri Sivanich, Mike Travis
  Cc: linux-kernel, Dave Young, Ard Biesheuvel, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, Thomas Garnier, Kees Cook, x86,
	linux-efi

Hi all,

On 05/05/17 at 09:42pm, Matt Fleming wrote:
> (Including the folks from SGI since this was hit on a UV system)

After debugging, I got the reason why kernel still crash casually when
the ident mapping issue of old_map efi has been fixed. It's because
SGI UV3 needs map MMIOH regions.  On a SGI uv3 system, I found that
there are two MMIOH regions:

[    1.519001] UV: Map MMIOH0_HI 0xffc00000000 - 0x100000000000
                                      16TB-16G -  16T
[    1.523001] UV: Map MMIOH1_HI 0x100000000000 - 0x200000000000
                                           16TB - 32TB
On this system, 512G ram are spread out to 1TB regions. Then above two
SGI MMIOH region also will be mapped into direct mapping section by
adding PAGE_OFFSET. The thing is SGI UV3 maps its MMIOH region to direct
mapping in uv_system_init() which is called during
kernel_init_freeable(), it's much later than kernel_randomize_memory(),
mm KASLR has no chance to take it into consideration.

When kaslr disabled, we can see that there are 64T
memory for ram. If system ram is not big enough, the left space of the
whole 64T memory is still enough to contain MMIOH regions to make it not
reach vmalloc and vmemmap area. 

ffff880000000000 - ffffc7ffffffffff (=64 TB) direct mapping of all phys.
memory                                                                  
136T - 200T
ffffc80000000000 - ffffc8ffffffffff (=40 bits) hole
200T - 201T
ffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap space
201T - 233T 

While with kaslr enabled, there's no this 64T memory reserved thing for
system ram any more. KASLR only reserve the actual size of system ram plus
10TB for direct mapping. So on SGI uv3 system, with kaslr enabled, MMIOH
region mapping could touch vmalloc or vmemmap area and trigger the BUG_ON()
in __init_extra_mapping().

Below is the back trace of crash after the ident mapping of old_map is
fixed. I believe this will happen on new map efi too, will reboot
several times to test new map efi.

So I will repost v3 for the ident mapping of old_map efi issue because
that is a code bug and independent with this one. And any idea about
this SGI uv3 MMIOH mapping issue?
 

[    1.375001] UV: Found UV300 hub
[    1.376007] UV: UVsystab: Revision:1
[    1.377001] UV: No UVsystab socket table, ignoring
[    1.378003] UV: N:7 M:38 m_shift:26 n_lshift:43
[    1.379001] UV: gpa_mask/shift:0x1fffffffffff/0 pnode_mask:0x7f apic_pns:5
[    1.380001] UV: mmr_base/shift:0xffa00000000/26 gru_base/shift:0x0/0
[    1.381001] UV: gnode_upper:0x0 gnode_extra:0x0
[    1.382001] UV: NODE_PRESENT_DEPTH = 16
[    1.383001] UV: NODE_PRESENT(0) = 0x000000000000000f
[    1.384005] UV: Found 4 hubs, 4 nodes, 128 CPUs
[    1.385076] UV: UVHUB node: 0 pn:00 nrcpus:32
[    1.386001] UV: UVHUB node: 1 pn:01 nrcpus:32
[    1.387001] UV: UVHUB node: 2 pn:02 nrcpus:32
[    1.388001] UV: UVHUB node: 3 pn:03 nrcpus:32
[    1.389001] UV: min_pnode:00 max_pnode:03
[    1.390002] UV: Map GRU_HI 0xff000000000 - 0xff040000000
[    1.391013] UV: Map MMR_HI 0xffa00000000 - 0xffa10000000
[    1.392004] UV: MMIOH0 overlay 0x8006cffc00000000 base:0x3ff00 m_io:27
[    1.393029] UV: MMIOH0[000..127] NASID 0x0000 ADDR 0x00000ffc00000000 - 0x0000100000000000
[    1.394001] UV: MMIOH0 base:0x3ff00 shift:26 M_IO:27 MAX_IO:127
[    1.395001] UV: Map MMIOH0_HI 0xffc00000000 - 0x100000000000
[    1.396116] UV: MMIOH1 overlay 0x8009500000000000 base:0x40000 m_io:37
[    1.397029] UV: MMIOH1[000..127] NASID 0x0000 ADDR 0x0000100000000000 - 0x0000200000000000
[    1.398001] UV: MMIOH1 base:0x40000 shift:26 M_IO:37 MAX_IO:127
[    1.399001] UV: Map MMIOH1_HI 0x100000000000 - 0x200000000000
[    1.487916] ------------[ cut here ]------------
[    1.488002] kernel BUG at arch/x86/mm/init_64.c:311!
[    1.489003] invalid opcode: 0000 [#1] SMP
[    1.490000] Modules linked in:
[    1.490000] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.11.0+ #17
[    1.490000] Hardware name: SGI UV300/UV300, BIOS SGI UV 300 series BIOS 05/25/2016
[    1.490000] task: ffff88d6f3910000 task.stack: ffffa488c0018000
[    1.490000] RIP: 0010:__init_extra_mapping+0x188/0x196
[    1.490000] RSP: 0000:ffffa488c001bc50 EFLAGS: 00010202
[    1.490000] RAX: ffff88d6ffc02000 RBX: ffff8897ffd16118 RCX: 00003ffffffff000
[    1.490000] RDX: ffff88d6ffc02000 RSI: 80001bf23fe001fb RDI: 0000000000000000
[    1.490000] RBP: ffffa488c001bc80 R08: 0000000000000000 R09: 000000000001f458
[    1.490000] R10: ffff88b6fffd5d00 R11: 0000000000000001 R12: 00001bf240000000
[    1.490000] R13: 0000040dc0000000 R14: 80000000000001fb R15: 0000000000000118
[    1.490000] FS:  0000000000000000(0000) GS:ffff88b683600000(0000) knlGS:0000000000000000
[    1.490000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    1.490000] CR2: ffff89757efff000 CR3: 0000000430a09000 CR4: 00000000003406f0
[    1.490000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    1.490000] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[    1.490000] Call Trace:
[    1.490000]  init_extra_mapping_uc+0x13/0x15
[    1.490000]  map_high+0x67/0x75
[    1.490000]  map_mmioh_high_uv3+0x20a/0x219
[    1.490000]  uv_system_init_hub+0x12d9/0x1496
[    1.490000]  uv_system_init+0x27/0x29
[    1.490000]  native_smp_prepare_cpus+0x28d/0x2d8
[    1.490000]  kernel_init_freeable+0xdd/0x253
[    1.490000]  ? rest_init+0x80/0x80
[    1.490000]  kernel_init+0xe/0x110
[    1.490000]  ret_from_fork+0x2c/0x40
[    1.490000] Code: 0a ee 29 ff 66 90 48 8b 3b e8 30 2e 2a ff 4c 89 e2
48 c1 ea 12 81 e2 f8 0f 00 00 48 01 c2 48 f7 02 9f ff ff ff 0f 84 da fe
ff ff <0f> 0b 58 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 1f 44 00 00 55 48 
[    1.490000] RIP: __init_extra_mapping+0x188/0x196 RSP: ffffa488c001bc50
[    1.490002] ---[ end trace f1736a9e6e4b7656 ]---
[    1.491001] Kernel panic - not syncing: Fatal exception
[    1.492000] ---[ end Kernel panic - not syncing: Fatal exception
******** [20170511.020636] BMC r001i11b: Power OFF via BMC 
******** [20170511.020701] BMC r001i11b: Power ON via BMC

> 
> On Thu, 27 Apr, at 08:07:03PM, Baoquan He wrote:
> > For EFI with old_map enabled, Kernel will panic when kaslr is enabled.
> > 
> > The root cause is the ident mapping is not built correctly in this case.
> > 
> > For nokaslr kernel, PAGE_OFFSET is 0xffff880000000000 which is PGDIR_SIZE
> > aligned. We can borrow the pud table from direct mapping safely. Given a
> > physical address X, we have pud_index(X) == pud_index(__va(X)). However,
> > for kaslr kernel, PAGE_OFFSET is PUD_SIZE aligned. For a given physical
> > address X, pud_index(X) != pud_index(__va(X)). We can't only copy pgd entry
> > from direct mapping to build ident mapping, instead need copy pud entry
> > one by one from direct mapping.
> > 
> > So fix it in this patch.
> > 
> > The panic message is like below, an emty PUD or a wrong PUD.
> > 
> > [    0.233007] BUG: unable to handle kernel paging request at 000000007febd57e
> > [    0.233899] IP: 0x7febd57e
> > [    0.234000] PGD 1025a067
> > [    0.234000] PUD 0
> > [    0.234000]
> > [    0.234000] Oops: 0010 [#1] SMP
> > [    0.234000] Modules linked in:
> > [    0.234000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc8+ #125
> > [    0.234000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
> > [    0.234000] task: ffffffffafe104c0 task.stack: ffffffffafe00000
> > [    0.234000] RIP: 0010:0x7febd57e
> > [    0.234000] RSP: 0000:ffffffffafe03d98 EFLAGS: 00010086
> > [    0.234000] RAX: ffff8c9e3fff9540 RBX: 000000007c4b6000 RCX: 0000000000000480
> > [    0.234000] RDX: 0000000000000030 RSI: 0000000000000480 RDI: 000000007febd57e
> > [    0.234000] RBP: ffffffffafe03e40 R08: 0000000000000001 R09: 000000007c4b6000
> > [    0.234000] R10: ffffffffafa71a40 R11: 20786c6c2478303d R12: 0000000000000030
> > [    0.234000] R13: 0000000000000246 R14: ffff8c9e3c4198d8 R15: 0000000000000480
> > [    0.234000] FS:  0000000000000000(0000) GS:ffff8c9e3fa00000(0000) knlGS:0000000000000000
> > [    0.234000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > [    0.234000] CR2: 000000007febd57e CR3: 000000000fe09000 CR4: 00000000000406b0
> > [    0.234000] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> > [    0.234000] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> > [    0.234000] Call Trace:
> > [    0.234000]  ? efi_call+0x58/0x90
> > [    0.234000]  ? printk+0x58/0x6f
> > [    0.234000]  efi_enter_virtual_mode+0x3c5/0x50d
> > [    0.234000]  start_kernel+0x40f/0x4b8
> > [    0.234000]  ? set_init_arg+0x55/0x55
> > [    0.234000]  ? early_idt_handler_array+0x120/0x120
> > [    0.234000]  x86_64_start_reservations+0x24/0x26
> > [    0.234000]  x86_64_start_kernel+0x14c/0x16f
> > [    0.234000]  start_cpu+0x14/0x14
> > [    0.234000] Code:  Bad RIP value.
> > [    0.234000] RIP: 0x7febd57e RSP: ffffffffafe03d98
> > [    0.234000] CR2: 000000007febd57e
> > [    0.234000] ---[ end trace d4ded46ab8ab8ba9 ]---
> > [    0.234000] Kernel panic - not syncing: Attempted to kill the idle task!
> > [    0.234000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > Cc: Matt Fleming <matt@codeblueprint.co.uk>
> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: Thomas Garnier <thgarnie@google.com>
> > Cc: Kees Cook <keescook@chromium.org>
> > Cc: x86@kernel.org
> > Cc: linux-efi@vger.kernel.org
> > ---
> > v1->v2:
> >     Change code and add description according to Thomas's suggestion as below:
> > 
> >     1. Add checking if pud table is allocated successfully. If not just break
> >     the for loop.
> > 
> >     2. Add code comment to explain how the 1:1 mapping is built in efi_call_phys_prolog
> > 
> >     3. Other minor change
> > 
> >  arch/x86/platform/efi/efi_64.c | 72 +++++++++++++++++++++++++++++++++++++-----
> >  1 file changed, 64 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
> > index 2ee7694..48de7fd 100644
> > --- a/arch/x86/platform/efi/efi_64.c
> > +++ b/arch/x86/platform/efi/efi_64.c
> > @@ -71,11 +71,13 @@ static void __init early_code_mapping_set_exec(int executable)
> >  
> >  pgd_t * __init efi_call_phys_prolog(void)
> >  {
> > -	unsigned long vaddress;
> > +	unsigned long vaddr, left_vaddr;
> > +	unsigned int num_entries;
> >  	pgd_t *save_pgd;
> > -
> > -	int pgd;
> > +	pud_t *pud, *pud_k;
> > +	int pud_idx;
> >  	int n_pgds;
> > +	int i;
> >  
> >  	if (!efi_enabled(EFI_OLD_MEMMAP)) {
> >  		save_pgd = (pgd_t *)read_cr3();
> > @@ -88,10 +90,51 @@ pgd_t * __init efi_call_phys_prolog(void)
> >  	n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
> >  	save_pgd = kmalloc_array(n_pgds, sizeof(*save_pgd), GFP_KERNEL);
> >  
> > -	for (pgd = 0; pgd < n_pgds; pgd++) {
> > -		save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
> > -		vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
> > -		set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
> > +	/*
> > +	 * We try to build 1:1 ident mapping for efi old_map usage. However,
> > +	 * whether kaslr is enabled or not, PAGE_OFFSET must be PUD_SIZE
> > +	 * aligned. Given a physical address X, we can copy its pud entry
> > +	 * of __va(X) to fill in its pud entry of 1:1 mapping since both
> > +	 * of them relate to the same physical memory position.
> > +	 *
> > +	 * And copying those pud entries one by one is inefficient. We copy
> > +	 * memory. Assume PAGE_OFFSET is not PGDIR_SIZE aligned, say it's
> > +	 * 0xffff880080000000, and we have memory bigger than 512G. Then the
> > +	 * first 512G will cross two pgd entries. We need copy memory twice.
> > +	 * The 1st pud entry will be in the 3rd slot of pud table, so we copy
> > +	 * pud[2] to pud[511] of the 1st pud table pointed by the 1st pgd entry
> > +	 * firstly, then copy pud[0] to pud[1] of the 2nd pud table pointed by
> > +	 * 2nd pgd entry at the second time.
> > +	 */
> > +	for (i = 0; i < n_pgds; i++) {
> > +		save_pgd[i] = *pgd_offset_k(i * PGDIR_SIZE);
> > +
> > +		vaddr = (unsigned long)__va(i * PGDIR_SIZE);
> > +
> > +		/*
> > +		 * Though it may fail to allocate page in the middle, just
> > +		 * leave those allocated pages there since 1:1 mapping has
> > +		 * been built. And efi region could be located there, efi_call
> > +		 * still can work.
> > +		 */
> > +		pud = pud_alloc_one(NULL, 0);
> > +		if (!pud) {
> > +			pr_err("Failed to allocate page for %d-th pud table "
> > +				"to build 1:1 mapping!\n", i);
> > +			break;
> > +		}
> > +
> > +		pud_idx = pud_index(vaddr);
> > +		num_entries = PTRS_PER_PUD - pud_idx;
> > +		pud_k = pud_offset(pgd_offset_k(vaddr), vaddr);
> > +		memcpy(pud, pud_k, num_entries);
> > +		if (pud_idx > 0) {
> > +			left_vaddr = vaddr + (num_entries * PUD_SIZE);
> > +			pud_k = pud_offset(pgd_offset_k(left_vaddr),
> > +					   left_vaddr);
> > +			memcpy(pud + num_entries, pud_k, pud_idx);
> > +		}
> > +		pgd_populate(NULL, pgd_offset_k(i * PGDIR_SIZE), pud);
> >  	}
> >  out:
> >  	__flush_tlb_all();
> > @@ -106,6 +149,8 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
> >  	 */
> >  	int pgd_idx;
> >  	int nr_pgds;
> > +	pud_t *pud;
> > +	pgd_t *pgd;
> >  
> >  	if (!efi_enabled(EFI_OLD_MEMMAP)) {
> >  		write_cr3((unsigned long)save_pgd);
> > @@ -115,8 +160,19 @@ void __init efi_call_phys_epilog(pgd_t *save_pgd)
> >  
> >  	nr_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);
> >  
> > -	for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++)
> > +	for (pgd_idx = 0; pgd_idx < nr_pgds; pgd_idx++) {
> > +		pgd = pgd_offset_k(pgd_idx * PGDIR_SIZE);
> > +
> > +		/*
> > +		 * We need check if the pud table was really allocated
> > +		 * successfully. Otherwise no need to free.
> > +		 * */
> > +		if (pgd_val(*pgd) != pgd_val(save_pgd[pgd_idx])) {
> > +			pud = (pud_t *)pgd_page_vaddr(*pgd);
> > +			pud_free(NULL, pud);
> > +		}
> >  		set_pgd(pgd_offset_k(pgd_idx * PGDIR_SIZE), save_pgd[pgd_idx]);
> > +	}
> >  
> >  	kfree(save_pgd);
> 
> This seems like a lot of code for a really simple problem. Do other
> 1:1 users require this change? I'm thinking of the realmode trampoline
> code.
> 
> If the SGI folks think this looks OK then I'll apply it with Thomas'
> ACK.

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

end of thread, other threads:[~2017-05-11  9:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 12:07 [PATCH v2] x86/efi: Correct ident mapping of efi old_map when kalsr enabled Baoquan He
2017-05-01 14:21 ` Thomas Garnier
2017-05-05 20:42 ` Matt Fleming
2017-05-05 23:36   ` Borislav Petkov
2017-05-07 18:37     ` Bhupesh Sharma
2017-05-08  1:36       ` Baoquan He
2017-05-08 15:25         ` Borislav Petkov
2017-05-09  3:30           ` Baoquan He
2017-05-10  2:30           ` Baoquan He
2017-05-08  3:18     ` Russ Anderson
2017-05-11  9:32   ` Baoquan He

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).