From patchwork Thu Jul 18 01:00:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13735899 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 27A0BC3DA60 for ; Thu, 18 Jul 2024 01:03:36 +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=ai5lnf0BUO6/UnVTaHRIu7hu7sAuyoUd1EC+9E9ZCBs=; b=I9/eUJoulXBNjSUxHYuMRR5gru AF40laShHF5G8xtXljyQmtg16mRSXnEFrHFVYNCEN97ZKGyxMKblcLdpkie+5TWZfngp0AMD60G/q FSaO56PUtrT8w2Z1xVAykwhLnDSk0/KxSW2xboVtzVV7+9fZNfmbaEzEOBeP4PqfyAnMYfK36gXQa y/M5AFy4jec/aknZ3/GuSF5MDvFW5gLQRDrbytGXOubStQdz46q1V5N1twdG6BG65knVEmVJOqQaH phccX/y3ZMrVv87C2l8WeH9qK6CMBtRVXMfMa18MdjGenM0FbZ+grFkQGbsQ53K0sZrZyxBZPIGCL BbPHbsUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFYL-0000000FKd0-0JZl; Thu, 18 Jul 2024 01:03:25 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUFVw-0000000FJY3-3XCf for linux-arm-kernel@lists.infradead.org; Thu, 18 Jul 2024 01:00:58 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e05f08adcacso780614276.0 for ; Wed, 17 Jul 2024 18:00:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721264455; x=1721869255; 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=ai5lnf0BUO6/UnVTaHRIu7hu7sAuyoUd1EC+9E9ZCBs=; b=JLa2X/wigXr+eyybkI85QSSJ5UqdRrYtTOgVM6kPpVv3p+/JcknOIZ/h4DIGEU4Hho qdjbLSO28bAncZ6kjmea70vLhh+UNEQfq8pXHM5Q6l2kiOrnu2JHTNbhOGh2auiOKqfw pYquKxHRUVniEgr8JfPMWisC4uGy9ULeHue17yso3++8MJgCPJtMHqL12U/Jzg+02JJF Mzx/o1nKYL44AyTwQj7jkA10LkV7qX6xhFx0ySM/LFVvPwzJR412Qkh6JVgOhYwZYpKw eIWtRtgwz+N+scCRnFaN86NQDPCWWa673MVhbDqSNoHvLwG6AQrh95hKmwi65odd+zwq CsXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721264455; x=1721869255; 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=ai5lnf0BUO6/UnVTaHRIu7hu7sAuyoUd1EC+9E9ZCBs=; b=laByMS86J2XrUhZcJ4idZsN1+Pc+1UqmJfx/1xWxkZoCQ7kl7vBP4QNHXWOsgZP71D cvfETKoINRhX+xcs2M2+IHB/bqXr6qttBWW18o2bzHVe4Lm75ilopb5+A6jeyaRt/e53 HeFtQE1HGkyRJ71XCO8YdG5z5B660FzZFzAMuYvmpmrjOWOjGZ0PU0j5FfAVgkpkTRXY iob9ztIGJhGy2Vhv1Oq+Y77DYriU4Ac9m4c2OGdGFZe6NNqJJ0cPBFFD3PJMITKLowiz 7lNJEakaID1Pa2Usd3cDsIzNpNA7FpM4SKYde9Zz1+4GLq1t64z/iCVeJV7+k20gxlBD Tspg== X-Forwarded-Encrypted: i=1; AJvYcCXVsQzsEc4gO7SBR9v0rk1IcuveQAYROC1P7WgW+i/QQaFu3gJxGx676nrt0e+p36hoE/bu/7oRgtR5gd3ugwQNBom2qJtWZTttuZ/AQn/KtnLuLpE= X-Gm-Message-State: AOJu0YwDaV3XBTMQjsmPRwKITu7nFf17J8S4JEz98jDIyLalqw08P9lb Xa+77OLCLYaaUrpzzEVfUTjJ9PXOBR6rKWLGE2W3Q2ZnYZShwq9ws5dpz/ubKTFZz+Hauyjmxb2 pbUpCqA== X-Google-Smtp-Source: AGHT+IFez645P/F0hZdJQXU/7kuPyHdktbnSXSbfLcl/dMKl+NBTQzET3BcxRmAOKtpToRAendNoVwwOs114 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:940b:9044:fa83:4060]) (user=irogers job=sendgmr) by 2002:a05:6902:102e:b0:e05:eb99:5f73 with SMTP id 3f1490d57ef6-e05fe83bae5mr2806276.0.1721264455354; Wed, 17 Jul 2024 18:00:55 -0700 (PDT) Date: Wed, 17 Jul 2024 18:00:04 -0700 In-Reply-To: <20240718010023.1495687-1-irogers@google.com> Message-Id: <20240718010023.1495687-9-irogers@google.com> Mime-Version: 1.0 References: <20240718010023.1495687-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog Subject: [PATCH v6 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 , Athira Rajeev , 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-20240717_180056_908305_AE7C4721 X-CRM114-Status: GOOD ( 12.28 ) 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 Reviewed-by: Adrian Hunter --- 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;