* [PATCH] kvm: Move KVM_GET_XSAVE2 IOCTL definition at the end of kvm.h
@ 2022-01-28 15:40 Janosch Frank
2022-01-29 1:35 ` Wang, Wei W
2022-01-31 14:22 ` Paolo Bonzini
0 siblings, 2 replies; 4+ messages in thread
From: Janosch Frank @ 2022-01-28 15:40 UTC (permalink / raw)
To: linux-kernel
Cc: kvm, pbonzini, guang.zeng, jing2.liu, kevin.tian, seanjc, tglx,
wei.w.wang, yang.zhong
This way we can more easily find the next free IOCTL number when
adding new IOCTLs.
Fixes: be50b2065dfa ("kvm: x86: Add support for getting/setting expanded xstate buffer")
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
include/uapi/linux/kvm.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 9563d294f181..efe81fef25eb 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -1623,9 +1623,6 @@ struct kvm_enc_region {
#define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
#define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
-/* Available with KVM_CAP_XSAVE2 */
-#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
-
struct kvm_s390_pv_sec_parm {
__u64 origin;
__u64 length;
@@ -2047,4 +2044,7 @@ struct kvm_stats_desc {
#define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
+/* Available with KVM_CAP_XSAVE2 */
+#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
+
#endif /* __LINUX_KVM_H */
--
2.32.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] kvm: Move KVM_GET_XSAVE2 IOCTL definition at the end of kvm.h
2022-01-28 15:40 [PATCH] kvm: Move KVM_GET_XSAVE2 IOCTL definition at the end of kvm.h Janosch Frank
@ 2022-01-29 1:35 ` Wang, Wei W
2022-01-31 6:28 ` Janosch Frank
2022-01-31 14:22 ` Paolo Bonzini
1 sibling, 1 reply; 4+ messages in thread
From: Wang, Wei W @ 2022-01-29 1:35 UTC (permalink / raw)
To: Janosch Frank, linux-kernel
Cc: kvm, pbonzini, Zeng, Guang, Liu, Jing2, Tian, Kevin, seanjc,
tglx, Zhong, Yang
On Friday, January 28, 2022 11:40 PM, Janosch Frank wrote:
> This way we can more easily find the next free IOCTL number when adding
> new IOCTLs.
Yes, this is good, but sometimes the relevant code tend to be put together (e.g. ioctl for vm fd and ioctls for vcpu fds), so not necessary to force them to be put in the number order.
I think it would be better to record the last used number in the comment on top, and new additions need to update it (similar to the case that we update the api doc):
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 9563d294f181..b7e5199ec47e 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -6,6 +6,9 @@
* Userspace interface for /dev/kvm - kernel based virtual machine
*
* Note: you must update KVM_API_VERSION if you change this interface.
+ *
+ * Last used cap number: KVM_CAP_XSAVE2(208)
+ * Last used ioctl number: KVM_HAS_DEVICE_ATTR(0xe3)
*/
#include <linux/const.h>
Thanks,
Wei
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kvm: Move KVM_GET_XSAVE2 IOCTL definition at the end of kvm.h
2022-01-29 1:35 ` Wang, Wei W
@ 2022-01-31 6:28 ` Janosch Frank
0 siblings, 0 replies; 4+ messages in thread
From: Janosch Frank @ 2022-01-31 6:28 UTC (permalink / raw)
To: Wang, Wei W, linux-kernel
Cc: kvm, pbonzini, Zeng, Guang, Liu, Jing2, Tian, Kevin, seanjc,
tglx, Zhong, Yang
On 1/29/22 02:35, Wang, Wei W wrote:
> On Friday, January 28, 2022 11:40 PM, Janosch Frank wrote:
>> This way we can more easily find the next free IOCTL number when adding
>> new IOCTLs.
>
> Yes, this is good, but sometimes the relevant code tend to be put together (e.g. ioctl for vm fd and ioctls for vcpu fds), so not necessary to force them to be put in the number order.
> I think it would be better to record the last used number in the comment on top, and new additions need to update it (similar to the case that we update the api doc):
It's not only the fact that it's not at the end, it's also in the middle
of a block of s390 IOCTLs which are not relevant for this x86 IOCTL.
Allowing an arbitrary order makes searching and adding harder. Imagine
we'd start grouping capabilities. Let's not go there.
>
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index 9563d294f181..b7e5199ec47e 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -6,6 +6,9 @@
> * Userspace interface for /dev/kvm - kernel based virtual machine
> *
> * Note: you must update KVM_API_VERSION if you change this interface.
> + *
> + * Last used cap number: KVM_CAP_XSAVE2(208)
> + * Last used ioctl number: KVM_HAS_DEVICE_ATTR(0xe3)
> */
>
> #include <linux/const.h>
>
> Thanks,
> Wei
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kvm: Move KVM_GET_XSAVE2 IOCTL definition at the end of kvm.h
2022-01-28 15:40 [PATCH] kvm: Move KVM_GET_XSAVE2 IOCTL definition at the end of kvm.h Janosch Frank
2022-01-29 1:35 ` Wang, Wei W
@ 2022-01-31 14:22 ` Paolo Bonzini
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2022-01-31 14:22 UTC (permalink / raw)
To: Janosch Frank, linux-kernel
Cc: kvm, guang.zeng, jing2.liu, kevin.tian, seanjc, tglx, wei.w.wang,
yang.zhong
On 1/28/22 16:40, Janosch Frank wrote:
> This way we can more easily find the next free IOCTL number when
> adding new IOCTLs.
>
> Fixes: be50b2065dfa ("kvm: x86: Add support for getting/setting expanded xstate buffer")
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> include/uapi/linux/kvm.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index 9563d294f181..efe81fef25eb 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -1623,9 +1623,6 @@ struct kvm_enc_region {
> #define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
> #define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
>
> -/* Available with KVM_CAP_XSAVE2 */
> -#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
> -
> struct kvm_s390_pv_sec_parm {
> __u64 origin;
> __u64 length;
> @@ -2047,4 +2044,7 @@ struct kvm_stats_desc {
>
> #define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
>
> +/* Available with KVM_CAP_XSAVE2 */
> +#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
> +
> #endif /* __LINUX_KVM_H */
Queued, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-31 14:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 15:40 [PATCH] kvm: Move KVM_GET_XSAVE2 IOCTL definition at the end of kvm.h Janosch Frank
2022-01-29 1:35 ` Wang, Wei W
2022-01-31 6:28 ` Janosch Frank
2022-01-31 14:22 ` Paolo Bonzini
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).