(patch) SMP Alpha hacks for 2.1.120

Jeff Garzik (jgarzik@pobox.com)
Wed, 2 Sep 1998 21:44:17 -0400 (EDT)


The following patch is against 2.1.120-pre3. It resolves several
problems when compiling with SMP = 1 on Alpha.

Test config: AS 200, avanti kernel w/ SRM boot, RedHat 5.1

Summary of changes:
proto.h corrects smp_info prototype
smp.c add kernel_flag spinlock var to
resolve missing-symbol link errors
smplock.h add recently-dropped macro kernel_lock_held(),
was referenced in smp.c
softirq.h needs linux/stddef.h for definition of NULL
linux/interrupt.h needs linux/ptrace.h for struct pt_regs
core_apecs.c needs linux/sched.h for smp_processor_id

Problems remain:

After applying the patch below, the kernel boots fine and loads RH5.1.
As soon as hard drive accesses begin in multi-user mode, mountains of
the following output appears. THE SYSTEM CONTINUES TO BE USABLE.

flush_tlb_page: kernel_flag 0 (cpu 0 akp 0)!
flush_tlb_page: kernel_flag 0 (cpu 0 akp 0)@0xfffffc000033554
flush_tlb_page: kernel_flag 0 (cpu 0 akp 0)@0xfffffc00003715c
...
[repeat many hundreds of times with each serious disk access,
the '!' lines are far more frequent than the memory address lines]

Compiling with SMP=0 kills egcs with an illegal instruction in
page_alloc.c, function __free_page().
We'll see if egcs-1.1a fares any better...

As a final note, this was the first time I've ever booted on a 2.1
kernel; without even lifting a finger to check version numbers on my RH
system, I booted the test kernel... and it came up and gave me a login
prompt just fine.

Advice/help on fixing the flush_tlb_page thingy would be great :)

Jeff

diff -r -c -b linux.copy/arch/alpha/kernel/core_apecs.c linux/arch/alpha/kernel/core_apecs.c
*** linux.copy/arch/alpha/kernel/core_apecs.c Sun Aug 9 15:09:05 1998
--- linux/arch/alpha/kernel/core_apecs.c Wed Sep 2 20:13:03 1998
***************
*** 14,19 ****
--- 14,20 ----
#include <linux/types.h>
#include <linux/pci.h>
#include <linux/init.h>
+ #include <linux/sched.h>

#include <asm/system.h>
#include <asm/ptrace.h>
diff -r -c -b linux.copy/arch/alpha/kernel/proto.h linux/arch/alpha/kernel/proto.h
*** linux.copy/arch/alpha/kernel/proto.h Sun Aug 9 15:09:05 1998
--- linux/arch/alpha/kernel/proto.h Wed Sep 2 20:13:03 1998
***************
*** 92,98 ****

/* smp.c */
extern void setup_smp(void);
! extern char *smp_info(void);
extern void handle_ipi(struct pt_regs *);

/* bios32.c */
--- 92,98 ----

/* smp.c */
extern void setup_smp(void);
! extern int smp_info(char *buffer);
extern void handle_ipi(struct pt_regs *);

/* bios32.c */
diff -r -c -b linux.copy/arch/alpha/kernel/smp.c linux/arch/alpha/kernel/smp.c
*** linux.copy/arch/alpha/kernel/smp.c Sun Aug 9 15:09:05 1998
--- linux/arch/alpha/kernel/smp.c Wed Sep 2 20:13:54 1998
***************
*** 34,39 ****
--- 34,40 ----
klock_info_t klock_info = { KLOCK_CLEAR, 0 };

spinlock_t ticker_lock = SPIN_LOCK_UNLOCKED;
+ spinlock_t kernel_flag = SPIN_LOCK_UNLOCKED;

unsigned int boot_cpu_id = 0;
static int smp_activated = 0;
diff -r -c -b linux.copy/include/asm-alpha/smplock.h linux/include/asm-alpha/smplock.h
*** linux.copy/include/asm-alpha/smplock.h Mon Aug 3 15:28:20 1998
--- linux/include/asm-alpha/smplock.h Wed Sep 2 20:20:42 1998
***************
*** 3,12 ****
--- 3,16 ----
*
* Default SMP lock implementation
*/
+ #include <linux/sched.h>
#include <linux/interrupt.h>
#include <asm/spinlock.h>

extern spinlock_t kernel_flag;
+
+ #define kernel_lock_held() \
+ (klock_info.kernel_flag && (klock_info.akp == smp_processor_id()))

/*
* Release global kernel lock and global interrupt lock
diff -r -c -b linux.copy/include/asm-alpha/softirq.h linux/include/asm-alpha/softirq.h
*** linux.copy/include/asm-alpha/softirq.h Mon Mar 30 03:21:41 1998
--- linux/include/asm-alpha/softirq.h Wed Sep 2 20:20:42 1998
***************
*** 1,6 ****
--- 1,7 ----
#ifndef _ALPHA_SOFTIRQ_H
#define _ALPHA_SOFTIRQ_H

+ #include <linux/stddef.h>
#include <asm/atomic.h>
#include <asm/hardirq.h>

diff -r -c -b linux.copy/include/linux/interrupt.h linux/include/linux/interrupt.h
*** linux.copy/include/linux/interrupt.h Wed Aug 26 18:00:39 1998
--- linux/include/linux/interrupt.h Wed Sep 2 20:20:42 1998
***************
*** 3,8 ****
--- 3,9 ----
#define _LINUX_INTERRUPT_H

#include <linux/kernel.h>
+ #include <linux/ptrace.h>
#include <asm/bitops.h>
#include <asm/atomic.h>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html