linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Perf kvm commands bug fix
@ 2025-08-05  0:46 Dapeng Mi
  2025-08-05  0:46 ` [PATCH 1/5] perf tools kvm: Add missed memory allocation check and free Dapeng Mi
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Dapeng Mi @ 2025-08-05  0:46 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
	Kan Liang
  Cc: linux-perf-users, linux-kernel, Kevin Tian, Dapeng Mi, Dapeng Mi

This patch-set fixes perf kvm commands issues, like missed memory
allocation check/free, out of range memory access and especially the
issue that fails to sample guest with "perf kvm record/top" commands on
Intel platforms.

The commit 634d36f82517 ("perf record: Just use "cycles:P" as the
 default event") changes to use PEBS event to do sampling by default
including guest sampling. This breaks host to sample guest with commands
"perf kvm record/top" on Intel platforms.

Since the change "KVM: x86/pmu: Add basic support to enable guest PEBS
 via DS"[1] starts, host loses the capability to sample guest with PEBS
since all PEBS related MSRs are switched to guest value after vm-entry,
like IA32_DS_AREA MSR is switched to guest GVA at vm-entry. This leads
to PEBS events can't be used to sample guest by host, otherwise no guest
PEBS records can be really sampled. The patches 4-5/5 fix this issue by
using "cycles" event instead of PEBS event "cycles:P" to sample guest on
Intel platforms.

Tests:
  * Run command "perf kvm record -a && perf kvm report" and "perf kvm
    top" on Intel Sapphire Rapids platform, guest records can be
    captured successfully.
  * Since no powerpc platforms on hand, doesn't check the patches on
    powerpc. Any test on powerpc is appreciated.

Ref:
  [1] https://lore.kernel.org/all/20220411101946.20262-1-likexu@tencent.com/

Dapeng Mi (5):
  perf tools kvm: Add missed memory allocation check and free
  perf tools kvm: Fix the potential out of range memory access issue
  perf tools: Add helper x86__is_intel_cpu()
  perf tools kvm: Use "cycles" to sample guest for "kvm record" on Intel
  perf tools kvm: Use "cycles" to sample guest for "kvm top" on Intel

 tools/perf/arch/x86/util/kvm-stat.c | 46 ++++++++++++++++++
 tools/perf/builtin-kvm.c            | 73 ++++++++++++++++++++++++-----
 tools/perf/util/env.c               | 22 +++++++++
 tools/perf/util/env.h               |  2 +
 4 files changed, 131 insertions(+), 12 deletions(-)


base-commit: 6235ce77749f45cac27f630337e2fdf04e8a6c73
-- 
2.34.1


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

end of thread, other threads:[~2025-08-11  5:35 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-05  0:46 [PATCH 0/5] Perf kvm commands bug fix Dapeng Mi
2025-08-05  0:46 ` [PATCH 1/5] perf tools kvm: Add missed memory allocation check and free Dapeng Mi
2025-08-06 23:40   ` Namhyung Kim
2025-08-07  2:51     ` Mi, Dapeng
2025-08-05  0:46 ` [PATCH 2/5] perf tools kvm: Fix the potential out of range memory access issue Dapeng Mi
2025-08-06 23:53   ` Namhyung Kim
2025-08-07  2:52     ` Mi, Dapeng
2025-08-05  0:46 ` [PATCH 3/5] perf tools: Add helper x86__is_intel_cpu() Dapeng Mi
2025-08-05  0:46 ` [PATCH 4/5] perf tools kvm: Use "cycles" to sample guest for "kvm record" on Intel Dapeng Mi
2025-08-07  0:08   ` Namhyung Kim
2025-08-07  3:08     ` Mi, Dapeng
2025-08-08 22:10       ` Namhyung Kim
2025-08-11  5:35         ` Mi, Dapeng
2025-08-05  0:46 ` [PATCH 5/5] perf tools kvm: Use "cycles" to sample guest for "kvm top" " Dapeng Mi
2025-08-05  0:57   ` Mi, Dapeng
2025-08-05 11:32     ` Aditya Bodkhe
2025-08-06  0:31       ` Mi, Dapeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).