vmt(4) reads MAC and IP addresses periodically through a task on the
kernel locked system task queue `systq'.

vmt_nicinfo_task() grabs the exclusive net lock which protects the
interface list and addresses, but it only reads and thus may grab the
shared net lock.

Again, not a big difference due to kernel lock always being held anyway,
but ifnetlist-wise this is an improvement.

I don't have access to VMWare to further tweak this, but am confident
enough that this can't break anything.

Feedback? Objection? OK?

Index: sys/dev/pv/vmt.c
===================================================================
RCS file: /cvs/src/sys/dev/pv/vmt.c,v
retrieving revision 1.26
diff -u -p -r1.26 vmt.c
--- sys/dev/pv/vmt.c    8 Sep 2022 10:22:06 -0000       1.26
+++ sys/dev/pv/vmt.c    23 Oct 2022 07:40:20 -0000
@@ -1336,7 +1336,7 @@ vmt_nicinfo_task(void *data)
        size_t nic_info_size;
        char *nic_info;
 
-       NET_LOCK();
+       NET_LOCK_SHARED();
 
        nic_info_size = vmt_xdr_nic_info(NULL) + sizeof(VM_NICINFO_CMD) - 1;
        nic_info = malloc(nic_info_size, M_DEVBUF, M_WAITOK | M_ZERO);
@@ -1344,7 +1344,7 @@ vmt_nicinfo_task(void *data)
        strncpy(nic_info, VM_NICINFO_CMD, nic_info_size);
        vmt_xdr_nic_info(nic_info + sizeof(VM_NICINFO_CMD) - 1);
 
-       NET_UNLOCK();
+       NET_UNLOCK_SHARED();
 
        if (nic_info_size != sc->sc_nic_info_size ||
            (memcmp(nic_info, sc->sc_nic_info, nic_info_size) != 0)) {

Reply via email to