All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Douglas Gilbert <dgilbert@interlog.com>
Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com, hare@suse.de
Subject: Re: [RFC] scsi_debug: add hosts initialization --> worker
Date: Fri, 19 Mar 2021 19:48:41 +0000	[thread overview]
Message-ID: <20210319194841.GL4332@42.do-not-panic.com> (raw)
In-Reply-To: <20210319150514.17083-1-dgilbert@interlog.com>

On Fri, Mar 19, 2021 at 11:05:14AM -0400, Douglas Gilbert wrote:
> Adding (pseudo) SCSI hosts has been done in the scsi_debug_init()
> function. Each added SCSI host triggers an (async) scan and for
> every LUN found, the host environment can trigger a lot of work.
> On a recent Ubuntu/Debian distribution a lot of this "work" seems
> to involve udev and its scripts. The result of this work can be
> seconds elapsed before scsi_debug_init() returns.
> 
> This experimental code places the function to add those SCSI hosts
> in its own thread. This allows scsi_debug_init() to complete a lot
> faster. To impede malevolent user space code that might try to send
> a 'rmmod scsi_debug', an extra module_get() reference is taken
> before the worker thread starts and that worker gives back that
> reference when it completes.
> 
> This patch is against MKP's repository and its 5.13/scsi-queue
> branch which is sitting at lk 5.12.0-rc1. It should apply to later
> release candidates in that series.
> 
> Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>

This is a good idea in general in terms of module design, however given
current users include fstests and blktests I think as-is it would
introduce a few false positives. So we either decide to not care about
those users and force a check on version moving forward.. or we keep
and the existing behaviour and bite the bullet long term.

Also, in terms of design an alternative is a load/unload sysfs file.
But we'd still punt the same issue of "are we ready to use these devices
after load" to when this file completes writing to.

FWIW, blktets users udevadm settle to try to ensure udev stuff completes
its work, but if folks are using blktests to test things they may also
have multipath installed, and for whatever reason that userspace
application loves to tickle scsi devices upon load, and that is a
random example of another user of of scsi devices which would prevent
unload. Granted, the use of that application of opening the device is
quick, but it still reveals an issue with testing. Perhaps all we can
do is just use scsi_complete_async_scans() in a private module namespace
as suggested in the bug report *and* perhaps setting TEST UNIT READY as
you suggested? If setting TEST UNIT READY for until we're ready, perhaps
that really suffices completely, and that would give parity with what
other userspace applications would use for prepping for a test on a
target scsi device.

I'll soon test what you recommended of

modprobe scsi_debug tur_ms_to_ready=20000

If more devices are used, perhaps the thing to do there is to
multiply per numbef of devices requested?

  Luis

  reply	other threads:[~2021-03-19 19:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 15:05 [RFC] scsi_debug: add hosts initialization --> worker Douglas Gilbert
2021-03-19 19:48 ` Luis Chamberlain [this message]
2021-03-23 13:26 ` [scsi_debug] 20b58d1e6b: blktests.block.001.fail kernel test robot
2021-03-23 13:26   ` kernel test robot
2021-03-23 15:29   ` Douglas Gilbert
2021-03-23 15:29     ` Douglas Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210319194841.GL4332@42.do-not-panic.com \
    --to=mcgrof@kernel.org \
    --cc=dgilbert@interlog.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.