* [Qemu-devel] [PULL for-2.1 0/3] virtio-scsi fixes, and block/iscsi compilation fix
@ 2014-07-01 8:22 Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 1/3] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing Paolo Bonzini
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Paolo Bonzini @ 2014-07-01 8:22 UTC (permalink / raw)
To: qemu-devel
The following changes since commit ec9fe956d5c728da770db5ec9bc429080ccb5043:
Merge remote-tracking branch 'remotes/bonzini/small-fixes' into staging (2014-06-30 15:56:00 +0100)
are available in the git repository at:
git://github.com/bonzini/qemu.git scsi-next
for you to fetch changes up to 5da65870fb1f698aab8c265c55884ca3d955276b:
configure: Fix -lm test, so that tools can be compiled on hosts that require -lm (2014-07-01 09:42:59 +0200)
----------------------------------------------------------------
Alexey Kardashevskiy (1):
configure: Fix -lm test, so that tools can be compiled on hosts that require -lm
Cédric Le Goater (1):
virtio-scsi: scsi events must be converted to target endianness
Greg Kurz (1):
virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing
Makefile.target | 4 ----
configure | 2 +-
hw/scsi/virtio-scsi.c | 12 +++---------
3 files changed, 4 insertions(+), 14 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PULL 1/3] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing
2014-07-01 8:22 [Qemu-devel] [PULL for-2.1 0/3] virtio-scsi fixes, and block/iscsi compilation fix Paolo Bonzini
@ 2014-07-01 8:22 ` Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 2/3] virtio-scsi: scsi events must be converted to target endianness Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm Paolo Bonzini
2 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2014-07-01 8:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Greg Kurz
From: Greg Kurz <gkurz@linux.vnet.ibm.com>
Hotplug of a virtio scsi disk is currently broken: no disk appears in the
guest (verified with a fedora 20 host running a fedora 20 guest with KVM).
Bisect leeds to Paolo's patches to support any_layout, especially this
commit:
commit 36b15c79aa1bef5fe7543f9f2629b6413720bbfb
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue Jun 10 16:21:18 2014 +0200
virtio-scsi: start preparing for any_layout
It modifies virtio_scsi_pop_req() so that it is up to the callers to parse
the virtio scsi request. It seems that virtio_scsi_push_event() was not
modified accordingly...
This patch adds a call to virtio_scsi_parse_req(). It also drops some
sanity checks that are already performed by virtio_scsi_parse_req().
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/virtio-scsi.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 04ecfa7..3fecdca 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -565,7 +565,6 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
VirtIOSCSIReq *req;
VirtIOSCSIEvent *evt;
VirtIODevice *vdev = VIRTIO_DEVICE(s);
- int in_size;
if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
return;
@@ -577,17 +576,12 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
return;
}
- if (req->elem.out_num) {
- virtio_scsi_bad_req();
- }
-
if (s->events_dropped) {
event |= VIRTIO_SCSI_T_EVENTS_MISSED;
s->events_dropped = false;
}
- in_size = iov_size(req->elem.in_sg, req->elem.in_num);
- if (in_size < sizeof(VirtIOSCSIEvent)) {
+ if (virtio_scsi_parse_req(req, 0, sizeof(VirtIOSCSIEvent))) {
virtio_scsi_bad_req();
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PULL 2/3] virtio-scsi: scsi events must be converted to target endianness
2014-07-01 8:22 [Qemu-devel] [PULL for-2.1 0/3] virtio-scsi fixes, and block/iscsi compilation fix Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 1/3] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing Paolo Bonzini
@ 2014-07-01 8:22 ` Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm Paolo Bonzini
2 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2014-07-01 8:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Cédric Le Goater, Greg Kurz
From: Cédric Le Goater <clg@fr.ibm.com>
Virtio SCSI Events need to be byteswapped before being pushed
when host and guest have a different endianness. Not doing so
breaks hotplug of virtio scsi disks, with the following error
message being printed in the guest console:
virtio_scsi: Unsupport virtio scsi event 1000000
This issue got uncovered while testing disk hotplug with a PowerKVM
ppc64le guest. I have checked that this issue also affects a x86_64
guest run on a ppc64 host.
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
[ Ported from PowerKVM,
Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/virtio-scsi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 3fecdca..0eb069a 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -587,8 +587,8 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
evt = &req->resp.event;
memset(evt, 0, sizeof(VirtIOSCSIEvent));
- evt->event = event;
- evt->reason = reason;
+ evt->event = virtio_tswap32(vdev, event);
+ evt->reason = virtio_tswap32(vdev, reason);
if (!dev) {
assert(event == VIRTIO_SCSI_T_EVENTS_MISSED);
} else {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm
2014-07-01 8:22 [Qemu-devel] [PULL for-2.1 0/3] virtio-scsi fixes, and block/iscsi compilation fix Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 1/3] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 2/3] virtio-scsi: scsi events must be converted to target endianness Paolo Bonzini
@ 2014-07-01 8:22 ` Paolo Bonzini
2014-07-01 8:26 ` Peter Maydell
2 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2014-07-01 8:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy
From: Alexey Kardashevskiy <aik@ozlabs.ru>
The existing test whether "-lm" needs to be included or not is
insufficient as it reports false negative on Fedora20/ppc64.
This happens because sin(0.0) is a constant value which compiler
can safely throw away and therefore there is no need to add "-lm".
As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile.
This adds a global variable and uses it in the test to prevent
from optimization.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
[Remove now useless -lm addition in Makefile.target. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Makefile.target | 4 ----
configure | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index 6089d29..137d0b0 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -163,10 +163,6 @@ dummy := $(call unnest-vars,.., \
all-obj-y += $(common-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
-ifndef CONFIG_HAIKU
-LIBS+=-lm
-endif
-
# build either PROG or PROGW
$(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
$(call LINK,$^)
diff --git a/configure b/configure
index 23ecb37..6dd44a9 100755
--- a/configure
+++ b/configure
@@ -3453,7 +3453,7 @@ fi
# Do we need libm
cat > $TMPC << EOF
#include <math.h>
-int main(void) { return isnan(sin(0.0)); }
+double x; int main(void) {return isnan(sin(x));}
EOF
if compile_prog "" "" ; then
:
--
1.8.3.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm
2014-07-01 8:22 ` [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm Paolo Bonzini
@ 2014-07-01 8:26 ` Peter Maydell
2014-07-01 17:26 ` Eric Blake
2014-07-02 7:02 ` Markus Armbruster
0 siblings, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2014-07-01 8:26 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Alexey Kardashevskiy, QEMU Developers
On 1 July 2014 09:22, Paolo Bonzini <pbonzini@redhat.com> wrote:
> From: Alexey Kardashevskiy <aik@ozlabs.ru>
>
> The existing test whether "-lm" needs to be included or not is
> insufficient as it reports false negative on Fedora20/ppc64.
> This happens because sin(0.0) is a constant value which compiler
> can safely throw away and therefore there is no need to add "-lm".
> As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile.
>
> This adds a global variable and uses it in the test to prevent
> from optimization.
> --- a/configure
> +++ b/configure
> @@ -3453,7 +3453,7 @@ fi
> # Do we need libm
> cat > $TMPC << EOF
> #include <math.h>
> -int main(void) { return isnan(sin(0.0)); }
> +double x; int main(void) {return isnan(sin(x));}
> EOF
> if compile_prog "" "" ; then
> :
This looks to me like we're leaving ourselves open for
a smarter compiler with linktime optimisation to complain
that x is used uninitialized.
thanks
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm
2014-07-01 8:26 ` Peter Maydell
@ 2014-07-01 17:26 ` Eric Blake
2014-07-02 7:02 ` Markus Armbruster
1 sibling, 0 replies; 8+ messages in thread
From: Eric Blake @ 2014-07-01 17:26 UTC (permalink / raw)
To: Peter Maydell, Paolo Bonzini; +Cc: Alexey Kardashevskiy, QEMU Developers
[-- Attachment #1: Type: text/plain, Size: 1267 bytes --]
On 07/01/2014 02:26 AM, Peter Maydell wrote:
> On 1 July 2014 09:22, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> From: Alexey Kardashevskiy <aik@ozlabs.ru>
>>
>> The existing test whether "-lm" needs to be included or not is
>> insufficient as it reports false negative on Fedora20/ppc64.
>> This happens because sin(0.0) is a constant value which compiler
>> can safely throw away and therefore there is no need to add "-lm".
>> As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile.
>>
>> This adds a global variable and uses it in the test to prevent
>> from optimization.
>
>> --- a/configure
>> +++ b/configure
>> @@ -3453,7 +3453,7 @@ fi
>> # Do we need libm
>> cat > $TMPC << EOF
>> #include <math.h>
>> -int main(void) { return isnan(sin(0.0)); }
>> +double x; int main(void) {return isnan(sin(x));}
>> EOF
>> if compile_prog "" "" ; then
>> :
>
> This looks to me like we're leaving ourselves open for
> a smarter compiler with linktime optimisation to complain
> that x is used uninitialized.
If that's your worry, what about:
int main(int argc, char **argv) { return isnan(sin(argc > 1)); }
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm
2014-07-01 8:26 ` Peter Maydell
2014-07-01 17:26 ` Eric Blake
@ 2014-07-02 7:02 ` Markus Armbruster
2014-07-02 9:40 ` Peter Maydell
1 sibling, 1 reply; 8+ messages in thread
From: Markus Armbruster @ 2014-07-02 7:02 UTC (permalink / raw)
To: Peter Maydell; +Cc: Alexey Kardashevskiy, Paolo Bonzini, QEMU Developers
Peter Maydell <peter.maydell@linaro.org> writes:
> On 1 July 2014 09:22, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> From: Alexey Kardashevskiy <aik@ozlabs.ru>
>>
>> The existing test whether "-lm" needs to be included or not is
>> insufficient as it reports false negative on Fedora20/ppc64.
>> This happens because sin(0.0) is a constant value which compiler
>> can safely throw away and therefore there is no need to add "-lm".
>> As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile.
>>
>> This adds a global variable and uses it in the test to prevent
>> from optimization.
>
>> --- a/configure
>> +++ b/configure
>> @@ -3453,7 +3453,7 @@ fi
>> # Do we need libm
>> cat > $TMPC << EOF
>> #include <math.h>
>> -int main(void) { return isnan(sin(0.0)); }
>> +double x; int main(void) {return isnan(sin(x));}
>> EOF
>> if compile_prog "" "" ; then
>> :
>
> This looks to me like we're leaving ourselves open for
> a smarter compiler with linktime optimisation to complain
> that x is used uninitialized.
x *is* initialized, to zero. A sufficiently smart compiler(TM) could
figure out that x is still zero in main(), and constant fold the test
away.
Suggest to use argc.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm
2014-07-02 7:02 ` Markus Armbruster
@ 2014-07-02 9:40 ` Peter Maydell
0 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2014-07-02 9:40 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Alexey Kardashevskiy, Paolo Bonzini, QEMU Developers
On 2 July 2014 08:02, Markus Armbruster <armbru@redhat.com> wrote:
>> This looks to me like we're leaving ourselves open for
>> a smarter compiler with linktime optimisation to complain
>> that x is used uninitialized.
>
> x *is* initialized, to zero. A sufficiently smart compiler(TM) could
> figure out that x is still zero in main(), and constant fold the test
> away.
Yes, I was wrong there.
> Suggest to use argc.
That's what we did -- see commit f80ea986.
thanks
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-07-02 9:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-01 8:22 [Qemu-devel] [PULL for-2.1 0/3] virtio-scsi fixes, and block/iscsi compilation fix Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 1/3] virtio-scsi: virtio_scsi_push_event() lacks VirtIOSCSIReq parsing Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 2/3] virtio-scsi: scsi events must be converted to target endianness Paolo Bonzini
2014-07-01 8:22 ` [Qemu-devel] [PULL 3/3] configure: Fix -lm test, so that tools can be compiled on hosts that require -lm Paolo Bonzini
2014-07-01 8:26 ` Peter Maydell
2014-07-01 17:26 ` Eric Blake
2014-07-02 7:02 ` Markus Armbruster
2014-07-02 9:40 ` Peter Maydell
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.