mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	"Huang, Kai" <kai.huang@intel.com>, lkp <lkp@intel.com>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"oe-kbuild-all@lists.linux.dev" <oe-kbuild-all@lists.linux.dev>,
	"x86@kernel.org" <x86@kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>
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 14:52:43 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LSU.2.20.2309141446000.28991@wotan.suse.de> (raw)
In-Reply-To: <20230914142644.GC18948@noisy.programming.kicks-ass.net>

Hey,

On Thu, 14 Sep 2023, Peter Zijlstra wrote:

> > > > It appears the __noreturn must be annotated to the function declaration 
> > > > but not the function body.  I'll send out the fix as soon as I confirm 
> > > > the fix with LKP.
> > > 
> > > FWIW, the reason being that...
> > > 
> > > 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.
> > 
> > BTW., arguably shouldn't the compiler generate a warning to begin with, 
> > when it encounters a noreturn function definition whose prototype doesn't 
> > have the attribute?
> 
> Yeah, I would agree with that,

That makes sense, yeah.  We actually have a warning -Wmissing-attributes 
that would fit this usecase, but currently doesn't implement this case (it 
only applies to aliases, not to decl vs. def).

> but I think the problem is that gnu
> attributes are all considered 'optional' and do not factor into the
> actual signature.

That actually depends on the attribute :)  Most attributes are like that, 
true, but some aren't optional in that sense as they influence the 
callee-caller contract (e.g. those that change the ABI, like fastcall).  
Those must then be part of the functions type.

'noreturn' is optional in that sense.  But a warning might still be 
warranted.


Ciao,
Michael.

      reply	other threads:[~2023-09-14 14:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  1:05 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
2023-09-14 14:16       ` Ingo Molnar
2023-09-14 14:26         ` Peter Zijlstra
2023-09-14 14:52           ` Michael Matz [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=alpine.LSU.2.20.2309141446000.28991@wotan.suse.de \
    --to=matz@suse.de \
    --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=mingo@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=peterz@infradead.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

all inboxes | Powered by JetHome®