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

Re: [PATCH v2] xen/arm: p2m: Populate pages for GICv2 mapping in arch_domain_create()


  • To: Henry Wang <Henry.Wang@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 14 Oct 2022 12:59:38 +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=6iqmbL5oucMnsSVY5xfcBr49F+PoJ5RNN4o392i2tN0=; b=dpLUDSlPOsv8wVpyWeDMbuk5HxbtmQsv8bMuXrUJClKWfxsjDx7kuESd1x2Zz+VdYIxFXE+V98kCK5GLgjnA+/lOCNxobWcaj5plQGwqtSl/ITKPfRBim4zPuqt7gBbOqfhuUX7VABnoHzRacjRMI86Sq8DYNnYnZpU5aawkPG1k/hUTvGw/E35MMGvxo8Fwo++Vr8IhHbt5fQvYw+7SKxiJQK1+k9PoZ1e44N5/KB57Mht0q79U5Ryd40mFEIVUCuXpvShtW1YErF6PMDU8Kujz0hAqASKs1XhTeYoafQoamypvl4GsvHopZ/uclHX1RPpkckEVK9bPtjFqLWmVBA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gdwqBLsGR6z0unlWkQ2kiJX72FXwn6uJ8fkOqzYxCs9rgpvAzBdfkdzKCSwa/gRLeCUtUDuR8W6yrW0jxk7E0TURepjRh8W5BFzFClZTrsBckDkUYHqdgKtJHH7rctENVV2Rj0Nj/0vpYHwUStyIPrLR0tL6LddMxikWthhlB3VLs2mQphtsXwBK3x5TgGhgDSXNiKJG/ISG6kNkMAEIvF2vZJkIQiTVeNzfC2KEU2kveTR0xdD1GGpfIQY9GG+2NDLZ/yuQHZUOijGXKmOFI6L+u6Yx/89kbYAG/cv1USGigDGjcBABjHQKbYFj23Y3ipQn0oF4gKcAZn+JjbC+cw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Fri, 14 Oct 2022 10:59:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.10.2022 12:53, Henry Wang wrote:
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@xxxxxxxx>
>>
>> On 14.10.2022 12:38, Henry Wang wrote:
>>>> -----Original Message-----
>>>> From: Julien Grall <julien@xxxxxxx>
>>>>>>> +    if ( d->arch.paging.p2m_total_pages != 0 )
>>>>>>> +    {
>>>>>>> +        spin_lock(&d->arch.paging.lock);
>>>>>>> +        p2m_set_allocation(d, 0, NULL);
>>>>>>> +        spin_unlock(&d->arch.paging.lock);
>>>>>>> +        ASSERT(d->arch.paging.p2m_total_pages == 0);
>>>>>>> +    }
>>>>>>
>>>>>> Is it intentional to largely open-code p2m_teardown_allocation() here?
>>>>>
>>>>> Yes, AFAICT p2m_teardown_allocation() is preemptible and we don't
>> want
>>>>> any preemption here.
>>>>
>>>> Like Jan, I would prefer if we can avoid the duplication. The loop
>>>> suggested by Jan should work.
>>>
>>> I am a little bit worried about the -ENOMEM, if -ENOMEM is
>>> returned from p2m_teardown_allocation(d), I think we are in
>>> the infinite loop, or did I miss understood the loop that Jan referred
>>> to?
>>
>> Where would -ENOMEM come from? We're firmly freeing memory here. -
>> ENOMEM
>> can only occur for a non-zero 2nd argument.
> 
> My initial thought is the "else if" part in p2m_set_allocation. It might be
> wrong. Would the code below seems ok to you?
> 
> int err;
> 
> do {
>     err = p2m_teardown_allocation(d)
> } while ( err == -ERESTART )

Sure, one of several ways of doing it.

Jan



 


Rackspace

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