Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751590AbdFOAAo (ORCPT ); Wed, 14 Jun 2017 20:00:44 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36158 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751623AbdFOAAm (ORCPT ); Wed, 14 Jun 2017 20:00:42 -0400 Subject: Re: [PATCH kernel] powerpc/debug: Add missing warn flag to WARN_ON's non-builtin path To: Michael Ellerman , linuxppc-dev@lists.ozlabs.org Cc: Benjamin Herrenschmidt , Paul Mackerras , Peter Zijlstra , linux-kernel@vger.kernel.org, "dan.carpenter@oracle.com" References: <20170614030125.45899-1-aik@ozlabs.ru> <87mv9a3k59.fsf@concordia.ellerman.id.au> From: Alexey Kardashevskiy Message-ID: Date: Thu, 15 Jun 2017 10:00:33 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: <87mv9a3k59.fsf@concordia.ellerman.id.au> Content-Type: text/plain; charset=koi8-r Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2293 Lines: 73 On 14/06/17 21:04, Michael Ellerman wrote: > Alexey Kardashevskiy writes: > >> When trapped on WARN_ON(), report_bug() is expected to return >> BUG_TRAP_TYPE_WARN so the caller could increment NIP by 4 and continue. >> The __builtin_constant_p() path of the PPC's WARN_ON() calls (indirectly) >> __WARN_FLAGS() which has BUGFLAG_WARNING set, however the other branch >> does not which makes report_bug() report a bug rather than a warning. >> >> Fixes: 19d436268dde95389 ("debug: Add _ONCE() logic to report_bug()") >> Signed-off-by: Alexey Kardashevskiy >> --- >> >> Actually 19d436268dde95389 replaced __WARN_TAINT() with __WARN_FLAGS() >> and lost BUGFLAG_TAINT() and this is not in the commit log so it is >> unclear: >> 1) why > > I think the rename is because previously the argument was a taint value, > whereas now it is a flags value (which is a superset of taint). > >> 2) whether this particular patch should be doing >> BUGFLAG_WARNING|BUGFLAG_TAINT(TAINT_WARN) >> or >> BUGFLAG_WARNING|(flags) > > There is no flags here so the latter won't work AFAICS. > >> Any ideas? Thanks. > > Your patch looks correct to me. I assume it works? Yes, it does. > > > The bug isn't introduced by 19d436268dde ("debug: Add _ONCE() logic to > report_bug()") as far as I can see. > > If you check out that revision you see that BUGFLAG_TAINT still contains > BUGFLAG_WARNING: > > #define BUGFLAG_TAINT(taint) (BUGFLAG_WARNING | ((taint) << 8)) > > But that was removed in f26dee15103f ("debug: Avoid setting > BUGFLAG_WARNING twice"). So I think the Fixes: tag should point at that > commit. Ah, you're right. Should I repost the patch with the updated "fixes:" clause? > > cheers > >> diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h >> index f2c562a0a427..0151af6c2a50 100644 >> --- a/arch/powerpc/include/asm/bug.h >> +++ b/arch/powerpc/include/asm/bug.h >> @@ -104,7 +104,7 @@ >> "1: "PPC_TLNEI" %4,0\n" \ >> _EMIT_BUG_ENTRY \ >> : : "i" (__FILE__), "i" (__LINE__), \ >> - "i" (BUGFLAG_TAINT(TAINT_WARN)), \ >> + "i" (BUGFLAG_WARNING|BUGFLAG_TAINT(TAINT_WARN)),\ >> "i" (sizeof(struct bug_entry)), \ >> "r" (__ret_warn_on)); \ >> } \ >> -- >> 2.11.0 -- Alexey