From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5F0F385D9E for ; Thu, 21 May 2026 10:33:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779359640; cv=none; b=Y4uIaqBbqM3BwrjbZSQac5Fjkgmji6AuPPGgwrWKEqBkUBSvJtzIZRilzEXElkcoTZxUY9XMTJYQI7E3B5W57APABUUvRP05ldE2S9WjkwYg9Ana8WqDpGsJ96gsOv9aExBZ3fhV3R/clZPiPHwsdX8sdad9+VV2cQdWGlt1zAM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779359640; c=relaxed/simple; bh=2pyB0b66d9OooIjO1bbEJelR7lkLdpgM45Rqj1axoIM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mCmRjJSiDZU1rVGS0fyCIATQT+2b2hKCVAWDrJvZ6IQ8uUCz5vkzaHmwT41I+f+KSfQ4CpCdxWBhNcp56BpsBbY/vx5gPLq0pcT27Xsk6aJMua5STKMbuvA46dknBucp6XP4xdLzRUhkjDBBDpBddiKUQBZiTZIjjx6wotepqZo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=islqC7+k; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=NWIxcFiw; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="islqC7+k"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="NWIxcFiw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779359637; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yxkfxQ3xSUPn6AB8xQpyVDZX4pCwkMu4r553AvWxGR4=; b=islqC7+kdzT72CZOl9l74uxo/AsJjzb7DKdMwkpV2PYkulX54PNQU/IH79rY+dXUgZ3AND pfL9GZJndOR9IPjMS29WaXQHJJOOJFGG79Trhk/DzhnyiCNXZT4/N+oR14gfIXWikNhxCD ltM4u1n4g52TJVpyafz3FVgjpzG6n24= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-322-X68f7sKZOnqOz81MGqNyIw-1; Thu, 21 May 2026 06:33:56 -0400 X-MC-Unique: X68f7sKZOnqOz81MGqNyIw-1 X-Mimecast-MFC-AGG-ID: X68f7sKZOnqOz81MGqNyIw_1779359635 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-48feb0298d7so46335485e9.1 for ; Thu, 21 May 2026 03:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1779359635; x=1779964435; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=yxkfxQ3xSUPn6AB8xQpyVDZX4pCwkMu4r553AvWxGR4=; b=NWIxcFiwY5U3Ew/vz0Wc4xR6VkxH7IjmYu9/RHMnUyksHkfTTjFAAdk/ju+oI1DkMo AMlWvTQP/JomyciS1jBi95ZbooE9a6//eehiOUmj47HVLn5K2Wu7c37rdvwA4CYUcvyv DmXWHl0jRlLJ4L453Ry3GdQJcV2kQ44yJo+Uwk+CqvXuq3tZqla4KBAU5fnF07bfrDi3 ze4DKMs1luqRuRg9nKs5OLvXzD2qSfzSHHAhBrKRI09XZ2ICkroWLxjsKuozezgVfluW +MFL7L+469vaOdXXDH0qt2Ih5EhctZIA8dwU5f63xljoagrCOarGKfIAvRHg8zFoGhrn Bpsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779359635; x=1779964435; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yxkfxQ3xSUPn6AB8xQpyVDZX4pCwkMu4r553AvWxGR4=; b=YAxKhVADPtkSk1uCaDp7onyxcpmCtYvffQGgz/dtBVkwVgoEqZAa+NTFpY6JMNrl87 3Ovx0e1GWz5p/uAaytfX5cuTEP3oOQqnwk0jJGf94CYM+qL9Eqd9LqDex/KK/XA5099u /nubHdUUIlU6nsZjXSB+Jqf7rRT717mmItQOZdB08ZjqMD6CdrYq1vYF572xfRXh6NWV +g6tzuijY17btWd2HGVUWd7VDNjXZI6ZHPVd8ChnGSQ4fkz5BiEkLk9DLju5omIX+jy2 jDMAcrNKYZRpkzPA5MBKaqCmYEFzs/w0wiUS8xizOcK3INHgubEra1h90cAGHnIN6CUx Sc0Q== X-Forwarded-Encrypted: i=1; AFNElJ876pZfXGCBrMG7m5XkbQldvJZMJtUpGzc+zoeHEtvjnXHOFH6sUfg3/BsqBlV76QNZJvdJzrLZv7MDSXs=@vger.kernel.org X-Gm-Message-State: AOJu0YxiraqPeCKCF42RAJkIrayxSuy48A4OsrhBenDZpPPsQYfO89L+ IjIFQkfCrdw1wwkt+bVN98MH0vt49I0dPVIM3lKjCll2jF7RxzDYZ54IDiwSaKQOwemrtwrjlSD TCaUmzhC5O7L5T7m1NZnFj6pMcAJWHepMaeKdAOica1JHKyMwwjASqBkvffawGhSdXg== X-Gm-Gg: Acq92OFi3cRkB1zr4O1imNIMC3WbkULRFtV5oPaW7ii4tBmno433HUMkLSRt1R7031E HaHVIsfklcdbrfbveQraXjHwpjz6nl0val2/zh99Je3qxpX3ebEaZLN+D774peK5HuwRppzrpnR lgmTNXaa48wM1XHM/3y3LJG728SC3SLkNajqSQ6eRRMxx3zBwqDbq4GXnIwLfp3ngaG7XsZlE2l 3Fn8v1EVtRvTou3rf6vl55PHIpfnzgPquh2BEwGn4kqAtJX4dd+yd1+/ivAOyyG1/9VhFnENZ8I zgoIXaEkg+cibgKzc71IUvMtaHUkAof5PbftRgo6h1NYKXYtgcud8iMo51rNORnxcIpA8SmwKma qRnoC3KixXHblOcssYEd4ahMI7MkP1aWxkGwJOQ94FbhFafaGJpGxrU0n3g== X-Received: by 2002:a05:600c:c0c2:b0:48f:e230:d5ad with SMTP id 5b1f17b1804b1-490360eea2bmr24691665e9.33.1779359635042; Thu, 21 May 2026 03:33:55 -0700 (PDT) X-Received: by 2002:a05:600c:c0c2:b0:48f:e230:d5ad with SMTP id 5b1f17b1804b1-490360eea2bmr24691355e9.33.1779359634600; Thu, 21 May 2026 03:33:54 -0700 (PDT) Received: from [192.168.88.32] ([169.155.232.242]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49035c46915sm13197775e9.13.2026.05.21.03.33.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 May 2026 03:33:54 -0700 (PDT) Message-ID: <5315a3b0-4fc8-4d74-8e27-d7b84bd794c9@redhat.com> Date: Thu, 21 May 2026 12:33:51 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] net: wwan: t7xx: fix race between TX thread and system PM suspend To: Tim JH Chen , netdev@vger.kernel.org Cc: Tim JH Chen , Chandrashekar Devegowda , Liu Haijun , Ricardo Martinez , Loic Poulain , Sergey Ryazanov , Johannes Berg , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , open list References: <20260518075033.58996-1-tim.jh.chen@wnc.com.tw> From: Paolo Abeni Content-Language: en-US In-Reply-To: <20260518075033.58996-1-tim.jh.chen@wnc.com.tw> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 5/18/26 9:50 AM, Tim JH Chen wrote: > When system suspend is triggered while the DPMAIF TX kthread > (t7xx_dpmaif_tx_hw_push_thread) is running, a deadlock can occur > leading to a CPU soft lockup. > > The root cause is two-fold: > > 1. t7xx_dpmaif_suspend() calls t7xx_dpmaif_tx_stop() which only stops > the TX work-queue items (by clearing txq->que_started and waiting on > txq->tx_processing). It does NOT signal the kthread and does NOT > update dpmaif_ctrl->state, which stays DPMAIF_STATE_PWRON. > > 2. The kthread's state guard (line: "if ... state != DPMAIF_STATE_PWRON") > is only checked at the top of each loop iteration. If the thread > already passed this guard, it proceeds unconditionally to call > pm_runtime_resume_and_get() — which tries to acquire the PM spinlock > also held (or contended) by the system PM suspend path. > > The result is a spinlock deadlock observed as: > > watchdog: BUG: soft lockup - CPU#N stuck for 26s! [dpmaif_tx_hw_pu] > RIP: _raw_spin_unlock_irqrestore > Call Trace: > __pm_runtime_resume+0x5b/0x80 > t7xx_dpmaif_tx_hw_push_thread+0xc4 [mtk_t7xx] > > The condition requires ASPM L1 enabled on the endpoint (which extends > the time pm_runtime_resume_and_get() holds the PM lock during L1.2 > link retraining) and hundreds of repeated suspend/resume cycles to > trigger reliably. > > Fix by three coordinated changes: > > - In t7xx_dpmaif_suspend(): immediately set state to DPMAIF_STATE_PWROFF > after stopping the TX queue, then call wake_up() so any sleeping thread > re-evaluates the wait_event condition and stops. > > - In t7xx_dpmaif_resume(): restore state to DPMAIF_STATE_PWRON before > re-enabling the TX queues, symmetric with the suspend change. > Without this the kthread would never wake up after resume. > > - In t7xx_dpmaif_tx_hw_push_thread(): add a second state check > immediately before pm_runtime_resume_and_get() to close the TOCTOU > window between the wait_event guard and the pm call. > > Tested: no soft lockup observed over 500+ suspend/resume cycles with > SIM registered and ASPM L1 enabled (previously triggered in < 300). > > Signed-off-by: Tim JH Chen This is a fix, it should target the 'net' tree including such tag into the subj prefix and should carry a 'Fixes:' tag. Also this is v2 of: https://lore.kernel.org/netdev/TYZPR02MB5232A8C6A2BA56226D97CF4A90062@TYZPR02MB5232.apcprd02.prod.outlook.com/ the subj prefix should have included the relevant revision number and you should have described what changed in the commit message after a '---' separator. Please have a deep read at the process documentation and specifically at: Documentation/process/maintainer-netdev.rst before posting the next revision. /P