Hi Julien,

> -----Original Message-----
> From: Julien Grall <jul...@xen.org>
> Sent: 2022年2月26日 4:12
> To: Wei Chen <wei.c...@arm.com>; Stefano Stabellini
> <sstabell...@kernel.org>
> Cc: xen-devel@lists.xenproject.org; Bertrand Marquis
> <bertrand.marq...@arm.com>; Penny Zheng <penny.zh...@arm.com>; Henry Wang
> <henry.w...@arm.com>; nd <n...@arm.com>
> Subject: Re: Proposal for Porting Xen to Armv8-R64 - DraftA
> 
> Hi Wei,
> 
> On 25/02/2022 10:48, Wei Chen wrote:
> >> >     Armv8-R64 can support max to 256 MPU regions. But that's just
> >> theoretical.
> >> >     So we don't want to define `pr_t mpu_regions[256]`, this is a
> memory
> >> waste
> >> >     in most of time. So we decided to let the user specify through a
> >> Kconfig
> >> >     option. `CONFIG_ARM_MPU_EL1_PROTECTION_REGIONS` default value can
> be
> >> `32`,
> >> >     it's a typical implementation on Armv8-R64. Users will recompile
> Xen
> >> when
> >> >     their platform changes. So when the MPU changes, respecifying the
> >> MPU
> >> >     protection regions number will not cause additional problems.
> >>
> >> I wonder if we could probe the number of MPU regions at runtime and
> >> dynamically allocate the memory needed to store them in arch_vcpu.
> >>
> >
> > We have considered to used a pr_t mpu_regions[0] in arch_vcpu. But it
> seems
> > we will encounter some static allocated arch_vcpu problems and sizeof
> issue.
> 
> Does it need to be embedded in arch_vcpu? If not, then we could allocate
> memory outside and add a pointer in arch_vcpu.
> 

We had thought to use a pointer in arch_vcpu instead of embedding mpu_regions
into arch_vcpu. But we noticed that arch_vcpu has a __cacheline_aligned
attribute, this may be because of arch_vcpu will be used very frequently
in some critical path. So if we use the pointer for mpu_regions, may cause
some cache miss in these critical path, for example, in context_swtich.

> Cheers,
> 
> --
> Julien Grall

Reply via email to