Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1646605
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter |
| Date | 2017-05-22 10:40 +0200 |
| Message-ID | <tJR2F-382-7@gated-at.bofh.it> (permalink) |
| References | <tIUlY-5uX-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, May 19, 2017 at 10:06:21AM -0700, kan.liang@intel.com wrote: > From: Kan Liang <Kan.liang@intel.com> > > The CPU ref_cycles can only be used by one user at the same time, > otherwise a "not counted" error will be displaced. > [kan]$ sudo perf stat -x, -e ref-cycles,ref-cycles -- sleep 1 > 1203264,,ref-cycles,513112,100.00,,,, > <not counted>,,ref-cycles,0,0.00,,,, > > CPU ref_cycles can only be counted by fixed counter 2. It uses > pseudo-encoding. The GP counter doesn't recognize. > > BUS_CYCLES (0x013c) is another event which is not affected by core > frequency changes. It has a constant ratio with the CPU ref_cycles. > BUS_CYCLES could be used as an alternative event for ref_cycles on GP > counter. > A hook is implemented in x86_schedule_events. If the fixed counter 2 is > occupied and a GP counter is assigned, BUS_CYCLES is used to replace > ref_cycles. A new flag PERF_X86_EVENT_REF_CYCLES_REP in > hw_perf_event is introduced to indicate the replacement. > To make the switch transparent, counting and sampling are also specially > handled. > - For counting, it multiplies the result with the constant ratio after > reading it. > - For sampling with fixed period, the BUS_CYCLES period = ref_cycles > period / the constant ratio. > - For sampling with fixed frequency, the adaptive frequency algorithm > will figure it out on its own. Do nothing. > > The constant ratio is model specific. > For the model after NEHALEM but before Skylake, the ratio is defined in > MSR_PLATFORM_INFO. > For the model after Skylake, it can be get from CPUID.15H. > For Knights Landing, Goldmont and later, the ratio is always 1. > > The old Silvermont/Airmont, Core2 and Atom machines are not covered by > the patch. The behavior on those machines will not change. Maybe I missed it, but *why* are we doing this?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter kan.liang@intel.com - 2017-05-19 20:00 +0200
[PATCH 2/2] perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86 kan.liang@intel.com - 2017-05-19 20:00 +0200
Re: [PATCH 2/2] perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86 Peter Zijlstra <peterz@infradead.org> - 2017-05-22 14:10 +0200
Re: [PATCH 2/2] perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86 Peter Zijlstra <peterz@infradead.org> - 2017-05-22 14:10 +0200
RE: [PATCH 2/2] perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86 "Liang, Kan" <kan.liang@intel.com> - 2017-05-22 19:00 +0200
Re: [PATCH 2/2] perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86 Peter Zijlstra <peterz@infradead.org> - 2017-05-22 21:30 +0200
Re: [PATCH 2/2] perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86 Stephane Eranian <eranian@google.com> - 2017-05-22 20:30 +0200
Re: [PATCH 2/2] perf/x86/intel, watchdog: Switch NMI watchdog to ref cycles on x86 Andi Kleen <ak@linux.intel.com> - 2017-05-22 22:10 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Peter Zijlstra <peterz@infradead.org> - 2017-05-22 10:40 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Stephane Eranian <eranian@google.com> - 2017-05-22 20:20 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Peter Zijlstra <peterz@infradead.org> - 2017-05-22 11:30 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Peter Zijlstra <peterz@infradead.org> - 2017-05-22 14:30 +0200
RE: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter "Liang, Kan" <kan.liang@intel.com> - 2017-05-22 19:00 +0200
RE: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter "Liang, Kan" <kan.liang@intel.com> - 2017-05-22 19:00 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Peter Zijlstra <peterz@infradead.org> - 2017-05-22 21:30 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Stephane Eranian <eranian@google.com> - 2017-05-22 21:30 +0200
RE: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter "Liang, Kan" <kan.liang@intel.com> - 2017-05-23 00:00 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Peter Zijlstra <peterz@infradead.org> - 2017-05-23 08:40 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Stephane Eranian <eranian@google.com> - 2017-05-23 08:50 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Andi Kleen <ak@linux.intel.com> - 2017-05-24 17:50 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Vince Weaver <vincent.weaver@maine.edu> - 2017-05-24 18:10 +0200
Re: [PATCH 1/2] perf/x86/intel: enable CPU ref_cycles for GP counter Andi Kleen <ak@linux.intel.com> - 2017-05-24 19:00 +0200
csiph-web