From owner-svn-src-all@freebsd.org Mon Nov 27 04:29:59 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E782CDF8645; Mon, 27 Nov 2017 04:29:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id A990C38BD; Mon, 27 Nov 2017 04:29:58 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 60C64D615D5; Mon, 27 Nov 2017 15:29:51 +1100 (AEDT) Date: Mon, 27 Nov 2017 15:29:51 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andrew Turner cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326225 - head/sys/arm64/arm64 In-Reply-To: <201711260929.vAQ9TYpk047843@repo.freebsd.org> Message-ID: <20171127143528.J1162@besplex.bde.org> References: <201711260929.vAQ9TYpk047843@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=cgg7eyTytd09u3vOAx0A:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Nov 2017 04:30:00 -0000 On Sun, 26 Nov 2017, Andrew Turner wrote: > Log: > Make the arm64 pmap_invalidate functions static inline. This fixes building > with DIAGNOSTIC. This is fairly broken on x86 too. > Modified: head/sys/arm64/arm64/pmap.c > ============================================================================== > --- head/sys/arm64/arm64/pmap.c Sun Nov 26 06:31:34 2017 (r326224) > +++ head/sys/arm64/arm64/pmap.c Sun Nov 26 09:29:34 2017 (r326225) > @@ -896,7 +896,7 @@ SYSCTL_ULONG(_vm_pmap_l2, OID_AUTO, promotions, CTLFLA > /* > * Invalidate a single TLB entry. > */ > -PMAP_INLINE void > +static __inline void > pmap_invalidate_page(pmap_t pmap, vm_offset_t va) PMAP_INLINE is now only used once on arm64 (for pmap_kremove). It gives a small optimization or pessimization by inlining, but is fragile and broken in some cases. In the DIAGNOSTIC case, it is usually or always defined as empty. This is silly. It does nothing except insignificantly simplify debugging and expose the 2 bugs fixed in this commit. These bugs are: - on arm64, the pmap_invalidate*() functions are not declared in a header file or used outside of pmap.c, but they were declared as gnu [implicit-extern] inline for the reachable !DIAGNOSTIC case. - complier bug: compilers don't detect the error that extern functions are not prototyped before they are defined in the gnu [implicit-extern] inline case The bugs are exposed by the DIAGNOSTIC case. Then the functions are plain implicit-extern. There is also an unreachable !DIAGNOSTIC case for non-gcc compatible compilers. On x86 and arm64, this uses explicit-extern inline. This gives C99 extern inline, which is confusing and probably doesn't worked. If it worked, then it might be used instead of forcing gnu implicit-extern inline if possible. Plain arm is quite different: arm/pmap-v4.c defines PMAP_INLINE as plain implicit-extern __inline in the !PMAP_DEBUG case. But this macro is completely different than the one of the same name in most other pmap files. It is only used when preceded by 'static', and thus is just for debugging, while its normal use is for inlining public functions. Some static functions are inlined without this obfuscation. i386 had the same obfuscation and more in FreeBSD-4 (it also used PMAP_INLINE for extern functions). arm/pmap-v6.c is more like arm64/pmap.c. It ifdefs on DIAGNOSTIC but gives plain implicit-extern C99 __inline only for extern functions where arm64 gives gnu implicit-extern non-C99 inline. There are also style bugs. Most places use __inline, but arm64 uses inline. amd64/pmap.c uses __inline except twice for PMAP_INLINE and once for pmap_unwire_ptp(). Bruce