Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp48762imw; Mon, 4 Jul 2022 05:07:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1scJ9eylm426kBRd7MdLlRd3G38pKvjAomPe7KhQ9dF+82fGC2qFtwcWAAkSf0RjBMrjWVD X-Received: by 2002:a05:6402:5207:b0:435:a27b:88f7 with SMTP id s7-20020a056402520700b00435a27b88f7mr39323967edd.22.1656936467920; Mon, 04 Jul 2022 05:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656936467; cv=none; d=google.com; s=arc-20160816; b=xBJoSA3xO3ivFvjCblvfNtIXOBe3ngB1QsCFTlhItF1us5uShxrdN258eRwnXR3w7i eVj1VG5+osiowwzDqmFjcWJn2ly+oMyQgWfbXsGidgkicwsVLc3z3ETchtb0he6VHYEm 1ilqDmaXZ1cKMHz4P3JKdY53a2G/D6sU7BJvSJ4s0+coBhRWUNp11gm8KXBjQOqwwfHN GmQUeJP+xl3Jn0NTSolgTVjoIBMP8zcAHaOZC7/awbAWC5xWLkPp8jQAC5YV70Cmvs70 4bbW93DOSf4hPrYyAtz449S1oNDq00hjBp+f/4XsVDBcL56bLUe3NzMfmifGm6sqnUNU dGcQ== 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=oRxEExQGS51+M6WTe0WINDdntAU5Zr4k/poXigFL9/0=; b=qodhp4wuGUAJbE2Umcieex241688u0JetqG6+enXzbKxnfm/WGBzAJZrlNd2pBT7oW GRhq4IMQYL7ynQjtw+XwgWVT5SO02gegcTn8hNut2zpBFxVyNrpCHJFCsRK5HdIy3nyO R/zzU9/5nM0tL/SN5kGAOikHh7eneO6f0CI+z64nWDunWe2g/7AMIWqbO33KBxpUpcc8 ZSXenRmHIbxsijWSQodUP47Y4Kr1ltInyinT8yNYOfR25DzGQulHlhn10SZuXe/Vqe4K cRD23I7XTgwY920nHUHXHoIW2OmX35fZTjk1XVaXzxdGOqlRrol+slWikdkzyKmNjMhe H9zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=nTR50Xlt; 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 qf2-20020a1709077f0200b007262cd54996si37498718ejc.457.2022.07.04.05.07.22; Mon, 04 Jul 2022 05:07:47 -0700 (PDT) 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=nTR50Xlt; 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 S233445AbiGDMCQ (ORCPT + 99 others); Mon, 4 Jul 2022 08:02:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbiGDMCO (ORCPT ); Mon, 4 Jul 2022 08:02:14 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4458D11824 for ; Mon, 4 Jul 2022 05:02:13 -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=oRxEExQGS51+M6WTe0WINDdntAU5Zr4k/poXigFL9/0=; b=nTR50XltwL+mBbqsdP+QoMm9wn VSHAFb183oqYta6DoOt5wmkBwjWtV5zR6H5s22nxpHuzDdV5GFM28RKggvvuLDa5EQvKY+ebG8xuw GgFONDiYmlLpq3uK0rv4DYfSfbHOteYsj9ptpSQNOPVHX0bWb3O89/GjQi180IuY6xkZDw2uj8Gx6 wpG+oeboK7Xy/7UI3LSH6ZahL9DwKWjoxoO7xIa1SncyjZBwMZOMPOg+xZiwbFwV1xLAJCDRZ6wLx ziomw1HwDOEJaP50X4tmRMZSxhgqdhj0qYtyNg33R3i9yzHOuFfNC2OUgZD9gmAgI32Wfu7dblN5j /Xp9AdlQ==; Received: from dhcp-077-249-017-003.chello.nl ([77.249.17.3] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1o8Klv-00HEd0-PZ; Mon, 04 Jul 2022 12:01:47 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 17333300252; Mon, 4 Jul 2022 14:01:47 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F15FA2028F029; Mon, 4 Jul 2022 14:01:46 +0200 (CEST) Date: Mon, 4 Jul 2022 14:01:46 +0200 From: Peter Zijlstra To: Segher Boessenkool Cc: "Naveen N. Rao" , Christophe Leroy , "linuxppc-dev@lists.ozlabs.org" , Sathvika Vasireddy , Sathvika Vasireddy , Marc Zyngier , "aik@ozlabs.ru" , "linux-kernel@vger.kernel.org" , "rostedt@goodmis.org" , "mingo@redhat.com" , "paulus@samba.org" , "jpoimboe@redhat.com" , "mbenes@suse.cz" , Chen Zhongjin , Linux ARM Subject: Re: [RFC PATCH v3 11/12] powerpc: Remove unreachable() from WARN_ON() Message-ID: References: <20220624183238.388144-1-sv@linux.ibm.com> <20220624183238.388144-12-sv@linux.ibm.com> <70b6d08d-aced-7f4e-b958-a3c7ae1a9319@csgroup.eu> <92eae2ef-f9b6-019a-5a8e-728cdd9bbbc0@linux.vnet.ibm.com> <1656572413.pbaqjnrrcl.naveen@linux.ibm.com> <1656583960.0nqsj977sr.naveen@linux.ibm.com> <20220630155811.GK25951@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220630155811.GK25951@gate.crashing.org> 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,T_SCC_BODY_TEXT_LINE 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 Thu, Jun 30, 2022 at 10:58:11AM -0500, Segher Boessenkool wrote: > On Thu, Jun 30, 2022 at 04:07:47PM +0530, Naveen N. Rao wrote: > > Objtool classifies 'ud2' as INSN_BUG, and 'int3' as INSN_TRAP. In x86 > > BUG(), there is no need for an annotation since objtool assumes that > > 'ud2' terminates control flow. But, for __WARN_FLAGS(), since 'ud2' is > > used, an explicit annotate_reachable() is needed. That's _reachable_, to > > indicate that the control flow can continue with the next instruction. > > > > On powerpc, we should (eventually) classify all trap variants as > > INSN_TRAP. Even in the absence of that classification today, objtool > > assumes that control flow continues with the next instruction. With your > > work to utilize asm goto for __WARN_FLAGS(), with no extra instructions > > being generated, I think it is appropriate to just use > > __builtin_unreachable() and to not use the annotation. > > > > In any case, we are only hitting this since gcc is generating a 'bl' due > > to that annotation. We are not yet enabling full objtool validation on > > powerpc, so I think we can revisit this at that point. > > See also that asks for a __builtin_trap() > variant that does not terminate control flow ("that is recoverable"). Re comment 9 there, x86 must assume ud2 will abort. If the compiler were to emit ud2 for non-abort purposes then it needs to somehow annotate this so that both objtool and the kernel can determine this. That said; the whole annotate_reachable() thing in our WARN is superfluous, we should read __bug_table instead. That said, we still need _ASM_REACHABLE to handle a few noreturn cases, so there is no real pressing reason to go clean that up. (if only the compiler would tell us about noreturn) ARM has an immediate in their break instruction and varies the desired behaviour depending on the immediate.