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=1796523836; b=eAtwsEKI10WWBu1soZmsGPVupcRIk9bneJWwDgUdYkwI0xKuYhvpg8DNx1GinDM3aJMt 15f6ceQwLqTaYQGregcT/sT8/EVZmg+DB2u6fcKfHQxeKrNNHXsssdWqOX5nJ/ch9hu5J Bit3yayu8x+9VQHWqw5EEMBXnMOLHBPgJv79DYIJ4BFFuIx1feZ7/k6k6SSGj7TR8VwIT dgU0JTodzGAKcXGqmXDPrHpk84kDebrlJ57l6SdLNLAYsVfrbtmwI8ucz7omzc4DvZiRm 6QIW0wkgvGe2vKnOIryuZ3ZO/B8fzByrGoernmUcj0KUqTsStRuOp+MyggyuQlYF5dA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796523836; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=nycRQjWuhd6xXId3/fRY5WeDZMZxI6MPQ6vq9j8Ldb8=; b=iBzp+yvvRpYXYuq1pKoMWigq1PU4PYX3CwIW4SG73zwt1x2hS5NvReZzhMDonBtAKjGJ BS+tKRjurAe2D/UQPtNCAId+LdvDph7nq5yh75frWZR97Qo3lMQQP17c9Ld0L419c681Q giwwtpNRKvp1BQEE052sjGEhb8S1277IU4+9YeyOkEJqxTQJ5z5fx+a2Wb/xzroBjB+Z1 Tym5RUXbhOpK7pf/rDT0aE6enMj6v5jj65fGfLqRNtngyAL/BSalVGgFdQm3E3VoRCruu 9EKo0YjCQIEH+YpaM3oK3bgleWUmPmm2vJcDYP2SsVxCSYvBlWPUxt1tudTguYORY7A== 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=Y4igiF2z; 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 9BAA3606A335 for ; Sun, 6 Dec 2026 02:23:56 +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=Y4igiF2z Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37CE31F0092B; Sun, 6 Dec 2026 02:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796523836; bh=nycRQjWuhd6xXId3/fRY5WeDZMZxI6MPQ6vq9j8Ldb8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Y4igiF2zw+6ZSkZszfD7qDZXyzOzOLLIJB+y/cuso/QnQq/B2cDfzdt8oUmdeBJMq mBhTFF+c5wx70/xC73dAgqGMFsnOt/AQyJ4OCIPoUwUpV+RwK/ZtEPHfsXCUIPw/lq AjqJSfxwadtc2C9AEh5dkxUDtZcUzu2ko66H0uwHYeYZbGn+VyLVo+OyIyXbJoBpUo Sr9T1bmaGl7TCvtUSQ1rKUv1KIdMP6OPmQsPeAVZCtQmnOrhYy+chhwMrqJceXU6yi EXbMO92WQoIc7SNiLADjj8KFYYwQsYTH9REQk82P5iTQu51aw3rtINuppPPtkq7Le3 JO+jU6R0CnBsA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/8] perf jevents: Support --gen-dir/--gen-manifest overlay and ignore backups Reply-To: sashiko-reviews@lists.linux.dev To: "Ian Rogers" Cc: linux-perf-users@vger.kernel.org In-Reply-To: <20261206021147.3036701-3-irogers@google.com> References: <20261206021147.3036701-1-irogers@google.com> <20261206021147.3036701-3-irogers@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 02:23:55 +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 1 potential issue to consider: - [Low] perf jevents: duplicated JSON and backup filter rules from metric.py -- commit ae5439c62af36dc621d24253814764bbf79485a1 Author: Ian Rogers perf jevents: Support --gen-dir/--gen-manifest overlay and ignore backups This commit refactors jevents.py to collect JSON tables in memory, adds --gen-dir, --gen-manifest, and --gen-file options for overlaying generated JSON files, and filters out backup and hidden files. > diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jev= ents.py > index 50bfce7d07d44..f4c6edd30d088 100755 > --- a/tools/perf/pmu-events/jevents.py > +++ b/tools/perf/pmu-events/jevents.py [ ... ] > @@ -91,6 +92,56 @@ _valid_keys: Set[str] =3D { > 'ThreadMask', 'UMask', 'Unit', > } > =20 > +# Generated JSON filenames written into --gen-dir rather than starting_d= ir. > +# Ignored in starting_dir when --gen-dir is supplied so leftover files f= rom > +# older in-tree builds cannot collide with freshly generated outputs. > +_GENERATED_JSON_NAMES =3D frozenset({ > + 'legacy-cache.json', > + 'extra-metrics.json', > + 'extra-metricgroups.json', > +}) > + > +# Backup files created by git mergetool end in .json and would otherwise= look > +# like valid topic tables. > +_MERGETOOL_BACKUP_RE =3D re.compile(r'_(?:BACKUP|BASE|LOCAL|REMOTE)_\d+\= .json$') > + > + > +def _is_valid_dir_name(name: str) -> bool: > + """Return True if a directory under arch/ should be traversed.""" > + return not name.startswith('.') and '.' not in name > + > + > +def _is_valid_json_filename(name: str, skip_generated: bool =3D False) -= > bool: > + """Return True if filename looks like a PMU event/metric JSON table. > + > + Skips hidden dotfiles (including Emacs '.#*' lockfiles), multi-dot bac= kup > + copies (e.g. 'cache.bak.json', 'cache.orig.json'), git mergetool backu= ps, > + and optionally generated filenames when scanning the source tree along= side > + an explicit --gen-dir. > + """ > + if name.startswith('.') or not name.endswith('.json'): > + return False > + if name.count('.') !=3D 1: > + return False > + if _MERGETOOL_BACKUP_RE.search(name): > + return False > + if skip_generated and name in _GENERATED_JSON_NAMES: > + return False > + return True [Severity: Low] Could _GENERATED_JSON_NAMES, _MERGETOOL_BACKUP_RE, _is_valid_dir_name(), and the filename checks in _is_valid_json_filename() be shared with tools/perf/pmu-events/metric.py instead of duplicated here? jevents.py already imports metric, which defines the same _MERGETOOL_BACKUP_RE, _SKIP_EVENT_JSON_NAMES, _is_valid_event_json(), and dotted/hidden directory filter in LoadEvents(). Keeping two copies risks metric generation and jevents compilation silently diverging if a new generated JSON table or backup pattern is added to only one module. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206021147.3036= 701-1-irogers@google.com?part=3D2