Skip to content

Commit b6dbde2

Browse files
Yi Livapier
authored andcommitted
Blackfin: use raw_smp_processor_id() in exception code
When preempt debugging is enabled, smp_processor_id() may utilize the "current" structure. This may not be safe to access under all exceptions due to it being in dynamically allocated memory. So in exception code, make sure we use raw_smp_processor_id() instead to get at the real value directly. Signed-off-by: Yi Li <yi.li@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
1 parent 00dd66d commit b6dbde2

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎arch/blackfin/kernel/cplb-mpu/cplbmgr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static noinline int dcplb_protection_fault(unsigned int cpu)
280280
int cplb_hdr(int seqstat, struct pt_regs *regs)
281281
{
282282
int cause = seqstat & 0x3f;
283-
unsigned int cpu = smp_processor_id();
283+
unsigned int cpu = raw_smp_processor_id();
284284
switch (cause) {
285285
case 0x23:
286286
return dcplb_protection_fault(cpu);

‎arch/blackfin/kernel/cplb-nompu/cplbmgr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ MGR_ATTR static int dcplb_miss(int cpu)
202202
MGR_ATTR int cplb_hdr(int seqstat, struct pt_regs *regs)
203203
{
204204
int cause = seqstat & 0x3f;
205-
unsigned int cpu = smp_processor_id();
205+
unsigned int cpu = raw_smp_processor_id();
206206
switch (cause) {
207207
case VEC_CPLB_I_M:
208208
return icplb_miss(cpu);

‎arch/blackfin/kernel/traps.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ asmlinkage void double_fault_c(struct pt_regs *fp)
227227
printk(KERN_EMERG "Double Fault\n");
228228
#ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT
229229
if (((long)fp->seqstat & SEQSTAT_EXCAUSE) == VEC_UNCOV) {
230-
unsigned int cpu = smp_processor_id();
230+
unsigned int cpu = raw_smp_processor_id();
231231
char buf[150];
232232
decode_address(buf, cpu_pda[cpu].retx_doublefault);
233233
printk(KERN_EMERG "While handling exception (EXCAUSE = 0x%x) at %s:\n",
@@ -263,7 +263,7 @@ asmlinkage notrace void trap_c(struct pt_regs *fp)
263263
int j;
264264
#endif
265265
#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
266-
unsigned int cpu = smp_processor_id();
266+
unsigned int cpu = raw_smp_processor_id();
267267
#endif
268268
const char *strerror = NULL;
269269
int sig = 0;
@@ -1098,7 +1098,7 @@ void show_regs(struct pt_regs *fp)
10981098
struct irqaction *action;
10991099
unsigned int i;
11001100
unsigned long flags = 0;
1101-
unsigned int cpu = smp_processor_id();
1101+
unsigned int cpu = raw_smp_processor_id();
11021102
unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic();
11031103

11041104
verbose_printk(KERN_NOTICE "\n");
@@ -1126,13 +1126,13 @@ void show_regs(struct pt_regs *fp)
11261126

11271127
verbose_printk(KERN_NOTICE "\nSEQUENCER STATUS:\t\t%s\n", print_tainted());
11281128
verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx IMASK: %04lx SYSCFG: %04lx\n",
1129-
(long)fp->seqstat, fp->ipend, cpu_pda[smp_processor_id()].ex_imask, fp->syscfg);
1129+
(long)fp->seqstat, fp->ipend, cpu_pda[raw_smp_processor_id()].ex_imask, fp->syscfg);
11301130
if (fp->ipend & EVT_IRPTEN)
11311131
verbose_printk(KERN_NOTICE " Global Interrupts Disabled (IPEND[4])\n");
1132-
if (!(cpu_pda[smp_processor_id()].ex_imask & (EVT_IVG13 | EVT_IVG12 | EVT_IVG11 |
1132+
if (!(cpu_pda[raw_smp_processor_id()].ex_imask & (EVT_IVG13 | EVT_IVG12 | EVT_IVG11 |
11331133
EVT_IVG10 | EVT_IVG9 | EVT_IVG8 | EVT_IVG7 | EVT_IVTMR)))
11341134
verbose_printk(KERN_NOTICE " Peripheral interrupts masked off\n");
1135-
if (!(cpu_pda[smp_processor_id()].ex_imask & (EVT_IVG15 | EVT_IVG14)))
1135+
if (!(cpu_pda[raw_smp_processor_id()].ex_imask & (EVT_IVG15 | EVT_IVG14)))
11361136
verbose_printk(KERN_NOTICE " Kernel interrupts masked off\n");
11371137
if ((fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) {
11381138
verbose_printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n",

0 commit comments

Comments
 (0)