Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4950980imm; Tue, 31 Jul 2018 03:02:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeKFgntooVNELcZ3zi4qAnXkCLqxW41mRShK84akycAWGRGopzIfIGG7BIMVNlHDNzKT0jl X-Received: by 2002:a62:c819:: with SMTP id z25-v6mr21298330pff.44.1533031339385; Tue, 31 Jul 2018 03:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533031339; cv=none; d=google.com; s=arc-20160816; b=qP4bjj60ghvdXweThtwAmiQ78SQRJxoNhi0AQQidJyGHdPi39spdlPBrfVudU8AbCT ugGpRbggIbvTf7VX9qgg855nyPTUD9Vd55WQsx3eKdl1bB7R8184BsQDq2n3g0LT7b3g 8kCJXBP72wzg/LQQHspKeedy7FNujfsX6ECmQ+lETWc5vgsHjpS/pEnEn6Sev6WW2euk NLMos7LvZHlIvYTJu5cFw6IkgI1Q9eZ3HYsknsjUsgWgKUpnC45QmBGZ46mmaBjfNIYK I39Ofvd4o1odGaFiwKMakkxm4YtFkbeYsOKLOM1p/Q97OKyhZtWPdF2TgRCQdrHcMrFJ bPgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from:arc-authentication-results; bh=IOHx3fUio+wPbR2lVN25B0Jf7fJM4vrvz7CxqiB2yQA=; b=ZtMnCJ7EKgBF1QTHVpHUOuqNBg0DcVqdPCmsvD87WqT2I8XGdggNfFW13ijPuRqgkM 4zqWpD+Uij8Xfj2Pte2eITVPjZGvD50fX64EckGjI054JWCip1zrMxJntmyH3gLS1Neg kBFokDI58pyU8W37xkJ6qDUK7mY3Z3tjtzQs2laVjhmgeP8bQ90vh/Mgiq+YShcWx5gL Q5yjTQku4FaKlKcmXgoSlkO3xbOJVKj04QxVMi4lqY4ntE+1Ros8Zk8qV+V8przNac2e gJfDpBtZDxowur5kNCrvaOCGm/Sl2EulXBvBtOvU3CPJLKOKhYV48V5ecpXEKeYmIGYV yy2A== 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 f32-v6si12286458pgb.506.2018.07.31.03.02.04; Tue, 31 Jul 2018 03:02:19 -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 S1731722AbeGaLkg convert rfc822-to-8bit (ORCPT + 99 others); Tue, 31 Jul 2018 07:40:36 -0400 Received: from ushosting.nmnhosting.com ([167.160.173.127]:49530 "EHLO ushosting.nmnhosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730422AbeGaLkg (ORCPT ); Tue, 31 Jul 2018 07:40:36 -0400 X-Greylist: delayed 456 seconds by postgrey-1.27 at vger.kernel.org; Tue, 31 Jul 2018 07:40:35 EDT Received: from mail2.nmnhosting.com (unknown [202.78.40.170]) by ushosting.nmnhosting.com (Postfix) with ESMTPS id 8BDF42F202BE; Tue, 31 Jul 2018 05:53:22 -0400 (EDT) Received: from Hawking (202-78-40-170.lei.net.au [202.78.40.170] (may be forged)) (authenticated bits=0) by mail2.nmnhosting.com (8.15.2/8.15.2) with ESMTPSA id w6V9qf9v055147 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 31 Jul 2018 19:52:56 +1000 (AEST) (envelope-from alastair@d-silva.org) From: "Alastair D'Silva" To: "'Michael Ellerman'" , "'Murilo Opsfelder Araujo'" , "'LEROY Christophe'" Cc: , "'Andrew Donnellan'" , "'Balbir Singh'" , "'Benjamin Herrenschmidt'" , "'Cyril Bur'" , "'Eric W . Biederman'" , "'Joe Perches'" , "'Michael Neuling'" , "'Nicholas Piggin'" , "'Paul Mackerras'" , "'Simon Guo'" , "'Sukadev Bhattiprolu'" , "'Tobin C . Harding'" , 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> <20180730152838.GA23704@kermit-br-ibm-com> <20180730183047.Horde.g9hQ_3EXmF6St0upNs2DDw1@messagerie.si.c-s.fr> <20180730231738.GA20351@kermit-br-ibm-com> <87va8vhhsj.fsf@concordia.ellerman.id.au> In-Reply-To: <87va8vhhsj.fsf@concordia.ellerman.id.au> Subject: RE: [PATCH v2 04/10] powerpc/traps: Use REG_FMT in show_signal_msg() Date: Tue, 31 Jul 2018 19:52:35 +1000 Message-ID: <072401d428b4$4c0f4340$e42dc9c0$@d-silva.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFlYMq3IkjUBeR9VdpWQycT384V2gEpXXI7AnHVZmwB7lZhVQHpdJOTAf5UMQ0CS/hRwaUou+oA Content-Language: en-au X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail2.nmnhosting.com [10.0.1.20]); Tue, 31 Jul 2018 19:53:15 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Michael Ellerman > Sent: Tuesday, 31 July 2018 7:32 PM > To: Murilo Opsfelder Araujo ; LEROY Christophe > > Cc: linux-kernel@vger.kernel.org; Alastair D'Silva ; > Andrew Donnellan ; Balbir Singh > ; Benjamin Herrenschmidt > ; Cyril Bur ; Eric W . > Biederman ; Joe Perches ; > Michael Neuling ; Nicholas Piggin > ; Paul Mackerras ; Simon Guo > ; Sukadev Bhattiprolu > ; Tobin C . Harding ; linuxppc- > dev@lists.ozlabs.org > Subject: Re: [PATCH v2 04/10] powerpc/traps: Use REG_FMT in > show_signal_msg() > > Murilo Opsfelder Araujo writes: > > On Mon, Jul 30, 2018 at 06:30:47PM +0200, LEROY Christophe wrote: > >> Murilo Opsfelder Araujo a écrit : > >> > On Fri, Jul 27, 2018 at 06:40:23PM +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 ? > >> > > >> > Yes. > >> > > >> > > Won't it change the behaviour for a 32 bits app running on a 64bits > kernel ? > >> > > >> > In fact, this changes how many zeroes are prefixed when displaying > >> > the registers (%016lx vs. %08lx format). For example, 32-bits > >> > userspace, 64-bits kernel: > >> > >> Indeed that's what I suspected. What is the real benefit of this change ? > >> Why not keep the current format for 32bits userspace ? All those > >> leading zeroes are pointless to me. > > > > One of the benefits is simplifying the code by removing some checks. > > Another is deduplicating almost identical format strings in favor of a unified > one. > > > > After reading Joe's comment [1], %px seems to be the format we're > looking for. > > An extract from Documentation/core-api/printk-formats.rst: > > > > "%px is functionally equivalent to %lx (or %lu). %px is preferred because it > > is more uniquely grep'able." > > > > So I guess we don't need to worry about the format (%016lx vs. %08lx), > > let's just use %px, as per the guideline. > > I don't think I like %px. Me neither, semantically, it's for pointers, and the data being displayed is not a pointer. > It makes the format string cleaner, but it means we have to cast everything > to void * which is ugly as heck. > > I actually don't think the leading zeroes are helpful at all in the signal > message, ie. we should just use %lx there. > > They are useful in show_regs() because we want everything to line up. > > So I think I'll drop patch 3 and use 0x%lx in show_signal_msg(), meaning we > end up with, eg: > > [ 73.414535] segv[3759]: segfault (11) at 0x0 nip 0x10000420 lr 0xfe61854 > code 0x1 in segv[10000000+10000] > [ 73.414641] segv[3759]: code: 4e800421 80010014 38210010 7c0803a6 > 4bffff30 9421ffd0 93e1002c 7c3f0b78 > [ 73.414665] segv[3759]: code: 39200000 913f001c 813f001c 39400001 > <91490000> 39200000 7d234b78 397f0030 Or better yet, "%#lx" - the hash adds the appropriate prefix in the right case for the format. -- Alastair D'Silva mob: 0423 762 819 skype: alastair_dsilva msn: alastair@d-silva.org blog: http://alastair.d-silva.org Twitter: @EvilDeece