All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size
@ 2018-03-27 16:41 Fam Zheng
  2018-03-27 17:05 ` Daniel Henrique Barboza
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Fam Zheng @ 2018-03-27 16:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Fam Zheng, danielhb, eblake, dgibson

Some backends report big max_io_sectors. Making min_io_size the same
value in this case will make it impossible for guest to align memory,
therefore the disk may not be usable at all.

Do not enlarge them when they are zero.

Reported-by: David Gibson <dgibson@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>

---

v2: Leave the values alone if zero. [Paolo]
    At least we can consult block layer for a slightly more sensible
    opt_io_size, but that's for another patch.
---
 hw/scsi/scsi-disk.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index f5ab767ab5..f8ed8cf2b4 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -714,10 +714,12 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
 
                 /* min_io_size and opt_io_size can't be greater than
                  * max_io_sectors */
-                min_io_size =
-                    MIN_NON_ZERO(min_io_size, max_io_sectors);
-                opt_io_size =
-                    MIN_NON_ZERO(opt_io_size, max_io_sectors);
+                if (min_io_size) {
+                    min_io_size = MIN(min_io_size, max_io_sectors);
+                }
+                if (opt_io_size) {
+                    opt_io_size = MIN(opt_io_size, max_io_sectors);
+                }
             }
             /* required VPD size with unmap support */
             buflen = 0x40;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size
  2018-03-27 16:41 [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size Fam Zheng
@ 2018-03-27 17:05 ` Daniel Henrique Barboza
  2018-03-28  2:37 ` David Gibson
  2018-04-05 15:54 ` Paolo Bonzini
  2 siblings, 0 replies; 7+ messages in thread
From: Daniel Henrique Barboza @ 2018-03-27 17:05 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: Paolo Bonzini, dgibson



On 03/27/2018 01:41 PM, Fam Zheng wrote:
> Some backends report big max_io_sectors. Making min_io_size the same
> value in this case will make it impossible for guest to align memory,
> therefore the disk may not be usable at all.
>
> Do not enlarge them when they are zero.
>
> Reported-by: David Gibson <dgibson@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>
>
> ---
>
> v2: Leave the values alone if zero. [Paolo]
>      At least we can consult block layer for a slightly more sensible
>      opt_io_size, but that's for another patch.
> ---
>   hw/scsi/scsi-disk.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index f5ab767ab5..f8ed8cf2b4 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -714,10 +714,12 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
>
>                   /* min_io_size and opt_io_size can't be greater than
>                    * max_io_sectors */
> -                min_io_size =
> -                    MIN_NON_ZERO(min_io_size, max_io_sectors);
> -                opt_io_size =
> -                    MIN_NON_ZERO(opt_io_size, max_io_sectors);
> +                if (min_io_size) {
> +                    min_io_size = MIN(min_io_size, max_io_sectors);
> +                }
> +                if (opt_io_size) {
> +                    opt_io_size = MIN(opt_io_size, max_io_sectors);
> +                }
>               }
>               /* required VPD size with unmap support */
>               buflen = 0x40;

Reviewed-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size
  2018-03-27 16:41 [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size Fam Zheng
  2018-03-27 17:05 ` Daniel Henrique Barboza
@ 2018-03-28  2:37 ` David Gibson
  2018-04-05 15:54 ` Paolo Bonzini
  2 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2018-03-28  2:37 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-devel, danielhb, Paolo Bonzini, dgibson

[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]

On Wed, Mar 28, 2018 at 12:41:41AM +0800, Fam Zheng wrote:
> Some backends report big max_io_sectors. Making min_io_size the same
> value in this case will make it impossible for guest to align memory,
> therefore the disk may not be usable at all.
> 
> Do not enlarge them when they are zero.
> 
> Reported-by: David Gibson <dgibson@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>

Tested-by: David Gibson <david@gibson.dropbear.id.au>

With this patch applied, I was able to successfully install a ppc64le
guest again.

> 
> ---
> 
> v2: Leave the values alone if zero. [Paolo]
>     At least we can consult block layer for a slightly more sensible
>     opt_io_size, but that's for another patch.
> ---
>  hw/scsi/scsi-disk.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index f5ab767ab5..f8ed8cf2b4 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -714,10 +714,12 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
>  
>                  /* min_io_size and opt_io_size can't be greater than
>                   * max_io_sectors */
> -                min_io_size =
> -                    MIN_NON_ZERO(min_io_size, max_io_sectors);
> -                opt_io_size =
> -                    MIN_NON_ZERO(opt_io_size, max_io_sectors);
> +                if (min_io_size) {
> +                    min_io_size = MIN(min_io_size, max_io_sectors);
> +                }
> +                if (opt_io_size) {
> +                    opt_io_size = MIN(opt_io_size, max_io_sectors);
> +                }
>              }
>              /* required VPD size with unmap support */
>              buflen = 0x40;

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size
  2018-03-27 16:41 [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size Fam Zheng
  2018-03-27 17:05 ` Daniel Henrique Barboza
  2018-03-28  2:37 ` David Gibson
@ 2018-04-05 15:54 ` Paolo Bonzini
  2018-04-09  1:08   ` David Gibson
  2 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2018-04-05 15:54 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: danielhb, eblake, dgibson

On 27/03/2018 18:41, Fam Zheng wrote:
> Some backends report big max_io_sectors. Making min_io_size the same
> value in this case will make it impossible for guest to align memory,
> therefore the disk may not be usable at all.
> 
> Do not enlarge them when they are zero.
> 
> Reported-by: David Gibson <dgibson@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> 
> ---
> 
> v2: Leave the values alone if zero. [Paolo]
>     At least we can consult block layer for a slightly more sensible
>     opt_io_size, but that's for another patch.
> ---
>  hw/scsi/scsi-disk.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index f5ab767ab5..f8ed8cf2b4 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -714,10 +714,12 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
>  
>                  /* min_io_size and opt_io_size can't be greater than
>                   * max_io_sectors */
> -                min_io_size =
> -                    MIN_NON_ZERO(min_io_size, max_io_sectors);
> -                opt_io_size =
> -                    MIN_NON_ZERO(opt_io_size, max_io_sectors);
> +                if (min_io_size) {
> +                    min_io_size = MIN(min_io_size, max_io_sectors);
> +                }
> +                if (opt_io_size) {
> +                    opt_io_size = MIN(opt_io_size, max_io_sectors);
> +                }
>              }
>              /* required VPD size with unmap support */
>              buflen = 0x40;
> 

Queued, thanks.

Paolo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size
  2018-04-05 15:54 ` Paolo Bonzini
@ 2018-04-09  1:08   ` David Gibson
  2018-04-09  9:28     ` Paolo Bonzini
  0 siblings, 1 reply; 7+ messages in thread
From: David Gibson @ 2018-04-09  1:08 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Fam Zheng, qemu-devel, danielhb, eblake

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

On Thu, 5 Apr 2018 17:54:00 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 27/03/2018 18:41, Fam Zheng wrote:
> > Some backends report big max_io_sectors. Making min_io_size the same
> > value in this case will make it impossible for guest to align memory,
> > therefore the disk may not be usable at all.
> > 
> > Do not enlarge them when they are zero.
> > 
> > Reported-by: David Gibson <dgibson@redhat.com>
> > Signed-off-by: Fam Zheng <famz@redhat.com>
[snip]
> Queued, thanks.
> 
> Paolo

Any ETA on going from queued to actually merged?  This is holding up a
handful of Power bugfixes for 2.12, because I can't complete my usual
testing cycle.

-- 
David Gibson <dgibson@redhat.com>
Principal Software Engineer, Virtualization, Red Hat

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size
  2018-04-09  1:08   ` David Gibson
@ 2018-04-09  9:28     ` Paolo Bonzini
  2018-04-10  0:51       ` David Gibson
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2018-04-09  9:28 UTC (permalink / raw)
  To: David Gibson; +Cc: Fam Zheng, qemu-devel, danielhb, eblake

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

On 09/04/2018 03:08, David Gibson wrote:
> On Thu, 5 Apr 2018 17:54:00 +0200 Paolo Bonzini <pbonzini@redhat.com> wrote:
>> On 27/03/2018 18:41, Fam Zheng wrote:
>>> Some backends report big max_io_sectors. Making min_io_size the same
>>> value in this case will make it impossible for guest to align memory,
>>> therefore the disk may not be usable at all.
>>>
>>> Do not enlarge them when they are zero.
>>
>> Queued, thanks.
>>
>> Paolo
> 
> Any ETA on going from queued to actually merged?  This is holding up a
> handful of Power bugfixes for 2.12, because I can't complete my usual
> testing cycle.

Hi David,

it's already included in my pull request from Friday.

Paolo


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size
  2018-04-09  9:28     ` Paolo Bonzini
@ 2018-04-10  0:51       ` David Gibson
  0 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2018-04-10  0:51 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Fam Zheng, qemu-devel, danielhb, eblake

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

On Mon, 9 Apr 2018 11:28:16 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 09/04/2018 03:08, David Gibson wrote:
>  [...]  
>  [...]  
>  [...]  
>  [...]  
>  [...]  
> 
> Hi David,
> 
> it's already included in my pull request from Friday.

And I see it in master now.  Thanks!

-- 
David Gibson <dgibson@redhat.com>
Principal Software Engineer, Virtualization, Red Hat

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-10  0:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 16:41 [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size Fam Zheng
2018-03-27 17:05 ` Daniel Henrique Barboza
2018-03-28  2:37 ` David Gibson
2018-04-05 15:54 ` Paolo Bonzini
2018-04-09  1:08   ` David Gibson
2018-04-09  9:28     ` Paolo Bonzini
2018-04-10  0:51       ` David Gibson

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.