Skip to contentSkip to conversation

fix CONFIG_X86_L1_CACHE_SHIFT

PATCH Andi Kleen 3 participants 4 messages Sep 7, 2003 – Sep 8, 2003 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andi Kleen

author
#1 lore raw
Quoted 2 lines · Adrian Bunk

With CONFIG_M686 CONFIG_X86_L1_CACHE_SHIFT was set to 5, but a Pentium 4 requires 7.

It doesn't require 7, it just prefers 7.

Quoted 4 lines

The patch below does:
- set CONFIG_X86_L1_CACHE_SHIFT 7 for all Intel processors (needed for the Pentium 4)
- set CONFIG_X86_L1_CACHE_SHIFT 6 for the K6 (needed for the Athlon)

I think these changes should be only done with CONFIG_X86_GENERIC is set.

Otherwise the people who want kernels really optimized for their CPUs won't get the full benefit. On UP it does not make that much difference, but on a SMP kernel having a bigger than needed cache size wastes a lot of memory.

-Andi

#2 lore raw
Quoted 5 lines · Andi Kleen
Quoted 2 lines · Adrian Bunk

With CONFIG_M686 CONFIG_X86_L1_CACHE_SHIFT was set to 5, but a Pentium 4 requires 7.

It doesn't require 7, it just prefers 7.

*nod*. This 'fix' also papers over the bug instead of fixing it. Likely it's something like a network card driver setting its cacheline size incorrectly. Peter what NIC did you see the problem on ?

I thought Ivan's PCI cacheline sizing fixes from 2.6 (see arch/i386/pci/common.c) already made it into 2.4, but from a quick grep, it seems that didn't happen.

Quoted 9 lines
Quoted 4 lines

The patch below does:
- set CONFIG_X86_L1_CACHE_SHIFT 7 for all Intel processors (needed for the Pentium 4)
- set CONFIG_X86_L1_CACHE_SHIFT 6 for the K6 (needed for the Athlon)

I think these changes should be only done with CONFIG_X86_GENERIC is set. Otherwise the people who want kernels really optimized for their CPUs won't get the full benefit. On UP it does not make that much difference, but on a SMP kernel having a bigger than needed cache size wastes a lot of memory.

ACK.

Dave

Signature · 1 line
 Dave Jones     http://www.codemonkey.org.uk
#3 lore raw

Hi,

Quoted 3 lines · Dave Jones

*nod*. This 'fix' also papers over the bug instead of fixing it. Likely it's something like a network card driver setting its cacheline size incorrectly. Peter what NIC did you see the problem on ?

All the machines have Forerunner LE ATM NICs and use LAN Emulation. I made an attempt to check whether the problems also occur with ethernet, but for some reason the ethernet card also didn't seem to work with 2.4.22. Maybe I should give this another try ...

As mentioned, Adrian's patch for "CONFIG_X86_L1_CACHE_SHIFT" seems to fix my current networking problems, but maybe the real cause is something else.

Since somebody here mentioned "memory corruption": Already for years I have been plagued by a bug somewhere in the ATM/LANE code that causes the machines to crash from time to time (see
http://sourceforge.net/tracker/index.php?func=detail&aid=445059&group_id=7812&atid=107812)

I could not discover any pattern, when and under which circumstances these crashes happen (usually, they occur with several months in between) Several times, I managed to get at least a stack trace, but the actual crashes occured at different places in the code (which, I guess, could mean that the real problem is somebody overwriting somebody elses memory). Could there be any connection?

If somebody has any good idea how to find out, what is going on, I'll be glad to investigate this further. At least, with my current networking problems (see the thread "2.4.22 with
CONFIG_M686: networking broken") I have a test case ...

Regards,
Peter Daum

A message that is not in the archive (sent off-list or not yet received): Pine.LNX.4.30.0309072228110.9987-100000@swamp.bayern.net.suse.lists.linux.kernel

author
#5 lore raw
Quoted 10 lines · [email protected] (Peter Daum) writes:

... actually, the problems also occurred when running on machines with Pentium II/Pentium Pro CPUs - even on these machines, I only could use kernels compiled with "CONFIG_MPENTIUM4".

Adrian's patch does fix these problems. What is amazing, is that in kernel version 2.4.20, the same values were used for "CONFIG_X86_L1_CACHE_SHIFT". The problems that I described, however, occur only with 2.4.22 - the same machines with the same configuration work just fine with 2.4.20. Maybe, there's something else involved, too?

Yes it very much sounds like some memory corruption that is just masked by the bigger cacheline padding.

Maybe you should try to compile with CONFIG_DEBUG_SLAB on and see if it triggers something?

The padding itself is a pure optimization, if it changes any behaviour that's a bug.

-Andi