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 90FC0C7618B for ; Wed, 15 Mar 2023 14:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232724AbjCOOwz (ORCPT ); Wed, 15 Mar 2023 10:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233188AbjCOOwo (ORCPT ); Wed, 15 Mar 2023 10:52:44 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 215629B9B0 for ; Wed, 15 Mar 2023 07:52:12 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id ja10so10630753plb.5 for ; Wed, 15 Mar 2023 07:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678891930; 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=x26vR0cXHAFQU/OylVs2A3pi9LFcSWhxlTPtYlnieFE6JRYXKgGQjVDkwSz7QBu5Nx sdvHxXI6FCFLlxlORUkFmaDzo7e2JKoejjxpI77bGeCaGT0aJvgzeTyTIGuslcdclVi5 4TyBRDLbeYmM30AYhhN/tIRqhmY1rOQoI7Qh2igwUxOgE9q+zNEal4k+XrYiYA/wFEbX GpLqe98MM+jvGMhcu0NygeMstpsEtut5+Ln4qooWLr4XER7qNB8BAn5pYP21IUt7Cr0h JnvhBx0OLd+HHK3BremRi9jiXeD9D5mWzW4fGYvXak1SBax78tZKH4CZ8TItk5jLYUlB GL2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678891930; 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=AxnKpXb7tdNbaKvB8czLGXmDmsmSkzY3TEfZpCj1DCXDTn9wiG7bdOA3DTo4WPwjlx V8S3XDFp8me+MeS/QUqzOQQupgb39NxK2+rokuD/y577J4izrN1B7qlA3IGJrlLsQNuA zmfJ66fEgzqUsjGAokLDyvvCs+MbthfpuKvzibtX4O7lssfhr20T5sZ38jY/+L7TL51X CEq/qN1jMKSShX9r925403PqZbxf+X8369BXSpEYrCJ6ZwiPqF65ZHBMzXJmD6a1b1ON /7QFZFNcjgyY53iBTAKYqUmClkpvBF/MP5e+Knx90mp4ztacHFCwJIlRovi+TDcTDv9X 6G0A== X-Gm-Message-State: AO0yUKUgkEi4qh1Ue6+zDqdu4bCqIIJwuY3TR0vpf1nCKoH2us6hLCyD MrzobLxOVmNZ/l4mbzI2GI84DA== X-Google-Smtp-Source: AK7set9VmJ9JazfbYgtFRf8oYUnPBYBITGOROjQDD6rD7Vh7Iej4zmzLmmZrN85pIp3yfHORhfPzng== X-Received: by 2002:a17:903:283:b0:19c:e0fe:ed2b with SMTP id j3-20020a170903028300b0019ce0feed2bmr3360060plr.54.1678891930227; Wed, 15 Mar 2023 07:52:10 -0700 (PDT) Received: from leoy-huanghe.lan ([107.151.177.133]) by smtp.gmail.com with ESMTPSA id kh3-20020a170903064300b0019926c77577sm3781587plb.90.2023.03.15.07.52.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 07:52:09 -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 v5 07/16] perf kvm: Pass argument 'sample' to kvm_alloc_init_event() Date: Wed, 15 Mar 2023 22:51:03 +0800 Message-Id: <20230315145112.186603-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230315145112.186603-1-leo.yan@linaro.org> References: <20230315145112.186603-1-leo.yan@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, int vcpu_id) } 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; @@ -277,7 +278,8 @@ static struct kvm_event *kvm_alloc_init_event(struct perf_kvm_stat *kvm, } 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 perf_kvm_stat *kvm, return event; } - event = kvm_alloc_init_event(kvm, key); + event = kvm_alloc_init_event(kvm, key, sample); if (!event) return NULL; @@ -300,15 +302,16 @@ static struct kvm_event *find_create_kvm_event(struct perf_kvm_stat *kvm, 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 = NULL; if (key->key != INVALID_KEY) - event = find_create_kvm_event(kvm, key); + event = find_create_kvm_event(kvm, key, sample); vcpu_record->last_event = event; - vcpu_record->start_time = timestamp; + vcpu_record->start_time = sample->time; return true; } @@ -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 = NULL; if (key->key != INVALID_KEY) - event = find_create_kvm_event(kvm, key); + event = find_create_kvm_event(kvm, key, sample); vcpu_record->last_event = event; @@ -429,7 +432,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm, return true; if (!event) - event = find_create_kvm_event(kvm, key); + event = find_create_kvm_event(kvm, key, sample); if (!event) return false; @@ -500,7 +503,7 @@ static bool handle_kvm_event(struct perf_kvm_stat *kvm, return true; 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); if (is_child_event(kvm, evsel, sample, &key)) return handle_child_event(kvm, vcpu_record, &key, sample); -- 2.34.1