[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 08:45:10 +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=ouZP8K5quQPfBFpbZlxkI7Wc+T4OX2siRacGXK0sF50=; b=ZNjklKiXnbKzy5eFisDLw56qL0u85I3RyBSSXiqEZ/GkCMGzyJGuxjkuGGHfLPFLvI/cBJsEBEILA5qw8iccRQ9bD3DtK3dYXJRCxJbtdtRljzOZNZ68Rcr9EdA3ZeLS5CiehZKKMvQsXFmmTg6WueY/u7fht9/Yt38N5tPGXJbp3+l9JQLL1JtUV3K2+QATEqlbLKn5T18maNuQqkYxGxgwvQk6xl1afM8Lfnyd/MTUHf4iUY9Feza/pxfSj+53KAhFL8HtJ+8wpLEQj8t/1JqOpV86sR6AdeM60aaMakQGTrP0tOUPA8BB29fvOiffrjo3GDW8g9bYhEkfjIhDzQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JeZ8p2TvyWM2LD6v7loRwApTMXy2MNG5OWmrwMBBQe957FE/F/hB4F3Sw5bX9jQQR9/4Y9LSrrH1cTwwuwIuj4HDFYQbK8yViHkmFNAT/tYXAV8SBJ1w1kje7lfqsNtpg7Dwun7o7s5boI84COJ7MbfLlN7vf+QtWCiAev3c74XjUSL1ml/nXiP5lH+LIgtrMuPXvCIFFj/wig03a1p95crOWjVwOFMHPSCWOQbivDY4gn8ooNiNjkPwsyInpYnPftv+Ce3Jqzg0iFP7OyoxWbnF9OAuHTEtzmi7aOeAug/ciVDzxOhRbfiG5wLzZq35o5Ug5hoPgDV8sBwmwNCMyA==
- 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 08:45:30 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHVtOxnMZNvtoiQIE62yqEH5VgLvKe+jS4AgAD/GYCAAAjHAA==
- Thread-topic: [Xen-devel] [PATCH V4 2/4] x86/altp2m: Add hypercall to set a range of sve bits
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.
Alex
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|