Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5600892rwb; Tue, 22 Nov 2022 02:13:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf54bFTexHHAZ6+WZorU113OKPwblEuAmd4SGeBo/Zk+9DhD0NMjxMQagIMBXd6RM+VmwCvA X-Received: by 2002:a05:6402:4504:b0:463:71ef:b9ce with SMTP id ez4-20020a056402450400b0046371efb9cemr11806729edb.75.1669112003871; Tue, 22 Nov 2022 02:13:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669112003; cv=none; d=google.com; s=arc-20160816; b=J51WL8vJYGD4bH+cBwgUIqPYKekU6+dZlaAT5Jd1QaBT/xkat3D7Nm0XRxOjURet8G kr5M1gXgQf5Ip8qcKuSUdvOw6xu4kqg7shCnsm/iWAxnioZiGHqrOS+qD5w5ARxFR2uH s2eo+kIfb/fysX7Ts2ONV6mwSeqkQrkyqoU3kGnpTR//HJyjiOdgegmhqBNGG/WLkrB3 sKgUepGCe894KC9f5wzQ+obezG108fsqzG8t6Etokj2Dr8Ebi0WGN0c2M4BvrNYHQb7A 1LZdbxXQXwYGdz2rwl7Py2Q/qytkqizESf55tt/vPBctmTtBaApEVKulCxrMdZE5RSxf CBhw== 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=yHp1AsAmHyPZmizl0nTdscJwTXgkYHDTI8L4G1VCVVM=; b=Vxk4vmjcxtzwqyzJ8i/j/DyvqYUqlloVCeXCPKmPYM8y4r99ygUaBRa7g2tPriHICm xjWntu7ykmcNetIzESTBUu1HUI6M0BnQFANifKOtAIcuIQ9ReczHj+Lts4pD0mmlt+b2 HIUHidM3MUEhN1eyZkt5ybrSe49APPyJvzvji00cpOlH6naEHt0vgRtlhgoN8hnnVD+x /Ke/0sbJRDT9ekAFxvaTazdTLf2uYM7k5JpjWlY3gF1Z3XTimYzVdYxm5SSeU6B4H55f WaLF/jtNtKb/HQ5G5JT1AxwNbUxeGqBGFxyu8liXf7YAbuljACFwCr+55TRFu8Xtx7eC zi/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=jgPGJOpa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs36-20020a1709073ea400b00791bcf8aa5esi13012258ejc.739.2022.11.22.02.13.01; Tue, 22 Nov 2022 02:13:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=jgPGJOpa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232864AbiKVIfg (ORCPT + 91 others); Tue, 22 Nov 2022 03:35:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232847AbiKVIf2 (ORCPT ); Tue, 22 Nov 2022 03:35:28 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA0E2419A0 for ; Tue, 22 Nov 2022 00:35:26 -0800 (PST) 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=yHp1AsAmHyPZmizl0nTdscJwTXgkYHDTI8L4G1VCVVM=; b=jgPGJOpa9YOcOQPUxq0blvWWHO 5bgOleZB/sfY7n2RW0YoJeqFNbnGsHbun8HLBA7va6I2dkb84pYnGGAgnjqXPN5DMA+xU3zu6c+oX J36ghDx3K3UsKkjquR5oDDpXqElsGrwP/rkxwtwiaW0EkaBxlK891r7OWHy7chygUum//xGbe+2so 7l7fnDtI3x2Ft2Wz95BQh2iXpCtyzgeQJ8y/UX3kKQDHF8k7+7aUhWTLFcGlB0tvGqmrXCruXtVO7 3i444E6IxwLDt8gPY94MQRGkQ9BTWVdO0LktlpDflWMxs+H0q6NJxSl8Wt0nr5IqZZSbnL9PG/+oP fgOiTezw==; 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 1oxOkW-0067UV-KJ; Tue, 22 Nov 2022 08:35:24 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9A56E300322; Tue, 22 Nov 2022 09:35:17 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 1839C2D65BCDA; Tue, 22 Nov 2022 09:35:17 +0100 (CET) Date: Tue, 22 Nov 2022 09:35:17 +0100 From: Peter Zijlstra To: Josh Poimboeuf Cc: "Paul E. McKenney" , sfr@canb.auug.org.au, linux-kernel@vger.kernel.org Subject: Re: objtool warning for next-20221118 Message-ID: References: <20221121040736.GA3738360@paulmck-ThinkPad-P17-Gen-1> <20221121145215.GF4001@paulmck-ThinkPad-P17-Gen-1> <20221122051605.4hcbslwxez2trdvt@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221122051605.4hcbslwxez2trdvt@treble> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Perhaps the best way would be to stick a REACHABLE annotation in arch_cpu_idle_dead() or something? --- diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index c21b7347a26d..0354be027eb0 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -712,6 +712,7 @@ void arch_cpu_idle_enter(void) void arch_cpu_idle_dead(void) { play_dead(); + asm(ASM_REACHABLE); } /*