linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Michael Kelley <mhklinux@outlook.com>
Cc: Naman Jain <namjain@linux.microsoft.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	"K . Y . Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	Mukesh Rathor <mrathor@linux.microsoft.com>,
	Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>,
	Nuno Das Neves <nunodasneves@linux.microsoft.com>,
	Christoph Hellwig <hch@infradead.org>,
	Saurabh Sengar <ssengar@linux.microsoft.com>,
	ALOK TIWARI <alok.a.tiwari@oracle.com>
Subject: Re: [PATCH v11 2/2] Drivers: hv: Introduce mshv_vtl driver
Date: Wed, 12 Nov 2025 10:37:04 +0100	[thread overview]
Message-ID: <20251112093704.GC4067720@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <SN6PR02MB4157C399DB7624C28D0860AAD4CCA@SN6PR02MB4157.namprd02.prod.outlook.com>

On Wed, Nov 12, 2025 at 04:12:08AM +0000, Michael Kelley wrote:

> > @@ -96,3 +97,10 @@ SYM_FUNC_START(__mshv_vtl_return_call)
> >  	pop %rbp
> >  	RET
> >  SYM_FUNC_END(__mshv_vtl_return_call)
> > +
> > +	.section	.discard.addressable,"aw"
> > +	.align 8
> > +	.type 	__UNIQUE_ID_addressable___SCK____mshv_vtl_return_hypercall_662.0, @object
> > +	.size 	__UNIQUE_ID_addressable___SCK____mshv_vtl_return_hypercall_662.0, 8
> > +__UNIQUE_ID_addressable___SCK____mshv_vtl_return_hypercall_662.0:
> > +	.quad	__SCK____mshv_vtl_return_hypercall
> 
> This is pretty yucky itself. 

Definitely doesn't win any prizes, for sure. 

> Why is it better than calling out to a C function?

It keeps all the code in one place is a strong argument.

> Is it because in spite of the annotations, there's no guarantee the C
> compiler won't generate some code that messes up a register value? Or is
> there some other reason?

There is that too, a frame pointer build would be in its right to add a
stack frame (although they typically won't in this case). And the C ABI
doesn't provide the guarantees your need, so calling out into C is very
much you get to keep the pieces.

> Does the magic "_662.0" have any significance?  Or is it just some
> uniqueness salt on the symbol name?

Like Paolo already said, that's just the crazy generated by our
__ADRESSABLE() macro, this name is mostly irrelevant, all we really need
is a reference to that __SCK____mshv_vtl_return_hypercall symbol so it
ends up in the symbol table. (And the final link will then complain if
the symbol doesn't end up being resolved)

Keeping the name somewhat in line with __ADDRESSABLE() has the advantage
that you can clearly see where it comes from, but yeah, we can strip of
the number if you like.

  parent reply	other threads:[~2025-11-12  9:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10  5:08 [PATCH v11 0/2] Drivers: hv: Introduce new driver - mshv_vtl Naman Jain
2025-11-10  5:08 ` [PATCH v11 1/2] Drivers: hv: Export some symbols for mshv_vtl Naman Jain
2025-11-10  5:08 ` [PATCH v11 2/2] Drivers: hv: Introduce mshv_vtl driver Naman Jain
2025-11-10 14:38   ` Peter Zijlstra
2025-11-11  6:55     ` Naman Jain
2025-11-11  8:13       ` Peter Zijlstra
2025-11-11 10:58         ` Naman Jain
2025-11-11 10:59           ` Peter Zijlstra
2025-11-12  4:12         ` Michael Kelley
2025-11-12  8:54           ` Paolo Bonzini
2025-11-12  9:37           ` Peter Zijlstra [this message]
2025-11-12  9:44             ` Michael Kelley
2025-11-12 10:10               ` Peter Zijlstra
2025-11-12 10:49                 ` Naman Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251112093704.GC4067720@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alok.a.tiwari@oracle.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=mingo@redhat.com \
    --cc=mrathor@linux.microsoft.com \
    --cc=namjain@linux.microsoft.com \
    --cc=nunodasneves@linux.microsoft.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=skinsburskii@linux.microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=wei.liu@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).