* [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers
@ 2020-03-31 14:56 Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 01/10] checkpatch: enforce process for expected files Michael S. Tsirkin
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell
The following changes since commit 5acad5bf480321f178866dc28e38eeda5a3f19bb:
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2020-03-28 00:27:04 +0000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to e82cdba3945340f524ba153170d52800dbd55ca4:
vhost-vsock: fix double close() in the realize() error path (2020-03-31 10:54:28 -0400)
----------------------------------------------------------------
virtio, pci, pc: bugfixes, checkpatch, maintainers
Bugfixes all over the place.
Add a new balloon maintainer.
A checkpatch enhancement to enforce ACPI change rules.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----------------------------------------------------------------
David Hildenbrand (1):
MAINTAINERS: Add myself as virtio-balloon co-maintainer
Gerd Hoffmann (1):
acpi: add acpi=OnOffAuto machine property to x86 and arm virt
Igor Mammedov (1):
acpi: pcihp: fix left shift undefined behavior in acpi_pcihp_eject_slot()
Li Feng (1):
fix vhost_user_blk_watch crash
Michael S. Tsirkin (1):
checkpatch: enforce process for expected files
Pan Nengyuan (3):
virtio-serial-bus: Plug memory leak on realize() error paths
virtio-blk: delete vqs on the error path in realize()
virtio-iommu: avoid memleak in the unrealize
Peter Maydell (1):
hw/i386/amd_iommu.c: Fix corruption of log events passed to guest
Stefano Garzarella (1):
vhost-vsock: fix double close() in the realize() error path
include/hw/acpi/acpi.h | 1 -
include/hw/arm/virt.h | 2 ++
include/hw/i386/x86.h | 3 +++
include/hw/virtio/vhost-user-blk.h | 1 -
hw/acpi/pcihp.c | 2 +-
hw/arm/virt-acpi-build.c | 2 +-
hw/arm/virt.c | 36 ++++++++++++++++++++++++++++++++++--
hw/block/vhost-user-blk.c | 19 -------------------
hw/block/virtio-blk.c | 3 +++
hw/char/virtio-serial-bus.c | 2 +-
hw/i386/acpi-build.c | 2 +-
hw/i386/amd_iommu.c | 2 +-
hw/i386/pc.c | 4 ++--
hw/i386/pc_piix.c | 2 +-
hw/i386/x86.c | 32 ++++++++++++++++++++++++++++++++
hw/virtio/vhost-vsock.c | 6 +++++-
hw/virtio/virtio-iommu.c | 3 +++
softmmu/vl.c | 4 ++--
MAINTAINERS | 9 +++++++++
scripts/checkpatch.pl | 25 +++++++++++++++++++++++++
20 files changed, 126 insertions(+), 34 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PULL 01/10] checkpatch: enforce process for expected files
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 02/10] MAINTAINERS: Add myself as virtio-balloon co-maintainer Michael S. Tsirkin
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Philippe Mathieu-Daudé,
Richard Henderson, Stefan Hajnoczi, Igor Mammedov, Paolo Bonzini,
Alex Bennée
If the process documented in tests/qtest/bios-tables-test.c
is followed, then same patch never touches both expected
files and code. Teach checkpatch to enforce this rule.
Tested-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
scripts/checkpatch.pl | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b27e4ff5e9..e658e6546f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -35,6 +35,8 @@ my $summary_file = 0;
my $root;
my %debug;
my $help = 0;
+my $acpi_testexpected;
+my $acpi_nontestexpected;
sub help {
my ($exitcode) = @_;
@@ -1256,6 +1258,27 @@ sub WARN {
}
}
+# According to tests/qtest/bios-tables-test.c: do not
+# change expected file in the same commit with adding test
+sub checkfilename {
+ my ($name) = @_;
+ if ($name =~ m#^tests/data/acpi/# and
+ # make exception for a shell script that rebuilds the files
+ not $name =~ m#^\.sh$# or
+ $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
+ $acpi_testexpected = $name;
+ } else {
+ $acpi_nontestexpected = $name;
+ }
+ if (defined $acpi_testexpected and defined $acpi_nontestexpected) {
+ ERROR("Do not add expected files together with tests, " .
+ "follow instructions in " .
+ "tests/qtest/bios-tables-test.c: both " .
+ $acpi_testexpected . " and " .
+ $acpi_nontestexpected . " found\n");
+ }
+}
+
sub process {
my $filename = shift;
@@ -1431,9 +1454,11 @@ sub process {
if ($line =~ /^diff --git.*?(\S+)$/) {
$realfile = $1;
$realfile =~ s@^([^/]*)/@@ if (!$file);
+ checkfilename($realfile);
} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
$realfile = $1;
$realfile =~ s@^([^/]*)/@@ if (!$file);
+ checkfilename($realfile);
$p1_prefix = $1;
if (!$file && $tree && $p1_prefix ne '' &&
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 02/10] MAINTAINERS: Add myself as virtio-balloon co-maintainer
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 01/10] checkpatch: enforce process for expected files Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 03/10] virtio-serial-bus: Plug memory leak on realize() error paths Michael S. Tsirkin
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, David Hildenbrand, Laurent Vivier,
Markus Armbruster, Aleksandar Markovic,
Philippe Mathieu-Daudé
From: David Hildenbrand <david@redhat.com>
As suggested by Michael, let's add me as co-maintainer of virtio-balloon.
While at it, also add "balloon.c" and "include/sysemu/balloon.h" to the
file list.
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200312133725.8192-1-david@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
MAINTAINERS | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index b5c86ec494..e580276603 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1634,6 +1634,15 @@ F: hw/virtio/trace-events
F: net/vhost-user.c
F: include/hw/virtio/
+virtio-balloon
+M: Michael S. Tsirkin <mst@redhat.com>
+M: David Hildenbrand <david@redhat.com>
+S: Maintained
+F: hw/virtio/virtio-balloon*.c
+F: include/hw/virtio/virtio-balloon.h
+F: balloon.c
+F: include/sysemu/balloon.h
+
virtio-9p
M: Greg Kurz <groug@kaod.org>
R: Christian Schoenebeck <qemu_oss@crudebyte.com>
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 03/10] virtio-serial-bus: Plug memory leak on realize() error paths
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 01/10] checkpatch: enforce process for expected files Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 02/10] MAINTAINERS: Add myself as virtio-balloon co-maintainer Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 04/10] acpi: pcihp: fix left shift undefined behavior in acpi_pcihp_eject_slot() Michael S. Tsirkin
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Peter Maydell, Amit Shah, Pan Nengyuan,
Markus Armbruster, Paolo Bonzini, Euler Robot,
Marc-André Lureau
From: Pan Nengyuan <pannengyuan@huawei.com>
We neglect to free port->bh on the error paths. Fix that.
Reproducer:
{'execute': 'device_add', 'arguments': {'id': 'virtio_serial_pci0', 'driver': 'virtio-serial-pci', 'bus': 'pci.0', 'addr': '0x5'}, 'id': 'yVkZcGgV'}
{'execute': 'device_add', 'arguments': {'id': 'port1', 'driver': 'virtserialport', 'name': 'port1', 'chardev': 'channel1', 'bus': 'virtio_serial_pci0.0', 'nr': 1}, 'id': '3dXdUgJA'}
{'execute': 'device_add', 'arguments': {'id': 'port2', 'driver': 'virtserialport', 'name': 'port2', 'chardev': 'channel2', 'bus': 'virtio_serial_pci0.0', 'nr': 1}, 'id': 'qLzcCkob'}
{'execute': 'device_add', 'arguments': {'id': 'port2', 'driver': 'virtserialport', 'name': 'port2', 'chardev': 'channel2', 'bus': 'virtio_serial_pci0.0', 'nr': 2}, 'id': 'qLzcCkob'}
The leak stack:
Direct leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x7f04a8008ae8 in __interceptor_malloc (/lib64/libasan.so.5+0xefae8)
#1 0x7f04a73cf1d5 in g_malloc (/lib64/libglib-2.0.so.0+0x531d5)
#2 0x56273eaee484 in aio_bh_new /mnt/sdb/backup/qemu/util/async.c:125
#3 0x56273eafe9a8 in qemu_bh_new /mnt/sdb/backup/qemu/util/main-loop.c:532
#4 0x56273d52e62e in virtser_port_device_realize /mnt/sdb/backup/qemu/hw/char/virtio-serial-bus.c:946
#5 0x56273dcc5040 in device_set_realized /mnt/sdb/backup/qemu/hw/core/qdev.c:891
#6 0x56273e5ebbce in property_set_bool /mnt/sdb/backup/qemu/qom/object.c:2238
#7 0x56273e5e5a9c in object_property_set /mnt/sdb/backup/qemu/qom/object.c:1324
#8 0x56273e5ef5f8 in object_property_set_qobject /mnt/sdb/backup/qemu/qom/qom-qobject.c:26
#9 0x56273e5e5e6a in object_property_set_bool /mnt/sdb/backup/qemu/qom/object.c:1390
#10 0x56273daa40de in qdev_device_add /mnt/sdb/backup/qemu/qdev-monitor.c:680
#11 0x56273daa53e9 in qmp_device_add /mnt/sdb/backup/qemu/qdev-monitor.c:805
Fixes: 199646d81522509ac2dba6d28c31e8c7d807bc93
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Amit Shah <amit@kernel.org>
Message-Id: <20200309021738.30072-1-pannengyuan@huawei.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/char/virtio-serial-bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 941ed5aca9..99a65bab7f 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -943,7 +943,6 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
Error *err = NULL;
port->vser = bus->vser;
- port->bh = qemu_bh_new(flush_queued_data_bh, port);
assert(vsc->have_data);
@@ -992,6 +991,7 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
return;
}
+ port->bh = qemu_bh_new(flush_queued_data_bh, port);
port->elem = NULL;
}
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 04/10] acpi: pcihp: fix left shift undefined behavior in acpi_pcihp_eject_slot()
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
` (2 preceding siblings ...)
2020-03-31 14:57 ` [PULL 03/10] virtio-serial-bus: Plug memory leak on realize() error paths Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 05/10] virtio-blk: delete vqs on the error path in realize() Michael S. Tsirkin
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov
From: Igor Mammedov <imammedo@redhat.com>
Coverity spots subj in following guest triggered code path
pci_write(, data = 0) -> acpi_pcihp_eject_slot(,slots = 0)
uinst32_t slot = ctz32(slots)
...
... = ~(1U << slot)
where 'slot' value is 32 in case 'slots' bitmap is empty.
'slots' is a bitmap and empty one shouldn't do anything
so return early doing nothing if resulted slot value is
not valid (i.e. not in 0-31 range)
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200326135624.32464-1-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/acpi/pcihp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 4dcef372bf..0dc963e983 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -154,7 +154,7 @@ static void acpi_pcihp_eject_slot(AcpiPciHpState *s, unsigned bsel, unsigned slo
trace_acpi_pci_eject_slot(bsel, slot);
- if (!bus) {
+ if (!bus || slot > 31) {
return;
}
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 05/10] virtio-blk: delete vqs on the error path in realize()
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
` (3 preceding siblings ...)
2020-03-31 14:57 ` [PULL 04/10] acpi: pcihp: fix left shift undefined behavior in acpi_pcihp_eject_slot() Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 06/10] virtio-iommu: avoid memleak in the unrealize Michael S. Tsirkin
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, qemu-block, Pan Nengyuan, Max Reitz,
Stefan Hajnoczi, Euler Robot, Stefano Garzarella
From: Pan Nengyuan <pannengyuan@huawei.com>
virtio_vqs forgot to free on the error path in realize(). Fix that.
The asan stack:
Direct leak of 14336 byte(s) in 1 object(s) allocated from:
#0 0x7f58b93fd970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7f58b858249d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x5562cc627f49 in virtio_add_queue /mnt/sdb/qemu/hw/virtio/virtio.c:2413
#3 0x5562cc4b524a in virtio_blk_device_realize /mnt/sdb/qemu/hw/block/virtio-blk.c:1202
#4 0x5562cc613050 in virtio_device_realize /mnt/sdb/qemu/hw/virtio/virtio.c:3615
#5 0x5562ccb7a568 in device_set_realized /mnt/sdb/qemu/hw/core/qdev.c:891
#6 0x5562cd39cd45 in property_set_bool /mnt/sdb/qemu/qom/object.c:2238
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20200328005705.29898-2-pannengyuan@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/block/virtio-blk.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 142863a3b2..97ba8a2187 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1204,6 +1204,9 @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp)
virtio_blk_data_plane_create(vdev, conf, &s->dataplane, &err);
if (err != NULL) {
error_propagate(errp, err);
+ for (i = 0; i < conf->num_queues; i++) {
+ virtio_del_queue(vdev, i);
+ }
virtio_cleanup(vdev);
return;
}
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 06/10] virtio-iommu: avoid memleak in the unrealize
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
` (4 preceding siblings ...)
2020-03-31 14:57 ` [PULL 05/10] virtio-blk: delete vqs on the error path in realize() Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 07/10] hw/i386/amd_iommu.c: Fix corruption of log events passed to guest Michael S. Tsirkin
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Pan Nengyuan, Eric Auger
From: Pan Nengyuan <pannengyuan@huawei.com>
req_vq/event_vq forgot to free in unrealize. Fix that.
And also do clean 's->as_by_busptr' hash table in unrealize to fix another leak.
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Acked-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20200328005705.29898-3-pannengyuan@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/virtio/virtio-iommu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index 4cee8083bc..22ba8848c2 100644
--- a/hw/virtio/virtio-iommu.c
+++ b/hw/virtio/virtio-iommu.c
@@ -693,9 +693,12 @@ static void virtio_iommu_device_unrealize(DeviceState *dev, Error **errp)
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOIOMMU *s = VIRTIO_IOMMU(dev);
+ g_hash_table_destroy(s->as_by_busptr);
g_tree_destroy(s->domains);
g_tree_destroy(s->endpoints);
+ virtio_delete_queue(s->req_vq);
+ virtio_delete_queue(s->event_vq);
virtio_cleanup(vdev);
}
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 07/10] hw/i386/amd_iommu.c: Fix corruption of log events passed to guest
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
` (5 preceding siblings ...)
2020-03-31 14:57 ` [PULL 06/10] virtio-iommu: avoid memleak in the unrealize Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 08/10] fix vhost_user_blk_watch crash Michael S. Tsirkin
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Eduardo Habkost, qemu-stable, Paolo Bonzini,
Richard Henderson
From: Peter Maydell <peter.maydell@linaro.org>
In the function amdvi_log_event(), we write an event log buffer
entry into guest ram, whose contents are passed to the function
via the "uint64_t *evt" argument. Unfortunately, a spurious
'&' in the call to dma_memory_write() meant that instead of
writing the event to the guest we would write the literal value
of the pointer, plus whatever was in the following 8 bytes
on the stack. This error was spotted by Coverity.
Fix the bug by removing the '&'.
Fixes: CID 1421945
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200326105349.24588-1-peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/amd_iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index b1175e52c7..fd75cae024 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -181,7 +181,7 @@ static void amdvi_log_event(AMDVIState *s, uint64_t *evt)
}
if (dma_memory_write(&address_space_memory, s->evtlog + s->evtlog_tail,
- &evt, AMDVI_EVENT_LEN)) {
+ evt, AMDVI_EVENT_LEN)) {
trace_amdvi_evntlog_fail(s->evtlog, s->evtlog_tail);
}
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 08/10] fix vhost_user_blk_watch crash
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
` (6 preceding siblings ...)
2020-03-31 14:57 ` [PULL 07/10] hw/i386/amd_iommu.c: Fix corruption of log events passed to guest Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 09/10] acpi: add acpi=OnOffAuto machine property to x86 and arm virt Michael S. Tsirkin
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Peter Maydell, Li Feng, qemu-block, Max Reitz
From: Li Feng <fengli@smartx.com>
the G_IO_HUP is watched in tcp_chr_connect, and the callback
vhost_user_blk_watch is not needed, because tcp_chr_hup is registered as
callback. And it will close the tcp link.
Signed-off-by: Li Feng <fengli@smartx.com>
Message-Id: <20200323052924.29286-1-fengli@smartx.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/vhost-user-blk.h | 1 -
hw/block/vhost-user-blk.c | 19 -------------------
2 files changed, 20 deletions(-)
diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-user-blk.h
index 05ea0ad183..34ad6f0c0e 100644
--- a/include/hw/virtio/vhost-user-blk.h
+++ b/include/hw/virtio/vhost-user-blk.h
@@ -38,7 +38,6 @@ typedef struct VHostUserBlk {
VhostUserState vhost_user;
struct vhost_virtqueue *vhost_vqs;
VirtQueue **virtqs;
- guint watch;
bool connected;
} VHostUserBlk;
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 12925a47ec..17df5338e7 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -349,18 +349,6 @@ static void vhost_user_blk_disconnect(DeviceState *dev)
vhost_dev_cleanup(&s->dev);
}
-static gboolean vhost_user_blk_watch(GIOChannel *chan, GIOCondition cond,
- void *opaque)
-{
- DeviceState *dev = opaque;
- VirtIODevice *vdev = VIRTIO_DEVICE(dev);
- VHostUserBlk *s = VHOST_USER_BLK(vdev);
-
- qemu_chr_fe_disconnect(&s->chardev);
-
- return true;
-}
-
static void vhost_user_blk_event(void *opaque, QEMUChrEvent event)
{
DeviceState *dev = opaque;
@@ -373,15 +361,9 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event)
qemu_chr_fe_disconnect(&s->chardev);
return;
}
- s->watch = qemu_chr_fe_add_watch(&s->chardev, G_IO_HUP,
- vhost_user_blk_watch, dev);
break;
case CHR_EVENT_CLOSED:
vhost_user_blk_disconnect(dev);
- if (s->watch) {
- g_source_remove(s->watch);
- s->watch = 0;
- }
break;
case CHR_EVENT_BREAK:
case CHR_EVENT_MUX_IN:
@@ -428,7 +410,6 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)
s->inflight = g_new0(struct vhost_inflight, 1);
s->vhost_vqs = g_new0(struct vhost_virtqueue, s->num_queues);
- s->watch = 0;
s->connected = false;
qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, vhost_user_blk_event,
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 09/10] acpi: add acpi=OnOffAuto machine property to x86 and arm virt
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
` (7 preceding siblings ...)
2020-03-31 14:57 ` [PULL 08/10] fix vhost_user_blk_watch crash Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 10/10] vhost-vsock: fix double close() in the realize() error path Michael S. Tsirkin
2020-03-31 16:56 ` [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Peter Maydell
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Eduardo Habkost, Shannon Zhao, qemu-arm,
Gerd Hoffmann, Paolo Bonzini, Igor Mammedov,
Philippe Mathieu-Daudé,
Richard Henderson
From: Gerd Hoffmann <kraxel@redhat.com>
Remove the global acpi_enabled bool and replace it with an
acpi OnOffAuto machine property.
qemu throws an error now if you use -no-acpi while the machine
type you are using doesn't support acpi in the first place.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20200320100136.11717-1-kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/acpi/acpi.h | 1 -
include/hw/arm/virt.h | 2 ++
include/hw/i386/x86.h | 3 +++
hw/arm/virt-acpi-build.c | 2 +-
hw/arm/virt.c | 36 ++++++++++++++++++++++++++++++++++--
hw/i386/acpi-build.c | 2 +-
hw/i386/pc.c | 4 ++--
hw/i386/pc_piix.c | 2 +-
hw/i386/x86.c | 32 ++++++++++++++++++++++++++++++++
softmmu/vl.c | 4 ++--
10 files changed, 78 insertions(+), 10 deletions(-)
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index 1f2dafbd7d..4bef575312 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -181,7 +181,6 @@ void acpi_send_gpe_event(ACPIREGS *ar, qemu_irq irq,
void acpi_update_sci(ACPIREGS *acpi_regs, qemu_irq irq);
/* acpi.c */
-extern int acpi_enabled;
extern char unsigned *acpi_tables;
extern size_t acpi_tables_len;
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 893796d3b0..60b2f521eb 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -131,6 +131,7 @@ typedef struct {
bool highmem_ecam;
bool its;
bool virt;
+ OnOffAuto acpi;
VirtGICType gic_version;
VirtIOMMUType iommu;
uint16_t virtio_iommu_bdf;
@@ -163,6 +164,7 @@ typedef struct {
OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
void virt_acpi_setup(VirtMachineState *vms);
+bool virt_is_acpi_enabled(VirtMachineState *vms);
/* Return the number of used redistributor regions */
static inline int virt_gicv3_redist_region_count(VirtMachineState *vms)
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index 22babcb3bb..54af8ab5cf 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -64,6 +64,7 @@ typedef struct {
unsigned smp_dies;
OnOffAuto smm;
+ OnOffAuto acpi;
/*
* Address space used by IOAPIC device. All IOAPIC interrupts
@@ -74,6 +75,7 @@ typedef struct {
#define X86_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
#define X86_MACHINE_SMM "smm"
+#define X86_MACHINE_ACPI "acpi"
#define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86")
#define X86_MACHINE(obj) \
@@ -104,6 +106,7 @@ void x86_load_linux(X86MachineState *x86ms,
bool linuxboot_dma_enabled);
bool x86_machine_is_smm_enabled(X86MachineState *x86ms);
+bool x86_machine_is_acpi_enabled(X86MachineState *x86ms);
/* Global System Interrupts */
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index fb4b166f82..7ef0733d71 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -910,7 +910,7 @@ void virt_acpi_setup(VirtMachineState *vms)
return;
}
- if (!acpi_enabled) {
+ if (!virt_is_acpi_enabled(vms)) {
trace_virt_acpi_setup();
return;
}
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 94f93dda54..7dc96abf72 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -67,6 +67,7 @@
#include "kvm_arm.h"
#include "hw/firmware/smbios.h"
#include "qapi/visitor.h"
+#include "qapi/qapi-visit-common.h"
#include "standard-headers/linux/input.h"
#include "hw/arm/smmuv3.h"
#include "hw/acpi/acpi.h"
@@ -1844,7 +1845,7 @@ static void machvirt_init(MachineState *machine)
create_pcie(vms);
- if (has_ged && aarch64 && firmware_loaded && acpi_enabled) {
+ if (has_ged && aarch64 && firmware_loaded && virt_is_acpi_enabled(vms)) {
vms->acpi_dev = create_acpi_ged(vms);
} else {
create_gpio(vms);
@@ -1934,6 +1935,31 @@ static void virt_set_its(Object *obj, bool value, Error **errp)
vms->its = value;
}
+bool virt_is_acpi_enabled(VirtMachineState *vms)
+{
+ if (vms->acpi == ON_OFF_AUTO_OFF) {
+ return false;
+ }
+ return true;
+}
+
+static void virt_get_acpi(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ VirtMachineState *vms = VIRT_MACHINE(obj);
+ OnOffAuto acpi = vms->acpi;
+
+ visit_type_OnOffAuto(v, name, &acpi, errp);
+}
+
+static void virt_set_acpi(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ VirtMachineState *vms = VIRT_MACHINE(obj);
+
+ visit_type_OnOffAuto(v, name, &vms->acpi, errp);
+}
+
static char *virt_get_gic_version(Object *obj, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -2113,7 +2139,7 @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine,
if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_IOMMU_PCI)) {
VirtMachineState *vms = VIRT_MACHINE(machine);
- if (!vms->bootinfo.firmware_loaded || !acpi_enabled) {
+ if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled(vms)) {
return HOTPLUG_HANDLER(machine);
}
}
@@ -2184,6 +2210,12 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
mc->numa_mem_supported = true;
mc->auto_enable_numa_with_memhp = true;
mc->default_ram_id = "mach-virt.ram";
+
+ object_class_property_add(oc, "acpi", "OnOffAuto",
+ virt_get_acpi, virt_set_acpi,
+ NULL, NULL, &error_abort);
+ object_class_property_set_description(oc, "acpi",
+ "Enable ACPI", &error_abort);
}
static void virt_instance_init(Object *obj)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 9a19c14e66..2a7e55bae7 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -3024,7 +3024,7 @@ void acpi_setup(void)
return;
}
- if (!acpi_enabled) {
+ if (!x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n");
return;
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 98ee763f68..0bf0aaca52 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1297,7 +1297,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
* but pcms->acpi_dev is still created. Check !acpi_enabled in
* addition to cover this case.
*/
- if (!pcms->acpi_dev || !acpi_enabled) {
+ if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
error_setg(errp,
"memory hotplug is not enabled: missing acpi device or acpi disabled");
return;
@@ -1351,7 +1351,7 @@ static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
* but pcms->acpi_dev is still created. Check !acpi_enabled in
* addition to cover this case.
*/
- if (!pcms->acpi_dev || !acpi_enabled) {
+ if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
error_setg(&local_err,
"memory hotplug is not enabled: missing acpi device or acpi disabled");
goto out;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index e6756216f9..9cceae3e2c 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -275,7 +275,7 @@ static void pc_init1(MachineState *machine,
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
}
- if (pcmc->pci_enabled && acpi_enabled) {
+ if (pcmc->pci_enabled && x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
DeviceState *piix4_pm;
smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0);
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 87b73fe33c..6ca3cf936f 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -904,11 +904,37 @@ static void x86_machine_set_smm(Object *obj, Visitor *v, const char *name,
visit_type_OnOffAuto(v, name, &x86ms->smm, errp);
}
+bool x86_machine_is_acpi_enabled(X86MachineState *x86ms)
+{
+ if (x86ms->acpi == ON_OFF_AUTO_OFF) {
+ return false;
+ }
+ return true;
+}
+
+static void x86_machine_get_acpi(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ X86MachineState *x86ms = X86_MACHINE(obj);
+ OnOffAuto acpi = x86ms->acpi;
+
+ visit_type_OnOffAuto(v, name, &acpi, errp);
+}
+
+static void x86_machine_set_acpi(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ X86MachineState *x86ms = X86_MACHINE(obj);
+
+ visit_type_OnOffAuto(v, name, &x86ms->acpi, errp);
+}
+
static void x86_machine_initfn(Object *obj)
{
X86MachineState *x86ms = X86_MACHINE(obj);
x86ms->smm = ON_OFF_AUTO_AUTO;
+ x86ms->acpi = ON_OFF_AUTO_AUTO;
x86ms->max_ram_below_4g = 0; /* use default */
x86ms->smp_dies = 1;
}
@@ -937,6 +963,12 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)
NULL, NULL, &error_abort);
object_class_property_set_description(oc, X86_MACHINE_SMM,
"Enable SMM", &error_abort);
+
+ object_class_property_add(oc, X86_MACHINE_ACPI, "OnOffAuto",
+ x86_machine_get_acpi, x86_machine_set_acpi,
+ NULL, NULL, &error_abort);
+ object_class_property_set_description(oc, X86_MACHINE_ACPI,
+ "Enable ACPI", &error_abort);
}
static const TypeInfo x86_machine_info = {
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 814537bb42..a331fb5321 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -144,7 +144,6 @@ static Chardev **serial_hds;
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
int win2k_install_hack = 0;
int singlestep = 0;
-int acpi_enabled = 1;
int no_hpet = 0;
int fd_bootchk = 1;
static int no_reboot;
@@ -3516,7 +3515,8 @@ void qemu_init(int argc, char **argv, char **envp)
vnc_parse(optarg, &error_fatal);
break;
case QEMU_OPTION_no_acpi:
- acpi_enabled = 0;
+ olist = qemu_find_opts("machine");
+ qemu_opts_parse_noisily(olist, "acpi=off", false);
break;
case QEMU_OPTION_no_hpet:
no_hpet = 1;
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PULL 10/10] vhost-vsock: fix double close() in the realize() error path
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
` (8 preceding siblings ...)
2020-03-31 14:57 ` [PULL 09/10] acpi: add acpi=OnOffAuto machine property to x86 and arm virt Michael S. Tsirkin
@ 2020-03-31 14:57 ` Michael S. Tsirkin
2020-03-31 16:56 ` [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Peter Maydell
10 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi, Stefano Garzarella
From: Stefano Garzarella <sgarzare@redhat.com>
vhost_dev_cleanup() closes the vhostfd parameter passed to
vhost_dev_init(), so this patch avoids closing it twice in
the vhost_vsock_device_realize() error path.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20200331075910.42529-1-sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/virtio/vhost-vsock.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index 9f9093e196..09b6b07f94 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -364,12 +364,16 @@ static void vhost_vsock_device_realize(DeviceState *dev, Error **errp)
err_vhost_dev:
vhost_dev_cleanup(&vsock->vhost_dev);
+ /* vhost_dev_cleanup() closes the vhostfd passed to vhost_dev_init() */
+ vhostfd = -1;
err_virtio:
virtio_delete_queue(vsock->recv_vq);
virtio_delete_queue(vsock->trans_vq);
virtio_delete_queue(vsock->event_vq);
virtio_cleanup(vdev);
- close(vhostfd);
+ if (vhostfd >= 0) {
+ close(vhostfd);
+ }
return;
}
--
MST
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
` (9 preceding siblings ...)
2020-03-31 14:57 ` [PULL 10/10] vhost-vsock: fix double close() in the realize() error path Michael S. Tsirkin
@ 2020-03-31 16:56 ` Peter Maydell
10 siblings, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2020-03-31 16:56 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: QEMU Developers
On Tue, 31 Mar 2020 at 15:57, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> The following changes since commit 5acad5bf480321f178866dc28e38eeda5a3f19bb:
>
> Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging (2020-03-28 00:27:04 +0000)
>
> are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
>
> for you to fetch changes up to e82cdba3945340f524ba153170d52800dbd55ca4:
>
> vhost-vsock: fix double close() in the realize() error path (2020-03-31 10:54:28 -0400)
>
> ----------------------------------------------------------------
> virtio, pci, pc: bugfixes, checkpatch, maintainers
>
> Bugfixes all over the place.
> Add a new balloon maintainer.
> A checkpatch enhancement to enforce ACPI change rules.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-03-31 16:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 14:56 [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 01/10] checkpatch: enforce process for expected files Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 02/10] MAINTAINERS: Add myself as virtio-balloon co-maintainer Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 03/10] virtio-serial-bus: Plug memory leak on realize() error paths Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 04/10] acpi: pcihp: fix left shift undefined behavior in acpi_pcihp_eject_slot() Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 05/10] virtio-blk: delete vqs on the error path in realize() Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 06/10] virtio-iommu: avoid memleak in the unrealize Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 07/10] hw/i386/amd_iommu.c: Fix corruption of log events passed to guest Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 08/10] fix vhost_user_blk_watch crash Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 09/10] acpi: add acpi=OnOffAuto machine property to x86 and arm virt Michael S. Tsirkin
2020-03-31 14:57 ` [PULL 10/10] vhost-vsock: fix double close() in the realize() error path Michael S. Tsirkin
2020-03-31 16:56 ` [PULL 00/10] virtio, pci, pc: bugfixes, checkpatch, maintainers 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.