From nobody Thu Dec 18 05:34:17 2025 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B0541991AD for ; Mon, 12 Aug 2024 20:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495668; cv=none; b=ZYulvUZ5iC2fq/TeAQqhEKttFeHsnMs2LYhLtnidRvouWRUihQf/4925NWPj5mpi77thDDQKf5WORVijrZzt5TddG6zymM00k0R2Aa1ziFvrNYq8e8WgPUL9932UFdOWc6wI6rPGwjKXaBAedJ2sVs1sUWgLszMon9HpK5v6U0A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495668; c=relaxed/simple; bh=Qrok1azG7UxnWaLySV6ZsE5DB8YS3BiC3PmFMnVvQAA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=BRzzp7vif1WeSRzmyYijlszpZgFW9J7KIn7tPrPzZSYrfJjXyTaaYLbJZW8Tgz49T/tQMyZQ0835yYD5yg3oQE+1PKEz5Z7rLGqorSGTEP3+g2G28rWN2El4WLyBUorfNhi06gaaLzpaGomz209ki2VZGZvqfoI8SGErTOFFa4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=AwPm+EHH; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AwPm+EHH" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-692aa9db2d5so96227827b3.3 for ; Mon, 12 Aug 2024 13:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723495665; x=1724100465; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=gibdVPBI4QwODB2QVabO7wcogY6JGDVcaHEIkpe2Azo=; b=AwPm+EHHOIl64NO3n+8ug+lvDBjwVMerhy508QgjaFdHjzCHmzOUBnzqvKrq4nONuV MjLY4xAA1uRcitkBE37n+Zvi9M1xKyCOtjJlJaeHNtBSjL4tpcMCnqwpCEilzZwoL3SP ebt7aKgabkMDwttrTSvvhYKMrSRwafUdwL6SbWxJXknGy3OTvonSGRzWaW/USQ3R6EM/ nuyvxS5hG6zUGcc/cSJEH6ZzaEYXv8+pwi0w0y+TWB5xf7zEN5ShUWptzvFOBrU9v8b1 U2rkwk8c7DmHX7/6tFUyVutC2JeRHtFXG5eEC7vlMJJRmEZqLaPc+YIeZR57QYzUzHJ3 S5IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723495665; x=1724100465; 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=gibdVPBI4QwODB2QVabO7wcogY6JGDVcaHEIkpe2Azo=; b=IZ0jYVHm61h8rYKqyBugCmsFJKtPb7kUv5E/GTWaVDlTuQJdUhMxhxkwXnkD/ON+sy QQIvUGMlLFYUtoTf2x+29jzHmVIMkcleNeeh3N90JscMQ3SmnXxG9Kn03ckN3gmNFyoD QOG4r9MCNA8+4/CxCAXNCrPeyISQYzXXzNux9ZNbhnFsRO5DZXIz1GNJSDyd1pmHFC+K VSn71NOy+smDMLX45dFjSiFWtNWjKcXyn7DsMN1+ppcS7WC1gidQplpMJLF4l9Rbgzkq b4L6fVfcrMq9x3GvwnEuVUEbHuY8vyOcljPTGsAoF5UDntBmsyJT1XwURz0wXbjVQciw 6qow== X-Forwarded-Encrypted: i=1; AJvYcCVKQdczj8mv76TVEaX119Zj39OFv7rFwJLAiByJZdwYbExD53Pw7hVzDeHmEpcYgr8UrZc/HINGlWoqrKhNfzUbEVGRrTNA3feDcX0x X-Gm-Message-State: AOJu0Yw4/TdHehCRCTCY3AkMAhQ8oKm4zu5mCQXqkLwzDXVfYtRxnuUS Bkb5V7GRYVFfPP6RbVZQH/18KJhKTU5EQLEHlhajO9aEP/SrDviDidXSZLz0Afc8H/6HZeLVcco WfHyFYA== X-Google-Smtp-Source: AGHT+IGcoDxlV6ReTDwa/pGeVDkEANIGIX3sSvxNGP6KX8/qg5oXdLKJGk56Ow4wd4MdzjIcDYZvPHQNsid+ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e7f1:b90:720c:35bf]) (user=irogers job=sendgmr) by 2002:a0d:c303:0:b0:61c:89a4:dd5f with SMTP id 00721157ae682-6a96c6090efmr432737b3.0.1723495665556; Mon, 12 Aug 2024 13:47:45 -0700 (PDT) Date: Mon, 12 Aug 2024 13:47:01 -0700 In-Reply-To: <20240812204720.631678-1-irogers@google.com> Message-Id: <20240812204720.631678-10-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240812204720.631678-1-irogers@google.com> X-Mailer: git-send-email 2.46.0.76.ge559c4bf1a-goog Subject: [PATCH v7 09/27] perf lock: 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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-lock.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 6efa9d646637..2c216427e929 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -1933,22 +1933,21 @@ static bool force; static int __cmd_report(bool display_info) { int err =3D -EINVAL; - struct perf_tool eops =3D { - .attr =3D perf_event__process_attr, - .event_update =3D process_event_update, - .sample =3D process_sample_event, - .comm =3D perf_event__process_comm, - .mmap =3D perf_event__process_mmap, - .namespaces =3D perf_event__process_namespaces, - .tracing_data =3D perf_event__process_tracing_data, - .ordered_events =3D true, - }; + struct perf_tool eops; struct perf_data data =3D { .path =3D input_name, .mode =3D PERF_DATA_MODE_READ, .force =3D force, }; =20 + perf_tool__init(&eops, /*ordered_events=3D*/true); + eops.attr =3D perf_event__process_attr; + eops.event_update =3D process_event_update; + eops.sample =3D process_sample_event; + eops.comm =3D perf_event__process_comm; + eops.mmap =3D perf_event__process_mmap; + eops.namespaces =3D perf_event__process_namespaces; + eops.tracing_data =3D perf_event__process_tracing_data; session =3D perf_session__new(&data, &eops); if (IS_ERR(session)) { pr_err("Initializing perf session failed\n"); @@ -2069,15 +2068,7 @@ static int check_lock_contention_options(const struc= t option *options, static int __cmd_contention(int argc, const char **argv) { int err =3D -EINVAL; - struct perf_tool eops =3D { - .attr =3D perf_event__process_attr, - .event_update =3D process_event_update, - .sample =3D process_sample_event, - .comm =3D perf_event__process_comm, - .mmap =3D perf_event__process_mmap, - .tracing_data =3D perf_event__process_tracing_data, - .ordered_events =3D true, - }; + struct perf_tool eops; struct perf_data data =3D { .path =3D input_name, .mode =3D PERF_DATA_MODE_READ, @@ -2100,6 +2091,14 @@ static int __cmd_contention(int argc, const char **a= rgv) =20 con.result =3D &lockhash_table[0]; =20 + perf_tool__init(&eops, /*ordered_events=3D*/true); + eops.attr =3D perf_event__process_attr; + eops.event_update =3D process_event_update; + eops.sample =3D process_sample_event; + eops.comm =3D perf_event__process_comm; + eops.mmap =3D perf_event__process_mmap; + eops.tracing_data =3D perf_event__process_tracing_data; + session =3D perf_session__new(use_bpf ? NULL : &data, &eops); if (IS_ERR(session)) { pr_err("Initializing perf session failed\n"); --=20 2.46.0.76.ge559c4bf1a-goog