[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210309043121.546mlvl4jmshogor@vireshk-i7>
Date: Tue, 9 Mar 2021 10:01:21 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Beata Michalska <beata.michalska@....com>
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
vireshk@...nel.org, nm@...com, sboyd@...nel.org
Subject: Re: [PATCH] opp: Invalidate current opp when draining the opp list
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
Powered by blists - more mailing lists