From: Peter Zijlstra <peterz@infradead.org>
To: "Huang, Kai" <kai.huang@intel.com>
Cc: "kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>,
"oe-kbuild-all@lists.linux.dev" <oe-kbuild-all@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
lkp <lkp@intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [tip:x86/tdx 8/12] vmlinux.o: warning: objtool: __tdx_hypercall+0x128: __tdx_hypercall_failed() is missing a __noreturn annotation
Date: Thu, 14 Sep 2023 13:06:03 +0200 [thread overview]
Message-ID: <20230914110603.GA18948@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <560662b4dd5088164119e0d312f88ed97f6f94a7.camel@intel.com>
On Thu, Sep 14, 2023 at 10:02:40AM +0000, Huang, Kai wrote:
> On Thu, 2023-09-14 at 10:59 +0200, Peter Zijlstra wrote:
> > On Thu, Sep 14, 2023 at 07:54:10AM +0000, Huang, Kai wrote:
> >
> > > > The point of noreturn is that the caller should know to stop generating
> > > > code. For that the declaration needs the attribute, because call sites
> > > > typically do not have access to the function definition in C.
> > >
> > > Ah that makes perfect sense. Thanks!
> > >
> > > Then I assume we don't need to annotate __noreturn in the function body, but
> > > only in the declaration? Because the compiler must already have seen the
> > > declaration when it generates the code for the function body.
> >
> > I think so, I'm sure it'll tell you if it disagrees :-)
> >
> > > Btw, I happened to notice that the objtool documentation suggests that we should
> > > also add the the function to tools/objtool/noreturns.h:
> > >
> > > 3. file.o: warning: objtool: foo+0x48c: bar() is missing a __noreturn annotation
> > >
> > > The call from foo() to bar() doesn't return, but bar() is missing the
> > > __noreturn annotation. NOTE: In addition to annotating the function
> > > with __noreturn, please also add it to tools/objtool/noreturns.h.
> > >
> > > Is it a behaviour that we still need to follow?
> >
> > Yes. objtool has some heuristics to detect noreturn, but is is very
> > difficult. Sadly noreturn is not something that is reflected in the ELF
> > object file so we have to guess.
> >
> > For now manually adding it to the objtool list is required, we're trying
> > to get to the point where it is generated/validated by the compiler,
> > perhaps with a plugin, but we're not there yet.
>
> Sorry one more question, do you know what Kconfig option triggers this
> __noreturn objtool check? I couldn't reproduce it on my own machine but have to
> depend on LKP for now.
Nope, sorry. Could be very GCC version specific through, this is all
about a specific code-gen pattern.
AFAICT we emit this warning when objtool finds this function is a
noreturn but code-gen continued.
next prev parent reply other threads:[~2023-09-14 11:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 1:05 [tip:x86/tdx 8/12] vmlinux.o: warning: objtool: __tdx_hypercall+0x128: __tdx_hypercall_failed() is missing a __noreturn annotation kernel test robot
2023-09-14 1:23 ` Huang, Kai
2023-09-14 3:21 ` Huang, Kai
2023-09-14 7:29 ` Peter Zijlstra
2023-09-14 7:54 ` Huang, Kai
2023-09-14 8:59 ` Peter Zijlstra
2023-09-14 9:18 ` Huang, Kai
2023-09-14 10:02 ` Huang, Kai
2023-09-14 11:06 ` Peter Zijlstra [this message]
2023-09-14 14:16 ` Ingo Molnar
2023-09-14 14:26 ` Peter Zijlstra
2023-09-14 14:52 ` Michael Matz
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=20230914110603.GA18948@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=dave.hansen@linux.intel.com \
--cc=kai.huang@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.