Skip to contentSkip to conversation

zeroing pages in the idle task?

DISCUSSION Michel Lanners 14 participants 27 messages Sep 12, 2000 – Sep 27, 2000

lore
Share & tools
lore
#0 lore raw

Hi all,

I've come across a 'forgotten' feature of the PPC kernels: namely zeroing pages 'in advance' in the idle task.

It's a feature Cort implemented some time ago, but which is disabled by default. I've tried to enable it:

[root@piglet ~]# echo 1 > /proc/sys/kernel/zero-paged

and it seems to work OK:

(this is after system boot, no apps started yet except 3 xterms)

[mlan@piglet ~]$ cat /proc/cpuinfo
processor : 0
cpu : 750
temperature : 0 C
clock : 195MHz

                  ^^^^^^

(by the way, this is wrong. Anybody with a fix?)

revision : 2.2
bogomips : 575.08
zero pages : total 264 (1056Kb) current: 96 (384Kb) hits: 168/255 (65%)
machine : Power Macintosh
motherboard : AAPL,7500 MacRISC
memory : 112MB
pmac-generation : OldWorld

So, a few questions:

- is there any problem with using this feature?

- if not, would it be a good idea to enable it by default?

- or, would it be better to add it to rc.sysinit, leaving it to each distribution whether to enable it or not?

I've not benchmarked anything (how would one do that?); but it seems to me it's a no-cost optimisation. Even if there's little advantage, since it's for free...

Comments?

Michel

-------------------------------------------------------------------------

Michel Lanners                 |  " Read Philosophy.  Study Art.
23, Rue Paul Henkes            |    Ask Questions.  Make Mistakes.
L-1710 Luxembourg              |
email   [email protected]            |
http://www.cpu.lu/~mlan        |                     Learn Always. "

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 3 lines · Michel Lanners

clock : 195MHz

                  ^^^^^^

(by the way, this is wrong. Anybody with a fix?)

I'm pretty sure that this is the number that OF is telling us, so if it's wrong, blame OF. You don't have a G3 upgrade card in an older machine perhaps?

Since the only use of this number is for oohs and aahs, there's not a lot of motivation to try and work out if OF is wrong and work out the correct number.

Paul.

--
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc. +61 2 6262 8990 tel, +61 2 6262 8991 fax [email protected], http://www.linuxcare.com.au/
Linuxcare. Support for the revolution.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw

Hi Paul,

On 13 Sep, this message from Paul Mackerras echoed through cyberspace:

Quoted 9 lines
Quoted 3 lines · Michel Lanners

clock : 195MHz

                  ^^^^^^

(by the way, this is wrong. Anybody with a fix?)

I'm pretty sure that this is the number that OF is telling us, so if it's wrong, blame OF. You don't have a G3 upgrade card in an older machine perhaps?

Yes, right. And I've seen OF report this before, and indeed, this info comes out of OF.

Quoted 3 lines

Since the only use of this number is for oohs and aahs, there's not a lot of motivation to try and work out if OF is wrong and work out the correct number.

Somebody might want to unify and come up with a routine that can calculate clock frequency across all PPC machines. I don't know if something like this can be done with only the processor, and no motherboard hardware support...

Michel

-------------------------------------------------------------------------

Michel Lanners                 |  " Read Philosophy.  Study Art.
23, Rue Paul Henkes            |    Ask Questions.  Make Mistakes.
L-1710 Luxembourg              |
email   [email protected]            |
http://www.cpu.lu/~mlan        |                     Learn Always. "

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
In reply to Paul Mackerras

Hi,

Quoted 6 lines · Paul Mackerras
Quoted 3 lines · Michel Lanners

clock : 195MHz

                  ^^^^^^

(by the way, this is wrong. Anybody with a fix?)

Quoted 7 lines

I'm pretty sure that this is the number that OF is telling us, so if it's wrong, blame OF. You don't have a G3 upgrade card in an older machine perhaps?

Since the only use of this number is for oohs and aahs, there's not a lot of motivation to try and work out if OF is wrong and work out the correct number.

Could you possibly tell me how one might implement this? That is: how one would measure/calculate this. On NuBus, there is no OF, so I'd like to implement.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
In reply to Michel Lanners
Quoted 7 lines
Quoted 4 lines

I'm pretty sure that this is the number that OF is telling us, so if it's wrong, blame OF. You don't have a G3 upgrade card in an older machine perhaps?

Yes, right. And I've seen OF report this before, and indeed, this info comes out of OF.

I remember seeing various "fixes" done by the Apple code in Darwin to correct the bogus values returned by OF on some machines.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
In reply to Takashi Oe
Quoted 7 lines · Takashi Oe
Quoted 3 lines

Since the only use of this number is for oohs and aahs, there's not a lot of motivation to try and work out if OF is wrong and work out the correct number.

Could you possibly tell me how one might implement this? That is: how one would measure/calculate this. On NuBus, there is no OF, so I'd like to implement.

Ask the guys at Newer Tech for their Clockometer sources. I don't know if they'd be willing to open-source them, but it's worth a shot. As I understand it, their program does just what you're looking for.

Later,
David

---------------------------------------------------------------------
A brief Haiku:

Microsoft is bad.
It seems secure at first glance.
Then you read your mail.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
Quoted 5 lines · David A. Gatwood
Quoted 4 lines · Takashi Oe
Quoted 3 lines

Since the only use of this number is for oohs and aahs, there's not a lot of motivation to try and work out if OF is wrong and work out the correct number.

Quoted 7 lines
Quoted 3 lines

Could you possibly tell me how one might implement this? That is: how one would measure/calculate this. On NuBus, there is no OF, so I'd like to implement.

Ask the guys at Newer Tech for their Clockometer sources. I don't know if they'd be willing to open-source them, but it's worth a shot. As I understand it, their program does just what you're looking for.

On the m68k, we have some code to guestimate the CPU clock based on the BogoMIPS (see get_cpuinfo() in arch/m68k/kernel/setup.c). Since we didn't care about the overhead incurred by interrupt processing, it's not that accurate though (I get 24.8 MHz on my 25 MHz 68040).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#18 lore raw
In reply to Michel Lanners

All, and especially Paul/Cort,

To come back to my original question...

On 12 Sep, this message from mlan echoed through cyberspace:

Quoted 5 lines

I've come across a 'forgotten' feature of the PPC kernels: namely zeroing pages 'in advance' in the idle task.

It's a feature Cort implemented some time ago, but which is disabled by default.

[snip]

Quoted 3 lines

So, a few questions:

- is there any problem with using this feature?

I didn't have any, but that's only my box then....

Quoted 1 line

- if not, would it be a good idea to enable it by default?

What do you think, Paul, Cort?

Quoted 2 lines

- or, would it be better to add it to rc.sysinit, leaving it to each distribution whether to enable it or not?

Maybe enabling it by default would be a good choice? It can always be disabled...

I'll post a patch on sourceforge.

Michel

-------------------------------------------------------------------------

Michel Lanners                 |  " Read Philosophy.  Study Art.
23, Rue Paul Henkes            |    Ask Questions.  Make Mistakes.
L-1710 Luxembourg              |
email   [email protected]            |
http://www.cpu.lu/~mlan        |                     Learn Always. "

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#19 lore raw

I missed a lot of this thread, this is the first message I picked up on.

} To come back to my original question...

It's a dead loss on SMP, but it can be just run on UP machines. The main problem was I didn't have enough time to finish it and didn't want to leave something running in the idle task that I hadn't finished studying the effect of.

I really wanted to push it up to the freelist since I don't think it's a PPC-only optimization. I never bothered trying to push it since at that point the tree was moving to the stable point and wasn't going to be changing that radically soon.

} > - is there any problem with using this feature? }
} I didn't have any, but that's only my box then....

Not without a lot of study and testing. I haven't touched the code in a long time...

} What do you think, Paul, Cort?

It's not a matter of turning it on - it's a matter of making it work again and testing it.

} Maybe enabling it by default would be a good choice? It can always be } disabled...
}
} I'll post a patch on sourceforge.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#20 lore raw
In reply to Michel Lanners
Quoted 3 lines · Michel Lanners
Quoted 1 line

- if not, would it be a good idea to enable it by default?

What do you think, Paul, Cort?

As I recall, it was necessary to disable the cache in the idle task so that the idle task's clearing of pages didn't trash the cache for other tasks. This introduces its own set of complexities, for example you have to make sure the cache is reenabled on all exception entries and also before you call schedule in the idle task. You also have to make sure that you don't get any inconsistencies in the cache, which means you would have to flush the cache for the page before starting to clear it with the cache disabled.

It would be cleaner to have the page mapped with a non-cacheable mapping while the idle task is clearing it but you still have to be careful about cache inconsistencies, particularly if the page is mapped twice and one mapping is cacheable and the other isn't.

I'm not sure that the current code still addresses all those issues correctly and completely. Unused things tend to be subject to bitrot. :-)

Paul.

--
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc. +61 2 6262 8990 tel, +61 2 6262 8991 fax [email protected], http://www.linuxcare.com.au/
Linuxcare. Support for the revolution.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw

ld bug?

In reply to Geert Uytterhoeven

Hi,

Well, I've just had a kernel hang at "Freeing unused kernel memory:..." with linux-2.4.0-test8 + numerous patches, and I've traced the hang to what apears (to me) to be a ld bug.

The kernel hangs at the call to spin_unlock_irq() in schedule() of kernel/sched.c. For me (UP kernel), spin_unlock_irq() is defined to be

struct int_control_struct

{
	void (*int_cli)(void);
	void (*int_sti)(void);
	void (*int_restore_flags)(unsigned long);
	void (*int_save_flags)(unsigned long *);
	void (*int_set_lost)(unsigned long);
};

extern struct int_control_struct int_control;

extern void __no_use_sti(void);

#define __sti() int_control.int_sti()
#define local_irq_enable() __sti()
#define spin_unlock(lock) do { } while (0)

#define spin_unlock_irq(lock)	\
	do { spin_unlock(lock);  local_irq_enable();       } while (0)
Quoted 1 line

From objdump output of kernel/sched.o:

     458:       3d 20 00 00     lis     r9,0
                        45a: R_PPC_ADDR16_HA    int_control+0x4
     45c:       80 09 00 04     lwz     r0,4(r9)
                        45e: R_PPC_ADDR16_LO    int_control+0x4
     460:       7c 08 03 a6     mtlr    r0
     464:       4e 80 00 21     blrl

So, if I'm reading this correctly, the compiler is generating correct assembly. Now, objdump output of vmlinux (kernel) for the same segment says:

c02164c4:       3d 20 c0 3a     lis     r9,-16326
c02164c8:       80 09 c3 e4     lwz     r0,-15388(r9)
c02164cc:       7c 08 03 a6     mtlr    r0
c02164d0:       4e 80 00 21     blrl

However, from "nm vmlinux | grep int_control", "int_control" is at

c039c3e0 D int_control

as opposed to c03ac3e0 used in vmlinux. So, it appears that ld or something is acting up. I've tried various version of binutils from 2.9.1.0.990418 to 2.10.0.18, but all have produced the same output. Except for 2.9.1.0.990414, all 2.10.x versions that I tried are from ftp://devel.linuxppc.org/users/fsirl/R5/RPMS/.

gcc is 2.95.3-2c (also from fsirl directory).

If I change some totally (and seemingly) unrelated files a bit, vmlinux produced may be correct. I tried to look at if any section's size matters, but I don't see any pattern unfortunately.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#11 lore raw
In reply to Geert Uytterhoeven
Quoted 4 lines · Geert Uytterhoeven

On the m68k, we have some code to guestimate the CPU clock based on the BogoMIPS (see get_cpuinfo() in arch/m68k/kernel/setup.c). Since we didn't care about the overhead incurred by interrupt processing, it's not that accurate though (I get 24.8 MHz on my 25 MHz 68040).

That thought had occured to me. Only problem is that the relationship between bogomips and cpu clock speed depends on, well, CPU. For 601, it's one to one, and, for 604, two to one, and so on. I don't know the ratios for 603, G3, or G4.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#8 lore raw

Re: ld bug?

In reply to Takashi Oe

From: Takashi Oe <[email protected]>
To: [email protected]
Subject: ld bug?
Date: Thu, 14 Sep 2000 21:28:46 -0500 (CDT)

Quoted 9 lines

Hi,

as opposed to c03ac3e0 used in vmlinux. So, it appears that ld or something is acting up. I've tried various version of binutils from 2.9.1.0.990418 to 2.10.0.18, but all have produced the same output. Except for 2.9.1.0.990414, all 2.10.x versions that I tried are from ftp://devel.linuxppc.org/users/fsirl/R5/RPMS/.

Quoted 6 lines

gcc is 2.95.3-2c (also from fsirl directory).

If I change some totally (and seemingly) unrelated files a bit, vmlinux produced may be correct. I tried to look at if any section's size matters, but I don't see any pattern unfortunately.

Lastest binutls is 2.10.0.24.

It's there.

ftp://ftp.valinux.com/pub/support/hjl/binutils/

Kaoru

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#9 lore raw

Re: ld bug?

In reply to Takashi Oe
Quoted 3 lines · Takashi Oe

Well, I've just had a kernel hang at "Freeing unused kernel memory:..." with linux-2.4.0-test8 + numerous patches, and I've traced the hang to what apears (to me) to be a ld bug.

Don't think so, see below...

Quoted 2 lines

The kernel hangs at the call to spin_unlock_irq() in schedule() of kernel/sched.c. For me (UP kernel), spin_unlock_irq() is defined to be

That sounds to me like an unhandled interrupt, endlessly repeated.

Quoted 4 lines

So, if I'm reading this correctly, the compiler is generating correct assembly. Now, objdump output of vmlinux (kernel) for the same segment says:

Quoted 8 lines
c02164c4:       3d 20 c0 3a     lis     r9,-16326
c02164c8:       80 09 c3 e4     lwz     r0,-15388(r9)
c02164cc:       7c 08 03 a6     mtlr    r0
c02164d0:       4e 80 00 21     blrl

However, from "nm vmlinux | grep int_control", "int_control" is at

c039c3e0 D int_control

No, it's right, the thing is that the -15388 in the lwz instruction is sign-extended. So the address it uses is 0xc03a0000 - 15388 (or put another way, 0xc03a0000 + 0xffffc3e4) which is in 0xc039c3e0.

Paul.

--
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc. +61 2 6262 8990 tel, +61 2 6262 8991 fax [email protected], http://www.linuxcare.com.au/
Linuxcare. Support for the revolution.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#10 lore raw

Re: ld bug?

Hi,

Quoted 6 lines · Paul Mackerras
Quoted 3 lines · Takashi Oe

Well, I've just had a kernel hang at "Freeing unused kernel memory:..." with linux-2.4.0-test8 + numerous patches, and I've traced the hang to what apears (to me) to be a ld bug.

Quoted 6 lines

Don't think so, see below...

Quoted 2 lines

The kernel hangs at the call to spin_unlock_irq() in schedule() of kernel/sched.c. For me (UP kernel), spin_unlock_irq() is defined to be

That sounds to me like an unhandled interrupt, endlessly repeated.

To be more precise on the "hang", the cursor is blinking normally as if something will happen shortly (but won't), and I can invoke xmon via NMI just fine. When I invoked xmon, LR is at right after spin_unlock_irq() and PC is at "blr" of __no_use_sti(), so obviously my previous interpretation was way wrong. Sorry.

[...]

Quoted 7 lines
Quoted 3 lines

However, from "nm vmlinux | grep int_control", "int_control" is at

c039c3e0 D int_control

No, it's right, the thing is that the -15388 in the lwz instruction is sign-extended. So the address it uses is 0xc03a0000 - 15388 (or put another way, 0xc03a0000 + 0xffffc3e4) which is in 0xc039c3e0.

Thanks! That makes a lot of sense. I'm really glad I don't have to compile binutils myself.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#12 lore raw
In reply to Takashi Oe
Quoted 8 lines · Takashi Oe
Quoted 5 lines · Geert Uytterhoeven

On the m68k, we have some code to guestimate the CPU clock based on the BogoMIPS (see get_cpuinfo() in arch/m68k/kernel/setup.c). Since we
didn't care
about the overhead incurred by interrupt processing, it's not that accurate though (I get 24.8 MHz on my 25 MHz 68040).

Quoted 4 lines

That thought had occured to me. Only problem is that the relationship between bogomips and cpu clock speed depends on, well, CPU. For 601, it's one to one, and, for 604, two to one, and so on. I don't know the ratios for 603, G3, or G4.

It gets more fun than that. I've found that the G3's ratio varies depending on how many of its features are turned on. It's usually 2:1, but if the BTIC and BHT (Branch Target Instruction Cache, Branch History Table) are turned off, it drops way down (1:1 I think, but I may be misremembering).

Why would they be off, you ask? Because Apple's OF doesn't always turn them on. I found out when I upgraded a B&W G3 from its original CPU to a 450 MHz G3; all of a sudden my BogoMIPS were actually lower than they were before the upgrade. The real world performance difference I've measured from BTIC & BHT being on/off is more like 5-10%, but it was rather startling to see BogoMIPS go down when the clock speed went up.

The point may be moot, because I think recent kernel versions always turn on BTIC and BHT during initialization.

Tim Seufert

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#16 lore raw
In reply to Takashi Oe
Quoted 10 lines · Takashi Oe
Quoted 4 lines · Geert Uytterhoeven

On the m68k, we have some code to guestimate the CPU clock based on the BogoMIPS (see get_cpuinfo() in arch/m68k/kernel/setup.c). Since we didn't care about the overhead incurred by interrupt processing, it's not that accurate though (I get 24.8 MHz on my 25 MHz 68040).

That thought had occured to me. Only problem is that the relationship between bogomips and cpu clock speed depends on, well, CPU. For 601, it's one to one, and, for 604, two to one, and so on. I don't know the ratios for 603, G3, or G4.

It's the same on m68k. Originally I had the ratios for 68040 only (and for 68000, which didn't matter at that time), but very soon I found them out for other CPUs. All you need is a few testers :-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#13 lore raw
In reply to Timothy A. Seufert
Quoted 15 lines · Timothy A. Seufert
Quoted 11 lines · Takashi Oe
Quoted 4 lines · Geert Uytterhoeven

On the m68k, we have some code to guestimate the CPU clock based on the BogoMIPS (see get_cpuinfo() in arch/m68k/kernel/setup.c). Since we didn't care about the overhead incurred by interrupt processing, it's not that accurate though (I get 24.8 MHz on my 25 MHz 68040).

That thought had occured to me. Only problem is that the relationship between bogomips and cpu clock speed depends on, well, CPU. For 601, it's one to one, and, for 604, two to one, and so on. I don't know the ratios for 603, G3, or G4.

Quoted 6 lines

It gets more fun than that. I've found that the G3's ratio varies depending on how many of its features are turned on. It's usually 2:1, but if the BTIC and BHT (Branch Target Instruction Cache, Branch History Table) are turned off, it drops way down (1:1 I think, but I may be misremembering).

Would a rewrite of the bogomips loop be an option?

In that case one could chose a sequence of dependant instructions in the loop body, preventing possible superscalar execution. (One could specifically use instructions that are commonly 'execution serializing', like 'adde', to again enforce execution of only a single instruction per clock.)

If the loop body was long enough, effects of varying branching efficiency could also be masked. That way, bogomips should correlate very well with actual MHz.

Holger

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#14 lore raw
Quoted 2 lines

Would a rewrite of the bogomips loop be an option?

Not really. The bogomips loop is meant to calibrate short delay loops used elsewhere in the kernel.

You can always add another calibration loop for the MHz if you absolutely need to.

Michael

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#15 lore raw
Quoted 8 lines · Michael Schmitz
Quoted 2 lines

Would a rewrite of the bogomips loop be an option?

Not really. The bogomips loop is meant to calibrate short delay loops used elsewhere in the kernel.

You can always add another calibration loop for the MHz if you absolutely need to.

Using the bogomips as it is is cheap, so I think I'll code up with that and add "(maybe wrong by 1 MHz or more)" or something for /proc/cpuinfo's clock field. Or remove that field all together where the information is not readily available.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#21 lore raw
In reply to Paul Mackerras
Quoted 4 lines · Paul Mackerras

It would be cleaner to have the page mapped with a non-cacheable mapping while the idle task is clearing it but you still have to be careful about cache inconsistencies, particularly if the page is mapped twice and one mapping is cacheable and the other isn't.

It might be interesting to try using a DMA engine on MPC 106/107 systems to clear pages in the background. I've seen some simulations which suggest that this could be a big win, but I'd have to spend a while digging through the IEEE archives to find them again.

- Adrian Cox, AG Electronics

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#22 lore raw
Quoted 10 lines
Quoted 5 lines

It would be cleaner to have the page mapped with a non-cacheable mapping while the idle task is clearing it but you still have to be careful about cache inconsistencies, particularly if the page is mapped twice and one mapping is cacheable and the other isn't.

It might be interesting to try using a DMA engine on MPC 106/107 systems to clear pages in the background. I've seen some simulations which suggest that this could be a big win, but I'd have to spend a while digging through the IEEE archives to find them again.

I didn't find any mention of a DMA engine in the MPC106... Or did I miss something ?

Ben.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#23 lore raw
Quoted 2 lines · Benjamin Herrenschmidt

I didn't find any mention of a DMA engine in the MPC106... Or did I miss something ?

You're probably right - I never worked with the 106, but went straight to the 107.

- Adrian Cox, AG Electronics

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#24 lore raw
Quoted 8 lines · Adrian Cox
Quoted 2 lines · Benjamin Herrenschmidt

I didn't find any mention of a DMA engine in the MPC106... Or did I miss something ?

You're probably right - I never worked with the 106, but went straight to the 107.

Yes, the 107 is the first Mot. Semi bridge to incorporate a DMA engine. The IBM CPC710 and 405GP both have DMA engines that could be used this way as well.

--
Matt Porter
MontaVista Software, Inc.
[email protected]

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#17 lore raw
In reply to Paul Mackerras
Quoted 7 lines · Paul Mackerras
Quoted 3 lines · Michel Lanners

clock : 195MHz

                  ^^^^^^

(by the way, this is wrong. Anybody with a fix?)

Quoted 7 lines

I'm pretty sure that this is the number that OF is telling us, so if it's wrong, blame OF. You don't have a G3 upgrade card in an older machine perhaps?

Since the only use of this number is for oohs and aahs, there's not a lot of motivation to try and work out if OF is wrong and work out the correct number.

It's not only OF, on my MVME machines with PPCBUG, I get 190 Mhz instead of 200. This value could be computed from the decrementer frequency and the clock multiplier (can be obtained from HID1 on some processors and has to be guessed on others). The 601 will require a different method, but can still be estimated quite precisely I believe.

Now, is is truly worth the effort ?

Gabriel (slowly reducing my email backlog after 2 weeks away)...

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#25 lore raw
In reply to Paul Mackerras
Quoted 10 lines · Paul Mackerras
Quoted 3 lines · Michel Lanners
Quoted 1 line

- if not, would it be a good idea to enable it by default?

What do you think, Paul, Cort?

As I recall, it was necessary to disable the cache in the idle task so that the idle task's clearing of pages didn't trash the cache for other tasks.

why ? When you are sleeping, the next task to run may or may not be the same.

If it is the same, you loose, but any task sleeping should not expect the caches to be hot when it restarts....

It it is not the same and you take care of cleaning the cache (with dcbst, not dcbf to opimize the case where you need a new allocation just after the switch to an active task), then you will end up with less dirty cache line pushes when the new task is started, effectively speeding up the task switch.

On SMP bus utlilization may be an issue, but dcbz+dcbst is not that expensive after all (2 address cycles and one data burst).

Regards,
Gabriel.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#26 lore raw
Quoted 10 lines · Gabriel Paubert
Quoted 3 lines · Paul Mackerras

As I recall, it was necessary to disable the cache in the idle task so that the idle task's clearing of pages didn't trash the cache for other tasks.

why ? When you are sleeping, the next task to run may or may not be the same.

If it is the same, you loose, but any task sleeping should not expect the caches to be hot when it restarts....

Cort did the measurements, I don't recall the actual numbers myself. I think that what was happening was that the idle task would run e.g. during a disk read and the net effect with things like a kernel compile was that it ran slower overall when the idle task was clearing pages with the cache enabled. Cort's solution was to disable the cache entirely while the idle task was running.

Paul.

--
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc. +61 2 6262 8990 tel, +61 2 6262 8991 fax [email protected], http://www.linuxcare.com.au/
Linuxcare. Support for the revolution.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/