From: Chanwoo Choi <cw00.choi@samsung.com>
To: myungjoo.ham@samsung.com
Cc: "kgene@kernel.org" <kgene@kernel.org>,
박경민 <kyungmin.park@samsung.com>,
"rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"ABHILASH KESAVAN" <a.kesavan@samsung.com>,
"tomasz.figa@gmail.com" <tomasz.figa@gmail.com>,
"Krzysztof Kozlowski" <k.kozlowski@samsung.com>,
"Bartlomiej Zolnierkiewicz" <b.zolnierkie@samsung.com>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
대인기 <inki.dae@samsung.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-samsung-soc@vger.kernel.org"
<linux-samsung-soc@vger.kernel.org>
Subject: Re: [PATCHv7 02/10] devfreq: event: Add the list of supported devfreq-event type
Date: Mon, 12 Jan 2015 20:17:20 +0900 [thread overview]
Message-ID: <54B3AD40.3040308@samsung.com> (raw)
In-Reply-To: <768125446.886831421046952335.JavaMail.weblogic@epmlwas09a>
Dear Myungjoo,
On 01/12/2015 04:15 PM, MyungJoo Ham wrote:
>>
>> This patch adds the list of supported devfreq-event type as following.
>> Each devfreq-event device driver would support the various devfreq-event type
>> for devfreq governor at the same time.
>> - DEVFREQ_EVENT_TYPE_RAW_DATA
>> - DEVFREQ_EVENT_TYPE_UTILIZATION
>> - DEVFREQ_EVENT_TYPE_BANDWIDTH
>> - DEVFREQ_EVENT_TYPE_LATENCY
>
> Did you try to say:
>
> A devfreq-event device may support multiple devfreq-event types
> simultaneously.
I think that one devfreq-event device can support multiple devfreq-event types.
but, devfreq-event device might provide only value at one point.
But,
This patch is ambiguous and includes a bug according to your comment
(below switch statement). I'll drop this patch on next patch-set.
This patch will be posted on further patch-set after resolving some issue.
Best Regards,
Chanwoo Choi
>
> If so, your switch expressions are going to screw up.
>
>
>>
>> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>> drivers/devfreq/devfreq-event.c | 58 ++++++++++++++++++++++++++++++++++++-----
>> include/linux/devfreq-event.h | 25 +++++++++++++++---
>> 2 files changed, 73 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
>> index 81448ba..64c1764 100644
>> --- a/drivers/devfreq/devfreq-event.c
>> +++ b/drivers/devfreq/devfreq-event.c
>>
> []
>> - mutex_lock(&edev->lock);
>> - ret = edev->desc->ops->get_event(edev, edata);
>> - mutex_unlock(&edev->lock);
>> + switch (type) {
>
> Bitwise value with switch? (what if type = RAW_DATA | BANDWIDTH, meaning
> this is raw data of the bandwitdh.)
>
>> + case DEVFREQ_EVENT_TYPE_RAW_DATA:
>> + case DEVFREQ_EVENT_TYPE_BANDWIDTH:
>> + case DEVFREQ_EVENT_TYPE_LATENCY:
>> + if ((edata->event > EVENT_TYPE_RAW_DATA_MAX) ||
>> + (edata->total_event > EVENT_TYPE_RAW_DATA_MAX)) {
>
> Is it possible for unsigned long edata->event/total_event to be
> > EVENT_TYPE_RAW_DATA_MAX = ULONG_MAX?
>
> What was your intention?
>
> If you were trying to detect overflow, you need to rethink about it.
> If not, (overflow is harmless or not going to happen) you don't need to
> check it.
>
>
>> + edata->event = edata->total_event = 0;
>> + ret = -EINVAL;
>> + }
>> + break;
>> + case DEVFREQ_EVENT_TYPE_UTILIZATION:
>> + edata->total_event = EVENT_TYPE_UTILIZATION_MAX;
>>
>> - if ((edata->total_event <= 0)
>> - || (edata->event > edata->total_event)) {
>> + if (edata->event > EVENT_TYPE_UTILIZATION_MAX) {
>> + edata->event = edata->total_event = 0;
>> + ret = -EINVAL;
>> + }
>> + break;
>> + default:
>> edata->event = edata->total_event = 0;
>> ret = -EINVAL;
>> + break;
>> }
>>
>> + mutex_unlock(&edev->lock);
>> +
>> return ret;
>> }
>> EXPORT_SYMBOL_GPL(devfreq_event_get_event);
>> diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
>> index b7363f5..13a5703 100644
>> --- a/include/linux/devfreq-event.h
>> +++ b/include/linux/devfreq-event.h
>> @@ -36,6 +36,14 @@ struct devfreq_event_dev {
>> const struct devfreq_event_desc *desc;
>> };
>>
>> +/* The supported type by devfreq-event device */
>> +enum devfreq_event_type {
>> + DEVFREQ_EVENT_TYPE_RAW_DATA = BIT(0),
>> + DEVFREQ_EVENT_TYPE_UTILIZATION = BIT(1),
>> + DEVFREQ_EVENT_TYPE_BANDWIDTH = BIT(2),
>> + DEVFREQ_EVENT_TYPE_LATENCY = BIT(3),
>> +};
>> +
>
> (Being curious) Is it possible to have multiple types
> simultaneously?
>
>
> []
> N�����r��y���b�X��ǧv�^�){.n�+����{�����x,�ȧ�\x17��ܨ}���Ơz�&j:+v���\a����zZ+��+zf���h���~����i���z�\x1e�w���?����&�)ߢ^[fl===
>
WARNING: multiple messages have this Message-ID (diff)
From: cw00.choi@samsung.com (Chanwoo Choi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv7 02/10] devfreq: event: Add the list of supported devfreq-event type
Date: Mon, 12 Jan 2015 20:17:20 +0900 [thread overview]
Message-ID: <54B3AD40.3040308@samsung.com> (raw)
In-Reply-To: <768125446.886831421046952335.JavaMail.weblogic@epmlwas09a>
Dear Myungjoo,
On 01/12/2015 04:15 PM, MyungJoo Ham wrote:
>>
>> This patch adds the list of supported devfreq-event type as following.
>> Each devfreq-event device driver would support the various devfreq-event type
>> for devfreq governor at the same time.
>> - DEVFREQ_EVENT_TYPE_RAW_DATA
>> - DEVFREQ_EVENT_TYPE_UTILIZATION
>> - DEVFREQ_EVENT_TYPE_BANDWIDTH
>> - DEVFREQ_EVENT_TYPE_LATENCY
>
> Did you try to say:
>
> A devfreq-event device may support multiple devfreq-event types
> simultaneously.
I think that one devfreq-event device can support multiple devfreq-event types.
but, devfreq-event device might provide only value at one point.
But,
This patch is ambiguous and includes a bug according to your comment
(below switch statement). I'll drop this patch on next patch-set.
This patch will be posted on further patch-set after resolving some issue.
Best Regards,
Chanwoo Choi
>
> If so, your switch expressions are going to screw up.
>
>
>>
>> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> ---
>> drivers/devfreq/devfreq-event.c | 58 ++++++++++++++++++++++++++++++++++++-----
>> include/linux/devfreq-event.h | 25 +++++++++++++++---
>> 2 files changed, 73 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c
>> index 81448ba..64c1764 100644
>> --- a/drivers/devfreq/devfreq-event.c
>> +++ b/drivers/devfreq/devfreq-event.c
>>
> []
>> - mutex_lock(&edev->lock);
>> - ret = edev->desc->ops->get_event(edev, edata);
>> - mutex_unlock(&edev->lock);
>> + switch (type) {
>
> Bitwise value with switch? (what if type = RAW_DATA | BANDWIDTH, meaning
> this is raw data of the bandwitdh.)
>
>> + case DEVFREQ_EVENT_TYPE_RAW_DATA:
>> + case DEVFREQ_EVENT_TYPE_BANDWIDTH:
>> + case DEVFREQ_EVENT_TYPE_LATENCY:
>> + if ((edata->event > EVENT_TYPE_RAW_DATA_MAX) ||
>> + (edata->total_event > EVENT_TYPE_RAW_DATA_MAX)) {
>
> Is it possible for unsigned long edata->event/total_event to be
> > EVENT_TYPE_RAW_DATA_MAX = ULONG_MAX?
>
> What was your intention?
>
> If you were trying to detect overflow, you need to rethink about it.
> If not, (overflow is harmless or not going to happen) you don't need to
> check it.
>
>
>> + edata->event = edata->total_event = 0;
>> + ret = -EINVAL;
>> + }
>> + break;
>> + case DEVFREQ_EVENT_TYPE_UTILIZATION:
>> + edata->total_event = EVENT_TYPE_UTILIZATION_MAX;
>>
>> - if ((edata->total_event <= 0)
>> - || (edata->event > edata->total_event)) {
>> + if (edata->event > EVENT_TYPE_UTILIZATION_MAX) {
>> + edata->event = edata->total_event = 0;
>> + ret = -EINVAL;
>> + }
>> + break;
>> + default:
>> edata->event = edata->total_event = 0;
>> ret = -EINVAL;
>> + break;
>> }
>>
>> + mutex_unlock(&edev->lock);
>> +
>> return ret;
>> }
>> EXPORT_SYMBOL_GPL(devfreq_event_get_event);
>> diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
>> index b7363f5..13a5703 100644
>> --- a/include/linux/devfreq-event.h
>> +++ b/include/linux/devfreq-event.h
>> @@ -36,6 +36,14 @@ struct devfreq_event_dev {
>> const struct devfreq_event_desc *desc;
>> };
>>
>> +/* The supported type by devfreq-event device */
>> +enum devfreq_event_type {
>> + DEVFREQ_EVENT_TYPE_RAW_DATA = BIT(0),
>> + DEVFREQ_EVENT_TYPE_UTILIZATION = BIT(1),
>> + DEVFREQ_EVENT_TYPE_BANDWIDTH = BIT(2),
>> + DEVFREQ_EVENT_TYPE_LATENCY = BIT(3),
>> +};
>> +
>
> (Being curious) Is it possible to have multiple types
> simultaneously?
>
>
> []
> N?????r??y???b?X???v?^?)?{.n?+????{?????x,???\x17???}????z?&j:+v???\a????zZ+??+zf???h???~????i???z?
?w????????&?)?^[fl===
>
next prev parent reply other threads:[~2015-01-12 11:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 7:15 [PATCHv7 02/10] devfreq: event: Add the list of supported devfreq-event type MyungJoo Ham
2015-01-12 7:15 ` MyungJoo Ham
2015-01-12 11:17 ` Chanwoo Choi [this message]
2015-01-12 11:17 ` Chanwoo Choi
-- strict thread matches above, loose matches on Subject: below --
2015-01-07 23:51 [PATCHv7 00/10] devfreq: Add devfreq-event class to provide raw data for devfreq device Chanwoo Choi
2015-01-07 23:51 ` [PATCHv7 02/10] devfreq: event: Add the list of supported devfreq-event type Chanwoo Choi
2015-01-07 23:51 ` Chanwoo Choi
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=54B3AD40.3040308@samsung.com \
--to=cw00.choi@samsung.com \
--cc=a.kesavan@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=inki.dae@samsung.com \
--cc=k.kozlowski@samsung.com \
--cc=kgene@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=myungjoo.ham@samsung.com \
--cc=rafael.j.wysocki@intel.com \
--cc=robh+dt@kernel.org \
--cc=tomasz.figa@gmail.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 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.