Skip to contentSkip to conversation

Protect against concurrent calls into UV BIOS

PATCH In review Hedi Berriche 6 participants 13 messages Feb 13, 2019 – Feb 15, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Protect against concurrent calls into UV BIOS

- Changes since v2
Addressed comments from Ard Biesheuvel:
* expose efi_runtime_lock to UV platform only instead of globally
* remove unnecessary #ifdef CONFIG_EFI from bios_uv.c

- Changes since v1:
Addressed comments from Bhupesh Sharma, Thomas Gleixner, and Ard Biesheuvel:
* made __uv_bios_call() static
* moved the efi_enabled() cleanup to its own patchlet
* explained the reason for renaming the efi_runtime_lock semaphore
* dropped the reviewed-bys as they should be given on the mailing list
* Cc'ng [email protected] given the nature of the problem addressed by the patches

---

Calls into UV BIOS were not being serialised which is wrong as it violates EFI runtime rules, and bad as it does result in all sorts of potentially hard to track down hangs and panics when efi_scratch.prev_mm gets clobbered whenever efi_switch_mm() gets called concurrently from two different CPUs.

Patch #1 removes an unnecessary #ifdef CONFIG_EFI guard from bios_uv.c.

Patch #2 removes uv_bios_call_reentrant() because it's dead code.

Patch #3 is a cleanup that drops test_bit() in favour of the ad hoc efi_enabled().

Patch #4 makes uv_bios_call() variants use the efi_runtime_lock semaphore to protect against concurrency.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>

Hedi Berriche (4):
x86/platform/UV: remove unnecessary #ifdef CONFIG_EFI x86/platform/UV: kill uv_bios_call_reentrant() as it has no callers x86/platform/UV: use efi_enabled() instead of test_bit() x86/platform/UV: use efi_runtime_lock to serialise BIOS calls

 arch/x86/include/asm/uv/bios.h          | 13 ++++-----
 arch/x86/platform/uv/bios_uv.c          | 35 ++++++++++++++-----------
 drivers/firmware/efi/runtime-wrappers.c |  7 +++++
 3 files changed, 34 insertions(+), 21 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v3 1/4 x86/platform/UV: remove unnecessary #ifdef CONFIG_EFI

CONFIG_EFI is implied by CONFIG_X86_UV and x86/platform/uv/bios_uv.c requires the latter, get rid of the redundant #ifdef CONFIG_EFI directives.

Cleanup, no functional changes.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>
---
 arch/x86/include/asm/uv/bios.h | 4 ----
 arch/x86/platform/uv/bios_uv.c | 2 --
 2 files changed, 6 deletions(-)
arch/x86/include/asm/uv/bios.h +0 -4
index e652a7cc6186..00d862cfbcbe 100644
@@ -151,11 +151,7 @@ extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
 extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *);
 extern int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus);
 
-#ifdef CONFIG_EFI
 extern void uv_bios_init(void);
-#else
-void uv_bios_init(void) { }
-#endif
 
 extern unsigned long sn_rtc_cycles_per_second;
 extern int uv_type;
arch/x86/platform/uv/bios_uv.c +0 -2
index 4a6a5a26c582..4a61ed2a7bb8 100644
@@ -188,7 +188,6 @@ int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus)
 }
 EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga_target);
 
-#ifdef CONFIG_EFI
 void uv_bios_init(void)
 {
 	uv_systab = NULL;
@@ -218,4 +217,3 @@ void uv_bios_init(void)
 	}
 	pr_info("UV: UVsystab: Revision:%x\n", uv_systab->revision);
 }
-#endif
Signature · 1 line
2.20.1
#2 lore raw

[tip:x86/uv] x86/platform/UV: Remove unnecessary #ifdef CONFIG_EFI

x86/platform/UV: Remove unnecessary #ifdef CONFIG_EFI
Commit-ID:  30ad3e031d2feae075cd5fd2c443baa2d86c0195
Gitweb:     https://git.kernel.org/tip/30ad3e031d2feae075cd5fd2c443baa2d86c0195
Author:     Hedi Berriche <[email protected]>
AuthorDate: Wed, 13 Feb 2019 19:34:10 +0000
Committer:  Borislav Petkov <[email protected]>
CommitDate: Fri, 15 Feb 2019 15:05:15 +0100

x86/platform/UV: Remove unnecessary #ifdef CONFIG_EFI

CONFIG_EFI is implied by CONFIG_X86_UV and x86/platform/uv/bios_uv.c requires the latter, get rid of the redundant #ifdef CONFIG_EFI directives.

Cleanup, no functional changes.

---
 arch/x86/include/asm/uv/bios.h | 4 ----
 arch/x86/platform/uv/bios_uv.c | 2 --
 2 files changed, 6 deletions(-)
arch/x86/include/asm/uv/bios.h +0 -4
index e652a7cc6186..00d862cfbcbe 100644
@@ -151,11 +151,7 @@ extern s64 uv_bios_change_memprotect(u64, u64, enum uv_memprotect);
 extern s64 uv_bios_reserved_page_pa(u64, u64 *, u64 *, u64 *);
 extern int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus);
 
-#ifdef CONFIG_EFI
 extern void uv_bios_init(void);
-#else
-void uv_bios_init(void) { }
-#endif
 
 extern unsigned long sn_rtc_cycles_per_second;
 extern int uv_type;
arch/x86/platform/uv/bios_uv.c +0 -2
index 4a6a5a26c582..4a61ed2a7bb8 100644
@@ -188,7 +188,6 @@ int uv_bios_set_legacy_vga_target(bool decode, int domain, int bus)
 }
 EXPORT_SYMBOL_GPL(uv_bios_set_legacy_vga_target);
 
-#ifdef CONFIG_EFI
 void uv_bios_init(void)
 {
 	uv_systab = NULL;
@@ -218,4 +217,3 @@ void uv_bios_init(void)
 	}
 	pr_info("UV: UVsystab: Revision:%x\n", uv_systab->revision);
 }
-#endif
#3 lore raw

PATCH v3 2/4 x86/platform/UV: kill uv_bios_call_reentrant()

In reply to Hedi Berriche

uv_bios_call_reentrant() has no callers nor is it exported, kill it.

Cleanup, no functional changes.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>
---
 arch/x86/include/asm/uv/bios.h |  1 -
 arch/x86/platform/uv/bios_uv.c | 12 ------------
 2 files changed, 13 deletions(-)
arch/x86/include/asm/uv/bios.h +0 -1
index 00d862cfbcbe..8c6ac271b5b3 100644
@@ -140,7 +140,6 @@ enum uv_memprotect {
  */
 extern s64 uv_bios_call(enum uv_bios_cmd, u64, u64, u64, u64, u64);
 extern s64 uv_bios_call_irqsave(enum uv_bios_cmd, u64, u64, u64, u64, u64);
-extern s64 uv_bios_call_reentrant(enum uv_bios_cmd, u64, u64, u64, u64, u64);
 
 extern s64 uv_bios_get_sn_info(int, int *, long *, long *, long *, long *);
 extern s64 uv_bios_freq_base(u64, u64 *);
arch/x86/platform/uv/bios_uv.c +0 -12
index 4a61ed2a7bb8..91e3d5285836 100644
@@ -66,18 +66,6 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
 	return ret;
 }
 
-s64 uv_bios_call_reentrant(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
-					u64 a4, u64 a5)
-{
-	s64 ret;
-
-	preempt_disable();
-	ret = uv_bios_call(which, a1, a2, a3, a4, a5);
-	preempt_enable();
-
-	return ret;
-}
-
 
 long sn_partition_id;
 EXPORT_SYMBOL_GPL(sn_partition_id);
Signature · 1 line
2.20.1
#4 lore raw

[tip:x86/uv] x86/platform/UV: Remove uv_bios_call_reentrant()

x86/platform/UV: Remove uv_bios_call_reentrant()
Commit-ID:  f816525d615fff0336d0c881e5d960bbec5ea016
Gitweb:     https://git.kernel.org/tip/f816525d615fff0336d0c881e5d960bbec5ea016
Author:     Hedi Berriche <[email protected]>
AuthorDate: Wed, 13 Feb 2019 19:34:11 +0000
Committer:  Borislav Petkov <[email protected]>
CommitDate: Fri, 15 Feb 2019 15:13:48 +0100

x86/platform/UV: Remove uv_bios_call_reentrant()

uv_bios_call_reentrant() has no callers nor is it exported, remove it.

Cleanup, no functional changes.

---
 arch/x86/include/asm/uv/bios.h |  1 -
 arch/x86/platform/uv/bios_uv.c | 12 ------------
 2 files changed, 13 deletions(-)
arch/x86/include/asm/uv/bios.h +0 -1
index 00d862cfbcbe..8c6ac271b5b3 100644
@@ -140,7 +140,6 @@ enum uv_memprotect {
  */
 extern s64 uv_bios_call(enum uv_bios_cmd, u64, u64, u64, u64, u64);
 extern s64 uv_bios_call_irqsave(enum uv_bios_cmd, u64, u64, u64, u64, u64);
-extern s64 uv_bios_call_reentrant(enum uv_bios_cmd, u64, u64, u64, u64, u64);
 
 extern s64 uv_bios_get_sn_info(int, int *, long *, long *, long *, long *);
 extern s64 uv_bios_freq_base(u64, u64 *);
arch/x86/platform/uv/bios_uv.c +0 -12
index 4a61ed2a7bb8..91e3d5285836 100644
@@ -66,18 +66,6 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
 	return ret;
 }
 
-s64 uv_bios_call_reentrant(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
-					u64 a4, u64 a5)
-{
-	s64 ret;
-
-	preempt_disable();
-	ret = uv_bios_call(which, a1, a2, a3, a4, a5);
-	preempt_enable();
-
-	return ret;
-}
-
 
 long sn_partition_id;
 EXPORT_SYMBOL_GPL(sn_partition_id);
#5 lore raw

PATCH v3 3/4 x86/platform/UV: use efi_enabled() instead of test_bit()

In reply to Hedi Berriche

Use ad hoc efi_enabled() instead of fiddling with test_bit().

Cleanup, no functional changes.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>
---
 arch/x86/platform/uv/bios_uv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/uv/bios_uv.c +1 -1
index 91e3d5285836..38a2e3431fc6 100644
@@ -44,7 +44,7 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
 	 * If EFI_OLD_MEMMAP is set, we need to fall back to using our old EFI
 	 * callback method, which uses efi_call() directly, with the kernel page tables:
 	 */
-	if (unlikely(test_bit(EFI_OLD_MEMMAP, &efi.flags)))
+	if (unlikely(efi_enabled(EFI_OLD_MEMMAP)))
 		ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5);
 	else
 		ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);
Signature · 1 line
2.20.1
#6 lore raw

[tip:x86/uv] x86/platform/UV: Use efi_enabled() instead of test_bit()

x86/platform/UV: Use efi_enabled() instead of test_bit()
Commit-ID:  8945d96f7b3ead56e053ac79b8f7b0de98a30bfe
Gitweb:     https://git.kernel.org/tip/8945d96f7b3ead56e053ac79b8f7b0de98a30bfe
Author:     Hedi Berriche <[email protected]>
AuthorDate: Wed, 13 Feb 2019 19:34:12 +0000
Committer:  Borislav Petkov <[email protected]>
CommitDate: Fri, 15 Feb 2019 15:15:18 +0100

x86/platform/UV: Use efi_enabled() instead of test_bit()

Use ad hoc efi_enabled() instead of fiddling with test_bit().

Cleanup, no functional changes.

---
 arch/x86/platform/uv/bios_uv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/uv/bios_uv.c +1 -1
index 91e3d5285836..38a2e3431fc6 100644
@@ -44,7 +44,7 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
 	 * If EFI_OLD_MEMMAP is set, we need to fall back to using our old EFI
 	 * callback method, which uses efi_call() directly, with the kernel page tables:
 	 */
-	if (unlikely(test_bit(EFI_OLD_MEMMAP, &efi.flags)))
+	if (unlikely(efi_enabled(EFI_OLD_MEMMAP)))
 		ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5);
 	else
 		ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);
#7 lore raw

PATCH v3 4/4 x86/platform/UV: use efi_runtime_lock to serialise BIOS calls

In reply to Hedi Berriche

Calls into UV firmware must be protected against concurrency, expose the efi_runtime_lock to the UV platform, and use it to serialise UV BIOS calls.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>
---
 arch/x86/include/asm/uv/bios.h          |  8 +++++++-
 arch/x86/platform/uv/bios_uv.c          | 23 +++++++++++++++++++++--
 drivers/firmware/efi/runtime-wrappers.c |  7 +++++++
 3 files changed, 35 insertions(+), 3 deletions(-)
arch/x86/include/asm/uv/bios.h +7 -1
index 8c6ac271b5b3..8cfccc3cbbf4 100644
@@ -48,7 +48,8 @@ enum {
 	BIOS_STATUS_SUCCESS		=  0,
 	BIOS_STATUS_UNIMPLEMENTED	= -ENOSYS,
 	BIOS_STATUS_EINVAL		= -EINVAL,
-	BIOS_STATUS_UNAVAIL		= -EBUSY
+	BIOS_STATUS_UNAVAIL		= -EBUSY,
+	BIOS_STATUS_ABORT		= -EINTR,
 };
 
 /* Address map parameters */
@@ -162,4 +163,9 @@ extern long system_serial_number;
 
 extern struct kobject *sgi_uv_kobj;	/* /sys/firmware/sgi_uv */
 
+/*
+ * EFI runtime lock; cf. firmware/efi/runtime-wrappers.c for details
+ */
+extern struct semaphore __efi_uv_runtime_lock;
+
 #endif /* _ASM_X86_UV_BIOS_H */
arch/x86/platform/uv/bios_uv.c +21 -2
index 38a2e3431fc6..ef60d789c76e 100644
@@ -29,7 +29,8 @@
 
 struct uv_systab *uv_systab;
 
-s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
+static s64 __uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
+			u64 a4, u64 a5)
 {
 	struct uv_systab *tab = uv_systab;
 	s64 ret;
@@ -51,6 +52,19 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
 
 	return ret;
 }
+
+s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
+{
+	s64 ret;
+
+	if (down_interruptible(&__efi_uv_runtime_lock))
+		return BIOS_STATUS_ABORT;
+
+	ret = __uv_bios_call(which, a1, a2, a3, a4, a5);
+	up(&__efi_uv_runtime_lock);
+
+	return ret;
+}
 EXPORT_SYMBOL_GPL(uv_bios_call);
 
 s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
@@ -59,10 +73,15 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
 	unsigned long bios_flags;
 	s64 ret;
 
+	if (down_interruptible(&__efi_uv_runtime_lock))
+		return BIOS_STATUS_ABORT;
+
 	local_irq_save(bios_flags);
-	ret = uv_bios_call(which, a1, a2, a3, a4, a5);
+	ret = __uv_bios_call(which, a1, a2, a3, a4, a5);
 	local_irq_restore(bios_flags);
 
+	up(&__efi_uv_runtime_lock);
+
 	return ret;
 }
 
drivers/firmware/efi/runtime-wrappers.c +7 -0
index 8903b9ccfc2b..e2abfdb5cee6 100644
@@ -146,6 +146,13 @@ void efi_call_virt_check_flags(unsigned long flags, const char *call)
  */
 static DEFINE_SEMAPHORE(efi_runtime_lock);
 
+/*
+ * Expose the EFI runtime lock to the UV platform
+ */
+#ifdef CONFIG_X86_UV
+extern struct semaphore __efi_uv_runtime_lock __alias(efi_runtime_lock);
+#endif
+
 /*
  * Calls the appropriate efi_runtime_service() with the appropriate
  * arguments.
Signature · 1 line
2.20.1
#8 lore raw

[tip:x86/urgent] x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls

x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls
Commit-ID:  f331e766c4be33f4338574f3c9f7f77e98ab4571
Gitweb:     https://git.kernel.org/tip/f331e766c4be33f4338574f3c9f7f77e98ab4571
Author:     Hedi Berriche <[email protected]>
AuthorDate: Wed, 13 Feb 2019 19:34:13 +0000
Committer:  Borislav Petkov <[email protected]>
CommitDate: Fri, 15 Feb 2019 15:19:56 +0100

x86/platform/UV: Use efi_runtime_lock to serialise BIOS calls

Calls into UV firmware must be protected against concurrency, expose the efi_runtime_lock to the UV platform, and use it to serialise UV BIOS calls.

---
 arch/x86/include/asm/uv/bios.h          |  8 +++++++-
 arch/x86/platform/uv/bios_uv.c          | 23 +++++++++++++++++++++--
 drivers/firmware/efi/runtime-wrappers.c |  7 +++++++
 3 files changed, 35 insertions(+), 3 deletions(-)
arch/x86/include/asm/uv/bios.h +7 -1
index e652a7cc6186..3f697a9e3f59 100644
@@ -48,7 +48,8 @@ enum {
 	BIOS_STATUS_SUCCESS		=  0,
 	BIOS_STATUS_UNIMPLEMENTED	= -ENOSYS,
 	BIOS_STATUS_EINVAL		= -EINVAL,
-	BIOS_STATUS_UNAVAIL		= -EBUSY
+	BIOS_STATUS_UNAVAIL		= -EBUSY,
+	BIOS_STATUS_ABORT		= -EINTR,
 };
 
 /* Address map parameters */
@@ -167,4 +168,9 @@ extern long system_serial_number;
 
 extern struct kobject *sgi_uv_kobj;	/* /sys/firmware/sgi_uv */
 
+/*
+ * EFI runtime lock; cf. firmware/efi/runtime-wrappers.c for details
+ */
+extern struct semaphore __efi_uv_runtime_lock;
+
 #endif /* _ASM_X86_UV_BIOS_H */
arch/x86/platform/uv/bios_uv.c +21 -2
index 4a6a5a26c582..eb33432f2f24 100644
@@ -29,7 +29,8 @@
 
 struct uv_systab *uv_systab;
 
-s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
+static s64 __uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
+			u64 a4, u64 a5)
 {
 	struct uv_systab *tab = uv_systab;
 	s64 ret;
@@ -51,6 +52,19 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
 
 	return ret;
 }
+
+s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
+{
+	s64 ret;
+
+	if (down_interruptible(&__efi_uv_runtime_lock))
+		return BIOS_STATUS_ABORT;
+
+	ret = __uv_bios_call(which, a1, a2, a3, a4, a5);
+	up(&__efi_uv_runtime_lock);
+
+	return ret;
+}
 EXPORT_SYMBOL_GPL(uv_bios_call);
 
 s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
@@ -59,10 +73,15 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3,
 	unsigned long bios_flags;
 	s64 ret;
 
+	if (down_interruptible(&__efi_uv_runtime_lock))
+		return BIOS_STATUS_ABORT;
+
 	local_irq_save(bios_flags);
-	ret = uv_bios_call(which, a1, a2, a3, a4, a5);
+	ret = __uv_bios_call(which, a1, a2, a3, a4, a5);
 	local_irq_restore(bios_flags);
 
+	up(&__efi_uv_runtime_lock);
+
 	return ret;
 }
 
drivers/firmware/efi/runtime-wrappers.c +7 -0
index 8903b9ccfc2b..e2abfdb5cee6 100644
@@ -146,6 +146,13 @@ void efi_call_virt_check_flags(unsigned long flags, const char *call)
  */
 static DEFINE_SEMAPHORE(efi_runtime_lock);
 
+/*
+ * Expose the EFI runtime lock to the UV platform
+ */
+#ifdef CONFIG_X86_UV
+extern struct semaphore __efi_uv_runtime_lock __alias(efi_runtime_lock);
+#endif
+
 /*
  * Calls the appropriate efi_runtime_service() with the appropriate
  * arguments.
Reviewed-by on the v3 series
#9 lore raw
In reply to Hedi Berriche
Quoted 6 lines · Hedi Berriche

- Changes since v2
Addressed comments from Ard Biesheuvel:
* expose efi_runtime_lock to UV platform only instead of globally
* remove unnecessary #ifdef CONFIG_EFI from bios_uv.c

Quoted 8 lines

- Changes since v1:
Addressed comments from Bhupesh Sharma, Thomas Gleixner, and Ard Biesheuvel:
* made __uv_bios_call() static
* moved the efi_enabled() cleanup to its own patchlet
* explained the reason for renaming the efi_runtime_lock semaphore
* dropped the reviewed-bys as they should be given on the mailing list
* Cc'ng [email protected] given the nature of the problem addressed by the patches

Hi Hedi,

The patches look good to me now.

For the series,

However, I don't think all the patches should go to -stable. Only 4/4 fixes an actual bug, and the remaining patches don't look like they are prerequisites for that change.

Also, if your colleagues reviewed your patches, now would be the time to ask them to give their Reviewed-by as well.

Signature · 1 line
Ard.
Quoted 36 lines

---

Calls into UV BIOS were not being serialised which is wrong as it violates EFI runtime rules, and bad as it does result in all sorts of potentially hard to track down hangs and panics when efi_scratch.prev_mm gets clobbered whenever efi_switch_mm() gets called concurrently from two different CPUs.

Patch #1 removes an unnecessary #ifdef CONFIG_EFI guard from bios_uv.c.

Patch #2 removes uv_bios_call_reentrant() because it's dead code.

Patch #3 is a cleanup that drops test_bit() in favour of the ad hoc efi_enabled().

Patch #4 makes uv_bios_call() variants use the efi_runtime_lock semaphore to protect against concurrency.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>

Hedi Berriche (4):
x86/platform/UV: remove unnecessary #ifdef CONFIG_EFI x86/platform/UV: kill uv_bios_call_reentrant() as it has no callers x86/platform/UV: use efi_enabled() instead of test_bit() x86/platform/UV: use efi_runtime_lock to serialise BIOS calls

 arch/x86/include/asm/uv/bios.h          | 13 ++++-----
 arch/x86/platform/uv/bios_uv.c          | 35 ++++++++++++++-----------
 drivers/firmware/efi/runtime-wrappers.c |  7 +++++
 3 files changed, 34 insertions(+), 21 deletions(-)

--
2.20.1

Reviewed-by
#10 lore raw
Quoted 22 lines · Ard Biesheuvel
Quoted 6 lines · Hedi Berriche

- Changes since v2
Addressed comments from Ard Biesheuvel:
* expose efi_runtime_lock to UV platform only instead of globally
* remove unnecessary #ifdef CONFIG_EFI from bios_uv.c

Quoted 8 lines

- Changes since v1:
Addressed comments from Bhupesh Sharma, Thomas Gleixner, and Ard Biesheuvel:
* made __uv_bios_call() static
* moved the efi_enabled() cleanup to its own patchlet
* explained the reason for renaming the efi_runtime_lock semaphore
* dropped the reviewed-bys as they should be given on the mailing list
* Cc'ng [email protected] given the nature of the problem addressed by the patches

Hi Hedi,

The patches look good to me now.

For the series,

Quoted 8 lines

However, I don't think all the patches should go to -stable. Only 4/4 fixes an actual bug, and the remaining patches don't look like they are prerequisites for that change.

Also, if your colleagues reviewed your patches, now would be the time to ask them to give their Reviewed-by as well.

Thanks.

Quoted 41 lines
Signature · 1 line
Ard.
Quoted 36 lines

---

Calls into UV BIOS were not being serialised which is wrong as it violates EFI runtime rules, and bad as it does result in all sorts of potentially hard to track down hangs and panics when efi_scratch.prev_mm gets clobbered whenever efi_switch_mm() gets called concurrently from two different CPUs.

Patch #1 removes an unnecessary #ifdef CONFIG_EFI guard from bios_uv.c.

Patch #2 removes uv_bios_call_reentrant() because it's dead code.

Patch #3 is a cleanup that drops test_bit() in favour of the ad hoc efi_enabled().

Patch #4 makes uv_bios_call() variants use the efi_runtime_lock semaphore to protect against concurrency.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>

Hedi Berriche (4):
x86/platform/UV: remove unnecessary #ifdef CONFIG_EFI x86/platform/UV: kill uv_bios_call_reentrant() as it has no callers x86/platform/UV: use efi_enabled() instead of test_bit() x86/platform/UV: use efi_runtime_lock to serialise BIOS calls

 arch/x86/include/asm/uv/bios.h          | 13 ++++-----
 arch/x86/platform/uv/bios_uv.c          | 35 ++++++++++++++-----------
 drivers/firmware/efi/runtime-wrappers.c |  7 +++++
 3 files changed, 34 insertions(+), 21 deletions(-)

--
2.20.1

Signature · 2 lines
Russ Anderson,  SuperDome Flex Linux Kernel Group Manager
HPE - Hewlett Packard Enterprise (formerly SGI)  [email protected]
Reviewed-by on the v3 series
#11 lore raw
In reply to Hedi Berriche

For the series:

Quoted 49 lines · Hedi Berriche

- Changes since v2
Addressed comments from Ard Biesheuvel:
* expose efi_runtime_lock to UV platform only instead of globally
* remove unnecessary #ifdef CONFIG_EFI from bios_uv.c

- Changes since v1:
Addressed comments from Bhupesh Sharma, Thomas Gleixner, and Ard Biesheuvel:
* made __uv_bios_call() static
* moved the efi_enabled() cleanup to its own patchlet
* explained the reason for renaming the efi_runtime_lock semaphore
* dropped the reviewed-bys as they should be given on the mailing list
* Cc'ng [email protected] given the nature of the problem addressed by the patches

---

Calls into UV BIOS were not being serialised which is wrong as it violates EFI runtime rules, and bad as it does result in all sorts of potentially hard to track down hangs and panics when efi_scratch.prev_mm gets clobbered whenever efi_switch_mm() gets called concurrently from two different CPUs.

Patch #1 removes an unnecessary #ifdef CONFIG_EFI guard from bios_uv.c.

Patch #2 removes uv_bios_call_reentrant() because it's dead code.

Patch #3 is a cleanup that drops test_bit() in favour of the ad hoc efi_enabled().

Patch #4 makes uv_bios_call() variants use the efi_runtime_lock semaphore to protect against concurrency.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>

Hedi Berriche (4):
x86/platform/UV: remove unnecessary #ifdef CONFIG_EFI x86/platform/UV: kill uv_bios_call_reentrant() as it has no callers x86/platform/UV: use efi_enabled() instead of test_bit() x86/platform/UV: use efi_runtime_lock to serialise BIOS calls

 arch/x86/include/asm/uv/bios.h          | 13 ++++-----
 arch/x86/platform/uv/bios_uv.c          | 35 ++++++++++++++-----------
 drivers/firmware/efi/runtime-wrappers.c |  7 +++++
 3 files changed, 34 insertions(+), 21 deletions(-)
Signature · 1 line
2.20.1
Reviewed-by
#12 lore raw
Quoted 3 lines · Dimitri Sivanich

For the series:

As well as I:

Quoted 51 lines · Hedi Berriche
Quoted 49 lines

- Changes since v2
Addressed comments from Ard Biesheuvel:
* expose efi_runtime_lock to UV platform only instead of globally
* remove unnecessary #ifdef CONFIG_EFI from bios_uv.c

- Changes since v1:
Addressed comments from Bhupesh Sharma, Thomas Gleixner, and Ard Biesheuvel:
* made __uv_bios_call() static
* moved the efi_enabled() cleanup to its own patchlet
* explained the reason for renaming the efi_runtime_lock semaphore
* dropped the reviewed-bys as they should be given on the mailing list
* Cc'ng [email protected] given the nature of the problem addressed by the patches

---

Calls into UV BIOS were not being serialised which is wrong as it violates EFI runtime rules, and bad as it does result in all sorts of potentially hard to track down hangs and panics when efi_scratch.prev_mm gets clobbered whenever efi_switch_mm() gets called concurrently from two different CPUs.

Patch #1 removes an unnecessary #ifdef CONFIG_EFI guard from bios_uv.c.

Patch #2 removes uv_bios_call_reentrant() because it's dead code.

Patch #3 is a cleanup that drops test_bit() in favour of the ad hoc efi_enabled().

Patch #4 makes uv_bios_call() variants use the efi_runtime_lock semaphore to protect against concurrency.

Cc Russ Anderson <[email protected]>
Cc Mike Travis <[email protected]>
Cc Dimitri Sivanich <[email protected]>
Cc Steve Wahl <[email protected]>

Hedi Berriche (4):
x86/platform/UV: remove unnecessary #ifdef CONFIG_EFI x86/platform/UV: kill uv_bios_call_reentrant() as it has no callers x86/platform/UV: use efi_enabled() instead of test_bit() x86/platform/UV: use efi_runtime_lock to serialise BIOS calls

  arch/x86/include/asm/uv/bios.h          | 13 ++++-----
  arch/x86/platform/uv/bios_uv.c          | 35 ++++++++++++++-----------
  drivers/firmware/efi/runtime-wrappers.c |  7 +++++
  3 files changed, 34 insertions(+), 21 deletions(-)
Signature · 1 line
2.20.1