Index | Thread | Search

From:
Alexander Bluhm <bluhm@openbsd.org>
Subject:
limit vio queues to 8 with IF_MAX_VECTORS
To:
tech@openbsd.org
Cc:
Stefan Fritsch <sf@sfritsch.de>
Date:
Fri, 21 Nov 2025 23:55:16 +0100

Download raw body.

Thread
  • Alexander Bluhm:

    limit vio queues to 8 with IF_MAX_VECTORS

Hi,

I forgot vio(4) when adding my global IF_MAX_VECTORS limit.
This reduces the number of queue length to 8.

Tested on a KVM/qemu VM with 16 cores and 12 virtio queues:
  virtio0 at pci0 dev 3 function 0 "Qumranet Virtio Network" rev 0x00
- vio0 at virtio0: 12 queues, address 52:54:00:45:0a:ea
+ vio0 at virtio0: 8 queues, address 52:54:00:45:0a:ea
  virtio0: msix

ok?

bluhm

Index: dev/pv/if_vio.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/dev/pv/if_vio.c,v
diff -u -p -r1.72 if_vio.c
--- dev/pv/if_vio.c	16 Sep 2025 12:18:10 -0000	1.72
+++ dev/pv/if_vio.c	13 Nov 2025 22:08:35 -0000
@@ -663,7 +663,7 @@ vio_attach(struct device *parent, struct
 		vsc->sc_nvqs = 2 * i + 1;
 		i = MIN(i, VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX);
 		sc->sc_intrmap = intrmap_create(&sc->sc_dev, i,
-		    va->va_nintr - 2, 0);
+		    MIN(va->va_nintr - 2, IF_MAX_VECTORS), 0);
 		sc->sc_nqueues = intrmap_count(sc->sc_intrmap);
 		printf(": %u queue%s", sc->sc_nqueues,
 		    sc->sc_nqueues > 1 ? "s" : "");