public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Christoffer Dall <cdall@linaro.org>
Cc: "Christoffer Dall" <christoffer.dall@linaro.org>,
	kvm@vger.kernel.org, "Andrew Jones" <drjones@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Marc Zyngier" <marc.zyngier@arm.com>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org,
	"James Hogan" <jhogan@kernel.org>,
	linux-mips@linux-mips.org, "Alexander Graf" <agraf@suse.com>,
	kvm-ppc@vger.kernel.org,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	linux-s390@vger.kernel.org
Subject: Re: [RFC PATCH] KVM: Only register preempt notifiers and load arch cpu state as needed
Date: Thu, 23 Nov 2017 19:16:32 +0100	[thread overview]
Message-ID: <acf7f751-d73d-8e16-fe9b-2f1f0e1f5e8d@redhat.com> (raw)
In-Reply-To: <20171123174804.GB28855@cbox>

On 23/11/2017 18:48, Christoffer Dall wrote:
>>> That doesn't solve my need as I want to *only* do the arch vcpu_load for
>>> KVM_RUN, I should have been more clear in the commit message.
>>
>> That's what you want to do, but it might not be what you need to do.
> 
> Well, why would we want to do a lot of work when there's absolutely no
> need to?
> 
> I see that this patch is invasive, and that's why I originally proposed
> the other approach of recording the ioctl number.

Because we need to balance performance and maintainability.  The
following observation is the important one:

> While it may be possible to call kvm_arch_vcpu_load() for a number of
> non-KVM_RUN ioctls, it makes the KVM/ARM code more difficult to reason
> about, especially after my optimization series, because a lot of things
> can now happen, where we have to consider if we're really in the process
> of running a vcpu or not.

... because outside ARM I couldn't see any maintainability drawback.
Now I understand (or at least, I understand enough to believe you!).

The idea of this patch then is okay, but:

* x86 can use __vcpu_load/__vcpu_put, because the calls outside the lock
are all in the destruction path where no one can concurrently take the
lock.  So the lock+load and put+unlock variants are not necessary.

* Just make a huge series that, one ioctl at a time, pushes down the
load/put to the arch-specific functions.  No need to figure out where
it's actually needed, or at least you can leave it to the architecture
maintainers.

Thanks,

Paolo

  reply	other threads:[~2017-11-23 18:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 16:05 [RFC PATCH] KVM: Only register preempt notifiers and load arch cpu state as needed Christoffer Dall
2017-11-23 16:17 ` Paolo Bonzini
2017-11-23 17:06   ` Christoffer Dall
2017-11-23 17:12     ` Paolo Bonzini
2017-11-23 17:48       ` Christoffer Dall
2017-11-23 18:16         ` Paolo Bonzini [this message]
2017-11-23 18:32           ` Christoffer Dall
2017-11-23 18:43             ` Paolo Bonzini
2017-11-23 18:05     ` Christian Borntraeger
2017-11-23 18:32       ` Christoffer Dall

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=acf7f751-d73d-8e16-fe9b-2f1f0e1f5e8d@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cdall@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=cohuck@redhat.com \
    --cc=drjones@redhat.com \
    --cc=jhogan@kernel.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=rkrcmar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox