From: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Nicholas Piggin <npiggin@gmail.com>,
Damien Le Moal <Damien.LeMoal@wdc.com>,
jgross@suse.com, x86@kernel.org
Subject: Re: WARNING: can't access registers at asm_common_interrupt
Date: Wed, 11 Nov 2020 21:07:30 +0100 [thread overview]
Message-ID: <20201111200730.GM2628@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20201111195900.2x7kfce2ejkmrzi3@treble>
On Wed, Nov 11, 2020 at 01:59:00PM -0600, Josh Poimboeuf wrote:
> On Wed, Nov 11, 2020 at 08:42:06PM +0100, Peter Zijlstra wrote:
> > > Would objtool have an easier time coping if this were implemented in
> > > terms of a static call?
> >
> > I doubt it, the big problem is that there is no visibility into the
> > actual alternative text. Runtime patching fragments into static call
> > would have the exact same problem.
> >
> > Something that _might_ maybe work is trying to morph the immediate
> > fragments into an alternative. That is, instead of this:
> >
> > static inline notrace unsigned long arch_local_save_flags(void)
> > {
> > return PVOP_CALLEE0(unsigned long, irq.save_fl);
> > }
> >
> > Write it something like:
> >
> > static inline notrace unsigned long arch_local_save_flags(void)
> > {
> > PVOP_CALL_ARGS;
> > PVOP_TEST_NULL(irq.save_fl);
> > asm_inline volatile(ALTERNATIVE(paravirt_alt(PARAVIRT_CALL),
> > "PUSHF; POP _ASM_AX",
> > X86_FEATURE_NATIVE)
> > : CLBR_RET_REG, ASM_CALL_CONSTRAINT
> > : paravirt_type(irq.save_fl.func),
> > paravirt_clobber(PVOP_CALLEE_CLOBBERS)
> > : "memory", "cc");
> > return __eax;
> > }
> >
> > And then we have to teach objtool how to deal with conflicting
> > alternatives...
> >
> > That would remove most (all, if we can figure out a form that deals with
> > the spinlock fragments) of paravirt_patch.c
> >
> > Hmm?
>
> I was going to suggest something similar. Though I would try to take it
> further and replace paravirt_patch_default() with static calls.
Possible, we just need to be _really_ careful to not allow changing
those static_call()s. So maybe we need DEFINE_STATIC_CALL_RO() which
does a __ro_after_init on the whole thing.
> Either way it doesn't make objtool's job much easier. But it would be
> nice to consolidate runtime patching mechanisms and get rid of
> .parainstructions.
I think the above (combining alternative and paravirt/static_call) does
make objtool's job easier, since then we at least have the actual
alternative instructions available to inspect, or am I mis-understanding
things?
next prev parent reply other threads:[~2020-11-11 20:07 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 6:04 WARNING: can't access registers at asm_common_interrupt Shinichiro Kawasaki
2020-11-06 18:06 ` Josh Poimboeuf
2020-11-09 9:10 ` Shinichiro Kawasaki
2020-11-10 3:19 ` Josh Poimboeuf
2020-11-10 9:19 ` Shinichiro Kawasaki
2020-11-11 17:05 ` Josh Poimboeuf
2020-11-11 17:47 ` Peter Zijlstra
2020-11-11 18:13 ` Josh Poimboeuf
2020-11-11 18:46 ` Andrew Cooper
2020-11-11 19:42 ` Peter Zijlstra
2020-11-11 19:59 ` Josh Poimboeuf
2020-11-11 20:07 ` Peter Zijlstra [this message]
2020-11-11 20:15 ` Josh Poimboeuf
2020-11-11 20:25 ` Andrew Cooper
2020-11-11 20:39 ` Peter Zijlstra
2020-11-13 17:34 ` Andy Lutomirski
2020-11-14 9:16 ` Jürgen Groß
2020-11-14 18:10 ` Andy Lutomirski
2020-11-15 6:33 ` Jürgen Groß
2020-11-15 16:05 ` Andy Lutomirski
2020-11-15 16:13 ` Jürgen Groß
2020-11-16 11:56 ` Jürgen Groß
2020-11-16 13:04 ` Peter Zijlstra
2020-11-18 6:47 ` Jürgen Groß
2020-11-18 8:22 ` Peter Zijlstra
2020-11-19 11:51 ` Shinichiro Kawasaki
2020-11-19 12:01 ` Peter Zijlstra
2020-11-19 12:28 ` Jürgen Groß
2020-11-19 12:48 ` Shinichiro Kawasaki
2020-11-11 20:35 ` Peter Zijlstra
2020-11-11 20:42 ` Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2020-09-06 20:46 syzbot
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=20201111200730.GM2628@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Damien.LeMoal@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=jgross@suse.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@gmail.com \
--cc=shinichiro.kawasaki@wdc.com \
--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