From nobody Sun Feb 8 17:46:54 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 884DF30BB82 for ; Wed, 21 Jan 2026 16:21:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769012492; cv=none; b=Lo2s3y+zdWo0MU7sUrEel97SnIKqxmkr/9N4dSvadJb1EK85gwzcntaHUE0QnDAGSIyldWpWixnIyWzale3v4+qIa+mbiBTvBEAu/7iPnwLIFvWVyICPdkCjurP6Im+K2jEdnEoYqY9B8QMN3MkmQyLz6cEu+G/yUZMUVB9B7es= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769012492; c=relaxed/simple; bh=QPlRDZ6YtMqz4rOZY4SerLH7qXodODt7cllxEzKDofI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=ELXThIX4N2O7+EFDNI89oBWuQRu0ekGPEE68KCKevljKymdxqqYIEA+n0dS3J10qPanCHmXIqcfp1m72fFiAeUek0/mLZ3UDjODzoblgLHwZ02jKbshRuloHXRmO3BK3KyE3CWOCkbyTz8+vG9M68i1Yc2pH02yzEOCTehkwJ9s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=F9A6n5sx; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="F9A6n5sx" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4801c2fae63so183685e9.2 for ; Wed, 21 Jan 2026 08:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769012488; x=1769617288; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=aDYdRg9fOimYCwHsfGmb8CgucK2H/5fEbqXKpOFujq8=; b=F9A6n5sxbHzxT3DCG+I5oON2HBAvrm0hf4VQvCIsLV58VgjlsXw8qEEQXVfnGfvTiy AoaYvLyMIbRm8aULvVqO8k8YqmeRkmCsCs22gCetnSifBex/oJC0q+Y26TFdl5371+Ou yreQPG+GYDKFBQ8NHyAi0PKO91iRBA+VSLUfk5Dx+pvKKUU5w2/Ot379yzNTw68nPM2y /hXRGMkm9hHcmwEYfh/MwevAFoojzYns4ptdVJqdXu/wWcN0nKeNhjl3HHj8BO2lKO9C Vg+NDcRXeZl0XsO7Tev19N4ZilYsNE9CpT5Gc8drISIL6KEQ7nT4qh16nnhT/fFMwQmU UP6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769012488; x=1769617288; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aDYdRg9fOimYCwHsfGmb8CgucK2H/5fEbqXKpOFujq8=; b=ZneRSMrjFenxq5JnWYsg35LKhq+Vsv/jki8YBfafDw/dGOP4iJ0U0u2L0o2ao74hGT 4DKzHB1O7bpUMJmZdZxyM8+ElEhQxjabl4NV4SKj3wOkrRmxxHBNSIbMrRHDA/yDP7wD Xtkdq6JKfvoy72WpmANTiL4n0Uv76ai8mjO+L0MTKsio+n6//DS0gIUNIJA3Pt3dezCE pXh9Eg4vqs8nfMB0/RihgarplY89D5PlxVE9AwkWsb/4aX8cviFZ0e/cBS8aU7fjErkt 3ldZZz/kiWPrN73rjhoNE5Euj54jh7ejMvQm6vZSL10tNfgzQcMQgvGySUT73NO7Cl02 wb0A== X-Forwarded-Encrypted: i=1; AJvYcCUHUqc7Nh/u5mDzaG9p1+WH+d1SyaPHFnluHvkaJx64q4HRWmC3YOAC2V5VsGs21HXm9UcINcF+9YWzw9o=@vger.kernel.org X-Gm-Message-State: AOJu0YyKxKP7GPIaBHOJ9/RxyI84XEsgnYApe2MbYOZyZu8lWt5mJ9rq atVUU8VlpjBVVNytVPuyrxgdHgynzesPttMGabeGHTfokIr3z/pc5Xr2to/zGjxzpuE= X-Gm-Gg: AZuq6aK2KxqQWkeS+AI86sWciYt4VZragIlWXAfIkqZMBbBV8tULyq8Pa/uRlqm6blY sAGnpGbz/NeoG9hGNSKtwV5wyclB+QWXLZmbwNZ90ZaLkro8uBVq4Nswg8jlsWYheqP5B0l+E0I GbDHNR9/wRyYdxlfqNOxA20chQKJQ9sh2H5z+nRRBRZJQCWdwIhoz0WbM8/TrtN2iVl1zu/c9Cc +/+JwpvasjOIzSejL39W8Iyv2O6xM49V8T95zx9YUVZuSXkuz6qo/Eh7DxoeJ81D+/pYlE+W3lT l12Ijd3Mw/r1/KlTzuJhIZyshJotwHwrUaiLHCUsyt/HTQkiU1fRCP505cvFthe9PtN8eCmU/di +jt4qgzcVnDqGK17FtuD/bMXzmIHePC5QVIP+IA5k2Q4JOs4q6brjGZ33VL4C0qJVGfAiq7xBUA aeCGzAryubUp7/EDncNpVZ X-Received: by 2002:a05:600c:630e:b0:479:3a86:dc1e with SMTP id 5b1f17b1804b1-4801e34f6e7mr277943465e9.36.1769012487528; Wed, 21 Jan 2026 08:21:27 -0800 (PST) Received: from ho-tower-lan.lan ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356996cecasm35055233f8f.26.2026.01.21.08.21.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 08:21:27 -0800 (PST) From: James Clark Date: Wed, 21 Jan 2026 16:19:40 +0000 Subject: [PATCH v2] perf jevents: Handle deleted JSONS in out of source builds Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260121-james-perf-json-delete-fix-v2-1-2e10f895bfd7@linaro.org> X-B4-Tracking: v=1; b=H4sIAJv8cGkC/42NQQ6CMBAAv0L27Bq2iIgn/2E4FFhgCbZkS4iG8 HcrL/A4c5jZILAKB7gnGyivEsS7COaUQDNY1zNKGxlMaq4pmRRH++KAM2uHY/AOW554YezkjQX leVZnRck3hhiYlaM+4s8q8iBh8fo5Xiv97F/ZlZCwtmyovNTUNt1jEmfVn732UO37/gWfCj02x QAAAA== To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown , James Clark X-Mailer: b4 0.14.0 Make the source folders a dependency for the generated folder root so that whenever a file is deleted from the source it will force a new fresh copy of all the JSON files and avoid stale deleted files. JSON_DIRS_OUTPUT_ROOT needs to be a dependency of LEGACY_CACHE_JSON so that the root folder doesn't get cleaned after the legacy JSON is generated. But this is a no-op with in-source builds as JSON_DIRS_OUTPUT_ROOT is unset. JSON_DIRS is added as a dependency of PMU_EVENTS_C which also forces a re-build for in source builds when JSON files are deleted. This could have also resulted in stale builds, but never a broken one. Reported-by: Mark Brown Closes: https://lore.kernel.org/linux-next/aW5XSAo88_LBPSYI@sirena.org.uk/ Fixes: 4bb55de4ff03 ("perf jevents: Support copying the source json files t= o OUTPUT") Signed-off-by: James Clark --- This is a bit of a hack and I thought that making jevents.py handle multiple input folders would be a much better solution than this. Then we could have "gen-pmu-events" for only generated files and "pmu-events" for only in-tree input files. It would be very clear what's generated and what's not and all copying rules and special clean rules just disappear (and this isn't the first time these rules have caused build issues). Unfortunately, after a while of trying to modify the script I thought it was too invasive for now. The script does output per-file at the very bottom of the logic in process_one_file(), so adding files in another folder ends up re-emitting section headers when another chunk is output. Although other parts of the script do build things up in memory before outputting so it was possible to make those parts work with multiple folders transparently. --- Changes in v2: - Drop dependency on rsync by wiping the output folder any time a source folder is updated. - Also fix the same issue for in source builds by adding the source folders as a dependency of PMU_EVENTS_C. - Link to v1: https://lore.kernel.org/r/20260120-james-perf-json-delete-fix= -v1-1-bae2194b1dcf@linaro.org --- tools/perf/pmu-events/Build | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build index a46ab7b612df..4f9ef624ba70 100644 --- a/tools/perf/pmu-events/Build +++ b/tools/perf/pmu-events/Build @@ -1,5 +1,6 @@ pmu-events-y +=3D pmu-events.o JSON =3D $(shell find pmu-events/arch -name '*.json' -o -name '*.csv') +JSON_DIRS =3D $(shell find pmu-events/arch -type d) JDIR_TEST =3D pmu-events/arch/test JSON_TEST =3D $(shell [ -d $(JDIR_TEST) ] && \ find $(JDIR_TEST) -name '*.json') @@ -31,16 +32,23 @@ $(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C) else # Copy checked-in json to OUTPUT for generation if it's an out of source b= uild ifneq ($(OUTPUT),) -$(OUTPUT)pmu-events/arch/%: pmu-events/arch/% +# Remove all output directories when any source directory timestamp changes +# so there are no stale deleted files +JSON_DIRS_ROOT =3D $(OUTPUT)pmu-events/arch/ +$(JSON_DIRS_ROOT): $(JSON_DIRS) + $(Q)$(call echo-cmd,gen)rm -rf $@ + $(Q)mkdir -p $@ + +$(OUTPUT)pmu-events/arch/%: pmu-events/arch/% $(JSON_DIRS_ROOT) $(call rule_mkdir) $(Q)$(call echo-cmd,gen)cp $< $@ endif =20 -$(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY) +$(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY) $(JSON_DIRS_ROOT) $(call rule_mkdir) $(Q)$(call echo-cmd,gen)$(PYTHON) $(LEGACY_CACHE_PY) > $@ =20 -GEN_JSON =3D $(patsubst %,$(OUTPUT)%,$(JSON)) $(LEGACY_CACHE_JSON) +GEN_JSON =3D $(patsubst %,$(OUTPUT)%,$(JSON)) $(LEGACY_CACHE_JSON) $(JSON_= DIRS) =20 $(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY) $(call rule_mkdir) --- base-commit: 571d29baa07e83e637075239f379f91353c24ec9 change-id: 20260120-james-perf-json-delete-fix-71553b379e8e Best regards, --=20 James Clark