From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796156025; b=I85prW4UIbJkCyqn0u4yA8Hl3/4dEoPC69/iLv3gteuA1X3a+B507RltBOUGNtzKyFUM mP3nTIUcc6QqeugEUyn41j1XcxQOBydHYkxKpxsP/lYMD0VtIMuTZD5dAQJzMTd7YdgpI GwX3hmMVA1LPecJmveWidh7ey1ZGie0kJWPmil4DNC2T6ofnr3P6doFWUoN2bQ4eU8wMg z8WfzVCjFnLq7ig+SwqWjfXqMNGsTAQ4ROfqcTazVnL73Z2hVRxcFiDpn9lxGf+DSlZCL H+D7Rd0UaC/HOH/UqYQugc+p4RMCaKtJoLwC3FXCxgHNCmyJKihVG3RGiHUUislD+Zg== 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=gXccqgMgumr9o6usxfQaP+tKg8pjLymzhXRtUis/+uucYzXrux1CyhiOFiOmEhBb2SAj yqi9cskmjRauBBaH1XQuipdEkMtxYNBe2g3vlbmJVW9QrWoDeaZVSZ+kGgyNDejbSSjKt zWPwNO73uDfRR98vZYpqFz8x/BtZLHp0G4KhOGpABkl9u8BtRouWuMT1W5XcBaUsCwNDB /UX9/mzbYxYDrT/Uii6dBSskUwhHJiHlmYspUscIsq+jOH93p9bNzHlWPcv7vpGRpnOEM 7rO+QGKPjMKjpRIOMzVudyjM6f/gp7jXXDcmAMs3a/ZonahodjlExQrMLPpUkM9MqaQ== 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="VbjSkY/I"; arc=none smtp.remote-ip=74.125.82.179 Received: from mail-dy1-f179.google.com (mail-dy1-f179.google.com [74.125.82.179]) (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 1C531606A32C for ; Tue, 1 Dec 2026 20:13:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1C531606A32C 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, unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=VbjSkY/I Received: by mail-dy1-f179.google.com with SMTP id 5a478bee46e88-38431138772so16669718eec.1 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=lists.linux.dev; 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=VbjSkY/I45M5ChMAxgQCJRJwwg+oifgJ4j7rgPrG0pQA8kd1OM/OK0gcWRArTRV4Up P6MBarHAzfiTDv+ALk+Q6MMI5LUboxo45grxn+2907pFhabtGzDj6SPy+9x1vyMYRkH9 tAdW4LrGErkf9rjGr0rI3WGlxeuai7PlAgjU0= 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=bSSOSst1BLgts9IMel5XRo+4H858SB2PV+dkSaA91trYXT2/BQ4oyI3fQJFz95Nr+x Ozbyi/YHkRvCdAHEa0egF0AgteAxxl4IMM7hcoCRWXa8Jvpqd4QNPX8xim+Ag9kMIhzx Ln8iiuDnvwjNoUpTT6hs/VDi1tsiTCZbVk0ns1fQrDMbkAvUjCLgeFgrPM7hWB7GFakz yeypegR/YrlzjTWkRvBjwpzPJnXgMUeB5DEhGXVNtH7bY2EfEFSzpsOkdynlreNF8+RZ XSc7ccEg5SxT4X6fhUPEX2R/cvabtxhRVXpRVVMZ6VWK6bPJCTLpMIIig5M479Zyo1i8 XbOw== X-Forwarded-Encrypted: i=1; AL+hErFW9BBl1DVXid4hA1TDm2aBHoVq8rQjmf2qxJovsDO5qNTQCf1ncOz0rO6imRC3IiZvcVyMF2xq+LKUyQ==@lists.linux.dev X-Gm-Message-State: APuU4Z86hzANITlMehg+oLnM7vtRzbU5fQGQVvnwg06O/eA4ZbtKlj62 zgYcKaCVvltyICF/9e8foc/QxDXmjr3X1oqYgGIqgA+5aYpmFBVtMkKVMJJH/qcYhQ== X-Gm-Gg: AZFdTZd1L/NnfDTtxDorWH0GnALyQASPBe+SV6DwUQwqWyFZuqyNmQm7T8eQxoZuWgd LdnO+MtyLfrH+Q/2kh//MdPO0cEsMaRqx3fzkRXewiU7J+Hvy1oDIKk8fnmanVkj2K+cn+uPq2Y AULCz2t3SfLy5CUwYJ6zEvm3gvud4xH1g+2jSDcpMjXiH2gfq6l417lPFeXeInaAeRwhbwL+n9Z xX3/iMHhO2qCID3yoxjPKEciXPYlwrlhk8M4Uf4McggTk+c0fR3k0GBFtvMa4Jk7xWti3txkQgx DfGbzBWT1ietXR60U4iTLB6wGzG1SHZGZjYOu6oG+i8fopaNwl6Q5DYW84eqSC9Af8bdgHg2T7W AQQHpgYGv+6IPtw+jy767IEIMRAkxe+p8oV9zH3Mm9VQ9ANw48x4Klir8t/Kpy7Lo5g3Pt6dUp4 PHUSxhSkBrN7JS6jsmAiN1H6I+TfoMHN+MCLm8YM3g2y4JXe7jmLc7NVHdtnax/8eQTiX2K7uHq H7+K5haxGfaD8bjyXb8lG62E50sBNnalhSImh7p+ZO0/UelUsL5GMzc8fdFeyBgwFzQXliLZD+u yxQmFRAMj38Dw0cgydQms8Fm+/xJTERjod0NoLzVE3KzsHbh2cdA3ZxUftylxUSCf10BNKFwbDv LPeeLAa6o5P0= 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: driver-core@lists.linux.dev 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