Enabling RDPMC in user space by default
From: Andi Kleen (ak_at_suse.de)
Date: 11/29/05
- Previous message: Pavel Machek: "[PATCH] fix swsusp on machines not supporting S4"
- Next in thread: Mikael Pettersson: "Re: Enabling RDPMC in user space by default"
- Reply: Mikael Pettersson: "Re: Enabling RDPMC in user space by default"
- Reply: Ray Bryant: "Re: Enabling RDPMC in user space by default"
- Reply: Zwane Mwaikambo: "Re: Enabling RDPMC in user space by default"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Nov 2005 16:15:15 +0100 To: discuss@x86-64.org
Hallo,
I'm considering to enable CR4.PCE by default on x86-64/i386. Currently it's 0
which means RDPMC doesn't work. On x86-64 PMC 0 is always programmed
to be a cycle counter, so it would be useful to be able to access
this for measuring instructions. That's especially useful because RDTSC
does not necessarily count cycles in the current P state (already
the case on Intel CPUs and AMD's future direction seems to also
to decouple it from cycles) Drawback is that it stops during idle, but
that shouldn't be a big issue for normal measuring. It's not useful
as a real timer anyways.
On Pentium 4 it also has the advantage that unlike RDTSC it's not
serializing so should be much faster.
The kernel change would be to always set CR4.PCE to allow RDPMC
in ring 3.
It would be actually a good idea to disable RDTSC in ring 3 too
(because user space usually doesn't have enough information to make
good use of it and gets it wrong), but I fear that will break
too many applications right now.
Any comments on this?
-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Pavel Machek: "[PATCH] fix swsusp on machines not supporting S4"
- Next in thread: Mikael Pettersson: "Re: Enabling RDPMC in user space by default"
- Reply: Mikael Pettersson: "Re: Enabling RDPMC in user space by default"
- Reply: Ray Bryant: "Re: Enabling RDPMC in user space by default"
- Reply: Zwane Mwaikambo: "Re: Enabling RDPMC in user space by default"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: Enabling RDPMC in user space by default
... That's especially useful because RDTSC ... > does not necessarily count cycles
in the current P state (already ... > that shouldn't be a big issue for normal measuring.
... send the line "unsubscribe linux-kernel" in ... (Linux-Kernel) - Re: No difference on my machine
... show better reproducable timing values. ... No, the serialising itself may take
190...+++ cycles, ... "Have you ever seen an odd value from rdtsc?" ... (alt.lang.asm) - Re: No difference on my machine
... show better reproducable timing values. ... Apparently 300 cycles on
my machine. ... My understanding is that without a serializing instruction, ...
come from after the rdtsc in our code, ... (alt.lang.asm) - Re: from elsewhere, an assembler
... a off by one may came from RDTSC itself ... CPUID | rdtsc | push eax edx
... fdiv D$FPU_Mem32 ... activities (for sure more cycles than your code
under test..). ... (alt.lang.asm) - [RFT] Port 0x80 I/O speed
... It measures in CPU cycles so CPU speed is crucial in reporting. ... unsigned
long long overhead; ... overhead = rdtsc() - start; ... (Linux-Kernel)