All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM
@ 2014-08-26 12:00 Christoffer Dall
  2014-08-26 12:00 ` [PATCH 2/2] KVM: Unconditionally export KVM_CAP_USER_NMI Christoffer Dall
  2014-08-26 12:30 ` [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: Christoffer Dall @ 2014-08-26 12:00 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini, Gleb Natapov, Christoffer Dall

The idea between capabilities and the KVM_CHECK_EXTENSION ioctl is that
userspace can, at run-time, determine if a feature is supported or not.
This allows KVM to being supporting a new feature with a new kernel
version without any need to update user space.  Unfortunately, since the
definition of KVM_CAP_READONLY_MEM was guarded by #ifdef
__KVM_HAVE_READONLY_MEM, such discovery still required a user space
update.

Therefore, unconditionally export KVM_CAP_READONLY_MEM and change the
in-kernel conditional to rely on __KVM_HAVE_READONLY_MEM.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 include/uapi/linux/kvm.h | 2 --
 virt/kvm/kvm_main.c      | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index cf3a2ff..90d3eda 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -738,9 +738,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_PPC_GET_SMMU_INFO 78
 #define KVM_CAP_S390_COW 79
 #define KVM_CAP_PPC_ALLOC_HTAB 80
-#ifdef __KVM_HAVE_READONLY_MEM
 #define KVM_CAP_READONLY_MEM 81
-#endif
 #define KVM_CAP_IRQFD_RESAMPLE 82
 #define KVM_CAP_PPC_BOOKE_WATCHDOG 83
 #define KVM_CAP_PPC_HTAB_FD 84
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 5a0817e..1d03967 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -708,7 +708,7 @@ static int check_memory_region_flags(struct kvm_userspace_memory_region *mem)
 {
 	u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;
 
-#ifdef KVM_CAP_READONLY_MEM
+#ifdef __KVM_HAVE_READONLY_MEM
 	valid_flags |= KVM_MEM_READONLY;
 #endif
 
-- 
2.0.0


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

* [PATCH 2/2] KVM: Unconditionally export KVM_CAP_USER_NMI
  2014-08-26 12:00 [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM Christoffer Dall
@ 2014-08-26 12:00 ` Christoffer Dall
  2014-08-26 12:30 ` [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Christoffer Dall @ 2014-08-26 12:00 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini, Gleb Natapov, Christoffer Dall

The idea between capabilities and the KVM_CHECK_EXTENSION ioctl is that
userspace can, at run-time, determine if a feature is supported or not.
This allows KVM to being supporting a new feature with a new kernel
version without any need to update user space.  Unfortunately, since the
definition of KVM_CAP_USER_NMI was guarded by #ifdef
__KVM_HAVE_USER_NMI, such discovery still required a user space update.

Therefore, unconditionally export KVM_CAP_USER_NMI and change the
the typo in the comment for the IOCTL number definition as well.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
---
 include/uapi/linux/kvm.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 90d3eda..0695a1e 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -654,9 +654,7 @@ struct kvm_ppc_smmu_info {
 #endif
 /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */
 #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
-#ifdef __KVM_HAVE_USER_NMI
 #define KVM_CAP_USER_NMI 22
-#endif
 #ifdef __KVM_HAVE_GUEST_DEBUG
 #define KVM_CAP_SET_GUEST_DEBUG 23
 #endif
@@ -1091,7 +1089,7 @@ struct kvm_s390_ucas_mapping {
 #define KVM_S390_INITIAL_RESET    _IO(KVMIO,   0x97)
 #define KVM_GET_MP_STATE          _IOR(KVMIO,  0x98, struct kvm_mp_state)
 #define KVM_SET_MP_STATE          _IOW(KVMIO,  0x99, struct kvm_mp_state)
-/* Available with KVM_CAP_NMI */
+/* Available with KVM_CAP_USER_NMI */
 #define KVM_NMI                   _IO(KVMIO,   0x9a)
 /* Available with KVM_CAP_SET_GUEST_DEBUG */
 #define KVM_SET_GUEST_DEBUG       _IOW(KVMIO,  0x9b, struct kvm_guest_debug)
-- 
2.0.0


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

* Re: [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM
  2014-08-26 12:00 [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM Christoffer Dall
  2014-08-26 12:00 ` [PATCH 2/2] KVM: Unconditionally export KVM_CAP_USER_NMI Christoffer Dall
@ 2014-08-26 12:30 ` Paolo Bonzini
  2014-08-26 12:40   ` Christoffer Dall
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2014-08-26 12:30 UTC (permalink / raw)
  To: Christoffer Dall, kvm; +Cc: Gleb Natapov

Il 26/08/2014 14:00, Christoffer Dall ha scritto:
> The idea between capabilities and the KVM_CHECK_EXTENSION ioctl is that
> userspace can, at run-time, determine if a feature is supported or not.
> This allows KVM to being supporting a new feature with a new kernel
> version without any need to update user space.  Unfortunately, since the
> definition of KVM_CAP_READONLY_MEM was guarded by #ifdef
> __KVM_HAVE_READONLY_MEM, such discovery still required a user space
> update.
> 
> Therefore, unconditionally export KVM_CAP_READONLY_MEM and change the
> in-kernel conditional to rely on __KVM_HAVE_READONLY_MEM.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> ---
>  include/uapi/linux/kvm.h | 2 --
>  virt/kvm/kvm_main.c      | 2 +-
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index cf3a2ff..90d3eda 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -738,9 +738,7 @@ struct kvm_ppc_smmu_info {
>  #define KVM_CAP_PPC_GET_SMMU_INFO 78
>  #define KVM_CAP_S390_COW 79
>  #define KVM_CAP_PPC_ALLOC_HTAB 80
> -#ifdef __KVM_HAVE_READONLY_MEM
>  #define KVM_CAP_READONLY_MEM 81
> -#endif
>  #define KVM_CAP_IRQFD_RESAMPLE 82
>  #define KVM_CAP_PPC_BOOKE_WATCHDOG 83
>  #define KVM_CAP_PPC_HTAB_FD 84
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 5a0817e..1d03967 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -708,7 +708,7 @@ static int check_memory_region_flags(struct kvm_userspace_memory_region *mem)
>  {
>  	u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;
>  
> -#ifdef KVM_CAP_READONLY_MEM
> +#ifdef __KVM_HAVE_READONLY_MEM
>  	valid_flags |= KVM_MEM_READONLY;
>  #endif
>  
> 

Thanks, applying both.  Next time please include a cover letter. :)

Paolo

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

* Re: [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM
  2014-08-26 12:30 ` [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM Paolo Bonzini
@ 2014-08-26 12:40   ` Christoffer Dall
  0 siblings, 0 replies; 4+ messages in thread
From: Christoffer Dall @ 2014-08-26 12:40 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm@vger.kernel.org, Gleb Natapov

On Tue, Aug 26, 2014 at 2:30 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Il 26/08/2014 14:00, Christoffer Dall ha scritto:
>> The idea between capabilities and the KVM_CHECK_EXTENSION ioctl is that
>> userspace can, at run-time, determine if a feature is supported or not.
>> This allows KVM to being supporting a new feature with a new kernel
>> version without any need to update user space.  Unfortunately, since the
>> definition of KVM_CAP_READONLY_MEM was guarded by #ifdef
>> __KVM_HAVE_READONLY_MEM, such discovery still required a user space
>> update.
>>
>> Therefore, unconditionally export KVM_CAP_READONLY_MEM and change the
>> in-kernel conditional to rely on __KVM_HAVE_READONLY_MEM.
>>
>> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
>> ---
>>  include/uapi/linux/kvm.h | 2 --
>>  virt/kvm/kvm_main.c      | 2 +-
>>  2 files changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
>> index cf3a2ff..90d3eda 100644
>> --- a/include/uapi/linux/kvm.h
>> +++ b/include/uapi/linux/kvm.h
>> @@ -738,9 +738,7 @@ struct kvm_ppc_smmu_info {
>>  #define KVM_CAP_PPC_GET_SMMU_INFO 78
>>  #define KVM_CAP_S390_COW 79
>>  #define KVM_CAP_PPC_ALLOC_HTAB 80
>> -#ifdef __KVM_HAVE_READONLY_MEM
>>  #define KVM_CAP_READONLY_MEM 81
>> -#endif
>>  #define KVM_CAP_IRQFD_RESAMPLE 82
>>  #define KVM_CAP_PPC_BOOKE_WATCHDOG 83
>>  #define KVM_CAP_PPC_HTAB_FD 84
>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>> index 5a0817e..1d03967 100644
>> --- a/virt/kvm/kvm_main.c
>> +++ b/virt/kvm/kvm_main.c
>> @@ -708,7 +708,7 @@ static int check_memory_region_flags(struct kvm_userspace_memory_region *mem)
>>  {
>>       u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;
>>
>> -#ifdef KVM_CAP_READONLY_MEM
>> +#ifdef __KVM_HAVE_READONLY_MEM
>>       valid_flags |= KVM_MEM_READONLY;
>>  #endif
>>
>>
>
> Thanks, applying both.  Next time please include a cover letter. :)
>
Thought, we didn't necessarily do that for trivial small patch series,
but Peter also complained about me doing this on qemu-devel, so will
not completely adjust my patch flow. Sorry about that, and thanks for
picking them up.

-Christoffer

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

end of thread, other threads:[~2014-08-26 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-26 12:00 [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM Christoffer Dall
2014-08-26 12:00 ` [PATCH 2/2] KVM: Unconditionally export KVM_CAP_USER_NMI Christoffer Dall
2014-08-26 12:30 ` [PATCH 1/2] KVM: Unconditionally export KVM_CAP_READONLY_MEM Paolo Bonzini
2014-08-26 12:40   ` Christoffer Dall

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.