[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251006111030.GU3245006@noisy.programming.kicks-ass.net>
Date: Mon, 6 Oct 2025 13:10:30 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Naman Jain <namjain@...ux.microsoft.com>
Cc: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Roman Kisel <romank@...ux.microsoft.com>,
"K . Y . Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>, linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org, mhklinux@...look.com
Subject: Re: [PATCH] x86/hyperv: Export hv_hypercall_pg unconditionally
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() ?
Powered by blists - more mailing lists