From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Zhang Rui <rui.zhang@intel.com>
Cc: srinivas.pandruvada@linux.intel.com, rkumbako@codeaurora.org,
amit.kucheria@linaro.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v3 3/4] thermal: core: genetlink support for events/cmd/sampling
Date: Sun, 5 Jul 2020 12:54:39 +0200 [thread overview]
Message-ID: <6c859054-1ede-b66c-b28a-c3d7903431b3@linaro.org> (raw)
In-Reply-To: <191a868fc02f6fca93250240cf6c3f7576c6a2c3.camel@intel.com>
On 05/07/2020 08:03, Zhang Rui wrote:
> On Fri, 2020-07-03 at 10:53 +0200, Daniel Lezcano wrote:
>> Initially the thermal framework had a very simple notification
>> mechanism to send generic netlink messages to the userspace.
>>
>> The notification function was never called from anywhere and the
>> corresponding dead code was removed. It was probably a first attempt
>> to introduce the netlink notification.
>>
>> At LPC2018, the presentation "Linux thermal: User kernel interface",
>> proposed to create the notifications to the userspace via a kfifo.
>>
>> The advantage of the kfifo is the performance. It is usually used
>> from
>> a 1:1 communication channel where a driver captures data and sends it
>> as fast as possible to a userspace process.
>>
>> The drawback is that only one process uses the notification channel
>> exclusively, thus no other process is allowed to use the channel to
>> get temperature or notifications.
>>
>> This patch defines a generic netlink API to discover the current
>> thermal setup and adds event notifications as well as temperature
>> sampling. As any genetlink protocol, it can evolve and the versioning
>> allows to keep the backward compatibility.
>>
>> In order to prevent the user from getting flooded with data on a
>> single channel, there are two multicast channels, one for the
>> temperature sampling when the thermal zone is updated and another one
>> for the events, so the user can get the events only without the
>> thermal zone temperature sampling.
>>
>> Also, a list of commands to discover the thermal setup is added and
>> can be extended when needed.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[ ... ]
>> +static int thermal_genl_event_cdev_update(struct param *p)
>> +{
>> + if (nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_ID,
>> + p->cdev_id) ||
>> + nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_CUR_STATE,
>> + p->cdev_state) ||
>> + nla_put_u32(p->msg, THERMAL_GENL_ATTR_CDEV_MAX_STATE,
>> + p->cdev_max_state))
>> + return -EMSGSIZE;
>> +
>> + return 0;
>> +}
>
>> +int thermal_notify_cdev_update(int cdev_id, int cdev_state)
>>> +{
>>> + struct param p = { .cdev_id = cdev_id, .cdev_state = cdev_state
>>> };
>>
>
> .cdev_max_state is not set here.
> I think we need to add a second parameter for cdev_max_state when
> invoking thermal_nofify_cdev_update().
Ah, right. I forgot to add the parameter, thanks for pointing this out.
-- Daniel
[ ... ]
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2020-07-05 10:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-03 8:53 [PATCH v3 1/4] thermal: core: Add helpers to browse the cdev, tz and governor list Daniel Lezcano
2020-07-03 8:53 ` [PATCH v3 2/4] thermal: core: Get thermal zone by id Daniel Lezcano
2020-07-03 8:53 ` [PATCH v3 3/4] thermal: core: genetlink support for events/cmd/sampling Daniel Lezcano
2020-07-03 9:28 ` Amit Kucheria
2020-07-05 6:03 ` Zhang Rui
2020-07-05 10:54 ` Daniel Lezcano [this message]
2020-07-06 7:04 ` Daniel Lezcano
2020-07-03 8:53 ` [PATCH v3 4/4] thermal: core: Add notifications call in the framework Daniel Lezcano
2020-07-03 9:30 ` Amit Kucheria
2020-07-03 17:03 ` kernel test robot
2020-07-03 17:03 ` [RFC PATCH] thermal: core: thermal_cdev_set_cur_state() can be static kernel test robot
2020-07-03 18:22 ` [PATCH v3 4/4] thermal: core: Add notifications call in the framework kernel test robot
2020-07-03 9:14 ` [PATCH v3 1/4] thermal: core: Add helpers to browse the cdev, tz and governor list Amit Kucheria
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=6c859054-1ede-b66c-b28a-c3d7903431b3@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=amit.kucheria@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rkumbako@codeaurora.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
/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).