From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (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 5F23C18C351 for ; Mon, 7 Oct 2024 22:35:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728340530; cv=none; b=uoMeG/R+lpTRmSV7h9qxJNAI90ZagrjiFzYhnAjNgrWcX8SjFWqCoChMzU2KOi2TLp7xy6Fi774+BG+whIAd2FwdLaakK753wi1Qv02dHm/jlayO3kL5QuNFj3sSNpEYkV6ygYo95PG1sIYMv9Kv/ENcWn//9Oo7c+fKDpg5NXk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728340530; c=relaxed/simple; bh=gesjil9Y0RZgbcjmX5qHd/S97rHztDCcedkOm+1cl0k=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TIdeMl4WgCgZPphEuE5+1Uu/AuY4bly4LSLF2BOaGll59psbfutRV5l6kU7kQzSvlvISDglENKDJqtzDxjWe05Xjebh7Otxlmt4M8B5bF+QYREMU1mrnTOx9zsRSWsj47VlzTqU7Rd4ZwtyagBiwY70upQ7Yg5xuGPVaoo+ms3s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=e3VL5Ud8; arc=none smtp.client-ip=209.85.219.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="e3VL5Ud8" Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-e25d164854dso4139031276.2 for ; Mon, 07 Oct 2024 15:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728340526; x=1728945326; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gesjil9Y0RZgbcjmX5qHd/S97rHztDCcedkOm+1cl0k=; b=e3VL5Ud84GLI+E2x3bA8ztpqvuFMv57yd9aYEVQJXCzdGLPTTmXpQqv3Opq72bJmux KBHMo3MVO1HOzdmTO8H+pcTCfVPqaiTDnPTpbQzl0qQR7IL44jHkwS4bzBufrjeR8qhe DDLiaWivcex7UxcVlthWRdgNLBWzi+M8qTeDx57baSkDWFH1agIYPgvRPadbYLCLtjZu 06qTHbdte5aRDCOnGRwQe0feCJbqguEWevqetTaa5WoZI91EWlvvh0bLcBUS4nMqHsf9 D1KWrNcsh7YIcTiYbXUJhkPijHa5aKTMIfa20aY8luGYazLflzR5ecy/UydbOSAfiQM/ 3TDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728340526; x=1728945326; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gesjil9Y0RZgbcjmX5qHd/S97rHztDCcedkOm+1cl0k=; b=soIsv+PR7ZkP0gyYTnyLwryoIwjYj8KoAR2cB5kMJeBOHdM701tLZoohyG8wDKC7r0 7CmMP2gjmFmepZiJBL4gXBdCnDSssQWSDDIBI40HG4HteQxXgIAPrv9BxiUz93pXzaj/ 5lHCM43OKwYoTxwAO/XVpI2x5MVmLqe6eoI/cDvZ8KjPOjQfukWW3jFXB9x6zVecLZs7 SeIfjnOFD2K4xezv0bSHUHY6OXWE0PrWABwT8M1c/m1xor2DUsKozOZglA2dBuY/CTP4 kF5uOlFQDsihIEh/GV6nNdo9bf8R4o/nXBgA/ChtOj8XpnEAqo29H9Z4HWov7TxcmXzD JlzQ== X-Forwarded-Encrypted: i=1; AJvYcCV1D1qoH6U4ByLklLgU6JsEvukAwXm2BrSI24R/BsjFN48dfJwWhvIUzFsK4vV8A8/QUl9K3i98rEqE@vger.kernel.org X-Gm-Message-State: AOJu0Yz/agvmzdeGJj9Vhvi5LcN3sYt8Tz68DGO2l7TPsO1mGUm7pZ4S Z4/CMXF4mQR/sazoUmygEV6rE+Hp6xbbyH9B1roMiMIIu6GG+BwKp3AmU9YnarMZtbz/GEYLjuK MGZUig+ydbi4eMiWrPeFuG1M/zeoDgboAjVlvSg== X-Google-Smtp-Source: AGHT+IGYLLRVc3CeXKReIUVnntYlZ+ULRb29gPUl3UTx4hoqAUGdx6q2aFDzdnacRWqcM/cOYseo4GoEdp7e3a8qLZE= X-Received: by 2002:a05:6902:2305:b0:e28:6ec7:4353 with SMTP id 3f1490d57ef6-e2893964043mr10612649276.54.1728340526338; Mon, 07 Oct 2024 15:35:26 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20241004094101.113349-1-sakari.ailus@linux.intel.com> <20241007184924.GH14766@pendragon.ideasonboard.com> <20241007222502.GG30699@pendragon.ideasonboard.com> In-Reply-To: <20241007222502.GG30699@pendragon.ideasonboard.com> From: Ulf Hansson Date: Tue, 8 Oct 2024 00:34:49 +0200 Message-ID: Subject: Re: [PATCH 00/51] treewide: Switch to __pm_runtime_put_autosuspend() To: Laurent Pinchart Cc: Sakari Ailus , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-gpio@vger.kernel.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-i3c@lists.infradead.org, linux-iio@vger.kernel.org, linux-input@vger.kernel.org, patches@opensource.cirrus.com, iommu@lists.linux.dev, imx@lists.linux.dev, linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-pci@vger.kernel.org, linux-phy@lists.infradead.org, linux-pwm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-sound@vger.kernel.org, linux-spi@vger.kernel.org, linux-staging@lists.linux.dev, linux-usb@vger.kernel.org, linux-serial@vger.kernel.org, greybus-dev@lists.linaro.org, asahi@lists.linux.dev, rafael@kernel.org, Andy Shevchenko Content-Type: text/plain; charset="UTF-8" On Tue, 8 Oct 2024 at 00:25, Laurent Pinchart wrote: > > Hi Ulf, > > On Tue, Oct 08, 2024 at 12:08:24AM +0200, Ulf Hansson wrote: > > On Mon, 7 Oct 2024 at 20:49, Laurent Pinchart wrote: > > > On Fri, Oct 04, 2024 at 04:38:36PM +0200, Ulf Hansson wrote: > > > > On Fri, 4 Oct 2024 at 11:41, Sakari Ailus wrote: > > > > > > > > > > Hello everyone, > > > > > > > > > > This set will switch the users of pm_runtime_put_autosuspend() to > > > > > __pm_runtime_put_autosuspend() while the former will soon be re-purposed > > > > > to include a call to pm_runtime_mark_last_busy(). The two are almost > > > > > always used together, apart from bugs which are likely common. Going > > > > > forward, most new users should be using pm_runtime_put_autosuspend(). > > > > > > > > > > Once this conversion is done and pm_runtime_put_autosuspend() re-purposed, > > > > > I'll post another set to merge the calls to __pm_runtime_put_autosuspend() > > > > > and pm_runtime_mark_last_busy(). > > > > > > > > That sounds like it could cause a lot of churns. > > > > > > > > Why not add a new helper function that does the > > > > pm_runtime_put_autosuspend() and the pm_runtime_mark_last_busy() > > > > things? Then we can start moving users over to this new interface, > > > > rather than having this intermediate step? > > > > > > I think the API would be nicer if we used the shortest and simplest > > > function names for the most common use cases. Following > > > pm_runtime_put_autosuspend() with pm_runtime_mark_last_busy() is that > > > most common use case. That's why I like Sakari's approach of repurposing > > > pm_runtime_put_autosuspend(), and introducing > > > __pm_runtime_put_autosuspend() for the odd cases where > > > pm_runtime_mark_last_busy() shouldn't be called. > > > > Okay, so the reason for this approach is because we couldn't find a > > short and descriptive name that could be used in favor of > > pm_runtime_put_autosuspend(). Let me throw some ideas at it and maybe > > you like it - or not. :-) > > I like the idea at least :-) > > > I don't know what options you guys discussed, but to me the entire > > "autosuspend"-suffix isn't really that necessary in my opinion. There > > are more ways than calling pm_runtime_put_autosuspend() that triggers > > us to use the RPM_AUTO flag for rpm_suspend(). For example, just > > calling pm_runtime_put() has the similar effect. > > To be honest, I'm lost there. pm_runtime_put() calls > __pm_runtime_idle(RPM_GET_PUT | RPM_ASYNC), while > pm_runtime_put_autosuspend() calls __pm_runtime_suspend(RPM_GET_PUT | > RPM_ASYNC | RPM_AUTO). __pm_runtime_idle() ends up calling rpm_idle(), which may call rpm_suspend() - if it succeeds to idle the device. In that case, it tags on the RPM_AUTO flag in the call to rpm_suspend(). Quite similar to what is happening when calling pm_runtime_put_autosuspend(). > > > > > Moreover, it's similar for pm_runtime_mark_last_busy(), it's called > > during rpm_resume() too, for example. So why bother about having > > "mark_last_busy" in the new name too. > > > > That said, my suggestion is simply "pm_runtime_put_suspend". > > Can we do even better, and make pm_runtime_put() to handle autosuspend > automatically when autosuspend is enabled ? As stated above, this is already the case. > > > If you don't like it, I will certainly not object to your current > > approach, even if I think it leads to unnecessary churns. > > > > [...] > > > > Kind regards > > Uffe > > -- > Regards, > > Laurent Pinchart Kind regards Uffe