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=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 D6AB9C3A5A0 for ; Sat, 18 Apr 2020 20:43:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD56E21D6C for ; Sat, 18 Apr 2020 20:43:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728155AbgDRUnG (ORCPT ); Sat, 18 Apr 2020 16:43:06 -0400 Received: from smtprelay0199.hostedemail.com ([216.40.44.199]:41158 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726014AbgDRUnF (ORCPT ); Sat, 18 Apr 2020 16:43:05 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id C8D98100E7B43; Sat, 18 Apr 2020 20:43:03 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: bikes51_54543769da122 X-Filterd-Recvd-Size: 3474 Received: from XPS-9350.home (unknown [47.151.136.130]) (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA; Sat, 18 Apr 2020 20:42:59 +0000 (UTC) Message-ID: <24a1f021e52ccabfd53baa22b93947ef10e6bf3b.camel@perches.com> Subject: Re: [PATCHv3 01/50] kallsyms/printk: Add loglvl to print_ip_sym() From: Joe Perches To: Dmitry Safonov , linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Andrew Morton , Greg Kroah-Hartman , Ingo Molnar , Jiri Slaby , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Tetsuo Handa , Albert Ou , Ben Segall , Dietmar Eggemann , Greentime Hu , Ingo Molnar , James Hogan , Juri Lelli , Mel Gorman , Michal Simek , Palmer Dabbelt , Paul Burton , Paul Walmsley , Peter Zijlstra , Ralf Baechle , Thomas Gleixner , Vincent Chen , Vincent Guittot , Will Deacon , linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org Date: Sat, 18 Apr 2020 13:40:45 -0700 In-Reply-To: <20200418201944.482088-2-dima@arista.com> References: <20200418201944.482088-1-dima@arista.com> <20200418201944.482088-2-dima@arista.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2020-04-18 at 21:18 +0100, Dmitry Safonov wrote: > print_ip_sym() needs to have a log level parameter to comply with other > parts being printed. Otherwise, half of the expected backtrace would be > printed and other may be missing with some logging level. I'd rather create another extension to %ps that also emits the [
] along with the symbol lookup and retire print_ip_sym altogether. Something like: --- lib/vsprintf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 7c488a..8fce8f 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2072,6 +2072,8 @@ char *fwnode_string(char *buf, char *end, struct fwnode_handle *fwnode, * - 'S' For symbolic direct pointers (or function descriptors) with offset * - 's' For symbolic direct pointers (or function descriptors) without offset * - '[Ss]R' as above with __builtin_extract_return_addr() translation + * - '[Ss]B' [
] and symbolic direct pointers as above + * (was used previously used as print_ip_sym) * - '[Ff]' %pf and %pF were obsoleted and later removed in favor of * %ps and %pS. Be careful when re-using these specifiers. * - 'B' For backtraced symbolic direct pointers with offset @@ -2183,6 +2185,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, case 'S': case 's': ptr = dereference_symbol_descriptor(ptr); + if (fmt[1] == 'B') + buf += vsprintf(buf, end, "[<%px>] ", ptr); /* Fallthrough */ case 'B': return symbol_string(buf, end, ptr, spec, fmt); 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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 C25EBC38A30 for ; Sat, 18 Apr 2020 20:43:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 957E821D6C for ; Sat, 18 Apr 2020 20:43:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mrxV10tn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 957E821D6C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cLDkEWgVzRQV1VKAKDzCjiILlinOI2S6nU1JABdlLig=; b=mrxV10tnSrG6i9 dXzdTG3cGp2NFyu2Fh+orwjvhGgsT9AsGTCzqnvJ31YxaGQZkBL0Qkn1giH2wJgrHUXtPRzzygAja u5jz+Al0U6B/JWWiCXjldAGPkrFnUnJP+PePpNJtPvnYz+TjGRFURmuf5K2FXsH/Zpr33VeVumbxe dY1UcsEluv7xpr6JlfrZw2aPLGB3UjcasUfJ0UbDkDe76W/UGfB9+bA5Sm47gY+O0c8u2JOnAhTZZ Eb3iap7+bQZgRFVWncmQBiCtRZ55518rmceJX40PHSPoDDV+HZwxGKKY2tL8KLzHRDkKD6p/pel+L K3PFgmeRF+dQfelCcDKA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPuIv-0001p8-Lo; Sat, 18 Apr 2020 20:43:09 +0000 Received: from smtprelay0153.hostedemail.com ([216.40.44.153] helo=smtprelay.hostedemail.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPuIt-0001ol-1i for linux-riscv@lists.infradead.org; Sat, 18 Apr 2020 20:43:08 +0000 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id C8D98100E7B43; Sat, 18 Apr 2020 20:43:03 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: bikes51_54543769da122 X-Filterd-Recvd-Size: 3474 Received: from XPS-9350.home (unknown [47.151.136.130]) (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA; Sat, 18 Apr 2020 20:42:59 +0000 (UTC) Message-ID: <24a1f021e52ccabfd53baa22b93947ef10e6bf3b.camel@perches.com> Subject: Re: [PATCHv3 01/50] kallsyms/printk: Add loglvl to print_ip_sym() From: Joe Perches To: Dmitry Safonov , linux-kernel@vger.kernel.org Date: Sat, 18 Apr 2020 13:40:45 -0700 In-Reply-To: <20200418201944.482088-2-dima@arista.com> References: <20200418201944.482088-1-dima@arista.com> <20200418201944.482088-2-dima@arista.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200418_134307_152137_4637782F X-CRM114-Status: UNSURE ( 8.49 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juri Lelli , Tetsuo Handa , James Hogan , Dmitry Safonov <0x7f454c46@gmail.com>, Ben Segall , linux-riscv@lists.infradead.org, Vincent Chen , Will Deacon , Ingo Molnar , Vincent Guittot , Paul Burton , Peter Zijlstra , Ingo Molnar , Mel Gorman , Jiri Slaby , Petr Mladek , Albert Ou , Steven Rostedt , Greentime Hu , Paul Walmsley , Thomas Gleixner , Dietmar Eggemann , Michal Simek , Greg Kroah-Hartman , linux-mips@vger.kernel.org, Ralf Baechle , Sergey Senozhatsky , Palmer Dabbelt , Andrew Morton Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org On Sat, 2020-04-18 at 21:18 +0100, Dmitry Safonov wrote: > print_ip_sym() needs to have a log level parameter to comply with other > parts being printed. Otherwise, half of the expected backtrace would be > printed and other may be missing with some logging level. I'd rather create another extension to %ps that also emits the [
] along with the symbol lookup and retire print_ip_sym altogether. Something like: --- lib/vsprintf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 7c488a..8fce8f 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -2072,6 +2072,8 @@ char *fwnode_string(char *buf, char *end, struct fwnode_handle *fwnode, * - 'S' For symbolic direct pointers (or function descriptors) with offset * - 's' For symbolic direct pointers (or function descriptors) without offset * - '[Ss]R' as above with __builtin_extract_return_addr() translation + * - '[Ss]B' [
] and symbolic direct pointers as above + * (was used previously used as print_ip_sym) * - '[Ff]' %pf and %pF were obsoleted and later removed in favor of * %ps and %pS. Be careful when re-using these specifiers. * - 'B' For backtraced symbolic direct pointers with offset @@ -2183,6 +2185,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, case 'S': case 's': ptr = dereference_symbol_descriptor(ptr); + if (fmt[1] == 'B') + buf += vsprintf(buf, end, "[<%px>] ", ptr); /* Fallthrough */ case 'B': return symbol_string(buf, end, ptr, spec, fmt);