On 2020-03-23 04:29, Daniel Wagner wrote: > On Fri, Mar 20, 2020 at 03:24:13PM -0700, Bart Van Assche wrote: >> Add a test that triggers the code touched by commit d0930bb8f46b ("blk-mq: >> Fix a recently introduced regression in blk_mq_realloc_hw_ctxs()"). This >> test only runs if a recently added fault injection feature is available, >> namely commit 596444e75705 ("null_blk: Add support for init_hctx() fault >> injection"). > > [...] > >> +test() { >> + local i sq=/sys/kernel/config/nullb/nullb0/submit_queues >> + >> + : "${TIMEOUT:=30}" >> + if ! _init_null_blk nr_devices=0 queue_mode=2 "init_hctx=$(nproc),100,0,0"; then > > Doesn't make the $(nproc) the test subtil depending on the execution > environment? Hi Daniel, The value $(nproc) has been chosen on purpose. The following code from the test script: + echo 1 >$sq + nproc >$sq triggers (nproc + 1) calls to null_init_hctx(). So injecting a failure after (nproc) null_init_hctx() calls triggers the following pattern: * The first blk_mq_realloc_hw_ctxs() call fails after (nproc - 1) null_init_hctx() calls. * The second blk_mq_realloc_hw_ctxs() call fails after (nproc - 2) null_init_hctx() calls. ... * The (nproc) th blk_mq_realloc_hw_ctxs() call fails after one null_init_hctx() call. * The (nproc + 1) th blk_mq_realloc_hw_ctxs() call succeeds. I'm not sure to trigger this behavior without using the $(nproc) value? Thanks, Bart.