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 65F7E37F015 for ; Thu, 28 May 2026 09:22:02 +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=1779960126; cv=none; b=GbFsNk3BX5xiNlkCWfm4QJEs89sYq33B7keUOvvPpxBMCFfT2zLnKVFCKS0oOC1gPGe58IlNFZ0WXPpRpm96mXVDVohqM8uhsOYxX+i3ZTDJcQrFIhotnETlOq3LBXEY+bSPgnl2yRU2ac0v7c7ws/0FFKY/9QTvJ4OP7YYBjyE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779960126; c=relaxed/simple; bh=nJVUxyWZa+V1ByNm3ZhRYPEuoWYvEqyF6CfNU4rh4FA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hFNSOaNoMUXXvD03vO9Gd0AiRAL/dOfnCZb0TTmQ4No3QkoNXv0xx2r6ieVeQPPgB688Z1cFhYolkh/FsfdOPD8S4p9puGlcBrq+9Q66Q4pKIjrC6b12kTpljXyW4N9soqIzPgtnuN1BJ/AxYTN9XG3AwmbDWtOEcIevfE2k74A= 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=HdsOIiWG; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=HfgP+1iL; 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="HdsOIiWG"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="HfgP+1iL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779960121; 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=nLZf/gEoFeqM9D8bf4wJzukHATe1AKQd4HAbi/Vwpq8=; b=HdsOIiWGS5Ve6SoZ9BqHlntlpmTvuYlNuNnxoX2vrBZisjZHO9kb7TQ89oVLGg5Ekad9ps ArUjoDuFxW91hrKH4rUenk0P/MBMqdcnqd8JRfotdLyuV2i6HQs1nZIHidgkbkdDEdiU4B ZAa53GcsOWtHV6326i6vViM76KOQWUM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-DjO_0g6IOcSoatf-j0so5A-1; Thu, 28 May 2026 05:21:58 -0400 X-MC-Unique: DjO_0g6IOcSoatf-j0so5A-1 X-Mimecast-MFC-AGG-ID: DjO_0g6IOcSoatf-j0so5A_1779960118 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4908af8d7f9so6147165e9.1 for ; Thu, 28 May 2026 02:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1779960117; x=1780564917; 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=nLZf/gEoFeqM9D8bf4wJzukHATe1AKQd4HAbi/Vwpq8=; b=HfgP+1iL7ZKklp0OQYjtNvTa6uJPFMrwp9PyYTkFeBoW4LDhFy+lYRrqoI/V7ejqmm Oi+VJH99ntUmGtgEGIuOLiNDL6Gt50fe0E0R+wWZJ+MVmNAih+gozUhRYFCKeOr51FEN 9Jmn/6kJsENPRlDfRX2g+LZ2gw3Pr7HuZWSVSxoq4WdrUYWRa2/EjOoC9Rv2IrEuYMk2 +lb2ztWcqa8764iYmdXf9x/KoQ0S2IanO0V/Zlr3W3rGpIWa7zMItzI4QW46cYg693Ss z1zvupV7FZQL35SldHpA+oAHSdWXydrICh8Ruq4tfrFuiXdPaLExoAHTWcNau0VgbRmp Bfmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779960117; x=1780564917; 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=nLZf/gEoFeqM9D8bf4wJzukHATe1AKQd4HAbi/Vwpq8=; b=ef0oyRDZCaxzd0fYPv3ywkx5jJ5Tcj7fE8CAleZg16JeVHliNWeZOLezYWxnayPfqd /wAmk0iAwIhgH9xkWnWIvuipO6x0sgWzj8x/cGyPVZEH3NRopY09o0b033gSbSWnp1Z3 O2LMmAyW8T3OwL0+DgNWVivA2rX5CPgNwp9ytPvm1f9JDCuPvz1Q59CojX2iGaSbcSJy tYHh7BOVjzuXraVh2eTen6WXO0bZ/78UIHf/zQ3hlhHMCglFIK2LimS58JGQCl2V8yKR PlUZ0oNXwaeqwmV6NI9M0AvUN89hDvllLq3mx3Vb450+7nJwv6Z54AzAHMt0C3ga/GrZ HwxA== X-Gm-Message-State: AOJu0YwRms2sHFJ2S4XKEPSFe/rHI8QEtmRr/TN42V5pC6tomRd40qu3 YzTD9dw2L89UGwfzZZPCQko+PPeYk7RfUZJV+g+HjV2eM5wskSvKO6zd9H2Zzx8niowpQ6RjWsX c+Ben1D+ZLIsklJDbmLkD5Aad17FXdez9AT9+iVafnbpjxyUVy5JjrIa64ySIJZkS0Ign3yXucA == X-Gm-Gg: Acq92OGO+sOqdGs3YU3o7BmrIrwJXuX6bjRvnEm6aSD133L6YtyWp2wRRYDpgZMkjyT Crt5z5OskRuQFQGdGBaWSEkL6didvyKIJghvcq7++9jPtZvNjuZGlcpWjTXcrBQAtSMkhcYyvh7 25GntnfdQWWazDn+uS2otvzQyRQXbG/U+2mdGSPx8cmGH4WLFmdoI9+U8Lq3stakCyDTNpYfTbA YUD5ewr/ZdLU8fyvFxFpip8Uh8OGfl+3bjTBW63D9li16THWukoBaaX/iDajrodqmQsZnUXPkDz RqiWGGpGUv2PYujTSpuu7h99qZtXyyf+RXrj8zQXiLWgz3YAzWkQfG5jWTZfX1QnnWhZDiH0KjN p24hcD9FcvkivDJbTIF1JXO0PQ/ofV5nVzBgELcdUvVt5ZWGVv9isQUgZi61koT5VeQ== X-Received: by 2002:a05:600c:4e4b:b0:485:46fd:7887 with SMTP id 5b1f17b1804b1-49069da6188mr214388045e9.13.1779960117633; Thu, 28 May 2026 02:21:57 -0700 (PDT) X-Received: by 2002:a05:600c:4e4b:b0:485:46fd:7887 with SMTP id 5b1f17b1804b1-49069da6188mr214387655e9.13.1779960117166; Thu, 28 May 2026 02:21:57 -0700 (PDT) Received: from [192.168.88.32] ([216.128.11.12]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45edb549e79sm13177936f8f.7.2026.05.28.02.21.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 May 2026 02:21:56 -0700 (PDT) Message-ID: <2f9c5f6b-1d8d-4c8b-815d-77a40aa76e23@redhat.com> Date: Thu, 28 May 2026 11:21:55 +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: linux-kernel@vger.kernel.org, tim.jh.chen@wnc.com.tw, Chih.Hung.Huang@wnc.com.tw References: <5315a3b0-4fc8-4d74-8e27-d7b84bd794c9@redhat.com> <20260525031320.519435-1-tim.jh.chen@wnc.com.tw> From: Paolo Abeni Content-Language: en-US In-Reply-To: <20260525031320.519435-1-tim.jh.chen@wnc.com.tw> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/25/26 5:13 AM, Tim JH Chen wrote: > v2: Address two concerns raised in AI-assisted code review of v1: > > 1. [High] t7xx_dpmaif_resume() was unconditionally restoring state to > DPMAIF_STATE_PWRON regardless of the state before suspend. If the > modem had already been moved to DPMAIF_STATE_PWROFF by > t7xx_dpmaif_md_state_callback() (MD_STATE_EXCEPTION or > MD_STATE_STOPPED) prior to system suspend, resume would incorrectly > re-arm the TX kthread guard, allowing TX HW writes against a modem > the MD state machine considers stopped or in exception. > > Fix: save dpmaif_ctrl->state into pre_suspend_state at the start of > t7xx_dpmaif_suspend() and restore that saved value in > t7xx_dpmaif_resume(), so a pre-suspend PWROFF is preserved across > the suspend/resume cycle. > > 2. [Medium] The v1 second state check before pm_runtime_resume_and_get() > only narrowed the TOCTOU window -- it did not close it. The state > field was a plain enum read and written without any lock or > READ_ONCE/WRITE_ONCE annotation. After the check passed on one CPU, > the suspend path on another CPU could still set state=PWROFF and > begin PM teardown before the kthread reached pm_runtime_resume_and_get(), > reproducing the deadlock. > > Fix: introduce tx_pm_lock (struct mutex) held by the kthread across > the [state check -> pm_runtime_resume_and_get -> pm_runtime_put] > sequence. t7xx_dpmaif_suspend() acquires this lock before setting > DPMAIF_STATE_PWROFF, which serialises with any in-progress kthread > PM section and guarantees the kthread cannot enter > pm_runtime_resume_and_get() after the state flag is set. > READ_ONCE/WRITE_ONCE are added at every access point of the state > flag that crosses the suspend/resume boundary to prevent > compiler-visible tearing. > > The original v1 description of the root cause and tested fix still > applies (deadlock between t7xx_dpmaif_tx_hw_push_thread calling > pm_runtime_resume_and_get() and the system PM suspend path, triggered > with ASPM L1 enabled after repeated suspend/resume cycles). > > Tested: no soft lockup over 500+ suspend/resume cycles with SIM > registered and ASPM L1 enabled (previously triggered in < 300). > > Fixes: 05f7e89ab ("Linux 6.19") > Signed-off-by: Tim JH Chen Please have a much more better read of: Documentation/process/ especially: Documentation/process/maintainer-netdev.rst before your next submission, because this one is still lacking in many ways: - subj prefix must include the target tree (net) and a revision number (for the next iteration: v3) - fixes tag should point to the commit actually introducing the bug - the commit message should describe the issue and the fix, alike v1, any changelog-related information (~all the above) should land after the tag area and a '---' separator. Also sashiko has still quite a bit of concerns: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260525031320.519435-1-tim.jh.chen%40wnc.com.tw and many of them look real. /P