From patchwork Fri Jul 12 18:10:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13732142 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 2E9E4C2BD09 for ; Fri, 12 Jul 2024 18:14:48 +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=byfF1KS0n4MzwFOMTsFSRoLAA/Zhxt2Mi8AKEzVn+O0=; b=yyjDZMs1vYtwUloqaBFnrfHMVb 7L2aF8O450YNWD3U47XU8btn48l6Uqv25UUKwYQ+BOyQwshgIejTZMLt16ums+8Vf4mEqpdohcwLo x05BbENT84y1WJgnC6D3fixw/uJ0Z8r+8cFpGJJpobDuVyTHx4jD6hj2umVgX7UZFEgJsjVdI/off WtNRtr3qxK/ggHE1o2FYO0n3gVUs0zU55Sy42HuCuBsXrZmRprCBziyJmimwn5Ljh5T1tnTYE4w6Z HB3aElhemsVgmChCr+KHQhCNkrOYinvyoxEH8n5dRVOKnrMg+kUyvSfAkkT1lj2UlRjFCS4lnQs0G Op6gDQIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSKmx-00000000wH6-3EGr; Fri, 12 Jul 2024 18:14:35 +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 1sSKkw-00000000vIx-0Ofc for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 18:12:31 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e039fe0346eso4189855276.1 for ; Fri, 12 Jul 2024 11:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720807948; x=1721412748; 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=byfF1KS0n4MzwFOMTsFSRoLAA/Zhxt2Mi8AKEzVn+O0=; b=Oka2O9WqZbUWZFVXS/BVPQhOAx+njpEg2nP7Oz8ZBWH9iVF4xN8EI3aC5NMYRdchp/ otcGUgo8PgUZoI7NsootiPI8o1ADormQMrUhPueFCoC7mwOlSE1NM4w1/McxjNHVhYQU 9aVYO2A2jTXfVQna9X7BWQa8EKgJ9+Kk7RKtF0/jz+F0YGHmGaaWpiyPlqdfxACrqBxi Izh2QUD67UGhWHH2UiWDs7jZw6JeB9qki6MdZw8dVQzMRFj4htCv+qkLVJxD4VTLqCDO Lw36ZuoNOdPyvOD1JuCgMmgUBX5/W+jABTA6tJVPmQw+PgM8FfMgwL2k374/MjmTRpWn lQhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720807948; x=1721412748; 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=byfF1KS0n4MzwFOMTsFSRoLAA/Zhxt2Mi8AKEzVn+O0=; b=By5YRwvt+FoKD51Cr0WhqpCTdrByFmvMj8YyGsIuxdmKiKMCk2M5rf7Gno5nrb8DwU EQhtpvQHQchWpQTfYa6p/c90nYDUi3Lrv0QDk+HvRaFnTTf1wabrTDKXQqiziupMCuDq EAZ9jA6M43EZomVLD53yFHARxo18bEVPG5aqABIxjiKs1ftjVsZ9PVSEBGhU+n4mnqIB 5m/5SnsU79aNOrzdgcZ1AyiA5RfaOGQmfReLHEynkgj/LIycT8vMhNBNxuMxUYo4CN2d OZpTd3qX2zWjIeMrYSThGd34gmLB9X3DyCFIo7pJGUXmhnL1Nbiqd6OXJ8PtOMgL6V5g +sOg== X-Forwarded-Encrypted: i=1; AJvYcCURqf1GbXwTByW5kA7wAqQqy7pLoPaYJx8XCdMIkaKRR+QTOIfAFzTCpXekt4r0OxuT2eePG1q7k2ZwizgXSZ3IF2Kj1HbHsxrAob3hC+32//Sz/+I= X-Gm-Message-State: AOJu0YxgbYCPpiPQrOoo/munxP784WyS4JEBiSBzcA6JtGDrLYSdxvE3 Lt7yMlE8e1Ts7HPPRtQT4p9s30Fn/f8SDZxfJ48Q2QN+Qempk4cDfFUICzTMe5vCayoNn5a5y3M +8CrSUg== X-Google-Smtp-Source: AGHT+IEDxd6QeNUvZWRQqBsrbT8Osq0gxiaqUBWAnKcNrHvP+zbFleqnJBw9O4ojwhJ+vbzxebyogc6l9y+y X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:2e7d:d47a:a0c6:e3b1]) (user=irogers job=sendgmr) by 2002:a05:6902:228e:b0:e02:c06f:1db8 with SMTP id 3f1490d57ef6-e041b051473mr24667276.4.1720807948405; Fri, 12 Jul 2024 11:12:28 -0700 (PDT) Date: Fri, 12 Jul 2024 11:10:49 -0700 In-Reply-To: <20240712181108.475336-1-irogers@google.com> Message-Id: <20240712181108.475336-9-irogers@google.com> Mime-Version: 1.0 References: <20240712181108.475336-1-irogers@google.com> X-Mailer: git-send-email 2.45.2.993.g49e7a77208-goog Subject: [PATCH v5 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-20240712_111230_143380_959A4B00 X-CRM114-Status: GOOD ( 13.02 ) 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;