: IRQ stacks for sparc64
PATCH 1/1 : IRQ stacks for sparc64
Anyone feeling dangerous? :-)
Today I put together a patch for IRQ stack support. This allows using single pages for the thread_struct plus kernel stack allocation.
I've run it for half of today on my workstation with no ill results so far. But more testing would be really nice, so if you can give this patch a spin that would be great.
The patch should apply to all recent 2.6.x trees.
Thanks.
arch/sparc64/kernel/irq.c +52 -0
@@ -601,11 +601,42 @@ out: bp->flags &= ~IBF_INPROGRESS ; } +struct irq_stack { +unsigned long stack[IRQSTACK_SIZE /sizeof (unsigned long )]; +}; + +static DEFINE_PER_CPU(struct irq_stack, irq_stack); +static DEFINE_PER_CPU(struct irq_stack, softirq_stack); + +static inline void switch_to_irqstack (struct irq_stack *_irq_stack) +{ +unsigned long irq_stack = (unsigned long ) _irq_stack; +unsigned long irq_stack_end = irq_stack +IRQSTACK_SIZE ; +unsigned long cur_stack; + +if (unlikely (!irq_stack)) +return ; + + __asm__ __volatile__("mov %%sp, %0\n" + :"=r" (cur_stack)); + + cur_stack +=STACK_BIAS ; +if (cur_stack >= irq_stack && cur_stack < irq_stack_end) +return ; + + __asm__ __volatile("mov %0, %%sp" + : /* no outputs */ + : "r" ((irq_stack + IRQSTACK_SIZE) - + (STACKFRAME_SZ +STACK_BIAS ))); +} +void handler_irq (int irq,struct pt_regs *regs) {struct ino_bucket *bp;int cpu =smp_processor_id (); +switch_to_irqstack (&__get_cpu_var (irq_stack)); +#ifndef CONFIG_SMP /* * Check for TICK_INT on level 14 softint.
@@ -645,6 +676,27 @@ void handler_irq(int irq, struct pt_regsirq_exit (); } +extern asmlinkage void __do_softirq(void); + +asmlinkage void do_softirq(void) +{ +unsigned long flags; + +if (in_interrupt ()) +return ; + +local_irq_save (flags); + +if (local_softirq_pending ()) { +switch_to_irqstack (&__get_cpu_var (softirq_stack)); +__do_softirq (); + } + +local_irq_restore (flags); +} + +EXPORT_SYMBOL (do_softirq); +#ifdef CONFIG_BLK_DEV_FD extern irqreturn_t floppy_interrupt (int ,void *,struct pt_regs *);;
include/asm-sparc64/irq.h +3 -0
@@ -16,6 +16,9 @@#include <asm/pil.h> #include <asm/ptrace.h> +#define __ARCH_HAS_DO_SOFTIRQ +#define IRQSTACK_SIZE 8192 +struct ino_bucket ;#define MAX_IRQ_DESC_ACTION 4
include/asm-sparc64/thread_info.h +4 -23
@@ -117,13 +117,8 @@ struct thread_info {#define FAULT_CODE_WINFIXUP 0x08/* Miss happened during spill/fill */ #define FAULT_CODE_BLKCOMMIT 0x10/* Use blk-commit ASI in copy_page */ -#if PAGE_SHIFT = 13 -#define THREAD_SIZE (2*PAGE_SIZE) -#define THREAD_SHIFT (PAGE_SHIFT + 1) -#else /* PAGE_SHIFT = 13 */ #define THREAD_SIZE PAGE_SIZE#define THREAD_SHIFT PAGE_SHIFT -#endif /* PAGE_SHIFT = 13 */ #define PREEMPT_ACTIVE 0x4000000
@@ -153,30 +148,16 @@ register struct thread_info *current_thr#define current_thread_info () (current_thread_info_reg)/* thread information allocation */ -#if PAGE_SHIFT = 13 -#define __THREAD_INFO_ORDER 1 -#else /* PAGE_SHIFT = 13 */ -#define __THREAD_INFO_ORDER 0 -#endif /* PAGE_SHIFT = 13 */ -#ifdef CONFIG_DEBUG_STACK_USAGE -#define alloc_thread_info (tsk) \ -({ \ - struct thread_info *ret; \ - \ - ret = (struct thread_info *) \ - __get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER); \ - if (ret) \ - memset(ret, 0, PAGE_SIZE<<__THREAD_INFO_ORDER); \ - ret; \ -}) +#define alloc_thread_info (tsk) \ + ((struct thread_info *) get_zeroed_page(GFP_KERNEL))#else #define alloc_thread_info (tsk) \ - ((struct thread_info *)__get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER)) + ((struct thread_info *) __get_free_page(GFP_KERNEL))#endif #define free_thread_info (ti) \ - free_pages((unsigned long)(ti),__THREAD_INFO_ORDER) + free_pages((unsigned long)(ti),0)#define __thread_flag_byte_ptr (ti) \ ((unsigned char *)(&((ti)->flags)))
DSM> Anyone feeling dangerous? :-)
Seems to run fine on my Ultra 5 for some time now, constantly serving NFS from onboard IDE at 10MB/s. Todays git snapshot was used as the base.
Signature · 1 line
Meelis Roos
From: Meelis Roos <[email protected]>
Date: Fri, 11 Nov 2005 17:41:49 +0200 (EET)
Quoted 5 lines
DSM> Anyone feeling dangerous? :-)
Seems to run fine on my Ultra 5 for some time now, constantly serving NFS from onboard IDE at 10MB/s. Todays git snapshot was used as the base.
Thanks so much for testing :-)
Quoted 6 lines · David S. Miller
Anyone feeling dangerous? :-)
Today I put together a patch for IRQ stack support. This allows using single pages for the
thread_structplus kernel stack allocation.
I'm running it on U2(2x400) currently with 2.6.14-U2-2x400-g393b0725. So far, it's doing fine, and this is on a system which has never been stable with a 2.6 kernel. With this kernel + IRQ patch, though, it's stayed up through a lot of stress tests which I would have expected would have killed it.
(But uptime is only 6 hours so far).
Regards,
Ferris
Signature · 2 lines
Ferris McCormick (P44646, MI) <[email protected]> Developer, Gentoo Linux (Sparc, Devrel)
From: Ferris McCormick <[email protected]>
Date: Fri, 11 Nov 2005 21:35:48 +0000
Quoted 6 lines
I'm running it on U2(2x400) currently with 2.6.14-U2-2x400-g393b0725. So far, it's doing fine, and this is on a system which has never been stable with a 2.6 kernel. With this kernel + IRQ patch, though, it's stayed up through a lot of stress tests which I would have expected would have killed it.
(But uptime is only 6 hours so far).
It would be interesting to know if that exact kernel, but without the IRQ stacks patch, works just as well.
It's nice that it's stable, but we should find out exactly why :-)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 10 lines · David S. Miller
From: Ferris McCormick <[email protected]>
Date: Fri, 11 Nov 2005 21:35:48 +0000Quoted 6 lines
I'm running it on U2(2x400) currently with 2.6.14-U2-2x400-g393b0725. So far, it's doing fine, and this is on a system which has never been stable with a 2.6 kernel. With this kernel + IRQ patch, though, it's stayed up through a lot of stress tests which I would have expected would have killed it.
(But uptime is only 6 hours so far).
Quoted 6 lines
It would be interesting to know if that exact kernel, but without the IRQ stacks patch, works just as well.
It's nice that it's stable, but we should find out exactly why :-)
If the system is still up Monday and if no one else has reported on the U2 (and U1) stability, I'll try to make a test using Josh Grebe's (squash's) crashme script against that kernel with the IRQ patch removed. I can't give a good estimate of when the test will be possible because Monday morning the U2 will be helping with a fairly lengthy upgrade unrelated to the kernel.
Regards,
Ferris
- --
Ferris McCormick (P44646, MI) <[email protected]>
Developer, Gentoo Linux (sparc, devrel)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFDdVpgQa6M3+I///cRAoh6AKCHJfFYVWRISLfpB4SSRSeE3CdPbACgtxnF FloXJHIgbtQvu2IYtXgDAoY=lxeP
-----END PGP SIGNATURE-----
Quoted 10 lines · On Thu, 10 Nov 2005 21:02:34 -0800 (PST) "David S. Miller"…
Anyone feeling dangerous? :-)
Today I put together a patch for IRQ stack support. This allows using single pages for the
thread_structplus kernel stack allocation.I've run it for half of today on my workstation with no ill results so far. But more testing would be really nice, so if you can give this patch a spin that would be great.
I've tried this patch against 2.6.14-git14 on a 2x750 Blade 1000. When I let the blade boot normally, it for some reason fails to mount the root filesystem and dies with the following error;
kernel BUG at kernel/fork.c:731
If I try booting the same kernel with the -p argument, this doesn't happen and the system boots as expected. Will let the system run like this and see how it goes.
Cheers,
Signature · 2 lines
Jason Wever Gentoo/Sparc Team Co-Lead
Quoted 25 lines · Ferris McCormick
Quoted 10 lines · David S. Miller
From: Ferris McCormick <[email protected]>
Date: Fri, 11 Nov 2005 21:35:48 +0000Quoted 6 lines
I'm running it on U2(2x400) currently with 2.6.14-U2-2x400-g393b0725. So far, it's doing fine, and this is on a system which has never been stable with a 2.6 kernel. With this kernel + IRQ patch, though, it's stayed up through a lot of stress tests which I would have expected would have killed it.
(But uptime is only 6 hours so far).Quoted 6 lines
It would be interesting to know if that exact kernel, but without the IRQ stacks patch, works just as well.
It's nice that it's stable, but we should find out exactly why :-)
If the system is still up Monday and if no one else has reported on the U2 (and U1) stability, I'll try to make a test using Josh Grebe's (squash's) crashme script against that kernel with the IRQ patch removed. I can't give a good estimate of when the test will be possible because Monday morning the U2 will be helping with a fairly lengthy upgrade unrelated to the kernel.
Quoted 2 lines
Regards,
Ferris
OK, I lied. I did the tests today. Here are the results:
1. 2.6.14-U2-2x400-g393b0725 (git kernel as identified, with IRQ stack patch): Still looks stable.
2. 2.6.14-U2-2x400-noIRQpatch-g393b0725 (same kernel w/o IRQ stack patch): very unstable (Josh's crashme script crashes it in the untar test during first pass).
And just for fun,
3. 2.6.14.2-U2-2x400 (2.6.14.2 as available at
http://www.kernel.org/pub/linux/kernel/v2.6/) + IRQ stack patch:
extremely unstable (apparently, more unstable than -2- above). I have no explanation; just results. (The g393... kernel seems to be dated November 11, and 2.14.2 also seems to be November 11: in .git/ for g393...,
4 drwxr-xr-x 260 536 536 4096 Nov 11 05:39 objects/
I've told you more than I know, but at least a stable 2.6.14-xxx on U2 is possible.
Signature · 2 lines
Ferris McCormick (P44646, MI) <[email protected]> Developer, Gentoo Linux (Sparc, Devrel)
From: Ferris McCormick <[email protected]>
Date: Sat, 12 Nov 2005 18:24:54 +0000
Quoted 2 lines
I've told you more than I know, but at least a stable 2.6.14-xxx on U2 is possible.
Ok, thanks :)
From: Jason Wever <[email protected]>
Date: Fri, 11 Nov 2005 21:03:27 -0700
Quoted 9 lines
I've tried this patch against 2.6.14-git14 on a 2x750 Blade 1000. When I let the blade boot normally, it for some reason fails to mount the root filesystem and dies with the following error;
kernel BUG at
kernel/fork.c:731If I try booting the same kernel with the -p argument, this doesn't happen and the system boots as expected. Will let the system run like this and see how it goes.
And without the IRQ stack patch applied the "kernel BUG at kernel/fork.c:731" problem does not occur?
Thanks.
Quoted 2 lines · On Sat, 12 Nov 2005 11:45:28 -0800 (PST) "David S. Miller"…
And without the IRQ stack patch applied the "kernel BUG at
kernel/fork.c:731" problem does not occur?
Correct, an unpatched 2.6.14, 2.6.14-git14 or 2.6.15-rc1 does not show this problem. All 3 of those kernels when patched, do.
Another discovery found while testing this patch but unrelated to it (happens both with and without the patch) is that if the new driver for a radeonfb is compiled into the kernel (i.e. for XVR-100 users) and -p is passed to the kernel at boot time, the kernel will panic. The error message is right as the kernel is detecting the CPUs on the Blade 1000 and says something to the effect of "cannot contact remote CPUs".
This also only appears to happen when the graphical console is detected as booting the system without a keyboard and mouse connected boots normally.
Cheers,
Signature · 2 lines
Jason Wever Gentoo/Sparc Team Co-Lead
From: Jason Wever <[email protected]>
Date: Sat, 12 Nov 2005 13:39:05 -0700
Quoted 8 lines
Quoted 2 lines · On Sat, 12 Nov 2005 11:45:28 -0800 (PST) "David S. Miller"…
And without the IRQ stack patch applied the "kernel BUG at
kernel/fork.c:731" problem does not occur?Correct, an unpatched 2.6.14, 2.6.14-git14 or 2.6.15-rc1 does not show this problem. All 3 of those kernels when patched, do.
Do you happen to have CONFIG_PREEMPT enabled by chance?
Quoted 1 line · On Tue, 15 Nov 2005 14:07:55 -0800 (PST) "David S. Miller"…
Do you happen to have
CONFIG_PREEMPTenabled by chance?
Nope, preempt is disabled. Since that's been the suggested course of action in the past, I haven't tempted fate there yet :)
Cheers,
Signature · 2 lines
Jason Wever Gentoo/Sparc Team Co-Lead
From: Jason Wever <[email protected]>
Date: Fri, 11 Nov 2005 21:03:27 -0700
Quoted 9 lines
I've tried this patch against 2.6.14-git14 on a 2x750 Blade 1000. When I let the blade boot normally, it for some reason fails to mount the root filesystem and dies with the following error;
kernel BUG at
kernel/fork.c:731If I try booting the same kernel with the -p argument, this doesn't happen and the system boots as expected. Will let the system run like this and see how it goes.
I'm trying to reproduce this here locally and not having any luck. On my SB1000 I also have 2x750 cpus and I have 2GB of ram. I'm using a creator3D framebuffer as the console with a USB keyboard.
And it works perfectly fine with the IRQ stack patch applied to 2.6.15-rc2.
Also, I'm using gcc-4.0.2-20050808 (Ubuntu 4.0.1-4ubuntu9) as my compiler.
Can you let me know your compiler, ".config" and what you're using as the console? It's the only place where I think there might be differences between our two setups.
Thanks Jason.