linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: peterz@infradead.org
To: Michael Kelley <mikelley@microsoft.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"mbenes@suse.de" <mbenes@suse.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"jgross@suse.com" <jgross@suse.com>
Subject: Re: [RFC][PATCH] objtool,x86_64,paravirt: Add pv_ops[] support
Date: Mon, 3 Aug 2020 18:19:21 +0200	[thread overview]
Message-ID: <20200803161921.GG2674@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <MW2PR2101MB10521C4F5E19F12E174623F7D74D0@MW2PR2101MB1052.namprd21.prod.outlook.com>

On Mon, Aug 03, 2020 at 03:18:57PM +0000, Michael Kelley wrote:
> From: peterz@infradead.org Sent: Monday, August 3, 2020 7:33 AM

> > It requires call sites are the normal indirect call, and not mangled
> > retpoison (slow_down_io() had those), it also requires pv_ops[]
> > assignments are single instructions and not laundered through some
> > pointless intermediate helper (hyperv).

^^^

> > diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c
> > index 09aa44cb8a91..bed769a84637 100644
> > --- a/drivers/clocksource/hyperv_timer.c
> > +++ b/drivers/clocksource/hyperv_timer.c
> > @@ -418,6 +418,13 @@ static struct clocksource hyperv_cs_msr = {
> >  	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
> >  };
> > 
> > +static __always_inline void hv_setup_sched_clock(void *sched_clock)
> > +{
> > +#ifdef CONFIG_PARAVIRT
> > +	pv_ops.time.sched_clock = sched_clock;
> > +#endif
> > +}
> > +
> 
> Moving this function to hyperv_timer.c is problematic because we
> want hyperv_timer.c to be architecture independent.  We're in the
> process of supporting Linux guests running on Hyper-V on ARM64, and
> there's a different implementation of hv_setup_sched_clock() on ARM64.

Then stick it in a header or something. The important part is that the
compiler generates:

4b737:       48 c7 05 00 00 00 00    movq   $0x0,0x0(%rip)        # 4b742 <hv_init_clocksource+0x4d>
4b73e:       00 00 00 00
		4b73a: R_X86_64_PC32    pv_ops
		4b73e: R_X86_64_32S     .text+0x827880

Where:

96378: 0000000000827880    32 FUNC    LOCAL  DEFAULT    4 read_hv_sched_clock_msr

Otherwise objtool cannot find the assignment and you get to keep the
pieces.

      reply	other threads:[~2020-08-03 16:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 14:32 [RFC][PATCH] objtool,x86_64,paravirt: Add pv_ops[] support peterz
2020-08-03 15:15 ` Andy Lutomirski
2020-08-03 15:59   ` peterz
2020-08-03 15:18 ` Michael Kelley
2020-08-03 16:19   ` peterz [this message]

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=20200803161921.GG2674@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jgross@suse.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.de \
    --cc=mikelley@microsoft.com \
    --cc=tglx@linutronix.de \
    --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).