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

Re: [Xen-devel] [PATCH V4 4/4] x86/mm: Make use of the default access param from xc_altp2m_create_view


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
  • From: Alexandru Stefan ISAILA <aisaila@xxxxxxxxxxxxxxx>
  • Date: Wed, 18 Dec 2019 11:53:12 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bitdefender.com; dmarc=pass action=none header.from=bitdefender.com; dkim=pass header.d=bitdefender.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-SenderADCheck; bh=zYTM7pWaCgIlbv64N217tfhaoO/2WodO9NAYRGMXJwI=; b=n1zkyGYt3JZV8QzIhzxqhbrN0e/stFxXpsXU/+9XJxKFX6z6sQUjhTMTPEbZ94uOiv2pKp/5T+L5QMuE/szHToAz1ZsyHqkfjx0vzyX+1BhR+FNP5eoDo5Bp6jb1+g7PuFBhNas/jWRzJyPjbkZJ/zJP5lpI9NTvIsGH7JOcm6snTOChGrvcNDiSYOrpVMcs/farcxoE/imoxwdg/yTFHGFSHUJ7sHY5mrno7mXdv8d0Ksx9E6cIlg+ql6M8P/uPNvf4az7eKKW2HNrJD9oi/CTTHD2Pz4zWS8WiG6nQY5BmZvlcSt38L79JgOdFFOIo4WlWItpqbbkCUBK6fY75lQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jJbn5LePU8hsw5ERcySgxcRUXJmT43ljPI/uYiMwV8DSA+W1GUj1h5v4LX476xqq3MleZJaZZ5DRF2yYO3Vme3j7toMQzEM/g1ioCi0JKIz2S714lYPiIsxc8Ny4Gcug0JZ4ZwBeoM8UpD3Pv1qG6TyiKv3jMmcE9ZP7y5ivLc25QTjFDdqsj0SA6/9bbXFDP9YFxqu4WiJVgu8KyjU0dwVQYdLNtJD4DjYQEwBsZJi3bqKlYvhzHNoGULgHzqyuiubzx76vwo50qG+NW2g9/ksuJMZEroyMLZNG5/9kcINrEU4odAH5BQG/VuXFO5xd0uD9ZmsOnz10DOxgMMOAWw==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisaila@xxxxxxxxxxxxxxx;
  • Cc: Petre Ovidiu PIRCALABU <ppircalabu@xxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Razvan COJOCARU <rcojocaru@xxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 18 Dec 2019 11:53:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVtOxtPhIY/fNOfU26Nr2n4YFnQqe/tqeAgAAS8YA=
  • Thread-topic: [PATCH V4 4/4] x86/mm: Make use of the default access param from xc_altp2m_create_view


On 18.12.2019 12:45, Jan Beulich wrote:
> On 17.12.2019 16:12, Alexandru Stefan ISAILA wrote:
>> --- a/xen/arch/x86/mm/mem_access.c
>> +++ b/xen/arch/x86/mm/mem_access.c
>> @@ -314,9 +314,9 @@ static int set_mem_access(struct domain *d, struct 
>> p2m_domain *p2m,
>>       return rc;
>>   }
>>   
>> -static bool xenmem_access_to_p2m_access(struct p2m_domain *p2m,
>> -                                        xenmem_access_t xaccess,
>> -                                        p2m_access_t *paccess)
>> +bool xenmem_access_to_p2m_access(struct p2m_domain *p2m,
>> +                                 xenmem_access_t xaccess,
>> +                                 p2m_access_t *paccess)
> 
> Would you mind taking the opportunity and add const to the first
> parameter?

Sure, given that there will be a new version, it will add it.

> 
>> @@ -2601,7 +2610,15 @@ int p2m_init_next_altp2m(struct domain *d, uint16_t 
>> *idx)
>>           if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) )
>>               continue;
>>   
>> -        rc = p2m_activate_altp2m(d, i);
>> +        p2m = d->arch.altp2m_p2m[i];
>> +
>> +        if ( !xenmem_access_to_p2m_access(p2m, hvmmem_default_access, &a) )
>> +        {
>> +            altp2m_list_unlock(d);
>> +            return -EINVAL;
>> +        }
> 
> Can this be pulled out of the locked region, ahead of the loop?
> The p2m getting passed in here (which is why it's in the loop)
> shouldn't have been in use yet, i.e. its ->default_access should
> have a known value. Hence this case could be taken care of
> independently, e.g. by adjusting xenmem_access_to_p2m_access()
> to cope with a NULL p2m coming in (producing whatever the default
> of the default is).
> 

Yes this sounds good. In xenmem_access_to_p2m_access() there can be a 
check like:

if ( !p2m )
     *paccess = p2m_access_rwx;
else
     *paccess = p2m->default_access;

But before I change this maybe Tamas or George have something to add?
And can this stay in the same patch or should it have a prereq one?

Alex
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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