From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796523964; b=XIZY6JwoTctXoTwLdD2txHQ9WuDFoiczBVxfEnow+PPKh1PkObSyBUJEqJo0uxQDKspj +8l1T5ggsed8/i5kKYpCjmRKuUchwn3avs2kGVpXIqg4l1ffycWNz+0VRWyG0GEXZsJsW HfqKtLI7W7Bbrxa/JyMaTOoEUMJBdNYcpT65WiEgBXxkeiq8B4jVqzu1o69zrmMlwN6jD ssCpNA5m+CqCZiQCynnWC/QG2XWcVHB84k0MOPe9PMm8Vuu+3R+35Wha1iNPB9KjU6iru FuCxktrDa70tH3d0r9YdyJi3xLejwO/CQelrLICqbkEs2JEo38dts8SGYY/XlUsMQqg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796523964; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=uIom+H6ytFAkjDiztqVUhQkl4f+WrzaO2tX1u64cUkg=; b=PoU9PteE6kQBfqIBeeH8fBYbtdTyB5TjhseTrO/OEvB+w7kMQe60nlmlGS6IfJrQXuYx JpFwFeqihY/rEzp8FBThSdEPJIQXKA63T7e6i+SoXcfSUxMdccJtdKVi5QccTpdvlkwZf LBs7hTH8Sra0pRP4FP3jBJXATWrviaE2e5kOtlFJCC8fErJk6mAYZ+WlDeAn9X8v33jqm iobBEmfjlnJnBq6Jk7zGRE2U3VzURDAwQbxCbgqCHWriLSGxjrflgWa/wPgvNBiKoBQAN Ga5NtQTUrUoYkrN1G4zWTwvULC3Pkte5ZR5HL9aNpX9lzshLHeWiPlUcaJfMoB/OplQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DVfx+MHD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89A69606A31F for ; Sun, 6 Dec 2026 02:26:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DVfx+MHD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 081101F0093B; Sun, 6 Dec 2026 02:26:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796523964; bh=uIom+H6ytFAkjDiztqVUhQkl4f+WrzaO2tX1u64cUkg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=DVfx+MHDv1ESUouaTRRAQ+WZJZ/X0TWCl+Q8eZ7lhu92s0icVYN7gnFRFLX88Skyp MNrnJv8n0y+Ifr4l3y60FHYaRBIe5gklX00ADrDVYNyA/A9+6LaOcOovuty1Pnye6X xPr73a333tMcW78tqNgpCtPH9Peowt0iDdg/Cn0LVgSURAOXDOQEmSjZgH++IugJWU TVK4/7lLeM4s7SDX+1CufMYJ42q+PySIMtIcbeI/J6h9llQmSfMN+QsfamjJN4Dvv/ C+AVaKw9jDf1IvzSKehQraprKT2ntJC2AJqG51sGV5yT7QslvQPrkUljiA/B2OQX9e fN3BUwYGeISZw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 5/8] perf build: Batch metric JSON generation in pmu-events/Build Reply-To: sashiko-reviews@lists.linux.dev To: "Ian Rogers" Cc: linux-perf-users@vger.kernel.org In-Reply-To: <20261206021147.3036701-6-irogers@google.com> References: <20261206021147.3036701-1-irogers@google.com> <20261206021147.3036701-6-irogers@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 02:26:03 +0000 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] perf build: metric stamps newer than JSON outputs break incremental builds - [Low] perf build: missing generated metric JSONs not regenerated under stamp rules - [Low] perf build: metric stamp files not removed before in-place JSON overwrite -- commit 1a536b4cc22c128125cad68b8bd0a9a6945e00bd Author: Ian Rogers perf build: Batch metric JSON generation in pmu-events/Build This commit replaces the 136 per-model metric JSON build rules in tools/perf/pmu-events/Build with three stamp-gated batch invocations for AMD, Intel, and ARM64. > diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build > index 22e4db88272f3..c0f6855a17c97 100644 > --- a/tools/perf/pmu-events/Build > +++ b/tools/perf/pmu-events/Build [ ... ] > @@ -94,59 +98,65 @@ $(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY) [ ... ] > +$(ZEN_METRICS_STAMP): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS) $(SRC= _ZEN_JSON) $(JEVENTS_SRC_MANIFEST) > $(call rule_mkdir) > - $(Q)$(call echo-cmd,gen)$(PYTHON) $< $(call model_name,$@) $(SRC_DIR) >= $@ > + $(Q)$(call echo-cmd,gen)$(PYTHON) $< --output-dir $(GEN_DIR) \ > + $(subst $(space),$(comma),$(strip $(ZENS))) $(SRC_DIR) && touch $@ [Severity: Medium] Does running touch $@ after $(PYTHON) finishes leave the stamp file newer than every generated JSON output? The batch scripts write all JSON files before touch $@ runs, and the @: rules do not update their mtimes. Every incremental build (entered via FORCE on LIBPMU_EVENTS_IN in tools/perf/Makefile.perf) therefore treats all 136 JSON targets as out of date, spawning /bin/sh -c : 136 times. The same applies to INTEL_METRICS_STAMP and ARM_METRICS_STAMP. Creating a temporary timestamp file before invoking $(PYTHON) and moving it into $@ on success would keep the stamp mtime at or before the generated outputs. [Severity: Low] Can a failed or interrupted regeneration leave a pre-existing stamp file intact over truncated or mixed-version JSON outputs? WriteMetricsOutput() in tools/perf/pmu-events/metric.py opens each model JSON directly with 'w', truncating it in place. If the script fails or is interrupted mid-run (for example during make -B), && touch $@ never runs, so $@'s mtime is unchanged and .DELETE_ON_ERROR will not delete it. Later incremental builds then treat the surviving stamp as up to date and either fail in jevents.py or compile mixed-version metrics. Removing $@ before invoking $(PYTHON) (and using atomic replacement in WriteMetricsOutput()) avoids this; the same applies to Intel and ARM64. > -$(ZEN_METRICGROUPS): pmu-events/amd_metrics.py $(GEN_METRIC_DEPS) > - $(call rule_mkdir) > - $(Q)$(call echo-cmd,gen)$(PYTHON) $< -metricgroups $(call model_name,$@= ) $(SRC_DIR) > $@ > +$(ZEN_METRICS) $(ZEN_METRICGROUPS): $(ZEN_METRICS_STAMP) > + @: [Severity: Low] What happens if an individual generated JSON file is missing while its stamp file is still up to date? Previously each JSON file had its own rule, so Make regenerated any missing output. With the bare @: recipe, Make silently satisfies a missing output and jevents.py aborts with FileNotFoundError on every subsequent make until the stamp is removed or make clean is run. The same applies to the Intel and ARM64 rules. Forcing regeneration when any expected output is absent (for example via $(wildcard ...) on the stamp prerequisite or checking test -f $@) would restore recovery. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206021147.3036= 701-1-irogers@google.com?part=3D5