disable the configuration interrupt for the unsupported device
cover disable the configuration interrupt for the unsupported device
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..
During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1. vhost_net_stop() was called, this will call the function virtio_pci_set_guest_notifiers() with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0
2. virtio_reset() was called -->set configure vector to VIRTIO_NO_VECTORt
3.vhost_net_start() was called (at this time the configure vector is still VIRTIO_NO_VECTOR) and call virtio_pci_set_guest_notifiers() with assgin= true, so the irqfd for vector 0 was not "init" during this process
4. The system continues to boot and msix_fire_vector_notifier() was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0 is_masked 1 [msix_fire_vector_notifier] 112 called vector 0 is_masked 0
The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of calling vhost_net_stop and then virtio_reset, and also won't call msix_fire_vector_notifier for vector 0 during system boot.
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.
For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enable
hw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)
Signature · 1 line
2.43.0
RFC 1/2 virtio-net: disable the configure interrupt for not support device
Only the vdpa device support configure interrupt, we need to disable the configure interrupt process in all other device.
In order to achieve this, I added a check in the virtio_net_device_realize(). When the peer's type is vdpa, the value of config_irq_enabled in the structure VirtIODevice will set to true.
--- hw/net/virtio-net.c | 5 ++++- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-)
hw/net/virtio-net.c +4 -1
@@ -3749,12 +3749,15 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) nc =qemu_get_queue (n->nic); nc->rxfilter_notify_enabled =1 ; + vdev->config_irq_enabled = false; -if (nc->peer && nc->peer->info->type ==NET_CLIENT_DRIVER_VHOST_VDPA ) { +if (nc->peer && nc->peer->info->type ==NET_CLIENT_DRIVER_VHOST_VDPA ) {struct virtio_net_config netcfg = {};memcpy (&netcfg.mac, &n->nic_conf.macaddr,ETH_ALEN );vhost_net_set_config (get_vhost_net (nc->peer), (uint8_t *)&netcfg,0 ,ETH_ALEN ,VHOST_SET_CONFIG_TYPE_FRONTEND ); + + vdev->config_irq_enabled = true; }QTAILQ_INIT (&n->rsc_chains); n->qdev = dev;
hw/virtio/virtio.c +1 -0
@@ -3255,6 +3255,7 @@ void virtio_init(VirtIODevice *vdev, uint16_t device_id, size_t config_size) virtio_vmstate_change, vdev); vdev->device_endian =virtio_default_endian (); vdev->use_guest_notifier_mask = true; + vdev->config_irq_enabled = false; }/*
include/hw/virtio/virtio.h +1 -0
@@ -164,6 +164,7 @@ struct VirtIODevice*/ EventNotifier config_notifier;bool device_iotlb_enabled; +bool config_irq_enabled; };struct VirtioDeviceClass {
Signature · 1 line
2.43.0
Re: [RFC 1/2] virtio-net: disable the configure interrupt for not support device
Quoted 3 lines · Cindy Lu
Only the vdpa device support configure interrupt, we need to disable the configure interrupt process in all other device.
I think we need to tweak the terminology here at least.
It's not about configure interrupt, it's about whether or not we can try to use irqfd for configure interrupt.
Btw, have you tried this on the old kernel that doesn't support configure interrupt for vDPA?
Quoted 16 lines
In order to achieve this, I added a check in the
virtio_net_device_realize(). When the peer's type is vdpa, the value ofconfig_irq_enabledin the structure VirtIODevice will set to true.Signed-off-by Cindy Lu <[email protected]>--- hw/net/virtio-net.c | 5 ++++- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-)hw/net/virtio-net.c +0
-0
hw/net/virtio-net.c static void virtio_net_device_realize(DeviceState *dev, Error **errp) · line 3752
Quoted 4 lines
hw/net/virtio-net.c +1
-0@@ -3749,12 +3749,15 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) nc =qemu_get_queue (n->nic); nc->rxfilter_notify_enabled =1 ; + vdev->config_irq_enabled = false;
Let's tweak the name of the variable.
But in another thought, there's no easy way to know if vDPA support configure interrupt at device realization.
We need a graceful fallback or just disable irqfd to configure irq.
Quoted 29 lines
hw/net/virtio-net.c +3
-1-if (nc->peer && nc->peer->info->type ==NET_CLIENT_DRIVER_VHOST_VDPA ) { +if (nc->peer && nc->peer->info->type ==NET_CLIENT_DRIVER_VHOST_VDPA ) {struct virtio_net_config netcfg = {};memcpy (&netcfg.mac, &n->nic_conf.macaddr,ETH_ALEN );vhost_net_set_config (get_vhost_net (nc->peer), (uint8_t *)&netcfg,0 ,ETH_ALEN ,VHOST_SET_CONFIG_TYPE_FRONTEND ); + + vdev->config_irq_enabled = true; }QTAILQ_INIT (&n->rsc_chains); n->qdev = dev;hw/virtio/virtio.c +1
-0@@ -3255,6 +3255,7 @@ void virtio_init(VirtIODevice *vdev, uint16_t device_id, size_t config_size) virtio_vmstate_change, vdev); vdev->device_endian =virtio_default_endian (); vdev->use_guest_notifier_mask = true; + vdev->config_irq_enabled = false; }/* include/hw/virtio/virtio.h +0
-0
include/hw/virtio/virtio.h struct VirtIODevice · line 170
Quoted 7 lines
include/hw/virtio/virtio.h +1
-0@@ -164,6 +164,7 @@ struct VirtIODevice*/ EventNotifier config_notifier;bool device_iotlb_enabled; +bool config_irq_enabled; };struct VirtioDeviceClass {
Thanks
Quoted 3 lines
--
2.43.0
RFC 2/2 virtio-pci: check if the configure interrupt enable
In reply to Cindy LuIf config_irq_enabled is not true, it means that configure interrupt is not supported. Therefore, the config vector will not be handled during the interrupt process.
--- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-)
hw/virtio/virtio-pci.c +23 -18
@@ -1065,7 +1065,7 @@ static int virtio_pci_vector_unmask(PCIDevice *dev, unsigned vector, vq =virtio_vector_next_queue (vq); }/* unmask config intr */ -if (vector == vdev->config_vector) { +if ((vector == vdev->config_vector) && (true == vdev->config_irq_enabled)) { n =virtio_config_get_guest_notifier (vdev); ret =virtio_pci_one_vector_unmask (proxy,VIRTIO_CONFIG_IRQ_IDX , vector, msg, n);
@@ -1111,7 +1111,7 @@ static void virtio_pci_vector_mask(PCIDevice *dev, unsigned vector) vq =virtio_vector_next_queue (vq); } -if (vector == vdev->config_vector) { +if ((vector == vdev->config_vector) && (true == vdev->config_irq_enabled)) { n =virtio_config_get_guest_notifier (vdev);virtio_pci_one_vector_mask (proxy,VIRTIO_CONFIG_IRQ_IDX , vector, n); }
@@ -1147,21 +1147,24 @@ static void virtio_pci_vector_poll(PCIDevice *dev, } }/* poll the config intr */ - ret =virtio_pci_get_notifier (proxy,VIRTIO_CONFIG_IRQ_IDX , ¬ifier, - &vector); -if (ret <0 ) { -return ; - } -if (vector < vector_start || vector >= vector_end || - !msix_is_masked (dev, vector)) { -return ; - } -if (k->guest_notifier_pending) { -if (k->guest_notifier_pending (vdev,VIRTIO_CONFIG_IRQ_IDX )) { +if (true == vdev->config_irq_enabled) { + ret =virtio_pci_get_notifier (proxy,VIRTIO_CONFIG_IRQ_IDX , ¬ifier, + &vector); +if (ret <0 ) { +return ; + } + +if (vector < vector_start || vector >= vector_end || + !msix_is_masked (dev, vector)) { +return ; + } +if (k->guest_notifier_pending) { +if (k->guest_notifier_pending (vdev,VIRTIO_CONFIG_IRQ_IDX )) { +msix_set_pending (dev, vector); + } + }else if (event_notifier_test_and_clear (notifier)) {msix_set_pending (dev, vector); } - }else if (event_notifier_test_and_clear (notifier)) { -msix_set_pending (dev, vector); } }
@@ -1282,9 +1285,11 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign)if (r <0 ) { goto config_assign_error; } - r =kvm_virtio_pci_vector_config_use (proxy); -if (r <0 ) { - goto config_error; +if (true == vdev->config_irq_enabled) { + r =kvm_virtio_pci_vector_config_use (proxy); +if (r <0 ) { + goto config_error; + } } }
Signature · 1 line
2.43.0
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0
Before vhost_net_stop(), do we know which vector is used by which queue?
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this process
How does the configure vector differ from the virtqueue vector here?
Quoted 6 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0
Quoted 7 lines
The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 8 lines · Jason Wang
Hi Cindy:
Quoted 4 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..
Quoted 8 lines
Quoted 5 lines
During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Before
vhost_net_stop(), do we know which vector is used by which queue?
before this stop, vdev->config_verctor is get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0
Quoted 9 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processHow does the configure vector differ from the virtqueue vector here?
All the vectors are VIRTIO_NO_VECTOR (including vq). any msix_fire_vector_notifier()
been called will cause the crash at this time. So I think this should be a bug in this guest image
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.
Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
Cindy
Quoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0
I basically meant if vector 0 is shared with some virtqueues here.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this process
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.
Won't virtio_pci_set_guest_notifiers() will try to allocate irqfd when the assignment is true?
Quoted 2 lines
So I think this should
be a bug in this guest image
The point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this process
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?
It will allocate, but the vector is VIRTIO_NO_VECTOR (0xffff)
then it will called kvm_virtio_pci_vector_use_one()
in this function, there is a check for
if (vector >= msix_nr_vectors_allocated(dev))
{ return 0; }
So it will return.
Quoted 9 lines
Quoted 2 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0
Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 50 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()
Quoted 7 lines
in this function, there is a check for
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
So it will return.
How about let's just fix this?
Btw, it's better to explain in detail like the above in the next version.
Thanks
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 54 lines · Jason Wang
Quoted 52 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()in this function, there is a check for
Quoted 7 lines
Quoted 5 lines
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
So it will return.
How about let's just fix this?
Btw, another question, how does vDPA work here?
Thanks
Quoted 66 lines
Btw, it's better to explain in detail like the above in the next version.
Thanks
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 60 lines · Jason Wang
Quoted 58 lines · Jason Wang
Quoted 56 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()in this function, there is a check for
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
So it will return.
How about let's just fix this?
Btw, another question, how does vDPA work here?
Thanks
the rhel/fedroa guest image will not call vrtio_stop and virtio_reset during the boot
So vector will not change to VIRTIO_NO_VECTOR. So the vdpa's configure interrupt
Should work ok and there is no crash
Thanks
cindy
Quoted 67 lines
Quoted 66 lines
Btw, it's better to explain in detail like the above in the next version.
Thanks
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 68 lines · Cindy Lu
Quoted 66 lines · Jason Wang
Quoted 54 lines · Jason Wang
Quoted 52 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()in this function, there is a check for
Quoted 7 lines
Quoted 5 lines
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
So it will return.
How about let's just fix this?
Btw, another question, how does vDPA work here?
Quoted 7 lines
Quoted 2 lines
Thanks
the rhel/fedroa guest image will not call
vrtio_stopandvirtio_resetduring the boot
So vector will not change toVIRTIO_NO_VECTOR. So the vdpa's configure interrupt
Should work ok and there is no crash
I mean:
1) if vDPA can work with the image you used to reproduce the issue
2) if current Qemu can work on old kernel without configure interrupt support for vDPA
Thanks
Quoted 71 lines
Thanks
cindyQuoted 67 lines
Quoted 66 lines
Btw, it's better to explain in detail like the above in the next version.
Thanks
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 78 lines · Jason Wang
Quoted 68 lines · Cindy Lu
Quoted 66 lines · Jason Wang
Quoted 54 lines · Jason Wang
Quoted 52 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()in this function, there is a check for
Quoted 7 lines
Quoted 5 lines
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
So it will return.
How about let's just fix this?
Btw, another question, how does vDPA work here?
Quoted 7 lines
Quoted 2 lines
Thanks
the rhel/fedroa guest image will not call
vrtio_stopandvirtio_resetduring the boot
So vector will not change toVIRTIO_NO_VECTOR. So the vdpa's configure interrupt
Should work ok and there is no crash
Quoted 6 lines
I mean:
1) if vDPA can work with the image you used to reproduce the issue
2) if current Qemu can work on old kernel without configure interrupt support for vDPA
Really Sorry for , I tried to answer this
1. the vDPA device also can not working in this image, Because the irqfd for vector 0 is released. and then guest image
called unmask this vector. These code are all not dependent on vdpa related processes
2, the current qemu can work with old kernel
because as I debug the old kernel won't call msix_fire_vector_notifier for vector 0, and it will not unmask vector 0
Thansk
cindy
Quoted 74 lines
Thanks
Quoted 71 lines
Thanks
cindyQuoted 67 lines
Quoted 66 lines
Btw, it's better to explain in detail like the above in the next version.
Thanks
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 58 lines · Jason Wang
Quoted 56 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()in this function, there is a check for
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
Quoted 8 lines
Quoted 1 line
So it will return.
How about let's just fix this?
Btw, it's better to explain in detail like the above in the next version.
Thanks
The problem is I think the behavior here is correct, The vector here is
VIRTIO_NO_VECTOR and we should return,
the fix could work maybe is we try get to know if this was changed from another value
and use that one? this seems strange.
Thanks
cindy
Quoted 62 lines
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 62 lines · Cindy Lu
Quoted 60 lines · Jason Wang
Quoted 57 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()in this function, there is a check for
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
So it will return.
Quoted 8 lines
Quoted 6 lines
How about let's just fix this?
Btw, it's better to explain in detail like the above in the next version.
Thanks
The problem is I think the behavior here is correct, The vector here is
VIRTIO_NO_VECTORand we should return,
So if I understand correctly, the configure vector is configured after DRIVER_OK?
Spec doesn't forbid this, this is something we need to support.
It looks to me the correct fix is to kvm_virtio_pci_vector_use_one() when guest is writing to msix_vector after DRIVER_OK?
Thanks
Quoted 68 lines
the fix could work maybe is we try get to know if this was changed from another value
and use that one? this seems strange.
Thanks
cindyQuoted 62 lines
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 68 lines · Jason Wang
Quoted 66 lines · Cindy Lu
Quoted 64 lines · Jason Wang
Quoted 50 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()Quoted 7 lines
in this function, there is a check for
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
So it will return.
How about let's just fix this?
Btw, it's better to explain in detail like the above in the next version.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Thanks
The problem is I think the behavior here is correct, The vector here is
VIRTIO_NO_VECTORand we should return,So if I understand correctly, the configure vector is configured after
DRIVER_OK?
sorry I didn't get your point, Do you mean set_guest_notifiers()?, this was called during the system boot
but for the value of vdev->config_vector/vq vector, this is changed
by virtio_pci_common_read/virtio_pci_common_write
and these function will not check the process DRIVER_OK.
Quoted 5 lines
Spec doesn't forbid this, this is something we need to support.
It looks to me the correct fix is to
kvm_virtio_pci_vector_use_one()when guest is writing tomsix_vectorafterDRIVER_OK?
if I understand correctly. do you mean
when function virtio_pci_common_read/virtio_pci_common_write was called
we need to check the number of vdev->config_vector/vq vector, if this was changed and also DRIVER_OK was set
then we need to call virtio_pci_set_guest_notifiers() to re-init the irqfd? Thanks
cindy
Quoted 71 lines
Thanks
Quoted 68 lines
the fix could work maybe is we try get to know if this was changed from another value
and use that one? this seems strange.
Thanks
cindyQuoted 62 lines
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0
Quoted 75 lines · Cindy Lu
Quoted 73 lines · Jason Wang
Quoted 70 lines · Cindy Lu
Quoted 58 lines · Jason Wang
Quoted 56 lines · Cindy Lu
Quoted 18 lines · Jason Wang
Quoted 16 lines · Cindy Lu
Quoted 14 lines · Jason Wang
Hi Cindy:
Quoted 9 lines · Cindy Lu
we need a crash in Non-standard image, here is the jira for this https://issues.redhat.com/browse/RHEL-28522
The root cause of the issue is that an IRQFD was used without initialization..During the booting process of the Vyatta image, the behavior of the called function in qemu is as follows:
1.
vhost_net_stop()was called, this will call the functionvirtio_pci_set_guest_notifiers()with assgin= false, and virtio_pci_set_guest_notifiers() will release the irqfd for vector 0Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Before
vhost_net_stop(), do we know which vector is used by which queue?before this stop,
vdev->config_verctoris get from virtio_pci_common_read/virtio_pci_common_write it was set to vector 0I basically meant if vector 0 is shared with some virtqueues here.
Really sorry for this, vq's vector is 1,2, and will not share with the configure vector
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
2.
virtio_reset()was called -->set configure vector toVIRTIO_NO_VECTORt3.vhost_net_start() was called (at this time the configure vector is still
VIRTIO_NO_VECTOR) and callvirtio_pci_set_guest_notifiers()with assgin= true, so the irqfd for vector 0 was not "init" during this processQuoted 9 lines
Quoted 5 lines
Quoted 2 lines
How does the configure vector differ from the virtqueue vector here?
All the vectors are
VIRTIO_NO_VECTOR(including vq). anymsix_fire_vector_notifier()
been called will cause the crash at this time.Won't
virtio_pci_set_guest_notifiers()will try to allocate irqfd when the assignment is true?It will allocate, but the vector is
VIRTIO_NO_VECTOR(0xffff)then it will called
kvm_virtio_pci_vector_use_one()in this function, there is a check for
if (vector >=
msix_nr_vectors_allocated(dev)){ return 0; }
Quoted 8 lines
Quoted 1 line
So it will return.
How about let's just fix this?
Btw, it's better to explain in detail like the above in the next version.
Thanks
The problem is I think the behavior here is correct, The vector here is
VIRTIO_NO_VECTORand we should return,
Quoted 8 lines
Quoted 3 lines
So if I understand correctly, the configure vector is configured after
DRIVER_OK?sorry I didn't get your point, Do you mean
set_guest_notifiers()?, this was called during the system boot
but for the value of vdev->config_vector/vq vector, this is changed
by virtio_pci_common_read/virtio_pci_common_write
and these function will not check the processDRIVER_OK.
I basically mean Qemu behave based on the guest's behaviour.
So what you've described looks like a guest trying to configure the config vector after it sets DRIVER_OK. So Qemu tries to use the irqfd without initializaiton.
Quoted 10 lines
Quoted 5 lines
Spec doesn't forbid this, this is something we need to support.
It looks to me the correct fix is to
kvm_virtio_pci_vector_use_one()when guest is writing tomsix_vectorafterDRIVER_OK?if I understand correctly. do you mean
when function virtio_pci_common_read/virtio_pci_common_write was called
we need to check the number of vdev->config_vector/vq vector, if this was changed and alsoDRIVER_OKwas set
then we need to callvirtio_pci_set_guest_notifiers()to re-init the irqfd?
It is not re-init, as it has been freed.
A quick fix would be, call kvm_virtio_pci_vector_use/unuse_one() when a guest assign/deassign a vector after DRIVER_OK.
Thanks
Quoted 74 lines
Thanks
cindyQuoted 71 lines
Thanks
Quoted 68 lines
the fix could work maybe is we try get to know if this was changed from another value
and use that one? this seems strange.
Thanks
cindyQuoted 62 lines
Quoted 61 lines
Quoted 10 lines
Quoted 3 lines
So I think this should
be a bug in this guest imageThe point is Qemu should not crash even if the guest driver is buggy.
It would be nice if we can have a qtest for this on top.
Thanks
sure, got it, I have done the Qtest, and it passed here is the result
Ok: 794 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 32 Timeout: 0Quoted 40 lines
Quoted 39 lines
Quoted 9 lines
Quoted 9 lines
4. The system continues to boot and
msix_fire_vector_notifier()was called unmask the vector 0 and then met the crash [msix_fire_vector_notifier] 112 called vector 0is_masked1 [msix_fire_vector_notifier] 112 called vector 0is_masked0The reason for not reproducing in RHEL/fedora guest image is because
REHL/Fedora doesn't have the behavior of callingvhost_net_stopand thenvirtio_reset, and also won't callmsix_fire_vector_notifierfor vector 0 during system boot.Quoted 7 lines
Quoted 4 lines
The reason for not reproducing before configure interrupt support is because
vector 0 is for configure interrupt, before the support for configure interrupts, the notifier process will not handle vector 0.For the device Vyatta using, it doesn't support configure interrupts at all, So we plan to disable the configure interrupts in unsupported device
Btw, let's tweak the changelog, it's a little bit hard to understand.
sure will do
thanks
CindyQuoted 19 lines
Thanks
Quoted 16 lines
Signed-off-by Cindy Lu <[email protected]>Cindy Lu (2):
virtio-net: disable the configure interrupt for not support device
virtio-pci: check if the configure interrupt enablehw/net/virtio-net.c | 5 ++++- hw/virtio/virtio-pci.c | 41 +++++++++++++++++++++----------------- hw/virtio/virtio.c | 1 + include/hw/virtio/virtio.h | 1 + 4 files changed, 29 insertions(+), 19 deletions(-)--
2.43.0