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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A61BEB64DC for ; Tue, 11 Jul 2023 14:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DLW/v0cYdHZ3+AkBBy1P5aOmGRqJPXOkVa6f1n0sB/0=; b=SM4BmXjvQK/X6d g5pFyyjeo+83lYyz6n88cVqMTuWxHO2gs+6p1rl9wGed3T6TXRtYhgF1LW6KbK+ZD4sFC/vULqnQn GT49r9UjQWPn7r2RS3ayN5tqqCA4b+QbRao3oVySQkGQqyCJ/T2T6mWmR6KvwRlZqEAlJIp3cNws+ nWnS9OzfRUzEb1kYdu+n3jTRo8Vw0RtfGXSYFgQf70C7de5NSqSMye0oFNO5sWwQNQQ5wE2/WecIx jdKz4zTx4X9uh9Epv4RsfjLjgsO3+Z/UQ03ZXo70hL+VfIdhTFOL5j19cZWT2zD9LMMUVyDUWvJSu 4Hj5N4suLWKXrkgT2Wqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJE01-00F4B3-2R; Tue, 11 Jul 2023 14:05:53 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJDzz-00F4AA-0F for linux-arm-kernel@lists.infradead.org; Tue, 11 Jul 2023 14:05:52 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E00561360; Tue, 11 Jul 2023 14:05:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09043C433C8; Tue, 11 Jul 2023 14:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689084349; bh=eQpT1Up302VIq5YjJenPPzwILjKJ/R7N7irZVDRMpYc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OiSXGJB1/DmuV2ZcN9TL2+Txp4Y1alpI18Lu71pbfaKPVBzndZB8adBT5eX91sOR4 BOlQ/S615hLk2ClPyUrX0DM6z9+g8gz+5iwFhTa3dA/O+/Gvvx2v6aFbeR+oxvE0Uw vN56TttZ2+PBX1iM8t0CM5S9SWKytQOPvYmvHvlE= Date: Tue, 11 Jul 2023 16:05:46 +0200 From: Greg Kroah-Hartman To: quanyang.wang@windriver.com Cc: Suzuki K Poulose , Alexander Shishkin , Tingwei Zhang , Mathieu Poirier , Kim Phillips , Sebastian Siewior , Thomas Gleixner , Steven Rostedt , linux-rt-users@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] coresight: etm3x: convert struct etm_drvdata's spinlock to raw_spinlock Message-ID: <2023071134-mardi-lyricist-e5b0@gregkh> References: <20230711070536.3944458-1-quanyang.wang@windriver.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230711070536.3944458-1-quanyang.wang@windriver.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230711_070551_157449_146B7327 X-CRM114-Status: GOOD ( 12.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 11, 2023 at 03:05:36PM +0800, quanyang.wang@windriver.com wrote: > From: Quanyang Wang > > For PREEMPT_RT kernel, spinlock_t locks become sleepable. The functions > etm_dying_cpu and etm_starting_cpu which call spin_lock/unlock run in > an irq-disabled context, this will trigger the following calltrace: > > BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:46 > in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 25, name: migration/1 > preempt_count: 1, expected: 0 > RCU nest depth: 0, expected: 0 > 1 lock held by migration/1/25: > #0: 82a7587c (&drvdata->spinlock){....}-{2:2}, at: etm_dying_cpu+0x28/0x54 > Preemption disabled at: > [<801ec760>] cpu_stopper_thread+0x94/0x120 > CPU: 1 PID: 25 Comm: migration/1 Not tainted 6.1.35-rt10-yocto-preempt-rt #30 > Hardware name: Xilinx Zynq Platform > Stopper: multi_cpu_stop+0x0/0x174 <- __stop_cpus.constprop.0+0x48/0x88 > unwind_backtrace from show_stack+0x18/0x1c > show_stack from dump_stack_lvl+0x58/0x70 > dump_stack_lvl from __might_resched+0x14c/0x1c0 > __might_resched from rt_spin_lock+0x4c/0x84 > rt_spin_lock from etm_dying_cpu+0x28/0x54 > etm_dying_cpu from cpuhp_invoke_callback+0x140/0x33c > cpuhp_invoke_callback from __cpuhp_invoke_callback_range+0xa4/0x104 > __cpuhp_invoke_callback_range from take_cpu_down+0x7c/0xa8 > take_cpu_down from multi_cpu_stop+0x15c/0x174 > multi_cpu_stop from cpu_stopper_thread+0x9c/0x120 > cpu_stopper_thread from smpboot_thread_fn+0x31c/0x360 > smpboot_thread_fn from kthread+0x100/0x124 > kthread from ret_from_fork+0x14/0x2c > > Convert struct etm_drvdata's spinlock to raw_spinlock to fix it. wait, why will a raw_spinlock fix this? Why not fix the root problem here, that of calling these locks inproperly in irq context? How is changing to a raw_spinlock going to fix the above splat? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel