Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 May 2020 11:12:22 -0500
From:      Kyle Evans <kevans@freebsd.org>
To:        Wei Hu <whu@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r361275 - in head/sys: conf dev/hyperv/hvsock dev/hyperv/include dev/hyperv/vmbus modules/hyperv modules/hyperv/hvsock sys
Message-ID:  <CACNAnaFJ5b-LoCCa7RZFuHKhsZ5mxd1hwmyXv-h3%2BQ26s0hGzQ@mail.gmail.com>
In-Reply-To: <202005201103.04KB3xTp013965@repo.freebsd.org>
References:  <202005201103.04KB3xTp013965@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 20, 2020 at 6:04 AM Wei Hu <whu@freebsd.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaFJ5b-LoCCa7RZFuHKhsZ5mxd1hwmyXv-h3%2BQ26s0hGzQ>