All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 2/3] KVM: x86: KVM_HC_RT_PRIO hypercall (host-side)
Date: Fri, 22 Sep 2017 09:23:47 +0200	[thread overview]
Message-ID: <29aadd63-ddfe-0ddc-2d71-8c0391db0ba4@redhat.com> (raw)
In-Reply-To: <20170922010811.GA20133@amt.cnet>

On 22/09/2017 03:08, Marcelo Tosatti wrote:
> On Thu, Sep 21, 2017 at 03:49:33PM +0200, Paolo Bonzini wrote:
>> On 21/09/2017 15:32, Konrad Rzeszutek Wilk wrote:
>>> So the guest can change the scheduling decisions at the host level?
>>> And the host HAS to follow it? There is no policy override for the
>>> host to say - nah, not going to do it?
> 
> In that case the host should not even configure the guest with this
> option (this is QEMU's 'enable-rt-fifo-hc' option).
> 
>>> Also wouldn't the guest want to always be at SCHED_FIFO? [I am thinking
>>> of a guest admin who wants all the CPU resources he can get]
> 
> No. Because in the following code, executed by the housekeeping vCPU
> running at constant SCHED_FIFO priority:
> 
> 	1. Start disk I/O.
> 	2. busy spin
> 
> With the emulator thread sharing the same pCPU with the housekeeping
> vCPU, the emulator thread (which runs at SCHED_NORMAL), will never
> be scheduled in in place of the vcpu thread at SCHED_FIFO.
> 
> This causes a hang.

But if the emulator thread can interrupt the housekeeping thread, the
emulator thread should also be SCHED_FIFO at higher priority; IIRC this
was in Jan's talk from a few years ago.

QEMU would also have to use PI mutexes (which is the main reason why
it's using QemuMutex instead of e.g. GMutex).

>> Yeah, I do not understand why there should be a housekeeping VCPU that
>> is running at SCHED_NORMAL.  If it hurts, don't do it...
> 
> Hope explanation above makes sense (in fact, it was you who pointed 
> out SCHED_FIFO should not be constant on the housekeeping vCPU,
> when sharing pCPU with emulator thread at SCHED_NORMAL).

The two are not exclusive... As you point out, it depends on the
workload.  For DPDK you can put both of them at SCHED_NORMAL.  For
kernel-intensive uses you must use SCHED_FIFO.

Perhaps we could consider running these threads at SCHED_RR instead.
Unlike SCHED_NORMAL, I am not against a hypercall that bumps temporarily
SCHED_RR to SCHED_FIFO, but perhaps that's not even necessary.

Paolo

  reply	other threads:[~2017-09-22  7:23 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21 11:38 [patch 0/3] KVM KVM_HC_RT_PRIO hypercall support Marcelo Tosatti
2017-09-21 11:38 ` [patch 1/3] KVM: x86: add per-vcpu option to set guest vcpu -RT priority Marcelo Tosatti
2017-09-21 11:38 ` [patch 2/3] KVM: x86: KVM_HC_RT_PRIO hypercall (host-side) Marcelo Tosatti
2017-09-21 13:32   ` Konrad Rzeszutek Wilk
2017-09-21 13:49     ` Paolo Bonzini
2017-09-22  1:08       ` Marcelo Tosatti
2017-09-22  7:23         ` Paolo Bonzini [this message]
2017-09-22 12:24           ` Marcelo Tosatti
2017-09-21 11:38 ` [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall Marcelo Tosatti
2017-09-21 13:36   ` Konrad Rzeszutek Wilk
2017-09-21 14:06     ` Peter Zijlstra
2017-09-22  1:10       ` Marcelo Tosatti
2017-09-22 10:00         ` Peter Zijlstra
2017-09-22 10:56           ` Peter Zijlstra
2017-09-22 12:33             ` Marcelo Tosatti
2017-09-22 12:55               ` Peter Zijlstra
2017-09-23 10:56                 ` Paolo Bonzini
2017-09-23 13:41                   ` Peter Zijlstra
2017-09-24 13:05                     ` Paolo Bonzini
2017-09-25  2:57                       ` Marcelo Tosatti
2017-09-25  9:13                         ` Peter Zijlstra
2017-09-25 15:12                           ` Paolo Bonzini
2017-09-26 22:49                             ` [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\ Marcelo Tosatti
2017-09-27  9:37                               ` Paolo Bonzini
2017-09-28  0:44                                 ` Marcelo Tosatti
2017-09-28  7:22                                   ` Paolo Bonzini
2017-09-28 21:35                                     ` Marcelo Tosatti
2017-09-28 21:41                                       ` Marcelo Tosatti
2017-09-29  8:18                                       ` Paolo Bonzini
2017-09-29 16:40                                         ` Marcelo Tosatti
2017-09-29 17:05                                           ` Paolo Bonzini
2017-09-29 20:17                                             ` Marcelo Tosatti
2017-10-02 12:30                                               ` Paolo Bonzini
2017-10-02 12:48                                                 ` Peter Zijlstra
2017-09-26 23:22                           ` [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall Marcelo Tosatti
2017-09-25 16:20                         ` Konrad Rzeszutek Wilk
2017-09-22 12:16           ` Marcelo Tosatti
2017-09-22 12:31             ` Peter Zijlstra
2017-09-22 12:36               ` Marcelo Tosatti
2017-09-22 12:59                 ` Peter Zijlstra
2017-09-25  1:52                   ` Marcelo Tosatti
2017-09-25  8:35                     ` Peter Zijlstra
2017-09-22 12:40               ` [patch 3/3] x86: kvm guest side support for KVM_HC_RT_PRIO hypercall\ Marcelo Tosatti
2017-09-22 13:01                 ` Peter Zijlstra
2017-09-25  2:22                   ` Marcelo Tosatti
2017-09-25  8:58                     ` Peter Zijlstra
2017-09-25 10:41                     ` Thomas Gleixner
2017-09-25 18:28                       ` Jan Kiszka
2017-09-21 17:45 ` [patch 0/3] KVM KVM_HC_RT_PRIO hypercall support Jan Kiszka
2017-09-22  1:19   ` Marcelo Tosatti
2017-09-22  6:23     ` Jan Kiszka
2017-09-26 23:59       ` Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29aadd63-ddfe-0ddc-2d71-8c0391db0ba4@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.