[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200724001736.GK21891@linux.intel.com>
Date: Thu, 23 Jul 2020 17:17:36 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
linux-arch@...r.kernel.org, Will Deacon <will@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Mark Rutland <mark.rutland@....com>,
Kees Cook <keescook@...omium.org>,
Keno Fischer <keno@...iacomputing.com>,
Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
Gabriel Krisman Bertazi <krisman@...labora.com>
Subject: Re: [patch V5 15/15] x86/kvm: Use generic xfer to guest work function
On Thu, Jul 23, 2020 at 12:00:09AM +0200, Thomas Gleixner wrote:
> From: Thomas Gleixner <tglx@...utronix.de>
>
> Use the generic infrastructure to check for and handle pending work before
> transitioning into guest mode.
>
> This now handles TIF_NOTIFY_RESUME as well which was ignored so
> far. Handling it is important as this covers task work and task work will
> be used to offload the heavy lifting of POSIX CPU timers to thread context.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> ---
> V5: Rename exit -> xfer
> ---
One nit/question below (though it's really about patch 5).
Reviewed-and-tested-by: Sean Christopherson <sean.j.christopherson@...el.com>
> @@ -8676,15 +8677,11 @@ static int vcpu_run(struct kvm_vcpu *vcp
> break;
> }
>
> - if (signal_pending(current)) {
> - r = -EINTR;
> - vcpu->run->exit_reason = KVM_EXIT_INTR;
> - ++vcpu->stat.signal_exits;
> - break;
> - }
> - if (need_resched()) {
> + if (xfer_to_guest_mode_work_pending()) {
> srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
> - cond_resched();
> + r = xfer_to_guest_mode(vcpu);
Any reason not to call this xfer_to_guest_mode_work()? Or handle_work(),
do_work(), etc... Without the "work" part, it looks like a function that
should be invoked unconditionally. It's obvious that's not the case if
one looks at the implementation, but it's a bit confusing on the KVM side
of things.
> + if (r)
> + return r;
> vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
> }
> }
>
Powered by blists - more mailing lists