From: Viresh Kumar <viresh.kumar@linaro.org>
To: Beata Michalska <beata.michalska@arm.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
vireshk@kernel.org, nm@ti.com, sboyd@kernel.org
Subject: Re: [PATCH] opp: Invalidate current opp when draining the opp list
Date: Tue, 9 Mar 2021 10:01:21 +0530 [thread overview]
Message-ID: <20210309043121.546mlvl4jmshogor@vireshk-i7> (raw)
In-Reply-To: <20210308181446.GA26783@e120325.cambridge.arm.com>
On 08-03-21, 18:14, Beata Michalska wrote:
> > -bool _opp_remove_all_static(struct opp_table *opp_table)
> > +/*
> > + * Can't remove the OPP from under the lock, debugfs removal needs to happen
> > + * lock less to avoid circular dependency issues. This must be called without
> > + * the opp_table->lock held.
> > + */
> > +static int _opp_drain_list(struct opp_table *opp_table, bool dynamic)
> > {
> > - struct dev_pm_opp *opp;
> > + struct dev_pm_opp *opp, *current_opp = NULL;
> > + int count = 0;
> > +
> > + while ((opp = _opp_get_next(opp_table, dynamic))) {
> > + if (opp_table->current_opp == opp) {
> > + /*
> > + * Reached at current OPP twice, no other OPPs left. The
> > + * last reference to current_opp is dropped from
> > + * _opp_table_kref_release().
> > + */
> > + if (current_opp)
> > + break;
> > +
> > + current_opp = opp;
> > + }
> Having a quick look at the code ...
> Shouldn't the current_opp be moved at the end of the list ?
> Otherwise there is a risk of leaving unreferenced opps (and opp_table).
How exactly ? Note that it is expected that the OPP table isn't being
used by anyone anymore at this point and all the users went away.
> Might be also worth adding warning (?)
>
> WARN_ONCE(!list_is_singular())
It is allowed for the list to contain both static and dynamic OPPs,
and so the list may have more OPPs here.
--
viresh
next prev parent reply other threads:[~2021-03-09 4:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 15:07 [PATCH] opp: Invalidate current opp when draining the opp list Beata Michalska
2021-03-04 17:27 ` Lukasz Luba
2021-03-05 4:24 ` Viresh Kumar
2021-03-05 13:55 ` Beata Michalska
2021-03-08 11:50 ` Viresh Kumar
2021-03-08 18:14 ` Beata Michalska
2021-03-09 4:31 ` Viresh Kumar [this message]
2021-03-09 12:14 ` Beata Michalska
2021-03-10 8:47 ` Viresh Kumar
2021-03-10 23:03 ` Beata Michalska
2021-03-12 3:49 ` Viresh Kumar
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=20210309043121.546mlvl4jmshogor@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=beata.michalska@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=sboyd@kernel.org \
--cc=vireshk@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).