From owner-svn-src-head@freebsd.org Fri Feb 16 07:42:39 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 79A76F1D818; Fri, 16 Feb 2018 07:42:39 +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 E7DE06AD40; Fri, 16 Feb 2018 07:42:38 +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 194E7D6924E; Fri, 16 Feb 2018 18:19:15 +1100 (AEDT) Date: Fri, 16 Feb 2018 18:19:14 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jung-uk Kim cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r329340 - head/sys/amd64/include In-Reply-To: <201802152042.w1FKgcDd079601@repo.freebsd.org> Message-ID: <20180216172320.I2471@besplex.bde.org> References: <201802152042.w1FKgcDd079601@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=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=wANgeDMT7b3Cd_af7SoA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 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: Fri, 16 Feb 2018 07:42:39 -0000 On Thu, 15 Feb 2018, Jung-uk Kim wrote: > Log: > Change size of padding to reflect reality. No functional change. > > Discussed with: kib > > Modified: > head/sys/amd64/include/pcpu.h > > Modified: head/sys/amd64/include/pcpu.h > ============================================================================== > --- head/sys/amd64/include/pcpu.h Thu Feb 15 19:49:15 2018 (r329339) > +++ head/sys/amd64/include/pcpu.h Thu Feb 15 20:42:38 2018 (r329340) > @@ -75,7 +75,7 @@ > uint32_t pc_pcid_gen; \ > uint32_t pc_smp_tlb_done; /* TLB op acknowledgement */ \ > uint32_t pc_ibpb_set; \ > - char __pad[216] /* be divisor of PAGE_SIZE \ > + char __pad[224] /* be divisor of PAGE_SIZE \ > after cache alignment */ This still has a bogus struct member name. The prefix for names in this struct is pc_, not __. Names beginning with __ are reserved for the implementation. The implementation might define __pad as . To detect this common naming error. It is also used in sys/efi.h. i386/include/pcpu.h and i386/include/pmc_mdep.h. The object of "be" in the comment is unclear. It is the size of the whole struct, not the MD fields. The padding amount is especially odd for i386 pcpu. It is 445 chars there. This means 445 chars of padding in __pad[] and 3 more chars in unnamed padding. The MD fields have no special alignment, and the padding depends on the MI fields too. With this change, on amd64 sizeof(struct pcpu) is 1K. This indeed divides PAGE_SIZE. I don't see what good this does. __pcpu is only aligned to an 0x200 boundary in my test kernel (struct pcpu is aligned to an 0x40 boundary, and aligning to this boundary is what made the old padding work). On i386, the garbage value of 445 also gives sizeof(struct pcpu) = 1K. __pcpu is only aligned to an 0x80 boundary in my test kernel (struct pcpu has the same CACHE_LINE_SIZE = 0x40 boundary as on amd64). Bruce