Skip to contentSkip to conversation

IOAT: fix for UP use of cpu_physical_id()

PATCH In review Shannon Nelson 2 participants 3 messages Aug 20, 2007

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

PATCH 1/1 IOAT: fix for UP use of cpu_physical_id()

Make sure we can use cpu_physical_id() even when compiled for uni-processor.

---

 drivers/dma/ioat_dca.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/dma/ioat_dca.c +8 -0
index c3a500b..b1af49c 100644
@@ -25,6 +25,14 @@
 #include <linux/smp.h>
 #include <linux/interrupt.h>
 #include <linux/dca.h>
+
+// either a kernel change is needed, or we need something like this in kernel
+#ifndef CONFIG_SMP
+#include <asm/smp.h>
+#undef cpu_physical_id
+#define cpu_physical_id(cpu) (cpuid_ebx(1) >> 24)
+#endif
+
 #include "ioatdma.h"
 #include "ioatdma_registers.h"
 
#1 lore raw
Quoted 9 lines · Shannon Nelson

Make sure we can use cpu_physical_id() even when compiled for uni-processor.

drivers/dma/ioat_dca.c +0 -0
index c3a500b..b1af49c 100644
@@ -25,6 +25,14 @@
 #include <linux/smp.h>

drivers/dma/ioat_dca.c line 35

Quoted 10 lines
drivers/dma/ioat_dca.c +8 -0
 #include <linux/interrupt.h>
 #include <linux/dca.h>
+
+// either a kernel change is needed, or we need something like this in kernel
+#ifndef CONFIG_SMP
+#include <asm/smp.h>
+#undef cpu_physical_id
+#define cpu_physical_id(cpu) (cpuid_ebx(1) >> 24)
+#endif
+

This value should probably be cached. Executing cpuid to get a static value seems like a bad idea.

-hpa

#2 lore raw
Quoted 23 lines

-----Original Message-----
From: H. Peter Anvin [mailto:[email protected]]
Sent: Monday, August 20, 2007 3:27 PM
To: Nelson, Shannon
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Luck, Tony
Subject: Re: [PATCH -mm] IOAT: fix for UP use of cpu_physical_id()

drivers/dma/ioat_dca.c line 29

Quoted 13 lines · Shannon Nelson

Make sure we can use cpu_physical_id() even when compiled for uni-processor.

drivers/dma/ioat_dca.c +2 -0
index c3a500b..b1af49c 100644
@@ -25,6 +25,14 @@
 #include <linux/smp.h>
 #include <linux/interrupt.h>
 #include <linux/dca.h>
+
+// either a kernel change is needed, or we need something 

like this in kernel

Quoted 9 lines

drivers/dma/ioat_dca.c line 35

Quoted 6 lines
drivers/dma/ioat_dca.c +6 -0
+#ifndef CONFIG_SMP
+#include <asm/smp.h>
+#undef cpu_physical_id
+#define cpu_physical_id(cpu) (cpuid_ebx(1) >> 24)
+#endif
+

This value should probably be cached. Executing cpuid to get a static value seems like a bad idea.

Yeah, this whole cpu_physical_id() gizmo needs to be fixed so it is actually usable for non-SMP configurations. Unfortunately, I'm not the guy to do it.

sln
--
======================================================================
Mr. Shannon Nelson LAN Access Division, Intel Corp.
[email protected] I don't speak for Intel
(503) 712-7659 Parents can't afford to be squeamish.