Context switch looks fine here.

Index: sys/dev/pv/hypervic.c
===================================================================
RCS file: /cvs/src/sys/dev/pv/hypervic.c,v
retrieving revision 1.19
diff -u -p -r1.19 hypervic.c
--- sys/dev/pv/hypervic.c       11 Apr 2023 00:45:08 -0000      1.19
+++ sys/dev/pv/hypervic.c       18 Sep 2023 08:35:02 -0000
@@ -846,7 +846,7 @@ kvp_get_ip_info(struct hv_kvp *kvp, cons
        struct sockaddr_in6 *sin6, sa6;
        uint8_t enaddr[ETHER_ADDR_LEN];
        uint8_t ipaddr[INET6_ADDRSTRLEN];
-       int i, j, lo, hi, s, af;
+       int i, j, lo, hi, af;
 
        /* Convert from the UTF-16LE string format to binary */
        for (i = 0, j = 0; j < ETHER_ADDR_LEN; i += 6) {
@@ -870,16 +870,14 @@ kvp_get_ip_info(struct hv_kvp *kvp, cons
                return (-1);
        }
 
-       KERNEL_LOCK();
-       s = splnet();
+       NET_LOCK_SHARED();
 
        TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
                if (!memcmp(LLADDR(ifp->if_sadl), enaddr, ETHER_ADDR_LEN))
                        break;
        }
        if (ifp == NULL) {
-               splx(s);
-               KERNEL_UNLOCK();
+               NET_UNLOCK_SHARED();
                return (-1);
        }
 
@@ -919,8 +917,7 @@ kvp_get_ip_info(struct hv_kvp *kvp, cons
                else if (ifa6ll != NULL)
                        ifa = ifa6ll;
                else {
-                       splx(s);
-                       KERNEL_UNLOCK();
+                       NET_UNLOCK_SHARED();
                        return (-1);
                }
        }
@@ -956,8 +953,7 @@ kvp_get_ip_info(struct hv_kvp *kvp, cons
                break;
        }
 
-       splx(s);
-       KERNEL_UNLOCK();
+       NET_UNLOCK_SHARED();
 
        return (0);
 }

Reply via email to