Linux Perf Users
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	regressions@lists.linux.dev
Subject: [PATCH] perf build: Do not use the mypy cache
Date: Fri,  4 Dec 2026 11:47:52 -0500	[thread overview]
Message-ID: <20261204164752.853673-1-sashal@kernel.org> (raw)

The build runs one mypy process per Python file, in parallel, and since
commit b3e9c396d0ac ("perf build: Make mypy build test opt-out
(NO_MYPY=1)") it does so whenever mypy is installed. All of them use
the default cache, .mypy_cache in tools/perf of the source tree.

Since mypy 1.20 that cache is an SQLite database by default. mypy 2.4.1
sets the journal mode of the database every time it opens it, and that
fails if another process has the database locked at that moment:

  sqlite3.OperationalError: database is locked

mypy reports this as an internal error and the build fails:

  error: INTERNAL ERROR -- Please try using mypy master on GitHub:
  [...]
  make[3]: *** [util/Build:426:
    /tmp/kci/kernel_build/util/setup.py.mypy_log] Error 1

Which files fail changes from build to build. KernelCI's arm64 perf
build of mainline, with mypy 2.4.1, has failed this way in 17 of 22
builds since November 26.

Pass --cache-dir=/dev/null so that mypy uses no cache. The build also no
longer writes .mypy_cache into the source tree.

mypy does not start worker processes without a cache and exits with
"Cache must be enabled in parallel mode" when MYPY_NUM_WORKERS or
num_workers in a mypy configuration file asks for them, so set
MYPY_NUM_WORKERS=0 for these runs. Each run checks a single file, so
workers would not help.

Fixes: b3e9c396d0ac ("perf build: Make mypy build test opt-out (NO_MYPY=1)")
Reported-by: kernelci.org bot <bot@kernelci.org>
Closes: https://lore.kernel.org/all/179589234320.273234.15340882774679334017@kernelci.org/
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

 tools/perf/Makefile.perf | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 4cc5bb3011da4..142237fc626f4 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -269,6 +269,11 @@ endif
 # (substituting escaped spaces so multi-word overrides like MYPY="mypy --strict"
 # are removed as a single token) so child Makefile.build sub-makes inherit the
 # MYPYPATH-wrapped export MYPY environment variable.
+# One mypy process runs per file and they run in parallel. mypy's cache cannot
+# be shared by concurrent runs (opening its SQLite database fails with
+# "database is locked"), so turn it off. mypy does not start worker processes
+# without a cache, so set MYPY_NUM_WORKERS=0, which also overrides num_workers
+# in a mypy configuration file.
 ifneq ($(force_fixdep),1)
   MAKEOVERRIDES := $(subst __SPACE__,\ ,$(filter-out MYPY=%,$(subst \ ,__SPACE__,$(MAKEOVERRIDES))))
   ifeq ($(NO_MYPY),1)
@@ -278,7 +283,8 @@ ifneq ($(force_fixdep),1)
   endif
 
   ifneq ($(MYPY),)
-    override MYPY := MYPYPATH=$(srctree)/tools/perf/python $(MYPY) --ignore-missing-imports
+    override MYPY := MYPYPATH=$(srctree)/tools/perf/python MYPY_NUM_WORKERS=0 $(MYPY) \
+      --ignore-missing-imports --cache-dir=/dev/null
   endif
 endif
 

base-commit: 007722b8211f7b34fdf21b1e6a9c32497633ea29
-- 
2.53.0


             reply	other threads:[~2026-12-04 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 16:47 Sasha Levin [this message]
2026-12-04 17:03 ` [PATCH] perf build: Do not use the mypy cache sashiko-bot
2026-12-04 17:36 ` Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204164752.853673-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=regressions@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox