Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Aug 2021 12:54:49 -0500
From:      Kyle Evans <kevans@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>,  "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org
Subject:   Re: git: d7e1bdfebacc - main - uipc: avoid circular pr_{slow, fast}timos
Message-ID:  <CACNAnaHmR=xfDvyv471N%2B_aE61K85MvM0d4RQ0JqwtxWKhO83w@mail.gmail.com>
In-Reply-To: <202108181754.17IHs1Ub030989@gitrepo.freebsd.org>
References:  <202108181754.17IHs1Ub030989@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 18, 2021 at 12:54 PM Kyle Evans <kevans@freebsd.org> wrote:
>
> The branch main has been updated by kevans:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=d7e1bdfebacc4de25dc51e14a91d66bb429677c9
>
> commit d7e1bdfebacc4de25dc51e14a91d66bb429677c9
> Author:     Kyle Evans <kevans@FreeBSD.org>
> AuthorDate: 2021-08-18 17:31:45 +0000
> Commit:     Kyle Evans <kevans@FreeBSD.org>
> CommitDate: 2021-08-18 17:46:54 +0000
>
>     uipc: avoid circular pr_{slow,fast}timos
>

This should read "avoid circular pf{fast,slow}_list", sorry.

>     domain_init() gets reinvoked for each vnet on a system, so we must not
>     alter global state.  Practically speaking, we were creating circular
>     lists and tying up a softclock thread into an infinite loop.
>
>     The breakage here was most easily observed by simply creating a jail
>     in a new vnet and watching the system suddenly become erratic.
>
>     Reported by:    markj
>     Fixes:  e0a17c3f063f ("uipc: create dedicated lists for fast ...")
>     Pointy hat:     kevans
> ---
>  sys/kern/uipc_domain.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
> index 0946a2a75326..d572e0ec19db 100644
> --- a/sys/kern/uipc_domain.c
> +++ b/sys/kern/uipc_domain.c
> @@ -194,12 +194,23 @@ domain_init(void *arg)
>                 (*dp->dom_init)();
>         for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
>                 protosw_init(pr);
> -               rm_wlock(&pftimo_lock);
> -               if (pr->pr_fasttimo != NULL)
> -                       LIST_INSERT_HEAD(&pffast_list, pr, pr_fasttimos);
> -               if (pr->pr_slowtimo != NULL)
> -                       LIST_INSERT_HEAD(&pfslow_list, pr, pr_slowtimos);
> -               rm_wunlock(&pftimo_lock);
> +
> +               /*
> +                * Note that with VIMAGE enabled, domain_init() will be
> +                * re-invoked for each new vnet that's created.  The below lists
> +                * are intended to be system-wide, so avoid altering global
> +                * state for non-default vnets.
> +                */
> +               if (IS_DEFAULT_VNET(curvnet)) {
> +                       rm_wlock(&pftimo_lock);
> +                       if (pr->pr_fasttimo != NULL)
> +                               LIST_INSERT_HEAD(&pffast_list, pr,
> +                                   pr_fasttimos);
> +                       if (pr->pr_slowtimo != NULL)
> +                               LIST_INSERT_HEAD(&pfslow_list, pr,
> +                                   pr_slowtimos);
> +                       rm_wunlock(&pftimo_lock);
> +               }
>         }
>
>         /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaHmR=xfDvyv471N%2B_aE61K85MvM0d4RQ0JqwtxWKhO83w>