Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp438491pxa; Wed, 19 Aug 2020 05:53:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0qXGWgrGBnjqxGVynfyYfvXflylRGwiWYpmJsmUUuVB2eKIUBBkyoRp9k2oAQ1T3/erV2 X-Received: by 2002:a17:906:6d91:: with SMTP id h17mr23800183ejt.531.1597841587534; Wed, 19 Aug 2020 05:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597841587; cv=none; d=google.com; s=arc-20160816; b=OiDzpLEuIp8mzFrv+rMVRTvSc59eIy4knrkQbPNPBVP6Ij2rrv4GtQO89Hzi6k6G1D 0xNGgQzAfZNzGPCw96tDxVoU04tENBtHr8r7EiV9CO3L+2wybSuyojdPl/S5iVmoWhKJ NTYbO+zy04jmtXBlB+o+yM0ltwvqYh3h5LtRUtM4PddTjoTEOAVsso1w9xJxKa+aSl9M cIH4WSVtATIAsALQoB7fliCmR/YV7F049b1i8OzSTTWZQbRq/nmoNruRB6WAm0MjQ6xo szr4HO6MekZSfDtwOLyaOOuKDd2iw1b6nv/d6kkMvqoM77i4LSiXGea/CcGnHywB6Vuw 1hyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lLEzroq//NCYzLup+vz3v370rYKpUmIzbUTX2FiHbjE=; b=OPlOeYAEG7fHhOoaZ7qPrd8VaEYhlIh/i4JW9OwJdcXEPpSDPKebiiyzDiWnprlWUZ /ECX19dTvLGlXR9SW34nY895ASmadHyC6DFIxnD1U0OW1jTivyD4s36gAAkJcyMVp4be QYAsPa8wHKmbU5y5YBQ47/UGUdhNbJphXXGE+OsUde0QQTYDll0X184VP0rsehr11hMV H/p6bQjhjuxLiMxeUW8pXfBAIvww9OFcKSxCzrboIEQeZxyeheTEUKJH7YIqGUHbicxP brPCtt98xM8zv5dChrmru2TKBNxcmjKEk+xlpfcOMqk6o1S1rzoeVhdAEOCWGwbGJLLj 89ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xQaGl6PW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q22si14628713eds.346.2020.08.19.05.52.44; Wed, 19 Aug 2020 05:53:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xQaGl6PW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728083AbgHSMuL (ORCPT + 99 others); Wed, 19 Aug 2020 08:50:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:36622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728165AbgHSMuG (ORCPT ); Wed, 19 Aug 2020 08:50:06 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2FCF7206DA; Wed, 19 Aug 2020 12:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597841405; bh=iitiI0HXg+qhORevAGb+DOw5RnlepYxovrFnfSjIODA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xQaGl6PWgr6UpMVGzfOsPtuTbxrtmtZiFeTLez6P/qyxsvfJizUecRp7CVO1ik0nj qkxcd/IFEB+ZlEKU6s5mwkK45ycK5UYvzCqwdjzSk45Ia4VPNgoD9jTZ21LanA6JwU 5Dgv2iWFLblym4tCbYDozmaL7iBahpd3BaVvQPJw= From: Mark Brown To: Catalin Marinas , Will Deacon , Vasily Gorbik , Heiko Carstens , Borislav Petkov , Thomas Gleixner , "H. Peter Anvin" Cc: Christian Borntraeger , Ingo Molnar , Jiri Slaby , x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Miroslav Benes , Mark Brown Subject: [PATCH v2 1/3] stacktrace: Remove reliable argument from arch_stack_walk() callback Date: Wed, 19 Aug 2020 13:49:11 +0100 Message-Id: <20200819124913.37261-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200819124913.37261-1-broonie@kernel.org> References: <20200819124913.37261-1-broonie@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the callback passed to arch_stack_walk() has an argument called reliable passed to it to indicate if the stack entry is reliable, a comment says that this is used by some printk() consumers. However in the current kernel none of the arch_stack_walk() implementations ever set this flag to true and the only callback implementation we have is in the generic stacktrace code which ignores the flag. It therefore appears that this flag is redundant so we can simplify and clarify things by removing it. Signed-off-by: Mark Brown --- arch/s390/kernel/stacktrace.c | 4 ++-- arch/x86/kernel/stacktrace.c | 10 +++++----- include/linux/stacktrace.h | 5 +---- kernel/stacktrace.c | 8 +++----- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/arch/s390/kernel/stacktrace.c b/arch/s390/kernel/stacktrace.c index fc5419ac64c8..7f1266c24f6b 100644 --- a/arch/s390/kernel/stacktrace.c +++ b/arch/s390/kernel/stacktrace.c @@ -19,7 +19,7 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, unwind_for_each_frame(&state, task, regs, 0) { addr = unwind_get_return_address(&state); - if (!addr || !consume_entry(cookie, addr, false)) + if (!addr || !consume_entry(cookie, addr)) break; } } @@ -56,7 +56,7 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, return -EINVAL; #endif - if (!consume_entry(cookie, addr, false)) + if (!consume_entry(cookie, addr)) return -EINVAL; } diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 2fd698e28e4d..8627fda8d993 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c @@ -18,13 +18,13 @@ void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, struct unwind_state state; unsigned long addr; - if (regs && !consume_entry(cookie, regs->ip, false)) + if (regs && !consume_entry(cookie, regs->ip)) return; for (unwind_start(&state, task, regs, NULL); !unwind_done(&state); unwind_next_frame(&state)) { addr = unwind_get_return_address(&state); - if (!addr || !consume_entry(cookie, addr, false)) + if (!addr || !consume_entry(cookie, addr)) break; } } @@ -72,7 +72,7 @@ int arch_stack_walk_reliable(stack_trace_consume_fn consume_entry, if (!addr) return -EINVAL; - if (!consume_entry(cookie, addr, false)) + if (!consume_entry(cookie, addr)) return -EINVAL; } @@ -114,7 +114,7 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie, { const void __user *fp = (const void __user *)regs->bp; - if (!consume_entry(cookie, regs->ip, false)) + if (!consume_entry(cookie, regs->ip)) return; while (1) { @@ -128,7 +128,7 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie, break; if (!frame.ret_addr) break; - if (!consume_entry(cookie, frame.ret_addr, false)) + if (!consume_entry(cookie, frame.ret_addr)) break; fp = frame.next_fp; } diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index b7af8cc13eda..50e2df30b0aa 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h @@ -29,14 +29,11 @@ unsigned int stack_trace_save_user(unsigned long *store, unsigned int size); * stack_trace_consume_fn - Callback for arch_stack_walk() * @cookie: Caller supplied pointer handed back by arch_stack_walk() * @addr: The stack entry address to consume - * @reliable: True when the stack entry is reliable. Required by - * some printk based consumers. * * Return: True, if the entry was consumed or skipped * False, if there is no space left to store */ -typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr, - bool reliable); +typedef bool (*stack_trace_consume_fn)(void *cookie, unsigned long addr); /** * arch_stack_walk - Architecture specific function to walk the stack * @consume_entry: Callback which is invoked by the architecture code for diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c index 946f44a9e86a..9f8117c7cfdd 100644 --- a/kernel/stacktrace.c +++ b/kernel/stacktrace.c @@ -78,8 +78,7 @@ struct stacktrace_cookie { unsigned int len; }; -static bool stack_trace_consume_entry(void *cookie, unsigned long addr, - bool reliable) +static bool stack_trace_consume_entry(void *cookie, unsigned long addr) { struct stacktrace_cookie *c = cookie; @@ -94,12 +93,11 @@ static bool stack_trace_consume_entry(void *cookie, unsigned long addr, return c->len < c->size; } -static bool stack_trace_consume_entry_nosched(void *cookie, unsigned long addr, - bool reliable) +static bool stack_trace_consume_entry_nosched(void *cookie, unsigned long addr) { if (in_sched_functions(addr)) return true; - return stack_trace_consume_entry(cookie, addr, reliable); + return stack_trace_consume_entry(cookie, addr); } /** -- 2.20.1