Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347718

[PATCH 3.10 07/80] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.10 07/80] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls
Date 2016-03-02 03:40 +0100
Message-ID <r84RJ-1dc-37@gated-at.bofh.it> (permalink)
References <r82dd-7Iy-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ingo Molnar <mingo@kernel.org>

commit 23a0d4e8fa6d3a1d7fb819f79bcc0a3739c30ba9 upstream.

Tapasweni Pathak reported that we do a kmalloc() in efi_call_phys_prolog()
on x86-64 while having interrupts disabled, which is a big no-no, as
kmalloc() can sleep.

Solve this by removing the irq disabling from the prolog/epilog calls
around EFI calls: it's unnecessary, as in this stage we are single
threaded in the boot thread, and we don't ever execute this from
interrupt contexts.

Reported-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
[ luis: backported to 3.10: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/platform/efi/efi.c    |    7 +++++++
 arch/x86/platform/efi/efi_32.c |   11 +++--------
 arch/x86/platform/efi/efi_64.c |    3 ---
 3 files changed, 10 insertions(+), 11 deletions(-)

--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -250,12 +250,19 @@ static efi_status_t __init phys_efi_set_
 	efi_memory_desc_t *virtual_map)
 {
 	efi_status_t status;
+	unsigned long flags;
 
 	efi_call_phys_prelog();
+
+	/* Disable interrupts around EFI calls: */
+	local_irq_save(flags);
 	status = efi_call_phys4(efi_phys.set_virtual_address_map,
 				memory_map_size, descriptor_size,
 				descriptor_version, virtual_map);
+	local_irq_restore(flags);
+
 	efi_call_phys_epilog();
+
 	return status;
 }
 
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -33,19 +33,16 @@
 
 /*
  * To make EFI call EFI runtime service in physical addressing mode we need
- * prelog/epilog before/after the invocation to disable interrupt, to
- * claim EFI runtime service handler exclusively and to duplicate a memory in
- * low memory space say 0 - 3G.
+ * prolog/epilog before/after the invocation to claim the EFI runtime service
+ * handler exclusively and to duplicate a memory mapping in low memory space,
+ * say 0 - 3G.
  */
 
-static unsigned long efi_rt_eflags;
 
 void efi_call_phys_prelog(void)
 {
 	struct desc_ptr gdt_descr;
 
-	local_irq_save(efi_rt_eflags);
-
 	load_cr3(initial_page_table);
 	__flush_tlb_all();
 
@@ -64,6 +61,4 @@ void efi_call_phys_epilog(void)
 
 	load_cr3(swapper_pg_dir);
 	__flush_tlb_all();
-
-	local_irq_restore(efi_rt_eflags);
 }
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -40,7 +40,6 @@
 #include <asm/fixmap.h>
 
 static pgd_t *save_pgd __initdata;
-static unsigned long efi_flags __initdata;
 
 static void __init early_code_mapping_set_exec(int executable)
 {
@@ -66,7 +65,6 @@ void __init efi_call_phys_prelog(void)
 	int n_pgds;
 
 	early_code_mapping_set_exec(1);
-	local_irq_save(efi_flags);
 
 	n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
 	save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL);
@@ -90,7 +88,6 @@ void __init efi_call_phys_epilog(void)
 		set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), save_pgd[pgd]);
 	kfree(save_pgd);
 	__flush_tlb_all();
-	local_irq_restore(efi_flags);
 	early_code_mapping_set_exec(0);
 }
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.10 00/80] 3.10.99-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 08/80] dm thin metadata: fix bug when taking a metadata snapshot Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 02/80] drm/ast: Initialized data needed to map fbdev memory Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 23/80] dts: vt8500: Add SDHC node to DTS file for WM8650 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 07/80] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 31/80] mac: validate mac_partition is within sector Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 14/80] proc: Fix ptrace-based permission checks for accessing task maps Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 29/80] megaraid_sas : SMAP restriction--do not access user memory from IOCTL code Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 32/80] ARC: dw2 unwind: Remove falllback linear search thru FDE entries Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 11/80] USB: cp210x: add IDs for GE B650V3 and B850V3 boards Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 41/80] dm btree: fix bufio buffer leaks in dm_btree_del() error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 27/80] wm831x_power: Use IRQF_ONESHOT to request threaded IRQs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 10/80] can: ems_usb: Fix possible tx overflow Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 01/80] tracepoints: Do not trace when cpu is offline Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 06/80] drm/radeon: fix hotplug race at startup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 26/80] devres: fix a for loop bounds check Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 30/80] mmc: remove bondage between REQ_META and reliable write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 15/80] iw_cxgb3: Fix incorrectly returning error on success Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 35/80] virtio: fix memory leak of virtio ida cache layers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:40 +0100
  [PATCH 3.10 04/80] bcache: unregister reboot notifier if bcache fails to unregister device Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 03:50 +0100
  Re: [PATCH 3.10 00/80] 3.10.99-stable review Guenter Roeck <linux@roeck-us.net> - 2016-03-02 15:40 +0100
    Re: [PATCH 3.10 00/80] 3.10.99-stable review Willy Tarreau <w@1wt.eu> - 2016-03-02 16:50 +0100
      Re: [PATCH 3.10 00/80] 3.10.99-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-02 18:30 +0100

csiph-web