From owner-svn-src-head@freebsd.org Sun Jul 8 14:22:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E78F1029340; Sun, 8 Jul 2018 14:22:25 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7587768A6; Sun, 8 Jul 2018 14:22:24 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-wr1-x443.google.com with SMTP id t6-v6so8349076wrn.7; Sun, 08 Jul 2018 07:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=J38f9Mqa8BXeiJ+U++RUytZ6xTycrx8+h78xL31lSTQ=; b=kbQq+SgoFNdJrCON0HEt3by3pBEhnROL+q9nkhvFyWWQ7LyI5DPSjJ7hYKSfTpsozG jEtc7rXah15FJZ/wKtIoqrvBjFSC3VxjgRbQ45fuvYHRe/kq7Ek6s3818IkHYVsPA1SQ UW56r/kB538xyBb4v+Lbi5aAMIuvQvc2ytDOz1Ftf8PXHzZ7QPs9sWdULrnM1peem3vA 5uEsC5Hk+9kKmWVdhdS+vIAvlaDGCS8b25QrYhk+jSywB0RyVIvHPI+ncZ+H5Rq6Yj2k 67ekICoubVdn1hgWe0rj4Dw0FkMO/MFlQIsALb+xgZVnnd8LqtbUcphHgq30/3my2h8+ 3nTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=J38f9Mqa8BXeiJ+U++RUytZ6xTycrx8+h78xL31lSTQ=; b=pLuDjRSRndPOEDEL8Q9xafvyy9Nd8/l4Ar68FRrhcze/p95bjnDbv92BzgQRrEvq5V f8J3UwvmBFS7md5PKshUdGcxCoYsxTT4bxjBAvxuJBXcAx72HKsjFvlF+QA/70OVGpDe xs1Pwq8KZ5Z9rN3H7/7s4OVjzNYeI4aYHXEb39qPIFjVQdBJLGGlXiKpLwBPrhrPhSa8 nu8aR8wF07Wkm9fBT05GiYJJomXKcqRMC5MonLT9fdz7+hneBkFhhhurhvzf/RWVxBdn cEe8FO+/fVEmrzy/a1NKPZt51KGOUzRzKCQ/0hFKCIzBdkG+mSZq1ThbJJgtp71yMZJ4 mJRw== X-Gm-Message-State: APt69E2wxFMbYd/weLKu4zhMM3dclFSFgXmdDk1z8BggYVNRPrgrwuNA 3ZZadFgIKwTrjBzB6k1684Ho4g== X-Google-Smtp-Source: AAOMgpeufyyXmn6dDr60hEkt5GZ3kH1JkUZQmZS0ydnpnCIfRS7HanTBx9NtbeTqA66O+DqVuUitJA== X-Received: by 2002:adf:acc3:: with SMTP id o61-v6mr13024326wrc.34.1531059743419; Sun, 08 Jul 2018 07:22:23 -0700 (PDT) Received: from pesky (174.red-81-43-74.staticip.rima-tde.net. [81.43.74.174]) by smtp.gmail.com with ESMTPSA id h102-v6sm19315481wrh.60.2018.07.08.07.22.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Jul 2018 07:22:22 -0700 (PDT) Sender: Mark Johnston Date: Sun, 8 Jul 2018 10:22:17 -0400 From: Mark Johnston To: Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r335879 - in head/sys: conf kern sys Message-ID: <20180708142210.GA18193@pesky> References: <201807030155.w631tARo009470@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201807030155.w631tARo009470@repo.freebsd.org> User-Agent: Mutt/1.10.0 (2018-05-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2018 14:22:25 -0000 On Tue, Jul 03, 2018 at 01:55:10AM +0000, Matt Macy wrote: > Author: mmacy > Date: Tue Jul 3 01:55:09 2018 > New Revision: 335879 > URL: https://svnweb.freebsd.org/changeset/base/335879 > > Log: > make critical_{enter, exit} inline > > Avoid pulling in all of the dependencies by > automatically generating a stripped down thread_lite exporting > only the fields of interest. The field declarations are type checked > against the original and the offsets of the generated result is > automatically checked. > > kib has expressed disagreement and would have preferred to simply > use genassym style offsets (which loses type check enforcement). > jhb has expressed dislike of it due to header pollution and a > duplicate structure. He would have preferred to just have defined > thread in _thread.h. Nonetheless, he admits that this is the only > viable solution at the moment. > > The impetus for this came from mjg's D15331: > "Inline critical_enter/exit for amd64" > > Reviewed by: jeff > Differential Revision: https://reviews.freebsd.org/D16078 > > [...] > +#if defined(KLD_MODULE) || defined(KTR_CRITICAL) || !defined(_KERNEL) || defined(GENOFFSET) > +#define critical_enter() critical_enter_KBI() > +#define critical_exit() critical_exit_KBI() > +#else > +static __inline void > +critical_enter(void) > +{ > + struct thread_lite *td; > + > + td = (struct thread_lite *)curthread; > + td->td_critnest++; Don't we need a compiler barrier here? > +} > + > +static __inline void > +critical_exit(void) > +{ > + struct thread_lite *td; > + > + td = (struct thread_lite *)curthread; > + KASSERT(td->td_critnest != 0, > + ("critical_exit: td_critnest == 0")); > + td->td_critnest--; > + __compiler_membar(); > + if (__predict_false(td->td_owepreempt)) > + critical_exit_preempt(); > + > +} > +#endif > + > + > #ifdef EARLY_PRINTF > typedef void early_putc_t(int ch); > extern early_putc_t *early_putc; >