Re: softirq_trylock with UP(w/ 2.1.81) fix included.

Steven N. Hirsch (shirsch@ibm.net)
Sat, 24 Jan 1998 09:52:15 -0500 (EST)


On Fri, 23 Jan 1998, Adam HeathA wrote:

>
>
> On Fri, 23 Jan 1998, Randy McCaskill wrote:
>
> >
> > The new softirq_trylock and softirq_endlock in 2.1.81 won't compile on a
> > UP system. The MP versions have a cpu parameter that the UP don't know
> > what to do with.
> >
>
> Change the following 2 lines in include/asm-i386/softirq.h ..
>

(snip)

This is only the tip of the iceberg. Try:

--- linux/include/asm-i386/softirq.h.orig Fri Jan 23 23:54:28 1998
+++ linux/include/asm-i386/softirq.h Sat Jan 24 00:15:32 1998
@@ -91,8 +91,8 @@
}

/* These are for the irq's testing the lock */
-#define softirq_trylock() (in_bh ? 0 : (local_bh_count[smp_processor_id()]=1))
-#define softirq_endlock() (local_bh_count[smp_processor_id()] = 0)
+#define softirq_trylock(foo) (in_bh() ? 0 : (local_bh_count[smp_processor_id()]=1))
+#define softirq_endlock(foo) (local_bh_count[smp_processor_id()] = 0)
#define synchronize_bh() do { } while (0)

#endif /* SMP */
--- linux/arch/i386/kernel/i386_ksyms.c.orig Fri Jan 23 23:54:19 1998
+++ linux/arch/i386/kernel/i386_ksyms.c Sat Jan 24 09:21:21 1998
@@ -39,7 +39,9 @@
EXPORT_SYMBOL_NOVERS(__down_failed);
EXPORT_SYMBOL_NOVERS(__down_failed_interruptible);
EXPORT_SYMBOL_NOVERS(__up_wakeup);
+#ifdef __SMP__
EXPORT_SYMBOL(global_bh_lock);
+#endif
/* Networking helper routines. */
EXPORT_SYMBOL(csum_partial_copy);
/* Delay loops */
--- linux/arch/alpha/kernel/irq.c.orig Fri Jan 23 23:54:19 1998
+++ linux/arch/alpha/kernel/irq.c Sat Jan 24 00:00:04 1998
@@ -373,7 +373,7 @@
if (!action)
continue;
len += sprintf(buf+len, "%2d: %10u %c %s",
- i, kstat.interrupts[0][i],
+ i, kstat.irqs[0][i],
(action->flags & SA_INTERRUPT) ? '+' : ' ',
action->name);
for (action=action->next; action; action = action->next) {
@@ -567,7 +567,7 @@
int cpu = smp_processor_id();

irq_enter(cpu, irq);
- kstat.interrupts[0][irq] += 1;
+ kstat.irqs[0][irq] += 1;
if (!action) {
unexpected_irq(irq, regs);
} else {
@@ -590,7 +590,7 @@
}

irq_enter(cpu, irq);
- kstat.interrupts[0][irq] += 1;
+ kstat.irqs[0][irq] += 1;
action = irq_action[irq];
/*
* For normal interrupts, we mask it out, and then ACK it.
--- linux/include/linux/sched.h.orig Sat Jan 24 09:33:26 1998
+++ linux/include/linux/sched.h Sat Jan 24 09:38:23 1998
@@ -307,8 +307,10 @@
*/
#ifdef __SMP__
#define INIT_LOCKS SPIN_LOCK_UNLOCKED
+#define INIT_CPU_TIMES {0,0,}
#else
#define INIT_LOCKS
+#define INIT_CPU_TIMES {0,}
#endif

/*
@@ -332,7 +334,7 @@
/* timeout */ 0,SCHED_OTHER,0,0,0,0,0,0,0, \
/* timer */ { NULL, NULL, 0, 0, it_real_fn }, \
/* utime */ {0,0,0,0},0, \
-/* per cpu times */ {0, 0, }, {0, 0, }, \
+/* per cpu times */ INIT_CPU_TIMES, INIT_CPU_TIMES, \
/* flt */ 0,0,0,0,0,0, \
/* swp */ 0,0,0,0,0, \
/* rlimits */ INIT_RLIMITS, \
--- linux/arch/i386/kernel/irq.c.orig Fri Jan 23 23:54:19 1998
+++ linux/arch/i386/kernel/irq.c Sat Jan 24 09:25:13 1998
@@ -639,6 +639,8 @@
irq_exit(cpu, irq);
}

+#ifdef __SMP__
+
/*
* FIXME! This is completely broken.
*/
@@ -680,6 +682,8 @@
enable_IO_APIC_irq(irq);
}

+#endif
+
/*
* do_IRQ handles all normal device IRQ's (the special
* SMP cross-CPU interrupts have their own specific
@@ -714,9 +718,10 @@
kstat.irqs[cpu][irq]++;

do_lowlevel_IRQ = do_8259A_IRQ;
+#ifdef __SMP__
if (IO_APIC_IRQ(irq))
do_lowlevel_IRQ = do_ioapic_IRQ;
-
+#endif
do_lowlevel_IRQ(irq, cpu, &regs);

/*