From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 018F7C433F5 for ; Thu, 6 Jan 2022 16:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SL04YD6OpYDWrxMch9V8wtJSsWx6GMLleVAuh8jf7Mc=; b=R0SKOE/9rBjYNc 0In6cxT3r8hVYv+99EghxPdFNx6KRRUhQjNXLNi1ZSOz6RePu/FHu+Sf7eMEUDnGSJRgIoCnUJEYl wp4Vg9QRdadDQEn14n7IMxlwGyrlGCnyakyZfL3IDq8hCTRS6PIq9des3/3kUoKgC6fciYI1CmHmv jf8d+qPw711m8lc0lHz13KTGk2wR8Q2s7nqHzfH3xPgdnaPxI9IguS/BB1t9Pyoz6bOCyoIczl6id F9MDhwVTyRPsutv5NwOeE3207yCSfWV6lAFSqLiRLbJUu7hjavzG0ASYqWDWXGGSuf+RLtU7No+Ja GXw5Oq1X67dVQ1HMGxIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5VMi-000ai5-9V; Thu, 06 Jan 2022 16:11:49 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5VMW-000afA-Gr for linux-arm-kernel@lists.infradead.org; Thu, 06 Jan 2022 16:11:38 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C85871042; Thu, 6 Jan 2022 08:11:35 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.10.56]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD1853F5A1; Thu, 6 Jan 2022 08:11:33 -0800 (PST) Date: Thu, 6 Jan 2022 16:11:31 +0000 From: Mark Rutland To: madvenka@linux.microsoft.com Cc: broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 03/10] arm64: Rename stackframe to unwind_state Message-ID: References: <0d0eb36f348fb5a6af6eb592c0525f6e94007328> <20220103165212.9303-1-madvenka@linux.microsoft.com> <20220103165212.9303-4-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220103165212.9303-4-madvenka@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220106_081136_727948_CCB69F13 X-CRM114-Status: GOOD ( 26.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 03, 2022 at 10:52:05AM -0600, madvenka@linux.microsoft.com wrote: > From: "Madhavan T. Venkataraman" > > Rename "struct stackframe" to "struct unwind_state" for consistency and > better naming. Accordingly, rename variable/argument "frame" to "state". > > Signed-off-by: Madhavan T. Venkataraman Thanks for this! Reviewed-by: Mark Rutland Mark. > --- > arch/arm64/include/asm/stacktrace.h | 2 +- > arch/arm64/kernel/stacktrace.c | 66 ++++++++++++++--------------- > 2 files changed, 34 insertions(+), 34 deletions(-) > > diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/stacktrace.h > index 3a15d376ab36..fc828c3c5dfd 100644 > --- a/arch/arm64/include/asm/stacktrace.h > +++ b/arch/arm64/include/asm/stacktrace.h > @@ -52,7 +52,7 @@ struct stack_info { > * associated with the most recently encountered replacement lr > * value. > */ > -struct stackframe { > +struct unwind_state { > unsigned long fp; > unsigned long pc; > DECLARE_BITMAP(stacks_done, __NR_STACK_TYPES); > diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c > index b980d96dccfc..a1a7ff93b84f 100644 > --- a/arch/arm64/kernel/stacktrace.c > +++ b/arch/arm64/kernel/stacktrace.c > @@ -33,13 +33,13 @@ > */ > > > -static void unwind_init(struct stackframe *frame, unsigned long fp, > +static void unwind_init(struct unwind_state *state, unsigned long fp, > unsigned long pc) > { > - frame->fp = fp; > - frame->pc = pc; > + state->fp = fp; > + state->pc = pc; > #ifdef CONFIG_KRETPROBES > - frame->kr_cur = NULL; > + state->kr_cur = NULL; > #endif > > /* > @@ -51,9 +51,9 @@ static void unwind_init(struct stackframe *frame, unsigned long fp, > * prev_fp value won't be used, but we set it to 0 such that it is > * definitely not an accessible stack address. > */ > - bitmap_zero(frame->stacks_done, __NR_STACK_TYPES); > - frame->prev_fp = 0; > - frame->prev_type = STACK_TYPE_UNKNOWN; > + bitmap_zero(state->stacks_done, __NR_STACK_TYPES); > + state->prev_fp = 0; > + state->prev_type = STACK_TYPE_UNKNOWN; > } > > /* > @@ -64,9 +64,9 @@ static void unwind_init(struct stackframe *frame, unsigned long fp, > * and the location (but not the fp value) of B. > */ > static int notrace unwind_next(struct task_struct *tsk, > - struct stackframe *frame) > + struct unwind_state *state) > { > - unsigned long fp = frame->fp; > + unsigned long fp = state->fp; > struct stack_info info; > > /* Final frame; nothing to unwind */ > @@ -79,7 +79,7 @@ static int notrace unwind_next(struct task_struct *tsk, > if (!on_accessible_stack(tsk, fp, 16, &info)) > return -EINVAL; > > - if (test_bit(info.type, frame->stacks_done)) > + if (test_bit(info.type, state->stacks_done)) > return -EINVAL; > > /* > @@ -95,27 +95,27 @@ static int notrace unwind_next(struct task_struct *tsk, > * stack to another, it's never valid to unwind back to that first > * stack. > */ > - if (info.type == frame->prev_type) { > - if (fp <= frame->prev_fp) > + if (info.type == state->prev_type) { > + if (fp <= state->prev_fp) > return -EINVAL; > } else { > - set_bit(frame->prev_type, frame->stacks_done); > + set_bit(state->prev_type, state->stacks_done); > } > > /* > * Record this frame record's values and location. The prev_fp and > * prev_type are only meaningful to the next unwind_next() invocation. > */ > - frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); > - frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8)); > - frame->prev_fp = fp; > - frame->prev_type = info.type; > + state->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); > + state->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8)); > + state->prev_fp = fp; > + state->prev_type = info.type; > > - frame->pc = ptrauth_strip_insn_pac(frame->pc); > + state->pc = ptrauth_strip_insn_pac(state->pc); > > #ifdef CONFIG_FUNCTION_GRAPH_TRACER > if (tsk->ret_stack && > - (frame->pc == (unsigned long)return_to_handler)) { > + (state->pc == (unsigned long)return_to_handler)) { > unsigned long orig_pc; > /* > * This is a case where function graph tracer has > @@ -123,16 +123,16 @@ static int notrace unwind_next(struct task_struct *tsk, > * to hook a function return. > * So replace it to an original value. > */ > - orig_pc = ftrace_graph_ret_addr(tsk, NULL, frame->pc, > - (void *)frame->fp); > - if (WARN_ON_ONCE(frame->pc == orig_pc)) > + orig_pc = ftrace_graph_ret_addr(tsk, NULL, state->pc, > + (void *)state->fp); > + if (WARN_ON_ONCE(state->pc == orig_pc)) > return -EINVAL; > - frame->pc = orig_pc; > + state->pc = orig_pc; > } > #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ > #ifdef CONFIG_KRETPROBES > - if (is_kretprobe_trampoline(frame->pc)) > - frame->pc = kretprobe_find_ret_addr(tsk, (void *)frame->fp, &frame->kr_cur); > + if (is_kretprobe_trampoline(state->pc)) > + state->pc = kretprobe_find_ret_addr(tsk, (void *)state->fp, &state->kr_cur); > #endif > > return 0; > @@ -140,15 +140,15 @@ static int notrace unwind_next(struct task_struct *tsk, > NOKPROBE_SYMBOL(unwind_next); > > static void notrace unwind(struct task_struct *tsk, > - struct stackframe *frame, > + struct unwind_state *state, > bool (*fn)(void *, unsigned long), void *data) > { > while (1) { > int ret; > > - if (!fn(data, frame->pc)) > + if (!fn(data, state->pc)) > break; > - ret = unwind_next(tsk, frame); > + ret = unwind_next(tsk, state); > if (ret < 0) > break; > } > @@ -192,17 +192,17 @@ noinline notrace void arch_stack_walk(stack_trace_consume_fn consume_entry, > void *cookie, struct task_struct *task, > struct pt_regs *regs) > { > - struct stackframe frame; > + struct unwind_state state; > > if (regs) > - unwind_init(&frame, regs->regs[29], regs->pc); > + unwind_init(&state, regs->regs[29], regs->pc); > else if (task == current) > - unwind_init(&frame, > + unwind_init(&state, > (unsigned long)__builtin_frame_address(1), > (unsigned long)__builtin_return_address(0)); > else > - unwind_init(&frame, thread_saved_fp(task), > + unwind_init(&state, thread_saved_fp(task), > thread_saved_pc(task)); > > - unwind(task, &frame, consume_entry, cookie); > + unwind(task, &state, consume_entry, cookie); > } > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel