From nobody Wed Feb 11 04:51:15 2026 Received: from mail-dy1-f201.google.com (mail-dy1-f201.google.com [74.125.82.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0646385EE9 for ; Mon, 9 Feb 2026 17:40:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770658856; cv=none; b=RnbOHVNUOaBcE+b0zf1hoj672VZJerCExMj6V2Hp+uurKSWgjcEtC2jWJoJmsheys2afb6CGGK0Xkkxhpmp5tXVFflhfIDQI5QQTqn3SG0pza++jt6+oALWtrKF46d/cXcxy7qgQF4M6T1RMZcLhWrG4OP/8e1yTLTTFL0q10rE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770658856; c=relaxed/simple; bh=qkHgAvRDamgqimEu8hPaGlL8ttguf0OFKjAmWUmCEME=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=ZUk4F9ocZ9fcTiWfI0VMAX5E/jYVZLN3Ds+enXq0mCEC/29xPCPu6i4IjFw0cuc16cZalDX5zNAsgw8seMWLoKAoXC9SlG9X4Qdw5TIFobkjRWSBN0/XKHSR/W+rPMHhyyQnvE4V+4xgm1rGBgecso+bhAWHmmhk6Ed6IYZHIJs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=yXxbY1jq; arc=none smtp.client-ip=74.125.82.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="yXxbY1jq" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-2b86addb8b1so1008489eec.0 for ; Mon, 09 Feb 2026 09:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1770658854; x=1771263654; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=BcZTNw/tuqoZN/EtJTkBUajAJxPG9SB29cptrCF651M=; b=yXxbY1jqe0q+2/BJqRBQ3ElrErJiJoRl+qNGRym9fezwRhtxi4tjatf+sXTEAbgFdk 0lyoiApdrcRbv5EcWh4FfxIXlU1ehqZpVQ8yVYplPAzgWcJZwMWQB6YcfItFmVEMNkK5 UuUo3fcJv9n2ICLepLaZptr5lb41F6r9BFIcec0PTucRPknzR5n0G5gspuW0qiZqMpeW sBGhaoYy8YO6CEFksEiymRkKgxuytGdJ5LVKN3s3eyZpjomO5OJlx1MweYe8r9Oilw8e D+QgnYSBodo0U7A6MA4V9R7n4mxSo/SkuiDL6r0t4dhGpC24ddQfpYsOccKuebRvQ6oc qjLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770658854; x=1771263654; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BcZTNw/tuqoZN/EtJTkBUajAJxPG9SB29cptrCF651M=; b=kv/Hv61AbVAGlzPZg6S5yT1wPhbYgNnC9pEd6ZvjgE0sqrULCp9HgMF6hH9vozrrP2 zvbEcyN9qhBUNvC1zpN6ZZj9WU0CdaqSkX1Vpm0ZOjhfVcrldsF5VEc/b0+Oq/sldesz ZJwJIZWn85DOGQBQwxGOklMVSYGtIff5FAfjusQMeI+GDLA1C1dlmYW77SNpbImf6T0Q c0b9464v6K11Fxy7iWLeq9m8LLvJbgP41Tb8ghhBhDwziw0iZQIOJ4B8TLtIqAm4S9gz ja5BIdlWkgqUOKlHH1giIsO6zhcb31eCa9uiTxJ26uoxcg8zS40TCBfBDiOEM5sVTnbf pxVg== X-Forwarded-Encrypted: i=1; AJvYcCX3ex7EoWTjLrElrjZvVOO9LswxLPA/T1YaKAqpdLOaeu6PVDnRW0qm/vzf2DfxMFwwja+OMkZxaoHR/VA=@vger.kernel.org X-Gm-Message-State: AOJu0YzYdbmo8s/1ufrol8sSyTrZfPvcwhz6XxMLbjeXyvxbsJYDZvx6 vIFtx5ouvZzRZeDn5JqBEcf0fVGtW1qyiBNTnJheDvWD5/65cRGIfRcU8ftSsoZqIToIqiS2QMd dDThCpeOnaw== X-Received: from dybuh20.prod.google.com ([2002:a05:7301:7514:b0:2b6:f3b6:6f0b]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7301:1699:b0:2ba:858b:3751 with SMTP id 5a478bee46e88-2ba858b3bd1mr385126eec.3.1770658853795; Mon, 09 Feb 2026 09:40:53 -0800 (PST) Date: Mon, 9 Feb 2026 09:40:12 -0800 In-Reply-To: <20260209174032.4142096-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260209174032.4142096-1-irogers@google.com> X-Mailer: git-send-email 2.53.0.239.g8d8fc8a987-goog Message-ID: <20260209174032.4142096-6-irogers@google.com> Subject: [PATCH v1 05/25] perf kvm: Don't pass evsel with sample From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Leo Yan , Tianyou Li , Athira Rajeev , Derek Foreman , Thomas Falcon , Howard Chu , Dmitry Vyukov , Andi Kleen , tanze , Hrishikesh Suresh , Quan Zhou , Andrew Jones , Anup Patel , Dapeng Mi , "Dr. David Alan Gilbert" , "=?UTF-8?q?Krzysztof=20=C5=81opatowski?=" , Chun-Tse Shao , Ravi Bangoria , Swapnil Sapkal , Chen Ni , Blake Jones , Yujie Liu , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As the sample now contains the evsel, read the evsel from the sample rather than passing them as a pair. Signed-off-by: Ian Rogers --- tools/perf/builtin-kvm.c | 19 +++-- .../perf/util/kvm-stat-arch/kvm-stat-arm64.c | 17 +++-- .../util/kvm-stat-arch/kvm-stat-loongarch.c | 17 ++--- .../util/kvm-stat-arch/kvm-stat-powerpc.c | 17 ++--- .../perf/util/kvm-stat-arch/kvm-stat-riscv.c | 18 +++-- tools/perf/util/kvm-stat-arch/kvm-stat-s390.c | 20 +++--- tools/perf/util/kvm-stat-arch/kvm-stat-x86.c | 70 ++++++++----------- tools/perf/util/kvm-stat.c | 19 +++-- tools/perf/util/kvm-stat.h | 18 ++--- 9 files changed, 89 insertions(+), 126 deletions(-) diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 5e8e6fde097a..d9b9792894a8 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -806,7 +806,6 @@ static bool update_kvm_event(struct perf_kvm_stat *kvm, } =20 static bool is_child_event(struct perf_kvm_stat *kvm, - struct evsel *evsel, struct perf_sample *sample, struct event_key *key) { @@ -818,8 +817,8 @@ static bool is_child_event(struct perf_kvm_stat *kvm, return false; =20 for (; child_ops->name; child_ops++) { - if (evsel__name_is(evsel, child_ops->name)) { - child_ops->get_key(evsel, sample, key); + if (evsel__name_is(sample->evsel, child_ops->name)) { + child_ops->get_key(sample, key); return true; } } @@ -917,11 +916,10 @@ static bool handle_end_event(struct perf_kvm_stat *kv= m, =20 static struct vcpu_event_record *per_vcpu_record(struct thread *thread, - struct evsel *evsel, struct perf_sample *sample) { /* Only kvm_entry records vcpu id. */ - if (!thread__priv(thread) && kvm_entry_event(evsel)) { + if (!thread__priv(thread) && kvm_entry_event(sample->evsel)) { struct vcpu_event_record *vcpu_record; struct machine *machine =3D maps__machine(thread__maps(thread)); uint16_t e_machine =3D thread__e_machine(thread, machine, /*e_flags=3D*/= NULL); @@ -932,7 +930,7 @@ struct vcpu_event_record *per_vcpu_record(struct thread= *thread, return NULL; } =20 - vcpu_record->vcpu_id =3D evsel__intval(evsel, sample, vcpu_id_str(e_mach= ine)); + vcpu_record->vcpu_id =3D evsel__intval(sample->evsel, sample, vcpu_id_st= r(e_machine)); thread__set_priv(thread, vcpu_record); } =20 @@ -943,12 +941,11 @@ static bool handle_kvm_event(struct perf_kvm_stat *kv= m, struct thread *thread, struct perf_sample *sample) { - struct evsel *evsel =3D sample->evsel; struct vcpu_event_record *vcpu_record; struct event_key key =3D { .key =3D INVALID_KEY, .exit_reasons =3D kvm->exit_reasons }; =20 - vcpu_record =3D per_vcpu_record(thread, evsel, sample); + vcpu_record =3D per_vcpu_record(thread, sample); if (!vcpu_record) return true; =20 @@ -957,13 +954,13 @@ static bool handle_kvm_event(struct perf_kvm_stat *kv= m, (kvm->trace_vcpu !=3D vcpu_record->vcpu_id)) return true; =20 - if (kvm->events_ops->is_begin_event(evsel, sample, &key)) + if (kvm->events_ops->is_begin_event(sample, &key)) return handle_begin_event(kvm, vcpu_record, &key, sample); =20 - if (is_child_event(kvm, evsel, sample, &key)) + if (is_child_event(kvm, sample, &key)) return handle_child_event(kvm, vcpu_record, &key, sample); =20 - if (kvm->events_ops->is_end_event(evsel, sample, &key)) + if (kvm->events_ops->is_end_event(sample, &key)) return handle_end_event(kvm, vcpu_record, &key, sample); =20 return true; diff --git a/tools/perf/util/kvm-stat-arch/kvm-stat-arm64.c b/tools/perf/ut= il/kvm-stat-arch/kvm-stat-arm64.c index c640dcd8af7c..1e76906f719c 100644 --- a/tools/perf/util/kvm-stat-arch/kvm-stat-arm64.c +++ b/tools/perf/util/kvm-stat-arch/kvm-stat-arm64.c @@ -17,10 +17,11 @@ static const char * const __kvm_events_tp[] =3D { NULL, }; =20 -static void event_get_key(struct evsel *evsel, - struct perf_sample *sample, +static void event_get_key(struct perf_sample *sample, struct event_key *key) { + struct evsel *evsel =3D sample->evsel; + key->info =3D 0; key->key =3D evsel__intval(evsel, sample, kvm_exit_reason(EM_AARCH64)); key->exit_reasons =3D arm64_exit_reasons; @@ -36,19 +37,17 @@ static void event_get_key(struct evsel *evsel, } } =20 -static bool event_begin(struct evsel *evsel, - struct perf_sample *sample __maybe_unused, +static bool event_begin(struct perf_sample *sample, struct event_key *key __maybe_unused) { - return evsel__name_is(evsel, kvm_entry_trace(EM_AARCH64)); + return evsel__name_is(sample->evsel, kvm_entry_trace(EM_AARCH64)); } =20 -static bool event_end(struct evsel *evsel, - struct perf_sample *sample, +static bool event_end(struct perf_sample *sample, struct event_key *key) { - if (evsel__name_is(evsel, kvm_exit_trace(EM_AARCH64))) { - event_get_key(evsel, sample, key); + if (evsel__name_is(sample->evsel, kvm_exit_trace(EM_AARCH64))) { + event_get_key(sample, key); return true; } return false; diff --git a/tools/perf/util/kvm-stat-arch/kvm-stat-loongarch.c b/tools/per= f/util/kvm-stat-arch/kvm-stat-loongarch.c index b802e516b138..9d6265290f6d 100644 --- a/tools/perf/util/kvm-stat-arch/kvm-stat-loongarch.c +++ b/tools/perf/util/kvm-stat-arch/kvm-stat-loongarch.c @@ -53,14 +53,12 @@ static const char * const __kvm_events_tp[] =3D { NULL, }; =20 -static bool event_begin(struct evsel *evsel, - struct perf_sample *sample, struct event_key *key) +static bool event_begin(struct perf_sample *sample, struct event_key *key) { - return exit_event_begin(evsel, sample, key); + return exit_event_begin(sample, key); } =20 -static bool event_end(struct evsel *evsel, - struct perf_sample *sample __maybe_unused, +static bool event_end(struct perf_sample *sample, struct event_key *key __maybe_unused) { /* @@ -71,17 +69,16 @@ static bool event_end(struct evsel *evsel, * kvm:kvm_enter means returning to vmm and then to guest * kvm:kvm_reenter means returning to guest immediately */ - return evsel__name_is(evsel, kvm_entry_trace(EM_LOONGARCH)) || - evsel__name_is(evsel, kvm_reenter_trace); + return evsel__name_is(sample->evsel, kvm_entry_trace(EM_LOONGARCH)) || + evsel__name_is(sample->evsel, kvm_reenter_trace); } =20 -static void event_gspr_get_key(struct evsel *evsel, - struct perf_sample *sample, struct event_key *key) +static void event_gspr_get_key(struct perf_sample *sample, struct event_ke= y *key) { unsigned int insn; =20 key->key =3D LOONGARCH_EXCEPTION_OTHERS; - insn =3D evsel__intval(evsel, sample, "inst_word"); + insn =3D evsel__intval(sample->evsel, sample, "inst_word"); =20 switch (insn >> 24) { case 0: diff --git a/tools/perf/util/kvm-stat-arch/kvm-stat-powerpc.c b/tools/perf/= util/kvm-stat-arch/kvm-stat-powerpc.c index 42182d70beb6..5158d7e88ee6 100644 --- a/tools/perf/util/kvm-stat-arch/kvm-stat-powerpc.c +++ b/tools/perf/util/kvm-stat-arch/kvm-stat-powerpc.c @@ -28,12 +28,11 @@ static const char * const ppc_book3s_hv_kvm_tp[] =3D { /* 1 extra placeholder for NULL */ static const char *__kvm_events_tp[NR_TPS + 1]; =20 -static void hcall_event_get_key(struct evsel *evsel, - struct perf_sample *sample, +static void hcall_event_get_key(struct perf_sample *sample, struct event_key *key) { key->info =3D 0; - key->key =3D evsel__intval(evsel, sample, "req"); + key->key =3D evsel__intval(sample->evsel, sample, "req"); } =20 static const char *get_hcall_exit_reason(u64 exit_code) @@ -51,18 +50,16 @@ static const char *get_hcall_exit_reason(u64 exit_code) return "UNKNOWN"; } =20 -static bool hcall_event_end(struct evsel *evsel, - struct perf_sample *sample __maybe_unused, +static bool hcall_event_end(struct perf_sample *sample, struct event_key *key __maybe_unused) { - return evsel__name_is(evsel, __kvm_events_tp[3]); + return evsel__name_is(sample->evsel, __kvm_events_tp[3]); } =20 -static bool hcall_event_begin(struct evsel *evsel, - struct perf_sample *sample, struct event_key *key) +static bool hcall_event_begin(struct perf_sample *sample, struct event_key= *key) { - if (evsel__name_is(evsel, __kvm_events_tp[2])) { - hcall_event_get_key(evsel, sample, key); + if (evsel__name_is(sample->evsel, __kvm_events_tp[2])) { + hcall_event_get_key(sample, key); return true; } =20 diff --git a/tools/perf/util/kvm-stat-arch/kvm-stat-riscv.c b/tools/perf/ut= il/kvm-stat-arch/kvm-stat-riscv.c index 8d4d5d6ce720..e8db8b4f8e2e 100644 --- a/tools/perf/util/kvm-stat-arch/kvm-stat-riscv.c +++ b/tools/perf/util/kvm-stat-arch/kvm-stat-riscv.c @@ -20,30 +20,28 @@ static const char * const __kvm_events_tp[] =3D { NULL, }; =20 -static void event_get_key(struct evsel *evsel, - struct perf_sample *sample, +static void event_get_key(struct perf_sample *sample, struct event_key *key) { int xlen =3D 64; // TODO: 32-bit support. =20 key->info =3D 0; - key->key =3D evsel__intval(evsel, sample, kvm_exit_reason(EM_RISCV)) & ~C= AUSE_IRQ_FLAG(xlen); + key->key =3D evsel__intval(sample->evsel, sample, + kvm_exit_reason(EM_RISCV)) & ~CAUSE_IRQ_FLAG(xlen); key->exit_reasons =3D riscv_exit_reasons; } =20 -static bool event_begin(struct evsel *evsel, - struct perf_sample *sample __maybe_unused, +static bool event_begin(struct perf_sample *sample, struct event_key *key __maybe_unused) { - return evsel__name_is(evsel, kvm_entry_trace(EM_RISCV)); + return evsel__name_is(sample->evsel, kvm_entry_trace(EM_RISCV)); } =20 -static bool event_end(struct evsel *evsel, - struct perf_sample *sample, +static bool event_end(struct perf_sample *sample, struct event_key *key) { - if (evsel__name_is(evsel, kvm_exit_trace(EM_RISCV))) { - event_get_key(evsel, sample, key); + if (evsel__name_is(sample->evsel, kvm_exit_trace(EM_RISCV))) { + event_get_key(sample, key); return true; } return false; diff --git a/tools/perf/util/kvm-stat-arch/kvm-stat-s390.c b/tools/perf/uti= l/kvm-stat-arch/kvm-stat-s390.c index 7e29169f5bb0..158372ba0205 100644 --- a/tools/perf/util/kvm-stat-arch/kvm-stat-s390.c +++ b/tools/perf/util/kvm-stat-arch/kvm-stat-s390.c @@ -18,38 +18,34 @@ define_exit_reasons_table(sie_sigp_order_codes, sigp_or= der_codes); define_exit_reasons_table(sie_diagnose_codes, diagnose_codes); define_exit_reasons_table(sie_icpt_prog_codes, icpt_prog_codes); =20 -static void event_icpt_insn_get_key(struct evsel *evsel, - struct perf_sample *sample, +static void event_icpt_insn_get_key(struct perf_sample *sample, struct event_key *key) { u64 insn; =20 - insn =3D evsel__intval(evsel, sample, "instruction"); + insn =3D evsel__intval(sample->evsel, sample, "instruction"); key->key =3D icpt_insn_decoder(insn); key->exit_reasons =3D sie_icpt_insn_codes; } =20 -static void event_sigp_get_key(struct evsel *evsel, - struct perf_sample *sample, +static void event_sigp_get_key(struct perf_sample *sample, struct event_key *key) { - key->key =3D evsel__intval(evsel, sample, "order_code"); + key->key =3D evsel__intval(sample->evsel, sample, "order_code"); key->exit_reasons =3D sie_sigp_order_codes; } =20 -static void event_diag_get_key(struct evsel *evsel, - struct perf_sample *sample, +static void event_diag_get_key(struct perf_sample *sample, struct event_key *key) { - key->key =3D evsel__intval(evsel, sample, "code"); + key->key =3D evsel__intval(sample->evsel, sample, "code"); key->exit_reasons =3D sie_diagnose_codes; } =20 -static void event_icpt_prog_get_key(struct evsel *evsel, - struct perf_sample *sample, +static void event_icpt_prog_get_key(struct perf_sample *sample, struct event_key *key) { - key->key =3D evsel__intval(evsel, sample, "code"); + key->key =3D evsel__intval(sample->evsel, sample, "code"); key->exit_reasons =3D sie_icpt_prog_codes; } =20 diff --git a/tools/perf/util/kvm-stat-arch/kvm-stat-x86.c b/tools/perf/util= /kvm-stat-arch/kvm-stat-x86.c index 43275d25b6cb..a7993e945d8b 100644 --- a/tools/perf/util/kvm-stat-arch/kvm-stat-x86.c +++ b/tools/perf/util/kvm-stat-arch/kvm-stat-x86.c @@ -24,45 +24,43 @@ static const struct kvm_events_ops exit_events =3D { * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry * the time of MMIO read: kvm_exit -> kvm_mmio(KVM_TRACE_MMIO_READ...). */ -static void mmio_event_get_key(struct evsel *evsel, struct perf_sample *sa= mple, +static void mmio_event_get_key(struct perf_sample *sample, struct event_key *key) { - key->key =3D evsel__intval(evsel, sample, "gpa"); - key->info =3D evsel__intval(evsel, sample, "type"); + key->key =3D evsel__intval(sample->evsel, sample, "gpa"); + key->info =3D evsel__intval(sample->evsel, sample, "type"); } =20 #define KVM_TRACE_MMIO_READ_UNSATISFIED 0 #define KVM_TRACE_MMIO_READ 1 #define KVM_TRACE_MMIO_WRITE 2 =20 -static bool mmio_event_begin(struct evsel *evsel, - struct perf_sample *sample, struct event_key *key) +static bool mmio_event_begin(struct perf_sample *sample, struct event_key = *key) { /* MMIO read begin event in kernel. */ - if (kvm_exit_event(evsel)) + if (kvm_exit_event(sample->evsel)) return true; =20 /* MMIO write begin event in kernel. */ - if (evsel__name_is(evsel, "kvm:kvm_mmio") && - evsel__intval(evsel, sample, "type") =3D=3D KVM_TRACE_MMIO_WRITE) { - mmio_event_get_key(evsel, sample, key); + if (evsel__name_is(sample->evsel, "kvm:kvm_mmio") && + evsel__intval(sample->evsel, sample, "type") =3D=3D KVM_TRACE_MMIO_WR= ITE) { + mmio_event_get_key(sample, key); return true; } =20 return false; } =20 -static bool mmio_event_end(struct evsel *evsel, struct perf_sample *sample, - struct event_key *key) +static bool mmio_event_end(struct perf_sample *sample, struct event_key *k= ey) { /* MMIO write end event in kernel. */ - if (kvm_entry_event(evsel)) + if (kvm_entry_event(sample->evsel)) return true; =20 /* MMIO read end event in kernel.*/ - if (evsel__name_is(evsel, "kvm:kvm_mmio") && - evsel__intval(evsel, sample, "type") =3D=3D KVM_TRACE_MMIO_READ) { - mmio_event_get_key(evsel, sample, key); + if (evsel__name_is(sample->evsel, "kvm:kvm_mmio") && + evsel__intval(sample->evsel, sample, "type") =3D=3D KVM_TRACE_MMIO_RE= AD) { + mmio_event_get_key(sample, key); return true; } =20 @@ -86,31 +84,27 @@ static const struct kvm_events_ops mmio_events =3D { }; =20 /* The time of emulation pio access is from kvm_pio to kvm_entry. */ -static void ioport_event_get_key(struct evsel *evsel, - struct perf_sample *sample, +static void ioport_event_get_key(struct perf_sample *sample, struct event_key *key) { - key->key =3D evsel__intval(evsel, sample, "port"); - key->info =3D evsel__intval(evsel, sample, "rw"); + key->key =3D evsel__intval(sample->evsel, sample, "port"); + key->info =3D evsel__intval(sample->evsel, sample, "rw"); } =20 -static bool ioport_event_begin(struct evsel *evsel, - struct perf_sample *sample, +static bool ioport_event_begin(struct perf_sample *sample, struct event_key *key) { - if (evsel__name_is(evsel, "kvm:kvm_pio")) { - ioport_event_get_key(evsel, sample, key); + if (evsel__name_is(sample->evsel, "kvm:kvm_pio")) { + ioport_event_get_key(sample, key); return true; } =20 return false; } =20 -static bool ioport_event_end(struct evsel *evsel, - struct perf_sample *sample __maybe_unused, - struct event_key *key __maybe_unused) +static bool ioport_event_end(struct perf_sample *sample, struct event_key = *key __maybe_unused) { - return kvm_entry_event(evsel); + return kvm_entry_event(sample->evsel); } =20 static void ioport_event_decode_key(struct perf_kvm_stat *kvm __maybe_unus= ed, @@ -130,31 +124,25 @@ static const struct kvm_events_ops ioport_events =3D { }; =20 /* The time of emulation msr is from kvm_msr to kvm_entry. */ -static void msr_event_get_key(struct evsel *evsel, - struct perf_sample *sample, - struct event_key *key) +static void msr_event_get_key(struct perf_sample *sample, struct event_key= *key) { - key->key =3D evsel__intval(evsel, sample, "ecx"); - key->info =3D evsel__intval(evsel, sample, "write"); + key->key =3D evsel__intval(sample->evsel, sample, "ecx"); + key->info =3D evsel__intval(sample->evsel, sample, "write"); } =20 -static bool msr_event_begin(struct evsel *evsel, - struct perf_sample *sample, - struct event_key *key) +static bool msr_event_begin(struct perf_sample *sample, struct event_key *= key) { - if (evsel__name_is(evsel, "kvm:kvm_msr")) { - msr_event_get_key(evsel, sample, key); + if (evsel__name_is(sample->evsel, "kvm:kvm_msr")) { + msr_event_get_key(sample, key); return true; } =20 return false; } =20 -static bool msr_event_end(struct evsel *evsel, - struct perf_sample *sample __maybe_unused, - struct event_key *key __maybe_unused) +static bool msr_event_end(struct perf_sample *sample, struct event_key *ke= y __maybe_unused) { - return kvm_entry_event(evsel); + return kvm_entry_event(sample->evsel); } =20 static void msr_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, diff --git a/tools/perf/util/kvm-stat.c b/tools/perf/util/kvm-stat.c index 27f16810498c..f17a6132958d 100644 --- a/tools/perf/util/kvm-stat.c +++ b/tools/perf/util/kvm-stat.c @@ -11,22 +11,20 @@ bool kvm_exit_event(struct evsel *evsel) return evsel__name_is(evsel, kvm_exit_trace(e_machine)); } =20 -void exit_event_get_key(struct evsel *evsel, - struct perf_sample *sample, +void exit_event_get_key(struct perf_sample *sample, struct event_key *key) { - uint16_t e_machine =3D evsel__e_machine(evsel, /*e_flags=3D*/NULL); + uint16_t e_machine =3D evsel__e_machine(sample->evsel, /*e_flags=3D*/NULL= ); =20 key->info =3D 0; - key->key =3D evsel__intval(evsel, sample, kvm_exit_reason(e_machine)); + key->key =3D evsel__intval(sample->evsel, sample, kvm_exit_reason(e_mach= ine)); } =20 =20 -bool exit_event_begin(struct evsel *evsel, - struct perf_sample *sample, struct event_key *key) +bool exit_event_begin(struct perf_sample *sample, struct event_key *key) { - if (kvm_exit_event(evsel)) { - exit_event_get_key(evsel, sample, key); + if (kvm_exit_event(sample->evsel)) { + exit_event_get_key(sample, key); return true; } =20 @@ -40,11 +38,10 @@ bool kvm_entry_event(struct evsel *evsel) return evsel__name_is(evsel, kvm_entry_trace(e_machine)); } =20 -bool exit_event_end(struct evsel *evsel, - struct perf_sample *sample __maybe_unused, +bool exit_event_end(struct perf_sample *sample, struct event_key *key __maybe_unused) { - return kvm_entry_event(evsel); + return kvm_entry_event(sample->evsel); } =20 static const char *get_exit_reason(struct perf_kvm_stat *kvm, diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h index 4a998aaece5d..cdbd921a555f 100644 --- a/tools/perf/util/kvm-stat.h +++ b/tools/perf/util/kvm-stat.h @@ -53,18 +53,15 @@ struct kvm_event { }; =20 struct child_event_ops { - void (*get_key)(struct evsel *evsel, - struct perf_sample *sample, + void (*get_key)(struct perf_sample *sample, struct event_key *key); const char *name; }; =20 struct kvm_events_ops { - bool (*is_begin_event)(struct evsel *evsel, - struct perf_sample *sample, + bool (*is_begin_event)(struct perf_sample *sample, struct event_key *key); - bool (*is_end_event)(struct evsel *evsel, - struct perf_sample *sample, struct event_key *key); + bool (*is_end_event)(struct perf_sample *sample, struct event_key *key); const struct child_event_ops *child_ops; void (*decode_key)(struct perf_kvm_stat *kvm, struct event_key *key, char *decode); @@ -116,14 +113,11 @@ struct kvm_reg_events_ops { =20 #ifdef HAVE_LIBTRACEEVENT =20 -void exit_event_get_key(struct evsel *evsel, - struct perf_sample *sample, +void exit_event_get_key(struct perf_sample *sample, struct event_key *key); -bool exit_event_begin(struct evsel *evsel, - struct perf_sample *sample, +bool exit_event_begin(struct perf_sample *sample, struct event_key *key); -bool exit_event_end(struct evsel *evsel, - struct perf_sample *sample, +bool exit_event_end(struct perf_sample *sample, struct event_key *key); void exit_event_decode_key(struct perf_kvm_stat *kvm, struct event_key *key, --=20 2.53.0.239.g8d8fc8a987-goog