Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1415615pxb; Fri, 21 Jan 2022 18:10:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1Do1QKd3Kgc9Cv/3BeqUYvA08AKJxd2vrDsB37PgfK1UQsXgJxgJRIWK7iS4e8m/HvYxf X-Received: by 2002:a17:902:e890:b0:14b:356b:7757 with SMTP id w16-20020a170902e89000b0014b356b7757mr398120plg.95.1642817420997; Fri, 21 Jan 2022 18:10:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642817420; cv=none; d=google.com; s=arc-20160816; b=wBvH8XR3Xti8wRP0JXYbzwGJff6cZd+S+XKW2ZdqgbXw8N3u2Z3zhZsUeYhlgfbJiQ j39xEUUUBasVZW+FRwiCRXX2O0B8sewMSRp8PbTRRaX4NQnvT4BxB4tH3p+chPz+rxt2 XZyYJ5A4+JmAqzvQtv2S9V0NCHR4x+WCxrYoUkFUBhkLIUamO81CTFsT4uZBWENZG+GU jHFay3yhYuYV/jboeMroaZ+YCOdBsqH9yqwJqmGtVhjlbKIz4+o8g1TniYUxF2gUOmYb apPcZvSzczmtuvyBAg3x2VQXSq9lvMMf5MeNCNv4897TEqIlDluySTpAL3jfXqtZrGDG ttBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=cvLU07JeXb0SlKFsfsUUdo0lpa3WvFVtp/ziCOpMVpQ=; b=t/GLv2je51fj3G/Sq0YPLgNxnJxMSeoEk7JPt+BFqj5MG5FCcYMPe7vhpSFxrhOcr/ bBLjQ3ZV2sG5FLi/RC2LsI+Mww96GNsf71m+TxMsGH7eybg/ynjnsSYsvvgWhbAC/RpA 7wnZ2zzHJJxgbSI1E8a30V+4Wp6pAh49k1/5slU4XUkmqsT/048Cv4sblt4doLpXQeb6 0aPTlWJ30buZDofZlZvEkIFK4Ff68+Duih1Wb6jnmhOZbBlZdzbWjpuw4pvHH/AKVI5a 2ab+mB0GFjONyXGtE30K9IRVS5N2Z4BMpY8zV2XTgqoCgSQEoJy9JpITL7Cggr3UFsDV S9/w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t15si7676008plb.345.2022.01.21.18.10.03; Fri, 21 Jan 2022 18:10:20 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382056AbiAUSLy (ORCPT + 99 others); Fri, 21 Jan 2022 13:11:54 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:49590 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351822AbiAUSLx (ORCPT ); Fri, 21 Jan 2022 13:11:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 16742B81F69; Fri, 21 Jan 2022 18:11:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA999C340E1; Fri, 21 Jan 2022 18:11:49 +0000 (UTC) Date: Fri, 21 Jan 2022 13:11:48 -0500 From: Steven Rostedt To: Heiko Carstens Cc: Sven Schnelle , Yinan Liu , peterz@infradead.org, mark-pk.tsai@mediatek.com, mingo@redhat.com, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Linus Torvalds Subject: Re: [PATCH v8] scripts: ftrace - move the sort-processing in ftrace_init Message-ID: <20220121131148.2025bc5b@gandalf.local.home> In-Reply-To: References: <20210911135043.16014-1-yinan@linux.alibaba.com> <20211212113358.34208-1-yinan@linux.alibaba.com> <20211212113358.34208-2-yinan@linux.alibaba.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Jan 2022 11:42:28 +0100 Heiko Carstens wrote: > This really should be addressed before rc1 is out, otherwise s390 is > broken if somebody enables ftrace. > Where "broken" translates to random crashes as soon as ftrace is > enabled, which again is nowadays quite common. Instead of reverting, should we just add this patch? -- Steve diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index f468767bc287..752ed89a293b 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -70,6 +70,13 @@ config HAVE_C_RECORDMCOUNT help C version of recordmcount available? +config BUILDTIME_MCOUNT_SORT + bool + default y + depends on BUILDTIME_TABLE_SORT && !S390 + help + Sort the mcount_loc section at build time. + config TRACER_MAX_TRACE bool @@ -918,7 +925,7 @@ config EVENT_TRACE_TEST_SYSCALLS config FTRACE_SORT_STARTUP_TEST bool "Verify compile time sorting of ftrace functions" depends on DYNAMIC_FTRACE - depends on BUILDTIME_TABLE_SORT + depends on BUILDTIME_MCOUNT_SORT help Sorting of the mcount_loc sections that is used to find the where the ftrace knows where to patch functions for tracing diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 403e485bf091..b01e1fa62193 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -6429,10 +6429,10 @@ static int ftrace_process_locs(struct module *mod, /* * Sorting mcount in vmlinux at build time depend on - * CONFIG_BUILDTIME_TABLE_SORT, while mcount loc in + * CONFIG_BUILDTIME_MCOUNT_SORT, while mcount loc in * modules can not be sorted at build time. */ - if (!IS_ENABLED(CONFIG_BUILDTIME_TABLE_SORT) || mod) { + if (!IS_ENABLED(CONFIG_BUILDTIME_MCOUNT_SORT) || mod) { sort(start, count, sizeof(*start), ftrace_cmp_ips, NULL); } else {