Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1157557pxj; Sat, 15 May 2021 05:43:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzpZjYYNohaGwqTj4sxYsdzcFFFSoBEwFLhAs0MdN7VwZBJUbse1SheR2CHtMWYngC+74d X-Received: by 2002:a50:fc0b:: with SMTP id i11mr62562116edr.259.1621082623653; Sat, 15 May 2021 05:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621082623; cv=none; d=google.com; s=arc-20160816; b=lRxaK8TVnFp5rSSXXbrC2tknsgZrA1BN0rOiP7vp7wrXev2BCyWh69l6Ut7Gychd7a V7rUGx3/lMo9D+fj+O4lVl2hRasdsIeHTDc/Emukcgwfdb8VEEpoheQCbWvEHeDGGCaZ UQWTg7LQBQRidqibwoBA726CWiQeFMS6YftTVOR7+vTZG9hGsRLNIu5yBU4QWV+qUTq8 rll9qIVfQRPab9YTVgvwWpD/0T1HjwVuwwpRg0vTOF0HFo94Yq/qwLkCo2x425GHcWhx tHD4y1QshtKz9fDFoWHpCvFHZ3ErCQAiRhTAD5WftNTc9uli3fego+frZnQmln4pz1El i3Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=pbkVFafXpgnQWWTGf1iAF1YIpVW1IMVAlOhixHBFmrU=; b=iQbIPjlV8qDoJloR55QdK5Xz1mPo0io3eS3BFfLqtY058OTHi7hUWfPPz0x45ohi8o 66hO7DELL3hFphlMru/2Af/il4nxTsDVYLzqs+69xS20d0RC7evVjIPzwQFcjPwXo4ys crP04QKHv9alEPtbMqE28dg5JEzprNz8A9PIxK+iEiBLBIs97rPuee/dqvMTcugjG9ne /7w5I82fHmk/VgENgfC+1/U24H2zb2/fjZpPB6/YlrpKZUqJ2hwCEhFJbEHmWJOIlCu+ 5CmFjG0FuO58rYMafAQJ6HQjtI1RfgzlIui9gSzo1kLC3lceST7duP0xPml6jvxk3Ayq kQdw== 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 bd11si8145529edb.491.2021.05.15.05.43.20; Sat, 15 May 2021 05:43:43 -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; 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 S234022AbhEOLF4 (ORCPT + 99 others); Sat, 15 May 2021 07:05:56 -0400 Received: from mail.loongson.cn ([114.242.206.163]:48308 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233077AbhEOLD1 (ORCPT ); Sat, 15 May 2021 07:03:27 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Axrcgpqp9g598WAA--.13691S4; Sat, 15 May 2021 19:02:08 +0800 (CST) From: Tiezhu Yang To: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Steven Rostedt Subject: [PATCH 2/2] MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER Date: Sat, 15 May 2021 19:02:01 +0800 Message-Id: <1621076521-22412-3-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1621076521-22412-1-git-send-email-yangtiezhu@loongson.cn> References: <1621076521-22412-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9Axrcgpqp9g598WAA--.13691S4 X-Coremail-Antisp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UUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When update the latest mainline kernel with the following three configs, the kernel hangs during startup: (1) CONFIG_FUNCTION_GRAPH_TRACER=y (2) CONFIG_PREEMPT_TRACER=y (3) CONFIG_FTRACE_STARTUP_TEST=y When update the latest mainline kernel with the above two configs (1) and (2), the kernel starts normally, but it still hangs when execute the following command: echo "function_graph" > /sys/kernel/debug/tracing/current_tracer Without CONFIG_PREEMPT_TRACER=y, the above two kinds of kernel hangs disappeared, so it seems that CONFIG_PREEMPT_TRACER has some influences with function_graph tracer at the first glance. I use ejtag to find out the epc address is related with preempt_enable() in the file arch/mips/lib/mips-atomic.c, because function tracing can trace the preempt_{enable,disable} calls that are traced, replace them with preempt_{enable,disable}_notrace to prevent function tracing from going into an infinite loop, and then it can fix the kernel hang issue. By the way, it seems that this commit is a complement and improvement of commit f93a1a00f2bd ("MIPS: Fix crash that occurs when function tracing is enabled"). Signed-off-by: Tiezhu Yang Cc: Steven Rostedt --- arch/mips/lib/mips-atomic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/mips/lib/mips-atomic.c b/arch/mips/lib/mips-atomic.c index de03838..a9b72ea 100644 --- a/arch/mips/lib/mips-atomic.c +++ b/arch/mips/lib/mips-atomic.c @@ -37,7 +37,7 @@ */ notrace void arch_local_irq_disable(void) { - preempt_disable(); + preempt_disable_notrace(); __asm__ __volatile__( " .set push \n" @@ -53,7 +53,7 @@ notrace void arch_local_irq_disable(void) : /* no inputs */ : "memory"); - preempt_enable(); + preempt_enable_notrace(); } EXPORT_SYMBOL(arch_local_irq_disable); @@ -61,7 +61,7 @@ notrace unsigned long arch_local_irq_save(void) { unsigned long flags; - preempt_disable(); + preempt_disable_notrace(); __asm__ __volatile__( " .set push \n" @@ -78,7 +78,7 @@ notrace unsigned long arch_local_irq_save(void) : /* no inputs */ : "memory"); - preempt_enable(); + preempt_enable_notrace(); return flags; } @@ -88,7 +88,7 @@ notrace void arch_local_irq_restore(unsigned long flags) { unsigned long __tmp1; - preempt_disable(); + preempt_disable_notrace(); __asm__ __volatile__( " .set push \n" @@ -106,7 +106,7 @@ notrace void arch_local_irq_restore(unsigned long flags) : "0" (flags) : "memory"); - preempt_enable(); + preempt_enable_notrace(); } EXPORT_SYMBOL(arch_local_irq_restore); -- 2.1.0