From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945939AbcBRL63 (ORCPT ); Thu, 18 Feb 2016 06:58:29 -0500 Received: from foss.arm.com ([217.140.101.70]:38592 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425547AbcBRL62 (ORCPT ); Thu, 18 Feb 2016 06:58:28 -0500 Date: Thu, 18 Feb 2016 11:58:24 +0000 From: Catalin Marinas To: Zhi-zhou Zhang Cc: robin.murphy@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] arm64: add architecture specified current_pt_regs Message-ID: <20160218115824.GA2538@e104818-lin.cambridge.arm.com> References: <1455796115-7844-1-git-send-email-zhizhou.zh@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455796115-7844-1-git-send-email-zhizhou.zh@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 18, 2016 at 07:48:35PM +0800, Zhi-zhou Zhang wrote: > From: zhizhou > > This patch is based on the implementation of arm. The generic > current_pt_regs is implemented with current->stack. It need to access > memory that would be too expensive. Do you have any performance numbers? > diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h > index e9e5467..1865d54 100644 > --- a/arch/arm64/include/asm/ptrace.h > +++ b/arch/arm64/include/asm/ptrace.h > @@ -185,5 +185,9 @@ static inline int valid_user_regs(struct user_pt_regs *regs) > > extern unsigned long profile_pc(struct pt_regs *regs); > > +#define current_pt_regs(void) ({ (struct pt_regs *) \ > + ((current_stack_pointer | (THREAD_SIZE - 1)) - 0xf) - 1; \ > +}) I don't think this works well with the separate IRQ stack that we merged in 4.5-rc1. current_thread_info() explicitly uses "sp_el0" while current_stack_pointer is just "sp" (though I don't think we ever use current_pt_regs in interrupt context). -- Catalin