* [PATCH] scsi: zero per-cmd driver data before each I/O
@ 2017-02-20 16:52 Christoph Hellwig
2017-02-20 17:00 ` Bart Van Assche
2017-02-21 6:48 ` Hannes Reinecke
0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2017-02-20 16:52 UTC (permalink / raw)
To: axboe, martin.petersen; +Cc: decui, linux-block, linux-scsi
Without this drivers that don't clear the state themselves can see off
effects. For example Hyper-V VMs using the storvsc driver will often
hang during boot due to uncleared Test Unit Ready failures.
Fixes: e9c787e6 ("scsi: allocate scsi_cmnd structures as part of struct request")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Dexuan Cui <decui@microsoft.com>
Tested-by: Dexuan Cui <decui@microsoft.com>
---
drivers/scsi/scsi_lib.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 90f65c8f487a..daced9db8af8 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1167,6 +1167,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
/* zero out the cmd, except for the embedded scsi_request */
memset((char *)cmd + sizeof(cmd->req), 0,
sizeof(*cmd) - sizeof(cmd->req));
+ memset((char *)(cmd + 1), 0, dev->host->hostt->cmd_size);
cmd->device = dev;
cmd->sense_buffer = buf;
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: zero per-cmd driver data before each I/O
2017-02-20 16:52 [PATCH] scsi: zero per-cmd driver data before each I/O Christoph Hellwig
@ 2017-02-20 17:00 ` Bart Van Assche
2017-02-21 6:48 ` Hannes Reinecke
1 sibling, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2017-02-20 17:00 UTC (permalink / raw)
To: Christoph Hellwig, axboe, martin.petersen; +Cc: decui, linux-block, linux-scsi
On 02/20/2017 08:52 AM, Christoph Hellwig wrote:=0A=
> Without this drivers that don't clear the state themselves can see off=0A=
> effects. For example Hyper-V VMs using the storvsc driver will often=0A=
> hang during boot due to uncleared Test Unit Ready failures.=0A=
> =0A=
> Fixes: e9c787e6 ("scsi: allocate scsi_cmnd structures as part of struct r=
equest")=0A=
> Signed-off-by: Christoph Hellwig <hch@lst.de>=0A=
> Reported-by: Dexuan Cui <decui@microsoft.com>=0A=
> Tested-by: Dexuan Cui <decui@microsoft.com>=0A=
> ---=0A=
> drivers/scsi/scsi_lib.c | 1 +=0A=
> 1 file changed, 1 insertion(+)=0A=
> =0A=
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c=0A=
> index 90f65c8f487a..daced9db8af8 100644=0A=
> --- a/drivers/scsi/scsi_lib.c=0A=
> +++ b/drivers/scsi/scsi_lib.c=0A=
> @@ -1167,6 +1167,7 @@ void scsi_init_command(struct scsi_device *dev, str=
uct scsi_cmnd *cmd)=0A=
> /* zero out the cmd, except for the embedded scsi_request */=0A=
> memset((char *)cmd + sizeof(cmd->req), 0,=0A=
> sizeof(*cmd) - sizeof(cmd->req));=0A=
> + memset((char *)(cmd + 1), 0, dev->host->hostt->cmd_size);=0A=
=0A=
Hello Christoph,=0A=
=0A=
Since this code is in the hot path: please combine the two memset()=0A=
calls into a single memset() call.=0A=
=0A=
Thanks,=0A=
=0A=
Bart.=0A=
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: zero per-cmd driver data before each I/O
@ 2017-02-20 17:00 ` Bart Van Assche
0 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2017-02-20 17:00 UTC (permalink / raw)
To: Christoph Hellwig, axboe, martin.petersen; +Cc: decui, linux-block, linux-scsi
On 02/20/2017 08:52 AM, Christoph Hellwig wrote:
> Without this drivers that don't clear the state themselves can see off
> effects. For example Hyper-V VMs using the storvsc driver will often
> hang during boot due to uncleared Test Unit Ready failures.
>
> Fixes: e9c787e6 ("scsi: allocate scsi_cmnd structures as part of struct request")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reported-by: Dexuan Cui <decui@microsoft.com>
> Tested-by: Dexuan Cui <decui@microsoft.com>
> ---
> drivers/scsi/scsi_lib.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 90f65c8f487a..daced9db8af8 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1167,6 +1167,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
> /* zero out the cmd, except for the embedded scsi_request */
> memset((char *)cmd + sizeof(cmd->req), 0,
> sizeof(*cmd) - sizeof(cmd->req));
> + memset((char *)(cmd + 1), 0, dev->host->hostt->cmd_size);
Hello Christoph,
Since this code is in the hot path: please combine the two memset()
calls into a single memset() call.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: zero per-cmd driver data before each I/O
2017-02-20 16:52 [PATCH] scsi: zero per-cmd driver data before each I/O Christoph Hellwig
@ 2017-02-21 6:48 ` Hannes Reinecke
2017-02-21 6:48 ` Hannes Reinecke
1 sibling, 0 replies; 5+ messages in thread
From: Hannes Reinecke @ 2017-02-21 6:48 UTC (permalink / raw)
To: Christoph Hellwig, axboe, martin.petersen; +Cc: decui, linux-block, linux-scsi
On 02/20/2017 05:52 PM, Christoph Hellwig wrote:
> Without this drivers that don't clear the state themselves can see off
> effects. For example Hyper-V VMs using the storvsc driver will often
> hang during boot due to uncleared Test Unit Ready failures.
>
> Fixes: e9c787e6 ("scsi: allocate scsi_cmnd structures as part of struct request")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reported-by: Dexuan Cui <decui@microsoft.com>
> Tested-by: Dexuan Cui <decui@microsoft.com>
> ---
> drivers/scsi/scsi_lib.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 90f65c8f487a..daced9db8af8 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1167,6 +1167,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
> /* zero out the cmd, except for the embedded scsi_request */
> memset((char *)cmd + sizeof(cmd->req), 0,
> sizeof(*cmd) - sizeof(cmd->req));
> + memset((char *)(cmd + 1), 0, dev->host->hostt->cmd_size);
>
> cmd->device = dev;
> cmd->sense_buffer = buf;
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: F. Imend�rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N�rnberg)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: zero per-cmd driver data before each I/O
@ 2017-02-21 6:48 ` Hannes Reinecke
0 siblings, 0 replies; 5+ messages in thread
From: Hannes Reinecke @ 2017-02-21 6:48 UTC (permalink / raw)
To: Christoph Hellwig, axboe, martin.petersen; +Cc: decui, linux-block, linux-scsi
On 02/20/2017 05:52 PM, Christoph Hellwig wrote:
> Without this drivers that don't clear the state themselves can see off
> effects. For example Hyper-V VMs using the storvsc driver will often
> hang during boot due to uncleared Test Unit Ready failures.
>
> Fixes: e9c787e6 ("scsi: allocate scsi_cmnd structures as part of struct request")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reported-by: Dexuan Cui <decui@microsoft.com>
> Tested-by: Dexuan Cui <decui@microsoft.com>
> ---
> drivers/scsi/scsi_lib.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 90f65c8f487a..daced9db8af8 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1167,6 +1167,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
> /* zero out the cmd, except for the embedded scsi_request */
> memset((char *)cmd + sizeof(cmd->req), 0,
> sizeof(*cmd) - sizeof(cmd->req));
> + memset((char *)(cmd + 1), 0, dev->host->hostt->cmd_size);
>
> cmd->device = dev;
> cmd->sense_buffer = buf;
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-21 6:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20 16:52 [PATCH] scsi: zero per-cmd driver data before each I/O Christoph Hellwig
2017-02-20 17:00 ` Bart Van Assche
2017-02-20 17:00 ` Bart Van Assche
2017-02-21 6:48 ` Hannes Reinecke
2017-02-21 6:48 ` Hannes Reinecke
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.