mprotect and SMP
Subsystems (2)
Hi all:
I'm running a multi-threaded application on an SMP Gemini board (2.2.18-pre11) which uses the mprotect call to lock pages between the threads. If I run the test program on this machine in SMP mode, it fails (threads tromp on their shared memory locations). If I run in uni-processor mode however it works fine. It also works fine on a dual processor pentium using a similar version of the kernel. The question is... Has anyone seen this sort of behavior and are there any suggested places to start looking to fix it? I took a look at the gemini specific files to see if there were any obvious missing eieio or sync instructions and so far haven't seen any, but I don't have the experience to know where else I should be looking.
Gavin
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 11 lines
(2.2.18-pre11) which uses the mprotect call to lock pages between the threads. If I run the test program on this machine in SMP mode, it fails (threads tromp on their shared memory locations). If I run in uni-processor mode however it works fine. It also works fine on a dual processor pentium using a similar version of the kernel. The question is... Has anyone seen this sort of behavior and are there any suggested places to start looking to fix it? I took a look at the gemini specific files to see if there were any obvious missing eieio or sync instructions and so far haven't seen any, but I don't have the experience to know where else I should be looking.
Can you get the latest bitkeeper _2_2 tree or paulus latest rsync tree and see if it still happens ?
Ben.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
This problem has existed since the earliest kernels I've had for the gemini (about 2.2.13).
I've got read access to the bk tree now, the problem is that it doesn't boot when configured for the gemini, I'm going to look through the gemini specific diffs and try and get the 2_2 tree running, but from what I've seen in the larger set of diff's there's no modifications that seem to apply to the mprotect problem. Just out of curiosity, if I do get the gemini configuration running who do I send the changes to so that they make it back into the tree.
Gavin
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 11 lines
(2.2.18-pre11) which uses the mprotect call to lock pages between the threads. If I run the test program on this machine in SMP mode, it fails (threads tromp on their shared memory locations). If I run in uni-processor mode however it works fine. It also works fine on a dual processor pentium using a similar version of the kernel. The question is... Has anyone seen this sort of behavior and are there any suggested places to start looking to fix it? I took a look at the gemini specific files to see if there were any obvious missing eieio or sync instructions and so far haven't seen any, but I don't have the experience to know where else I should be looking.
Quoted 4 lines
Can you get the latest bitkeeper _2_2 tree or paulus latest rsync tree and see if it still happens ?
Ben.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 5 lines
This problem has existed since the earliest kernels I've had for the gemini (about 2.2.13).
Quoted 8 lines
I've got read access to the bk tree now, the problem is that it doesn't boot when configured for the gemini, I'm going to look through the gemini specific diffs and try and get the 2_2 tree running, but from what I've seen in the larger set of diff's there's no modifications that seem to apply to the mprotect problem. Just out of curiosity, if I do get the gemini configuration running who do I send the changes to so that they make it back into the tree.
Gavin
Send them to this list, CC to me & paulus, eventually submit them to the sourceforge site.
Ben.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 14 lines · Benjamin Herrenschmidt
Quoted 5 lines
This problem has existed since the earliest kernels I've had for the gemini (about 2.2.13).
Quoted 8 lines
I've got read access to the bk tree now, the problem is that it doesn't boot when configured for the gemini, I'm going to look through the gemini specific diffs and try and get the 2_2 tree running, but from what I've seen in the larger set of diff's there's no modifications that seem to apply to the mprotect problem. Just out of curiosity, if I do get the gemini configuration running who do I send the changes to so that they make it back into the tree.
Gavin
Quoted 4 lines
Send them to this list, CC to me & paulus, eventually submit them to the sourceforge site.
Ben.
Ben:
Well I've finally got what I think are the minimum set of differences needed to make the 2.2.18 bk tree run on the "gemini" (read synergymicro) boards. The diffs are against the current bk linuxppc2_2 tree. I still have not solved the mprotect problem but at least I can run the the system with a kernel based on the bk tree. Could you please see about getting these changes included in the bk linuxppc_2_2 tree?
G++
Makefile +1 -1
@@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 2 SUBLEVEL = 18 -EXTRAVERSION = gemini-1 +EXTRAVERSION = ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
arch/ppc/boot/head.S +0 -52
93 lines not on this page · raw message
arch/ppc/boot/misc.c +1 -24
@@ -42,13 +42,7 @@char cmd_buf[256 ];char *cmd_line = cmd_buf; -#ifdef CONFIG_VGA -#define HAS_KEYB 1 -#else -#define HAS_KEYB 0 -#endif - -int keyb_present =HAS_KEYB ;/* keyboard controller is present by default */ +int keyb_present =1 ;/* keyboard controller is present by default */ RESIDUAL hold_resid_buf;RESIDUAL *hold_residual = &hold_resid_buf;unsigned long initrd_start =0 , initrd_end =0 ;
@@ -382,11 +376,8 @@#if defined(CONFIG_SERIAL_CONSOLE ) com_port = (struct NS16550 *)NS16550_init (0 );#endif /* CONFIG_SERIAL_CONSOLE */ -#ifdef CONFIG_VGA vga_init (0xC0000000 ); -#endif -#ifndef CONFIG_GEMINI if (residual) {/* Is this Motorola PPCBug? */
@@ -454,7 +445,6 @@/* Turn MMU back off */ _put_MSR (orig_MSR & ~0x0030 ); } -#endif /* !CONFIG_GEMINI */ if (start_multi) { hold_residual->VitalProductData.SmpIar =0 ;
@@ -493,22 +483,13 @@puts ("\n" ); } -#ifndef CONFIG_GEMINI /* we have to subtract 0x10000 here to correct for objdump including the size of the elf header which we strip -- Cort */ zimage_start = (char *)(load_addr -0x10000 +ZIMAGE_OFFSET ); zimage_size =ZIMAGE_SIZE ; -#else - zimage_start = (char *)(load_addr +ZIMAGE_OFFSET ); - zimage_size =ZIMAGE_SIZE ; -#endif if (INITRD_OFFSET ) -#ifndef CONFIG_GEMINI initrd_start = load_addr -0x10000 +INITRD_OFFSET ; -#else - initrd_start = load_addr +INITRD_OFFSET ; -#endif else initrd_start =0 ; initrd_end =INITRD_SIZE + initrd_start;
@@ -558,9 +539,7 @@puts ("\nLinux/PPC load: " ); timer =0 ; cp = cmd_line; -#ifndef CONFIG_GEMINI memcpy (cmd_line, cmd_preset,sizeof (cmd_preset)); -#endif while ( *cp )putc (*cp++);while (timer++ <5 *1000 ) {if (tstc ()) {
@@ -579,9 +558,7 @@ }udelay (1000 );/* 1 msec */ } -#ifndef CONFIG_GEMINI *cp =0 ; -#endif puts ("\n" );/* mappings on early boot can only handle 16M */
arch/ppc/boot/ns16550.c +0 -11
@@ -2,7 +2,6 @@* COM1 NS16550 support */ -#include <linux/config.h> #include "ns16550.h" typedef struct NS16550 *NS16550_t ;
@@ -23,7 +22,6 @@#if 0 if (com_port->ier !=0x0F )return ((struct NS16550 *)0 );#endif -#ifndef CONFIG_GEMINI com_port->ier =0x00 ; com_port->lcr =0x80 ;/* Access baud rate */ com_port->dll =0xc ;/* 9600 baud */
@@ -31,14 +29,6 @@ com_port->lcr =0x03 ;/* 8 data, 1 stop, no parity */ com_port->mcr =0x03 ;/* RTS/DTR */ com_port->fcr =0x07 ;/* Clear & enable FIFOs */ -#else - com_port->lcr =0x83 ; - com_port->rbr =0x9c ; - com_port->ier =0 ; - com_port->lcr =7 ; - com_port->mcr =0xf ; - asm("sync" ); -#endif return (com_port); }
@@ -48,7 +38,6 @@volatile int i;while ((com_port->lsr &LSR_THRE ) ==0 ) ; com_port->thr = c; - asm("sync" ); }unsigned char
arch/ppc/boot/ns16550.h +0 -9
@@ -2,8 +2,6 @@* NS16550 Serial Port */ -#include <linux/config.h> -struct NS16550 {unsigned char rbr;/* 0 */
@@ -30,14 +28,7 @@#define LSR_TEMT 0x40/* Xmitter empty */ #define LSR_ERR 0x80/* Error */ -#ifndef CONFIG_GEMINI #define COM1 0x800003F8#define COM2 0x800002F8#define COM3 0x800003F8#define COM4 0x80000388 -#else -#define COM1 0xffeffb08 -#define COM2 0xffeffb00 -#define COM3 0 -#define COM4 0 -#endif
arch/ppc/kernel/gemini_prom.S +22 -0
@@ -37,6 +37,28 @@ ori r3,r3,MSR_IR|MSR_DR andc r4,r4,r3 mtmsr r4 +#if 0 + /* zero out the bats now that the MMU is off */ +prom_no_mmu: + li r3,0 + mtspr IBAT0U,r3 + mtspr IBAT0L,r3 + mtspr IBAT1U,r3 + mtspr IBAT1L,r3 + mtspr IBAT2U,r3 + mtspr IBAT2L,r3 + mtspr IBAT3U,r3 + mtspr IBAT3L,r3 + + mtspr DBAT0U,r3 + mtspr DBAT0L,r3 + mtspr DBAT1U,r3 + mtspr DBAT1L,r3 + mtspr DBAT2U,r3 + mtspr DBAT2L,r3 + mtspr DBAT3U,r3 + mtspr DBAT3L,r3 +#endif /* the bootloader (as far as I'm currently aware) doesn't mess with page tables, but since we're already here, might as well zap these, too */
arch/ppc/kernel/gemini_setup.c +153 -158
411 lines not on this page · raw message
arch/ppc/kernel/idle.c +0 -1
@@ -297,7 +297,6 @@case 6 :/* 603e */ case 7 :/* 603ev */ case 8 :/* 750 */ -case 12 :/* 7400 */ save_flags (msr);__cli ();if (!current->need_resched) {
drivers/char/serial.c +0 -2
@@ -2963,7 +2963,6 @@* 0x80 is a non-existent port; which should be safe since * include/asm/io.h also makes this assumption. */ -#ifdef __i386__ scratch =serial_inp (info,UART_IER );serial_outp (info,UART_IER ,0 );outb (0xff ,0x080 );
@@ -2973,7 +2972,6 @@restore_flags (flags);return ;/* We failed; there's nothing here */ } -#endif /* * Check to see if a UART is really there. Certain broken
include/asm-ppc/gemini_serial.h +2 -2
@@ -7,10 +7,10 @@#define BASE_BAUD (24576000 / 16)#ifdef CONFIG_SERIAL_DETECT_IRQ -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ) +#define STD_COM_FLAGS (/*ASYNC_BOOT_AUTOCONF|*/ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)#else -#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST) +#define STD_COM_FLAGS (/*ASYNC_BOOT_AUTOCONF|*/ASYNC_SKIP_TEST)#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF)#endif
I have just tried the program with the latest bk 2_2 tree (pulled four hours ago) on both the quad 750 and quad 7400. It still fails. I also built the kernel with the L2 caches disabled and that fails as well. The same kernel built uni-processor passes on both boards. I had thought it might be a cacheing issue, but if it is, it's got to be level 1 cache. I'm still at a loss as to where to start looking for the problem. All I can say is help!
I'll package up gemini specific patches to let the 2_2 tree boot sometime this weekend and forward them.
Gavin
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 11 lines
(2.2.18-pre11) which uses the mprotect call to lock pages between the threads. If I run the test program on this machine in SMP mode, it fails (threads tromp on their shared memory locations). If I run in uni-processor mode however it works fine. It also works fine on a dual processor pentium using a similar version of the kernel. The question is... Has anyone seen this sort of behavior and are there any suggested places to start looking to fix it? I took a look at the gemini specific files to see if there were any obvious missing eieio or sync instructions and so far haven't seen any, but I don't have the experience to know where else I should be looking.
Quoted 4 lines
Can you get the latest bitkeeper _2_2 tree or paulus latest rsync tree and see if it still happens ?
Ben.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/