kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Reorganize request bits
@ 2016-01-07 14:17 Paolo Bonzini
  2016-01-07 14:17 ` [PATCH 1/4] KVM: Remove unused KVM_REQ_KICK to save a bit in Paolo Bonzini
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-01-07 14:17 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Takuya Yoshikawa, Christian Borntraeger, Paul Mackerras

There is no need for request bits to differ across architectures.  Only
a handful of them are architecture-independent, the others can all share
bits 8-31 with overlap.

Leaving room for more architecture-independent bits means that actually
no bits are freed, but the cleanup is useful anyway IMO.

Paolo Bonzini (4):
  KVM: Remove unused KVM_REQ_KICK to save a bit in
  KVM: document which architecture uses each request bit
  KVM: renumber architecture-dependent requests
  KVM: move architecture-dependent requests to arch/

 arch/powerpc/include/asm/kvm_host.h |  4 ++++
 arch/s390/include/asm/kvm_host.h    |  4 ++++
 arch/x86/include/asm/kvm_host.h     | 28 ++++++++++++++++++++++++++
 arch/x86/kvm/x86.c                  | 10 ++++++++++
 include/linux/kvm_host.h            | 39 +++++--------------------------------
 virt/kvm/kvm_main.c                 | 10 ----------
 6 files changed, 51 insertions(+), 44 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/4] KVM: Remove unused KVM_REQ_KICK to save a bit in
  2016-01-07 14:17 [PATCH 0/4] Reorganize request bits Paolo Bonzini
@ 2016-01-07 14:17 ` Paolo Bonzini
  2016-01-07 14:26   ` Christian Borntraeger
  2016-01-07 14:17 ` [PATCH 2/4] KVM: document which architecture uses each request bit Paolo Bonzini
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2016-01-07 14:17 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Takuya Yoshikawa, Christian Borntraeger, Paul Mackerras

Suggested-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
[Takuya moved all subsequent constants to fill the void, but that
 is useless in view of the following patches.  So this change looks
 nothing like the original. - Paolo]

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/linux/kvm_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 61c3e6c69f27..5ac775b4dde9 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -122,7 +122,7 @@ static inline bool is_error_page(struct page *page)
 #define KVM_REQ_UNHALT             6
 #define KVM_REQ_MMU_SYNC           7
 #define KVM_REQ_CLOCK_UPDATE       8
-#define KVM_REQ_KICK               9
+/* 9 is unused */
 #define KVM_REQ_DEACTIVATE_FPU    10
 #define KVM_REQ_EVENT             11
 #define KVM_REQ_APF_HALT          12
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/4] KVM: document which architecture uses each request bit
  2016-01-07 14:17 [PATCH 0/4] Reorganize request bits Paolo Bonzini
  2016-01-07 14:17 ` [PATCH 1/4] KVM: Remove unused KVM_REQ_KICK to save a bit in Paolo Bonzini
@ 2016-01-07 14:17 ` Paolo Bonzini
  2016-01-07 14:38   ` Christian Borntraeger
  2016-01-07 14:17 ` [PATCH 3/4] KVM: renumber architecture-dependent requests Paolo Bonzini
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2016-01-07 14:17 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Takuya Yoshikawa, Christian Borntraeger, Paul Mackerras

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/linux/kvm_host.h | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 5ac775b4dde9..48abf6792286 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -114,12 +114,14 @@ static inline bool is_error_page(struct page *page)
  * vcpu->requests bit members
  */
 #define KVM_REQ_TLB_FLUSH          0
-#define KVM_REQ_MIGRATE_TIMER      1
-#define KVM_REQ_REPORT_TPR_ACCESS  2
 #define KVM_REQ_MMU_RELOAD         3
-#define KVM_REQ_TRIPLE_FAULT       4
 #define KVM_REQ_PENDING_TIMER      5
 #define KVM_REQ_UNHALT             6
+
+/* x86-specific requests */
+#define KVM_REQ_MIGRATE_TIMER      1
+#define KVM_REQ_REPORT_TPR_ACCESS  2
+#define KVM_REQ_TRIPLE_FAULT       4
 #define KVM_REQ_MMU_SYNC           7
 #define KVM_REQ_CLOCK_UPDATE       8
 /* 9 is unused */
@@ -130,14 +132,10 @@ static inline bool is_error_page(struct page *page)
 #define KVM_REQ_NMI               14
 #define KVM_REQ_PMU               15
 #define KVM_REQ_PMI               16
-#define KVM_REQ_WATCHDOG          17
 #define KVM_REQ_MASTERCLOCK_UPDATE 18
 #define KVM_REQ_MCLOCK_INPROGRESS 19
-#define KVM_REQ_EPR_EXIT          20
 #define KVM_REQ_SCAN_IOAPIC       21
 #define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
-#define KVM_REQ_ENABLE_IBS        23
-#define KVM_REQ_DISABLE_IBS       24
 #define KVM_REQ_APIC_PAGE_RELOAD  25
 #define KVM_REQ_SMI               26
 #define KVM_REQ_HV_CRASH          27
@@ -146,6 +144,14 @@ static inline bool is_error_page(struct page *page)
 #define KVM_REQ_HV_EXIT           30
 #define KVM_REQ_HV_STIMER         31
 
+/* PPC-specific requests */
+#define KVM_REQ_WATCHDOG          17
+#define KVM_REQ_EPR_EXIT          20
+
+/* s390-specific requests */
+#define KVM_REQ_ENABLE_IBS        23
+#define KVM_REQ_DISABLE_IBS       24
+
 #define KVM_USERSPACE_IRQ_SOURCE_ID		0
 #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID	1
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/4] KVM: renumber architecture-dependent requests
  2016-01-07 14:17 [PATCH 0/4] Reorganize request bits Paolo Bonzini
  2016-01-07 14:17 ` [PATCH 1/4] KVM: Remove unused KVM_REQ_KICK to save a bit in Paolo Bonzini
  2016-01-07 14:17 ` [PATCH 2/4] KVM: document which architecture uses each request bit Paolo Bonzini
@ 2016-01-07 14:17 ` Paolo Bonzini
  2016-01-07 15:27   ` Christian Borntraeger
  2016-01-08  6:01   ` Takuya Yoshikawa
  2016-01-07 14:17 ` [PATCH 4/4] KVM: move architecture-dependent requests to arch/ Paolo Bonzini
  2016-01-07 14:23 ` [PATCH 0/4] Reorganize request bits Christian Borntraeger
  4 siblings, 2 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-01-07 14:17 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Takuya Yoshikawa, Christian Borntraeger, Paul Mackerras

Leave room for 4 more arch-independent requests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/linux/kvm_host.h | 59 ++++++++++++++++++++++++------------------------
 1 file changed, 29 insertions(+), 30 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 48abf6792286..b0ec0f778192 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -114,43 +114,42 @@ static inline bool is_error_page(struct page *page)
  * vcpu->requests bit members
  */
 #define KVM_REQ_TLB_FLUSH          0
-#define KVM_REQ_MMU_RELOAD         3
-#define KVM_REQ_PENDING_TIMER      5
-#define KVM_REQ_UNHALT             6
+#define KVM_REQ_MMU_RELOAD         1
+#define KVM_REQ_PENDING_TIMER      2
+#define KVM_REQ_UNHALT             3
 
 /* x86-specific requests */
-#define KVM_REQ_MIGRATE_TIMER      1
-#define KVM_REQ_REPORT_TPR_ACCESS  2
-#define KVM_REQ_TRIPLE_FAULT       4
-#define KVM_REQ_MMU_SYNC           7
-#define KVM_REQ_CLOCK_UPDATE       8
-/* 9 is unused */
-#define KVM_REQ_DEACTIVATE_FPU    10
-#define KVM_REQ_EVENT             11
-#define KVM_REQ_APF_HALT          12
-#define KVM_REQ_STEAL_UPDATE      13
-#define KVM_REQ_NMI               14
-#define KVM_REQ_PMU               15
-#define KVM_REQ_PMI               16
-#define KVM_REQ_MASTERCLOCK_UPDATE 18
-#define KVM_REQ_MCLOCK_INPROGRESS 19
-#define KVM_REQ_SCAN_IOAPIC       21
-#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
+#define KVM_REQ_MIGRATE_TIMER      8
+#define KVM_REQ_REPORT_TPR_ACCESS  9
+#define KVM_REQ_TRIPLE_FAULT      10
+#define KVM_REQ_MMU_SYNC          11
+#define KVM_REQ_CLOCK_UPDATE      12
+#define KVM_REQ_DEACTIVATE_FPU    13
+#define KVM_REQ_EVENT             14
+#define KVM_REQ_APF_HALT          15
+#define KVM_REQ_STEAL_UPDATE      16
+#define KVM_REQ_NMI               17
+#define KVM_REQ_PMU               18
+#define KVM_REQ_PMI               19
+#define KVM_REQ_SMI               20
+#define KVM_REQ_MASTERCLOCK_UPDATE 21
+#define KVM_REQ_MCLOCK_INPROGRESS 22
+#define KVM_REQ_SCAN_IOAPIC       23
+#define KVM_REQ_GLOBAL_CLOCK_UPDATE 24
 #define KVM_REQ_APIC_PAGE_RELOAD  25
-#define KVM_REQ_SMI               26
-#define KVM_REQ_HV_CRASH          27
-#define KVM_REQ_IOAPIC_EOI_EXIT   28
-#define KVM_REQ_HV_RESET          29
-#define KVM_REQ_HV_EXIT           30
-#define KVM_REQ_HV_STIMER         31
+#define KVM_REQ_HV_CRASH          26
+#define KVM_REQ_IOAPIC_EOI_EXIT   27
+#define KVM_REQ_HV_RESET          28
+#define KVM_REQ_HV_EXIT           29
+#define KVM_REQ_HV_STIMER         30
 
 /* PPC-specific requests */
-#define KVM_REQ_WATCHDOG          17
-#define KVM_REQ_EPR_EXIT          20
+#define KVM_REQ_WATCHDOG           8
+#define KVM_REQ_EPR_EXIT           9
 
 /* s390-specific requests */
-#define KVM_REQ_ENABLE_IBS        23
-#define KVM_REQ_DISABLE_IBS       24
+#define KVM_REQ_ENABLE_IBS         8
+#define KVM_REQ_DISABLE_IBS        9
 
 #define KVM_USERSPACE_IRQ_SOURCE_ID		0
 #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID	1
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] KVM: move architecture-dependent requests to arch/
  2016-01-07 14:17 [PATCH 0/4] Reorganize request bits Paolo Bonzini
                   ` (2 preceding siblings ...)
  2016-01-07 14:17 ` [PATCH 3/4] KVM: renumber architecture-dependent requests Paolo Bonzini
@ 2016-01-07 14:17 ` Paolo Bonzini
  2016-01-07 15:54   ` Christian Borntraeger
  2016-01-07 14:23 ` [PATCH 0/4] Reorganize request bits Christian Borntraeger
  4 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2016-01-07 14:17 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: Takuya Yoshikawa, Christian Borntraeger, Paul Mackerras

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/powerpc/include/asm/kvm_host.h |  4 ++++
 arch/s390/include/asm/kvm_host.h    |  4 ++++
 arch/x86/include/asm/kvm_host.h     | 28 +++++++++++++++++++++++++++
 arch/x86/kvm/x86.c                  | 10 ++++++++++
 include/linux/kvm_host.h            | 38 ++-----------------------------------
 virt/kvm/kvm_main.c                 | 10 ----------
 6 files changed, 48 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index cfa758c6b4f6..271fefbbe521 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -50,6 +50,10 @@
 #define KVM_NR_IRQCHIPS          1
 #define KVM_IRQCHIP_NUM_PINS     256
 
+/* PPC-specific vcpu->requests bit members */
+#define KVM_REQ_WATCHDOG           8
+#define KVM_REQ_EPR_EXIT           9
+
 #include <linux/mmu_notifier.h>
 
 #define KVM_ARCH_WANT_MMU_NOTIFIER
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index c83144110ea9..31fe20f4d129 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -39,6 +39,10 @@
 #define KVM_IRQCHIP_NUM_PINS 4096
 #define KVM_HALT_POLL_NS_DEFAULT 0
 
+/* s390-specific vcpu->requests bit members */
+#define KVM_REQ_ENABLE_IBS         8
+#define KVM_REQ_DISABLE_IBS        9
+
 #define SIGP_CTRL_C		0x80
 #define SIGP_CTRL_SCN_MASK	0x3f
 
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index a7c89876698b..44adbb819041 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -46,6 +46,31 @@
 
 #define KVM_IRQCHIP_NUM_PINS  KVM_IOAPIC_NUM_PINS
 
+/* x86-specific vcpu->requests bit members */
+#define KVM_REQ_MIGRATE_TIMER      8
+#define KVM_REQ_REPORT_TPR_ACCESS  9
+#define KVM_REQ_TRIPLE_FAULT      10
+#define KVM_REQ_MMU_SYNC          11
+#define KVM_REQ_CLOCK_UPDATE      12
+#define KVM_REQ_DEACTIVATE_FPU    13
+#define KVM_REQ_EVENT             14
+#define KVM_REQ_APF_HALT          15
+#define KVM_REQ_STEAL_UPDATE      16
+#define KVM_REQ_NMI               17
+#define KVM_REQ_PMU               18
+#define KVM_REQ_PMI               19
+#define KVM_REQ_SMI               20
+#define KVM_REQ_MASTERCLOCK_UPDATE 21
+#define KVM_REQ_MCLOCK_INPROGRESS 22
+#define KVM_REQ_SCAN_IOAPIC       23
+#define KVM_REQ_GLOBAL_CLOCK_UPDATE 24
+#define KVM_REQ_APIC_PAGE_RELOAD  25
+#define KVM_REQ_HV_CRASH          26
+#define KVM_REQ_IOAPIC_EOI_EXIT   27
+#define KVM_REQ_HV_RESET          28
+#define KVM_REQ_HV_EXIT           29
+#define KVM_REQ_HV_STIMER         30
+
 #define CR0_RESERVED_BITS                                               \
 	(~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \
 			  | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \
@@ -1268,6 +1293,9 @@ u64 kvm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc);
 unsigned long kvm_get_linear_rip(struct kvm_vcpu *vcpu);
 bool kvm_is_linear_rip(struct kvm_vcpu *vcpu, unsigned long linear_rip);
 
+void kvm_make_mclock_inprogress_request(struct kvm *kvm);
+void kvm_make_scan_ioapic_request(struct kvm *kvm);
+
 void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
 				     struct kvm_async_pf *work);
 void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 102c3028513f..dc6b37f47cd7 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1686,6 +1686,11 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm)
 #endif
 }
 
+void kvm_make_mclock_inprogress_request(struct kvm *kvm)
+{
+	kvm_make_all_cpus_request(kvm, KVM_REQ_MCLOCK_INPROGRESS);
+}
+
 static void kvm_gen_update_masterclock(struct kvm *kvm)
 {
 #ifdef CONFIG_X86_64
@@ -6337,6 +6342,11 @@ static void process_smi(struct kvm_vcpu *vcpu)
 	kvm_mmu_reset_context(vcpu);
 }
 
+void kvm_make_scan_ioapic_request(struct kvm *kvm)
+{
+	kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
+}
+
 static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu)
 {
 	u64 eoi_exit_bitmap[4];
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index b0ec0f778192..81c35dff52fd 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -111,46 +111,14 @@ static inline bool is_error_page(struct page *page)
 }
 
 /*
- * vcpu->requests bit members
+ * Architecture-independent vcpu->requests bit members
+ * Bits 4-7 are reserved for more arch-independent bits.
  */
 #define KVM_REQ_TLB_FLUSH          0
 #define KVM_REQ_MMU_RELOAD         1
 #define KVM_REQ_PENDING_TIMER      2
 #define KVM_REQ_UNHALT             3
 
-/* x86-specific requests */
-#define KVM_REQ_MIGRATE_TIMER      8
-#define KVM_REQ_REPORT_TPR_ACCESS  9
-#define KVM_REQ_TRIPLE_FAULT      10
-#define KVM_REQ_MMU_SYNC          11
-#define KVM_REQ_CLOCK_UPDATE      12
-#define KVM_REQ_DEACTIVATE_FPU    13
-#define KVM_REQ_EVENT             14
-#define KVM_REQ_APF_HALT          15
-#define KVM_REQ_STEAL_UPDATE      16
-#define KVM_REQ_NMI               17
-#define KVM_REQ_PMU               18
-#define KVM_REQ_PMI               19
-#define KVM_REQ_SMI               20
-#define KVM_REQ_MASTERCLOCK_UPDATE 21
-#define KVM_REQ_MCLOCK_INPROGRESS 22
-#define KVM_REQ_SCAN_IOAPIC       23
-#define KVM_REQ_GLOBAL_CLOCK_UPDATE 24
-#define KVM_REQ_APIC_PAGE_RELOAD  25
-#define KVM_REQ_HV_CRASH          26
-#define KVM_REQ_IOAPIC_EOI_EXIT   27
-#define KVM_REQ_HV_RESET          28
-#define KVM_REQ_HV_EXIT           29
-#define KVM_REQ_HV_STIMER         30
-
-/* PPC-specific requests */
-#define KVM_REQ_WATCHDOG           8
-#define KVM_REQ_EPR_EXIT           9
-
-/* s390-specific requests */
-#define KVM_REQ_ENABLE_IBS         8
-#define KVM_REQ_DISABLE_IBS        9
-
 #define KVM_USERSPACE_IRQ_SOURCE_ID		0
 #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID	1
 
@@ -689,8 +657,6 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
 
 void kvm_flush_remote_tlbs(struct kvm *kvm);
 void kvm_reload_remote_mmus(struct kvm *kvm);
-void kvm_make_mclock_inprogress_request(struct kvm *kvm);
-void kvm_make_scan_ioapic_request(struct kvm *kvm);
 bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
 
 long kvm_arch_dev_ioctl(struct file *filp,
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index be3cef12706c..314c7774652e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -206,16 +206,6 @@ void kvm_reload_remote_mmus(struct kvm *kvm)
 	kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD);
 }
 
-void kvm_make_mclock_inprogress_request(struct kvm *kvm)
-{
-	kvm_make_all_cpus_request(kvm, KVM_REQ_MCLOCK_INPROGRESS);
-}
-
-void kvm_make_scan_ioapic_request(struct kvm *kvm)
-{
-	kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
-}
-
 int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
 {
 	struct page *page;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/4] Reorganize request bits
  2016-01-07 14:17 [PATCH 0/4] Reorganize request bits Paolo Bonzini
                   ` (3 preceding siblings ...)
  2016-01-07 14:17 ` [PATCH 4/4] KVM: move architecture-dependent requests to arch/ Paolo Bonzini
@ 2016-01-07 14:23 ` Christian Borntraeger
  4 siblings, 0 replies; 14+ messages in thread
From: Christian Borntraeger @ 2016-01-07 14:23 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm; +Cc: Takuya Yoshikawa, Paul Mackerras

On 01/07/2016 03:17 PM, Paolo Bonzini wrote:
> There is no need for request bits to differ across architectures.  Only
> a handful of them are architecture-independent, the others can all share
> bits 8-31 with overlap.
> 
> Leaving room for more architecture-independent bits means that actually
> no bits are freed, but the cleanup is useful anyway IMO.
> 
> Paolo Bonzini (4):
>   KVM: Remove unused KVM_REQ_KICK to save a bit in
>   KVM: document which architecture uses each request bit
>   KVM: renumber architecture-dependent requests
>   KVM: move architecture-dependent requests to arch/
> 
>  arch/powerpc/include/asm/kvm_host.h |  4 ++++
>  arch/s390/include/asm/kvm_host.h    |  4 ++++
>  arch/x86/include/asm/kvm_host.h     | 28 ++++++++++++++++++++++++++
>  arch/x86/kvm/x86.c                  | 10 ++++++++++
>  include/linux/kvm_host.h            | 39 +++++--------------------------------
>  virt/kvm/kvm_main.c                 | 10 ----------
>  6 files changed, 51 insertions(+), 44 deletions(-)
> 

For the idea:

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
but no deep review so far.



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] KVM: Remove unused KVM_REQ_KICK to save a bit in
  2016-01-07 14:17 ` [PATCH 1/4] KVM: Remove unused KVM_REQ_KICK to save a bit in Paolo Bonzini
@ 2016-01-07 14:26   ` Christian Borntraeger
  0 siblings, 0 replies; 14+ messages in thread
From: Christian Borntraeger @ 2016-01-07 14:26 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm; +Cc: Takuya Yoshikawa, Paul Mackerras

On 01/07/2016 03:17 PM, Paolo Bonzini wrote:
> Suggested-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
> [Takuya moved all subsequent constants to fill the void, but that
>  is useless in view of the following patches.  So this change looks
>  nothing like the original. - Paolo]
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  include/linux/kvm_host.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 61c3e6c69f27..5ac775b4dde9 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -122,7 +122,7 @@ static inline bool is_error_page(struct page *page)
>  #define KVM_REQ_UNHALT             6
>  #define KVM_REQ_MMU_SYNC           7
>  #define KVM_REQ_CLOCK_UPDATE       8
> -#define KVM_REQ_KICK               9
> +/* 9 is unused */
>  #define KVM_REQ_DEACTIVATE_FPU    10
>  #define KVM_REQ_EVENT             11
>  #define KVM_REQ_APF_HALT          12
> 

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] KVM: document which architecture uses each request bit
  2016-01-07 14:17 ` [PATCH 2/4] KVM: document which architecture uses each request bit Paolo Bonzini
@ 2016-01-07 14:38   ` Christian Borntraeger
  0 siblings, 0 replies; 14+ messages in thread
From: Christian Borntraeger @ 2016-01-07 14:38 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm; +Cc: Takuya Yoshikawa, Paul Mackerras

On 01/07/2016 03:17 PM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  include/linux/kvm_host.h | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 5ac775b4dde9..48abf6792286 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -114,12 +114,14 @@ static inline bool is_error_page(struct page *page)
>   * vcpu->requests bit members
>   */
>  #define KVM_REQ_TLB_FLUSH          0
> -#define KVM_REQ_MIGRATE_TIMER      1
> -#define KVM_REQ_REPORT_TPR_ACCESS  2
>  #define KVM_REQ_MMU_RELOAD         3
> -#define KVM_REQ_TRIPLE_FAULT       4
>  #define KVM_REQ_PENDING_TIMER      5
>  #define KVM_REQ_UNHALT             6
> +
> +/* x86-specific requests */
> +#define KVM_REQ_MIGRATE_TIMER      1
> +#define KVM_REQ_REPORT_TPR_ACCESS  2
> +#define KVM_REQ_TRIPLE_FAULT       4
>  #define KVM_REQ_MMU_SYNC           7
>  #define KVM_REQ_CLOCK_UPDATE       8
>  /* 9 is unused */
> @@ -130,14 +132,10 @@ static inline bool is_error_page(struct page *page)
>  #define KVM_REQ_NMI               14
>  #define KVM_REQ_PMU               15
>  #define KVM_REQ_PMI               16
> -#define KVM_REQ_WATCHDOG          17
>  #define KVM_REQ_MASTERCLOCK_UPDATE 18
>  #define KVM_REQ_MCLOCK_INPROGRESS 19
> -#define KVM_REQ_EPR_EXIT          20
>  #define KVM_REQ_SCAN_IOAPIC       21
>  #define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
> -#define KVM_REQ_ENABLE_IBS        23
> -#define KVM_REQ_DISABLE_IBS       24
>  #define KVM_REQ_APIC_PAGE_RELOAD  25
>  #define KVM_REQ_SMI               26
>  #define KVM_REQ_HV_CRASH          27
> @@ -146,6 +144,14 @@ static inline bool is_error_page(struct page *page)
>  #define KVM_REQ_HV_EXIT           30
>  #define KVM_REQ_HV_STIMER         31
> 
> +/* PPC-specific requests */
> +#define KVM_REQ_WATCHDOG          17
> +#define KVM_REQ_EPR_EXIT          20
> +
> +/* s390-specific requests */
> +#define KVM_REQ_ENABLE_IBS        23
> +#define KVM_REQ_DISABLE_IBS       24
> +
>  #define KVM_USERSPACE_IRQ_SOURCE_ID		0
>  #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID	1
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] KVM: renumber architecture-dependent requests
  2016-01-07 14:17 ` [PATCH 3/4] KVM: renumber architecture-dependent requests Paolo Bonzini
@ 2016-01-07 15:27   ` Christian Borntraeger
  2016-01-07 15:45     ` Paolo Bonzini
  2016-01-08  6:01   ` Takuya Yoshikawa
  1 sibling, 1 reply; 14+ messages in thread
From: Christian Borntraeger @ 2016-01-07 15:27 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm; +Cc: Takuya Yoshikawa, Paul Mackerras

On 01/07/2016 03:17 PM, Paolo Bonzini wrote:
> Leave room for 4 more arch-independent requests.
> 


The patch subject is wrong.

"renumber architecture-dependent requests"

--> "renumber kvm requests"

as we also renumber the architecture independent ones.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] KVM: renumber architecture-dependent requests
  2016-01-07 15:27   ` Christian Borntraeger
@ 2016-01-07 15:45     ` Paolo Bonzini
  2016-01-07 15:50       ` Christian Borntraeger
  0 siblings, 1 reply; 14+ messages in thread
From: Paolo Bonzini @ 2016-01-07 15:45 UTC (permalink / raw)
  To: Christian Borntraeger, linux-kernel, kvm; +Cc: Takuya Yoshikawa, Paul Mackerras



On 07/01/2016 16:27, Christian Borntraeger wrote:
> On 01/07/2016 03:17 PM, Paolo Bonzini wrote:
>> Leave room for 4 more arch-independent requests.
> 
> The patch subject is wrong.
> 
> "renumber architecture-dependent requests"
> 
> --> "renumber kvm requests"
> 
> as we also renumber the architecture independent ones.

Right.  Ok with that change?

Paolo

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] KVM: renumber architecture-dependent requests
  2016-01-07 15:45     ` Paolo Bonzini
@ 2016-01-07 15:50       ` Christian Borntraeger
  0 siblings, 0 replies; 14+ messages in thread
From: Christian Borntraeger @ 2016-01-07 15:50 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm; +Cc: Takuya Yoshikawa, Paul Mackerras

On 01/07/2016 04:45 PM, Paolo Bonzini wrote:
> 
> 
> On 07/01/2016 16:27, Christian Borntraeger wrote:
>> On 01/07/2016 03:17 PM, Paolo Bonzini wrote:
>>> Leave room for 4 more arch-independent requests.
>>
>> The patch subject is wrong.
>>
>> "renumber architecture-dependent requests"
>>
>> --> "renumber kvm requests"
>>
>> as we also renumber the architecture independent ones.
> 
> Right.  Ok with that change?

Reviewed-by with that change.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] KVM: move architecture-dependent requests to arch/
  2016-01-07 14:17 ` [PATCH 4/4] KVM: move architecture-dependent requests to arch/ Paolo Bonzini
@ 2016-01-07 15:54   ` Christian Borntraeger
  2016-01-07 16:04     ` Paolo Bonzini
  0 siblings, 1 reply; 14+ messages in thread
From: Christian Borntraeger @ 2016-01-07 15:54 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm; +Cc: Takuya Yoshikawa, Paul Mackerras

On 01/07/2016 03:17 PM, Paolo Bonzini wrote:

Can you add at least a one line patch description?

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
>  arch/powerpc/include/asm/kvm_host.h |  4 ++++
>  arch/s390/include/asm/kvm_host.h    |  4 ++++
>  arch/x86/include/asm/kvm_host.h     | 28 +++++++++++++++++++++++++++
>  arch/x86/kvm/x86.c                  | 10 ++++++++++
>  include/linux/kvm_host.h            | 38 ++-----------------------------------
>  virt/kvm/kvm_main.c                 | 10 ----------
>  6 files changed, 48 insertions(+), 46 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index cfa758c6b4f6..271fefbbe521 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -50,6 +50,10 @@
>  #define KVM_NR_IRQCHIPS          1
>  #define KVM_IRQCHIP_NUM_PINS     256
> 
> +/* PPC-specific vcpu->requests bit members */
> +#define KVM_REQ_WATCHDOG           8
> +#define KVM_REQ_EPR_EXIT           9
> +
>  #include <linux/mmu_notifier.h>
> 
>  #define KVM_ARCH_WANT_MMU_NOTIFIER
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index c83144110ea9..31fe20f4d129 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -39,6 +39,10 @@
>  #define KVM_IRQCHIP_NUM_PINS 4096
>  #define KVM_HALT_POLL_NS_DEFAULT 0
> 
> +/* s390-specific vcpu->requests bit members */
> +#define KVM_REQ_ENABLE_IBS         8
> +#define KVM_REQ_DISABLE_IBS        9
> +
>  #define SIGP_CTRL_C		0x80
>  #define SIGP_CTRL_SCN_MASK	0x3f
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index a7c89876698b..44adbb819041 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -46,6 +46,31 @@
> 
>  #define KVM_IRQCHIP_NUM_PINS  KVM_IOAPIC_NUM_PINS
> 
> +/* x86-specific vcpu->requests bit members */
> +#define KVM_REQ_MIGRATE_TIMER      8
> +#define KVM_REQ_REPORT_TPR_ACCESS  9
> +#define KVM_REQ_TRIPLE_FAULT      10
> +#define KVM_REQ_MMU_SYNC          11
> +#define KVM_REQ_CLOCK_UPDATE      12
> +#define KVM_REQ_DEACTIVATE_FPU    13
> +#define KVM_REQ_EVENT             14
> +#define KVM_REQ_APF_HALT          15
> +#define KVM_REQ_STEAL_UPDATE      16
> +#define KVM_REQ_NMI               17
> +#define KVM_REQ_PMU               18
> +#define KVM_REQ_PMI               19
> +#define KVM_REQ_SMI               20
> +#define KVM_REQ_MASTERCLOCK_UPDATE 21
> +#define KVM_REQ_MCLOCK_INPROGRESS 22
> +#define KVM_REQ_SCAN_IOAPIC       23
> +#define KVM_REQ_GLOBAL_CLOCK_UPDATE 24
> +#define KVM_REQ_APIC_PAGE_RELOAD  25
> +#define KVM_REQ_HV_CRASH          26
> +#define KVM_REQ_IOAPIC_EOI_EXIT   27
> +#define KVM_REQ_HV_RESET          28
> +#define KVM_REQ_HV_EXIT           29
> +#define KVM_REQ_HV_STIMER         30
> +
>  #define CR0_RESERVED_BITS                                               \
>  	(~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \
>  			  | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \
> @@ -1268,6 +1293,9 @@ u64 kvm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc);
>  unsigned long kvm_get_linear_rip(struct kvm_vcpu *vcpu);
>  bool kvm_is_linear_rip(struct kvm_vcpu *vcpu, unsigned long linear_rip);
> 
> +void kvm_make_mclock_inprogress_request(struct kvm *kvm);
> +void kvm_make_scan_ioapic_request(struct kvm *kvm);
> +
>  void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
>  				     struct kvm_async_pf *work);
>  void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 102c3028513f..dc6b37f47cd7 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1686,6 +1686,11 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm)
>  #endif
>  }
> 
> +void kvm_make_mclock_inprogress_request(struct kvm *kvm)
> +{
> +	kvm_make_all_cpus_request(kvm, KVM_REQ_MCLOCK_INPROGRESS);
> +}
> +
>  static void kvm_gen_update_masterclock(struct kvm *kvm)
>  {
>  #ifdef CONFIG_X86_64
> @@ -6337,6 +6342,11 @@ static void process_smi(struct kvm_vcpu *vcpu)
>  	kvm_mmu_reset_context(vcpu);
>  }
> 
> +void kvm_make_scan_ioapic_request(struct kvm *kvm)
> +{
> +	kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
> +}
> +
>  static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu)
>  {
>  	u64 eoi_exit_bitmap[4];
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index b0ec0f778192..81c35dff52fd 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -111,46 +111,14 @@ static inline bool is_error_page(struct page *page)
>  }
> 
>  /*
> - * vcpu->requests bit members
> + * Architecture-independent vcpu->requests bit members
> + * Bits 4-7 are reserved for more arch-independent bits.
>   */
>  #define KVM_REQ_TLB_FLUSH          0
>  #define KVM_REQ_MMU_RELOAD         1
>  #define KVM_REQ_PENDING_TIMER      2
>  #define KVM_REQ_UNHALT             3
> 
> -/* x86-specific requests */
> -#define KVM_REQ_MIGRATE_TIMER      8
> -#define KVM_REQ_REPORT_TPR_ACCESS  9
> -#define KVM_REQ_TRIPLE_FAULT      10
> -#define KVM_REQ_MMU_SYNC          11
> -#define KVM_REQ_CLOCK_UPDATE      12
> -#define KVM_REQ_DEACTIVATE_FPU    13
> -#define KVM_REQ_EVENT             14
> -#define KVM_REQ_APF_HALT          15
> -#define KVM_REQ_STEAL_UPDATE      16
> -#define KVM_REQ_NMI               17
> -#define KVM_REQ_PMU               18
> -#define KVM_REQ_PMI               19
> -#define KVM_REQ_SMI               20
> -#define KVM_REQ_MASTERCLOCK_UPDATE 21
> -#define KVM_REQ_MCLOCK_INPROGRESS 22
> -#define KVM_REQ_SCAN_IOAPIC       23
> -#define KVM_REQ_GLOBAL_CLOCK_UPDATE 24
> -#define KVM_REQ_APIC_PAGE_RELOAD  25
> -#define KVM_REQ_HV_CRASH          26
> -#define KVM_REQ_IOAPIC_EOI_EXIT   27
> -#define KVM_REQ_HV_RESET          28
> -#define KVM_REQ_HV_EXIT           29
> -#define KVM_REQ_HV_STIMER         30
> -
> -/* PPC-specific requests */
> -#define KVM_REQ_WATCHDOG           8
> -#define KVM_REQ_EPR_EXIT           9
> -
> -/* s390-specific requests */
> -#define KVM_REQ_ENABLE_IBS         8
> -#define KVM_REQ_DISABLE_IBS        9
> -
>  #define KVM_USERSPACE_IRQ_SOURCE_ID		0
>  #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID	1
> 
> @@ -689,8 +657,6 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
> 
>  void kvm_flush_remote_tlbs(struct kvm *kvm);
>  void kvm_reload_remote_mmus(struct kvm *kvm);
> -void kvm_make_mclock_inprogress_request(struct kvm *kvm);
> -void kvm_make_scan_ioapic_request(struct kvm *kvm);
>  bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
> 
>  long kvm_arch_dev_ioctl(struct file *filp,
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index be3cef12706c..314c7774652e 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -206,16 +206,6 @@ void kvm_reload_remote_mmus(struct kvm *kvm)
>  	kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD);
>  }
> 
> -void kvm_make_mclock_inprogress_request(struct kvm *kvm)
> -{
> -	kvm_make_all_cpus_request(kvm, KVM_REQ_MCLOCK_INPROGRESS);
> -}
> -
> -void kvm_make_scan_ioapic_request(struct kvm *kvm)
> -{
> -	kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
> -}
> -
>  int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
>  {
>  	struct page *page;
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] KVM: move architecture-dependent requests to arch/
  2016-01-07 15:54   ` Christian Borntraeger
@ 2016-01-07 16:04     ` Paolo Bonzini
  0 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-01-07 16:04 UTC (permalink / raw)
  To: Christian Borntraeger, linux-kernel, kvm; +Cc: Takuya Yoshikawa, Paul Mackerras



On 07/01/2016 16:54, Christian Borntraeger wrote:
> On 01/07/2016 03:17 PM, Paolo Bonzini wrote:
> 
> Can you add at least a one line patch description?

Yes, and it will be more than one line. :)

"Since the numbers now overlap, it makes sense to enumerate
them in asm/kvm_host.h rather than linux/kvm_host.h.  Functions
that refer to architecture-specific requests are also moved
to arch/."

Paolo

>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> 
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> ---
>>  arch/powerpc/include/asm/kvm_host.h |  4 ++++
>>  arch/s390/include/asm/kvm_host.h    |  4 ++++
>>  arch/x86/include/asm/kvm_host.h     | 28 +++++++++++++++++++++++++++
>>  arch/x86/kvm/x86.c                  | 10 ++++++++++
>>  include/linux/kvm_host.h            | 38 ++-----------------------------------
>>  virt/kvm/kvm_main.c                 | 10 ----------
>>  6 files changed, 48 insertions(+), 46 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
>> index cfa758c6b4f6..271fefbbe521 100644
>> --- a/arch/powerpc/include/asm/kvm_host.h
>> +++ b/arch/powerpc/include/asm/kvm_host.h
>> @@ -50,6 +50,10 @@
>>  #define KVM_NR_IRQCHIPS          1
>>  #define KVM_IRQCHIP_NUM_PINS     256
>>
>> +/* PPC-specific vcpu->requests bit members */
>> +#define KVM_REQ_WATCHDOG           8
>> +#define KVM_REQ_EPR_EXIT           9
>> +
>>  #include <linux/mmu_notifier.h>
>>
>>  #define KVM_ARCH_WANT_MMU_NOTIFIER
>> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
>> index c83144110ea9..31fe20f4d129 100644
>> --- a/arch/s390/include/asm/kvm_host.h
>> +++ b/arch/s390/include/asm/kvm_host.h
>> @@ -39,6 +39,10 @@
>>  #define KVM_IRQCHIP_NUM_PINS 4096
>>  #define KVM_HALT_POLL_NS_DEFAULT 0
>>
>> +/* s390-specific vcpu->requests bit members */
>> +#define KVM_REQ_ENABLE_IBS         8
>> +#define KVM_REQ_DISABLE_IBS        9
>> +
>>  #define SIGP_CTRL_C		0x80
>>  #define SIGP_CTRL_SCN_MASK	0x3f
>>
>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
>> index a7c89876698b..44adbb819041 100644
>> --- a/arch/x86/include/asm/kvm_host.h
>> +++ b/arch/x86/include/asm/kvm_host.h
>> @@ -46,6 +46,31 @@
>>
>>  #define KVM_IRQCHIP_NUM_PINS  KVM_IOAPIC_NUM_PINS
>>
>> +/* x86-specific vcpu->requests bit members */
>> +#define KVM_REQ_MIGRATE_TIMER      8
>> +#define KVM_REQ_REPORT_TPR_ACCESS  9
>> +#define KVM_REQ_TRIPLE_FAULT      10
>> +#define KVM_REQ_MMU_SYNC          11
>> +#define KVM_REQ_CLOCK_UPDATE      12
>> +#define KVM_REQ_DEACTIVATE_FPU    13
>> +#define KVM_REQ_EVENT             14
>> +#define KVM_REQ_APF_HALT          15
>> +#define KVM_REQ_STEAL_UPDATE      16
>> +#define KVM_REQ_NMI               17
>> +#define KVM_REQ_PMU               18
>> +#define KVM_REQ_PMI               19
>> +#define KVM_REQ_SMI               20
>> +#define KVM_REQ_MASTERCLOCK_UPDATE 21
>> +#define KVM_REQ_MCLOCK_INPROGRESS 22
>> +#define KVM_REQ_SCAN_IOAPIC       23
>> +#define KVM_REQ_GLOBAL_CLOCK_UPDATE 24
>> +#define KVM_REQ_APIC_PAGE_RELOAD  25
>> +#define KVM_REQ_HV_CRASH          26
>> +#define KVM_REQ_IOAPIC_EOI_EXIT   27
>> +#define KVM_REQ_HV_RESET          28
>> +#define KVM_REQ_HV_EXIT           29
>> +#define KVM_REQ_HV_STIMER         30
>> +
>>  #define CR0_RESERVED_BITS                                               \
>>  	(~(unsigned long)(X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS \
>>  			  | X86_CR0_ET | X86_CR0_NE | X86_CR0_WP | X86_CR0_AM \
>> @@ -1268,6 +1293,9 @@ u64 kvm_read_l1_tsc(struct kvm_vcpu *vcpu, u64 host_tsc);
>>  unsigned long kvm_get_linear_rip(struct kvm_vcpu *vcpu);
>>  bool kvm_is_linear_rip(struct kvm_vcpu *vcpu, unsigned long linear_rip);
>>
>> +void kvm_make_mclock_inprogress_request(struct kvm *kvm);
>> +void kvm_make_scan_ioapic_request(struct kvm *kvm);
>> +
>>  void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
>>  				     struct kvm_async_pf *work);
>>  void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 102c3028513f..dc6b37f47cd7 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -1686,6 +1686,11 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm)
>>  #endif
>>  }
>>
>> +void kvm_make_mclock_inprogress_request(struct kvm *kvm)
>> +{
>> +	kvm_make_all_cpus_request(kvm, KVM_REQ_MCLOCK_INPROGRESS);
>> +}
>> +
>>  static void kvm_gen_update_masterclock(struct kvm *kvm)
>>  {
>>  #ifdef CONFIG_X86_64
>> @@ -6337,6 +6342,11 @@ static void process_smi(struct kvm_vcpu *vcpu)
>>  	kvm_mmu_reset_context(vcpu);
>>  }
>>
>> +void kvm_make_scan_ioapic_request(struct kvm *kvm)
>> +{
>> +	kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
>> +}
>> +
>>  static void vcpu_scan_ioapic(struct kvm_vcpu *vcpu)
>>  {
>>  	u64 eoi_exit_bitmap[4];
>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
>> index b0ec0f778192..81c35dff52fd 100644
>> --- a/include/linux/kvm_host.h
>> +++ b/include/linux/kvm_host.h
>> @@ -111,46 +111,14 @@ static inline bool is_error_page(struct page *page)
>>  }
>>
>>  /*
>> - * vcpu->requests bit members
>> + * Architecture-independent vcpu->requests bit members
>> + * Bits 4-7 are reserved for more arch-independent bits.
>>   */
>>  #define KVM_REQ_TLB_FLUSH          0
>>  #define KVM_REQ_MMU_RELOAD         1
>>  #define KVM_REQ_PENDING_TIMER      2
>>  #define KVM_REQ_UNHALT             3
>>
>> -/* x86-specific requests */
>> -#define KVM_REQ_MIGRATE_TIMER      8
>> -#define KVM_REQ_REPORT_TPR_ACCESS  9
>> -#define KVM_REQ_TRIPLE_FAULT      10
>> -#define KVM_REQ_MMU_SYNC          11
>> -#define KVM_REQ_CLOCK_UPDATE      12
>> -#define KVM_REQ_DEACTIVATE_FPU    13
>> -#define KVM_REQ_EVENT             14
>> -#define KVM_REQ_APF_HALT          15
>> -#define KVM_REQ_STEAL_UPDATE      16
>> -#define KVM_REQ_NMI               17
>> -#define KVM_REQ_PMU               18
>> -#define KVM_REQ_PMI               19
>> -#define KVM_REQ_SMI               20
>> -#define KVM_REQ_MASTERCLOCK_UPDATE 21
>> -#define KVM_REQ_MCLOCK_INPROGRESS 22
>> -#define KVM_REQ_SCAN_IOAPIC       23
>> -#define KVM_REQ_GLOBAL_CLOCK_UPDATE 24
>> -#define KVM_REQ_APIC_PAGE_RELOAD  25
>> -#define KVM_REQ_HV_CRASH          26
>> -#define KVM_REQ_IOAPIC_EOI_EXIT   27
>> -#define KVM_REQ_HV_RESET          28
>> -#define KVM_REQ_HV_EXIT           29
>> -#define KVM_REQ_HV_STIMER         30
>> -
>> -/* PPC-specific requests */
>> -#define KVM_REQ_WATCHDOG           8
>> -#define KVM_REQ_EPR_EXIT           9
>> -
>> -/* s390-specific requests */
>> -#define KVM_REQ_ENABLE_IBS         8
>> -#define KVM_REQ_DISABLE_IBS        9
>> -
>>  #define KVM_USERSPACE_IRQ_SOURCE_ID		0
>>  #define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID	1
>>
>> @@ -689,8 +657,6 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
>>
>>  void kvm_flush_remote_tlbs(struct kvm *kvm);
>>  void kvm_reload_remote_mmus(struct kvm *kvm);
>> -void kvm_make_mclock_inprogress_request(struct kvm *kvm);
>> -void kvm_make_scan_ioapic_request(struct kvm *kvm);
>>  bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req);
>>
>>  long kvm_arch_dev_ioctl(struct file *filp,
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index be3cef12706c..314c7774652e 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -206,16 +206,6 @@ void kvm_reload_remote_mmus(struct kvm *kvm)
>>  	kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_RELOAD);
>>  }
>>
>> -void kvm_make_mclock_inprogress_request(struct kvm *kvm)
>> -{
>> -	kvm_make_all_cpus_request(kvm, KVM_REQ_MCLOCK_INPROGRESS);
>> -}
>> -
>> -void kvm_make_scan_ioapic_request(struct kvm *kvm)
>> -{
>> -	kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
>> -}
>> -
>>  int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
>>  {
>>  	struct page *page;
>>
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] KVM: renumber architecture-dependent requests
  2016-01-07 14:17 ` [PATCH 3/4] KVM: renumber architecture-dependent requests Paolo Bonzini
  2016-01-07 15:27   ` Christian Borntraeger
@ 2016-01-08  6:01   ` Takuya Yoshikawa
  1 sibling, 0 replies; 14+ messages in thread
From: Takuya Yoshikawa @ 2016-01-08  6:01 UTC (permalink / raw)
  To: Paolo Bonzini, linux-kernel, kvm; +Cc: Christian Borntraeger, Paul Mackerras

On 2016/01/07 23:17, Paolo Bonzini wrote:
> Leave room for 4 more arch-independent requests.

In the current requests handling code, this ordering means
that architecture specific requests get handled only after
generic ones.

If someone wants to make a generic request that needs to be
handled before entering the guest from any architecture
specific request handler, this can be a problem.

If you can guarantee that this kind of dependencies will not
be introduced in the future, this change looks good to me.

Actually, I want to make the current dependencies, even between
architecture specific requests, more explicitly written in the
code.

  Takuya

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-01-08  6:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-07 14:17 [PATCH 0/4] Reorganize request bits Paolo Bonzini
2016-01-07 14:17 ` [PATCH 1/4] KVM: Remove unused KVM_REQ_KICK to save a bit in Paolo Bonzini
2016-01-07 14:26   ` Christian Borntraeger
2016-01-07 14:17 ` [PATCH 2/4] KVM: document which architecture uses each request bit Paolo Bonzini
2016-01-07 14:38   ` Christian Borntraeger
2016-01-07 14:17 ` [PATCH 3/4] KVM: renumber architecture-dependent requests Paolo Bonzini
2016-01-07 15:27   ` Christian Borntraeger
2016-01-07 15:45     ` Paolo Bonzini
2016-01-07 15:50       ` Christian Borntraeger
2016-01-08  6:01   ` Takuya Yoshikawa
2016-01-07 14:17 ` [PATCH 4/4] KVM: move architecture-dependent requests to arch/ Paolo Bonzini
2016-01-07 15:54   ` Christian Borntraeger
2016-01-07 16:04     ` Paolo Bonzini
2016-01-07 14:23 ` [PATCH 0/4] Reorganize request bits Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).