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=1795948740; b=JFP1GkGzATKR4caoyrwk347bWH0+qEvAzVvRmoiD+OTsmZs+Q0DBiV7jcO2nY+/2ClVQ +4+ElWCn6jb2MSLawkv/qzeNGAEtmGAGf1yE/w2O7+inVlwS4s91danJCc3ve3GtbZHb6 MRKqBh4e7ccttf4cBcwdj7FlhTZyuZQPIGAUXbr4ULsEnw3TVNbZmR2zyo+GKkV8W0Cov I+3l8LHv8z3VdL+QvMxVe+BKBzCN3jJkX3q8DrnhmWzZpPssT2kKqK0hJOfTZ3yklorI2 krtC/zxZzb1RjpDwus9CZLcTn0WEQyzdfV3ndjImF5cQxs2G6rm8u1s9JIPr2DA7ERg== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 095871F00925; Sun, 29 Nov 2026 10:38:58 +0000 (UTC) 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== Subject: Re: [PATCH net-next v5 13/14] selftests: dpll: add concurrency stress tests From: netdev-bot+sashiko@kernel.org To: poros@redhat.com 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 Date: Sun, 29 Nov 2026 10:38:58 +0000 Message-ID: <179594873859.3146.5615694504477947742@kernel.org> In-Reply-To: <20261125090522.3777494-14-poros@redhat.com> References: <20261125090522.3777494-14-poros@redhat.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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//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//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