From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, TVD_SUBJ_WIPE_DEBT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 201D5C433DB for ; Thu, 11 Feb 2021 10:08:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCC2164E38 for ; Thu, 11 Feb 2021 10:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbhBKKI2 (ORCPT ); Thu, 11 Feb 2021 05:08:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbhBKKFm (ORCPT ); Thu, 11 Feb 2021 05:05:42 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B1FC061756 for ; Thu, 11 Feb 2021 02:05:02 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id fa16so3108384pjb.1 for ; Thu, 11 Feb 2021 02:05:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=6LL6HEN/TlIvgjV/qKDhMJslAnmqizgu+vOTXyLuIe0=; b=p35Rgaoe/NHzNcM//KvM2suJwdKoGxwyruZkUwP7/rBRzL6qGUex30LwZjonYIYVVM olRdWmBoKpOUDcUIHLlviqP7cQhkV72X1Z1LSjDlZZ2AY2kZuhoNARwR63ePu1iclq4+ 0lmqreZ3NBi28ZdDjQPSYWjhu8hMP3Qu0L+7vRfyd/7GrDnGuJYPvic2faoCIgNsCD9E DpW4zTOzFqQv635bnW4w+vfbL6M1/ECRZgXlus2Hw/MLc1F0RRjXThszMn1FLrFakFX/ YOZC+g2WSazUT9PbfxwkQwWeRcMGqsh/3+DIRzab6kk+4v3FKZ0W6Fe2rWAzezQNa63P lymQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=6LL6HEN/TlIvgjV/qKDhMJslAnmqizgu+vOTXyLuIe0=; b=VwBPaLQ2bMAq3xjStxteaJRqYXfOndzAt6xvkQ26ptlPteCJCgjHfNcS4+RzGys9Kd 8/2rbtVXTc8x4EdgYIn1N5FTEGRiZE1cxUf+f02vl+ZuLgtVK5w0TZx66rTRyT0B33BD mRToQJ+Gn41PcEfuDXBN6GuaIlJbZtlKAnW7zJuVaC7qZ8i7u60mC3uLM7kD6FR4D8b+ km3tid+X/BbaVumjCIYKQrGnpeXKlG/sy9WN3+M2b4yGAOjYl4Kukf9R2fXPFie8503k ZctFqdBtrpEoIeOfCfSdoJK1U99VyJrLY+7Q7FyEraDpn3fXyrBesg3Rkbn3y+CUTEfZ 0b8g== X-Gm-Message-State: AOAM530yRegoB4JRF/fMMQslvZF1Oef6jTCvPiPHWkunhbTioVJfmniO Vpfrou3BObWBTahl3lzInI8vlJd/bxo= X-Google-Smtp-Source: ABdhPJw7en9Rdip4b1jO8Tx86JajlxFNgYrdaduyMhSqjEH+ic/FoFQBz2ksbyiZuNfN8ricNnsfSA== X-Received: by 2002:a17:90a:f00b:: with SMTP id bt11mr3236187pjb.76.1613037902231; Thu, 11 Feb 2021 02:05:02 -0800 (PST) Received: from localhost (14-201-150-91.tpgi.com.au. [14.201.150.91]) by smtp.gmail.com with ESMTPSA id i10sm4851813pgt.85.2021.02.11.02.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 02:05:01 -0800 (PST) Date: Thu, 11 Feb 2021 20:04:55 +1000 From: Nicholas Piggin Subject: Re: [PATCH] powerpc/bug: Remove specific powerpc BUG_ON() To: Benjamin Herrenschmidt , Christophe Leroy , Michael Ellerman , Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <694c7195c81d1bcc781b3c14f452886683d6c524.1613029237.git.christophe.leroy@csgroup.eu> In-Reply-To: <694c7195c81d1bcc781b3c14f452886683d6c524.1613029237.git.christophe.leroy@csgroup.eu> MIME-Version: 1.0 Message-Id: <1613036567.zvyupcz926.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Christophe Leroy's message of February 11, 2021 5:41 pm: > powerpc BUG_ON() is based on using twnei or tdnei instruction, > which obliges gcc to format the condition into a 0 or 1 value > in a register. >=20 > By using a generic implementation, gcc will generate a branch > to the unconditional trap generated by BUG(). We don't want to do this on 64s because that will lose the useful CFAR contents. Unfortunately the code generation is not great and the registers that=20 give some useful information about the condition are often mangled :( It would be nice if we could have a __builtin_trap_if that gcc would use=20 conditional traps with, (and which never assumes following code is=20 unreachable even for constant true, so we can use it with WARN and put=20 explicit unreachable for BUG). >=20 > As modern powerpc implement branch folding, that's even more efficient. I think POWER will speculate conditional traps as non faulting always so it should be just as good if not better than the branch. Thanks, Nick