From patchwork Mon Mar 13 11:40:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13172333 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6FE97C6FD19 for ; Mon, 13 Mar 2023 11:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5y5oEQVKFbLVTsye6xdv3mZgAfUbatPDH3ykig8+Xq4=; b=R9Zxect55c4imj SV0HJun1X2Gs8ERFEVU13LZShlrjqGCRdrmyY8OnzRYvLrAV319LTRTv1rGKmC7dnzpYD1/HRtd/7 a6XW4oJ7geQO9rXo8kPMayy8bpPlp9So6L7vInWx762NVSqGVPOKxpRxxr1pGMx00jRtQN/1UQiut G5nQDkor4akWtXuuV7qcaHZ/J7nSUV7znw9CPELDddOSe0bM5kO4cW4dipU+2SdC/4vFz+dxAYSft IOKGHXH1CcF/tx+IgRRb7fLK/TbwTtdhzy56YTa1F/XK5cVrvoqKYPsFq7cDvzXMLtEORpHDbjTbk f1QZZl4cudqJn27LbF+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbgZU-005Sji-4f; Mon, 13 Mar 2023 11:42:32 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbgYE-005S8O-IO for linux-arm-kernel@lists.infradead.org; Mon, 13 Mar 2023 11:41:16 +0000 Received: by mail-pl1-x635.google.com with SMTP id k2so4706888pll.8 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=7w9VRyt+nXm0qW1m3S2rZlDFJYsI5HI3QcJ0JmGhdx+zOMzA6M2DABYaM4z3HLUXTT TXl/RLiU9eWqTDCjSE+/DQBelt3sZrCBIKu/USV9wIICxrg+sGeQY1Aug/ui/QlHSm3o YeGwhxVwn//n6467fV/97vTpGP45fI8tLVbFEJ/Zu/W5EjkcPb1uVKbPI0wchbe/oaMV l/pkGWIg2QJ9gC+MNaHZ2JqQDVErFpAqhhlv4n9yCdaOLrQzWLHiLUh3lGpiybnmS31B vI+fZXhpI6AGCRfCoyvHFqrglKL9omD4XGG+g7EuNQ/4g9mPAQQubcuyujOnWMDCad3d JlhQ== X-Gm-Message-State: AO0yUKU5EnCiz8DlCiff1noeHe6zzFgDHZ7Sij5vxZGCX5GQrjqnPmwV VbpMdL3iywES+MfbF0620XoDed4vX5xb8xsYS7HSgJe4 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_044114_657808_A8E555CD X-CRM114-Status: GOOD ( 14.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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);