From: Thierry Reding <firstname.lastname@example.org> To: "Rafael J. Wysocki" <email@example.com> Cc: Greg Kroah-Hartman <firstname.lastname@example.org>, Ulf Hansson <email@example.com>, Jon Hunter <firstname.lastname@example.org>, LKML <email@example.com>, Linux PM <firstname.lastname@example.org>, Daniel Vetter <email@example.com>, Lukas Wunner <firstname.lastname@example.org>, Andrzej Hajda <email@example.com>, Russell King - ARM Linux <firstname.lastname@example.org>, Lucas Stach <email@example.com>, Linus Walleij <firstname.lastname@example.org>, Laurent Pinchart <email@example.com>, Marek Szyprowski <firstname.lastname@example.org> Subject: Re: [PATCH] driver core: Fix PM-runtime for links added during consumer probe Date: Tue, 19 Feb 2019 18:07:04 +0100 [thread overview] Message-ID: <20190219170704.GB14351@ulmo> (raw) In-Reply-To: <2442421.P6CTj2BjBs@aspire.rjw.lan> [-- Attachment #1: Type: text/plain, Size: 2670 bytes --] On Tue, Feb 19, 2019 at 05:53:26PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <email@example.com> > > Commit 4c06c4e6cf63 ("driver core: Fix possible supplier PM-usage > counter imbalance") introduced a regression that causes suppliers > to be suspended prematurely for device links added during consumer > driver probe if the initial PM-runtime status of the consumer is > "suspended" and the consumer is resumed after adding the link and > before pm_runtime_put_suppliers() is called. In that case, > pm_runtime_put_suppliers() will drop the rpm_active refcount for > the link by one and (since rpm_active is equal to two after the > preceding consumer resume) the supplier's PM-runtime usage counter > will be decremented, which may cause the supplier to suspend even > though the consumer's PM-runtime status is "active". > > For this reason, partially revert commit 4c06c4e6cf63 as the problem > it tried to fix needs to be addressed somewhat differently, and > change pm_runtime_get_suppliers() and pm_runtime_put_suppliers() so > that the latter only drops rpm_active references acquired by the > former. [This requires adding a new field to struct device_link, > but I coulnd't find a cleaner way to address the issue that would > work in all cases.] > > This causes pm_runtime_put_suppliers() to effectively ignore device > links added during consumer probe, so device_link_add() doesn't need > to worry about ensuring that suppliers will remain active after > pm_runtime_put_suppliers() for links created with DL_FLAG_RPM_ACTIVE > set and it only needs to bump up rpm_active by one for those links, > so pm_runtime_active_link() is not necessary any more. > > Fixes: 4c06c4e6cf63 ("driver core: Fix possible supplier PM-usage counter imbalance") > Reported-by: Jon Hunter <firstname.lastname@example.org> > Tested-by: Jon Hunter <email@example.com> > Tested-by: Ulf Hansson <firstname.lastname@example.org> > Reviewed-by: Ulf Hansson <email@example.com> > Signed-off-by: Rafael J. Wysocki <firstname.lastname@example.org> > --- > > Changes from the RFC version: > - T-by and R-by tags from Jon and Ulf. > - More details in the changelog. > > --- > drivers/base/core.c | 4 ++-- > drivers/base/power/runtime.c | 29 ++++++----------------------- > include/linux/device.h | 1 + > include/linux/pm_runtime.h | 4 ---- > 4 files changed, 9 insertions(+), 29 deletions(-) I'm sure Jon and Ulf have done much more extensive testing, but I've had this applied for most of today and haven't run into any issues, so: Tested-by: Thierry Reding <email@example.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2019-02-19 17:07 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-19 16:53 Rafael J. Wysocki 2019-02-19 17:07 ` Thierry Reding [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190219170704.GB14351@ulmo \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: [PATCH] driver core: Fix PM-runtime for links added during consumer probe' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).