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

Re: [PATCH v3 1/6] arm/mpu: Find MPU region by range


  • To: Hari Limaye <Hari.Limaye@xxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Tue, 15 Jul 2025 11:59:35 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • 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=NVdPxIvFWjAi1vxxi3/MX5dbad8orM456+oSftU6GVE=; b=S5Nlj7n+5mc6VeWK9CguMHFEndFFhakgQ9twJvCvJEwwaDkFBFDlM1xsigul5Z1mpIX06WcLggJYegKYrif54FycKCL6xOTTKF2LRbW/AKw3gdDjRJ8TMkUZ2H9/OWUibE73mm1ROC9J2qJcCpt5Vs+ByEs3jLbCgO4517yG7eBkuPSJvpi2rED5KvnzZ6vPiAlgFQoB+0WezwRX0E8bmi7wMCn8rT/NzX6I+fUnWIVc5UlmRwaUnrVPuD+AorShsoqFv9KdU8H3upbkIG9QtJ54hRt3q6qzfYMIvA4XPSuGTOeBWwv2clG7Juz6mlGL/F26LsBBXJvtfH0/NPjzew==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=szqSvJOVrTFoKX2cs0h/gnMsTOIaNqs7o6wL+iKo4D70OgCaLtHaXZ25L3ypEVNrkNJU3+9jQBfn5rK3vRX8JSEW7qT5S4OktZ8NLFeW4ehY9d9rHoBDkagAYIcS7AI5BF2g6tK655zrKbm75ebMwfHIir5EaRH8Jjl3lXdZbI4kLZcmksAp6/6qjhNh2o5RGiShvWwW09Ngg2q4S8oSGOyeWt4TqRa2Z2ljTs2rMiR1XRLjh+L9CwYQBOaEWOZS3o4nSkH9FilefT4QvwhwCdpR1glmBcSxSmVP90JtQooY7mh+OU00hyt+rzsKAhhAgPBi5I8nMYqadlxWXmst2w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Luca Fancellu <Luca.Fancellu@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 15 Jul 2025 09:59:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 15/07/2025 11:48, Hari Limaye wrote:
> Hi Michal,
> 
>> On 15 Jul 2025, at 09:45, Orzel, Michal <michal.orzel@xxxxxxx> wrote:
>>
>>
>>
>> On 15/07/2025 10:36, Hari Limaye wrote:
>>> Hi Michal,
>>>
>>>>> +int mpumap_contains_region(pr_t *table, uint8_t nr_regions, paddr_t base,
>>>>> +                           paddr_t limit, uint8_t *index)
>>>>> +{
>>>>> +    ASSERT(index);
>>>>> +    *index = INVALID_REGION_IDX;
>>>>> +
>>>>> +    /*
>>>>> +     * The caller supplies a half-open interval [base, limit), i.e. 
>>>>> limit is the
>>>>> +     * first byte *after* the region. Require limit strictly greater 
>>>>> than base,
>>>>> +     * which is necessarily a non-empty region.
>>>>> +     */
>>>>> +    ASSERT(base < limit);
>>>> Well, that does not guarantee a non-empty region.
>>>> Consider passing [x, x+1). The assert will pass, even though the region is 
>>>> empty.
>>>>
>>>> ~Michal
>>>>
>>>
>>> Apologies, I may well be missing something here! Please could you suggest a 
>>> code snippet to understand your expectation here / what you would prefer 
>>> the assert to be?
>>>
>>> As I understand it, with a half-open interval [base, limit) as is passed to 
>>> this function, the size is  `limit - base` and so the region [x, x+1) will 
>>> have size 1. The empty region starting at the same address would be [x, x). 
>>> But perhaps I am making the off-by-one error here.
>> Hmm, I think I made a mistake here. Region of size 1B would have base == 
>> limit
>> in registers. All good then.
>>
>> ~Michal
>>
> 
> Thanks for double checking. I notice you did not add your tag here, I wanted 
> to check if you think this patch is reviewed from your perspective?
Yes.

Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal




 


Rackspace

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