From owner-svn-src-all@freebsd.org Fri May 22 16:12:35 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBCD12CCDD3; Fri, 22 May 2020 16:12:35 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49TBN35bCGz4WFf; Fri, 22 May 2020 16:12:35 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id BB28625495; Fri, 22 May 2020 16:12:35 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f170.google.com with SMTP id w3so5705223qkb.6; Fri, 22 May 2020 09:12:35 -0700 (PDT) X-Gm-Message-State: AOAM531EDtgYrnprKzK8trjZSK43Unlath3u4hI1nykysdImzfRXYlmW vT9AWZjL9+d3p+istvM5q+rzh8RGwESD9N2oxyw= X-Google-Smtp-Source: ABdhPJy2IDbJ0vNtwYPCInXwtMTgkmqZzuSO5BSJJVmSllznLoq/64tpdaYzNazQu2ulAqT3qVDXIK/WOl4ufoo7QXI= X-Received: by 2002:a37:a20c:: with SMTP id l12mr7805847qke.34.1590163955375; Fri, 22 May 2020 09:12:35 -0700 (PDT) MIME-Version: 1.0 References: <202005201103.04KB3xTp013965@repo.freebsd.org> In-Reply-To: <202005201103.04KB3xTp013965@repo.freebsd.org> From: Kyle Evans Date: Fri, 22 May 2020 11:12:22 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r361275 - in head/sys: conf dev/hyperv/hvsock dev/hyperv/include dev/hyperv/vmbus modules/hyperv modules/hyperv/hvsock sys To: Wei Hu Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2020 16:12:35 -0000 On Wed, May 20, 2020 at 6:04 AM Wei Hu wrote: > > Author: whu > Date: Wed May 20 11:03:59 2020 > New Revision: 361275 > URL: https://svnweb.freebsd.org/changeset/base/361275 > > Log: > HyperV socket implementation for FreeBSD > > This change adds Hyper-V socket feature in FreeBSD. New socket address > family AF_HYPERV and its kernel support are added. > > [... snip ...] > +void > +hvs_trans_init(void) > +{ > + /* Skip initialization of globals for non-default instances. */ > + if (!IS_DEFAULT_VNET(curvnet)) > + return; > + > + if (vm_guest != VM_GUEST_HV) > + return; > + > + HVSOCK_DBG(HVSOCK_DBG_VERBOSE, > + "%s: HyperV Socket hvs_trans_init called\n", __func__); > + > + /* Initialize Globals */ > + previous_auto_bound_port = MAX_PORT; > + sx_init(&hvs_trans_socks_sx, "hvs_trans_sock_sx"); > + mtx_init(&hvs_trans_socks_mtx, > + "hvs_trans_socks_mtx", NULL, MTX_DEF); > + LIST_INIT(&hvs_trans_bound_socks); > + LIST_INIT(&hvs_trans_connected_socks); > +} > + I have a suspicion that all of these should really be per-vnet for correct semantics with VIMAGE, with the IS_DEFAULT_VNET check earlier dropped completely. I haven't read around the rest all that much, but this would at least seem to prevent port re-use by a different vnet, which is perhaps "good enough" but I think this is something that should be fixed in the mid-term. Thanks, Kyle Evans