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

Re: [PATCH 2/6] arm/mpu: Implement vmap functions for MPU


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 8 Dec 2025 12:10:05 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P3IXhYZrqjgWlFE/m8Jp9W2Vh/NZkuZOInmNfg0aCoU=; b=Xv/LBUIjCgTtYAgsCBTUMW0iqaUweFukv6Mp2jmpirQVfr/8DE7OG+3QHUpAWtWIuUWGqRkZ0Ktt0KNQHXHAuBLfDiFY1wLLZ5CzGoKkNXUOcIx3LYDg/MwdW/SULsaXHGu78H4LqHBetn8ckT1tisd28+ia1QbMkwT3IvJOFYdn8Ib8+XLxcQ0ROeXvP+dfv+TpKgdFRo1In+01809HiTk0KwvBfcFgr+QSDsEGauStjMLz+Aegrwj4Iz/G5Nx1nQLwnrbk61J0yVrpmZIBAguOzWstE1Xcd8SCOvw7PTEmnCzLFtkDLcwOwWFT4jxOvgaOSUct/KS2DuA/Gn6NOA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V+Waz8yIBh4giaDMIbob1Ch55OOSPpk2KM6YOCIlV/FvTEt60bVErPAP1DZo0uOLAypWKXGHE7Y19lQfpo+tN38edm0xHm2B2PLPNyd0o3vAAAX+pVCSkUZRVwjXxbRGN5biaOKgth/5AQmQPPkaQargZ1WKdHP4VzrQgDFdbhpOVx7xAWpkN/qP6lL/YI3t4UhAwplI86fMVyg3xdBE5OYw456ITHiZok3b2y56K6/NzLekBr5zmnYMTzw/ZtD9k7sDTLOnaXe8I21t/EUGNsi4rwx4TLrx427qTvYHjH9X6vwnVhTIY3nb2ZqINjDUtkbgciTzYhRiCts6XZhl5w==
  • Cc: Harry Ramsey <Harry.Ramsey@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 08 Dec 2025 11:10:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 08/12/2025 11:20, Luca Fancellu wrote:
> Hi Michal,
> 
> thanks for your review, I’ll answer only few of your points and I’ll let 
> Harry take the rest.
> 
>> On 8 Dec 2025, at 09:53, Orzel, Michal <Michal.Orzel@xxxxxxx> wrote:
>>
>>
>>
>> On 28/11/2025 10:58, Harry Ramsey wrote:
>>> From: Luca Fancellu <luca.fancellu@xxxxxxx>
>>>
>>> HAS_VMAP is not enabled on MPU systems, but the vmap functions are used
>> Just as a reminder, we don't intend to support VMAP on MPU? Asking because it
>> would otherwise be a duplicate effort to implement only these two helpers.
> 
> Yes we are not going to support VMAP on MPU, here we want only to provide the
> implementation of these two helper so that we don’t touch the common code 
> using these.
> Are you suggesting some rewording or was it only a curiosity on your side?
It was a question to check whether we are aligned.

> 
>>>
>>> +/*
>>> + * Free a xen_mpumap entry given the index. A mpu region is actually 
>>> disabled
>>> + * when the refcount is 0 and the region type is MPUMAP_REGION_FOUND.
>>> + *
>>> + * @param idx                   Index of the mpumap entry.
>>> + * @param region_found_type     Either MPUMAP_REGION_FOUND or 
>>> MPUMAP_REGION_INCLUSIVE.
>> Both of these are unsigned, so why the parameter is int?
> 
> Uhm, good catch, I think this is a documentation issue because it might be 
> also MPUMAP_REGION_OVERLAP which is
> -1, we should not mandate which value might be here, we should only say 
> MPUMAP_REGION_* values.
> 
> 
>>>
>>>
>>> void vunmap(const void *va)
>>> {
>>> -    BUG_ON("unimplemented");
>>> +    paddr_t base = virt_to_maddr(va);
>>> +
>>> +    if ( destroy_entire_xen_mapping(base) )
>>> +        panic("Failed to vunmap region\n");
>> Looking at common vunmap() we ignore the return code from
>> destroy_xen_mappings(). Is it ok to diverge?
> 
> In our tests it’s ok, I asked Harry to have this so that we can catch any 
> vunmap that is not balanced
> with a prior mapping. To be fair I’m not really sure why in the vmap.c 
> implementation we are not
> reading the error codes from destroy_xen_mappings.
I'm ok with that. I don't know why we don't check the rc there. If you look at
x86 destroy_xen_mappings calls, none seem to be checked against rc. It can be
that it's impossible scenario there.

~Michal

> 
> Cheers,
> Luca
> 




 


Rackspace

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