From: Jean Guyader Subject: Re: xen kernel: build failure Date: Mon, 28 Nov 2011 12:16:57 +0000 Message-ID: <20111128121657.GF32513@spongy.cam.xci-test.com> References: <4EA698C8.8030603@amd.com> <4ECD30330200007800062C2E@nat28.tlf.novell.com> <20111128115914.GD32513@spongy.cam.xci-test.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20111128115914.GD32513@spongy.cam.xci-test.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jan Beulich Cc: Christoph Egger , Keir Fraser , "xen-devel@lists.xensource.com" , Jean Guyader List-Id: xen-devel@lists.xenproject.org On 28/11 11:59, Jean Guyader wrote: > On 23/11 04:41, Jan Beulich wrote: > > >>> On 23.11.11 at 17:31, Jean Guyader wrote: > > > On 25 October 2011 13:35, Keir Fraser wrote: > > >> On 25/10/2011 12:08, "Christoph Egger" wrote: > > >> > > >>> > > >>> Hi, > > >>> > > >>> Compiling the xen kernel fails with: > > >>> > > >>> xen/arch/x86/domain.c: In function 'alloc_domain_struct' > > >>> xen/arch/x86/domain.c:191: error: negative width in bit-field '' > > >> > > >> Problem is that struct domain has grown bigger than a page for some reason, > > >> in your build environment. > > >> > > >> I can't reproduce this. > > >> > > >>> Removing the line > > >>> > > >>> BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE); > > >>> > > >>> makes xen kernel compile again. > > >> > > >> But not actually work properly. We only allocate a single page for the > > >> domain struct. If the struct is bigger than a page, you'll get memory > > >> corruption at run time. > > >> > > > > > > Is there a reason for that? > > > > Of course there is: Post-boot there shouldn't be any allocations of > > order greater than zero. This is a generally advisable thing, given that > > Xen can't reclaim memory arbitrarily from domains, and in particular > > also necessary for tmem. > > > > > What would be the recommended to add something > > > into the struct domain now if we can't make it bigger than a page. > > > > Put a pointer to your data (or larger parts that are already there) > > instead of the data itself into struct domain, and allocate it > > separately. (You may have seen a patch from Olaf Hering late > > yesterday or earlier today that moved the mem_event pieces out > > of there for this very reason.) > > > > > > I've printed sizeof (struct domain) on boot with xen-unstable and it's > exactly a PAGE big. That mean that if I want a add a value to the struct > domain (event a pointer) I will have to make some room first. > I can see two candidates, that could be turned into pointers in arch_domain for x86: /* nestedhvm: translate l2 guest physical to host physical */ struct p2m_domain *nested_p2m[MAX_NESTEDP2M]; mm_lock_t nested_p2m_lock; or struct PITState vpit; Let me know which one I should pick. Maybe I should modify both to save some space for later. Jean