From owner-dev-commits-src-main@freebsd.org Wed Aug 18 17:55:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AF455653D28 for ; Wed, 18 Aug 2021 17:55:02 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GqbCB4SZRz4r6w for ; Wed, 18 Aug 2021 17:55:02 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 7CFF02C977 for ; Wed, 18 Aug 2021 17:55:02 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f177.google.com with SMTP id m21so3931530qkm.13 for ; Wed, 18 Aug 2021 10:55:02 -0700 (PDT) X-Gm-Message-State: AOAM532ZldvXVRJNnQH3doivxPqUtIfCXUxRqkxQWmvtwuW6o7J2m4/6 KweAlKhRklJnKNp+oSzwf8mHNLsy7pL+mk1b2tc= X-Received: by 2002:a37:a58b:: with SMTP id o133mt11334822qke.120.1629309302075; Wed, 18 Aug 2021 10:55:02 -0700 (PDT) MIME-Version: 1.0 References: <202108181754.17IHs1Ub030989@gitrepo.freebsd.org> In-Reply-To: <202108181754.17IHs1Ub030989@gitrepo.freebsd.org> From: Kyle Evans Date: Wed, 18 Aug 2021 12:54:49 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d7e1bdfebacc - main - uipc: avoid circular pr_{slow, fast}timos Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Aug 2021 17:55:02 -0000 On Wed, Aug 18, 2021 at 12:54 PM Kyle Evans wrote: > > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d7e1bdfebacc4de25dc51e14a91d66bb429677c9 > > commit d7e1bdfebacc4de25dc51e14a91d66bb429677c9 > Author: Kyle Evans > AuthorDate: 2021-08-18 17:31:45 +0000 > Commit: Kyle Evans > 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); > + } > } > > /*