[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] open-coded page list manipulation in shadow code



>>> On 30.01.15 at 11:20, <tim@xxxxxxx> wrote:
> At 08:36 +0000 on 30 Jan (1422603387), Jan Beulich wrote:
>> >>> On 29.01.15 at 18:30, <tim@xxxxxxx> 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.