Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3677334pxb; Mon, 24 Jan 2022 15:07:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbcvif0G2QBPQ1fKoqpaAXm56Vl4EQHejtUohV8bmM3ko7hz40kbUPQevxP8tAXEHqsLae X-Received: by 2002:a63:6948:: with SMTP id e69mr7701738pgc.16.1643065632908; Mon, 24 Jan 2022 15:07:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065632; cv=none; d=google.com; s=arc-20160816; b=B6OuEFe0JMYiRhWw5eE8FmwxPrBEPVjp7sYc2ifEEpuf0busJweGHaWMyWcbt5ysQH W7ovtu/5pQaTTjrK7QX3jC9oj61D1E7LGST9rIjMQLd5D4LnQC9m+We7G5iubMpP1swQ tgrxmdnfZBqGLZBBrYIsgTF304tSzFan7W2M36Ax2E8leKEQnIMTTcHkQTJK53DqYNfz imrA2NvnjqlTeM1dm6r1Jq/ywkTxvRpC562o0W3RGPaK1k05HqoNA7+0GlasMS9WbUdU dSR2Ffr22G8fSX27iBiRUmyLPf0OgeB9Y6jSzAgE1agGw+9+rQDubO+GalAWKtkd46oc yfFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=wKURN5aanokEYpMOLuWJct3TirMTgKjm7Fk0z29ByXc=; b=C6oGUZ4JgkDO3/IOkQUjl1eSDysZw35+XMC1nLj6S5zC9QmpXS11bm1B9w7GQ4mPaU k9/JvJFKCPa6BKxW3Uc8rKVjkxH51jYg/7lIUnLUeOmLdiva0Cd5g9/G52WviUy8AUSB 85TgjuvVK+klm7ehvp3IigOAjn2IXtFY3CN3q7yCPLZJYWOSx/ymC6yHW+3UEtKy4y6h fM6bBQQLwJVlE24yjHi9pAzTHrMn87b5ZTBliw5qpMQU1Bmz1RflWfMuMmhmFl3mM00Q dma5+l/bI+UUGipO449OiZdjL64OcCB3iFiJZmCUmNNllbKq9oibN7VnTKB+wIBP96rv r1Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gnuweeb.org header.s=default header.b="hz0g4K/x"; 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 d6si13950699pgb.149.2022.01.24.15.07.00; Mon, 24 Jan 2022 15:07:12 -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; dkim=fail header.i=@gnuweeb.org header.s=default header.b="hz0g4K/x"; 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 S1383500AbiAXXEU (ORCPT + 99 others); Mon, 24 Jan 2022 18:04:20 -0500 Received: from ip59.38.31.103.in-addr.arpa.unknwn.cloudhost.asia ([103.31.38.59]:48238 "EHLO gnuweeb.org" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1348958AbiAXWIe (ORCPT ); Mon, 24 Jan 2022 17:08:34 -0500 Received: from [10.5.5.3] (unknown [68.183.184.174]) by gnuweeb.org (Postfix) with ESMTPSA id 21C0DC316C; Mon, 24 Jan 2022 22:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=gnuweeb.org; s=default; t=1643062112; bh=zxxunHJMdrtLLW9Gj1MtrXIOO8UGQKHrxWPSXsEVrXE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hz0g4K/xfkORh2e55UOv0F0+MwoNXnKbRWDbVEfYymEuHpJA0o+OVqZAOi+f9Obog u9wAvZ4egvndPhyr9tAASg2ilf0rnRGIwzx+AsXBZ19lWce3VKMvgqeyADxd7dfWc3 C3mxO6xmZ++sTFqPlH5FM4zC9DlKgFuYXLr6b6K0dxCiZEmOsI7JL6EtvKgGhaAupP PzzGHgzuZ48TcLP5j9mLPV5OGvFrqymJG+Rl8SP3jgUfmakXOiTqdNVkUxYdAEr3wy t1u4T7rX13FrAr8ptO0vbLjcp/ClqTWfGvp+gYzRI0o+1ZJGHwKPI1dnL5RclkrbFv JWZQC9GCqLZVQ== Message-ID: <3f08b8cf-a1dc-4d83-0de2-94203dff9a4c@gnuweeb.org> Date: Tue, 25 Jan 2022 05:08:29 +0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v2] rcu: Add per-CPU rcuc task info to RCU CPU stall warnings Content-Language: en-US To: paulmck@kernel.org Cc: Zqiang , linux-kernel@vger.kernel.org References: <20220124103637.4001386-1-qiang1.zhang@intel.com> <20220124164251.GF4285@paulmck-ThinkPad-P17-Gen-1> From: Ammar Faizi In-Reply-To: <20220124164251.GF4285@paulmck-ThinkPad-P17-Gen-1> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/22 11:42 PM, Paul E. McKenney wrote: > On Mon, Jan 24, 2022 at 05:38:21PM +0700, Ammar Faizi wrote: >> [snip...] >> FWIW, this one makes more sense: >> ``` >> static void rcuc_kthread_dump(struct rcu_data *rdp) >> { >> int cpu; >> unsigned long j; >> struct task_struct *rcuc; >> >> if (!rcu_is_rcuc_kthread_starving(rdp, &j)) >> return; >> >> rcuc = rdp->rcu_cpu_kthread_task; >> if (!rcuc) >> return; >> >> pr_err("%s kthread starved for %ld jiffies, stack dump:\n", rcuc->comm, j); > > Thank you for looking this over and for the great feedback, Ammar! > > I am also wondering why the above message should be printed when the > corresponding CPU is offline or idle. Why not move the above pr_err() > line down to replace the pr_err() line below? > > Thanx, Paul Hi Paul, Thank you for the review. Agree with that. Hopefully this one looks better (untested): ``` static void rcuc_kthread_dump(struct rcu_data *rdp) { int cpu; unsigned long j; struct task_struct *rcuc; rcuc = rdp->rcu_cpu_kthread_task; if (!rcuc) return; cpu = task_cpu(rcuc); if (cpu_is_offline(cpu) || idle_cpu(cpu)) return; if (!rcu_is_rcuc_kthread_starving(rdp, &j)) return; pr_err("%s kthread starved for %ld jiffies\n", rcuc->comm, j); sched_show_task(rcuc); if (!trigger_single_cpu_backtrace(cpu)) dump_cpu_task(cpu); } ``` Recall that dump_cpu_task looks like this: ``` void dump_cpu_task(int cpu) { pr_info("Task dump for CPU %d:\n", cpu); sched_show_task(cpu_curr(cpu)); } ``` which already tells us it's a dump, so "stack dump" in the pr_err() can be omitted. Any comment, Zqiang? -- Ammar Faizi