scsi-disk: Don't enlarge min_io_size to max_io_size
PATCH v2 1/1 scsi-disk: Don't enlarge min_io_size to max_io_size
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.
---
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(-)
hw/scsi/scsi-disk.c +6 -4
@@ -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 ;
Signature · 1 line
2.14.3
Quoted 29 lines · Fam Zheng
Some backends report big
max_io_sectors. Makingmin_io_sizethe 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 <[email protected]>Signed-off-by Fam Zheng <[email protected]>---
v2: Leave the values alone if zero. [Paolo]
At least we can consult block layer for a slightly more sensibleopt_io_size, but that's for another patch.--- hw/scsi/scsi-disk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)hw/scsi/scsi-disk.c +0
-3@@ -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 =
hw/scsi/scsi-disk.c static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) · line 725
Quoted 10 lines
hw/scsi/scsi-disk.c +6
-1-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 ;
Quoted 8 lines · Fam Zheng
Some backends report big
max_io_sectors. Makingmin_io_sizethe 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 <[email protected]>Signed-off-by Fam Zheng <[email protected]>
With this patch applied, I was able to successfully install a ppc64le guest again.
Quoted 31 lines
---
v2: Leave the values alone if zero. [Paolo]
At least we can consult block layer for a slightly more sensibleopt_io_size, but that's for another patch.--- hw/scsi/scsi-disk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)hw/scsi/scsi-disk.c +6
-4@@ -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 ;
Signature · 4 lines
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
Paolo Bonzini
AppliedQuoted 30 lines · Fam Zheng
Some backends report big
max_io_sectors. Makingmin_io_sizethe 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 <[email protected]>Signed-off-by Fam Zheng <[email protected]>---
v2: Leave the values alone if zero. [Paolo]
At least we can consult block layer for a slightly more sensibleopt_io_size, but that's for another patch.--- hw/scsi/scsi-disk.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)hw/scsi/scsi-disk.c +0
-3@@ -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 =
hw/scsi/scsi-disk.c static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) · line 725
Quoted 10 lines
hw/scsi/scsi-disk.c +6
-1-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
Quoted 9 lines · On Thu, 5 Apr 2018 17:54:00 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 8 lines · Fam Zheng
Some backends report big
max_io_sectors. Makingmin_io_sizethe 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 <[email protected]>Signed-off-by Fam Zheng <[email protected]>
[snip]
Quoted 3 lines
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.
Signature · 2 lines
David Gibson <[email protected]> Principal Software Engineer, Virtualization, Red Hat
Quoted 8 lines · David Gibson
Quoted 7 lines · On Thu, 5 Apr 2018 17:54:00 +0200 Paolo Bonzini <[email protected]> wrote:
Quoted 5 lines · Fam Zheng
Some backends report big
max_io_sectors. Makingmin_io_sizethe 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.
Quoted 7 lines
Quoted 3 lines
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
Quoted 10 lines · On Mon, 9 Apr 2018 11:28:16 +0200 Paolo Bonzini <[email protected]> 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!
Signature · 2 lines
David Gibson <[email protected]> Principal Software Engineer, Virtualization, Red Hat