diff mbox series

[1/2] xen: make HYPERVISOR_get_debugreg() always_inline

Message ID 20211125092056.24758-2-jgross@suse.com (mailing list archive)
State Accepted
Commit b1c45ad53efbad779aa6cdb588de0b8ea1ed54bb
Headers show
Series xen: make debugreg accessors always_inline | expand

Commit Message

Jürgen Groß Nov. 25, 2021, 9:20 a.m. UTC
HYPERVISOR_get_debugreg() is being called from noinstr code, so it
should be attributed "always_inline".

Fixes: f4afb713e5c3a4419ba ("x86/xen: Make get_debugreg() noinstr")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/include/asm/xen/hypercall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Cooper Nov. 25, 2021, 3 p.m. UTC | #1
On 25/11/2021 09:20, Juergen Gross wrote:
> HYPERVISOR_get_debugreg() is being called from noinstr code, so it
> should be attributed "always_inline".
>
> Fixes: f4afb713e5c3a4419ba ("x86/xen: Make get_debugreg() noinstr")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  arch/x86/include/asm/xen/hypercall.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
> index 0575f5863b7f..28ca1119606b 100644
> --- a/arch/x86/include/asm/xen/hypercall.h
> +++ b/arch/x86/include/asm/xen/hypercall.h
> @@ -287,7 +287,7 @@ HYPERVISOR_set_debugreg(int reg, unsigned long value)
>  	return _hypercall2(int, set_debugreg, reg, value);
>  }
>  
> -static inline unsigned long
> +static __always_inline unsigned long
>  HYPERVISOR_get_debugreg(int reg)
>  {
>  	return _hypercall1(unsigned long, get_debugreg, reg);

All this is going to do is push the error one step further in.

Next, objtool will complain that hypercall_page isn't noinstr.

~Andrew
Jürgen Groß Nov. 25, 2021, 3:04 p.m. UTC | #2
On 25.11.21 16:00, Andrew Cooper wrote:
> On 25/11/2021 09:20, Juergen Gross wrote:
>> HYPERVISOR_get_debugreg() is being called from noinstr code, so it
>> should be attributed "always_inline".
>>
>> Fixes: f4afb713e5c3a4419ba ("x86/xen: Make get_debugreg() noinstr")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Juergen Gross <jgross@suse.com>
>> ---
>>   arch/x86/include/asm/xen/hypercall.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
>> index 0575f5863b7f..28ca1119606b 100644
>> --- a/arch/x86/include/asm/xen/hypercall.h
>> +++ b/arch/x86/include/asm/xen/hypercall.h
>> @@ -287,7 +287,7 @@ HYPERVISOR_set_debugreg(int reg, unsigned long value)
>>   	return _hypercall2(int, set_debugreg, reg, value);
>>   }
>>   
>> -static inline unsigned long
>> +static __always_inline unsigned long
>>   HYPERVISOR_get_debugreg(int reg)
>>   {
>>   	return _hypercall1(unsigned long, get_debugreg, reg);
> 
> All this is going to do is push the error one step further in.
> 
> Next, objtool will complain that hypercall_page isn't noinstr.

I don't think so:

.pushsection .noinstr.text, "ax"
         .balign PAGE_SIZE
SYM_CODE_START(hypercall_page)
         .rept (PAGE_SIZE / 32)
                 UNWIND_HINT_FUNC
                 .skip 31, 0x90
                 ret
         .endr


Juergen
Andrew Cooper Nov. 25, 2021, 3:41 p.m. UTC | #3
On 25/11/2021 15:04, Juergen Gross wrote:
> On 25.11.21 16:00, Andrew Cooper wrote:
>> On 25/11/2021 09:20, Juergen Gross wrote:
>>> HYPERVISOR_get_debugreg() is being called from noinstr code, so it
>>> should be attributed "always_inline".
>>>
>>> Fixes: f4afb713e5c3a4419ba ("x86/xen: Make get_debugreg() noinstr")
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>> ---
>>>   arch/x86/include/asm/xen/hypercall.h | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/include/asm/xen/hypercall.h
>>> b/arch/x86/include/asm/xen/hypercall.h
>>> index 0575f5863b7f..28ca1119606b 100644
>>> --- a/arch/x86/include/asm/xen/hypercall.h
>>> +++ b/arch/x86/include/asm/xen/hypercall.h
>>> @@ -287,7 +287,7 @@ HYPERVISOR_set_debugreg(int reg, unsigned long
>>> value)
>>>       return _hypercall2(int, set_debugreg, reg, value);
>>>   }
>>>   -static inline unsigned long
>>> +static __always_inline unsigned long
>>>   HYPERVISOR_get_debugreg(int reg)
>>>   {
>>>       return _hypercall1(unsigned long, get_debugreg, reg);
>>
>> All this is going to do is push the error one step further in.
>>
>> Next, objtool will complain that hypercall_page isn't noinstr.
>
> I don't think so:
>
> .pushsection .noinstr.text, "ax"
>         .balign PAGE_SIZE
> SYM_CODE_START(hypercall_page)
>         .rept (PAGE_SIZE / 32)
>                 UNWIND_HINT_FUNC
>                 .skip 31, 0x90
>                 ret
>         .endr

/sigh yes.  It would help if I was reading an up to date tree.

Sorry for the noise.

~Andrew
diff mbox series

Patch

diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 0575f5863b7f..28ca1119606b 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -287,7 +287,7 @@  HYPERVISOR_set_debugreg(int reg, unsigned long value)
 	return _hypercall2(int, set_debugreg, reg, value);
 }
 
-static inline unsigned long
+static __always_inline unsigned long
 HYPERVISOR_get_debugreg(int reg)
 {
 	return _hypercall1(unsigned long, get_debugreg, reg);