On Mon, Oct 06, 2025 at 04:20:03PM +0530, Naman Jain wrote:

> I am facing issues in this approach, after moving the assembly code to a
> separate file, using static calls, and making it noinstr.
> 
> We need to make a call to STATIC_CALL_TRAMP_STR(hv_hypercall_pg + offset) in
> the assembly code. This offset is populated at run time in the driver, so I
> have to pass this offset to the assembly function via function parameters or
> a shared variable. This leaves noinstr section and results in below warning:
> 
> [1]: vmlinux.o: warning: objtool: __mshv_vtl_return_call+0x4f: call to
> mshv_vtl_call_addr() leaves .noinstr.text section
> 
> 
> To fix this, one of the ways was to avoid making indirect calls. So I used
> EXPORT_STATIC_CALL to export the static call *trampoline and key* for the
> static call we created in C driver. Then I figured, we could simply call
> __SCT__<static_callname> in assembly code and it should work fine. But then
> it leads to this error in objtool.

Easiest solution is to create a second static_call and have
hv_set_hypercall_pg() set that to +offset.

DEFINE_STATIC_CALL(__hv_vtl_hypercall);


hv_set_hypercall()
        ...
        static_call_update(__hv_vtl_hypercall, ptr+offset); /* +- cast to right 
function type */


> [2]: arch/x86/hyperv/mshv_vtl_asm.o: error: objtool: static_call: can't find
> static_call_key symbol: __SCK__mshv_vtl_return_hypercall

Look at arch/x86/include/asm/preempt.h

you might need that __STATIC_CALL_MOD_ADDRESSABLE() thing somewhere.


Also, what's actually in that hypercall page that is so magical and
can't just be an ALTERNATIVE() ?



Reply via email to