From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: open-coded page list manipulation in shadow code Date: Fri, 30 Jan 2015 10:26:01 +0000 Message-ID: <54CB6A49020000780005B2D9@mail.emea.novell.com> References: <54C67AC802000078000598CE@mail.emea.novell.com> <20150127105026.GA38811@deinos.phlegethon.org> <20150129173046.GG30353@deinos.phlegethon.org> <54CB509B020000780005B264@mail.emea.novell.com> <20150130102007.GA17164@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YH8m3-0002AA-FQ for xen-devel@lists.xenproject.org; Fri, 30 Jan 2015 10:26:03 +0000 In-Reply-To: <20150130102007.GA17164@deinos.phlegethon.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 30.01.15 at 11:20, wrote: > At 08:36 +0000 on 30 Jan (1422603387), Jan Beulich wrote: >> >>> On 29.01.15 at 18:30, wrote: >> > --- a/xen/arch/x86/mm/shadow/private.h >> > +++ b/xen/arch/x86/mm/shadow/private.h >> > @@ -318,6 +318,33 @@ static inline int mfn_oos_may_write(mfn_t gmfn) >> > } >> > #endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */ >> > >> > +/* Figure out the size (in pages) of a given shadow type */ >> > +static inline u32 >> > +shadow_size(unsigned int shadow_type) >> > +{ >> > + static const u32 type_to_size[SH_type_unused] = { >> > + 1, /* SH_type_none */ >> > + 2, /* SH_type_l1_32_shadow */ >> > + 2, /* SH_type_fl1_32_shadow */ >> > + 4, /* SH_type_l2_32_shadow */ >> > + 1, /* SH_type_l1_pae_shadow */ >> > + 1, /* SH_type_fl1_pae_shadow */ >> > + 1, /* SH_type_l2_pae_shadow */ >> > + 1, /* SH_type_l2h_pae_shadow */ >> > + 1, /* SH_type_l1_64_shadow */ >> > + 1, /* SH_type_fl1_64_shadow */ >> > + 1, /* SH_type_l2_64_shadow */ >> > + 1, /* SH_type_l2h_64_shadow */ >> > + 1, /* SH_type_l3_64_shadow */ >> > + 1, /* SH_type_l4_64_shadow */ >> > + 1, /* SH_type_p2m_table */ >> > + 1, /* SH_type_monitor_table */ >> > + 1 /* SH_type_oos_snapshot */ >> > + }; >> > + ASSERT(shadow_type < SH_type_unused); >> > + return type_to_size[shadow_type]; >> > +} >> >> Isn't this going to lead to multiple instances of that static array? > > Urgh, maybe. I'd have thought this would end up as a common symbol > (if that's the term I mean - one where the linker will merge identical > copies) but I didn't check what actually happens. That's C++ behavior you have in mind. Jan