From owner-dev-commits-src-all@freebsd.org Thu Aug 5 23:58:50 2021 Return-Path: Delivered-To: dev-commits-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 3CA3666D004 for ; Thu, 5 Aug 2021 23:58:50 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2c.ore.mailhop.org (outbound2c.ore.mailhop.org [54.186.10.118]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ggltx6NNzz4hkv for ; Thu, 5 Aug 2021 23:58:49 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1628207923; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=gVrKL5P7eAIc0KHV8DYCfRTQ8xU2AEy1AhvoxHrhycYTz1c3m38v9tXSu0ChJyV0jA3CZJ1FajY7x v8LyQPubIuHGrRyKUJ0szUclnrau6jhPo6pAyOP31BSc9JGzh/kjIJqabuFQy1ruzMtuJBxrBYUGwe t/1VBhCH97XTC6M3ZuUFzNz0At6UnGwDoGabHgjzclu+5F/Dw0L+psnC41m352V6oh/1dM2li1UCMr ai6yJ6Xk9zao30n+f28RqFVdObYwlPnRNIfJ9w1PoeDNNr4Eb9x2dXmr7Qx9kxJ6ljbrxRIY382x5K MxSxeVFClW4W2Az9k5B3aRYhG1THCsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=l09YutvCLUy5HpLP3zWJgoK6psR+4zFElran31sxWt0=; b=hOPDBPx7poEjDdRTOhaYdcQDw4E0e+RtN3lR94LCZMh9zRwwDkfzOlIp6tLfHZP1pyTI+yOv5381/ +0bzoqCdNylN4ZFv7/OLBUBHlDaolPsIb3vzgVxPGTiByHWfNtsqpSlnfGjc1fbensa99Ecukgo2US KWtCXqkYraSVaJIYCp75XZbIQ0Ujn0xNjDYpY+XqlsHg6BbxB4a0Ii6eHruY56/W1uwTehS3WIwGWE 75TiSY2QAN/+gq/INYmCOiaQNo/1pvYaTO4+c/SsKUyOAE2ZETqp0whPR6ZECAMpNp0Jgii2bag48j GBdBPREWpXgA2fH9wheKx9a+YJkGyJQ== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=l09YutvCLUy5HpLP3zWJgoK6psR+4zFElran31sxWt0=; b=AzEevA0J5IkyLcsSHR9kRNrjpBSmzldVospuJifhA2TCacylD3zOosybYlod+b5Nj2cVmf1K+wnOw 46kQ5yehLWjT5GIcEgVfUTnwSwD1acLWJGO46vZJ162BKtnhx+JXba16i53guocHe8XaMo5Ivw/4Nq r9CZQbiLdDlcPDQwft//hPX89VBJzFuLAxJcXdVh/6DX5RHIPuPOsa/tCHSaukbMlV00qh4t4Nvt/u Xc5QihzggXYn3e7BMn2MCBF/Rp4jPlrEc8Sxfw5TB6LHZXqyMVBJoYxZpPkLAqBG+5Y5cj22rhckn/ MrR4+FpDDA5mF5vrm6GZIYCKUjmSR3A== X-Originating-IP: 67.177.211.60 X-MHO-RoutePath: aGlwcGll X-MHO-User: 0f529c41-f649-11eb-a658-89389772cfc7 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 0f529c41-f649-11eb-a658-89389772cfc7; Thu, 05 Aug 2021 23:58:42 +0000 (UTC) Received: from [172.22.42.84] (rev2.hippie.lan [172.22.42.84]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 175Nwf0q086315; Thu, 5 Aug 2021 17:58:41 -0600 (MDT) (envelope-from ian@freebsd.org) X-Authentication-Warning: paranoia.hippie.lan: Host rev2.hippie.lan [172.22.42.84] claimed to be [172.22.42.84] Message-ID: Subject: Re: git: 09066b98663d - main - ktls: Use the new PNOLOCK flag From: Ian Lepore To: Andrew Gallatin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Date: Thu, 05 Aug 2021 17:58:41 -0600 In-Reply-To: <202108052251.175MpwTC090873@gitrepo.freebsd.org> References: <202108052251.175MpwTC090873@gitrepo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.3 FreeBSD GNOME Team MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Ggltx6NNzz4hkv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 23:58:50 -0000 On Thu, 2021-08-05 at 22:51 +0000, Andrew Gallatin wrote: > The branch main has been updated by gallatin: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=09066b98663d92f4d129bab25105805adf0abaf7 > > commit 09066b98663d92f4d129bab25105805adf0abaf7 > Author:     Andrew Gallatin > AuthorDate: 2021-08-05 21:19:12 +0000 > Commit:     Andrew Gallatin > CommitDate: 2021-08-05 21:19:12 +0000 > >     ktls: Use the new PNOLOCK flag >     >     Use the new PNOLOCK flag to tsleep() to indicate that >     we are managing potential races, and don't need to >     sleep with a lock, or have a backstop timeout. >     >     Reviewed by: jhb >     Sponsored by: Netflix > --- >  sys/kern/uipc_ktls.c | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c > index 47815c266667..1cc1f2e8b8c4 100644 > --- a/sys/kern/uipc_ktls.c > +++ b/sys/kern/uipc_ktls.c > @@ -2240,7 +2240,7 @@ ktls_alloc_thread(void *ctx) >         nbufs = 0; >         for (;;) { >                 atomic_store_int(&sc->running, 0); > -               tsleep_sbt(sc, PZERO, "waiting for work", SBT_MAX, > SBT_1S, 0); > +               tsleep(sc, PZERO | PNOLOCK, "-",  0); >                 atomic_store_int(&sc->running, 1); >                 sc->wakeups++; >                 if (nbufs != ktls_max_alloc) { I especially like this solution, it documents explicitly what you're doing and why. (Earlier I was considering mumbling something about "there should be a comment to say a sleep-forever is known safe here".) -- Ian