2002-11-17 15:48:30

by Ricardo Galli

[permalink] [raw]
Subject: PATCH: Recognize Tualatin cache size in 2.4.x

Marcelo,
please attach this patch to recognise the Tualatin processors'
cache.

I think this has been already discussed in the list, and DaveJ
also applied it in his tree and/or 2.5.x. It is documented by
Intel.

Regards

--
ricardo galli GPG id C8114D34

--- /usr/src/linux-2.4.20-rc1/arch/i386/kernel/setup.c 2002-11-05 2002-11-17 16:46:32.000000000 +0100
+++ /usr/src/linux-2.4.20-rc1a/arch/i386/kernel/setup.c 2002-11-05 00:52:25.000000000 +0100
@@ -2215,6 +2215,7 @@
{ 0x7B, LVL_2, 512 },
{ 0x7C, LVL_2, 1024 },
{ 0x82, LVL_2, 256 },
+ { 0x83, LVL_2, 512 },
{ 0x84, LVL_2, 1024 },
{ 0x85, LVL_2, 2048 },
{ 0x00, 0, 0}



2002-11-18 18:58:30

by Dave Jones

[permalink] [raw]
Subject: Re: PATCH: Recognize Tualatin cache size in 2.4.x

On Sun, Nov 17, 2002 at 04:55:22PM +0100, Ricardo Galli wrote:
> Marcelo,
> please attach this patch to recognise the Tualatin processors'
> cache.
>
> I think this has been already discussed in the list, and DaveJ
> also applied it in his tree and/or 2.5.x. It is documented by
> Intel.

I sent Marcelo a patch containing this and other IDs.
He wants to take it for .21pre1

It's purely cosmetic, so that's fine with me..

Dave

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-11-18 20:48:02

by Ricardo Galli

[permalink] [raw]
Subject: Re: PATCH: Recognize Tualatin cache size in 2.4.x

On Monday 18 November 2002 20:02, Dave Jones shaped the electrons to shout:
> On Sun, Nov 17, 2002 at 04:55:22PM +0100, Ricardo Galli wrote:
> > Marcelo,
> > please attach this patch to recognise the Tualatin processors'
> > cache.
> >
> > I think this has been already discussed in the list, and DaveJ
> > also applied it in his tree and/or 2.5.x. It is documented by
> > Intel.
>
> I sent Marcelo a patch containing this and other IDs.
> He wants to take it for .21pre1
>
> It's purely cosmetic, so that's fine with me..

It's very cosmetic but very annoying for P3 > 1GHz, where Linux <= 2.4.20-preX
only reports 32 KB of cache and it also seems to ignore the "cachesize"
parameter. Perhaps it really uses 256KB, but not sure.

I tested it in a Compaq Proliant 330ML-G2 (P3 1.4) and a kernel compilation is
100% faster if the patch is applied.

Regards,

PS: Dave, see you in Mallorca in 20 days :-)

--
ricardo galli GPG id C8114D34

2002-11-19 12:03:52

by Dave Jones

[permalink] [raw]
Subject: Re: PATCH: Recognize Tualatin cache size in 2.4.x

On Mon, Nov 18, 2002 at 09:54:52PM +0100, Ricardo Galli wrote:

> It's very cosmetic but very annoying for P3 > 1GHz, where Linux <= 2.4.20-preX
> only reports 32 KB of cache and it also seems to ignore the "cachesize"
> parameter. Perhaps it really uses 256KB, but not sure.

There was a bug related to that parameter, I'm sure if the fix
went into the same patch, or a separate one. I'll check later.

> I tested it in a Compaq Proliant 330ML-G2 (P3 1.4) and a kernel compilation is
> 100% faster if the patch is applied.

<raises eyebrows>. The SMP weighting used by various parts of the kernel
will be slightly off, but I'd be amazed if it made *that much*
difference.

> PS: Dave, see you in Mallorca in 20 days :-)

Indeed 8-)

Dave

--
| Dave Jones. http://www.codemonkey.org.uk

2002-11-20 14:17:51

by Mathias Kretschmer

[permalink] [raw]
Subject: Re: PATCH: Recognize Tualatin cache size in 2.4.x

Dave Jones wrote:
> On Tue, Nov 19, 2002 at 08:41:26PM -0500, Mathias Kretschmer wrote:
> > I just patched my 2.4.20rc2 kernel. Now, it reports
> > 512K cache for my 2 Tualatin 1.26 GHz CPUs.
> >
> > 'time make -j4 bzImage' went down from 3:30 to 3:04.
> > Not too bad.
>
> That is quite an impressive gain. The patch I sent Marcelo which
> also fixes up a problem with some tualatins and adds P4 trace cache
> support is at..
>
> ftp.kernel.org/pub/linux/kernel/people/davej/patches/2.4/2.4.20/descriptors.diff
>
> As you have tualatins can you try with the above patch and make sure
> theres no regressions there ?

Hi Dave,

Here are the results. I've upgraded to gcc-3.2.1 yesterday evening.
Hence, we can not compare to the results from yesterday.
The ones below are new:

2.4.20rc2+small-patch (ran it three times with very similar results):
265.05user 16.66system 2:43.09elapsed 172%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (621129major+1391627minor)pagefaults 0swaps

2.4.20rc2-descriptors.diff (also run three times):
302.60user 16.95system 2:43.39elapsed 195%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (621129major+1390848minor)pagefaults 0swaps

Pretty much the same result - within the tolerance.
%CPU is up quite a bit.

Also, my optimization options are '-Os -march=pentium3'.

The machine was idle but still in multi-user mode. If
you need more precise results, I could do that over the weekend.

Cheers,

Mathias

---

> cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 11
model name : Intel(R) Pentium(R) III CPU family 1266MHz
stepping : 1
cpu MHz : 1280.932
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 mmx fxsr sse
bogomips : 2555.90

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 11
model name : Intel(R) Pentium(R) III CPU family 1266MHz
stepping : 1
cpu MHz : 1280.932
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 mmx fxsr sse
bogomips : 2555.90

2002-11-20 19:57:21

by Stephan von Krawczynski

[permalink] [raw]
Subject: Re: PATCH: Recognize Tualatin cache size in 2.4.x

On Tue, 19 Nov 2002 12:08:34 +0000
Dave Jones <[email protected]> wrote:

> On Mon, Nov 18, 2002 at 09:54:52PM +0100, Ricardo Galli wrote:
>
> > It's very cosmetic but very annoying for P3 > 1GHz, where Linux <= 2.4.20-preX
> > only reports 32 KB of cache and it also seems to ignore the "cachesize"
> > parameter. Perhaps it really uses 256KB, but not sure.
>
> There was a bug related to that parameter, I'm sure if the fix
> went into the same patch, or a separate one. I'll check later.

Sorry for this possibly dumb comment/question:
my Tualatins have 512KB cache on die. Are we all sure that it's used?
/proc says indeed 32KB on 2.4.20-rc2

Regards,
Stephan

2002-11-20 20:15:35

by Erich Boleyn

[permalink] [raw]
Subject: Re: PATCH: Recognize Tualatin cache size in 2.4.x


Stephan von Krawczynski <[email protected]> wrote:

> On Tue, 19 Nov 2002 12:08:34 +0000
> Dave Jones <[email protected]> wrote:
>
> > On Mon, Nov 18, 2002 at 09:54:52PM +0100, Ricardo Galli wrote:
> >
> > > It's very cosmetic but very annoying for P3 > 1GHz, where Linux <= 2.4.20-
> preX
> > > only reports 32 KB of cache and it also seems to ignore the "cachesize"
> > > parameter. Perhaps it really uses 256KB, but not sure.
> >
> > There was a bug related to that parameter, I'm sure if the fix
> > went into the same patch, or a separate one. I'll check later.
>
> Sorry for this possibly dumb comment/question:
> my Tualatins have 512KB cache on die. Are we all sure that it's used?
> /proc says indeed 32KB on 2.4.20-rc2

On x86 systems in general the full cache sizes are always used. It's
enabled in the hardware/BIOS, so there should be no problem there.

The only thing it might do is change any optimizations the Linux kernel
is trying to make to optimize for the cache size. The only one I'm
aware of at the moment is the weighting algorithm when running in SMP
(i.e. how hard to fix a process to a particular processor in order to
take best advantage of the cache footprint).

--
Erich Stefan Boleyn <[email protected]> http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"

2002-11-20 21:36:40

by Dave Jones

[permalink] [raw]
Subject: Re: PATCH: Recognize Tualatin cache size in 2.4.x

On Wed, Nov 20, 2002 at 09:03:57PM +0100, Stephan von Krawczynski wrote:
> On Tue, 19 Nov 2002 12:08:34 +0000
> Dave Jones <[email protected]> wrote:
>
> > On Mon, Nov 18, 2002 at 09:54:52PM +0100, Ricardo Galli wrote:
> >
> > > It's very cosmetic but very annoying for P3 > 1GHz, where Linux <= 2.4.20-preX
> > > only reports 32 KB of cache and it also seems to ignore the "cachesize"
> > > parameter. Perhaps it really uses 256KB, but not sure.
> >
> > There was a bug related to that parameter, I'm sure if the fix
> > went into the same patch, or a separate one. I'll check later.
>
> Sorry for this possibly dumb comment/question:
> my Tualatins have 512KB cache on die. Are we all sure that it's used?
> /proc says indeed 32KB on 2.4.20-rc2

Odd. If you can send me the output of dmesg, /proc/cpuinfo
and x86info -a, I'll take a look.
(You can find x86info at
http://www.codemonkey.org.uk/x86info/x86info-1.11.tar.gz)

Dave

--
| Dave Jones. http://www.codemonkey.org.uk

2002-11-20 21:46:45

by Stephan von Krawczynski

[permalink] [raw]
Subject: Re: PATCH: Recognize Tualatin cache size in 2.4.x

On Wed, 20 Nov 2002 21:41:04 +0000
Dave Jones <[email protected]> wrote:

> On Wed, Nov 20, 2002 at 09:03:57PM +0100, Stephan von Krawczynski wrote:
> > On Tue, 19 Nov 2002 12:08:34 +0000
> > Dave Jones <[email protected]> wrote:
> >
> > > On Mon, Nov 18, 2002 at 09:54:52PM +0100, Ricardo Galli wrote:
> > >
> > > > It's very cosmetic but very annoying for P3 > 1GHz, where Linux <= 2.4.20-preX
> > > > only reports 32 KB of cache and it also seems to ignore the "cachesize"
> > > > parameter. Perhaps it really uses 256KB, but not sure.
> > >
> > > There was a bug related to that parameter, I'm sure if the fix
> > > went into the same patch, or a separate one. I'll check later.
> >
> > Sorry for this possibly dumb comment/question:
> > my Tualatins have 512KB cache on die. Are we all sure that it's used?
> > /proc says indeed 32KB on 2.4.20-rc2
>
> Odd. If you can send me the output of dmesg, /proc/cpuinfo
> and x86info -a, I'll take a look.
> (You can find x86info at
> http://www.codemonkey.org.uk/x86info/x86info-1.11.tar.gz)

Hi Dave,

I just tested your descriptors.diff, and here are the results:
(make dep clean bzImage modules modules_install, all same tree of course)

2.4.20-rc2:
real 5m27.670s user 5m6.450s sys 0m18.710s
real 5m27.590s user 5m6.760s sys 0m18.660s
real 5m27.953s user 5m6.900s sys 0m18.310s

2.4.20-rc2 with descriptors.diff:

real 5m29.005s user 5m8.540s sys 0m18.610s
real 5m27.752s user 5m8.760s sys 0m17.870s
real 5m29.021s user 5m8.210s sys 0m18.540s

Doesn't really look more than cosmetic, does it?
/proc output is correct with your diff.

Regards,
Stephan