Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1587904 > unrolled thread
| Started by | Radim Krčmář <rkrcmar@redhat.com> |
|---|---|
| First post | 2017-02-24 21:00 +0100 |
| Last post | 2017-02-27 11:10 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2 0/5] KVM: rename and encapsulate vcpu->requests API Radim Krčmář <rkrcmar@redhat.com> - 2017-02-24 21:00 +0100
[PATCH v2 3/5] KVM: add kvm_request_pending Radim Krčmář <rkrcmar@redhat.com> - 2017-02-24 21:00 +0100
Re: [PATCH v2 3/5] KVM: add kvm_request_pending David Hildenbrand <david@redhat.com> - 2017-02-27 11:10 +0100
Re: [PATCH v2 0/5] KVM: rename and encapsulate vcpu->requests API Andrew Jones <drjones@redhat.com> - 2017-02-27 10:20 +0100
Re: [PATCH v2 1/5] KVM: rename API for requests to match bit operations David Hildenbrand <david@redhat.com> - 2017-02-27 11:10 +0100
| From | Radim Krčmář <rkrcmar@redhat.com> |
|---|---|
| Date | 2017-02-24 21:00 +0100 |
| Subject | [PATCH v2 0/5] KVM: rename and encapsulate vcpu->requests API |
| Message-ID | <teuc1-4Ze-5@gated-at.bofh.it> |
v1: http://www.spinics.net/lists/kvm/msg145145.html Discussions around v1 were mostly concerned with various requirements for guest kicks and synchronization. Here is the mostly undisputed core. I think these patches are worthwhile even alone. v2: * removed the memory barrier optimization (Paolo) * added a MIPS cleanup, [4/5] Radim Krčmář (5): KVM: rename API for requests to match bit operations KVM: add KVM request variants without barrier KVM: add kvm_request_pending KVM: MIPS: remove useless kvm_request_clear KVM: optimize kvm_make_all_cpus_request arch/mips/kvm/emulate.c | 3 +- arch/mips/kvm/trap_emul.c | 4 +- arch/powerpc/kvm/book3s_pr.c | 4 +- arch/powerpc/kvm/book3s_pr_papr.c | 2 +- arch/powerpc/kvm/booke.c | 22 +++--- arch/powerpc/kvm/powerpc.c | 8 +-- arch/s390/kvm/kvm-s390.c | 26 +++---- arch/s390/kvm/kvm-s390.h | 4 +- arch/s390/kvm/priv.c | 4 +- arch/x86/kvm/hyperv.c | 14 ++-- arch/x86/kvm/i8259.c | 2 +- arch/x86/kvm/lapic.c | 22 +++--- arch/x86/kvm/mmu.c | 14 ++-- arch/x86/kvm/pmu.c | 6 +- arch/x86/kvm/svm.c | 12 ++-- arch/x86/kvm/vmx.c | 32 ++++----- arch/x86/kvm/x86.c | 144 +++++++++++++++++++------------------- include/linux/kvm_host.h | 64 ++++++++++++++--- virt/kvm/kvm_main.c | 8 ++- 19 files changed, 220 insertions(+), 175 deletions(-) -- 2.11.1
[toc] | [next] | [standalone]
| From | Radim Krčmář <rkrcmar@redhat.com> |
|---|---|
| Date | 2017-02-24 21:00 +0100 |
| Subject | [PATCH v2 3/5] KVM: add kvm_request_pending |
| Message-ID | <teuc2-4Ze-11@gated-at.bofh.it> |
| In reply to | #1587904 |
Just to complete the encapsulation.
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
v2: add READ_ONCE [Drew]
---
arch/mips/kvm/trap_emul.c | 2 +-
arch/powerpc/kvm/booke.c | 2 +-
arch/powerpc/kvm/powerpc.c | 4 ++--
arch/s390/kvm/kvm-s390.c | 2 +-
arch/x86/kvm/x86.c | 4 ++--
include/linux/kvm_host.h | 6 +++++-
6 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/mips/kvm/trap_emul.c b/arch/mips/kvm/trap_emul.c
index 35068823cde6..59e121343170 100644
--- a/arch/mips/kvm/trap_emul.c
+++ b/arch/mips/kvm/trap_emul.c
@@ -1029,7 +1029,7 @@ static void kvm_trap_emul_check_requests(struct kvm_vcpu *vcpu, int cpu,
struct mm_struct *mm;
int i;
- if (likely(!vcpu->requests))
+ if (likely(!kvm_request_pending(vcpu)))
return;
if (kvm_request_test_and_clear(KVM_REQ_TLB_FLUSH, vcpu)) {
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index e9098af0ab2a..54d2d1cca514 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -682,7 +682,7 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
kvmppc_core_check_exceptions(vcpu);
- if (vcpu->requests) {
+ if (kvm_request_pending(vcpu)) {
/* Exception delivery raised request; start over */
return 1;
}
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 2bcc03548c03..8a2ac7a24dd9 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -52,7 +52,7 @@ EXPORT_SYMBOL_GPL(kvmppc_pr_ops);
int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
{
return !!(v->arch.pending_exceptions) ||
- v->requests;
+ kvm_request_pending(v);
}
int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
@@ -104,7 +104,7 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
*/
smp_mb();
- if (vcpu->requests) {
+ if (kvm_request_pending(vcpu)) {
/* Make sure we process requests preemptable */
local_irq_enable();
trace_kvm_check_requests(vcpu);
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index b10acac8facf..089ca2c90d3e 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2394,7 +2394,7 @@ static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
{
retry:
kvm_s390_vcpu_request_handled(vcpu);
- if (!vcpu->requests)
+ if (!kvm_request_pending(vcpu))
return 0;
/*
* We use MMU_RELOAD just to re-arm the ipte notifier for the
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 16493795ab21..16ec68a0e972 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6724,7 +6724,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
bool req_immediate_exit = false;
- if (vcpu->requests) {
+ if (kvm_request_pending(vcpu)) {
if (kvm_request_test_and_clear(KVM_REQ_MMU_RELOAD, vcpu))
kvm_mmu_unload(vcpu);
if (kvm_request_test_and_clear(KVM_REQ_MIGRATE_TIMER, vcpu))
@@ -6888,7 +6888,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
kvm_x86_ops->sync_pir_to_irr(vcpu);
}
- if (vcpu->mode == EXITING_GUEST_MODE || vcpu->requests
+ if (vcpu->mode == EXITING_GUEST_MODE || kvm_request_pending(vcpu)
|| need_resched() || signal_pending(current)) {
vcpu->mode = OUTSIDE_GUEST_MODE;
smp_wmb();
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 6d637dbbb82f..f6c1f2267eb2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -1098,13 +1098,17 @@ static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
* 3) remote request with data (= kick + mb)
*
* TODO:
- * - completely encapsulate vcpu->requests
* - do not use __kvm_request* outside request helpers
* - do not use memory barrier in (1) and (2)
* - let architectures define custom vcpu kick
* - add kick when setting remote request
*/
+static inline bool kvm_request_pending(struct kvm_vcpu *vcpu)
+{
+ return READ_ONCE(vcpu->requests);
+}
+
static inline void __kvm_request_set(unsigned req, struct kvm_vcpu *vcpu)
{
set_bit(req, &vcpu->requests);
--
2.11.1
[toc] | [prev] | [next] | [standalone]
| From | David Hildenbrand <david@redhat.com> |
|---|---|
| Date | 2017-02-27 11:10 +0100 |
| Subject | Re: [PATCH v2 3/5] KVM: add kvm_request_pending |
| Message-ID | <tfqpH-45z-3@gated-at.bofh.it> |
| In reply to | #1587907 |
Am 24.02.2017 um 20:50 schrieb Radim Krčmář: > Just to complete the encapsulation. > > Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> > --- > v2: add READ_ONCE [Drew] > --- > arch/mips/kvm/trap_emul.c | 2 +- > arch/powerpc/kvm/booke.c | 2 +- > arch/powerpc/kvm/powerpc.c | 4 ++-- > arch/s390/kvm/kvm-s390.c | 2 +- > arch/x86/kvm/x86.c | 4 ++-- > include/linux/kvm_host.h | 6 +++++- > 6 files changed, 12 insertions(+), 8 deletions(-) > Reviewed-by: David Hildenbrand <david@redhat.com> -- Thanks, David
[toc] | [prev] | [next] | [standalone]
| From | Andrew Jones <drjones@redhat.com> |
|---|---|
| Date | 2017-02-27 10:20 +0100 |
| Message-ID | <tfpDj-3t3-7@gated-at.bofh.it> |
| In reply to | #1587904 |
On Fri, Feb 24, 2017 at 08:49:57PM +0100, Radim Krčmář wrote: > v1: http://www.spinics.net/lists/kvm/msg145145.html > > Discussions around v1 were mostly concerned with various requirements > for guest kicks and synchronization. > Here is the mostly undisputed core. I think these patches are > worthwhile even alone. > > v2: > * removed the memory barrier optimization (Paolo) > * added a MIPS cleanup, [4/5] > > > Radim Krčmář (5): > KVM: rename API for requests to match bit operations > KVM: add KVM request variants without barrier > KVM: add kvm_request_pending > KVM: MIPS: remove useless kvm_request_clear > KVM: optimize kvm_make_all_cpus_request For the series Reviewed-by: Andrew Jones <drjones@redhat.com> > > arch/mips/kvm/emulate.c | 3 +- > arch/mips/kvm/trap_emul.c | 4 +- > arch/powerpc/kvm/book3s_pr.c | 4 +- > arch/powerpc/kvm/book3s_pr_papr.c | 2 +- > arch/powerpc/kvm/booke.c | 22 +++--- > arch/powerpc/kvm/powerpc.c | 8 +-- > arch/s390/kvm/kvm-s390.c | 26 +++---- > arch/s390/kvm/kvm-s390.h | 4 +- > arch/s390/kvm/priv.c | 4 +- > arch/x86/kvm/hyperv.c | 14 ++-- > arch/x86/kvm/i8259.c | 2 +- > arch/x86/kvm/lapic.c | 22 +++--- > arch/x86/kvm/mmu.c | 14 ++-- > arch/x86/kvm/pmu.c | 6 +- > arch/x86/kvm/svm.c | 12 ++-- > arch/x86/kvm/vmx.c | 32 ++++----- > arch/x86/kvm/x86.c | 144 +++++++++++++++++++------------------- > include/linux/kvm_host.h | 64 ++++++++++++++--- > virt/kvm/kvm_main.c | 8 ++- > 19 files changed, 220 insertions(+), 175 deletions(-) > > -- > 2.11.1 >
[toc] | [prev] | [next] | [standalone]
| From | David Hildenbrand <david@redhat.com> |
|---|---|
| Date | 2017-02-27 11:10 +0100 |
| Subject | Re: [PATCH v2 1/5] KVM: rename API for requests to match bit operations |
| Message-ID | <tfqpI-45z-41@gated-at.bofh.it> |
| In reply to | #1587904 |
Am 24.02.2017 um 20:49 schrieb Radim Krčmář: > kvm_make_request was a wrapper that added barriers to set_bit and > kvm_check_request did the same for test_bit and check_bit, but the name > was not very obvious. > > The renaming: > kvm_request_set <- kvm_make_request > kvm_request_test_and_clear <- kvm_check_request > What about kvm_req_set() / kvm_req_test_and_clear() Matches the request bit definitions (KVM_REQ_*) and saves a couple of characters. Anyhow Reviewed-by: David Hildenbrand <david@redhat.com> -- Thanks, David
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web