From: Andrew Cooper <Andrew.Cooper3@citrix.com>
To: Peter Zijlstra <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jgross@suse.com" <jgross@suse.com>,
"sstabellini@kernel.org" <sstabellini@kernel.org>,
"boris.ostrovsky@oracle.com" <boris.ostrovsky@oracle.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: objtool warning for next-20221118
Date: Wed, 23 Nov 2022 10:52:09 +0000 [thread overview]
Message-ID: <2255c45f-d8ba-3f32-9d99-737ad3040dd7@citrix.com> (raw)
In-Reply-To: <Y33gAiFP2IpVdxJu@hirez.programming.kicks-ass.net>
On 23/11/2022 08:55, Peter Zijlstra wrote:
> On Tue, Nov 22, 2022 at 05:23:50PM -0800, Josh Poimboeuf wrote:
>> On Tue, Nov 22, 2022 at 09:35:17AM +0100, Peter Zijlstra wrote:
>>> On Mon, Nov 21, 2022 at 09:16:05PM -0800, Josh Poimboeuf wrote:
>>>
>>>> It's complaining about an unreachable instruction after a call to
>>>> arch_cpu_idle_dead(). In this case objtool detects the fact
>>>> arch_cpu_idle_dead() doesn't return due to its call to the
>>>> non-CONFIG_SMP version of play_dead(). But GCC has no way of detecting
>>>> that because the caller is in another translation unit.
>>>>
>>>> As far as I can tell, that function should never return. Though it
>>>> seems to have some dubious semantics (see xen_pv_play_dead() for
>>>> example, which *does* seem to return?). I'm thinking it would be an
>>>> improvement to enforce that noreturn behavior across all arches and
>>>> platforms, sprinkling __noreturn and BUG() on arch_cpu_idle_dead() and
>>>> maybe some of it callees, where needed.
>>>>
>>>> Peter, what do you think? I could attempt a patch.
>>> I'm thinking the Xen case makes all this really rather difficult :/
>>>
>>> While normally a CPU is brought up through a trampoline, Xen seems to
>>> have implemented it by simply returning from play_dead(), and afaict
>>> that is actually a valid way to go about doing it.
>> o_O
>>
>> How the @#$% is that a valid way of doing it? Why not just do it the
>> normal way?
> Well, if you return from arch_cpu_idle_dead() you're back in the idle
> loop -- exactly where you would be if you were to bootstrap the whole
> CPU -- provided you have it remember the whole state (easier with a
> vCPU).
>
> But maybe I'm missing something, lets add Xen folks on.
Calling VCPUOP_down on oneself always succeeds, but all it does is
deschedule the vCPU.
It can be undone at a later point by a different vcpu issuing VCPUOP_up
against the previously-downed CPU, at which point the vCPU gets rescheduled.
This is why the VCPUOP_down hypercall returns normally. All state
really is intact.
As for what Linux does, this is how xen_pv_cpu_up() currently behaves.
If you want to make Xen behave more everything else, then bug a BUG()
after VCPUOP_down, and adjust xen_pv_cpu_up() to skip its initialised
check and always use VCPUOP_initialise to bring the vCPU back online.
~Andrew
next prev parent reply other threads:[~2022-11-23 10:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 4:07 Paul E. McKenney
2022-11-21 11:31 ` Peter Zijlstra
2022-11-21 14:52 ` Paul E. McKenney
2022-11-22 5:16 ` Josh Poimboeuf
2022-11-22 8:35 ` Peter Zijlstra
2022-11-23 0:22 ` Paul E. McKenney
2022-11-23 1:48 ` Josh Poimboeuf
2022-11-23 17:49 ` Paul E. McKenney
2022-11-23 18:19 ` Josh Poimboeuf
2022-11-23 19:12 ` Paul E. McKenney
2022-11-23 22:32 ` Josh Poimboeuf
2022-11-23 23:06 ` Paul E. McKenney
2023-01-28 19:06 ` Paul E. McKenney
2023-02-01 0:02 ` Josh Poimboeuf
2023-02-01 0:33 ` Paul E. McKenney
2023-02-01 4:21 ` Paul E. McKenney
2022-11-23 1:23 ` Josh Poimboeuf
2022-11-23 8:55 ` Peter Zijlstra
2022-11-23 10:52 ` Andrew Cooper [this message]
2022-11-23 17:03 ` Josh Poimboeuf
2022-11-24 2:39 ` Josh Poimboeuf
2022-11-24 5:28 ` Juergen Gross
2022-11-24 7:47 ` Juergen Gross
2022-11-24 16:39 ` Josh Poimboeuf
2022-11-25 5:30 ` Juergen Gross
2022-11-29 19:56 ` Paul E. McKenney
2022-12-02 0:27 ` Paul E. McKenney
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=2255c45f-d8ba-3f32-9d99-737ad3040dd7@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=sfr@canb.auug.org.au \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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
all inboxes | Powered by JetHome®