more fixes to SMP alpha snapshot, should work now

David S. Miller (davem@jenolan.rutgers.edu)
Wed, 22 Jan 1997 21:27:18 -0500


I actually got things up tonight on a dual-PPro AMI Goliath machine
with the following patches to the SMP snapshot I made the other day.

The only problem I have now is that ypbind gets stuck until I stick
strace on the process, then it is just fine, weird. I'll be
investigating this next, could be all the SysV/IPC stuff it uses.

Please keep all the success/failure stories coming along, and thanks
for all the reports thus far.

diff -u --recursive --new-file --exclude=CVS snapshot/linux/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c
--- snapshot/linux/arch/i386/kernel/process.c Sun Jan 19 18:46:01 1997
+++ linux/arch/i386/kernel/process.c Wed Jan 22 20:22:13 1997
@@ -494,7 +494,7 @@
p->tss.esp = (unsigned long) childregs;
#ifdef __SMP__
p->tss.eip = (unsigned long) ret_from_smpfork;
- p->tss.eflags = regs->eflags & 0xfff7cfff; /* iopl always 0 for a new process */
+ p->tss.eflags = regs->eflags & 0xffffcdff; /* iopl always 0 for a new process */
#else
p->tss.eip = (unsigned long) ret_from_sys_call;
p->tss.eflags = regs->eflags & 0xffffcfff; /* iopl always 0 for a new process */
diff -u --recursive --new-file --exclude=CVS snapshot/linux/include/asm-i386/smp.h linux/include/asm-i386/smp.h
--- snapshot/linux/include/asm-i386/smp.h Sun Jan 19 19:03:15 1997
+++ linux/include/asm-i386/smp.h Wed Jan 22 20:23:14 1997
@@ -236,17 +236,41 @@
/* These read/change the "processes available" counter in the scheduler. */
extern __inline__ __volatile__ void inc_smp_counter(volatile int *ctr)
{
+ int cpu = smp_processor_id();
while(set_bit(31, ctr))
- ;
- *ctr++;
+ {
+ while(test_bit(31,ctr))
+ {
+ if(clear_bit(cpu,&smp_invalidate_needed))
+ {
+ unsigned long tmpreg;
+ __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3"
+ : "=r" (tmpreg) : : "memory");
+ set_bit(cpu,&cpu_callin_map[0]);
+ }
+ }
+ }
+ *ctr = (*ctr + 1);
clear_bit(31, ctr);
}

extern __inline__ __volatile__ void dec_smp_counter(volatile int *ctr)
{
+ int cpu = smp_processor_id();
while(set_bit(31, ctr))
- ;
- *ctr--;
+ {
+ while(test_bit(31,ctr))
+ {
+ if(clear_bit(cpu,&smp_invalidate_needed))
+ {
+ unsigned long tmpreg;
+ __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3"
+ : "=r" (tmpreg) : : "memory");
+ set_bit(cpu,&cpu_callin_map[0]);
+ }
+ }
+ }
+ *ctr = (*ctr - 1);
clear_bit(31, ctr);
}