Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3865047rdb; Thu, 14 Sep 2023 05:18:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnrtqsltd1R49xUlIq04IrBnXoPk2u9qS52rpw7Yfln9v3bpBBQFwIrZh9RF2gDwxOIjtP X-Received: by 2002:a17:902:e5cb:b0:1bc:422a:b9fd with SMTP id u11-20020a170902e5cb00b001bc422ab9fdmr6413388plf.13.1694693887658; Thu, 14 Sep 2023 05:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694693887; cv=none; d=google.com; s=arc-20160816; b=0yrBmTJ2Hj9oz9ZHyUa/hCYunjQANXlG5g7fOAZ/VIU/CFeOibbEZfYEyR993WTUt4 vkVK9THz2xYtoT+ePyINeskAbHp+1G9IMeUDXMUVhMb3Z8H6fXkpnF8ISSzl21DUqPZu g3IWOGMZ1+C3qFhDVhYm5Bl1ExZKpgMNOWqDv/A1mesVhI8v26DH6VBegji9TIdS1EB9 8vu/4dRbuF2FswPPrNzo0b1bYQ++mxoSCdfQEl5xHne5uRisYZ2HCraVAznpS0w+IG2c ytDzsaKlWh5JFsy4/3lNR6RITzRA7JWfyMsqXuo0JMNj/tV9KXKIYcvuSz2V91he5PT+ smPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=31Mk8LyxJ/i2+GjpPHSXdxRgP0SAQUj9tBvhJ35XS1Q=; fh=4xcivHZ91gqiPZgj5UjOBEYWS8TmoMuDqbxAVs2UW0Q=; b=eKH0Gu0TRW2vq9SWprabVwce7D9mdFl0iGfGH11aYY3D0h1QTrXBZUyKblfZHpwPXu xhRJLi3O/UpGgOrGxliTwFNbpLfYaLyzpn7EWsXLNTgL0JC8se95ZYDuDbrC6fHPW2Y2 MdFB8ZQud14pavsO0NECfMUZhrE8p7Ws4z/YfcKhcn00tD3H4OwYkzMv/bGzyKUBIKSk kL3uaX7oHdIaqj8REaHG3Ss9shWwIverNEx4veSfecPOLlgTf6/u79lEnCmos3NpbrRp RFUYbsTlSjoW8E2rVY6Oh33rc4NJZiF+cUUltKhDGKU4w3Nirecf1yst4zsIWhT36LFP d5Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pMq0MbCD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id o3-20020a170902d4c300b001c3fcfb8000si1635125plg.506.2023.09.14.05.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 05:18:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pMq0MbCD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 326A4807CB56; Thu, 14 Sep 2023 04:06:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233606AbjINLGW (ORCPT + 99 others); Thu, 14 Sep 2023 07:06:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjINLGV (ORCPT ); Thu, 14 Sep 2023 07:06:21 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F239B1BF8 for ; Thu, 14 Sep 2023 04:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=31Mk8LyxJ/i2+GjpPHSXdxRgP0SAQUj9tBvhJ35XS1Q=; b=pMq0MbCDyhC/AppRuT/3DlvLCr b95eGXoEwxDyiyj/L9//DrjtXUWlf7+A3YaZn6tnPgzDwDXMpn2QJPUD1Wc7509exPNNsr3DFu6U/ sLOX5oTNucU4KpFcw/3OQSd2KmvzXNK9mq+JOhzKsw1dyJBBm4VBzTXwYhEZaWN6saslZT35DKFA5 SuZ+/ZmxlaB9iwo9N8NBFCZlhIYYSxDUnkwxLzpCsVeIb0nKKnSk03aZIHdff+FCLsQtnBY3Beavt Nx14FlXYmC6CXursGkIUZQlHYOTVGGc3TvplR+7mPJ+bu9e1ErH1oQ9Lf3hZ6m+Utp3hDJoLGyA3i TfCmlkdw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qgkAd-002XTv-O7; Thu, 14 Sep 2023 11:06:03 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 69D7930036C; Thu, 14 Sep 2023 13:06:03 +0200 (CEST) Date: Thu, 14 Sep 2023 13:06:03 +0200 From: Peter Zijlstra To: "Huang, Kai" Cc: "kirill.shutemov@linux.intel.com" , "oe-kbuild-all@lists.linux.dev" , "linux-kernel@vger.kernel.org" , lkp , "dave.hansen@linux.intel.com" , "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 Message-ID: <20230914110603.GA18948@noisy.programming.kicks-ass.net> References: <202309140828.9RdmlH2Z-lkp@intel.com> <90f0a4d44704f9c296f3a4d8b72c57f2916aa09d.camel@intel.com> <377b1ce2ecd390f4b6f8cdf68d22c708f7cef6d1.camel@intel.com> <20230914072959.GC16631@noisy.programming.kicks-ass.net> <9eb77be3a64c25b3264d5011a93242d006b88627.camel@intel.com> <20230914085913.GD16631@noisy.programming.kicks-ass.net> <560662b4dd5088164119e0d312f88ed97f6f94a7.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <560662b4dd5088164119e0d312f88ed97f6f94a7.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 04:06:26 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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.