On Fri, 2026-07-10 at 01:08 +0800, Wen Yang wrote:
> >   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?

> 
> Reviewed-by: Wen Yang <[email protected]>
> 
> > +   ret=$?
> > +   kill "$load_pid"
> > +   wait "$load_pid"
> > +   return $ret
> >   }
> >   
> >   echo 1 > monitors/wwnr/enable
> >   echo printk > monitors/wwnr/reactors
> >   
> > -load
> > -
> >   echo 0 > monitoring_on
> >   ! load || false
> >   echo 1 > monitoring_on
> >   
> > -load
> > -
> >   echo 0 > reacting_on
> >   ! load || false
> >   echo 1 > reacting_on
> >   
> > +load
> > +
> >   echo nop > monitors/wwnr/reactors
> >   echo 0 > monitors/wwnr/enable


Reply via email to