Thread (53 messages) 53 messages, 4 authors, 12d ago

Re: [PATCH v3 16/17] selftests/verification: Rearrange the wwnr_printk test

From: Wen Yang <hidden>
Date: 2026-07-14 17:43:18
Also in: linux-kselftest, lkml


On 7/10/26 16:31, Gabriele Monaco wrote:
On Fri, 2026-07-10 at 01:08 +0800, Wen Yang wrote:
quoted
quoted
   load() { # returns true if there was a reaction
-	local lines_before num
+	local lines_before num load_pid ret
   	num=$((($(nproc) + 1) / 2))
   	lines_before=$(dmesg | wc -l)
-	stress-ng --cpu-sched "$num" --timer "$num" -t 5 -q
-	dmesg | tail -n $((lines_before + 1)) | grep -q "rv: monitor wwnr
does not allow event"
+	stress-ng --cpu-sched "$num" --timer "$num" -t 5 -q &
+	load_pid=$!
+	timeout 5 dmesg -w | tail -n +$((lines_before + 1)) | grep -m 1 -q
"rv: monitor wwnr does not allow event"

Minor nit: could we add a small delay (e.g., sleep 0.1) before dmesg?
I don't get what the benefit would be.

The intent of that line is to run a continuous dmesg (-w) for up to 5s (timeout)
but stopping if an occurrence is found (grep -m 1 would close the pipe).

Do you see a case in which this wouldn't happen?
You're right, the sleep is not needed. My concern was that a reaction
message generated in the brief window between starting stress-ng and the
dmesg pipeline being fully set up might be missed. But that can't
happen: dmesg -w always starts by flushing all currently buffered
messages before entering watch mode, so any reaction already in the ring
buffer will be included in its initial output. The  tail -n +N  offset
then correctly filters to only those messages beyond our pre-test
baseline.

Withdraw the nit. The Reviewed-by stands.

--
Best wishes,
Wen
quoted
Reviewed-by: Wen Yang <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help