From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f201.google.com (mail-dy1-f201.google.com [74.125.82.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 05927477E53 for ; Mon, 18 May 2026 15:47:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779119249; cv=none; b=Q4k9xbbjQXCeHpLdZSZy0Ur43mOI2BusD7bJbsl/yyDlQ18wpkyV1xLUrMB1JzwP+KPwKp0rcd336bSgl3BH2wP3nKYFtgGV6mEKaQ4c98RpiwsvapbhoJF/cGobB3fsSZFCzey/baimsIATEOZKCQJUAljhX3v2gwj56qtj7n8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779119249; c=relaxed/simple; bh=X/Y6Y0RSQ8C+MKLNRZgURcIaY/WnI4mafzsUsFyDboM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cpsD4pvoSX1VCtAaXslzrF9dQ++LD7YmmRf4DOgNRb6YC0zCYUstmmp7EtHE8M8LvqsIA8EDiV812fcUZY2pvtRHb4jLynyEvUQdj0C3khcr90llT4NBZB49DZ/1cJO3OcC2zYj0c2iSy5yl75qxna+mgbypvj+WUAOuKYWRUtg= 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=H3WbO5xN; arc=none smtp.client-ip=74.125.82.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="H3WbO5xN" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-2f1383b7439so2650335eec.1 for ; Mon, 18 May 2026 08:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779119234; x=1779724034; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=TX+St+pVYkIq20j0v2ezoU/ohjaZ4xJX9nTu6/yN9F4=; b=H3WbO5xNS6Bmeu7nNWGPMsAcVEgU6/YV9eVWoy+g+luXVVs48rUi4obquBoXb2SyLp Tche+46vrriJCC6vuVwaqXftekc2S5JMBlK1p0KGPgI5ukrlU4gEQo+m6AJhEUQ3GPW2 lGN2q+c/pOXy0WMs/Tcj+DKtuJKhB/vr7ph1H/Qfh2VAlLqvmYBQ4JmQsry1A1ERVicE uQ9guDW60l5nTGLNF7sffSQUVLDWQ6pWN4N2ZFx+fwXPy5a4n1g54RjN/dqxCbXyMaHV oCHF0iYtW+FBGWvmnA5m0g7edOyy9ESTxMHIWWg3XTcwaOtSPlrCh2lr7mPJSjGBoyTy cLcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779119234; x=1779724034; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TX+St+pVYkIq20j0v2ezoU/ohjaZ4xJX9nTu6/yN9F4=; b=mp4q70gSurGTVqrbyqF7nw/2nLhGV1+pOzVHLW5v9jCP6yf7I/KMS/bmW6yW1pnwKZ /7Wy5vkXO952rVTl7jl1c9kvdBg3sVK5cyysQPy3YcqcZFy0C/vq5S8PoCaKzjWAsLCy QPs9fWKnf8fQwE0E10/QCmHhFRT0bPPqWBKgD5o3lXtByB0Kgts4zuJRvXvzCbUe8/zs ueN6GfVRo2IKqVBUQZj+HG0WBfBQI/MKvlD3UPr6Sr0DskOzAkOcfw8a37MQ1MhwyXRx ANYV0YKAvbMDLQXMlwtr0JtDXBT74cqZNraG/0+6ylCQyiU663BHH46+8tQLLi0lk+xP w7iQ== X-Forwarded-Encrypted: i=1; AFNElJ/VxaIm5khHAMIa6lTsksKp1L1b/mdzgKpfKDJhCyP0fTpI8VsM6yMl8ZER6skY3viwV8mKwrMMdJNF7+M=@vger.kernel.org X-Gm-Message-State: AOJu0YyCgywyl8J795HLpeHmyh4DyNPeqn4CRhndEr52oTK+WI41Bhel S/2EOEDosAVeKXfLALa+d2Cb6ZVSB80WxbZ1d5BlKfPm9YSw9cLDPzWwzfD5YcP/EDpOKj/jFGi tCedyQQt8Ug== X-Received: from dlad4.prod.google.com ([2002:a05:701b:2204:b0:12d:cbbc:2a7b]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:f8c:b0:12c:aae:7b43 with SMTP id a92af1059eb24-134c8d4f504mr8212918c88.24.1779119233477; Mon, 18 May 2026 08:47:13 -0700 (PDT) Date: Mon, 18 May 2026 08:46:38 -0700 In-Reply-To: <20260518154638.2798789-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260518044740.2526802-1-irogers@google.com> <20260518154638.2798789-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.563.g4f69b47b94-goog Message-ID: <20260518154638.2798789-15-irogers@google.com> Subject: [PATCH v7 14/14] perf build: Convert llvm-config shell queries to simply expanded variables From: Ian Rogers To: irogers@google.com, acme@kernel.org, namhyung@kernel.org Cc: 9erthalion6@gmail.com, adrian.hunter@intel.com, alex@ghiti.fr, alexandre.chartre@oracle.com, andrii@kernel.org, ankur.a.arora@oracle.com, aou@eecs.berkeley.edu, bpf@vger.kernel.org, collin.funk1@gmail.com, costa.shul@redhat.com, daniel@iogearbox.net, dapeng1.mi@linux.intel.com, dsterba@suse.com, eddyz87@gmail.com, howardchu95@gmail.com, james.clark@linaro.org, jolsa@kernel.org, leo.yan@arm.com, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, martin.lau@linux.dev, memxor@gmail.com, mingo@redhat.com, mmayer@broadcom.com, nathan@kernel.org, palmer@dabbelt.com, peterz@infradead.org, pjw@kernel.org, qmo@kernel.org, ricky.ringler@proton.me, song@kernel.org, swapnil.sapkal@amd.com, terrelln@fb.com, tglozar@redhat.com, thomas.falcon@intel.com, yonghong.song@linux.dev Content-Type: text/plain; charset="UTF-8" In Makefile.config, CFLAGS, CXXFLAGS, LIBLLVM, and EXTLIBS were assigned using recursive expansion or appended with raw $(shell $(LLVM_CONFIG) ...) calls. Because these variables were expanded during dependency evaluation across every single object file compilation rule, Kbuild continuously re-executed llvm-config forks nearly 200 times during incremental builds. Convert llvm-config shell queries to simply expanded variables (:=) to ensure Make evaluates LLVM compiler flags and library paths exactly once when Makefile.config is parsed, eliminating ~185 redundant sub-processes during build startup. Assisted-by: Gemini:gemini-3.1-pro-preview Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 26de7528d6ce..b56fa8419f7d 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -925,11 +925,14 @@ ifndef NO_LIBLLVM $(call feature_check,llvm-perf) ifeq ($(feature-llvm-perf), 1) CFLAGS += -DHAVE_LIBLLVM_SUPPORT - CFLAGS += $(shell $(LLVM_CONFIG) --cflags) - CXXFLAGS += -DHAVE_LIBLLVM_SUPPORT - CXXFLAGS += $(shell $(LLVM_CONFIG) --cxxflags) - LIBLLVM = $(shell $(LLVM_CONFIG) --libs all) $(shell $(LLVM_CONFIG) --system-libs) - EXTLIBS += -L$(shell $(LLVM_CONFIG) --libdir) $(LIBLLVM) + LLVM_CFLAGS := $(shell $(LLVM_CONFIG) --cflags 2>/dev/null) + LLVM_CXXFLAGS := $(shell $(LLVM_CONFIG) --cxxflags 2>/dev/null) + LLVM_LIBLLVM := $(shell $(LLVM_CONFIG) --libs all 2>/dev/null) $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null) + LLVM_LIBDIR := $(shell $(LLVM_CONFIG) --libdir 2>/dev/null) + CFLAGS += $(LLVM_CFLAGS) + CXXFLAGS += -DHAVE_LIBLLVM_SUPPORT $(LLVM_CXXFLAGS) + LIBLLVM := $(LLVM_LIBLLVM) + EXTLIBS += -L$(LLVM_LIBDIR) $(LIBLLVM) EXTLIBS += -lstdc++ $(call detected,CONFIG_LIBLLVM) else -- 2.54.0.563.g4f69b47b94-goog