From patchwork Wed Jun 26 20:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13713398 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 2C475C27C4F for ; Wed, 26 Jun 2024 20:38:16 +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=tCaWPauD9DYnL2p41QgtYliLPX lBBnOaGKyb+9TKxWvi2NqzGJtT09Yb2u2ne7mRALhJX6GmKVgMa9jc05acDUS3NomeSBeBJomGNU9 IJnVUL9EWXgLUsBdRzd4CqaNwZ982daqXrpqUs9hDlOdb6aHl/CM9x0csOwMfab6YP1eqSNcnl5Pv N6/wyyqcoDCjJR0uoSP0HjV9uuxlUR9mpYF12C5Sz8Upr3iWAuXF34BspkOmYEodZckDS/tRJ5WeP cdh+Wz1ATkcT4fwtiVayP/fG/lTVBzMSGXlF+VHB9zpd74+CwdiDVBBITTrPsuF2mtzjz+BD1SFNy 3o/nfhEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMZOy-00000008Fo1-3og0; Wed, 26 Jun 2024 20:38:03 +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 1sMZNy-00000008FCH-3ggH for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2024 20:37:01 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-646f73e4354so44112737b3.1 for ; Wed, 26 Jun 2024 13:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719434217; x=1720039017; 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=S5aH8amcxbW9gZIq3orgT4ctT+hHC6S2V8qppK9jnb1Lw1myhJHJsQqZ+oHH9E8zE+ bXh3IC2gWnQbBGI1VVw6nbRAKsXA3bjT1A5LnF4TuAdg0F1G0D3NvgCXIXJEGofSY+hJ zNoOiX9ZHZO4ggN9agHDrE51KNklY8EqKDQImuFlOln9dclor86F3qvN0d1PcftLGjmB XsqpBCfMGraA2rQ2EEPL2UorCrWi9m2epBieWMW+qLH88NTclijgEwqbUfjKJrSBUCBO oxmG2mu9DUcA2a+TZu8U/VegHbdED7o66TLgExbcNF0pC6uQt2IFD9haGw2KucHFxzHy jMMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719434217; x=1720039017; 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=FsjFFMi4ZK+lW8LO0+/aRFiKfxVLVXG7edYWR0fEEl+gTw9BNxks0aNuVf7LJWFIxB 3laa+CLNORSbMUrNyacF8VYFVF6mBcxIwW0TMUudv8yIY7Y1Tv71PkTCtlA6WUUCgeKw cevbV8chPCyDG4U4qkK+acr/V7XbJAS8iZdRJ1uupZt76Ql5i8RwRSNGdSTo6dUlalb8 8u9LZ2VhyUPk2YlfyMCXMC6OqmHXs+Ybr0yo2QOVT8LMyktjbzGvhM+IZ6unGMjDa9Hd mZ+8BbPrpnQvovXjMge2bBG63vOru/VPck0++WHCzTJOwdeVE8LbNvsrX8iEK9RHiY14 X9hw== X-Forwarded-Encrypted: i=1; AJvYcCU3jNEzkN4rA0TQQ1mIuYjYCaHF+nhZ1GoKqH4e3fuR25g5wSS4jNwjl2q2IXqm9AkfetUQ4NvbhzocOBd1efs6Dqwrd2hiFcwyN5yI7JmZ3wkzyvg= X-Gm-Message-State: AOJu0Yz+skng4ntqeVvkuoERxLiIwqnlbD5188zOZR9RcRN8815oKw+q L2/0+hLH28NH8zyugpIgXdWreQyxkX8XMPn2C6JjzjXakDAEVL8xt1dH1BOtGHadiu4eDYnQzVb 1ow35gQ== X-Google-Smtp-Source: AGHT+IFuUkZI1xUb4dQtuVFreG6sSaXi+9c/mJnE0USxl2dca1+VIZOjUXTn6HLYlU8i1RaN2vfEqGJqEkiE X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:23a1:25b9:2412:56de]) (user=irogers job=sendgmr) by 2002:a05:690c:3602:b0:62d:a29:53a0 with SMTP id 00721157ae682-6434041982bmr1581297b3.7.1719434217307; Wed, 26 Jun 2024 13:36:57 -0700 (PDT) Date: Wed, 26 Jun 2024 13:36:10 -0700 In-Reply-To: <20240626203630.1194748-1-irogers@google.com> Message-Id: <20240626203630.1194748-9-irogers@google.com> Mime-Version: 1.0 References: <20240626203630.1194748-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.741.gdbec12cfda-goog Subject: [PATCH v2 08/27] 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-20240626_133659_034679_6D796876 X-CRM114-Status: GOOD ( 12.86 ) 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;