From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163105AbdAJR2x (ORCPT ); Tue, 10 Jan 2017 12:28:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52060 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163054AbdAJR2v (ORCPT ); Tue, 10 Jan 2017 12:28:51 -0500 Date: Tue, 10 Jan 2017 11:28:49 -0600 From: Josh Poimboeuf To: Miroslav Benes Cc: x86@kernel.org, Dave Jones , Dmitry Vyukov , Andy Lutomirski , Brian Gerst , linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] x86/unwind: include __schedule() in stack traces Message-ID: <20170110172849.3rloddujbjhx35g4@treble> References: <598e9f7505ed0aba86e8b9590aa528c6c7ae8dcd.1483978430.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 10 Jan 2017 17:28:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 10, 2017 at 11:14:51AM +0100, Miroslav Benes wrote: > On Mon, 9 Jan 2017, Josh Poimboeuf wrote: > > Signed-off-by: Josh Poimboeuf > > --- > > arch/x86/include/asm/stacktrace.h | 5 +---- > > arch/x86/include/asm/switch_to.h | 10 +++++++++- > > 2 files changed, 10 insertions(+), 5 deletions(-) > > > > diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h > > index 20ce3db..2e41c50 100644 > > --- a/arch/x86/include/asm/stacktrace.h > > +++ b/arch/x86/include/asm/stacktrace.h > > @@ -52,16 +52,13 @@ static inline bool on_stack(struct stack_info *info, void *addr, size_t len) > > static inline unsigned long * > > get_frame_pointer(struct task_struct *task, struct pt_regs *regs) > > { > > - struct inactive_task_frame *frame; > > - > > if (regs) > > return (unsigned long *)regs->bp; > > > > if (task == current) > > return __builtin_frame_address(0); > > > > - frame = (struct inactive_task_frame *)task->thread.sp; > > - return (unsigned long *)READ_ONCE_NOCHECK(frame->bp); > > + return &((struct inactive_task_frame *)task->thread.sp)->bp; > > You effectively remove one of the changes from the previous patch - > READ_ONCE_NOCHECK. Is it intentional? Yes, notice that it's no longer reading the value of bp on the stack. It's instead getting a pointer to it. Since there's no longer a stack access, READ_ONCE_NOCHECK is no longer needed. -- Josh