Skip to contentSkip to conversation

doc: kvm: Fix return description of KVM_SET_MSRS

PATCH Superseded Xiaoyao Li 2 participants 3 messages Sep 4, 2019 – Sep 5, 2019

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

PATCH v2 1/1 doc: kvm: Fix return description of KVM_SET_MSRS

Userspace can use ioctl KVM_SET_MSRS to update a set of MSRs of guest. This ioctl sets specified MSRs one by one. Once it fails to set an MSR due to setting reserved bits, the MSR is not supported/emulated by kvm, or violating other restrictions, it stops further processing and returns the number of MSRs have been set successfully.

---
v2:
elaborate the changelog and description of ioctl KVM_SET_MSRS based on Sean's comments.

---
 Documentation/virt/kvm/api.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/virt/kvm/api.txt +6 -1
index 2d067767b617..4638e893dec0 100644
@@ -586,7 +586,7 @@ Capability: basic
 Architectures: x86
 Type: vcpu ioctl
 Parameters: struct kvm_msrs (in)
-Returns: 0 on success, -1 on error
+Returns: number of msrs successfully set (see below), -1 on error
 
 Writes model-specific registers to the vcpu.  See KVM_GET_MSRS for the
 data structures.
@@ -595,6 +595,11 @@ Application code should set the 'nmsrs' member (which indicates the
 size of the entries array), and the 'index' and 'data' members of each
 array entry.
 
+It tries to set the MSRs in array entries[] one by one. Once failing to
+set an MSR (due to setting reserved bits, the MSR is not supported/emulated
+by kvm, or violating other restrctions), it stops setting following MSRs
+and returns the number of MSRs have been set successfully.
+
 
 4.20 KVM_SET_CPUID
 
Signature · 1 line
2.19.1
#1 lore raw
Quoted 30 lines · Xiaoyao Li

Userspace can use ioctl KVM_SET_MSRS to update a set of MSRs of guest. This ioctl sets specified MSRs one by one. Once it fails to set an MSR due to setting reserved bits, the MSR is not supported/emulated by kvm, or violating other restrictions, it stops further processing and returns the number of MSRs have been set successfully.

---
v2:
elaborate the changelog and description of ioctl KVM_SET_MSRS based on Sean's comments.

---
 Documentation/virt/kvm/api.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/virt/kvm/api.txt +1 -1
index 2d067767b617..4638e893dec0 100644
@@ -586,7 +586,7 @@ Capability: basic
 Architectures: x86
 Type: vcpu ioctl
 Parameters: struct kvm_msrs (in)
-Returns: 0 on success, -1 on error
+Returns: number of msrs successfully set (see below), -1 on error
 
 Writes model-specific registers to the vcpu.  See KVM_GET_MSRS for the
 data structures.

Documentation/virt/kvm/api.txt Application code should set the 'nmsrs' member (which indicates the · line 598

Quoted 4 lines
Documentation/virt/kvm/api.txt +1 -0
@@ -595,6 +595,11 @@ Application code should set the 'nmsrs' member (which indicates the
 size of the entries array), and the 'index' and 'data' members of each
 array entry.
 
+It tries to set the MSRs in array entries[] one by one. Once failing to

Probably better to say 'If' as opposed to 'Once', don't want to imply that userspace is incompetent :)

Documentation/virt/kvm/api.txt Application code should set the 'nmsrs' member (which indicates the · line 600

Quoted 2 lines
Documentation/virt/kvm/api.txt +2 -0
+set an MSR (due to setting reserved bits, the MSR is not supported/emulated
+by kvm, or violating other restrctions), 

Make it clear the list is not exhaustive, e.g.:

It tries to set the MSRs in array entries[] one by one. If setting an MSR fails, e.g. due to setting reserved bits, the MSR isn't supported/emulated by KVM, etc..., it stops processing the MSR list and returns the number of MSRs that have been set successfully.

Quoted 9 lines

it stops setting following MSRs

Documentation/virt/kvm/api.txt +2 -0
+and returns the number of MSRs have been set successfully.
+
 
 4.20 KVM_SET_CPUID
Signature · 2 lines
-- 
2.19.1
author
#2 lore raw
Quoted 44 lines · Sean Christopherson
Quoted 30 lines · Xiaoyao Li

Userspace can use ioctl KVM_SET_MSRS to update a set of MSRs of guest. This ioctl sets specified MSRs one by one. Once it fails to set an MSR due to setting reserved bits, the MSR is not supported/emulated by kvm, or violating other restrictions, it stops further processing and returns the number of MSRs have been set successfully.

---
v2:
elaborate the changelog and description of ioctl KVM_SET_MSRS based on Sean's comments.

---
  Documentation/virt/kvm/api.txt | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/virt/kvm/api.txt +1 -1
index 2d067767b617..4638e893dec0 100644
@@ -586,7 +586,7 @@ Capability: basic
  Architectures: x86
  Type: vcpu ioctl
  Parameters: struct kvm_msrs (in)
-Returns: 0 on success, -1 on error
+Returns: number of msrs successfully set (see below), -1 on error
 
  Writes model-specific registers to the vcpu.  See KVM_GET_MSRS for the
  data structures.

Documentation/virt/kvm/api.txt Application code should set the 'nmsrs' member (which indicates the · line 598

Quoted 4 lines
Documentation/virt/kvm/api.txt +1 -0
@@ -595,6 +595,11 @@ Application code should set the 'nmsrs' member (which indicates the
  size of the entries array), and the 'index' and 'data' members of each
  array entry.
 
+It tries to set the MSRs in array entries[] one by one. Once failing to

Probably better to say 'If' as opposed to 'Once', don't want to imply that userspace is incompetent :)

Documentation/virt/kvm/api.txt Application code should set the 'nmsrs' member (which indicates the · line 600

Quoted 2 lines
Documentation/virt/kvm/api.txt +2 -0
+set an MSR (due to setting reserved bits, the MSR is not supported/emulated
+by kvm, or violating other restrctions),

Make it clear the list is not exhaustive, e.g.:

Quoted 5 lines

It tries to set the MSRs in array entries[] one by one. If setting an MSR fails, e.g. due to setting reserved bits, the MSR isn't supported/emulated by KVM, etc..., it stops processing the MSR list and returns the number of MSRs that have been set successfully.

Refine it as you commented and send out v3, thanks.

Quoted 9 lines
Quoted 9 lines

it stops setting following MSRs

Documentation/virt/kvm/api.txt +2 -0
+and returns the number of MSRs have been set successfully.
+
 
  4.20 KVM_SET_CPUID
Signature · 2 lines
-- 
2.19.1