From nobody Sat Nov 23 18:18:04 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 E2CC91547FF for ; Tue, 19 Nov 2024 01:18:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731979095; cv=none; b=KRbQMrBY7p062XiTWH6sTzN3iahqQYkHeXc28fHI+VeDGyhZU5hpySVHMifh00G1oqxex7KnKMQGvWPv+fIytz8qNHCEsQEl4o7HUSx3KEpU4zpnqfVYkSDvceBHm2IIZNFfLE2ashNMt0AO2FYa8gVyE1SzCuX42pxKWQJToGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731979095; c=relaxed/simple; bh=TbR4BOS7mQPgSaQH1tcutfX+y86KQP6eWwApMmstiek=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=HAHaDDVydP9qDCv99MQaM7mj9CqfhwiHbkXKGblQyjqdUFHfj04izIyal7IDBEsD9Ode80nSGWuKKS4/44lXMCITUkC/ZXOD7ADXH1ejy+bLC7j9eG3W0y4ZLwyT4fQlzGqIWWwyrBujP4gtM2RVLOwioE5Q+LrlDw77stXuC2s= 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=qpaKDP7w; arc=none smtp.client-ip=209.85.219.201 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="qpaKDP7w" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e3314237b86so3452091276.1 for ; Mon, 18 Nov 2024 17:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1731979092; x=1732583892; 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=wrXtQg5+ba7sDCX0vVayflm8VxueJWYimdy8axJrFZ8=; b=qpaKDP7w4gMaer+TNpEapxNciCXSt/vCaqUK7nXn4ZioLbdg+6sqsjPRr6nE5vzNCE 7RcgHPnKbdP1p1lmGlCw8k/sHQrN+Cl+gGw3qZWtEepdX4fA7rccs4XZ9yNq/tJdJ6uk yTsYYPd2oh9c+tG7GFLdKNHl7WEzN0eDuMjQ+XSLTUjYkH5rMLSyewX5U/VNTmDdo4Ko gDI2oYxoxAxlFkrb9s/UYH5v7bEzpKc2LqV4bfv8UHvxGYz01Xd5eyDB3SnNsEy4rMRS 64RT+wnlRyil+TQOPf0Z/mnY23w94O90AsyzWFy8dV0vpdvwPX/l1G7wyTYJK73ZECli L9zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731979092; x=1732583892; 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=wrXtQg5+ba7sDCX0vVayflm8VxueJWYimdy8axJrFZ8=; b=kvjjXAGCmbjgazYmpwvBho6oLhRLwMzNYF1jCa949ottPCSroS4tPb2+Uu8GXus0kI v+vWvEDkDNp2DR29edOrWv9vBO5ai/EnmMHirT2jSlPTxD3YzYJdknXF6QVnpWJZgAut BgNdf1SFYYuNDAiVug3505d90Dou2r8Gv6TAc6cFO/+nAFB5A/7c47EQHg9OssW2zwCE vBGzDWmBym8+Du2143kd8HMiTviHINJnsH2V/1fBOg+5jUfOH/2reHEF2vzRxHU62mwp YDAt1LpDAjb22hwPG2DSYERhnPgnmd0uvw57XNRejM64RalCkpXSh/Rm5EqSX4S3oV/y 1OUg== X-Forwarded-Encrypted: i=1; AJvYcCUxLhUjYfKMG92D0R5ZZXsaYqNHm4Mt11g40mylsviXl2ubjYjxvetjKXeYPLZVwHX/Xul7nhFcFCd2sy8=@vger.kernel.org X-Gm-Message-State: AOJu0YxXLnOmj3YMUmEiKRQP0kyK4GPhzYibaW02puW9qFNT1y4v++Mo WWSR4Immn4sFEQWEGn7T6cQZPhVRK2JXNrqOtt4+NNIy0OzGQaEobQqIjZzwHng+3n9mFc5mKyI rcdV2jQ== X-Google-Smtp-Source: AGHT+IEyRYVBQBZBqB+W3paPg6O1q0NERXZbtpznVI+9FR9vI2hLxhnsONIVMlmtNtw/uYgBLJjH//9eTJUQ X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:22a4:ded5:5c37:fcc7]) (user=irogers job=sendgmr) by 2002:a25:8392:0:b0:e38:1293:ee43 with SMTP id 3f1490d57ef6-e3825d2823amr11237276.1.1731979091806; Mon, 18 Nov 2024 17:18:11 -0800 (PST) Date: Mon, 18 Nov 2024 17:16:38 -0800 In-Reply-To: <20241119011644.971342-1-irogers@google.com> Message-Id: <20241119011644.971342-17-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241119011644.971342-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.338.g60cca15819-goog Subject: [PATCH v7 16/22] perf bench: Remove reference to cmd_inject 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 , James Clark , Howard Chu , Athira Jajeev , Michael Petlan , Veronika Molnarova , Dapeng Mi , Thomas Richter , Ilya Leoshkevich , Colin Ian King , Weilin Wang , Andi Kleen , Josh Poimboeuf , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Avoid `perf bench internals inject-build-id` referencing the cmd_inject sub-command that requires perf-bench to backward reference internals of builtins. Replace the reference to cmd_inject with a call to main. To avoid python.c needing to link with something providing main, drop the libperf-bench library from the python shared object. Signed-off-by: Ian Rogers --- tools/perf/Makefile.perf | 7 +++++-- tools/perf/bench/inject-buildid.c | 13 +++++++------ tools/perf/util/python.c | 6 ------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index d74241a15131..cbcb698cea38 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -487,6 +487,9 @@ endif EXTLIBS :=3D $(call filter-out,$(EXCLUDE_EXTLIBS),$(EXTLIBS)) LIBS =3D -Wl,--whole-archive $(PERFLIBS) $(EXTRA_PERFLIBS) -Wl,--no-whole-= archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group =20 +PERFLIBS_PY :=3D $(call filter-out,$(LIBPERF_BENCH),$(PERFLIBS)) +LIBS_PY =3D -Wl,--whole-archive $(PERFLIBS_PY) $(EXTRA_PERFLIBS) -Wl,--no-= whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group + export INSTALL SHELL_PATH =20 ### Build rules @@ -735,9 +738,9 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BI= NDINGS) $(OTHER_PROGRAMS) # Create python binding output directory if not already present $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python') =20 -$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.p= y $(PERFLIBS) +$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): util/python.c util/setup.p= y $(PERFLIBS_PY) $(QUIET_GEN)LDSHARED=3D"$(CC) -pthread -shared" \ - CFLAGS=3D'$(CFLAGS)' LDFLAGS=3D'$(LDFLAGS) $(LIBS)' \ + CFLAGS=3D'$(CFLAGS)' LDFLAGS=3D'$(LDFLAGS) $(LIBS_PY)' \ $(PYTHON_WORD) util/setup.py \ --quiet build_ext; \ cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/ diff --git a/tools/perf/bench/inject-buildid.c b/tools/perf/bench/inject-bu= ildid.c index a759eb2328be..f55c07e4be94 100644 --- a/tools/perf/bench/inject-buildid.c +++ b/tools/perf/bench/inject-buildid.c @@ -52,7 +52,7 @@ struct bench_dso { static int nr_dsos; static struct bench_dso *dsos; =20 -extern int cmd_inject(int argc, const char *argv[]); +extern int main(int argc, const char **argv); =20 static const struct option options[] =3D { OPT_UINTEGER('i', "iterations", &iterations, @@ -294,7 +294,7 @@ static int setup_injection(struct bench_data *data, boo= l build_id_all) =20 if (data->pid =3D=3D 0) { const char **inject_argv; - int inject_argc =3D 2; + int inject_argc =3D 3; =20 close(data->input_pipe[1]); close(data->output_pipe[0]); @@ -318,15 +318,16 @@ static int setup_injection(struct bench_data *data, b= ool build_id_all) if (inject_argv =3D=3D NULL) exit(1); =20 - inject_argv[0] =3D strdup("inject"); - inject_argv[1] =3D strdup("-b"); + inject_argv[0] =3D strdup("perf"); + inject_argv[1] =3D strdup("inject"); + inject_argv[2] =3D strdup("-b"); if (build_id_all) - inject_argv[2] =3D strdup("--buildid-all"); + inject_argv[3] =3D strdup("--buildid-all"); =20 /* signal that we're ready to go */ close(ready_pipe[1]); =20 - cmd_inject(inject_argc, inject_argv); + main(inject_argc, inject_argv); =20 exit(0); } diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 6851f9b07e04..5e6db4b143a1 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -19,7 +19,6 @@ #include "util/kwork.h" #include "util/sample.h" #include -#include "../builtin.h" =20 #define _PyUnicode_FromString(arg) \ PyUnicode_FromString(arg) @@ -1309,8 +1308,3 @@ struct kwork_work *perf_kwork_add_work(struct perf_kw= ork *kwork __maybe_unused, { return NULL; } - -int cmd_inject(int argc __maybe_unused, const char *argv[] __maybe_unused) -{ - return -1; -} --=20 2.47.0.338.g60cca15819-goog