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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 E1C68C64E7A for ; Tue, 1 Dec 2020 06:27:45 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2A3C20757 for ; Tue, 1 Dec 2020 06:27:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2A3C20757 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4ClXG60qMyzDr0R for ; Tue, 1 Dec 2020 17:27:42 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4ClXD15bh2zDqrW for ; Tue, 1 Dec 2020 17:25:43 +1100 (AEDT) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4ClXCj3vNPz9txxS; Tue, 1 Dec 2020 07:25:37 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id JYY3puAw4Z9I; Tue, 1 Dec 2020 07:25:37 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4ClXCj35B8z9txxR; Tue, 1 Dec 2020 07:25:37 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 413318B79E; Tue, 1 Dec 2020 07:25:38 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Wz7KSnzgPyUC; Tue, 1 Dec 2020 07:25:38 +0100 (CET) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E5EF98B769; Tue, 1 Dec 2020 07:25:37 +0100 (CET) Subject: Re: [PATCH v2] powerpc: Allow relative pointers in bug table entries To: Jordan Niethe , linuxppc-dev@lists.ozlabs.org References: <20201201005203.15210-1-jniethe5@gmail.com> From: Christophe Leroy Message-ID: Date: Tue, 1 Dec 2020 07:25:38 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201201005203.15210-1-jniethe5@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Le 01/12/2020 à 01:52, Jordan Niethe a écrit : > This enables GENERIC_BUG_RELATIVE_POINTERS on Power so that 32-bit > offsets are stored in the bug entries rather than 64-bit pointers. > While this doesn't save space for 32-bit machines, use it anyway so > there is only one code path. > > Signed-off-by: Jordan Niethe Reviewed-by: Christophe Leroy Tested-by: Christophe Leroy # on PPC32 > --- > v2: Remove non-relative pointers code > --- > arch/powerpc/Kconfig | 4 ++++ > arch/powerpc/include/asm/bug.h | 8 ++++---- > arch/powerpc/xmon/xmon.c | 4 ++-- > 3 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index e9f13fe08492..294108e0e5c6 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -311,6 +311,10 @@ config GENERIC_BUG > default y > depends on BUG > > +config GENERIC_BUG_RELATIVE_POINTERS > + def_bool y > + depends on GENERIC_BUG > + > config SYS_SUPPORTS_APM_EMULATION > default y if PMAC_APM_EMU > bool > diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h > index 338f36cd9934..ba0500872cce 100644 > --- a/arch/powerpc/include/asm/bug.h > +++ b/arch/powerpc/include/asm/bug.h > @@ -12,7 +12,7 @@ > #ifdef CONFIG_DEBUG_BUGVERBOSE > .macro EMIT_BUG_ENTRY addr,file,line,flags > .section __bug_table,"aw" > -5001: PPC_LONG \addr, 5002f > +5001: .4byte \addr - 5001b, 5002f - 5001b > .short \line, \flags > .org 5001b+BUG_ENTRY_SIZE > .previous > @@ -23,7 +23,7 @@ > #else > .macro EMIT_BUG_ENTRY addr,file,line,flags > .section __bug_table,"aw" > -5001: PPC_LONG \addr > +5001: .4byte \addr - 5001b > .short \flags > .org 5001b+BUG_ENTRY_SIZE > .previous > @@ -36,14 +36,14 @@ > #ifdef CONFIG_DEBUG_BUGVERBOSE > #define _EMIT_BUG_ENTRY \ > ".section __bug_table,\"aw\"\n" \ > - "2:\t" PPC_LONG "1b, %0\n" \ > + "2:\t.4byte 1b - 2b, %0 - 2b\n" \ > "\t.short %1, %2\n" \ > ".org 2b+%3\n" \ > ".previous\n" > #else > #define _EMIT_BUG_ENTRY \ > ".section __bug_table,\"aw\"\n" \ > - "2:\t" PPC_LONG "1b\n" \ > + "2:\t.4byte 1b - 2b\n" \ > "\t.short %2\n" \ > ".org 2b+%3\n" \ > ".previous\n" > diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c > index 55c43a6c9111..9704c81aff7d 100644 > --- a/arch/powerpc/xmon/xmon.c > +++ b/arch/powerpc/xmon/xmon.c > @@ -1745,9 +1745,9 @@ static void print_bug_trap(struct pt_regs *regs) > > #ifdef CONFIG_DEBUG_BUGVERBOSE > printf("kernel BUG at %s:%u!\n", > - bug->file, bug->line); > + (char *)bug + bug->file_disp, bug->line); > #else > - printf("kernel BUG at %px!\n", (void *)bug->bug_addr); > + printf("kernel BUG at %px!\n", (void *)bug + bug->bug_addr_disp); > #endif > #endif /* CONFIG_BUG */ > } >