Re: [PATCH] perf_events: fix bug in hw_perf_enable()

From: Stephane Eranian
Date: Mon Feb 01 2010 - 11:14:14 EST


On Mon, Feb 1, 2010 at 5:04 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Mon, 2010-02-01 at 16:35 +0100, Peter Zijlstra wrote:
>> +++ linux-2.6/arch/x86/kernel/cpu/perf_event.c
>> @@ -243,8 +243,18 @@ static struct event_constraint intel_cor
>>
>> Âstatic struct event_constraint intel_core2_event_constraints[] =
>> Â{
>> - Â Â Â FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
>> - Â Â Â FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
>> + Â Â Â FIXED_EVENT_CONSTRAINT(0x00c0, 1ULL << 32), /* INST_RETIRED.ANY */
>> + Â Â Â FIXED_EVENT_CONSTRAINT(0x003c, 1ULL << 33), /* CPU_CLK_UNHALTED.CORE */
>> + Â Â Â /*
>> + Â Â Â Â* FIXED_EVENT_CONSTRAINT(0x013c, 1ULL << 34), ÂCPU_CLK_UNHALTED.REF
>> + Â Â Â Â*
>> + Â Â Â Â* Core2 has Fixed Counter 2 listed as CPU_CLK_UNHALTED.REF and event
>> + Â Â Â Â* 0x013c as CPU_CLK_UNHALTED.BUS and specifies there is a fixed
>> + Â Â Â Â* ratio between these counters.
>> + Â Â Â Â*
>> + Â Â Â Â* TODO: find/measure the fixed ratio and apply it so that we can
>> + Â Â Â Â* enable this fixed purpose counter in a transparent way.
>> + Â Â Â Â*/
>> Â Â Â Â INTEL_EVENT_CONSTRAINT(0x10, 0x1), /* FP_COMP_OPS_EXE */
>> Â Â Â Â INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */
>> Â Â Â Â INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */
>
> >From what I can measure on the available Core2 systems this ratio is
> exactly 1, which would be consistent with the Nehalem and Westmere
> tables calling this event .REF
>
> Stephane, have you ever observed this ratio to be anything other than 1?
>

Using perfmon on Core 2 on a 10s noploop:

pfmon -eunhalted_reference_cycles,unhalted_core_cycles,cpu_clk_unhalted:bus
noploop 10
noploop for 10 seconds
23869090125 UNHALTED_REFERENCE_CYCLES
23849336873 UNHALTED_CORE_CYCLES
2652122099 CPU_CLK_UNHALTED:BUS


> If not, I think we can simply stick this counter back in and not worry
> about it.
>
>



--
Stephane Eranian | EMEA Software Engineering
Google France | 38 avenue de l'OpÃra | 75002 Paris
Tel : +33 (0) 1 42 68 53 00
This email may be confidential or privileged. If you received this
communication by mistake, please
don't forward it to anyone else, please erase all copies and
attachments, and please let me know that
it went to the wrong person. Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/