From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796156025; b=2V+oKkfTGzlN/RZugjzcNzP5phjccManMJemeME/t4MwlR0fmZk+bCIAeC4JPMksIzgH dA4Y8WaRdh/03NIeDN6Ajerjmemmb9S+KDTfUcjTPI0qsd/J+0BgfV3NTffeyFth2q9N8 JshFReBq4ctFtzpu9pI+f9dkYO59eKbb91PsHkLFyw7qxaLx+OEj9yTWt5jBoi0a0VviM SzpIE/XZKP5OM9cRvVlWU5Ns2qbY7g8iHwG3Y2lB5qbNnn0IbLxqw62vCQFEtTSsT4KoC fm9EvA1Y+6MNMge8MYwBWaLvC3lU6w/HtJo8dF6odavnE4bp4UQmKcINOeXer2+0Wew== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796156025; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To; bh=IGvRFyzVFdYD5iLZqdx6aWxspGUF2/450Q/e5up6Zgg=; b=ay2U5QJ3AgFY1NXk+INu81mPoi1qXh5drkl4j17ZqM6KefbeTCCf0c1VzLljRqR0PEDx 1rv9j3I331FHVRBiRj2OD3Fn8Kyi6q7+kEGZLhVaWb09QtjfouzVaHapthN/n7+ZXUVB6 TF8BnYx2CrEhMtNFW+lmynXt0ePgBE7NnlZj1F82Hzbk22blPoozNJz0ROnpUcVC9SnIA eKfvR1lgUFEuQieqIOlGnS5Qr+jFSGdrLeX7ZTeSDQwyU3H3sYtL/Qq8pdkp0LBMwV04H 3EkyEUspd/1YeIfZazx3aM4irR9wfac4fmXlddN4ntMi8/byhFjFySYzw/yu12RO7UQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=eXYI6bSb; arc=none smtp.remote-ip=74.125.82.174 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14A80606A320 for ; Tue, 1 Dec 2026 20:13:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 14A80606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=eXYI6bSb Received: by mail-dy1-f174.google.com with SMTP id 5a478bee46e88-386c71feeeaso9727941eec.0 for ; Tue, 01 Dec 2026 12:13:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1796156024; x=1796760824; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=IGvRFyzVFdYD5iLZqdx6aWxspGUF2/450Q/e5up6Zgg=; b=eXYI6bSb/eEWbsjLcUhUKy22IVJgd5YJKQpJdlKwLuLN8LqZCU3vtPzd7H/4aeky3z Tk4DqcmH/P/gU0+2TVkX4z6ohNNjeYs4ojd7BxZRfBFu8FctT5W6gM5BBEm4YSmg8YDm oN9f+kFsqVqJqQdKrvn34eOwYom0tRzSFqu+U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796156024; x=1796760824; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=IGvRFyzVFdYD5iLZqdx6aWxspGUF2/450Q/e5up6Zgg=; b=d34qt9y4obsA9P5Pf5ztYu/Xq66yYCR1R0VoQ+MSb5omrZxZt8WBDxbAG1cTqk55ch e9TURf+dFCMPUphU1JSMwG4TyJC+v+YtdTUH2hwtgnxMhPslcXESZA8rRIi63liWx7La H1vLV1zv3P2XhbwFVmmo8wqG3QnzRKLU00lSWjm/pctWEW9S4GuVI440XxrGZx0Ct+t6 zdUPCyZfwl2CqDmJ8LRLn0v0RVqxJXooMzCpnRml3uL3jLRiTWHsx87TyF4OmW65W1eA kZ/7X5Bvr4mA/Hevi9rsWizAOTVBTXcAP9TzTm7d7MJ2Tlsv0izlHXX3BR5JOf2X985z 5AKQ== X-Forwarded-Encrypted: i=1; AL+hErHZ96cuxhg8nZXPeaqdtZK+IyWvXip/psMDi7WNgZr2mV+7yzY7NS5CwqlHGXMV3Ky/XNRqMUyAsQ==@vger.kernel.org X-Gm-Message-State: APuU4Z8kaLnYHocScENos/8vRExzazO/Rzxhq9+m1AAofysQ+keSIeAt wRFB6MpXZS6J/5GFAmC9ayY+43g5VS8zFw0Scr8b63ybRCYWUxXkVdaBvWIboY8xtw== X-Gm-Gg: AZFdTZfatObSylet3aIoxWUKHy4/H2MEvP0sPtHZVPRTdf7ffLUDo7euKsNYx6YJTSr 0sqevNKCZdVkBqA0cdnH/OwK82JAZr9lZFsC+wdabTOXK+HWV4LUcvGBcH9H35Dov2O7jgczSms pdNX39DdhyB6hd/KVz6FikPeHt0hLWFv0WlADESsCauPdZRnORUX/pnvcPLa0Szy8cm5l4KbkgY jfDd4ugjfcaDqyBzma2iO8nddPsmHAijsULD1qXnePU5OPZlu0SorlWN7UFmbwiLNaBF/qCGT5f 7p7GToIgFMBhppAcsx4kUJXt5bWjH4kaif6cyR8lI0jIMO44V8vnjWPiTS6+4CO7Td1VE04j6Pw a1Q4IAvUgLJF72JikgAQHbiWLbJCvep+yfymfftrTJzKDnUTdy1gGDpH86hrF5qxt/p3PMExLJ4 k7uuBAO6y4K2qfVtY+qLK1lfvKK15678/Fzje+z/zfJAGIMPPtCK2OYINKgy4I3Syqi90mNz6T7 GG3HMS8F6a9dO0x97/luHAZu1AZT9tz/IFaD6xmS8rvnBwowJdcURfg4ATCZDR6Gz70HgfaiDHJ SK493+lRIO95Yc+aFkPTaGMu+D+rfcxiRZLcQymM9SUSh92z6WchR9s5fAnffGyTqTFwooveuQ+ vlG1bn3ZnjOc= X-Received: by 2002:a05:693c:414b:10b0:386:9e32:a65b with SMTP id 5a478bee46e88-3869e32aac6mr35899170eec.1.1796156024130; Tue, 01 Dec 2026 12:13:44 -0800 (PST) Received: from localhost ([2a00:79e0:2e7c:8:4a1f:3e7:2ac1:9562]) by smtp.gmail.com with UTF8SMTPSA id 5a478bee46e88-385666e99fdsm128403032eec.5.2026.12.01.12.13.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 12:13:43 -0800 (PST) Date: Tue, 1 Dec 2026 12:13:41 -0800 From: Brian Norris To: "Rafael J. Wysocki (Intel)" Cc: Ulf Hansson , Linux PM , Alan Stern , Sakari Ailus , Linux Driver Core Development , Javen Xu , Andrew Lunn Subject: Re: [PATCH v2 2/2] PM: runtime: Call rpm_idle() in rpm_resume() for active devices Message-ID: References: <5129504.GXAFRqVoOG@rafael.j.wysocki> <3453261.aeNJFYEL58@rafael.j.wysocki> X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Dec 01, 2026 at 03:08:13PM +0100, Rafael J. Wysocki (Intel) wrote: > On Tue, Dec 1, 2026 at 1:37 AM Brian Norris wrote: > > e.g., the dedicated wakeirq stuff here makes me scratch my head some: > > > > 56f487c78015 PM / Runtime: Update last_busy in rpm_resume > > 4990d4fe327b PM / Wakeirq: Add automated device wake IRQ handling > > > > Commit 56f487c78015 seems to suggest it's relying on a non-zero > > autosuspend delay to avoid problems. (Very sketchy IMO.) I can't tell if > > those are actual functional problems, or if that was just a suboptimal > > behavior / performance problem. > > Wakeup IRQs are a special case to some extent because they occur > during system suspend-resume while runtime PM is disabled anyway and > their role is mostly to wake up the system as a whole rather than to > wake up a specific device. Mostly but not entirely. They clearly care about runtime-PM scenarios too; otherwise commit 56f487c78015 wouldn't really be important. (It was intentionally provided as a prerequiste to commit 4990d4fe327b.) > There are also other places where pm_runtime_resume() is called in > response to a device wakeup signal, but those cases rely on the > .runtime_resume() callback to recognize whether or not the wakeup was > genuine and do something to prevent the device from suspending again. Sure. And presumably "dedicated wake IRQ" devices should also be doing something similar, but it's not clear that they uniformly do so correctly. And as I interpret it, I think commit 56f487c78015 implies the use case in question did not do that. > Resuming a device without taking a reference to it doesn't guarantee > anything in any case because user space may toggle power/control to > "on" and back to "auto" at any time which will at least start an > autosuspend timer for the device. This way or another, rpm_suspend() > may run for the given device at any time and if it is not actively > prevented from suspending the device, it will do that. Ack. I think we all agree there are many reasons this stuff is fragile, if anyone is relying on it :) > > But drivers/net/ethernet/realtek/r8169_main.c is a similar one, that I > > believe is functionally wrong today, and possibly made worse with your > > patch. > > > > Specifically, see: > > > > phylink_link_up -> rtl_mac_link_up() -> pm_request_resume() > > > > In that context, netif_carrier_on() has not yet run, and so > > rtl8169_runtime_idle() may still rearm its suspend timer > > (pm_schedule_suspend()). Because rtl8169_runtime_suspend() does *not* > > recheck netif_carrier_ok(), this means that 10 seconds later, we may > > runtime-suspend an active link. > > That's correct. > > > I believe this technically regressed with commit 8a3c76523e44 ("r8169: > > add support for phylink"), where the calling conditions for > > pm_request_resume() changed. > > > > I'm no netdev / phylink expert, but it feels like maybe the driver > > should be doing get()/put() in .mac_link_{up,down}(), rather than > > relying only on carefully crafted .runtime_idle() + pm_request_resume(). > > I agree. OK, I sent a bugfix here: [PATCH net-next 1/2] r8169: hold runtime PM reference while link is up https://lore.kernel.org/all/20261201115920.net-next.1.Idb20d02896f15f4a79b68a9fee4f3bed1ea49543@changeid/ and paired that with converting to autosuspend / dropping .runtime_idle(). Brian