Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4182386rdb; Thu, 14 Sep 2023 14:34:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKXaqeHXtXsM5HVIGDzuMcF7n++9JBMlTH6UebBv+b7NE54sq3u2gz4e33grV3J0OeLhgx X-Received: by 2002:a05:6a20:1581:b0:13d:17cc:5bca with SMTP id h1-20020a056a20158100b0013d17cc5bcamr10495pzj.18.1694727248808; Thu, 14 Sep 2023 14:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694727248; cv=none; d=google.com; s=arc-20160816; b=DLtAi0wvvtHgnJEuP56xx7cGHZJjn6PVu5BUdw4ZMavMdFaKicTOSotEFzMZXx3Ks5 oopvnpM9oOJcxSy3MiEEtRh9R/xnpOpIX46p8+rrDVRm2Jg2FtyyEgE+Zzqa6Q614IHR 98pig7iT11bVVWG2KeqgD7Lt3KEcwQ4+aiWkb3jEfv6eAcMxkpoNkz+pIg4inJ3gUyiJ 1R6FziYcAOhMzGHxboBB+J6n48e2/3d8uVflHzWNQWKUa9g9g7PLU8j2qOlhC3n/AsrL TauJDkDr+peJ9JWwpgB2k48WyJvSN7lO9CySsHZalrpfs7fbOsEBtAESOOQrcTDY8HDY f53Q== 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=767aOcIiPAu+a4xSMgdj3nN/8LUSwQTBQXYqcr4vSMA=; fh=LIGlz94wA0CrvDrQsi6OhXhPfDhvta94WcA5GFD2LA4=; b=JS1qH4W2E0Xzh+9UTdy6/dRiusXN1BG3vVZOEAqwp0PsTWwZMcjb0Bu31sl2uuyCo5 9i+/i0GMNwOsagIps2fqavRhInaGJXDM3l9v8zSpgpKe31WSU3Rwiwj3ajMfr+ZnMXDf ZH/GaX56Gad8ZUJdW2AAyh069rH2g7dozAjKrmIY0WUGpktnhfBaIH5Ll7KlUHwW/oDw 2/bZI5Tw5PPNDyogkIG9iTybdbsNvogkX9QSMJ5WuF7Sx4rvLyNyMOt2ALY50wD5Re8t i68uabU/4YLtTKnVbDqkpARiF9UdirLmjj9U0EaHXUE5Q9/+0E9bwMJXEMls0fGYZ/74 7QbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kgFcO0zV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q7-20020a631f47000000b0057761dd9c56si2088312pgm.322.2023.09.14.14.34.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 14:34:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kgFcO0zV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 19F888194762; Thu, 14 Sep 2023 01:59:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236376AbjINI7l (ORCPT + 99 others); Thu, 14 Sep 2023 04:59:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235913AbjINI7k (ORCPT ); Thu, 14 Sep 2023 04:59:40 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 392CDA8 for ; Thu, 14 Sep 2023 01:59:36 -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=767aOcIiPAu+a4xSMgdj3nN/8LUSwQTBQXYqcr4vSMA=; b=kgFcO0zVBVsnq/RZPRCNd5HN35 p8VN7t6TqAXFG6k7to+8XkKW7wL8LCf5SehsFSaqHD1AaIkwUt6v9G2sujMmd6go9KeAUzOGU01vx PYa0S46uqrKSX3jShgHJkktVfOlmzHDOg2ho7ZBTjqgVdzrTHOKn/CIiDgDu8KMOdpJz1Uf4t8cZB mkldwNURQ48hqWknD2F7GZZfCkoI0YizQDxNpSXmolQGtbUktQR1xoQy7ez4O+c6ItAKXp/lFS+JS BoFU8x/UBhieJ/Bvqul8Z+OeyrunOe/Gt0KfqlGMKVFlH5l+ThDhPqD/Zgv6ogKRNs0R6jdW0uRjj NjgP8vBQ==; 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 1qgiBt-001xaT-HM; Thu, 14 Sep 2023 08:59:13 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 35FEA30036C; Thu, 14 Sep 2023 10:59:13 +0200 (CEST) Date: Thu, 14 Sep 2023 10:59:13 +0200 From: Peter Zijlstra To: "Huang, Kai" Cc: "kirill.shutemov@linux.intel.com" , "dave.hansen@linux.intel.com" , "linux-kernel@vger.kernel.org" , lkp , "oe-kbuild-all@lists.linux.dev" , "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: <20230914085913.GD16631@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9eb77be3a64c25b3264d5011a93242d006b88627.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 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 01:59:39 -0700 (PDT) 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.