Article View: linux.kernel.netdev
Article #24125Re: [PATCH net-next v5 13/14] selftests: dpll: add concurrency stress tests
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 10:38
Date: Sun, 29 Nov 2026 10:38
111 lines
12533 bytes
12533 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In tools/testing/selftests/drivers/dpll/dpll_stress.sh, cleanup()
checks a pid and signals it in two separate steps: `pid_running "$pid"โฆ
--
selftests: dpll: add concurrency stress tests
This adds test_concurrent_workers and test_many_devices to the dpll stress
selftest. The workers run in subshells and remove their in-flight device
from their own exit traps. The cleanup handler signals the recorded
workers, then removes whatever they left behind, using clock-id ranges
reserved per worker. dpllsim_delete_device() now also treats a part of a
device that disappears concurrently as removed.
> diff --git a/tools/testing/selftests/drivers/dpll/dpll_stress.sh b/tools/testing/selftests/drivers/dpll/dpll_stress.sh
> index 1596c3f1e70b5..20b3132e8a3db 100755
> --- a/tools/testing/selftests/drivers/dpll/dpll_stress.sh
> +++ b/tools/testing/selftests/drivers/dpll/dpll_stress.sh
[ ... ]
> +# Return 0 while the process is a running child of this shell. bash
> +# reaps a background child as soon as it exits and only keeps its status
> +# for a later wait, so the pid of a worker that is gone can be handed
> +# out again. A process that reused it has another parent, which is how
> +# it is told apart, and it must never be signalled. A child that has
> +# exited but was not reaped yet is a zombie, state Z in
> +# /proc/<pid>/stat, and counts as gone, or a wait on it would spin until
> +# the forced kill.
> +pid_running()
> +{
> + local stat state ppid
> +
> + # The state and the parent pid follow the parenthesized command
> + # name, which may contain spaces and parentheses. The ".*" is
> + # greedy, so the expression strips everything up to the last ") "
> + # of the line, and a ")" inside the name is harmless.
> + stat=$(sed 's/^.*) //' "/proc/$1/stat" 2>/dev/null) || return 1
> + read -r state ppid _ <<< "$stat"
> + [ "$ppid" = "$$" ] && [ "$state" != "Z" ]
> +}
[ ... ]
> cleanup()
> {
> # A second signal must not abort the teardown half way.
> trap '' INT TERM
>
> - local dev
> + local pid dev base
> + local pids=() shell_jobs=()
> +
> + # A worker forked right before the signal arrived may not be
> + # recorded yet, so the jobs of the shell are taken as well.
> + mapfile -t shell_jobs < <(jobs -p)
> + mapfile -t pids < <(printf '%s\n' "${BACKGROUND_PIDS[@]}" \
> + "${shell_jobs[@]}" | grep . | sort -u)
> + # Only a process that is still a running child of this shell is
> + # signalled, see pid_running, a recorded pid may have been reused
> + # since its worker finished.
> + for pid in "${pids[@]}"; do
> + pid_running "$pid" && kill "$pid" 2>/dev/null
> + done
[Severity: Low]
Is the check in pid_running() enough to keep a reused pid from being
signalled here?
The check and the kill are two separate steps. pid_running() reads
/proc/<pid>/stat through a forked sed. After it returns, the worker can
still exit, and bash's SIGCHLD handler can reap it before the kill builtin
runs. With a numeric argument, kill calls kill(2) directly and does not
consult the job table. So if the kernel hands the pid to another process
in that gap, the TERM goes to that process.
The same window exists for the forced kill further down:
> + pids_gone "${pids[@]}"
> + for pid in "${pids[@]}"; do
> + pid_running "$pid" && kill -KILL "$pid" 2>/dev/null
> + done
In practice the pid allocator would have to wrap through all of pid_max
inside that short window, so this is very unlikely to happen. The check
does close the main case, a pid that was recycled long after its worker
finished.
However, the commit message says the handler "signals a pid only while
that is still a child of the script". The pid_running() comment also says
a process that reused the pid "must never be signalled". Both describe a
stronger guarantee than the code gives.
Would it make sense to signal by jobspec instead? bash checks liveness
there with SIGCHLD blocked. Otherwise, the comment and the commit message
could say that the check narrows the window rather than closing it.
> + # Give the workers a few seconds to run their exit traps, then
> + # force the survivors and give those a few seconds to die. A
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125090522.3777494-1-poros%40redhat.com
Technical Details
Message-ID:
<179594873859.3146.5615694504477947742@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373457-linux-kernel-netdev=dewy.ruReferences:
<20261125090522.3777494-14-poros@redhat.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373457-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v5 13/14] selftests: dpll: add concurrency stress tests Date: Sun, 29 Nov 2026 10:38:58 +0000 Organization: Usenet Network Message-ID: <179594873859.3146.5615694504477947742@kernel.org> References: <20261125090522.3777494-14-poros@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1150584"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:H5Uw/B5y3AgAlsl69HGAB2fAp9Y= sha256:aGNHvGo8NgecPvFYe/v/13ZSn4icJhJFQEvz5ZaHA7w= sha1:+ON1o2YC23aK2dcB58wGkxPQ/ZE= sha256:OxeQlR1XDRLr5gDnUO2B47YcsolUzpsvzjXht533RBs= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 45707125F99; Sun, 29 Nov 2026 13:39:28 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yxFtXhqZAasD; Sun, 29 Nov 2026 13:39:24 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373457-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 9078F125F96; Sun, 29 Nov 2026 13:39:16 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 72A1E25C06; Sun, 29 Nov 2026 10:39:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795948741; b=NK2mg9/2FhcS5waEm85Q1tBE3ceiSwLKpNEm5UMdJdg4Fy74cY+RHw1IV+LDBnqtUw7Y cw87C7dL8Dwwcrh4LME4dAg5Z4pdUQtTzpyzyK1DgrC8jotyejQP1C6YMdbYSmgkDZowx lejqt+Jnt01CPSF2onfgK77jEG3qloaBiiN52qq5EG1k3tPY15mwyobGewG1rTxS9AyC+ N524f2S6ypDs/1WOg9uLKXiudhTkzZMbBAO/FL6ZXosa6++24SBqQygn76J96/seo7W+d MP8YMUJuzRvJeoPIEYTnsVm/21cyMrjE+pExNxfUwE+e8M1MROXD70sTnBjCiZrObjA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795948741; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=SAS12LGQjsnk/7Fokq3AdwoymaxfAFuZHA3ZFVi9AR0=; b=iP6A8EOkJ3chjlmPCNSd5ryWwMnS05CJsKAYAwrF5PEdYBsfUqDfQHRwWalmKjFsE1rd C3GJnbXppqLGr/CrXtqjfVh31iD5oN5GzB7ENY/2w9oX6u5pmBQ2jXNykzUUgnN0eMyZe T8PhTchKr5n81CoPNvkTCm9FpUe0pUFXP10l5j/CJlzF4mzMW57sOR6lTxDxqAgmDpkGU 1DFlOTkWmVEQx33dVmT6yaDB8Gdmlc64cWxGaAAvzctpEndyJDskscNJePvBi2VtARqTV ud++vV7NyMUDRdn6ZfxWI2CzYwdx6uub8CQqw/gGaQkYrKMeVy8BckF6wpzVe+sBU5g== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Hb5OPJcE; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B2A7606A32E; Sun, 29 Nov 2026 10:39:01 +0000 (UTC) X-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=Hb5OPJcE X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795948740; b=JFP1GkGzATKR4caoyrwk347bWH0+qEvAzVvRmoiD+OTsmZs+Q0DBiV7jcO2nY+/2ClVQ +4+ElWCn6jb2MSLawkv/qzeNGAEtmGAGf1yE/w2O7+inVlwS4s91danJCc3ve3GtbZHb6 MRKqBh4e7ccttf4cBcwdj7FlhTZyuZQPIGAUXbr4ULsEnw3TVNbZmR2zyo+GKkV8W0Cov I+3l8LHv8z3VdL+QvMxVe+BKBzCN3jJkX3q8DrnhmWzZpPssT2kKqK0hJOfTZ3yklorI2 krtC/zxZzb1RjpDwus9CZLcTn0WEQyzdfV3ndjImF5cQxs2G6rm8u1s9JIPr2DA7ERg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795948740; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=SAS12LGQjsnk/7Fokq3AdwoymaxfAFuZHA3ZFVi9AR0=; b=q/xmGKcx9d6iOrSRFUer9+Gx/uiwd3JRypR5UeUZgY9fasTAhMOFhQbqpaZjsyte+zZZ nPfO+zMUBZMM9TehprV1vPBZHHxqG7uSKroDIEpJ6V401uWglBcpvE4M5dCdGi2V26oFV eTaIXVN9aiKBEhlwEGHqLU//tya9wYX5sGR0Ur6l1YyffTGahRzlufCOAmSAmIvzgB9Xy fJicttPgJK/TYyQ0i0uBIw/NyVkxj4tsrOKb4JCl+WICUi0A9AJah293Q2Ah4g/FNFRYX ZJHq38cOOxHiM+LBCwlNykREutRdl9B3bW9oT+vQVKKT6gmEDLEu98WF7SZ3mfDxUug== X-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=Hb5OPJcE; arc=none smtp.remote-ip=100.103.45.18 X-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 6A19D606A327; Sun, 29 Nov 2026 10:39:00 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 095871F00925; Sun, 29 Nov 2026 10:38:58 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795948740; bh=SAS12LGQjsnk/7Fokq3AdwoymaxfAFuZHA3ZFVi9AR0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Hb5OPJcEqjerrDlPofFBmyJNcagR64SmVZNVSYBI87lctlz9/VGRsGZrZe4vE1Hk/ kcJlKVN3pqImm6kbIKX28nU2pcXbjKihZ9WSdLTGnfUubcGHa5ysc20vgsH7n8zf5s 4SKAim35dPn8BZ4nkzz1LmADgCPfk0P8qZ9YW2DnsDqO+iIUuK+ZVjNShyVfkP3E2G AVZ9IJzMWg7Rz66q+mWV2JsOQic5JrMGMUZKgpocpfq6b8X8jyi5+wh4NIseOclrMC +IH0dKQMsbntpTgYLGuaTlYYqrRW+8dX/LVahCx4BzC62AYfWNitQ3lE2E2K/X1H1J Wb1GtQiYzcjzw== X-Cc: netdev@vger.kernel.org, ivecera@redhat.com, jiri@nvidia.com, corbet@lwn.net, skhan@linuxfoundation.org, shuah@kernel.org, rdunlap@infradead.org, jani.nikula@intel.com, vadim.fedorenko@linux.dev, arkadiusz.kubalewski@intel.com, jiri@resnulli.us, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <20261125090522.3777494-14-poros@redhat.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list