From mboxrd@z Thu Jan 1 00:00:00 1970 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 A42F8C6FD19 for ; Mon, 13 Mar 2023 11:42:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231179AbjCMLmD (ORCPT ); Mon, 13 Mar 2023 07:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbjCMLli (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 C33EB64B26 for ; Mon, 13 Mar 2023 04:41:11 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id nn12so11676817pjb.5 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=nhK7bkkHgdSDqBpPyTmnoTa/LaydQJPgOgeRyf3QfRCOe5meeBZuygXgg9bO6uz14J G5dQHnNe33dubXCYe7ON9uc/znSHVi+pTOwCtgajPXFj684JWSs4nxj3zWl78+zJ/OqJ T8BDD7SeaWubuTT/g6//9tx6hdWuX22JEv1aJkNdaTxIpNSlm2RsenjTMH5rtV/oOMvg lxeE/IyGtUsLDSbPbepWTU0gdNmDt6YuSWlte9ZrQQFLhuBz5ccXhD51B4gep0QAvSO7 SxELNCA5WHgI4Njs/fEfR6/34VV7AKqauR1y/WMuU85WZZMHiX/BjIGeb1Uv8WMqJbO+ qmzQ== X-Gm-Message-State: AO0yUKV1Ni5Vr9tb5HcsQu0FI2pcheXoPwb0IsK8xuzlvxrR2fYL0zKB n5tAo1Y4p2eTmfR1TANOnE69LQ== 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: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@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