qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, danielhb@linux.vnet.ibm.com,
	Paolo Bonzini <pbonzini@redhat.com>,
	dgibson@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] scsi-disk: Don't enlarge min_io_size to max_io_size
Date: Wed, 28 Mar 2018 13:37:13 +1100	[thread overview]
Message-ID: <20180328023713.GH3510@umbus.fritz.box> (raw)
In-Reply-To: <20180327164141.19075-1-famz@redhat.com>

[-- 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 --]

  parent reply	other threads:[~2018-03-28  3:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=20180328023713.GH3510@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=danielhb@linux.vnet.ibm.com \
    --cc=dgibson@redhat.com \
    --cc=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).