From patchwork Tue Jun 25 17:25:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13711719 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 CDD69C30658 for ; Tue, 25 Jun 2024 17:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0D3Ll4YJxFSzRg0DxL5KKZwtYxMwAkaxOfW7jAWfCz0=; b=qeysIkIfKHnJMvZ7i+E2fqlXhG cRxw2Jl2OZWgqIvLys2f9bJt7LoM60WNVeqygsdSX+oehNZQxjFCEKMo+K/WPmfWdsgb8ejDnFGMs CIgCg//6VoP+kYHGMDGzQR0v7t4WAJfjq3zG5rBAhAXbXekPnf8GW9ZsyZaqkaKXZW/nxM21/XfJV WPrnSy4nSSnpCHsHq7Ks6/09zpBYjCIVMEVrL0Jx3yqlU7uM1LYp0KaM1PxN9i+zbX8iH1TB1YSSc k/F9/YWlTLwOCnUafsxIuhsuSMDRCRfhZ1wicuCe+gl+Lq+Rhj8fmliG/jF/BOygHlKSj+lPfHhT1 lKMEsLyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9wN-00000003slK-26NV; Tue, 25 Jun 2024 17:26:47 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sM9w0-00000003sVB-3YpC for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2024 17:26:26 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-63bf44b87d4so65856187b3.0 for ; Tue, 25 Jun 2024 10:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719336382; x=1719941182; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=0D3Ll4YJxFSzRg0DxL5KKZwtYxMwAkaxOfW7jAWfCz0=; b=GbW9Y/6m6BBw0ijdidjB8M1DzoABhc0UQTT/QiKUvMKpcBr69x6vkiHwAkoLUaPJyj qkapUnY/AoZLUDNUM9F2VqeFyyt6X5GnSzNDV7uiISoA+1j6m+Fqgqitdcl8wbrnRWTY tLwx8uITxnyOXW3AGfbrVsUN6FqtntZtDek6qxgtY3FUmt7AWwKGS/c2XmVQ2lnbM3Oi ZCAV4Kr4eQffwk+K17GmA4AWwLYHRLBXSDfOpjOkBjzwDL+DNkWV3JQXpuwQtFOJNsQs FaPLyHkn+MAncpUqtmAYJppLs1hR2Mj5jg6KpLm0o61aQToheR32vvuYV1/tZzz+2icG 4LsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719336382; x=1719941182; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0D3Ll4YJxFSzRg0DxL5KKZwtYxMwAkaxOfW7jAWfCz0=; b=T46GX2W8i+z9bj5s8WEi4KckPjeguXgRVhdq31dEaE2WDtrXz7e49FuyXcs3Q5zYvX NtVHjrWxF/+qUQF+X80draljK3/Okbf+rBD1lyON8BOSHcyRckmn+vsL8KrftfEBV8ZV YYQ7HSr8bwy3nfzrvs8vmckVIb9y8zGH29bVDRO77qcQ/qlghnBR6m2F23/HAQmc6UJ6 W3mb712veFVP+/RLOYFUdki1RbbsYxcRo79d+732HrASgmTmwDK279MXOQAF2iyotsZo NhPNK/hsV1oqusfAu3Aejx9qilR2jScysJqDEcZ/DS7Yhfk5RrHH5lfooYi/Opvu5Of3 0tkg== X-Forwarded-Encrypted: i=1; AJvYcCX503wrdLy+cfJBBnKzkhITe/Af/gTG74lzRFlngkvmtwZpA3GbifjlkRKA21LvLpMtA+mlRMnGqMvZqaVlifR7Sia4b/AyDxXu2pVrAab59WI7QIU= X-Gm-Message-State: AOJu0YwpZ5Ux5NZgLv/Lmq+CSm9aO3zCeXcYKb/cvj9wNEZhi7M0xF+a s7f7GruBjyIgPHzzVqs7fCIf39iREi/1vZ1qtglAEOCdfb2oXV793cQsy9lDtK9nOVGK6bw4gKs hMvDuYA== X-Google-Smtp-Source: AGHT+IHTa5kZKd9h8ifXYMe2T99DgFi/uV4x8OfhUXLRdl9AjprPNPjesq9BkyxfvYvf643IgrcWtu2wbIrp X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:b4cb:a52b:f9ea:8678]) (user=irogers job=sendgmr) by 2002:a05:690c:f09:b0:62f:1f93:939e with SMTP id 00721157ae682-642544fa2a5mr2623767b3.2.1719336381892; Tue, 25 Jun 2024 10:26:21 -0700 (PDT) Date: Tue, 25 Jun 2024 10:25:43 -0700 In-Reply-To: <20240625172603.900667-1-irogers@google.com> Message-Id: <20240625172603.900667-7-irogers@google.com> Mime-Version: 1.0 References: <20240625172603.900667-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.741.gdbec12cfda-goog Subject: [PATCH v1 06/26] perf kvm: Use perf_tool__init From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Suzuki K Poulose , Yicong Yang , Jonathan Cameron , Nick Terrell , Nick Desaulniers , Oliver Upton , Anshuman Khandual , Song Liu , Ilkka Koskinen , Huacai Chen , Yanteng Si , Sun Haiyong , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240625_102624_916996_283AE60E X-CRM114-Status: GOOD ( 13.06 ) 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 Use perf_tool__init so that more uses of struct perf_tool can be const and not relying on perf_tool__fill_defaults. Signed-off-by: Ian Rogers --- tools/perf/builtin-kvm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index a3b903cf4311..692267b1b7e8 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -1603,19 +1603,17 @@ static int read_events(struct perf_kvm_stat *kvm) { int ret; - struct perf_tool eops = { - .sample = process_sample_event, - .comm = perf_event__process_comm, - .namespaces = perf_event__process_namespaces, - .ordered_events = true, - }; struct perf_data file = { .path = kvm->file_name, .mode = PERF_DATA_MODE_READ, .force = kvm->force, }; - kvm->tool = eops; + perf_tool__init(&kvm->tool, /*ordered_events=*/true); + kvm->tool.sample = process_sample_event; + kvm->tool.comm = perf_event__process_comm; + kvm->tool.namespaces = perf_event__process_namespaces; + kvm->session = perf_session__new(&file, &kvm->tool); if (IS_ERR(kvm->session)) { pr_err("Initializing perf session failed\n"); @@ -1919,14 +1917,13 @@ static int kvm_events_live(struct perf_kvm_stat *kvm, /* event handling */ + perf_tool__init(&kvm->tool, /*ordered_events=*/true); kvm->tool.sample = process_sample_event; kvm->tool.comm = perf_event__process_comm; kvm->tool.exit = perf_event__process_exit; kvm->tool.fork = perf_event__process_fork; kvm->tool.lost = process_lost_event; kvm->tool.namespaces = perf_event__process_namespaces; - kvm->tool.ordered_events = true; - perf_tool__fill_defaults(&kvm->tool); /* set defaults */ kvm->display_time = 1;