Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1052913imm; Fri, 27 Jul 2018 10:19:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfEZ38F4JunQy6kbScjEPJFcaqAPLw8G0yeCMWPDJXkSJ1ev72jFJN2ARhQe4dUHiHbcLHj X-Received: by 2002:a63:1c5f:: with SMTP id c31-v6mr6999348pgm.321.1532711991473; Fri, 27 Jul 2018 10:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532711991; cv=none; d=google.com; s=arc-20160816; b=WHYHTaeBeKziJ1CACeNGoZMZkeIUayiFopnB0Txri62SeNdwevY0pP9EdmN167sASE kms4XYgfnOMvbqYRYY68fwq/ZnxmjBkBdVVI/hXc9gnU8+v3oM1tK2MZnC7bn8Kw72yF 2BQfn+V6ZqjeS6/4xGJ/EIw0m3Cf72TDnSkXNzW79mrlCIDPkIAx8tBLMg+UM9K/YZtJ zILg0bbcey67/z7MEy73619ZQpW86NacAnk1GruzgSAextBci+Mah8DxH/13qWpythCN hUDxDR6S1DRLRci8acuOI6v2xqEkdoGn5jJBYQfjoJxdaurYW5r+ZAA7n/ntIFi2+ayR Q7dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=Mqmi29P4TofoGUIgnMe7mXkA1eN5VcRZkNZmy0wQC4M=; b=liaWIAEFpck6ToLwxvNUDFU0G58qZam5lsgVlnfiIAeL3185xVunhTUrrtRwKyyGg7 xqQCpqsyuBnqju690kQhFqoNO02d+Lx6zQ/9wFeh/TAs2Bo81eSncNBqi+hQuVJ6fO3V HVankSQ2b7T3Qxseo32JVH5+X9RCxRrLUDs6qd8HCcNaNnYVrQ0YfLobi+YmA2i9G7Ca AlGir9WiP26UPpuJA6S6y3lqc2MG/4kdIKT8BzEsfXkZs+aH7ShXIW77ZEDPsHXz9bqW TpbDZSN+dhFNQid/0GqjObrUTyxxVugKs0Dp6Z2eB7CeVbMviNraW6vOeUGyUX12nL9u 3Vgg== 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 68-v6si4086525pga.113.2018.07.27.10.19.36; Fri, 27 Jul 2018 10:19:51 -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 S2388660AbeG0SlD (ORCPT + 99 others); Fri, 27 Jul 2018 14:41:03 -0400 Received: from smtprelay0229.hostedemail.com ([216.40.44.229]:39774 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728713AbeG0SlC (ORCPT ); Fri, 27 Jul 2018 14:41:02 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id 3BCAB18224D9C; Fri, 27 Jul 2018 17:18:12 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2902:3138:3139:3140:3141:3142:3353:3622:3865:3867:3868:3871:3872:3873:4321:4605:5007:6119:6691:6742:7903:10004:10400:10450:10455:10848:11026:11232:11658:11914:12043:12296:12438:12679:12740:12895:13095:13439:13894:13972:14181:14659:14721:19904:19999:21080:21212:21433:21451:21627:30012:30054:30056:30070:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: waste09_8176f2ae0cf38 X-Filterd-Recvd-Size: 3682 Received: from XPS-9350 (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf09.hostedemail.com (Postfix) with ESMTPA; Fri, 27 Jul 2018 17:18:09 +0000 (UTC) Message-ID: <26f07092cdde378ebb42c1034badde1b56521c36.camel@perches.com> Subject: Re: [PATCH v2 04/10] powerpc/traps: Use REG_FMT in show_signal_msg() From: Joe Perches To: LEROY Christophe , Murilo Opsfelder Araujo Cc: linuxppc-dev@lists.ozlabs.org, "Tobin C . Harding" , Sukadev Bhattiprolu , Simon Guo , Paul Mackerras , Nicholas Piggin , Michael Neuling , Michael Ellerman , "Eric W . Biederman" , Cyril Bur , Benjamin Herrenschmidt , Balbir Singh , Andrew Donnellan , Alastair D'Silva , linux-kernel@vger.kernel.org Date: Fri, 27 Jul 2018 10:18:08 -0700 In-Reply-To: <20180727184023.Horde.KRXPzZpG18uxt_B9sy_FBg5@messagerie.si.c-s.fr> References: <20180727145811.12334-1-muriloo@linux.ibm.com> <20180727145811.12334-5-muriloo@linux.ibm.com> <20180727184023.Horde.KRXPzZpG18uxt_B9sy_FBg5@messagerie.si.c-s.fr> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2018-07-27 at 18:40 +0200, LEROY Christophe wrote: > Murilo Opsfelder Araujo a ?crit : > > > Simplify the message format by using REG_FMT as the register format. This > > avoids having two different formats and avoids checking for MSR_64BIT. > > Are you sure it is what we want ? > > Won't it change the behaviour for a 32 bits app running on a 64bits kernel ? [] > > diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c [] > > @@ -311,17 +311,13 @@ static bool show_unhandled_signals_ratelimited(void) > > static void show_signal_msg(int signr, struct pt_regs *regs, int code, > > unsigned long addr) > > { > > - const char fmt32[] = KERN_INFO "%s[%d]: unhandled signal %d " \ > > - "at %08lx nip %08lx lr %08lx code %x\n"; > > - const char fmt64[] = KERN_INFO "%s[%d]: unhandled signal %d " \ > > - "at %016lx nip %016lx lr %016lx code %x\n"; > > - > > if (!unhandled_signal(current, signr)) > > return; > > > > - printk(regs->msr & MSR_64BIT ? fmt64 : fmt32, > > - current->comm, current->pid, signr, > > - addr, regs->nip, regs->link, code); > > + pr_info("%s[%d]: unhandled signal %d at "REG_FMT \ I think it better to use a space after the close " and also the line continuation is unnecessary. > > + " nip "REG_FMT" lr "REG_FMT" code %x\n", And spaces before the open quotes too. I'd also prefer the format on a single line: pr_info("%s[%d]: unhandled signal %d at " REG_FMT " nip " REG_FMT " lr " REG_FMT " code %x\n", > > + current->comm, current->pid, signr, addr, > > + regs->nip, regs->link, code); Seeing as these are all unsigned long, a better way to do this is to use %p and cast to pointer. This might be better anyway as this output exposes pointer addresses and instead would now use pointer hashed output. pr_info("%s[%d]: unhandled signal %d at %p nip %p lr %p code %x\n", current->comm, current->pid, signr, (void *)addr, (void *)regs->nip, (void *)regs->link, code); Use %px if you _really_ need to emit unhashed addresses. see: Documentation/core-api/printk-formats.rst