All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted
@ 2022-11-19  8:56 Javier Martinez Canillas
  2022-11-19  8:56 ` [PATCH 2/2] KVM: Add missing arch for KVM_CREATE_DEVICE and KVM_{SET,GET}_DEVICE_ATTR Javier Martinez Canillas
  2022-11-28 18:30 ` [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted Sean Christopherson
  0 siblings, 2 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-11-19  8:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sergio Lopez Pascual, Javier Martinez Canillas, Jonathan Corbet,
	Paolo Bonzini, kvm, linux-doc

Other ioctl such as KVM_ARM_SET_DEVICE_ADDR have a (deprecated) next to it
which makes it easier to determine that is deprecated. Do the same for the
ioctls that have been obsoleted.

Suggested-by: Sergio Lopez Pascual <slp@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 Documentation/virt/kvm/api.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index eee9f857a986..c17bac32d25c 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -272,7 +272,7 @@ the VCPU file descriptor can be mmap-ed, including:
   KVM_CAP_DIRTY_LOG_RING, see section 8.3.
 
 
-4.6 KVM_SET_MEMORY_REGION
+4.6 KVM_SET_MEMORY_REGION (obsoleted)
 -------------------------
 
 :Capability: basic
@@ -368,7 +368,7 @@ see the description of the capability.
 Note that the Xen shared info page, if configured, shall always be assumed
 to be dirty. KVM will not explicitly mark it such.
 
-4.9 KVM_SET_MEMORY_ALIAS
+4.9 KVM_SET_MEMORY_ALIAS (obsoleted)
 ------------------------
 
 :Capability: basic
-- 
2.38.1


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

* [PATCH 2/2] KVM: Add missing arch for KVM_CREATE_DEVICE and KVM_{SET,GET}_DEVICE_ATTR
  2022-11-19  8:56 [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted Javier Martinez Canillas
@ 2022-11-19  8:56 ` Javier Martinez Canillas
  2022-11-28 18:30 ` [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted Sean Christopherson
  1 sibling, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-11-19  8:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Sergio Lopez Pascual, Javier Martinez Canillas, Jonathan Corbet,
	Paolo Bonzini, kvm, linux-doc

The ioctls are missing an architecture property that is present in others.

Suggested-by: Sergio Lopez Pascual <slp@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---

 Documentation/virt/kvm/api.rst | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index c17bac32d25c..0a99858d6d03 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -3293,6 +3293,7 @@ valid entries found.
 ----------------------
 
 :Capability: KVM_CAP_DEVICE_CTRL
+:Architectures: all
 :Type: vm ioctl
 :Parameters: struct kvm_create_device (in/out)
 :Returns: 0 on success, -1 on error
@@ -3333,6 +3334,7 @@ number.
 :Capability: KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device,
              KVM_CAP_VCPU_ATTRIBUTES for vcpu device
              KVM_CAP_SYS_ATTRIBUTES for system (/dev/kvm) device (no set)
+:Architectures: x86, arm64, s390
 :Type: device ioctl, vm ioctl, vcpu ioctl
 :Parameters: struct kvm_device_attr
 :Returns: 0 on success, -1 on error
-- 
2.38.1


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

* Re: [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted
  2022-11-19  8:56 [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted Javier Martinez Canillas
  2022-11-19  8:56 ` [PATCH 2/2] KVM: Add missing arch for KVM_CREATE_DEVICE and KVM_{SET,GET}_DEVICE_ATTR Javier Martinez Canillas
@ 2022-11-28 18:30 ` Sean Christopherson
  2022-11-30 14:28   ` Paolo Bonzini
  1 sibling, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2022-11-28 18:30 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, Sergio Lopez Pascual, Jonathan Corbet,
	Paolo Bonzini, kvm, linux-doc

On Sat, Nov 19, 2022, Javier Martinez Canillas wrote:
> Other ioctl such as KVM_ARM_SET_DEVICE_ADDR have a (deprecated) next to it
> which makes it easier to determine that is deprecated. Do the same for the
> ioctls that have been obsoleted.
> 
> Suggested-by: Sergio Lopez Pascual <slp@redhat.com>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> ---
> 
>  Documentation/virt/kvm/api.rst | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
> index eee9f857a986..c17bac32d25c 100644
> --- a/Documentation/virt/kvm/api.rst
> +++ b/Documentation/virt/kvm/api.rst
> @@ -272,7 +272,7 @@ the VCPU file descriptor can be mmap-ed, including:
>    KVM_CAP_DIRTY_LOG_RING, see section 8.3.
>  
>  
> -4.6 KVM_SET_MEMORY_REGION
> +4.6 KVM_SET_MEMORY_REGION (obsoleted)

I realize the existing doc entry and include/uapi/linux/kvm.h says these are
"obsolete", but both of these are more than just obsolete since KVM no longer
supports them.  There's even a different blurb that states they are deprecated.

E.g. KVM_{CREATE,GET,SET}_PIT are good examples of obsolete ioctls; they've been
supplanted by newer variants, but KVM still supports the old ones too.

Alternatively (to marking them deprecated), can we completely remove all references
to VM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS?  The cascading updates in api.rst
will be painful, but it's one-time pain.

E.g. can we do something like this?

---
 Documentation/virt/kvm/api.rst  | 27 ---------------------------
 arch/x86/include/uapi/asm/kvm.h |  8 --------
 include/uapi/linux/kvm.h        | 12 ++----------
 3 files changed, 2 insertions(+), 45 deletions(-)

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index eee9f857a986..85a5b12eb017 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -272,18 +272,6 @@ the VCPU file descriptor can be mmap-ed, including:
   KVM_CAP_DIRTY_LOG_RING, see section 8.3.
 
 
-4.6 KVM_SET_MEMORY_REGION
--------------------------
-
-:Capability: basic
-:Architectures: all
-:Type: vm ioctl
-:Parameters: struct kvm_memory_region (in)
-:Returns: 0 on success, -1 on error
-
-This ioctl is obsolete and has been removed.
-
-
 4.7 KVM_CREATE_VCPU
 -------------------
 
@@ -368,17 +356,6 @@ see the description of the capability.
 Note that the Xen shared info page, if configured, shall always be assumed
 to be dirty. KVM will not explicitly mark it such.
 
-4.9 KVM_SET_MEMORY_ALIAS
-------------------------
-
-:Capability: basic
-:Architectures: x86
-:Type: vm ioctl
-:Parameters: struct kvm_memory_alias (in)
-:Returns: 0 (success), -1 (error)
-
-This ioctl is obsolete and has been removed.
-
 
 4.10 KVM_RUN
 ------------
@@ -1377,10 +1354,6 @@ the memory region are automatically reflected into the guest.  For example, an
 mmap() that affects the region will be made visible immediately.  Another
 example is madvise(MADV_DROP).
 
-It is recommended to use this API instead of the KVM_SET_MEMORY_REGION ioctl.
-The KVM_SET_MEMORY_REGION does not allow fine grained control over memory
-allocation and is deprecated.
-
 
 4.36 KVM_SET_TSS_ADDR
 ---------------------
diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h
index c6df6b16a088..e48deab8901d 100644
--- a/arch/x86/include/uapi/asm/kvm.h
+++ b/arch/x86/include/uapi/asm/kvm.h
@@ -53,14 +53,6 @@
 /* Architectural interrupt line count. */
 #define KVM_NR_INTERRUPTS 256
 
-struct kvm_memory_alias {
-	__u32 slot;  /* this has a different namespace than memory slots */
-	__u32 flags;
-	__u64 guest_phys_addr;
-	__u64 memory_size;
-	__u64 target_phys_addr;
-};
-
 /* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
 struct kvm_pic_state {
 	__u8 last_irr;	/* edge detection */
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 7fea12369245..b8e905ac9d0d 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -86,13 +86,6 @@ struct kvm_debug_guest {
 /* *** End of deprecated interfaces *** */
 
 
-/* for KVM_CREATE_MEMORY_REGION */
-struct kvm_memory_region {
-	__u32 slot;
-	__u32 flags;
-	__u64 guest_phys_addr;
-	__u64 memory_size; /* bytes */
-};
 
 /* for KVM_SET_USER_MEMORY_REGION */
 struct kvm_userspace_memory_region {
@@ -1443,15 +1436,14 @@ struct kvm_vfio_spapr_tce {
 /*
  * ioctls for VM fds
  */
-#define KVM_SET_MEMORY_REGION     _IOW(KVMIO,  0x40, struct kvm_memory_region)
+#define KVM_DEPRECATED_SET_MEMORY_REGION     _IOW(KVMIO,  0x40)
 /*
  * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
  * a vcpu fd.
  */
 #define KVM_CREATE_VCPU           _IO(KVMIO,   0x41)
 #define KVM_GET_DIRTY_LOG         _IOW(KVMIO,  0x42, struct kvm_dirty_log)
-/* KVM_SET_MEMORY_ALIAS is obsolete: */
-#define KVM_SET_MEMORY_ALIAS      _IOW(KVMIO,  0x43, struct kvm_memory_alias)
+#define KVM_DEPRECATED_SET_MEMORY_ALIAS      _IOW(KVMIO,  0x43)
 #define KVM_SET_NR_MMU_PAGES      _IO(KVMIO,   0x44)
 #define KVM_GET_NR_MMU_PAGES      _IO(KVMIO,   0x45)
 #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \

base-commit: 7ca560b50ba9a13150ccf2768ae1f53cd6c735c1
-- 


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

* Re: [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted
  2022-11-28 18:30 ` [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted Sean Christopherson
@ 2022-11-30 14:28   ` Paolo Bonzini
  2022-12-02  9:42     ` Javier Martinez Canillas
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2022-11-30 14:28 UTC (permalink / raw)
  To: Sean Christopherson, Javier Martinez Canillas
  Cc: linux-kernel, Sergio Lopez Pascual, Jonathan Corbet, kvm, linux-doc

On 11/28/22 19:30, Sean Christopherson wrote:
> E.g. KVM_{CREATE,GET,SET}_PIT are good examples of obsolete ioctls; they've been
> supplanted by newer variants, but KVM still supports the old ones too.
> 
> Alternatively (to marking them deprecated), can we completely remove all references
> to VM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS?  The cascading updates in api.rst
> will be painful, but it's one-time pain.

Yes, we should.

Paolo


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

* Re: [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted
  2022-11-30 14:28   ` Paolo Bonzini
@ 2022-12-02  9:42     ` Javier Martinez Canillas
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-12-02  9:42 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson
  Cc: linux-kernel, Sergio Lopez Pascual, Jonathan Corbet, kvm, linux-doc

Hello Sean and Paolo,

Thanks for your feedback.

On 11/30/22 15:28, Paolo Bonzini wrote:
> On 11/28/22 19:30, Sean Christopherson wrote:
>> E.g. KVM_{CREATE,GET,SET}_PIT are good examples of obsolete ioctls; they've been
>> supplanted by newer variants, but KVM still supports the old ones too.
>>
>> Alternatively (to marking them deprecated), can we completely remove all references
>> to VM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS?  The cascading updates in api.rst
>> will be painful, but it's one-time pain.
> 
> Yes, we should.
>

Ok. I'll do that and post a v2 then.
 
> Paolo
> 

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

end of thread, other threads:[~2022-12-02  9:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19  8:56 [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted Javier Martinez Canillas
2022-11-19  8:56 ` [PATCH 2/2] KVM: Add missing arch for KVM_CREATE_DEVICE and KVM_{SET,GET}_DEVICE_ATTR Javier Martinez Canillas
2022-11-28 18:30 ` [PATCH 1/2] KVM: Mark KVM_SET_MEMORY_REGION and KVM_SET_MEMORY_ALIAS as obsoleted Sean Christopherson
2022-11-30 14:28   ` Paolo Bonzini
2022-12-02  9:42     ` Javier Martinez Canillas

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.