From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32E5327B4F7 for ; Tue, 30 Sep 2025 13:57:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759240670; cv=none; b=t2d/7PXMHHQAUsTV4FWeTfNbNwnjQf1bBusOSqB78odVhfalELm2L+HvpiokNQ9krzQVBFH+m+bZA3cDyIlIP5Y0L9i21QwDhaqWWsy4Ki8rO3vVmDkqlEKFJvm1gKVNzfDLDG0WmrVraiuxDR/alYlpCh6XFs3o3/eCj/SyVCI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759240670; c=relaxed/simple; bh=EDzcGCT23XY617chFDXkwzZHMTi25a4+ow20gFgRZWA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Di/GVtDayYMJj5d7qtWCiQDmaYoE62+6cRyA+r/HU9ZJPK7wuSF3YmI2kyCmyS8+N2kLv71osG1oKKQIJG+A54TDqvnR5xwdZbXU9Lt/gv8MTRUu2OTV1xYDxCcD5T+j2GwHatPrKDf9jng69YfSxjOQzQVDXFg7lOVKTg/1o8I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wbinvd.org; spf=pass smtp.mailfrom=wbinvd.org; dkim=pass (2048-bit key) header.d=wbinvd.org header.i=@wbinvd.org header.b=LCKelp3b; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wbinvd.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wbinvd.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wbinvd.org header.i=@wbinvd.org header.b="LCKelp3b" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-7800ff158d5so3914881b3a.1 for ; Tue, 30 Sep 2025 06:57:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wbinvd.org; s=wbinvd; t=1759240667; x=1759845467; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=gyTvOdpRQ3RLIF7l0tgHW+prs+xDkj9HIOzS/Sl2Gn4=; b=LCKelp3btwXAoswstPcSldy7+ubYotGksHmcz9rDb9xIvwObrXAbCaTbes+SMC7vhE tNVPruhWJUDow0yTFU4gGCgWqc3TgmibwcaTovmdIPCHHk9hEWhN8vjSL4Lcgbg8Bl3F 4RA6huvF9hzsv+WikrAUIeMQBxcW2RCGk2U5AGobE5z8u0cu5GvzKq+yIVl/gwwzI7/K sspv/CrJCSdX241H9AQIZvKtfdIuAjyKg6Hi+xDui1ftP1hEL3qitLoakGf0CUmFDrHJ J1ypRCPXs6Srf3GM4/+8QMY7H7M8G2MeOd842/6VmgGkAdNDc4dCQv3Yxm6jy8zHUol1 GijA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759240667; x=1759845467; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gyTvOdpRQ3RLIF7l0tgHW+prs+xDkj9HIOzS/Sl2Gn4=; b=CIsrXEdK8vqhtJI6rxzfdb/6oUFEwJu3DXhg8U37dKjwyyUpgb3TJ2Wuaa6GR5/u20 7vipAlA6gJ6oAPzKF0fQRftYkxJnI0WIjKbldK1U/3TNK9h4humn1Q9jQMp/me8VwoFr 9hPU4OR1EOOGCBqJIUYq0V+suERV46TqJGLrrD1xtfGXoXUDNMAd2yI+sdtM29vjmxv8 KJAomtcL1g3bba+dXqTSM9rerCYl/pkbyonU1H4jg5lInwbByb0g4XZyFxzGDhvnAsmj 9FGMJsr7WNdocfNUlUf2nzsV3Wx7jl+OZ55arOiBGkk3IIKbF1ohlsAw2ko73VAm1u6k UmVg== X-Forwarded-Encrypted: i=1; AJvYcCW8n5yUZkFr5ztPS1xTwCX/QdAbnkBRLeCR9aeXSmRcmulFm/UPbFvvWPK+hJexMlnI9Nw2cR+/iXS1BoM=@vger.kernel.org X-Gm-Message-State: AOJu0Yxn/Lkndkzz0WyHIych86Et/KqxygMBJoZ5pFMhNSvCmFEN3Ink GkSCXAzB5kOPk6heJAywBc0AYeVHn0BtUJPpQLHQ2DCmmmUAbLavJFqoza0Ixp/W9Rw= X-Gm-Gg: ASbGncuMjwz70Lg4C+5oL19o/Q6/Wmdsr/MScbpjIC/Rztt6AYfh7n4B3VLaqVxoXrg oj9NiaXulKScjStTvtzyoQjk16ldc10umqNMg/SfRQ54VCsh0BXcinYrJlKXoPnzqQDHpX47vFi 8fcrlp7/skf38eg4QsiuVMkgCQhb3LML1qS8pmTVBoO4rLhegzhkRUxKRqv9ASmLY3EpcjZ7+aj 3QaseLaA7rk1TPkzNIwLUHioiUxzj9RcTF52eFBhkkF7h82+r3veWG9ErxNf/rmb0eDCs+7gq5j /kX2uWDJECldp+1ZWyZZ0xBMvhx2CFV898OMq1+T21o0gUK5O2u8JNTUxSkMov4CTSp4CoOZzux jiVNnpbBf8hJ/PAjOXEvzF79EIC0KUXp0vmsOCxaX5k2djN/n7DkyUneQp+3CXwbZSeRzPA== X-Google-Smtp-Source: AGHT+IFioGEUpCSi8t1OoOu+7g5Bc2fS6DDlaI2GFhWOUgvKavqyicXcNzpJSLYHJnk38V5bb31MYQ== X-Received: by 2002:a05:6a00:3c8d:b0:781:27a7:dd00 with SMTP id d2e1a72fcca58-78127a7de7cmr14346212b3a.2.1759240667422; Tue, 30 Sep 2025 06:57:47 -0700 (PDT) Received: from mozart.vkv.me ([192.184.167.117]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7810238f11esm13915481b3a.19.2025.09.30.06.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Sep 2025 06:57:46 -0700 (PDT) Date: Tue, 30 Sep 2025 06:57:44 -0700 From: Calvin Owens To: Breno Leitao Cc: Petr Mladek , John Ogness , Mike Galbraith , Simon Horman , kuba@kernel.org, Pavel Begunkov , Johannes Berg , paulmck@kernel.org, LKML , netdev@vger.kernel.org, boqun.feng@gmail.com, Sergey Senozhatsky , Steven Rostedt Subject: Re: netconsole: HARDIRQ-safe -> HARDIRQ-unsafe lock order warning Message-ID: References: <7a2b44c9e95673829f6660cc74caf0f1c2c0cffe.camel@gmx.de> <5b509b1370d42fd0cc109fc8914272be6dcfcd54.camel@gmx.de> <84a539f4kf.fsf@jogness.linutronix.de> <847by65wfj.fsf@jogness.linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Wednesday 09/10 at 11:26 -0700, Breno Leitao wrote: > On Wed, Sep 10, 2025 at 05:12:43PM +0200, Petr Mladek wrote: > > On Wed 2025-09-10 14:28:40, John Ogness wrote: > > > > @pmladek: We could introduce a new console flag (NBCON_ATOMIC_UNSAFE) so > > > that the callback is only used by nbcon_atomic_flush_unsafe(). > > > > This might be an acceptable compromise. It would try to emit messages > > only at the very end of panic() as the last desperate attempt. > > > > Just to be sure, what do you mean with unsafe? > > > > + taking IRQ unsafe locks? > > Taking IRQ unsafe locks is the major issue we have in netconsole today. > Basically the drivers can implement IRQ unsafe locks in their > .ndo_start_xmit() callback, and in some cases those are IRQ unsafe, > which doesn't match with .write_atomic(), which expect all the inner > locks to be IRQ safe. Hmm, I'm also hitting the below on next-20250926 with translated=strict, the triggering acquisition is here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iommu/iova.c?id=30d4efb2f5a515a60fe6b0ca85362cbebea21e2f#n832 Naively I'd think the IOMMU code would need to be safe to call with interrupts disabled? Do we need raw_spin_lock() in some places there? I'll have more time to dig and maybe send a patch tomorrow, any quick thoughts are appreciated. [ 319.006534][ T16] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 [ 319.006536][ T16] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 16, name: pr/legacy [ 319.006537][ T16] preempt_count: 0, expected: 0 [ 319.006537][ T16] RCU nest depth: 3, expected: 3 [ 319.006538][ T16] 8 locks held by pr/legacy/16: [ 319.006539][ T16] #0: ffffffff831ffbe0 (console_lock){+.+.}-{0:0}, at: legacy_kthread_func+0x1e/0xc0 [ 319.006546][ T16] #1: ffffffff831ffc30 (console_srcu){....}-{0:0}, at: console_flush_all+0xf2/0x430 [ 319.006550][ T16] #2: ffffffff832c3ef8 (target_list_lock){+.+.}-{3:3}, at: write_ext_msg.part.0+0x28/0x4d0 [ 319.006554][ T16] #3: ffffffff83202720 (rcu_read_lock){....}-{1:3}, at: rt_spin_lock+0xd5/0x1a0 [ 319.006557][ T16] #4: ffffffff83202720 (rcu_read_lock){....}-{1:3}, at: __netpoll_send_skb+0x4a/0x3c0 [ 319.006561][ T16] #5: ffff888107c89e98 (_xmit_ETHER#2){+...}-{3:3}, at: __netpoll_send_skb+0x2d6/0x3c0 [ 319.006564][ T16] #6: ffffffff83202720 (rcu_read_lock){....}-{1:3}, at: rt_spin_trylock+0x59/0x130 [ 319.006567][ T16] #7: ffffe8ffffc06218 (&cpu_rcache->lock){+.+.}-{3:3}, at: alloc_iova_fast+0x70/0x2d0 [ 319.006570][ T16] irq event stamp: 20680 [ 319.006571][ T16] hardirqs last enabled at (20679): [] _raw_spin_unlock_irqrestore+0x3c/0x50 [ 319.006573][ T16] hardirqs last disabled at (20680): [] netpoll_send_skb+0x30/0x70 [ 319.006575][ T16] softirqs last enabled at (0): [] copy_process+0x7aa/0x1940 [ 319.006577][ T16] softirqs last disabled at (0): [<0000000000000000>] 0x0 [ 319.006580][ T16] CPU: 0 UID: 0 PID: 16 Comm: pr/legacy Not tainted 6.17.0-rc7-next-20250926 #1 PREEMPT_{RT,LAZY} [ 319.006582][ T16] Hardware name: ASUSTeK COMPUTER INC. WS C246M PRO Series/WS C246M PRO Series, BIOS 3301 03/23/2020 [ 319.006583][ T16] Call Trace: [ 319.006584][ T16] [ 319.006586][ T16] dump_stack_lvl+0x57/0x80 [ 319.006590][ T16] __might_resched.cold+0xec/0xfd [ 319.006592][ T16] rt_spin_lock+0x52/0x1a0 [ 319.006594][ T16] ? alloc_iova_fast+0x70/0x2d0 [ 319.006598][ T16] alloc_iova_fast+0x70/0x2d0 [ 319.006603][ T16] iommu_dma_alloc_iova+0xca/0x100 [ 319.006606][ T16] __iommu_dma_map+0x7f/0x170 [ 319.006611][ T16] iommu_dma_map_phys+0xb7/0x190 [ 319.006615][ T16] dma_map_phys+0xc9/0x130 [ 319.006619][ T16] igc_tx_map.isra.0+0x155/0x570 [ 319.006625][ T16] igc_xmit_frame_ring+0x2f3/0x510 [ 319.006627][ T16] ? rt_spin_trylock+0x59/0x130 [ 319.006631][ T16] netpoll_start_xmit+0x11c/0x190 [ 319.006635][ T16] __netpoll_send_skb+0x32b/0x3c0 [ 319.006640][ T16] netpoll_send_skb+0x3e/0x70 [ 319.006643][ T16] write_ext_msg.part.0+0x457/0x4d0 [ 319.006650][ T16] console_emit_next_record+0xcb/0x1c0 [ 319.006656][ T16] console_flush_all+0x274/0x430 [ 319.006660][ T16] ? devkmsg_write+0x110/0x110 [ 319.006663][ T16] __console_flush_and_unlock+0x34/0xa0 [ 319.006666][ T16] legacy_kthread_func+0x23/0xc0 [ 319.006669][ T16] ? swake_up_locked+0x50/0x50 [ 319.006672][ T16] kthread+0xf9/0x200 [ 319.006675][ T16] ? kthread_fetch_affinity.isra.0+0x40/0x40 [ 319.006678][ T16] ret_from_fork+0xff/0x150 [ 319.006681][ T16] ? kthread_fetch_affinity.isra.0+0x40/0x40 [ 319.006682][ T16] ? kthread_fetch_affinity.isra.0+0x40/0x40 [ 319.006684][ T16] ret_from_fork_asm+0x11/0x20 [ 319.006694][ T16]