patch-2.3.8 linux/include/asm-alpha/softirq.h
Next file: linux/include/asm-alpha/spinlock.h
Previous file: linux/include/asm-alpha/smp.h
Back to the patch index
Back to the overall index
- Lines: 113
- Date:
Tue Jun 22 10:46:52 1999
- Orig file:
v2.3.7/linux/include/asm-alpha/softirq.h
- Orig date:
Thu Jun 3 14:32:26 1999
diff -u --recursive --new-file v2.3.7/linux/include/asm-alpha/softirq.h linux/include/asm-alpha/softirq.h
@@ -5,18 +5,33 @@
#include <asm/atomic.h>
#include <asm/hardirq.h>
-/*
- * This works but is wrong - on SMP it should disable only on the
- * current CPU and shouldn't synchronize like the heavy global
- * disable does. Oh, well.
- *
- * See the x86 version for an example.
- */
-#define local_bh_enable() start_bh_atomic()
-#define local_bh_disable() end_bh_atomic()
-
extern unsigned int local_bh_count[NR_CPUS];
+extern inline void cpu_bh_disable(int cpu)
+{
+ local_bh_count[cpu]++;
+ mb();
+}
+
+extern inline void cpu_bh_enable(int cpu)
+{
+ mb();
+ local_bh_count[cpu]--;
+}
+
+extern inline int cpu_bh_trylock(int cpu)
+{
+ return local_bh_count[cpu] ? 0 : (local_bh_count[cpu] = 1);
+}
+
+extern inline void cpu_bh_endlock(int cpu)
+{
+ local_bh_count[cpu] = 0;
+}
+
+#define local_bh_enable() cpu_bh_enable(smp_processor_id())
+#define local_bh_disable() cpu_bh_disable(smp_processor_id())
+
#define get_active_bhs() (bh_mask & bh_active)
static inline void clear_active_bhs(unsigned long x)
@@ -43,8 +58,9 @@
extern inline void remove_bh(int nr)
{
- bh_base[nr] = NULL;
bh_mask &= ~(1 << nr);
+ wmb();
+ bh_base[nr] = NULL;
}
extern inline void mark_bh(int nr)
@@ -78,44 +94,39 @@
/* These are for the irq's testing the lock */
static inline int softirq_trylock(int cpu)
{
- if (!test_and_set_bit(0,&global_bh_count)) {
- if (atomic_read(&global_bh_lock) == 0) {
- ++local_bh_count[cpu];
- return 1;
+ if (cpu_bh_trylock(cpu)) {
+ if (!test_and_set_bit(0, &global_bh_count)) {
+ if (atomic_read(&global_bh_lock) == 0)
+ return 1;
+ clear_bit(0, &global_bh_count);
}
- clear_bit(0,&global_bh_count);
+ cpu_bh_endlock(cpu);
}
return 0;
}
static inline void softirq_endlock(int cpu)
{
- local_bh_count[cpu]--;
- clear_bit(0,&global_bh_count);
+ cpu_bh_enable(cpu);
+ clear_bit(0, &global_bh_count);
}
#else
extern inline void start_bh_atomic(void)
{
- local_bh_count[smp_processor_id()]++;
- barrier();
+ local_bh_disable();
}
extern inline void end_bh_atomic(void)
{
- barrier();
- local_bh_count[smp_processor_id()]--;
+ local_bh_enable();
}
/* These are for the irq's testing the lock */
-#define softirq_trylock(cpu) \
- (local_bh_count[cpu] ? 0 : (local_bh_count[cpu] = 1))
-
-#define softirq_endlock(cpu) \
- (local_bh_count[cpu] = 0)
-
-#define synchronize_bh() do { } while (0)
+#define softirq_trylock(cpu) cpu_bh_trylock(cpu)
+#define softirq_endlock(cpu) cpu_bh_endlock(cpu)
+#define synchronize_bh() barrier()
#endif /* SMP */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)