From: "Alex Bennée" <alex.bennee@linaro.org>
To: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
virtio-fs@redhat.com
Subject: Re: [Virtio-fs] Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
Date: Fri, 14 Oct 2022 12:07:17 +0100 [thread overview]
Message-ID: <87czauoe6y.fsf@linaro.org> (raw)
In-Reply-To: <1c400131-59f6-f14f-e7e0-3871cc0d1815@linux.ibm.com>
Christian Borntraeger <borntraeger@linux.ibm.com> writes:
> Am 14.10.22 um 09:30 schrieb Christian Borntraeger:
>> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>>> From: Alex Bennée <alex.bennee@linaro.org>
>>>
>>> All the boilerplate virtio code does the same thing (or should at
>>> least) of checking to see if the VM is running before attempting to
>>> start VirtIO. Push the logic up to the common function to avoid
>>> getting a copy and paste wrong.
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> This results in a regression for our s390x CI when doing
>> save/restore of guests with vsock:
>> #1 0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>> #2 0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>> #3 0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>> #4 0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>> #5 0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>> #6 0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>> #7 0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>> #8 0x000002aa2d570ba4
>> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
>> 0x270ba4)
>> #9 0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>> #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>> #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>> #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>> #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
>>
>
>
> Something like
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 7dc3c7393122..b4d056ae6f01 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -73,6 +73,10 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
> bool should_start = virtio_device_started(vdev, status);
> int ret;
> + if (!vdev->vm_running) {
> + should_start = false;
> + }
> +
> if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
> return;
> }
>
> helps.
>
> The problem seems to be that virtio_device_started does ignore
> vm_running when use_start is set.
Wouldn't it make more sense to re-order the check there, something like:
static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
{
if (!vdev->vm_running) {
return false;
}
if (vdev->use_started) {
return vdev->started;
}
return status & VIRTIO_CONFIG_S_DRIVER_OK;
}
Is the problem that vdev->started gets filled during the migration but
because the VM isn't running yet we can never actually run?
--
Alex Bennée
WARNING: multiple messages have this Message-ID (diff)
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
virtio-fs@redhat.com
Subject: Re: Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started)
Date: Fri, 14 Oct 2022 12:07:17 +0100 [thread overview]
Message-ID: <87czauoe6y.fsf@linaro.org> (raw)
In-Reply-To: <1c400131-59f6-f14f-e7e0-3871cc0d1815@linux.ibm.com>
Christian Borntraeger <borntraeger@linux.ibm.com> writes:
> Am 14.10.22 um 09:30 schrieb Christian Borntraeger:
>> Am 10.10.22 um 19:29 schrieb Michael S. Tsirkin:
>>> From: Alex Bennée <alex.bennee@linaro.org>
>>>
>>> All the boilerplate virtio code does the same thing (or should at
>>> least) of checking to see if the VM is running before attempting to
>>> start VirtIO. Push the logic up to the common function to avoid
>>> getting a copy and paste wrong.
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org>
>>> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>>> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> This results in a regression for our s390x CI when doing
>> save/restore of guests with vsock:
>> #1 0x000003ff9a248580 raise (libc.so.6 + 0x48580)
>> #2 0x000003ff9a22b5c0 abort (libc.so.6 + 0x2b5c0)
>> #3 0x000003ff9a2409da __assert_fail_base (libc.so.6 + 0x409da)
>> #4 0x000003ff9a240a4e __assert_fail (libc.so.6 + 0x40a4e)
>> #5 0x000002aa2d69a066 vhost_vsock_common_pre_save (qemu-system-s390x + 0x39a066)
>> #6 0x000002aa2d55570e vmstate_save_state_v (qemu-system-s390x + 0x25570e)
>> #7 0x000002aa2d556218 vmstate_save_state (qemu-system-s390x + 0x256218)
>> #8 0x000002aa2d570ba4
>> qemu_savevm_state_complete_precopy_non_iterable (qemu-system-s390x +
>> 0x270ba4)
>> #9 0x000002aa2d5710b6 qemu_savevm_state_complete_precopy (qemu-system-s390x + 0x2710b6)
>> #10 0x000002aa2d564d0e migration_completion (qemu-system-s390x + 0x264d0e)
>> #11 0x000002aa2d8db25c qemu_thread_start (qemu-system-s390x + 0x5db25c)
>> #12 0x000003ff9a296248 start_thread (libc.so.6 + 0x96248)
>> #13 0x000003ff9a31183e thread_start (libc.so.6 + 0x11183e)
>>
>
>
> Something like
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 7dc3c7393122..b4d056ae6f01 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -73,6 +73,10 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
> bool should_start = virtio_device_started(vdev, status);
> int ret;
> + if (!vdev->vm_running) {
> + should_start = false;
> + }
> +
> if (vhost_dev_is_started(&vvc->vhost_dev) == should_start) {
> return;
> }
>
> helps.
>
> The problem seems to be that virtio_device_started does ignore
> vm_running when use_start is set.
Wouldn't it make more sense to re-order the check there, something like:
static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
{
if (!vdev->vm_running) {
return false;
}
if (vdev->use_started) {
return vdev->started;
}
return status & VIRTIO_CONFIG_S_DRIVER_OK;
}
Is the problem that vdev->started gets filled during the migration but
because the VM isn't running yet we can never actually run?
--
Alex Bennée
next prev parent reply other threads:[~2022-10-14 11:07 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 17:28 [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 01/55] hw/virtio: incorporate backend features in features Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 02/55] include/hw/virtio: more comment for VIRTIO_F_BAD_FEATURE Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 03/55] include/hw: document vhost_dev feature life-cycle Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 04/55] hw/virtio: fix some coding style issues Michael S. Tsirkin
2022-10-10 17:28 ` [PULL 05/55] hw/virtio: log potentially buggy guest drivers Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 06/55] hw/virtio: add some vhost-user trace events Michael S. Tsirkin
2022-10-10 17:29 ` [Virtio-fs] [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started Michael S. Tsirkin
2022-10-10 17:29 ` Michael S. Tsirkin
2022-10-14 7:30 ` [Virtio-fs] Regression save/restore of vsock: (was [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started) Christian Borntraeger
2022-10-14 7:30 ` Christian Borntraeger
2022-10-14 8:31 ` [Virtio-fs] " Christian Borntraeger
2022-10-14 8:31 ` Christian Borntraeger
2022-10-14 11:07 ` Alex Bennée [this message]
2022-10-14 11:07 ` Alex Bennée
2022-10-14 11:58 ` [Virtio-fs] " Christian Borntraeger
2022-10-14 11:58 ` Christian Borntraeger
2022-10-14 8:37 ` [Virtio-fs] " Alex Bennée
2022-10-14 8:37 ` Alex Bennée
2022-10-14 8:44 ` [Virtio-fs] " Christian Borntraeger
2022-10-14 8:44 ` Christian Borntraeger
2022-11-05 16:45 ` [Virtio-fs] [PULL 07/55] hw/virtio: move vm_running check to virtio_device_started Michael S. Tsirkin
2022-11-05 16:45 ` Michael S. Tsirkin
2022-11-07 9:21 ` [Virtio-fs] " Alex Bennée
2022-11-07 9:21 ` Alex Bennée
2022-10-10 17:29 ` [Virtio-fs] [PULL 08/55] hw/virtio: move vhd->started check into helper and add FIXME Michael S. Tsirkin
2022-10-10 17:29 ` Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 09/55] hw/virtio: add boilerplate for vhost-user-gpio device Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 10/55] hw/virtio: add vhost-user-gpio-pci boilerplate Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 11/55] tests/qtest: pass stdout/stderr down to subtests Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 12/55] tests/qtest: add a timeout for subprocess_run_one_test Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 13/55] tests/qtest: use qos_printf instead of g_test_message Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 14/55] tests/qtest: catch unhandled vhost-user messages Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 15/55] tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURES Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 16/55] tests/qtest: add assert to catch bad features Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 17/55] tests/qtest: implement stub for VHOST_USER_GET_CONFIG Michael S. Tsirkin
2022-10-10 17:29 ` [PULL 18/55] tests/qtest: add a get_features op to vhost-user-test Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 19/55] tests/qtest: enable tests for virtio-gpio Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 20/55] virtio: introduce VirtIOConfigSizeParams & virtio_get_config_size Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 21/55] virtio-blk: move config size params to virtio-blk-common Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 22/55] vhost-user-blk: make it possible to disable write-zeroes/discard Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 23/55] vhost-user-blk: make 'config_wce' part of 'host_features' Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 24/55] vhost-user-blk: dynamically resize config space based on features Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 25/55] tests/acpi: virt: allow acpi GTDT changes Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 26/55] acpi: arm/virt: build_gtdt: fix invalid 64-bit physical addresses Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 27/55] tests/acpi: virt: update ACPI GTDT binaries Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 28/55] mem/cxl-type3: Add sn option to provide serial number for PCI ecap Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 29/55] Revert "intel_iommu: Fix irqchip / X2APIC configuration checks" Michael S. Tsirkin
2022-10-10 17:39 ` David Woodhouse
2022-10-10 19:08 ` Peter Xu
2022-10-10 23:16 ` David Woodhouse
2022-10-11 0:04 ` Peter Xu
2022-10-10 17:30 ` [PULL 30/55] qmp: add QMP command x-query-virtio Michael S. Tsirkin
2022-10-10 17:30 ` [PULL 31/55] qmp: add QMP command x-query-virtio-status Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 32/55] qmp: decode feature & status bits in virtio-status Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 33/55] qmp: add QMP commands for virtio/vhost queue-status Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 34/55] qmp: add QMP command x-query-virtio-queue-element Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 35/55] hmp: add virtio commands Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 36/55] pci: Remove unused pci_get_*_by_mask() functions Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 37/55] pci: Sanity check mask argument to pci_set_*_by_mask() Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 38/55] hw/smbios: support for type 8 (port connector) Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 39/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 40/55] acpi: x86: deduplicate HPET AML building Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 41/55] tests: acpi: update expected blobs after HPET move Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 42/55] tests: acpi: whitelist pc/q35 DSDT due to HPET AML move Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 43/55] acpi: x86: refactor PDSM method to reduce nesting Michael S. Tsirkin
2022-10-10 17:31 ` [PULL 44/55] x86: acpi: _DSM: use Package to pass parameters Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 45/55] tests: acpi: update expected blobs Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 46/55] tests: acpi: whitelist pc/q35 DSDT before switching _DSM to use ASUN Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 47/55] x86: acpi: cleanup PCI device _DSM duplication Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 48/55] tests: acpi: update expected blobs Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 49/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 50/55] x86: pci: acpi: reorder Device's _ADR and _SUN fields Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 51/55] tests: acpi: update expected blobs Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 52/55] tests: acpi: whitelist pc/q35 DSDT before moving _ADR field Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 53/55] x86: pci: acpi: reorder Device's _DSM method Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 54/55] tests: acpi: update expected blobs Michael S. Tsirkin
2022-10-10 17:32 ` [PULL 55/55] x86: pci: acpi: consolidate PCI slots creation Michael S. Tsirkin
2022-10-12 20:04 ` [PULL 00/55] pc,virtio: features, tests, fixes, cleanups Stefan Hajnoczi
2022-10-12 20:59 ` Michael S. Tsirkin
2022-10-12 21:01 ` Stefan Hajnoczi
2022-10-12 21:25 ` Stefan Hajnoczi
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=87czauoe6y.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=borntraeger@linux.ibm.com \
--cc=dgilbert@redhat.com \
--cc=mathieu.poirier@linaro.org \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=virtio-fs@redhat.com \
/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 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.