All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] perf: Implement event group read using txn interface
@ 2015-03-04  8:35 ` Sukadev Bhattiprolu
  0 siblings, 0 replies; 22+ messages in thread
From: Sukadev Bhattiprolu @ 2015-03-04  8:35 UTC (permalink / raw)
  To: Michael Ellerman, Paul Mackerras, peterz; +Cc: dev, linux-kernel, linuxppc-dev

Unlike normal hardware PMCs, the 24x7 counters[1] in Power8 are stored in
memory and accessed via a hypervisor call (HCALL).  A major aspect of the
HCALL is that it allows retireving _SEVERAL_ counters at once (unlike
regular PMCs, which are read one at a time). By reading several counters
at once, we can get a more consistent snapshot of the system.

This patchset explores the possibility of using the transaction interface
to accomplish submitting several "events" to the PMU and have the PMU read
them all at once. User is expected to submit the set of events they want
to read as an "event group".

In the kernel, we submit each event to the PMU using the following logic
(from Peter Zijlstra).
	
	pmu->start_txn(pmu, PMU_TXN_READ);

	leader->read();
	for_each_sibling()
		sibling->read();
	pmu->commit_txn();

where:
	- the ->read()s queue events to be submitted to the hypervisor, and,
	- the ->commit_txn() issues the HCALL, retrieves the result and
	  updates the event count.

Since the ->commit_txn() updates the event count, perf subsystem can use
the event count directly and skip the a ->read() call immediately after
the transaction.

TODO: 
	- Lightly tested on Powerpc; Needs more testing on Power and x86.
	- Need to review/update txn and perf_event_read_value() interfaces
	  for other architectures.

Thanks to Peter Zijlstra for his input.

Sukadev Bhattiprolu (4):
  perf: Add 'flags' parameter to pmu txn interfaces
  perf: Split perf_event_read() and perf_event_count()
  perf: Add 'update' parameter to perf_event_read_value()
  perf/powerpc: Implement group_read() txn interface for 24x7 counters

 arch/powerpc/perf/core-book3s.c  |  15 +++-
 arch/powerpc/perf/hv-24x7.c      | 171 +++++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/cpu/perf_event.c |  15 +++-
 arch/x86/kvm/pmu.c               |   2 +-
 include/linux/perf_event.h       |  17 +++-
 kernel/events/core.c             |  93 ++++++++++++++++-----
 6 files changed, 281 insertions(+), 32 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-04-01 18:10 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04  8:35 [PATCH 0/4] perf: Implement event group read using txn interface Sukadev Bhattiprolu
2015-03-04  8:35 ` Sukadev Bhattiprolu
2015-03-04  8:35 ` [PATCH 1/4] perf: Add 'flags' parameter to pmu txn interfaces Sukadev Bhattiprolu
2015-03-04  8:35   ` Sukadev Bhattiprolu
2015-03-17  6:47   ` Peter Zijlstra
2015-03-17  6:47     ` Peter Zijlstra
2015-03-26  4:00     ` Sukadev Bhattiprolu
2015-03-26  4:00       ` Sukadev Bhattiprolu
2015-03-04  8:35 ` [PATCH 2/4] perf: Split perf_event_read() and perf_event_count() Sukadev Bhattiprolu
2015-03-04  8:35   ` Sukadev Bhattiprolu
2015-03-04  8:35 ` [PATCH 3/4] perf: Add 'update' parameter to perf_event_read_value() Sukadev Bhattiprolu
2015-03-04  8:35   ` Sukadev Bhattiprolu
2015-03-17  6:54   ` Peter Zijlstra
2015-03-17  6:54     ` Peter Zijlstra
2015-03-04  8:35 ` [PATCH 4/4] perf/powerpc: Implement group_read() txn interface for 24x7 counters Sukadev Bhattiprolu
2015-03-04  8:35   ` Sukadev Bhattiprolu
2015-03-17  6:57   ` Peter Zijlstra
2015-03-17  6:57     ` Peter Zijlstra
2015-03-26  5:57     ` Sukadev Bhattiprolu
2015-03-26  5:57       ` Sukadev Bhattiprolu
2015-04-01 18:10       ` Peter Zijlstra
2015-04-01 18:10         ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.