Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2203135yba; Thu, 25 Apr 2019 12:19:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqw53mqHu4MaZv+LktDnLsUXINCKXOiEHkvcHY8+g3zYK7x9QpKJL+lgDwP9peMFai0Y8i+3 X-Received: by 2002:a17:902:8488:: with SMTP id c8mr19840741plo.192.1556219978160; Thu, 25 Apr 2019 12:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556219978; cv=none; d=google.com; s=arc-20160816; b=PKDzDRJFHbdPTScmwG8KrN6q6QhJFZTJNPmuAOui9slaTcfAew9L5gGnsZ1c888EGY VucVr7OiYQuYoXNtmc8YFzdeLaqtOUQhLDE8knD0YzPJ09q5XwC595314SQyWszCeF5h syAitHxHLhF3NnSXhtM70P6sGtxhKQTDt46g1xcSu1PwdVtf56bcMTEp69Y4ZnFRcR2w EZrKLyZ+Oq3RdnT/SiJGxzIyliNmI92FR2wZE1QMiVIIaCrnVL7p2hsFoj6WWC/PkHpn IxOqcuTwsbbpuNawv1+9/7+ZwFDmkHVaSH/sH3pNyi5c/HxGvDoiPLfmQUFCLL05Xupz T1VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=A5wwbzdeiQrMV1W27Xj1YcX0Qjh4zwjiYg44ZJ89oQU=; b=CmzFQLgRg1AHoEc9/l7u8di5sq1D/wMKnhlKMCwsOvquj8fxqj3vHIVWt6FockhKLL GcpjlcQ8/xGzQmr78CFxTWQNZ6GFfnoLH0+PBbAvEYTZniVL4mdnO76M3XBub8rZ4Ao2 zHheYddMn5ZTwXiGCMiR+zUR0JtYTBNFPuoZxUU5SxWKC0N38fSOTtsqM+Kr9SqCUnaF eYpfOJPrAWKvBO5bzTLYk6z/mkd5i47RoIad0nt2vTRTjN32tW74zD+4CkMWwpph6pKd 5IsWVrtghzbDPToySWOL+NXkXhHKEpmHPHmciy85Ffz+2JydOYXuL0GQB8u3ilNCO2F4 n1Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=kYGyyBe1; 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 i9si21013385pgq.23.2019.04.25.12.19.22; Thu, 25 Apr 2019 12:19:38 -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; dkim=pass header.i=@sifive.com header.s=google header.b=kYGyyBe1; 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 S1727823AbfDYTNW (ORCPT + 99 others); Thu, 25 Apr 2019 15:13:22 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:38819 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726490AbfDYTNV (ORCPT ); Thu, 25 Apr 2019 15:13:21 -0400 Received: by mail-it1-f194.google.com with SMTP id q19so1949071itk.3 for ; Thu, 25 Apr 2019 12:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=A5wwbzdeiQrMV1W27Xj1YcX0Qjh4zwjiYg44ZJ89oQU=; b=kYGyyBe13Wv+DV3jzR0y04R2wwk23zd9LzN2fFhhKu+gP6ghvr5EqrDx+R0V5B/Dx9 +ADYCq07AZJP8BTRi4uKSRBzHzNRPfKxhp5Jr5XaPD2HE7zuiDksc/lTZIu0/7YvbQWm 27H5VqYNjX0nbRTtHvl17iN4bJ2kirlqKsnBNvO2GU3nFryc/NnEtVOqwdEh6Z9D34UN Tyiz29JcVOvCgmf87FmmV2Iy8oVV8DgsKdehmnYR3X0QfKfWhp5w2A/u6PmeNBWh+KUH SpX3zPDI/7H1LEAo52MG74rQS4w79ELl7hgoVLz6BHWOK0UD6QZtPCGyn4tz7om2z+01 DFCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=A5wwbzdeiQrMV1W27Xj1YcX0Qjh4zwjiYg44ZJ89oQU=; b=gpH4lnAifCGOGdhpBRXgNsOx+5CW8sDkhWCymmMEAaUhdX0TTR5PF1Uzw6wHacXink 1K5G4xsoJHKgprdC1zxncpB8cwBKm6hldsofwlq7jav5LXhsa0JvS3z8OmMEX0j81lzW JTs6kvm2OcnEOV9XeDznVnKbX7VFX6NjN+InqsLdGDIJQ481/bodQ7yEC6fvtxfcZnw1 MEJ4WvURq0s+hoV58pEde/FqxXrE0VypC/7NNnax2faQiQjqrgA9H0GPIfxJF7/4xHvR WJ5t9X8UaG2ylUdYj5EnGmo3v1SYv6WY/iptK18BKSI/c/BwdL4p6hyiUHzAzs5YtlA9 xIcg== X-Gm-Message-State: APjAAAW75eX98xDv9Lp86DfCk9tTp0d/3TAqfzZ/H5i0JzFroSqDXQ8q xJUzNNijpg34cNkCUA4nOEDDSNcYQ6o= X-Received: by 2002:a24:76d5:: with SMTP id z204mr4967251itb.44.1556219600184; Thu, 25 Apr 2019 12:13:20 -0700 (PDT) Received: from localhost (c-73-95-159-87.hsd1.co.comcast.net. [73.95.159.87]) by smtp.gmail.com with ESMTPSA id x187sm10583787itb.39.2019.04.25.12.13.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2019 12:13:19 -0700 (PDT) Date: Thu, 25 Apr 2019 12:13:18 -0700 (PDT) From: Paul Walmsley X-X-Sender: paulw@viisi.sifive.com To: Christoph Hellwig cc: Palmer Dabbelt , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 7/9] riscv: remove duplicate macros from ptrace.h In-Reply-To: <20190411115623.5749-8-hch@lst.de> Message-ID: References: <20190411115623.5749-1-hch@lst.de> <20190411115623.5749-8-hch@lst.de> User-Agent: Alpine 2.21.9999 (DEB 301 2018-08-15) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Apr 2019, Christoph Hellwig wrote: > No need to have two names for the same thing. > > Signed-off-by: Christoph Hellwig This is probably worth cleaning up across the entire tree. asm-{generic,x86,arm64,powerpc}/ptrace.h all define similar GET_IP/SET_IP macros - although it seems that arch/riscv is the only architecture that uses them. - Paul > --- > arch/riscv/include/asm/ptrace.h | 21 ++++++--------------- > arch/riscv/kernel/stacktrace.c | 8 ++++---- > arch/riscv/kernel/traps.c | 2 +- > 3 files changed, 11 insertions(+), 20 deletions(-) > > diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h > index d35ec2f41381..9c867a4bac83 100644 > --- a/arch/riscv/include/asm/ptrace.h > +++ b/arch/riscv/include/asm/ptrace.h > @@ -70,47 +70,38 @@ struct pt_regs { > > > /* Helpers for working with the instruction pointer */ > -#define GET_IP(regs) ((regs)->sepc) > -#define SET_IP(regs, val) (GET_IP(regs) = (val)) > - > static inline unsigned long instruction_pointer(struct pt_regs *regs) > { > - return GET_IP(regs); > + return regs->sepc; > } > static inline void instruction_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_IP(regs, val); > + regs->sepc = val; > } > > #define profile_pc(regs) instruction_pointer(regs) > > /* Helpers for working with the user stack pointer */ > -#define GET_USP(regs) ((regs)->sp) > -#define SET_USP(regs, val) (GET_USP(regs) = (val)) > - > static inline unsigned long user_stack_pointer(struct pt_regs *regs) > { > - return GET_USP(regs); > + return regs->sp; > } > static inline void user_stack_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_USP(regs, val); > + regs->sp = val; > } > > /* Helpers for working with the frame pointer */ > -#define GET_FP(regs) ((regs)->s0) > -#define SET_FP(regs, val) (GET_FP(regs) = (val)) > - > static inline unsigned long frame_pointer(struct pt_regs *regs) > { > - return GET_FP(regs); > + return regs->s0; > } > static inline void frame_pointer_set(struct pt_regs *regs, > unsigned long val) > { > - SET_FP(regs, val); > + regs->s0 = val; > } > > static inline unsigned long regs_return_value(struct pt_regs *regs) > diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c > index a4b1d94371a0..25fe0ff81f9e 100644 > --- a/arch/riscv/kernel/stacktrace.c > +++ b/arch/riscv/kernel/stacktrace.c > @@ -33,9 +33,9 @@ static void notrace walk_stackframe(struct task_struct *task, > unsigned long fp, sp, pc; > > if (regs) { > - fp = GET_FP(regs); > - sp = GET_USP(regs); > - pc = GET_IP(regs); > + fp = frame_pointer(regs); > + sp = user_stack_pointer(regs); > + pc = instruction_pointer(regs); > } else if (task == NULL || task == current) { > const register unsigned long current_sp __asm__ ("sp"); > fp = (unsigned long)__builtin_frame_address(0); > @@ -83,7 +83,7 @@ static void notrace walk_stackframe(struct task_struct *task, > > if (regs) { > sp = GET_USP(regs); > - pc = GET_IP(regs); > + pc = instruction_pointer(regs); > } else if (task == NULL || task == current) { > const register unsigned long current_sp __asm__ ("sp"); > sp = current_sp; > diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c > index 24a9333dda2c..86731a2fa218 100644 > --- a/arch/riscv/kernel/traps.c > +++ b/arch/riscv/kernel/traps.c > @@ -70,7 +70,7 @@ void do_trap(struct pt_regs *regs, int signo, int code, > && printk_ratelimit()) { > pr_info("%s[%d]: unhandled signal %d code 0x%x at 0x" REG_FMT, > tsk->comm, task_pid_nr(tsk), signo, code, addr); > - print_vma_addr(KERN_CONT " in ", GET_IP(regs)); > + print_vma_addr(KERN_CONT " in ", instruction_pointer(regs)); > pr_cont("\n"); > show_regs(regs); > } > -- > 2.20.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv >