Re: 4kb for kernel stack - what is that?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rene Herman wrote:
On 13-04-08 21:55, Robert P. J. Day wrote:

(*) Per thread and a bit less in fact, since the current thread's
thread_struct lives at the bottom. The option furthermore also means
you get seperate interrupt stacks (also meaning that depending on
usage you might even end with more generally available stack with
the 4KSTACK option then without, when interrupt handlers share the
stack).

  as i understand it (and i just want to make sure i have this right),
on x86, if you have 8K stacks, then an interrupt simply "borrows" the
stack of the process that was interrupted, right?  so even though
interrupt handlers don't run in a process context, they'll quietly use
the stack of that process anyway.

On x86-32, yes.

  if, however, you select 4K stacks, what happens?  is there now a
single, separate 4K stack for interrupts, completely independent from
each process' kernel stack?

"Per-CPU single" yes and completely independent (and with CONFIG_4KSTACKS there is also a second per-CPU 4K stack for softirq's, which also used to run on the process' kernel stack).

x86-64 has always used seperate the IRQ stack(s) and has hardware support for them. I believe it actually has at least a few IRQs with private IRQ stacks (private to the single IRQ even) but I'm too sunday to check right now. Still on x86-32 myself...

(by the way, my "current thread's thread_struct" above should be "current thread's struct thread_info").

Rene.



Thank you Rene and Robert, the $DEITY has finally arrived.....only after I added the "AAAAAAAAAAAAAAA" block of codes the module crashes. Taking away that block, the module did not crashed because single byte corruption is insufficient to arouse the $DEITY - I supposed.

Now does anyone know where is that defined? So that I can look into the Xen's hypervisor implementation to answer similar question - what is the max kernel stack size for the Xen hypervisor - is it possible to be 16KB?


/* * hello-1.c - The simplest kernel module.
*/
#include <linux/module.h>       /* Needed by all modules */
#include <linux/kernel.h>       /* Needed for KERN_INFO */

int init_module(void)
{
       char mystack[1024*1024];

       printk(KERN_INFO "Hello world 1.\n");
       mystack[1024*1024-2] = 'A';


      /***AAAAAAAAAAAAAAAA**/
      /************************************/
      /************************************/
     /************************************/
       memset(mystack, 'A', 1024*1024);
       mystack[1024*1024-2] = '\0';
       printk(KERN_INFO "Hello world 1 %s.\n", mystack);
      /************************************/
      /************************************/
      /************************************/


       /*
        * A non 0 return means init_module failed; module can't be loaded.
        */
       return 0;
}

void cleanup_module(void)
{
       printk(KERN_INFO "Goodbye world 1.\n");
}


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux