From owner-svn-src-head@freebsd.org Sun Jul 8 19:28: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 5F6091025E52; Sun, 8 Jul 2018 19:28:25 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14AE284BA6; Sun, 8 Jul 2018 19:28:25 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from mail-io0-f174.google.com (mail-io0-f174.google.com [209.85.223.174]) (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)) (Authenticated sender: mmacy) by smtp.freebsd.org (Postfix) with ESMTPSA id CFDCE24210; Sun, 8 Jul 2018 19:28:24 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: by mail-io0-f174.google.com with SMTP id v26-v6so15186614iog.5; Sun, 08 Jul 2018 12:28:24 -0700 (PDT) X-Gm-Message-State: AOUpUlFNLO/bR+46j1DRQtw/y+ihNY3flQnrldyrG+kgOGoj9/52UbZ1 Nw3Z3VWQwkdkWkkjcBGDl6E0qiY37XEQbscKwno= X-Google-Smtp-Source: AAOMgpclZn/FE5kbGGKMttyIKdlxmVbedUIL4MbgRJ6Se6JMdyVV7ohmTxTl5N9jiHcxhFi2sIJXYtqs83nGikxbDtE= X-Received: by 2002:a6b:ed11:: with SMTP id n17-v6mr15092396iog.132.1531078103910; Sun, 08 Jul 2018 12:28:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:8d2:0:0:0:0:0 with HTTP; Sun, 8 Jul 2018 12:28:22 -0700 (PDT) In-Reply-To: <20180708142210.GA18193@pesky> References: <201807030155.w631tARo009470@repo.freebsd.org> <20180708142210.GA18193@pesky> From: Matthew Macy Date: Sun, 8 Jul 2018 12:28:22 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r335879 - in head/sys: conf kern sys To: Mark Johnston Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" 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 19:28:25 -0000 On Sun, Jul 8, 2018 at 7:22 AM, Mark Johnston wrote: > 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? > We definitely do. Not sure how that got lost :( Will fix. -M