kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
@ 2020-04-09 11:49 Uros Bizjak
  2020-04-09 15:11 ` Xu, Like
  2020-04-15 15:41 ` Paolo Bonzini
  0 siblings, 2 replies; 9+ messages in thread
From: Uros Bizjak @ 2020-04-09 11:49 UTC (permalink / raw)
  To: kvm; +Cc: Uros Bizjak, Paolo Bonzini

The function returns no value.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Fixes: 199cd1d7b534 ("KVM: SVM: Split svm_vcpu_run inline assembly to separate file")
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
 arch/x86/kvm/svm/svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 2be5bbae3a40..061d19e69c73 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -3276,7 +3276,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
 	svm_complete_interrupts(svm);
 }
 
-bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
+void __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
 
 static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 {
-- 
2.25.2


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

* Re: [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
  2020-04-09 11:49 [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration Uros Bizjak
@ 2020-04-09 15:11 ` Xu, Like
  2020-04-09 15:18   ` Paolo Bonzini
  2020-04-09 15:27   ` Uros Bizjak
  2020-04-15 15:41 ` Paolo Bonzini
  1 sibling, 2 replies; 9+ messages in thread
From: Xu, Like @ 2020-04-09 15:11 UTC (permalink / raw)
  To: Uros Bizjak, kvm; +Cc: Paolo Bonzini

Hi Bizjak,

On 2020/4/9 19:49, Uros Bizjak wrote:
> The function returns no value.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Fixes: 199cd1d7b534 ("KVM: SVM: Split svm_vcpu_run inline assembly to separate file")
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> ---
>   arch/x86/kvm/svm/svm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 2be5bbae3a40..061d19e69c73 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -3276,7 +3276,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
>   	svm_complete_interrupts(svm);
>   }
>   
> -bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
Just curious if __svm_vcpu_run() will fail to enter SVM guest mode,
and a return value could indicate that nothing went wrong rather than 
blindly keeping silent.

Thanks,
Like Xu
> +void __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
>   
>   static void svm_vcpu_run(struct kvm_vcpu *vcpu)
>   {


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

* Re: [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
  2020-04-09 15:11 ` Xu, Like
@ 2020-04-09 15:18   ` Paolo Bonzini
  2020-04-09 15:42     ` Xu, Like
  2020-04-09 15:27   ` Uros Bizjak
  1 sibling, 1 reply; 9+ messages in thread
From: Paolo Bonzini @ 2020-04-09 15:18 UTC (permalink / raw)
  To: like.xu, Uros Bizjak, kvm

On 09/04/20 17:11, Xu, Like wrote:
>>
>>   -bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
> Just curious if __svm_vcpu_run() will fail to enter SVM guest mode,
> and a return value could indicate that nothing went wrong rather than
> blindly keeping silent.

That's already available in the exit code (which is 0xffffffff when
vmentry fails).

Paolo


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

* Re: [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
  2020-04-09 15:11 ` Xu, Like
  2020-04-09 15:18   ` Paolo Bonzini
@ 2020-04-09 15:27   ` Uros Bizjak
  2020-04-09 15:57     ` Xu, Like
  1 sibling, 1 reply; 9+ messages in thread
From: Uros Bizjak @ 2020-04-09 15:27 UTC (permalink / raw)
  To: like.xu; +Cc: kvm, Paolo Bonzini

On Thu, Apr 9, 2020 at 5:11 PM Xu, Like <like.xu@intel.com> wrote:
>
> Hi Bizjak,
>
> On 2020/4/9 19:49, Uros Bizjak wrote:
> > The function returns no value.
> >
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Fixes: 199cd1d7b534 ("KVM: SVM: Split svm_vcpu_run inline assembly to separate file")
> > Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> > ---
> >   arch/x86/kvm/svm/svm.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> > index 2be5bbae3a40..061d19e69c73 100644
> > --- a/arch/x86/kvm/svm/svm.c
> > +++ b/arch/x86/kvm/svm/svm.c
> > @@ -3276,7 +3276,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
> >       svm_complete_interrupts(svm);
> >   }
> >
> > -bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
> Just curious if __svm_vcpu_run() will fail to enter SVM guest mode,
> and a return value could indicate that nothing went wrong rather than
> blindly keeping silent.

vmload, vmrun and vmsave do not return anything in flags or registers,
so we can't detect anything at this point, modulo exception that is
handled below the respective instruction.

BTW: the change by itself does not change the generated code, the fake
return value from __svm_vcpu_run is already ignored. So, the change is
mostly cosmetic.

Uros.

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

* Re: [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
  2020-04-09 15:18   ` Paolo Bonzini
@ 2020-04-09 15:42     ` Xu, Like
  2020-04-09 15:55       ` Paolo Bonzini
  0 siblings, 1 reply; 9+ messages in thread
From: Xu, Like @ 2020-04-09 15:42 UTC (permalink / raw)
  To: Paolo Bonzini, Uros Bizjak, kvm

Hi Paolo,

On 2020/4/9 23:18, Paolo Bonzini wrote:
> On 09/04/20 17:11, Xu, Like wrote:
>>>    -bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
>> Just curious if __svm_vcpu_run() will fail to enter SVM guest mode,
>> and a return value could indicate that nothing went wrong rather than
>> blindly keeping silent.
> That's already available in the exit code (which is 0xffffffff when
> vmentry fails).
Yes, I assume the svm->vmcb->control.exit_code is referred.

What makes me confused is
why we need "vmx->exit_reason" and "vmx->fail"
for the same general purpose, but svm does not.

Thanks,
Like Xu
>
> Paolo
>


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

* Re: [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
  2020-04-09 15:42     ` Xu, Like
@ 2020-04-09 15:55       ` Paolo Bonzini
  2020-04-09 16:05         ` Xu, Like
  0 siblings, 1 reply; 9+ messages in thread
From: Paolo Bonzini @ 2020-04-09 15:55 UTC (permalink / raw)
  To: like.xu, Uros Bizjak, kvm

On 09/04/20 17:42, Xu, Like wrote:
>>
> Yes, I assume the svm->vmcb->control.exit_code is referred.
> 
> What makes me confused is
> why we need "vmx->exit_reason" and "vmx->fail"
> for the same general purpose, but svm does not.

Because VMLAUNCH/VMRESUME can also report vmFailValid and vmFailInvalid
via the carry and zero flags, there is no equivalent of that for AMD
virtualization extensions.

Paolo


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

* Re: [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
  2020-04-09 15:27   ` Uros Bizjak
@ 2020-04-09 15:57     ` Xu, Like
  0 siblings, 0 replies; 9+ messages in thread
From: Xu, Like @ 2020-04-09 15:57 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: kvm, Paolo Bonzini

On 2020/4/9 23:27, Uros Bizjak wrote:
> On Thu, Apr 9, 2020 at 5:11 PM Xu, Like <like.xu@intel.com> wrote:
>> Hi Bizjak,
>>
>> On 2020/4/9 19:49, Uros Bizjak wrote:
>>> The function returns no value.
>>>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Fixes: 199cd1d7b534 ("KVM: SVM: Split svm_vcpu_run inline assembly to separate file")
>>> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
>>> ---
>>>    arch/x86/kvm/svm/svm.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
>>> index 2be5bbae3a40..061d19e69c73 100644
>>> --- a/arch/x86/kvm/svm/svm.c
>>> +++ b/arch/x86/kvm/svm/svm.c
>>> @@ -3276,7 +3276,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
>>>        svm_complete_interrupts(svm);
>>>    }
>>>
>>> -bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
>> Just curious if __svm_vcpu_run() will fail to enter SVM guest mode,
>> and a return value could indicate that nothing went wrong rather than
>> blindly keeping silent.
> vmload, vmrun and vmsave do not return anything in flags or registers,
> so we can't detect anything at this point, modulo exception that is
> handled below the respective instruction.
If we check the __vmx_vcpu_run(), we have something like:

     /* VM-Fail.  Out-of-line to avoid a taken Jcc after VM-Exit. */
2:    mov $1, %eax
     jmp 1b

so do we need it in the __svm_vcpu_run() or why not ?
>
> BTW: the change by itself does not change the generated code, the fake
> return value from __svm_vcpu_run is already ignored. So, the change is
> mostly cosmetic.
Yes, the generated code is not affected and the change is reasonable.
>
> Uros.


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

* Re: [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
  2020-04-09 15:55       ` Paolo Bonzini
@ 2020-04-09 16:05         ` Xu, Like
  0 siblings, 0 replies; 9+ messages in thread
From: Xu, Like @ 2020-04-09 16:05 UTC (permalink / raw)
  To: Paolo Bonzini, Uros Bizjak, kvm

On 2020/4/9 23:55, Paolo Bonzini wrote:
> On 09/04/20 17:42, Xu, Like wrote:
>> Yes, I assume the svm->vmcb->control.exit_code is referred.
>>
>> What makes me confused is
>> why we need "vmx->exit_reason" and "vmx->fail"
>> for the same general purpose, but svm does not.
> Because VMLAUNCH/VMRESUME can also report vmFailValid and vmFailInvalid
> via the carry and zero flags, there is no equivalent of that for AMD
> virtualization extensions.
Oh, this makes sense to me. Thanks!
Let me confirm it from both specifications.
>
> Paolo
>


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

* Re: [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration.
  2020-04-09 11:49 [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration Uros Bizjak
  2020-04-09 15:11 ` Xu, Like
@ 2020-04-15 15:41 ` Paolo Bonzini
  1 sibling, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2020-04-15 15:41 UTC (permalink / raw)
  To: Uros Bizjak, kvm

On 09/04/20 13:49, Uros Bizjak wrote:
> The function returns no value.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Fixes: 199cd1d7b534 ("KVM: SVM: Split svm_vcpu_run inline assembly to separate file")
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> ---
>  arch/x86/kvm/svm/svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 2be5bbae3a40..061d19e69c73 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -3276,7 +3276,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
>  	svm_complete_interrupts(svm);
>  }
>  
> -bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
> +void __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
>  
>  static void svm_vcpu_run(struct kvm_vcpu *vcpu)
>  {
> 

Queued, thanks.

Paolo


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

end of thread, other threads:[~2020-04-15 15:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09 11:49 [PATCH] KVM: SVM: Fix __svm_vcpu_run declaration Uros Bizjak
2020-04-09 15:11 ` Xu, Like
2020-04-09 15:18   ` Paolo Bonzini
2020-04-09 15:42     ` Xu, Like
2020-04-09 15:55       ` Paolo Bonzini
2020-04-09 16:05         ` Xu, Like
2020-04-09 15:27   ` Uros Bizjak
2020-04-09 15:57     ` Xu, Like
2020-04-15 15:41 ` 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).