Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1527252ybl; Sun, 18 Aug 2019 05:24:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPbU/18L3vGGcdoeBd44zBHBjD9S/abhP5KmusWyP4+BPfkXDBrNA9csTlvAI4HZogpYbD X-Received: by 2002:a17:902:2bc8:: with SMTP id l66mr18186869plb.222.1566131043915; Sun, 18 Aug 2019 05:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566131043; cv=none; d=google.com; s=arc-20160816; b=KoBpxVpJm5F454W+S52szuq2ZfdwyLlcMSD8u1fGtWGifKThckm1BBDgiNmykaAHAJ SOYU/v6tYtz2M0nmVQDr6bWsigHMhfSYOT0KTryoEBllCXojQu026pB3C6ZwXZyl2byA JE9CKh2Ix2VZWMwQQ8Me6i18fhSiDvGOtWwzCPGDzmSI9ZTQpnl/i6V3HVj80n9Dp26Y JfoKzwFPhl4L9caDN01P92VaKjJUtVlnV0PogbqXkfNmfSQ9LTMFudUXvUuJZPMrNcGS FTKwkAvVCBljmLbttBxo/5qtXylrxTWhB/ne+YvCLXFmhXIowoQIODJgayYvCy2zaTAt 4EtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=uQM88fruvdF11/JNSj8BvOOooKtkBswWKYQXx8ft4d0=; b=Oan8WVd0O7195ZXrTtfKWcvPLmJWbt7Ej55HvF8TUx2An2QveUMvosUJPIAc36tbEi 534G8ww7KNo6Pi2e6JHkm6DWRZvrQtB127SxgIcOX003GqVP4X6EKWMXtkPTrkJb/Rhq Jzh2rbk2chwhawMWqYqlV8ckEffrA6nFmulA8B09JI2kG6mHAagEo9SL5US/KY78vH6r lDjXHsPCMkjNTKGrGgfWcN8WX+p1hfN0Deb9dPdPVLDeFqs7z2sp6yUpFT5fMphVE1uN PcNKEV1xO/wGy0kmlJpNW5xVepL+6x1P1K/SCYIY/g+ZsRqimzQ0ot/rgZkS5etf5N6s 8NZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x125si7728854pgx.332.2019.08.18.05.23.49; Sun, 18 Aug 2019 05:24:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726652AbfHRMVD (ORCPT + 99 others); Sun, 18 Aug 2019 08:21:03 -0400 Received: from gate.crashing.org ([63.228.1.57]:37001 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726073AbfHRMVD (ORCPT ); Sun, 18 Aug 2019 08:21:03 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x7ICKb2C002871; Sun, 18 Aug 2019 07:20:37 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id x7ICKa2n002870; Sun, 18 Aug 2019 07:20:36 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sun, 18 Aug 2019 07:20:36 -0500 From: Segher Boessenkool To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [RFC PATCH] powerpc: use __builtin_trap() in BUG/WARN macros. Message-ID: <20190818122036.GW31406@gate.crashing.org> References: <20190817183750.D3018106766@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190817183750.D3018106766@localhost.localdomain> User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christophe, On Sat, Aug 17, 2019 at 06:37:50PM +0000, Christophe Leroy wrote: > #define BUG() do { \ > + __builtin_trap(); \ GCC will optimise away all code after this, it knows it is unreachable. But you want to keep that BUG_ENTRY stuff I think? The same will happen with a BUG_ON if the compiler can prove your condition is always true. > __asm__ __volatile__( \ > - "1: twi 31,0,0\n" \ > + "1:\n" \ > _EMIT_BUG_ENTRY \ > : : "i" (__FILE__), "i" (__LINE__), \ > "i" (0), "i" (sizeof(struct bug_entry))); \ (GCC wil generate a different trap btw; what is called "trap" as extended mnemonic, that is, "tw 31,0,0", not the same thing as "twi", if that matters for the exception handler). Segher