From nobody Wed Feb 11 17:25:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 187BEC6FD1C for ; Mon, 13 Mar 2023 11:42:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231219AbjCMLmE (ORCPT ); Mon, 13 Mar 2023 07:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbjCMLli (ORCPT ); Mon, 13 Mar 2023 07:41:38 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23F130192 for ; Mon, 13 Mar 2023 04:41:11 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id l1so11705581pjt.2 for ; Mon, 13 Mar 2023 04:41:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678707671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5IYKqlpTPvf4B9W/g9ZH0t1bS6GpjcqsifmwRVPlTPE=; b=S4r7hqotk6HS7rVbQXptLHHawPHLQynLpKGSY1VkolIE/P7FIMKBjLWIAuTMlYpreq OpQKBFi5ELO1PnYucscKkPnLEjMjjcEWnPEzYU7ytndE+WEUtal3s+Vuq+qmhfyhr7Hn w8q8zJL17SnHalrey6tGzfGbCBMsG1MI2S99ksy/jyXPRhaaJlb87m9yXuhMNT6GSMIT zh/2h+0qkJiMZcpqK//u3Zbg92xNu8jgOUWSZK78rUOkIYSv4hugoVxwXf2DON74U4A/ ge5qgcoBGN+29Sybdw5CrYfFGmz+88pNqkrDFDSr6nKTlZ2yWvkgO4IbbVQHK0strO+l LQyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678707671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5IYKqlpTPvf4B9W/g9ZH0t1bS6GpjcqsifmwRVPlTPE=; b=Ulm4kFzD5Nk1Pz68qWJbBKYF36/8x0NdEsqR3I4HufNwz78T6CGv6sjl8qiBTX/Apn KPgbXHAvWRfriaDcUH1Jg/7g8r8kb9+q8G/HbZJ3EBUjaXLTuhGjs69ETi1RQFr7/ikR 0CSYXzaxrJfQJKSWR0rsmwsGqBVpcMTgmUbssCXncRwpIoDdzj6ZtDxJCFyTp304b4Pe IrbMAyrrbluZrwpMUBM4umjy+Gu/kE2I/fgYMe53Ap52uRnxncf9JNn2x7UQUKpizEN3 W83Ut7qzqqoM2kwCngt+LdM+SgQMLzQyGW8cYT5OFurinvsCR6GQ14N9WRErTZNP3EO1 PbSQ== X-Gm-Message-State: AO0yUKWAEMLYPAmp7T4YYzi5K4LB8kSR+p3cM/sw9Am1ktx9+vQGb1yi trZAHMi4kn0us+vyQlrTSHCI0g== X-Google-Smtp-Source: AK7set8RVASXZ6HtexSO7pgR6L/6ygL9d+NKSaVenQUGjJww7nIV0uWTsEiwzQuPe6liL3MbQoj4Tw== X-Received: by 2002:a17:90a:728d:b0:23b:4f2a:8026 with SMTP id e13-20020a17090a728d00b0023b4f2a8026mr4863481pjg.48.1678707671340; Mon, 13 Mar 2023 04:41:11 -0700 (PDT) Received: from leoy-huanghe.lan ([156.59.236.112]) by smtp.gmail.com with ESMTPSA id q21-20020a17090a2e1500b0022335f1dae2sm4281625pjd.22.2023.03.13.04.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 04:41:11 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , John Garry , James Clark , Adrian Hunter , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v4 07/16] perf kvm: Pass argument 'sample' to kvm_alloc_init_event() Date: Mon, 13 Mar 2023 19:40:09 +0800 Message-Id: <20230313114018.543254-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230313114018.543254-1-leo.yan@linaro.org> References: <20230313114018.543254-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch adds an argument 'sample' for kvm_alloc_init_event(), and its caller functions are updated as well for passing down the 'sample' pointer. This is a preparation change to allow later patch to create histograms entries for kvm event, no any functionality changes. Signed-off-by: Leo Yan Reviewed-by: James Clark --- tools/perf/builtin-kvm.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 384992c8a01a..5ea723fd45a4 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -260,7 +260,8 @@ static bool kvm_event_expand(struct kvm_event *event, i= nt vcpu_id) } =20 static struct kvm_event *kvm_alloc_init_event(struct perf_kvm_stat *kvm, - struct event_key *key) + struct event_key *key, + struct perf_sample *sample __maybe_unused) { struct kvm_event *event; =20 @@ -277,7 +278,8 @@ static struct kvm_event *kvm_alloc_init_event(struct pe= rf_kvm_stat *kvm, } =20 static struct kvm_event *find_create_kvm_event(struct perf_kvm_stat *kvm, - struct event_key *key) + struct event_key *key, + struct perf_sample *sample) { struct kvm_event *event; struct list_head *head; @@ -290,7 +292,7 @@ static struct kvm_event *find_create_kvm_event(struct p= erf_kvm_stat *kvm, return event; } =20 - event =3D kvm_alloc_init_event(kvm, key); + event =3D kvm_alloc_init_event(kvm, key, sample); if (!event) return NULL; =20 @@ -300,15 +302,16 @@ static struct kvm_event *find_create_kvm_event(struct= perf_kvm_stat *kvm, =20 static bool handle_begin_event(struct perf_kvm_stat *kvm, struct vcpu_event_record *vcpu_record, - struct event_key *key, u64 timestamp) + struct event_key *key, + struct perf_sample *sample) { struct kvm_event *event =3D NULL; =20 if (key->key !=3D INVALID_KEY) - event =3D find_create_kvm_event(kvm, key); + event =3D find_create_kvm_event(kvm, key, sample); =20 vcpu_record->last_event =3D event; - vcpu_record->start_time =3D timestamp; + vcpu_record->start_time =3D sample->time; return true; } =20 @@ -375,12 +378,12 @@ static bool is_child_event(struct perf_kvm_stat *kvm, static bool handle_child_event(struct perf_kvm_stat *kvm, struct vcpu_event_record *vcpu_record, struct event_key *key, - struct perf_sample *sample __maybe_unused) + struct perf_sample *sample) { struct kvm_event *event =3D NULL; =20 if (key->key !=3D INVALID_KEY) - event =3D find_create_kvm_event(kvm, key); + event =3D find_create_kvm_event(kvm, key, sample); =20 vcpu_record->last_event =3D event; =20 @@ -429,7 +432,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm, return true; =20 if (!event) - event =3D find_create_kvm_event(kvm, key); + event =3D find_create_kvm_event(kvm, key, sample); =20 if (!event) return false; @@ -500,7 +503,7 @@ static bool handle_kvm_event(struct perf_kvm_stat *kvm, return true; =20 if (kvm->events_ops->is_begin_event(evsel, sample, &key)) - return handle_begin_event(kvm, vcpu_record, &key, sample->time); + return handle_begin_event(kvm, vcpu_record, &key, sample); =20 if (is_child_event(kvm, evsel, sample, &key)) return handle_child_event(kvm, vcpu_record, &key, sample); --=20 2.34.1