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

Re: [PATCH v2 10/13] xen/arm: remove shm holes from extended regions


  • To: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 10 Apr 2024 16:58:41 +0200
  • 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=arcselector9901; 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=lUYXT+lySupyG2n8L+1iRKSiFtZLMt2zGXTL1cZJQ/c=; b=c5CHnwQJ6vBiI0miMpM2zoXof9F7jE6nHBEa8JMHCAksHbcbbtcKLFOz2clxICk8xZzPep04kR1BHD26SAIg/W2+QqfDFS/hy7vILzQbvr92nP7q/toNRnKvBX6cpwCwLc1NtnX8SNByyStS/MtXtTxoXzrpMtgKVM6fiBxg+UdhG1iAVzgPR1c9ZrkAHaeceYr4bZWsl4kXgdQj7rcoD83l6yyif0/wyrBsBr8zHzKmWS0L84QZqQnss9a4VIhy3U6Kerbe0g8ymevqQXfmIhOORWdGK6gkUkHdjjYWU/Uen+C7thoyy+Bt0vW/bydzMnbs7S8FIK+mbtnDd+QVMA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CoPabj3pLU3MYE7mMmMUwu2CP5rRlQoq7BdvwIeqsoiig3Bg8kCG2Wfci+XLosDwH1FSgxv6U9cp99oVmAn77kurVxDMdSa6dZMVFsnFHaN2/0nl54R0GN5qzTZAxrn6dp3DH6NluThaPAw7F74LqX7YuSPwvmJFBV8aOiaEM/u4pFJ3bh9Kv2oeYMvSCrwuGW6eO6V1WUQgsi7d2TxDqimxUPhC2Fdd4qOenjGeWd4lJYvrv9/8kDcSqYrYtyM5IAtW+eo5BLZoqe25lHGx7DYjKlJYU/3dlRc4wTZa+lv0pqeLkxEkJ3lT1wedGkLQPRj8NcDU8Fpdn/13Uw1ntQ==
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 10 Apr 2024 14:58:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Luca,

On 10/04/2024 16:08, Luca Fancellu wrote:
> 
> 
> Hi Michal,
> 
>>>
>>> For direct-map domain with iommu on, after we get guest shm info from 
>>> "kinfo",
>>> we use "remove_shm_from_rangeset" to remove static shm.
>>>
>>> For direct-map domain with iommu off, as static shm has already been taken
>>> care of through reserved memory banks, we do nothing.
>> Stale info given that shmem is no longer part of reserved memory banks. It's 
>> been taken care
>> of by removing shmem regions in find_unallocated_memory()
> 
> Sure, will amend for this:
> 
>>>
>>> +int __init remove_shm_from_rangeset(const struct kernel_info *kinfo,
>>> +                                    struct rangeset *rangeset)
>>> +{
>>> +    const struct membanks *shm_mem = &kinfo->shm_mem.common;
>>> +    unsigned int i;
>>> +
>>> +    /* Remove static shared memory regions */
>>> +    for ( i = 0; i < shm_mem->nr_banks; i++ )
>>> +    {
>>> +        paddr_t start, end;
>>> +        int res;
>>> +
>>> +        start = shm_mem->bank[i].start;
>>> +        end = shm_mem->bank[i].start + shm_mem->bank[i].size - 1;
>> If you look at other rangeset_remove_range use cases and error messages, 1 
>> is subtracted
>> in PFN_DOWN() so that the error message contains end unchanged. Please 
>> adhere to that so that
>> printed messages are consistent.
> 
> Yes I will change it to have -1 inside PFN_DOWN(), here and in the other 
> occurrences
>>>
>>> +    /* Remove static shared memory regions */
>>> +    res = remove_shm_from_rangeset(kinfo, guest_holes);
>>> +    if ( res )
>>> +        goto out;
>>> +
>> Could you please add a comment explaining here what's done below?
> 
> Is it ok something like this:
I'm ok with your proposal in the other e-mail.

> 
> /*
>  * Take the interval of memory starting from the first extended region bank
>  * start address and ending to the end of the last extended region bank.
I would stop here. The rest reads quite difficult.

>  * The interval will be passed to rangeset_report_ranges to allow it to
>  * create, by the add_ext_regions callback, a set of extended memory region
>  * banks from the guest_holes rangeset, which contains the original extended
>  * memory region ranges where the static shared memory ranges are carved
>  * out.
>  */
> 
>>> +    i = ext_regions->nr_banks - 1;
>>> +    start = ext_regions->bank[0].start;
>>> +    end = ext_regions->bank[i].start + ext_regions->bank[i].size - 1;
>>> +
>>> +    /* Reset original extended regions to hold new value */
>>> +    ext_regions->nr_banks = 0;
>>> +    res = rangeset_report_ranges(guest_holes, PFN_DOWN(start), 
>>> PFN_DOWN(end),
>>> +                                 add_ext_regions, ext_regions);
>>> +    if ( res )
>>> +        ext_regions->nr_banks = 0;
>>> +    else if ( !ext_regions->nr_banks )
>>> +        res = -ENOENT;
>>> +
>>> + out:
>>> +    rangeset_destroy(guest_holes);
>>> +
>>> +    return res;
>>> +}
>>> +
>>> /*
>>>  * Local variables:
>>>  * mode: C
>>> --
>>> 2.34.1
>>>
>>
>> ~Michal
>>
> 
> Cheers,
> Luca

~Michal



 


Rackspace

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