[PATCH v2] x86/platform/uv: Dont use smp_processor_id while preemptible

Mike Travis posted 1 patch 1 year, 10 months ago
There is a newer version of this series
arch/x86/platform/uv/uv_time.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
[PATCH v2] x86/platform/uv: Dont use smp_processor_id while preemptible
Posted by Mike Travis 1 year, 10 months ago
To avoid a "BUG: using smp_processor_id() in preemptible" debug
warning message, disable preemption around use of the processor id.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Reviewed-by: Dimitri Sivanich <dimitri.sivanich@hpe.com>
Cc: stable@vger.kernel.org
---
v2: Add Cc: stable tag
---
 arch/x86/platform/uv/uv_time.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c
index 54663f3e00cb..094190814a28 100644
--- a/arch/x86/platform/uv/uv_time.c
+++ b/arch/x86/platform/uv/uv_time.c
@@ -275,14 +275,17 @@ static int uv_rtc_unset_timer(int cpu, int force)
  */
 static u64 uv_read_rtc(struct clocksource *cs)
 {
-	unsigned long offset;
+	unsigned long offset, time;
+	unsigned int cpu = get_cpu();
 
 	if (uv_get_min_hub_revision_id() == 1)
 		offset = 0;
 	else
-		offset = (uv_blade_processor_id() * L1_CACHE_BYTES) % PAGE_SIZE;
+		offset = (uv_cpu_blade_processor_id(cpu) * L1_CACHE_BYTES) % PAGE_SIZE;
 
-	return (u64)uv_read_local_mmr(UVH_RTC | offset);
+	time = (u64)uv_read_local_mmr(UVH_RTC | offset);
+	put_cpu();
+	return time;
 }
 
 /*
-- 
2.26.2