Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Fix vmx(4) receive workqueue problem on qemu, re...
details: https://anonhg.NetBSD.org/src/rev/922ec72669c0
branches: trunk
changeset: 989153:922ec72669c0
user: knakahara <knakahara%NetBSD.org@localhost>
date: Wed Oct 13 01:11:29 2021 +0000
description:
Fix vmx(4) receive workqueue problem on qemu, reported by ozaki-r@n.o, thanks.
ESXi stops interrupt by vmxnet3_disable_intr() immediately. In contrast, qemu
does not stop interrupt soon. Hmm, qemu's behavior seems not to be correct,
however, there is no explicit specification of vmxnet3. So, we have to accept
that behavior.
diffstat:
sys/dev/pci/if_vmx.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diffs (52 lines):
diff -r a1a439a57fd8 -r 922ec72669c0 sys/dev/pci/if_vmx.c
--- a/sys/dev/pci/if_vmx.c Tue Oct 12 23:40:38 2021 +0000
+++ b/sys/dev/pci/if_vmx.c Wed Oct 13 01:11:29 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vmx.c,v 1.4 2020/10/15 04:37:48 ryo Exp $ */
+/* $NetBSD: if_vmx.c,v 1.5 2021/10/13 01:11:29 knakahara Exp $ */
/* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */
/*
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.4 2020/10/15 04:37:48 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.5 2021/10/13 01:11:29 knakahara Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -253,6 +253,7 @@
void *vxq_si;
bool vxq_workqueue;
+ bool vxq_wq_enqueued;
struct work vxq_wq_cookie;
};
@@ -2484,8 +2485,15 @@
{
if (vmxq->vxq_workqueue) {
- workqueue_enqueue(sc->vmx_queue_wq, &vmxq->vxq_wq_cookie,
- curcpu());
+ /*
+ * When this function is called, "vmxq" is owned by one CPU.
+ * so, atomic operation is not required here.
+ */
+ if (!vmxq->vxq_wq_enqueued) {
+ vmxq->vxq_wq_enqueued = true;
+ workqueue_enqueue(sc->vmx_queue_wq,
+ &vmxq->vxq_wq_cookie, curcpu());
+ }
} else {
softint_schedule(vmxq->vxq_si);
}
@@ -2625,6 +2633,7 @@
struct vmxnet3_queue *vmxq;
vmxq = container_of(wk, struct vmxnet3_queue, vxq_wq_cookie);
+ vmxq->vxq_wq_enqueued = false;
vmxnet3_handle_queue(vmxq);
}
Home |
Main Index |
Thread Index |
Old Index