* [PATCH] KVM: x86: Fix function address when kvm_x86_ops.func is NULL
@ 2022-02-22 6:25 Like Xu
2022-02-22 8:33 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Like Xu @ 2022-02-22 6:25 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Sean Christopherson, Jim Mattson, Vitaly Kuznetsov, Wanpeng Li,
Joerg Roedel, kvm, linux-kernel, Like Xu
From: Like Xu <likexu@tencent.com>
Fix the function address for __static_call_return0() which is used by
static_call_update() when a func in struct kvm_x86_ops is NULL.
Fixes: 5be2226f417d ("KVM: x86: allow defining return-0 static calls")
Signed-off-by: Like Xu <likexu@tencent.com>
---
arch/x86/include/asm/kvm_host.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 713e08f62385..312f5ee19514 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -1548,7 +1548,7 @@ static inline void kvm_ops_static_call_update(void)
#define KVM_X86_OP_OPTIONAL __KVM_X86_OP
#define KVM_X86_OP_OPTIONAL_RET0(func) \
static_call_update(kvm_x86_##func, kvm_x86_ops.func ? : \
- (void *) __static_call_return0);
+ (void *)&__static_call_return0);
#include <asm/kvm-x86-ops.h>
#undef __KVM_X86_OP
}
--
2.35.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: x86: Fix function address when kvm_x86_ops.func is NULL
2022-02-22 6:25 [PATCH] KVM: x86: Fix function address when kvm_x86_ops.func is NULL Like Xu
@ 2022-02-22 8:33 ` Paolo Bonzini
2022-02-22 8:54 ` Like Xu
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2022-02-22 8:33 UTC (permalink / raw)
To: Like Xu
Cc: Sean Christopherson, Jim Mattson, Vitaly Kuznetsov, Wanpeng Li,
Joerg Roedel, kvm, linux-kernel, Like Xu
On 2/22/22 07:25, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
>
> Fix the function address for __static_call_return0() which is used by
> static_call_update() when a func in struct kvm_x86_ops is NULL.
>
> Fixes: 5be2226f417d ("KVM: x86: allow defining return-0 static calls")
> Signed-off-by: Like Xu <likexu@tencent.com>
Sorry for the stupid question, but what breaks?
Paolo
> ---
> arch/x86/include/asm/kvm_host.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 713e08f62385..312f5ee19514 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1548,7 +1548,7 @@ static inline void kvm_ops_static_call_update(void)
> #define KVM_X86_OP_OPTIONAL __KVM_X86_OP
> #define KVM_X86_OP_OPTIONAL_RET0(func) \
> static_call_update(kvm_x86_##func, kvm_x86_ops.func ? : \
> - (void *) __static_call_return0);
> + (void *)&__static_call_return0);
> #include <asm/kvm-x86-ops.h>
> #undef __KVM_X86_OP
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: x86: Fix function address when kvm_x86_ops.func is NULL
2022-02-22 8:33 ` Paolo Bonzini
@ 2022-02-22 8:54 ` Like Xu
2022-02-22 15:25 ` Sean Christopherson
0 siblings, 1 reply; 4+ messages in thread
From: Like Xu @ 2022-02-22 8:54 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Sean Christopherson, Jim Mattson, Vitaly Kuznetsov, Wanpeng Li,
Joerg Roedel, kvm, linux-kernel
On 22/2/2022 4:33 pm, Paolo Bonzini wrote:
> On 2/22/22 07:25, Like Xu wrote:
>> From: Like Xu <likexu@tencent.com>
>>
>> Fix the function address for __static_call_return0() which is used by
>> static_call_update() when a func in struct kvm_x86_ops is NULL.
>>
>> Fixes: 5be2226f417d ("KVM: x86: allow defining return-0 static calls")
>> Signed-off-by: Like Xu <likexu@tencent.com>
>
> Sorry for the stupid question, but what breaks?
Although they are numerically the same, I suppose we should use the
& operator here, as in the other cases where __static_call_return0 is used.
What's more, Clang complains about the KVM_X86_OP_OPTIONAL_RET0 change:
./arch/x86/include/asm/kvm-x86-ops.h:108:1: warning: pointer type mismatch \
('bool (*)(struct kvm_vcpu *)' (aka '_Bool (*)(struct kvm_vcpu *)') and 'void *') \
[-Wpointer-type-mismatch]
and more warnings from [-Wpointer-type-mismatch]
Does it help you ?
>
> Paolo
>
>> ---
>> arch/x86/include/asm/kvm_host.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
>> index 713e08f62385..312f5ee19514 100644
>> --- a/arch/x86/include/asm/kvm_host.h
>> +++ b/arch/x86/include/asm/kvm_host.h
>> @@ -1548,7 +1548,7 @@ static inline void kvm_ops_static_call_update(void)
>> #define KVM_X86_OP_OPTIONAL __KVM_X86_OP
>> #define KVM_X86_OP_OPTIONAL_RET0(func) \
>> static_call_update(kvm_x86_##func, kvm_x86_ops.func ? : \
>> - (void *) __static_call_return0);
>> + (void *)&__static_call_return0);
>> #include <asm/kvm-x86-ops.h>
>> #undef __KVM_X86_OP
>> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: x86: Fix function address when kvm_x86_ops.func is NULL
2022-02-22 8:54 ` Like Xu
@ 2022-02-22 15:25 ` Sean Christopherson
0 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2022-02-22 15:25 UTC (permalink / raw)
To: Like Xu
Cc: Paolo Bonzini, Jim Mattson, Vitaly Kuznetsov, Wanpeng Li,
Joerg Roedel, kvm, linux-kernel
On Tue, Feb 22, 2022, Like Xu wrote:
> On 22/2/2022 4:33 pm, Paolo Bonzini wrote:
> > On 2/22/22 07:25, Like Xu wrote:
> > > From: Like Xu <likexu@tencent.com>
> > >
> > > Fix the function address for __static_call_return0() which is used by
> > > static_call_update() when a func in struct kvm_x86_ops is NULL.
> > >
> > > Fixes: 5be2226f417d ("KVM: x86: allow defining return-0 static calls")
> > > Signed-off-by: Like Xu <likexu@tencent.com>
> >
> > Sorry for the stupid question, but what breaks?
>
> Although they are numerically the same, I suppose we should use the
> & operator here, as in the other cases where __static_call_return0 is used.
Meh, IMO all the other instances are weird for adding the "&".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-22 15:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 6:25 [PATCH] KVM: x86: Fix function address when kvm_x86_ops.func is NULL Like Xu
2022-02-22 8:33 ` Paolo Bonzini
2022-02-22 8:54 ` Like Xu
2022-02-22 15:25 ` Sean Christopherson
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.