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

Re: [PATCH 12/12] xen/arm: add cache coloring support for Xen


  • To: Carlo Nonato <carlo.nonato@xxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 27 Sep 2022 17:28:51 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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=53kokOxlv3mhNzEXo4N2e7qjZ7GtvDibULuNMsr4bFs=; b=QRkQjqdFfDKiPcBEpKblWJVT2vWwlaKWvwGJQY3m19gkcYNxt5/Ef53qPG3rFAgY4FvKMGil7lNJ/G8NluGHN+xD0Y5sCnd6MNJEzM1M7ZI2u2fN9cFujvixVf5JuidR8PfmAqyx/FZ78McGXuAXn44VYdk1S7Hex+dRvLSTbJ206vYy9e8q+inDFr+WAHOPvIjeyePPyeoPuHY/itBazD3b3AXe5ywAZFJ8Td2XJc3CVe3GosbS4r+hpqZvZncKMJ9V1aQP5PWOfMRd2gNTMOnfO16lbaLLZ5i/kdk6yybXYUdUcSGbMqIWv0LsJ7hPjfEtbiJWr7be0GL0ouwMcw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UjjF/Iq7LreQgAwbyj9W8kTaVLzwqL6GWdmJfrfHSHmWEExqw3uYN5OGj5mTlOi7JyaWXtxl8qQzDKz3ZinlSpe6EyvonSb2Elok0PVhXXaBhGb8zpDSDRDMUwRnAAoOnsjt+FDwLJxsly6xzhsmCIqnnZMMXjkBsSDQWXGCEHf4sJCPWlJCYMp4A9U8V6SuJv93qEz2tEbFAXKcx17T0SVv7PyYeLKILmstX0rAHgzcN/oNh59kYdsp9wTFCHM0rtTbCbaRVkFCUBr+fl2ACF3mSJzAmKtzqLBIJgU9AyDKHQ3U6yxpitgklxeEQB7QnS6AmL4YUq8aJmm4xtLnjw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, julien@xxxxxxx, stefano.stabellini@xxxxxxx, wl@xxxxxxx, marco.solieri@xxxxxxxxxx, andrea.bastoni@xxxxxxxxxxxxxxx, lucmiccio@xxxxxxxxx, Marco Solieri <marco.solieri@xxxxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 27 Sep 2022 15:29:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.09.2022 16:31, Carlo Nonato wrote:
> On Mon, Sep 19, 2022 at 10:38 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>> On 16.09.2022 18:07, Carlo Nonato wrote:
>>> On Thu, Sep 15, 2022 at 3:25 PM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>>> On 26.08.2022 14:51, Carlo Nonato wrote:
>>>>> @@ -218,6 +221,28 @@ void *__vmap(const mfn_t *mfn, unsigned int 
>>>>> granularity,
>>>>>      return va;
>>>>>  }
>>>>>
>>>>> +#ifdef CONFIG_CACHE_COLORING
>>>>> +void * __vmap_colored(const mfn_t *mfn, unsigned int nr, unsigned int 
>>>>> align,
>>>>> +                      unsigned int flags, enum vmap_region type)
>>>>> +{
>>>>> +    void *va = vm_alloc(nr, align, type);
>>>>> +    unsigned long cur = (unsigned long)va;
>>>>> +    paddr_t pa = mfn_to_maddr(*mfn);
>>>>> +
>>>>> +    for ( ; va && nr-- ; cur += PAGE_SIZE )
>>>>> +    {
>>>>> +        pa = next_xen_colored(pa);
>>>>
>>>> This may alter the address, yet the caller expects that the original
>>>> address be mapped. I must be missing something?
>>>
>>> If the original address color is assigned to Xen, then next_xen_colored()
>>> simply returns that address. If this isn't the case, then you're right: the
>>> address changes to the correct, colored, one. The caller should expect
>>> this behavior since this is the colored version of vmap, the one that takes
>>> into account the Xen coloring configuration.
>>
>> That's (to me at least) very surprising behavior, and hence needs
>> properly calling out in a code comment at the least.
>>
>> Personally I'm not convinced of having a function with this behavior,
>> and instead I think the normal vmap() should do. As long as you're
>> only allowing for order-0 allocations, that shouldn't be an issue
>> anyway.
> 
> You mean creating an array of colored mfns (I mean with a colored machine
> address) and passing it to vmap()? Am I understanding you correctly?

Yes.

> This is the only way I can see to use the original vmap() and respect
> the coloring configuration at the same time. But isn't it a waste of time
> and space to create this array?

Well, that's the price to pay for non-contiguous vmap-s. If the added
function really is just an optimization, I guess this might be acceptable
if actually stated that way in the description. I intentionally say
"might", because I think there's too heavy an implications here (the
caller having done the allocation(s) in a way that matches the function's
behavior).

Jan



 


Rackspace

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