From: Dmitry Osipenko <digetx@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Zhang Rui <rui.zhang@intel.com>,
Eduardo Valentin <edubezval@gmail.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH V5] thermal: Add cooling device's statistics in sysfs
Date: Mon, 13 Aug 2018 20:02:50 +0300 [thread overview]
Message-ID: <18709513.zahsa7p5Fo@dimapc> (raw)
In-Reply-To: <CAKohpo=BnVJ5uO5+6p6ONhucHkxS893t6d1gtHJZW1kKB0EXOw@mail.gmail.com>
On Monday, 13 August 2018 19:53:33 MSK Viresh Kumar wrote:
> On 13 August 2018 at 22:13, Dmitry Osipenko <digetx@gmail.com> wrote:
> > On Monday, 13 August 2018 19:21:43 MSK Viresh Kumar wrote:
> >> On 13 August 2018 at 21:36, Dmitry Osipenko <digetx@gmail.com> wrote:
> >> > I'm working on adding support of OPP and cooling for NVIDIA Tegra20/30
> >> > CPUFreq driver and stumbled upon a bug that is introduced by this
> >> > patch.
> >> > It is triggered on the driver module unload.
> >>
> >> The problem is that device_unregister() will end up freeing the cdev as
> >> well, so the current sequence is surely wrong.
> >>
> >> > diff --git a/drivers/thermal/thermal_core.c
> >> > b/drivers/thermal/thermal_core.c index 6ab982309e6a..de53c821a282
> >> > 100644
> >> > --- a/drivers/thermal/thermal_core.c
> >> > +++ b/drivers/thermal/thermal_core.c
> >> > @@ -1102,8 +1102,8 @@ void thermal_cooling_device_unregister(struct
> >> > thermal_cooling_device *cdev)>
> >> >
> >> > mutex_unlock(&thermal_list_lock);
> >> >
> >> > ida_simple_remove(&thermal_cdev_ida, cdev->id);
> >> >
> >> > - device_unregister(&cdev->device);
> >> >
> >> > thermal_cooling_device_destroy_sysfs(cdev);
> >> >
> >> > + device_unregister(&cdev->device);
> >>
> >> But this looks wrong as well, as the device is still around while
> >> memory of its sysfs data is gone.
> >
> > Indeed.
> >
> >> Maybe something like this is what we need:
> >>
> >> device_del();
> >> thermal_cooling_device_destroy_sysfs();
> >> device_put();
> >
> > [I just realized that thermal_zone and cooling_device are not
> > interrelated.
> > I'm not familiar with the thermal/ code]
> >
> > Thank you Viresh, your proposal looks good to me and works fine. Will you
> > make a proper patch?
>
> Maybe you send a patch for this and take the credit as well :)
Okay, I'll make the patch. Thank you for the help.
prev parent reply other threads:[~2018-08-13 17:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 10:56 [PATCH V5] thermal: Add cooling device's statistics in sysfs Viresh Kumar
2018-04-02 10:56 ` Viresh Kumar
2018-08-13 16:06 ` Dmitry Osipenko
2018-08-13 16:21 ` Viresh Kumar
2018-08-13 16:43 ` Dmitry Osipenko
2018-08-13 16:53 ` Viresh Kumar
2018-08-13 17:02 ` Dmitry Osipenko [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=18709513.zahsa7p5Fo@dimapc \
--to=digetx@gmail.com \
--cc=edubezval@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.