Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2297203ybv; Mon, 24 Feb 2020 02:50:28 -0800 (PST) X-Google-Smtp-Source: APXvYqx5XYwcGbCs0yi5esDJSbzr6lH/+rSg8T0tQzZVPzmY27pLza9kiYyqkpMwzkgN64QvXh9W X-Received: by 2002:a05:6808:4cc:: with SMTP id a12mr12583578oie.115.1582541428836; Mon, 24 Feb 2020 02:50:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582541428; cv=none; d=google.com; s=arc-20160816; b=YxkWLAnlyEOAAoyjpbd7JIa+64ser3lXPAvKecKrG4hqS1b7WE+VA+rkfveOaT3/Ys Hbh8hicvyXk+bzMw6qVY785mxWe68cX6ZWS6zid0xWZsk3prImwO0f2EpyziZMANgMAo HqxGunwCMxJzzA8pr8elpkoSUP0UNKUm9fRBT+RZUJYHAbD/P9iWXb3+pj60BtQiXhPn LY8VkCr6jlamVS9EQEB7wBlWzgeWesA/mfy5sCQf0pHMQcOp0Y0lSgLu0OtE9AQmMA0m 9kt1T1qaR03tsfSpIKcxD3C6BokmE2UI/Ct4rc5HJiGVU3nfrvaptGc2jESy6uj9h1Hi TrtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=bhzSGzXhzKysVrlK1AEhf+iYyNTiMJMgVIPp8zQrpu0=; b=eJO9jMG2QOCfWTvViBc8njJBhN8HdJF4iV/4rofVx8soynzJxO7o3UpdrCcvu9laui iGzBVTrQvN93aC466MIj0z4Ks6hiKXmKIJBPr28ZuK8s3f0MZa+PXrHr7BFufrSKavm9 o+kRswy39HlujOqvW0ALkShcvjPpiR4OmSNk6Gx3fK6eHlOyOtudjY2Q2ieSRDjKOBTD qs/33s1cc9BDXMKxFWGkNIc8Rs4VScuQc/pPNCgywoz2NNpuGzQcMoWIBraL1T7M1j1F GCRx/9asLVtyR4iostYV9A+1tADuP6kqwy2G2DwcIkpw/cDJTusXgMVpuYTbzWPCwVbb sFVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b="VxO9///u"; 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 m82si4722418oig.129.2020.02.24.02.50.16; Mon, 24 Feb 2020 02:50:28 -0800 (PST) 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; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b="VxO9///u"; 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 S1727310AbgBXKsd (ORCPT + 99 others); Mon, 24 Feb 2020 05:48:33 -0500 Received: from bilbo.ozlabs.org ([203.11.71.1]:50395 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726778AbgBXKsd (ORCPT ); Mon, 24 Feb 2020 05:48:33 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 48QzLj0yR2z9sP7; Mon, 24 Feb 2020 21:48:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1582541309; bh=706Vp/HHmo+lrWjl+3TUImaROxTZwoAKGRpck8URTZ0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=VxO9///uot9PqW/pBL7CbpvXKurwqJJXDD+1rHaEkqYGJbz4JApxRwSgEaG9JgiqY MSCgqTqNjbWiX6c2l99XfmIGaQNylMpN1+ZkxmymBClnJPLLnJD9K7G88fx4+ZfF0y ioriFn8/lOj7U6uP6L/mIsS2lTjetKpbH++Odf0j0sNcP4KV4CcQFsJniBZ1it730B eIjaSQcPF6HJrEasbl825N2kn5tFd//X4L/YOjr4vi1DuxJhSx1KZ82piqRDLrdSMz ZhbII0tBnxb80mqFiTlA/Uv1d5iuYPxemFVFdzdX7ANLmAmeTzi8K6WhZ9k5st/eLe RWCUH81LjTiAA== From: Michael Ellerman To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , mikey@neuling.org Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [RFC PATCH v2 02/12] powerpc/ptrace: drop unnecessary #ifdefs CONFIG_PPC64 In-Reply-To: <34af3942cd27f6b5365caae772fb8e0af44763d5.1561735587.git.christophe.leroy@c-s.fr> References: <34af3942cd27f6b5365caae772fb8e0af44763d5.1561735587.git.christophe.leroy@c-s.fr> Date: Mon, 24 Feb 2020 21:48:26 +1100 Message-ID: <878sks1csl.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Christophe Leroy writes: > Drop a bunch of #ifdefs CONFIG_PPC64 that are not vital. > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/include/asm/ptrace.h | 9 ++++----- > arch/powerpc/include/uapi/asm/ptrace.h | 12 ++++-------- > arch/powerpc/kernel/ptrace/ptrace.c | 24 +++--------------------- > 3 files changed, 11 insertions(+), 34 deletions(-) > > diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h > index faa5a338ac5a..1506a9c61d50 100644 > --- a/arch/powerpc/include/asm/ptrace.h > +++ b/arch/powerpc/include/asm/ptrace.h > @@ -36,11 +36,10 @@ struct pt_regs > unsigned long link; > unsigned long xer; > unsigned long ccr; > -#ifdef CONFIG_PPC64 > - unsigned long softe; > -#else > - unsigned long mq; > -#endif > + union { > + unsigned long softe; > + unsigned long mq; > + }; > unsigned long trap; > unsigned long dar; > unsigned long dsisr; > diff --git a/arch/powerpc/include/uapi/asm/ptrace.h b/arch/powerpc/include/uapi/asm/ptrace.h > index f5f1ccc740fc..37d7befbb8dc 100644 > --- a/arch/powerpc/include/uapi/asm/ptrace.h > +++ b/arch/powerpc/include/uapi/asm/ptrace.h > @@ -43,12 +43,11 @@ struct pt_regs > unsigned long link; > unsigned long xer; > unsigned long ccr; > -#ifdef __powerpc64__ > - unsigned long softe; /* Soft enabled/disabled */ > -#else > - unsigned long mq; /* 601 only (not used at present) */ > + union { > + unsigned long softe; /* Soft enabled/disabled */ > + unsigned long mq; /* 601 only (not used at present) */ > /* Used on APUS to hold IPL value. */ > -#endif > + }; As Andreas pointed out this is not safe as this is a uapi header. > unsigned long trap; /* Reason for being here */ > /* N.B. for critical exceptions on 4xx, the dar and dsisr > fields are overloaded to hold srr0 and srr1. */ > @@ -105,11 +104,8 @@ struct pt_regs > #define PT_LNK 36 > #define PT_XER 37 > #define PT_CCR 38 > -#ifndef __powerpc64__ > #define PT_MQ 39 > -#else > #define PT_SOFTE 39 > -#endif I'd also rather leave that as it is. There's a slim chance it could break some code that already has either of those defined. If you need them both defined to make other code work in the kernel that's fine, in the kernel header we can do: // Ensure these are always defined inside the kernel to avoid #ifdefs #ifdef CONFIG_PPC64 #define PT_MQ 39 #else #define PT_SOFTE 39 #endif > #define PT_TRAP 40 > #define PT_DAR 41 > #define PT_DSISR 42 > diff --git a/arch/powerpc/kernel/ptrace/ptrace.c b/arch/powerpc/kernel/ptrace/ptrace.c > index 684b0b315c32..0afb223c4d57 100644 > --- a/arch/powerpc/kernel/ptrace/ptrace.c > +++ b/arch/powerpc/kernel/ptrace/ptrace.c > @@ -113,11 +113,8 @@ static const struct pt_regs_offset regoffset_table[] = { > REG_OFFSET_NAME(link), > REG_OFFSET_NAME(xer), > REG_OFFSET_NAME(ccr), > -#ifdef CONFIG_PPC64 > REG_OFFSET_NAME(softe), > -#else > REG_OFFSET_NAME(mq), > -#endif Pretty sure that will cause breakage. The offset is ABI. cheers