diff mbox series

[v2] doc: kvm: Fix return description of KVM_SET_MSRS

Message ID 20190904060118.43851-1-xiaoyao.li@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2] doc: kvm: Fix return description of KVM_SET_MSRS | expand

Commit Message

Xiaoyao Li Sept. 4, 2019, 6:01 a.m. UTC
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.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
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(-)

Comments

Sean Christopherson Sept. 4, 2019, 5:41 p.m. UTC | #1
On Wed, Sep 04, 2019 at 02:01:18PM +0800, Xiaoyao Li wrote:
> 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.
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
> 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(-)
> 
> diff --git a/Documentation/virt/kvm/api.txt b/Documentation/virt/kvm/api.txt
> index 2d067767b617..4638e893dec0 100644
> --- a/Documentation/virt/kvm/api.txt
> +++ b/Documentation/virt/kvm/api.txt
> @@ -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

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

> +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.

> it stops setting following MSRs
> +and returns the number of MSRs have been set successfully.
> +
>  
>  4.20 KVM_SET_CPUID
>  
> -- 
> 2.19.1
>
Xiaoyao Li Sept. 5, 2019, 1:11 a.m. UTC | #2
On 9/5/2019 1:41 AM, Sean Christopherson wrote:
> On Wed, Sep 04, 2019 at 02:01:18PM +0800, Xiaoyao Li wrote:
>> 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.
>>
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>> ---
>> 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(-)
>>
>> diff --git a/Documentation/virt/kvm/api.txt b/Documentation/virt/kvm/api.txt
>> index 2d067767b617..4638e893dec0 100644
>> --- a/Documentation/virt/kvm/api.txt
>> +++ b/Documentation/virt/kvm/api.txt
>> @@ -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
> 
> Probably better to say 'If' as opposed to 'Once', don't want to imply that
> userspace is incompetent :)
> 
>> +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.
>

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

>> it stops setting following MSRs
>> +and returns the number of MSRs have been set successfully.
>> +
>>   
>>   4.20 KVM_SET_CPUID
>>   
>> -- 
>> 2.19.1
>>
diff mbox series

Patch

diff --git a/Documentation/virt/kvm/api.txt b/Documentation/virt/kvm/api.txt
index 2d067767b617..4638e893dec0 100644
--- a/Documentation/virt/kvm/api.txt
+++ b/Documentation/virt/kvm/api.txt
@@ -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