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

Re: [Xen-devel] [PATCH V4 2/4] x86/altp2m: Add hypercall to set a range of sve bits


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Alexandru Stefan ISAILA <aisaila@xxxxxxxxxxxxxxx>
  • Date: Wed, 18 Dec 2019 10:32:39 +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=umwB5DZ0dJQG9qJhr3szH6fUjGWH7S+QpiIke9K+Ag4=; b=MQV8pjRNLiLLCsEWAddQLE8tQUh2LCTZMQzTJsx3HOILYI8hh4bgKSJI7tAspUFqNrlntVKCHOERMyw5O8Se1N/p7jIvXb/4Xcrj9Y2uwchSrtwSmpjoHwHKqQOceQKxu5TafDig8V3qGztwJhwfGYM2dYVSdakUR5U2Fr95RQ53HgLv1uHDxjAKgcFtQNGJqyGyBWRFurLlllbZSLP6sNyCL9UtnIyKc1MfZY0noJVKDNZOaO6+pL/dV45s/f+eO6zvo3an0v6VGpQgt12oCpl7c338G9eUjUu9HNnNeVKUK5h1bmjvj0Kj7cSCoae5DnMUqcm0+Ql55j6ngHu+4A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S0Cmwigcb4x5JMF0SPg047zE7m9pRicEYN1VI6VDq3BR4IPa/zQiowu+9x4pIYAZvY9m7jv/gmKO6LZ/Hj0xgtsOUr7HxDkNF7V+4M/621z6C2rPIQJ+gw48IjRfKYX0SA3M+Z3sLJteeEqX+vWLCpUfTk0notC3CY+N6doufmS6cnXbzD3VpO7Oy9g//5uZPsOBoyommuziZ1rIGA5MAhRrLDRG90Ne5HQmDt4StH5GIVl3ddRpNQ+f3++Dq0g+nu3of12NYhVU6LaymFLtyFuGq8Z4xMSgW5swu1PzgeNoNXd8t6Og9zDOPVKc3qPXSq/7Utchr6H75nd9CdfmCA==
  • 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>, Wei Liu <wl@xxxxxxx>, Razvan COJOCARU <rcojocaru@xxxxxxxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 18 Dec 2019 10:32:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVtOxnMZNvtoiQIE62yqEH5VgLvKe+jS4AgAD/GYCAACpOAP//+JmAgAAD54A=
  • Thread-topic: [Xen-devel] [PATCH V4 2/4] x86/altp2m: Add hypercall to set a range of sve bits


On 18.12.2019 12:18, Jan Beulich wrote:
> On 18.12.2019 09:45, Alexandru Stefan ISAILA wrote:
>>
>>
>> On 18.12.2019 10:13, Alexandru Stefan ISAILA wrote:
>>>
>>>>> +/*
>>>>> + * Set/clear the #VE suppress bit for multiple pages.  Only available on 
>>>>> VMX.
>>>>> + */
>>>>> +int p2m_set_suppress_ve_multi(struct domain *d,
>>>>> +                              struct xen_hvm_altp2m_suppress_ve_multi 
>>>>> *sve)
>>>>> +{
>>>>> +    struct p2m_domain *host_p2m = p2m_get_hostp2m(d);
>>>>> +    struct p2m_domain *ap2m = NULL;
>>>>> +    struct p2m_domain *p2m = host_p2m;
>>>>> +    uint64_t start = sve->first_gfn;
>>>>> +    int rc = 0;
>>>>> +    uint64_t max_phys_addr = (1UL << d->arch.cpuid->extd.maxphysaddr) - 
>>>>> 1;
>>>>> +
>>>>> +    if ( sve->view > 0 )
>>>>> +    {
>>>>> +        if ( sve->view >= MAX_ALTP2M ||
>>>>> +             d->arch.altp2m_eptp[array_index_nospec(sve->view, 
>>>>> MAX_EPTP)] ==
>>>>> +             mfn_x(INVALID_MFN) )
>>>>> +            return -EINVAL;
>>>>> +
>>>>> +        p2m = ap2m = d->arch.altp2m_p2m[array_index_nospec(sve->view,
>>>>> +                                                           MAX_ALTP2M)];
>>>>> +    }
>>>>> +
>>>>> +    p2m_lock(host_p2m);
>>>>> +
>>>>> +    if ( ap2m )
>>>>> +        p2m_lock(ap2m);
>>>>> +
>>>>> +    while ( sve->last_gfn >= start && start < max_phys_addr )
>>>>
>>>> Why don't you clip ->last_gfn ahead of the loop, saving one
>>>> comparison per iteration?
>>>
>>> I've done this so it will have fewer lines but sure, I can have the
>>> ->last_gfn check before the loop.
>>
>> Wouldn't there be a issue if start goes over ->last_gfn and there is no
>> break for preemption? Then the loop will run until max_phys_addr.
> 
> I'm not sure I understand. My guess is a misunderstanding - I'm
> asking to replace the right side of the &&, and it looks you
> understood me to mean the least side. Note how I said "clip" in
> my earlier reply, meaning you to update ->last_gfn ahead of the
> loop if it's above (1UL << d->arch.cpuid->extd.maxphysaddr) - 1.
> Perhaps this could even be done in the caller together with (and
> possibly ahead of) the other sanity checking of incoming values.
> 

Then I could have  "sve->last_gfn = min(sve->last_gfn, max_phys_addr)"
and then drop the "start < max_phys_addr" check from the while loop.

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®.