[libvirt] [PATCH 1/2] qemu: support for kvm-hint-dedicated performance hint

Menno Lageman menno.lageman at oracle.com
Mon Aug 12 11:53:14 UTC 2019


On 12-08-19 13:39, Michal Privoznik wrote:
> On 8/12/19 1:18 PM, Menno Lageman wrote:
>> On 12-08-19 11:23, Michal Privoznik wrote:
>>> On 8/9/19 5:19 PM, Menno Lageman wrote:
>>>> From: Wim ten Have <wim.ten.have at oracle.com>
>>>>
>>>> QEMU version 2.12.1 introduced a performance feature under commit
>>>> be7773268d98 ("target-i386: add KVM_HINTS_DEDICATED performance hint")
>>>>
>>>> This patch adds a new KVM feature 'hint-dedicated' to set this 
>>>> performance
>>>> hint for KVM guests. The feature is off by default.
>>>>
>>>> To enable this hint and have libvirt add "-cpu 
>>>> host,kvm-hint-dedicated=on"
>>>> to the QEMU command line, the following XML code needs to be added 
>>>> to the
>>>> guest's domain description in conjunction with CPU 
>>>> mode='host-passthrough'.
>>>>
>>>>     <features>
>>>>       <kvm>
>>>>         <hint-dedicated state='on'/>
>>>>       </kvm>
>>>>     </features>
>>>>     ...
>>>>     <cpu mode='host-passthrough ... />
>>>>
>>>> Signed-off-by: Wim ten Have <wim.ten.have at oracle.com>
>>>> Signed-off-by: Menno Lageman <menno.lageman at oracle.com>
>>>> ---
>>>>    docs/formatdomain.html.in     |  7 +++++++
>>>>    docs/schemas/domaincommon.rng |  5 +++++
>>>>    src/conf/domain_conf.c        |  4 ++++
>>>>    src/conf/domain_conf.h        |  1 +
>>>>    src/qemu/qemu_command.c       | 13 +++++++++++++
>>>>    5 files changed, 30 insertions(+)
>>>>
>>>> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
>>>> index 6d084d7c0472..c9b18b57e1fc 100644
>>>> --- a/docs/formatdomain.html.in
>>>> +++ b/docs/formatdomain.html.in
>>>> @@ -2044,6 +2044,7 @@
>>>>      </hyperv>
>>>>      <kvm>
>>>>        <hidden state='on'/>
>>>> +    <hint-dedicated state='on'/>
>>>>      </kvm>
>>>>      <pvspinlock state='on'/>
>>>>      <gic version='2'/>
>>>> @@ -2217,6 +2218,12 @@
>>>>              <td>on, off</td>
>>>>              <td><span class="since">1.2.8 (QEMU 2.1.0)</span></td>
>>>>            </tr>
>>>> +        <tr>
>>>> +          <td>hint-dedicated</td>
>>>> +          <td>Set the "dedicated physical CPU" performance hint 
>>>> ("-cpu kvm-hint-dedicated=on")</td>
>>>
>>> I'd rather not document the command line libvirt generates here. Not 
>>> only it's an internal thing of libvirt, it'd also be a promise we 
>>> might not keep up (if qemu changes way how this is configured for 
>>> instance).
>>> But what we should document is what this feature actually is. I've 
>>> tried to dig out KVM patches and now I have a faint idea, but we 
>>> can't expect our users to go through patches when deciding whether to 
>>> turn this on or not.
>>
>> How about replacing it with "Allows a guest to enable optimizations 
>> when running on dedicated vCPU" ?
> 
> What do you mean by 'dedicated vCPU'? So far I only know dedicated 
> physical CPU (or CPU core) - and that's not easy to set up, you'll need 
> numa pinning, cpu pinning, isolcpus, and whatnot. Also, what 
> opimizations does it enable?

I tried to extract the essence of the QEMU commit message ("Add 
KVM_HINTS_DEDICATED performance hint, guest checks this feature bit to 
determine if they run on dedicated vCPUs, allowing optimizations such as 
usage of qspinlocks.") without adding too much detail about exactly what 
optimizations are available since it is the guest that does (or does 
not) enable these optimizations.

Menno

> 
> I'm not saying we need to put everything in the docs, but also I don't 
> want the docs to be undestandable by developers who developed given 
> feature.
> 
> Michal
> 
> -- 
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list