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 X-Spam-Level: X-Spam-Status: No, score=-19.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8513EC433ED for ; Fri, 14 May 2021 14:05:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B1A16147E for ; Fri, 14 May 2021 14:05:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234128AbhENOGe (ORCPT ); Fri, 14 May 2021 10:06:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:60434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234106AbhENOGb (ORCPT ); Fri, 14 May 2021 10:06:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C121F61463; Fri, 14 May 2021 14:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621001120; bh=KIMl5RduaL26Nsf0bpag/c4ClLw7SGizgJXPJGZClO4=; h=From:To:Cc:Subject:Date:From; b=ZoH5RPWl1UG28Csvy5bv+Mh9iMk07EP/kDffLlaLMnjpNHaW7NXHT3y+uEVw2aKun ABXvYTTkeFrPQtoN3eFG7P5PoeQSr0EtIOIC3UmaitavKqGfz527u8iNYWtgFDFg2s RSYQznbNu4eZyXBw+2FTzKXEKI+HoVfbhh2OKej2nwY56zaVEE9bfWBc5peNGtSldS NCotBB2TMIXQSZaYJNLHeILwClyyZNRdG8pj9C+e2Z+IfF0K7ZKKNmhQ1h3MLusK3P lCuOVE9pEgqiVm9Jy9GRnWn5DfSgJomhBv/30g6LMFJlvq5AFuksuJ60FRnMTkIIeN fMvnu+fNblf7A== From: Arnd Bergmann To: Steven Rostedt , Ingo Molnar , Nathan Chancellor , Nick Desaulniers Cc: Arnd Bergmann , "Steven Rostedt (VMware)" , Tom Zanussi , Masami Hiramatsu , Qiujun Huang , Tom Rix , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] tracing: events_hist: avoid using excessive stack space Date: Fri, 14 May 2021 16:04:25 +0200 Message-Id: <20210514140429.3334181-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann In some configurations, clang produces a warning about an overly large amount of stack space used in hist_trigger_print_key(): kernel/trace/trace_events_hist.c:4594:13: error: stack frame size of 1248 bytes in function 'hist_trigger_print_key' [-Werror,-Wframe-larger-than=] static void hist_trigger_print_key(struct seq_file *m, Moving the 'str' variable into a more local scope in the two places where it gets used actually reduces the the used stack space here and gets it below the warning limit, because the compiler can now assume that it is safe to use the same stack slot that it has for the stack of any inline function. Signed-off-by: Arnd Bergmann --- kernel/trace/trace_events_hist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index c1abd63f1d6c..e3fe84f017a8 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -4597,7 +4597,6 @@ static void hist_trigger_print_key(struct seq_file *m, struct tracing_map_elt *elt) { struct hist_field *key_field; - char str[KSYM_SYMBOL_LEN]; bool multiline = false; const char *field_name; unsigned int i; @@ -4617,11 +4616,13 @@ static void hist_trigger_print_key(struct seq_file *m, uval = *(u64 *)(key + key_field->offset); seq_printf(m, "%s: %llx", field_name, uval); } else if (key_field->flags & HIST_FIELD_FL_SYM) { + char str[KSYM_SYMBOL_LEN]; uval = *(u64 *)(key + key_field->offset); sprint_symbol_no_offset(str, uval); seq_printf(m, "%s: [%llx] %-45s", field_name, uval, str); } else if (key_field->flags & HIST_FIELD_FL_SYM_OFFSET) { + char str[KSYM_SYMBOL_LEN]; uval = *(u64 *)(key + key_field->offset); sprint_symbol(str, uval); seq_printf(m, "%s: [%llx] %-55s", field_name, -- 2.29.2