Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2642218pxj; Mon, 14 Jun 2021 03:50:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6BPfvFZ7MCKMucM+Jojg82jC6gpLGeEU6EInBMzyeCmWC+ik6jSph8kRuZ2QllNYzALIx X-Received: by 2002:a17:906:d1ce:: with SMTP id bs14mr15093406ejb.183.1623667810294; Mon, 14 Jun 2021 03:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623667810; cv=none; d=google.com; s=arc-20160816; b=awtrx8WuoyoIjOXmyZFsxu5jRKS6iPC88SldOUsp7+zYJG5ew/cW17wFvn+lvCyQ3o LJSDJKn+0EKg4b8BPdDnekfXjUTWa7N28MRHDo0EZtvCMTgFu/p3jQi83GtTfG5gUwgU V2lXXWeyjnQ/TShhCj72P4pmgXjLE/JToxs352zFeTJZgLaoegyzt/QJO7AoLoSE6cAd KIMVi6jqs1QpqvLDY+09C2Bttz0Pk/WHE0m/IsKK1+vwcKC09r7rUVaoGS8ROfFlpoiH Lj6VLLFMJMIqokxIy7gcjAi2yl7DD2q/uw7oTXH1GROAGCjbUMDT0Bawp7SZLN1iun+H 1CXw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZC4VB6Em4EmwMlZo9vVemlxP7ZDXYeXEGbQdGnU6fR8=; b=oSml7xZKLx5owZABsw1+qE+T7KWAd2A8kyOcPNqaJxAU+9YNFMvpcE5J4BXVtNYSAD PZA/FzPgY6fPk7Zedx3gCtNoEEMFpxV9SWApLesXWlLZbifPUOc+LLtFWqrc9I0xaHMy l8DLfxtwHZrHmYgd7YiEy0HQqAjwAwg58PPpVvO5tBSQD1ycPI0jjGHE91lcT1dBoDtT rDpw2jrPjGtc9ujPJ97qgpYnNcucFNRelJJUl0EU+rditVedYdNMsWgwHNWhzj6eR652 DRLHyJAhi3f1bbJZd7I/yyOfV9dmmyblHAjISR1Z3+/2Z45Qqib0wEAuXsijQOLuXjxV hhhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H5vxxUEy; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g25si10837704eds.466.2021.06.14.03.49.47; Mon, 14 Jun 2021 03:50:10 -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=@linuxfoundation.org header.s=korg header.b=H5vxxUEy; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233803AbhFNKsK (ORCPT + 99 others); Mon, 14 Jun 2021 06:48:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:46340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233591AbhFNKkz (ORCPT ); Mon, 14 Jun 2021 06:40:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 68DCE61206; Mon, 14 Jun 2021 10:34:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666900; bh=3LvHQp1xxlyxC7ZpjBoqWXgvRjOcDdp7uDfoI2xNWCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H5vxxUEyOwz+ndXoSUx63jziBRew5CT36a0wcSVdxDDs0vkizYkrIvCJz1iodw4l8 NtbeSIhKC5Ld88p94TbeTU0zfgM3i5FARcWs4xoPo23lwjrAvygozilbpiuvz8IEnD AXeD51QFoVbf0DGSQbL5P0jNkQoQNOGjN/mp/1hM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tiezhu Yang , Steven Rostedt , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 4.19 21/67] MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER Date: Mon, 14 Jun 2021 12:27:04 +0200 Message-Id: <20210614102644.474350651@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102643.797691914@linuxfoundation.org> References: <20210614102643.797691914@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tiezhu Yang [ Upstream commit 78cf0eb926cb1abeff2106bae67752e032fe5f3e ] 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 Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- 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 5530070e0d05..57497a26e79c 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.30.2