Skip to contentSkip to conversation

i386: always use 4k stacks

PATCH Alex Davis 21 participants 46 messages Nov 14, 2005 – Nov 17, 2005

lore
Share & tools
lore

Alex Davis

author
#0 lore raw

This will break ndiswrapper. Why can't we just leave this in and let people choose?

I code, therefore I am

__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

#1 lore raw
Quoted 1 line · Alex Davis

This will break ndiswrapper. Why can't we just leave this in and let people choose?

If we spent our entire lives waiting for people to fix code nothing would ever happen. Removing 8K stacks is a good thing to do for many reasons. The ndis wrapper people have known it is coming for a long time, and if it has a lot of users I'm sure someone in that community will take the time to make patches.

#2 lore raw
Quoted 9 lines · Alan Cox
Quoted 2 lines · Alex Davis

This will break ndiswrapper. Why can't we just leave this in and let people choose?

If we spent our entire lives waiting for people to fix code nothing would ever happen. Removing 8K stacks is a good thing to do for many reasons. The ndis wrapper people have known it is coming for a long time, and if it has a lot of users I'm sure someone in that community will take the time to make patches.

I honestly don't know if this is the case, but is it conceivable that no patch could be written to resolve this, because the Windows drivers themselves only respect Windows stack limits (which are presumably still 8K?).

Signature · 6 lines
Cheers,
Alistair.

'No sense being pessimistic, it probably wouldn't work anyway.'
Third year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.
#3 lore raw
Quoted 4 lines

I honestly don't know if this is the case, but is it conceivable that no patch could be written to resolve this, because the Windows drivers themselves only respect Windows stack limits (which are presumably still 8K?).

afaik Windows has 12k or 16k stacks.

#4 lore raw
In reply to Alistair John Strachan
Quoted 11 lines · Alistair John Strachan
Quoted 9 lines · Alan Cox
Quoted 2 lines · Alex Davis

This will break ndiswrapper. Why can't we just leave this in and let people choose?

If we spent our entire lives waiting for people to fix code nothing would ever happen. Removing 8K stacks is a good thing to do for many reasons. The ndis wrapper people have known it is coming for a long time, and if it has a lot of users I'm sure someone in that community will take the time to make patches.

Quoted 3 lines

I honestly don't know if this is the case, but is it conceivable that no patch could be written to resolve this, because the Windows drivers themselves only respect Windows stack limits (which are presumably still 8K?).

Windows drivers can actually use more than 8KB. So in some situations, you're already screwed. There are already cases where vendors customer service are now telling people "Use ndiswrapper" when people ask about Linux support.

If we continue down this path, we'll have no native wireless drivers for Linux. The answer is not to complain to linux-kernel for breaking ndiswrapper, but complain to the vendors for not releasing specifications for native drivers to be written.

Dave

#5 lore raw
Quoted 22 lines · Dave Jones
Quoted 11 lines · Alistair John Strachan
Quoted 9 lines · Alan Cox
Quoted 2 lines · Alex Davis

This will break ndiswrapper. Why can't we just leave this in and let people choose?

If we spent our entire lives waiting for people to fix code nothing would ever happen. Removing 8K stacks is a good thing to do for many reasons. The ndis wrapper people have known it is coming for a long time, and if it has a lot of users I'm sure someone in that community will take the time to make patches.

Quoted 4 lines

I honestly don't know if this is the case, but is it conceivable that no patch could be written to resolve this, because the Windows drivers themselves only respect Windows stack limits (which are presumably still 8K?).

Windows drivers can actually use more than 8KB. So in some situations, you're already screwed. There are already cases where vendors customer service are now telling people "Use ndiswrapper" when people ask about Linux support.

Quoted 4 lines

If we continue down this path, we'll have no native wireless drivers for Linux. The answer is not to complain to linux-kernel for breaking ndiswrapper, but complain to the vendors for not releasing specifications for native drivers to be written.

I agree, and I was not arguing for or against breaking ndiswrapper. I think it's an interesting (and difficult) problem to solve if 4K-stacks gets in.

LWN has a piece on the possible options, but I suppose you could use the argument that forcibly breaking ndiswrapper will spur new driver development (but if you look at vendors like Broadcom, they have seem consistently unwilling to do this).

http://lwn.net/Articles/150580/

Signature · 6 lines
Cheers,
Alistair.

'No sense being pessimistic, it probably wouldn't work anyway.'
Third year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.
#6 lore raw
Quoted 5 lines

LWN has a piece on the possible options, but I suppose you could use the argument that forcibly breaking ndiswrapper will spur new driver development (but if you look at vendors like Broadcom, they have seem consistently unwilling to do this).

there now is a specification for the broadcom wireless, and a driver is being written right now to that specification; and it seems to be getting along quite well (it's not ready for primetime use yet but at least they can send and receive stuff, which is probably the hardest part)

#7 lore raw
Quoted 10 lines · Arjan van de Ven
Quoted 4 lines

LWN has a piece on the possible options, but I suppose you could use the argument that forcibly breaking ndiswrapper will spur new driver development (but if you look at vendors like Broadcom, they have seem consistently unwilling to do this).

there now is a specification for the broadcom wireless, and a driver is being written right now to that specification; and it seems to be getting along quite well (it's not ready for primetime use yet but at least they can send and receive stuff, which is probably the hardest part)

Great news. Perhaps all is not lost. This seems to be a leading chip for laptop wireless, which is an especially contentious issue (since users cannot swap it out as easily due to BIOS locks).

Signature · 6 lines
Cheers,
Alistair.

'No sense being pessimistic, it probably wouldn't work anyway.'
Third year Computer Science undergraduate.
1F2 55 South Clerk Street, Edinburgh, UK.
#8 lore raw
In reply to Arjan van de Ven
Quoted 6 lines · Arjan van de Ven

there now is a specification for the broadcom wireless, and a driver is being written right now to that specification; and it seems to be getting along quite well (it's not ready for primetime use yet but at least they can send and receive stuff, which is probably the hardest part)

Goodie. With Broadcom and Intel on-board, we should have most of the market covered in wireless, and ndiswrappers really should be less of an argument (it was never an argument for me personally, but for others..).

Linus

#9 lore raw
Quoted 9 lines · you
Quoted 6 lines · Arjan van de Ven

there now is a specification for the broadcom wireless, and a driver is being written right now to that specification; and it seems to be getting along quite well (it's not ready for primetime use yet but at least they can send and receive stuff, which is probably the hardest part)

Quoted 3 lines

Goodie. With Broadcom and Intel on-board, we should have most of the market covered in wireless, and ndiswrappers really should be less of an argument (it was never an argument for me personally, but for others..).

I really hope we get this thing usable in a few weeks. Looks good so far... .

However, I did not test the broadcom driver on 4k-stacks,
as I only have a G4 with a broadcom card. ;) But I do not expect any problems.

Signature · 1 line
Greetings Michael.
#10 lore raw

Hi,

Quoted 10 lines · Michael Buesch
Quoted 9 lines · you
Quoted 6 lines · Arjan van de Ven

there now is a specification for the broadcom wireless, and a driver is being written right now to that specification; and it seems to be getting along quite well (it's not ready for primetime use yet but at least they can send and receive stuff, which is probably the hardest part)

Quoted 6 lines
Quoted 3 lines

Goodie. With Broadcom and Intel on-board, we should have most of the market covered in wireless, and ndiswrappers really should be less of an argument (it was never an argument for me personally, but for others..).

I really hope we get this thing usable in a few weeks. Looks good so far... .

Great!

Quoted 2 lines

However, I did not test the broadcom driver on 4k-stacks,
as I only have a G4 with a broadcom card. ;) But I do not expect any problems.

If you want someone to test it on x86-64, I think I can do that.

Greetings,
Rafael

#11 lore raw
In reply to Alistair John Strachan
Quoted 9 lines · Alistair John Strachan
Quoted 5 lines

If we spent our entire lives waiting for people to fix code nothing would ever happen. Removing 8K stacks is a good thing to do for many reasons. The ndis wrapper people have known it is coming for a long time, and if it has a lot of users I'm sure someone in that community will take the time to make patches.

I honestly don't know if this is the case, but is it conceivable that no patch could be written to resolve this, because the Windows drivers themselves only respect Windows stack limits (which are presumably still 8K?).

Both systems are (subject to memory limits) turing complete, so it is definitely possible 8) The kernel itself switches stacks on an IRQ with the 4K stack so you only have to worry about switching your kernel stack not about taking interrupts on it and confusion that may cause.

author
#12 lore raw

Could someone either list or post a link to someplace that lists all the advantages of 4K stacks?

-Alex

I code, therefore I am

__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

#13 lore raw
Quoted 2 lines · Alex Davis

Could someone either list or post a link to someplace that lists all the advantages of 4K stacks?

See the help text for the option under the kernel configurator...

or <http://lwn.net/Articles/84583/>

To summarize: it allows for more processes/threads (each process/thread requires a kernel stack) and it makes it easier for the VM subsystem to allocate larger than order 0 (4k) memory segments (i.e. it will be easier to find contiguous free blocks).

HTH,
-cp

Signature · 1 line
Phishing, pharming; n.: Ways to obtain phood. -- The Devil's Infosec Dictionary
#14 lore raw
In reply to Alex Davis
Quoted 2 lines · Alex Davis

Could someone either list or post a link to someplace that lists all the advantages of 4K stacks?

* less kernel memory (eg lowmem) used for a thread
- allows more threads on the same system (java!)
- increases performance in high-thread systems because more memory is available for disk cache etc
* thread stacks are now order 0 not order 1
- order 0 is easy for the VM, order > 0 is harder (increasingly so the higher the order; so the 16Kb/32Kb request is just really wrong). For order > 0, fragmentation becomes an issue (just look at the entire fragmentation debate from a few weeks ago how bad a problem fragmentation can be). Thread stacks are just about the last remaining "big" user of order > 0 allocations normally. (eg excluding init/setup code)
- order 0 allocations come from a per cpu "quicklist" of pages, while order>0 allocations need to go to a global allocator pool. "global" means "cache line bounces" and "cpu scalability problem".
* less CPU cache footprint due to interrupt stacks
- interrupt stacks are per cpu now instead of borrowing the per thread stack space; this both has less impact on the caches, and has more cache hits; the per cpu stack will be in cache more than the previously scattered bits and pieces
* more stack space is available for interrupts compared to 2.4 kernels
- in 2.4 kernels only 2Kb was available for interrupt context (to keep 4K available for user context). With complex softirqs such as PPP and firewall rules and nested interrupts this wasn't always enough. Compared to 2.6-with-8Kstacks is a bit harder; there is 2Kb extra available there compared to 2.4 and arguably some of that extra is for interrupts.

#15 lore raw

Am Mittwoch, 16. November 2005 09:03 schrieb Arjan van de Ven:

Quoted 4 lines

* less CPU cache footprint due to interrupt stacks
   - interrupt stacks are per cpu now instead of borrowing the per thread stack space; this both has less impact on the caches, and has more cache hits; the per cpu stack will be in cache more than

Quoted 8 lines

     the previously scattered bits and pieces
* more stack space is available for interrupts compared to 2.4 kernels
   - in 2.4 kernels only 2Kb was available for interrupt context (to keep 4K available for user context). With complex softirqs such as PPP and firewall rules and nested interrupts this wasn't always enough. Compared to 2.6-with-8Kstacks is a bit harder; there is 2Kb extra available there compared to 2.4 and arguably some of that extra is for interrupts.

This is due to having interrupt stacks. Is there any reason not to have 8K task stacks and per CPU interrupt stacks?

Regards
Oliver

#16 lore raw
Quoted 14 lines · Oliver Neukum

Am Mittwoch, 16. November 2005 09:03 schrieb Arjan van de Ven:

Quoted 4 lines

* less CPU cache footprint due to interrupt stacks
   - interrupt stacks are per cpu now instead of borrowing the per thread stack space; this both has less impact on the caches, and has more cache hits; the per cpu stack will be in cache more than

Quoted 8 lines

     the previously scattered bits and pieces
* more stack space is available for interrupts compared to 2.4 kernels
   - in 2.4 kernels only 2Kb was available for interrupt context (to keep 4K available for user context). With complex softirqs such as PPP and firewall rules and nested interrupts this wasn't always enough. Compared to 2.6-with-8Kstacks is a bit harder; there is 2Kb extra available there compared to 2.4 and arguably some of that extra is for interrupts.

Quoted 2 lines

This is due to having interrupt stacks. Is there any reason not to have 8K task stacks and per CPU interrupt stacks?

yes, all the other arguments you snipped :) Arjan wrote 4K+4K stacks for Fedora almost 2 years ago, and the patch has a good track record. Here's some more background info about 4K+4K stacks:

http://lwn.net/Articles/84583/
http://lwn.net/Articles/150580/
http://lwn.net/Articles/160138/

Ingo

#17 lore raw
In reply to Arjan van de Ven
Quoted 7 lines · Arjan van de Ven

* more stack space is available for interrupts compared to 2.4 kernels
- in 2.4 kernels only 2Kb was available for interrupt context (to keep 4K available for user context). With complex softirqs such as PPP and firewall rules and nested interrupts this wasn't always enough. Compared to 2.6-with-8Kstacks is a bit harder; there is 2Kb extra available there compared to 2.4 and arguably some of that extra is for interrupts.

I would like to contribute that listing with two non-technical reasons more:

* Encourages good code. Due to the 4 Kb stacks patch several parts of the kernel have gone on diet, improving the quality of the code (see ndiswrapper, ndis drivers can overflow the stack even with 8KB stacks, the 4KB patch will force them to develop a _real_ safe solution for that, improving the quality of ndiswrapper).

* Some distros are enabling 4KB (fedora), other distros aren't, so having a single stack size option will make 3rd party modules distribution easier (some propietary drivers may not be caring about making their drivers work with 4Kb stacks due to the lack of uniformity)

#18 lore raw
Quoted 13 lines · On Wed, 2005-11-16 at 11:18 +0100, Wed, 16 Nov 2005 11:18:12 +0100 wrote:
Quoted 7 lines · Arjan van de Ven

* more stack space is available for interrupts compared to 2.4 kernels
- in 2.4 kernels only 2Kb was available for interrupt context (to keep 4K available for user context). With complex softirqs such as PPP and firewall rules and nested interrupts this wasn't always enough. Compared to 2.6-with-8Kstacks is a bit harder; there is 2Kb extra available there compared to 2.4 and arguably some of that extra is for interrupts.

Quoted 5 lines

I would like to contribute that listing with two non-technical reasons more:

* Encourages good code. Due to the 4 Kb stacks patch several parts of the kernel have gone on diet, improving the quality of the code

this argument I agree with. especially since 64 bit platforms have a higher stack footprint by nature (bigger call frames and more to store on the stack) and if x86 allows stackbloat, the other architectures get in trouble and are going to need really large stacks.

Quoted 5 lines

* Some distros are enabling 4KB (fedora), other distros aren't, so having a single stack size option will make 3rd party modules distribution easier (some propietary drivers may not be caring about making their drivers work with 4Kb stacks due to the lack of uniformity)

this I don't see as a reason; illegal drivers should never be a reason to clutter our kernel one way or the other. And for GPL 3rd party drivers the problem isn't there realistically. If they were reliable in 2.4, they're reliable with 2.6+4K stacks. If they're not then they need to be fixed (eg your previous point).

#19 lore raw
Quoted 10 lines · Arjan van de Ven
Quoted 5 lines

I would like to contribute that listing with two non-technical reasons more:

* Encourages good code. Due to the 4 Kb stacks patch several parts of the kernel have gone on diet, improving the quality of the code

this argument I agree with. especially since 64 bit platforms have a higher stack footprint by nature (bigger call frames and more to store on the stack) and if x86 allows stackbloat, the other architectures get in trouble and are going to need really large stacks.

I think it's in general risky. It's like balancing without a safety net. Might be a nice hobby, but for real production you want a safety net. That's simple because there are likely some code paths through the code that need more stack space and that are rarely hit (and cannot be easily found by static analysis, e.g. if they involve indirect pointers or particularly complex configuration setups). With very tight stack space you're much nearer a crash in extreme situations than otherwise.

So I think it's a bad idea to change this.

-Andi (who prefers to have safety nets)

#20 lore raw
Quoted 7 lines · Andi Kleen

I think it's in general risky. It's like balancing without a safety net. Might be a nice hobby, but for real production you want a safety net. That's simple because there are likely some code paths through the code that need more stack space and that are rarely hit (and cannot be easily found by static analysis, e.g. if they involve indirect pointers or particularly complex configuration setups).

It isn't that hard to find such places. Trouble is that you find so many of them and it takes quite a while to go through them all. Years is a good unit for "quite a while".

Jörn

Signature · 3 lines
With a PC, I always felt limited by the software available. On Unix, 
I am limited only by my knowledge.
-- Peter J. Schoenster
#21 lore raw
Quoted 12 lines · Jörn Engel
Quoted 8 lines · Andi Kleen

I think it's in general risky. It's like balancing without a safety net. Might be a nice hobby, but for real production you want a safety net. That's simple because there are likely some code paths through the code that need more stack space and that are rarely hit (and cannot be easily found by static analysis, e.g. if they involve indirect pointers or particularly complex configuration setups).

Quoted 8 lines

It isn't that hard to find such places. Trouble is that you find so many of them and it takes quite a while to go through them all. Years is a good unit for "quite a while".

Jörn

Map a blank ro page beneath the address range when stack memory is mapped is trap on page faults to the page when folks go off the end of th e stack.

Easy to find.

Jeff

#22 lore raw
Quoted 4 lines · jmerkey
Quoted 1 line

Map a blank ro page beneath the address range when stack memory is mapped is trap on page faults to the page when folks go off the end of th e stack.

You forgot the part with the testcase that will trigger every single possible stack overflow.

Quoted 1 line

Easy to find.

Jörn

Signature · 2 lines
Sometimes, asking the right question is already the answer.
-- Unknown
#23 lore raw
In reply to jmerkey

Am Mittwoch, 16. November 2005 15:42 schrieb jmerkey:

Quoted 5 lines

Map a blank ro page beneath the address range when stack memory is mapped is trap on page faults to the page when folks go off the end of th e stack.

Easy to find.

Provided you can easily trigger it. I don't see how that is a given.

Regards
Oliver

#24 lore raw
Quoted 8 lines · Oliver Neukum

Am Mittwoch, 16. November 2005 15:42 schrieb jmerkey:

Quoted 5 lines

Map a blank ro page beneath the address range when stack memory is mapped is trap on page faults to the page when folks go off the end of th e stack.

Easy to find.

Provided you can easily trigger it. I don't see how that is a given.

the same is true for a unified 8k stack or for the 4k/4k split though. Ok sure there's a 1.5Kb difference on the one side.. (but a 2Kb gain on the other side)

#25 lore raw
Quoted 6 lines · Arjan van de Ven
Quoted 5 lines · Oliver Neukum

Am Mittwoch, 16. November 2005 15:42 schrieb jmerkey:

Quoted 4 lines

Map a blank ro page beneath the address range when stack memory is mapped is trap on page faults to the page when folks go off the end of th e stack.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Easy to find.

Provided you can easily trigger it. I don't see how that is a given.

the same is true for a unified 8k stack or for the 4k/4k split though. Ok sure there's a 1.5Kb difference on the one side.. (but a 2Kb gain on the other side)

I was always in favour of 8K process stacks + irq stacks. Works great on x86-64.

-Andi

#26 lore raw
Quoted 9 lines · Andi Kleen
Quoted 8 lines · Arjan van de Ven
Quoted 7 lines · Oliver Neukum

Am Mittwoch, 16. November 2005 15:42 schrieb jmerkey:

Quoted 5 lines

Map a blank ro page beneath the address range when stack memory is mapped is trap on page faults to the page when folks go off the end of th e stack.

Easy to find.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Provided you can easily trigger it. I don't see how that is a given.

the same is true for a unified 8k stack or for the 4k/4k split though. Ok sure there's a 1.5Kb difference on the one side.. (but a 2Kb gain on the other side)

I was always in favour of 8K process stacks + irq stacks. Works great on x86-64.

Jörn did some analysis regarding possible call paths > 3k.

Our goal is to achieve a stack usage < 3k with a safety margin of 1k.

The problem is similar no matter whether you have 4k or 8k stacks, but with 4k stacks you have the additional benefits of order 0 allocations and less memory usage.

Quoted 1 line

-Andi

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#27 lore raw
Quoted 3 lines · Adrian Bunk

The problem is similar no matter whether you have 4k or 8k stacks, but with 4k stacks you have the additional benefits of order 0 allocations and less memory usage.

We could implement a stack guard page for the transition period, so that any stack overflows would end up generating a fault. That's easy enough to do by using vmalloc().

-ben

#28 lore raw
Quoted 1 line · Benjamin LaHaise

We could implement a stack guard page for the transition period, so that

CONFIG_DEBUG_STACKOVERFLOW doesn't do that but it looks useful too.

Does CONFIG_DEBUG_STACKOVERFLOW harm performance a lot? (doesn't look like that for a newbie's eye)

#29 lore raw
Quoted 9 lines · On Wednesday 16 November 2005 21:46, Wed, 16 Nov 2005 21:46:05 +0100 wrote:
Quoted 1 line · Benjamin LaHaise

We could implement a stack guard page for the transition period, so that

CONFIG_DEBUG_STACKOVERFLOW doesn't do that but it looks useful too.

Does CONFIG_DEBUG_STACKOVERFLOW harm performance a lot? (doesn't look like that for a newbie's eye)

No, it's very cheap. In fact it could be probably enabled by default.

-Andi

P.S.: Can you please chose a less irritating realname?

#30 lore raw
In reply to Benjamin LaHaise
Quoted 8 lines · Benjamin LaHaise
Quoted 3 lines · Adrian Bunk

The problem is similar no matter whether you have 4k or 8k stacks, but with 4k stacks you have the additional benefits of order 0 allocations and less memory usage.

We could implement a stack guard page for the transition period, so that any stack overflows would end up generating a fault. That's easy enough to do by using vmalloc()

And would add considerable overhead in TLB flushes and locking ...

-Andi

#31 lore raw
In reply to Adrian Bunk
Quoted 2 lines · Adrian Bunk

Jörn did some analysis regarding possible call paths > 3k.

And most of them have been changed since. Zlib remains high on the list, but those paths are from /lib/inflate.c, during bootup.

What remains to be analysed is the recursions. If someone seriously wants to work on those, I can respin the tests. The process is not fully automated, so it will take me a weekend (and this weekend is scheduled for a party).

Jörn

Signature · 3 lines
The cheapest, fastest and most reliable components of a computer
system are those that aren't there.
-- Gordon Bell, DEC labratories
#32 lore raw
Quoted 10 lines · Jörn Engel
Quoted 3 lines · Adrian Bunk

Jörn did some analysis regarding possible call paths > 3k.

And most of them have been changed since. Zlib remains high on the list, but those paths are from /lib/inflate.c, during bootup.

Quoted 9 lines

What remains to be analysed is the recursions. If someone seriously wants to work on those, I can respin the tests. The process is not fully automated, so it will take me a weekend (and this weekend is scheduled for a party).

Jörn

The SCSI layer needs to be checked. I reproduced another crash on today on an older Niksun box running off the end of the stack.

Jeff

#33 lore raw
Quoted 17 lines · Jeffrey V. Merkey
Quoted 15 lines · Jörn Engel
Quoted 2 lines · Adrian Bunk

Jörn did some analysis regarding possible call paths > 3k.

And most of them have been changed since. Zlib remains high on the list, but those paths are from /lib/inflate.c, during bootup.

What remains to be analysed is the recursions. If someone seriously wants to work on those, I can respin the tests. The process is not fully automated, so it will take me a weekend (and this weekend is scheduled for a party).

Quoted 9 lines
Quoted 4 lines

Jörn

The SCSI layer needs to be checked. I reproduced another crash on today on an older Niksun box running off the end of the stack.

Jeff

It's somewhere in the scanning code. There's a case where it runs off the end of the stack. Check the compaq drivers for SATA as well, they also crash in a similiar place during bus scan. Both occurred during bootup, so I wasn't able to get a log of the particulars. Should be easy to reproduce. Compaq Presario 2200.

Jeff

#34 lore raw
Quoted 10 lines · Jeffrey V. Merkey
Quoted 4 lines · Jeffrey V. Merkey
Quoted 1 line

The SCSI layer needs to be checked. I reproduced another crash on today on an older Niksun box running off the end of the stack.

It's somewhere in the scanning code. There's a case where it runs off the end of the stack. Check the compaq drivers for SATA as well, they also crash in a similiar place during bus scan. Both occurred during bootup, so I wasn't able to get a log of the particulars. Should be easy to reproduce. Compaq Presario 2200.

Do you have a backtrace for these? Real-life problem tend to generate more attention than theoretical results based on code checkers.

Jörn

Signature · 4 lines
Linux is more the core point of a concept that surrounds "open source"
which, in turn, is based on a false concept. This concept is that
people actually want to look at source code.
-- Rob Enderle
#35 lore raw
Quoted 10 lines · Jörn Engel
Quoted 7 lines · Jeffrey V. Merkey
Quoted 4 lines · Jeffrey V. Merkey

The SCSI layer needs to be checked. I reproduced another crash on today on an older Niksun box running off the end of the stack.

Quoted 11 lines
Quoted 3 lines

It's somewhere in the scanning code. There's a case where it runs off the end of the stack. Check the compaq drivers for SATA as well, they also crash in a similiar place during bus scan. Both occurred during bootup, so I wasn't able to get a log of the particulars. Should be easy to reproduce. Compaq Presario 2200.

Do you have a backtrace for these? Real-life problem tend to generate more attention than theoretical results based on code checkers.

Jörn

I'll try to get one tonight ad post to the list.

Jeff

#36 lore raw
In reply to Jeffrey V. Merkey
Quoted 4 lines · Jeffrey V. Merkey
Quoted 4 lines

The SCSI layer needs to be checked. I reproduced another crash on today on an older Niksun box running off the end of the stack.

Quoted 8 lines
Quoted 3 lines

Jeff

It's somewhere in the scanning code. There's a case where it runs off the end of the stack. Check the compaq drivers for SATA as well, they also crash in a similiar place during bus scan. Both occurred during bootup, so I wasn't able to get a log of the particulars. Should be easy to reproduce. Compaq Presario 2200.

Are you using completely unmodified ftp.kernel.org kernels?

Which version?

If it occurs during bootup, you should see the error displayed. Please use a digital camera to photograph the error and send a linkt ot the photo.

Quoted 1 line

Jeff

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#37 lore raw
Quoted 10 lines · Adrian Bunk
Quoted 7 lines · Jeffrey V. Merkey
Quoted 7 lines

The SCSI layer needs to be checked. I reproduced another crash on today on an older Niksun box running off the end of the stack.

Jeff

Quoted 7 lines
Quoted 3 lines

It's somewhere in the scanning code. There's a case where it runs off the end of the stack. Check the compaq drivers for SATA as well, they also crash in a similiar place during bus scan. Both occurred during bootup, so I wasn't able to get a log of the particulars. Should be easy to reproduce. Compaq Presario 2200.

Are you using completely unmodified ftp.kernel.org kernels?.

Yes.

Quoted 4 lines

Which version?

2.6.14

Quoted 5 lines

If it occurs during bootup, you should see the error displayed. Please use a digital camera to photograph the error and send a linkt ot the photo.

The error is a stack trace rolling off the screen with a list of functions -- right before it reboots.

Jeff

Quoted 9 lines
Quoted 3 lines

Jeff

cu
Adrian

#38 lore raw
In reply to Alan Cox
Quoted 3 lines · Alan Cox

reasons. The ndis wrapper people have known it is coming for a long time, and if it has a lot of users I'm sure someone in that community will take the time to make patches.

I believe I mentioned it before. ndiswrapper itself has been 4k stacks ready for quite sometime. It is Windows drivers that need more than 4k stacks (although Windows uses 12k stacks, I don't know of any Windows driver requiring more than 8k stacks). One or two Windows drivers work with ndiswrapper and 4k stacks, Broadcom for example.

If this 4k stack patch makes into mainstream, I am wondering what options, other than maintaining a patch to back this patch, are available. The last time this issue came up some people suggested pushing ndiswrapper into user space. However, AFAIK this is non-trivial; I looked into FUSD
http://www.circlemud.org/~jelson/software/fusd/ which doesn't support network drivers and seems to be not active in the recent past.

Any suggestions on how ndiswrapper can live with this patch would be greatly appreciated.

Giri

#39 lore raw
Quoted 2 lines · Giridhar Pemmasani

Any suggestions on how ndiswrapper can live with this patch would be greatly appreciated.

Couldn't ndiswrapper have its own private stack to switch to when calling the windows driver, or are there still things hanging off the end of the stack area?

OG.

#40 lore raw
Quoted 3 lines · Olivier Galibert

Couldn't ndiswrapper have its own private stack to switch to when calling the windows driver, or are there still things hanging off the end of the stack area?

It's possible, but would need a change to how the kernel finds the thread local data (which is currently done by masking off the stack pointer). There are certainly a few ways of doing this, like using tr to find out which cpu we're on and then indexing into the thread info state.

-ben

Signature · 1 line
"Time is what keeps everything from happening all at once." -- John Wheeler
#41 lore raw
Quoted 4 lines · Benjamin LaHaise
Quoted 3 lines · Olivier Galibert

Couldn't ndiswrapper have its own private stack to switch to when calling the windows driver, or are there still things hanging off the end of the stack area?

This has been discussed sometime back. Search for "ndiswrapper" on lkml. See, e.g.,
http://marc.theaimsgroup.com/?l=linux-kernel&m=112602638406796&w=2

Quoted 4 lines

It's possible, but would need a change to how the kernel finds the thread local data (which is currently done by masking off the stack pointer). There are certainly a few ways of doing this, like using tr to find out which cpu we're on and then indexing into the thread info state.

If any such alternate ways are used instead of relying on stack pointer, we could have implemented private stacks for threads in ndiswrapper (and driverloader).

Giri

#42 lore raw
In reply to Giridhar Pemmasani
Quoted 9 lines · Giridhar Pemmasani

If this 4k stack patch makes into mainstream, I am wondering what options, other than maintaining a patch to back this patch, are available. The last time this issue came up some people suggested pushing ndiswrapper into user space. However, AFAIK this is non-trivial; I looked into FUSD
http://www.circlemud.org/~jelson/software/fusd/ which doesn't support network drivers and seems to be not active in the recent past.

Any suggestions on how ndiswrapper can live with this patch would be greatly appreciated.

Switch stack before calling the Windows bits. If we take an IRQ then the kernel will itself switch to its own IRQ stack for the IRQ handling. I don't think there is much more required.

#43 lore raw

On Mon, 14 Nov 2005 22:33:57 +0000, Alan Cox <[email protected]> said:

Alan> Switch stack before calling the Windows bits. If we take an IRQ then Alan> the kernel will itself switch to its own IRQ stack for the IRQ Alan> handling. I don't think there is much more required.

Shouldn't I have to prevent scheduler from changing the tasks when executing Windows code? Otherwise, kernel gets wrong current thread information, which is based on stack pointer. This is the stumbling block for implementing private stacks.

Thanks,
Giri

#44 lore raw
In reply to Giridhar Pemmasani
Quoted 9 lines · Giridhar Pemmasani
Quoted 3 lines · Alan Cox

reasons. The ndis wrapper people have known it is coming for a long time, and if it has a lot of users I'm sure someone in that community will take the time to make patches.

[...]
Any suggestions on how ndiswrapper can live with this patch would be greatly appreciated.

One idea that has not yet been suggested, is to use a x86 emulator to run the driver code.

I did some development a while ago, to reduce the size a x86 emulator to run VGA BIOS functions. If an emulator like this would make it to the kernel it could also be used to change video modes even using the VESA driver, suspend/resume the VGA using the VGA own code, etc.

The final size of the emulator was a little over 30k, but there was still room for even more reductions.

The advantages:

- the driver runs in a complete sandbox

- support for running NDIS drivers in multiple architectures (not just
x86)

- the emulator could be shared amongst more kernel subsystems in need
of an emulator (VESA, for instance)

Disadvantages:

- increase in kernel code size (about 30k)

- decrease in driver code execution speed

I'm not really advocating for this, just wanted to make sure people would be aware of all the solutions available before committing to any approach.

Signature · 5 lines
Paulo Marques - www.grupopie.com

The rule is perfect: in all matters of opinion our
adversaries are insane.
Mark Twain
author
#45 lore raw
In reply to Alan Cox

That doesn't answer my question. I want to know what __problems__ are caused by allowing the __choice__ of stack sizes.

-Alex

Quoted 7 lines · --- Alan Cox

If we spent our entire lives waiting for people to fix code nothing would ever happen. Removing 8K stacks is a good thing to do for many reasons. The ndis wrapper people have known it is coming for a long time, and if it has a lot of users I'm sure someone in that community will take the time to make patches.

I code, therefore I am

__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com