From: Bart Van Assche <bvanassche@acm.org>
To: Xuewei Zhang <xueweiz@google.com>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Ming Lei <ming.lei@redhat.com>, Hannes Reinecke <hare@suse.de>,
Christoph Hellwig <hch@lst.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
Aditya Kali <adityakali@google.com>,
tytso@mit.edu, Guenter Roeck <groeck@chromium.org>,
maze@google.com
Subject: Re: [PATCH] scsi: sd: Contribute to randomness when running rotational device
Date: Thu, 06 Sep 2018 15:27:53 -0700 [thread overview]
Message-ID: <1536272873.26747.11.camel@acm.org> (raw)
In-Reply-To: <20180906203719.209399-1-xueweiz@google.com>
On Thu, 2018-09-06 at 13:37 -0700, Xuewei Zhang wrote:
> Currently a scsi device won't contribute to kernel randomness when it
> uses blk-mq. Since we commonly use scsi on rotational device with
> blk-mq, it make sense to keep contributing to kernel randomness in these
> cases. This is especially important for virtual machines.
>
> commit b5b6e8c8d3b4 ("scsi: virtio_scsi: fix IO hang caused by automatic
> irq vector affinity") made all virtio-scsi device to use blk-mq, which
> does not contribute to randomness today. So for a virtual machine only
> having virtio-scsi disk (which is common), it will simple stop getting
> randomness from its disks in today's implementation.
>
> With this patch, if the above VM has rotational virtio-scsi device, then
> it can still benefit from the entropy generated from the disk.
>
> Reported-by: Xuewei Zhang <xueweiz@google.com>
> Signed-off-by: Xuewei Zhang <xueweiz@google.com>
> ---
> drivers/scsi/sd.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index b79b366a94f7..5e4f10d28065 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2959,6 +2959,9 @@ static void sd_read_block_characteristics(struct
> scsi_disk *sdkp)
> if (rot == 1) {
> blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
> blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
> + } else {
> + blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
> + blk_queue_flag_set(QUEUE_FLAG_ADD_RANDOM, q);
> }
>
> if (sdkp->device->type == TYPE_ZBC) {
Although this patch looks fine to me, seeing this patch makes me wonder
whether the default should be changed (QUEUE_FLAG_MQ_DEFAULT) instead of
modifying the sd driver. Can anyone remind me why QUEUE_FLAG_MQ_DEFAULT does
not include QUEUE_FLAG_ADD_RANDOM?
Thanks,
Bart.
next prev parent reply other threads:[~2018-09-06 22:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 20:37 [PATCH] scsi: sd: Contribute to randomness when running rotational device Xuewei Zhang
2018-09-06 22:27 ` Bart Van Assche [this message]
2018-09-06 22:42 ` Theodore Y. Ts'o
2018-09-06 23:03 ` Xuewei Zhang
2018-09-08 4:06 ` Bart Van Assche
2018-09-09 11:52 ` Ming Lei
2018-09-14 5:05 ` Maciej Żenczykowski
2018-09-17 6:58 ` Martin K. Petersen
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=1536272873.26747.11.camel@acm.org \
--to=bvanassche@acm.org \
--cc=adityakali@google.com \
--cc=groeck@chromium.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=maze@google.com \
--cc=ming.lei@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tytso@mit.edu \
--cc=xueweiz@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox