From: Sibi Sankar <quic_sibis@quicinc.com>
To: Cristian Marussi <cristian.marussi@arm.com>,
Sudeep Holla <sudeep.holla@arm.com>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<quic_mdtipton@quicinc.com>,
<linux-arm-kernel@lists.infradead.org>,
<quic_asartor@quicinc.com>, <quic_lingutla@quicinc.com>
Subject: Re: [PATCH 2/3] firmware: arm_scmi: Fix freq/power truncation in the perf protocol
Date: Fri, 1 Dec 2023 01:02:25 +0530 [thread overview]
Message-ID: <c8e1adbf-a63e-5a6f-9b4a-e68a2af67779@quicinc.com> (raw)
In-Reply-To: <ZWi3iN3HDc92eMFO@pluto>
On 11/30/23 21:55, Cristian Marussi wrote:
> On Thu, Nov 30, 2023 at 01:56:56PM +0000, Sudeep Holla wrote:
>> On Thu, Nov 30, 2023 at 12:49:42PM +0000, Cristian Marussi wrote:
>>> On Thu, Nov 30, 2023 at 12:05:06PM +0000, Sudeep Holla wrote:
>>>> On Wed, Nov 29, 2023 at 12:27:47PM +0530, Sibi Sankar wrote:
>>>>> Fix frequency and power truncation seen in the performance protocol by
>>>>> casting it with the correct type.
>>>>>
>>>>
>>>> While I always remembered to handle this when reviewing the spec, seem to
>>>> have forgotten when it came to handling in the implementation :(. Thanks
>>>> for spotting this.
>>>>
>>>> However I don't like the ugly type casting. I think we can do better. Also
>>>> looking at the code around the recently added level index mode, I think we
>>>> can simplify things like below patch.
>>>>
>>>> Cristian,
>>>> What do you think ?
>>>>
>>>
>>> Hi
>>>
>>> the cleanup seems nice in general to compact the mult_factor multipliers
>>> in one place, and regarding addressing the problem of truncation without
>>> the need of the explicit casting, should not be enough to change to
>>> additionally also change mult_factor to be an u64 ?
>>>
>>
>> I started exactly with that, but when I completed the patch, there was no
>> explicit need for it, so dropped it again. I can bump mult_factor to be
>> u64 but do you see any other place that would need it apart from having
>> single statement that does multiplication and assignment ? I am exploiting
>> the conditional based on level_indexing_mode here but I agree it may help
>> in backporting if I make mult_factor u64.
>>
>
> Ah right
>
> freq *= dom->multi_fact;
>
> does the trick..but cannot this by itself (under unplausibl conds)
> overflow and does not fit into a u32 mult_factor ?
>
> dom_info->mult_factor =
> (dom_info->sustained_freq_khz * 1000UL)
wouldn't having the 1000UL ensure that we don't truncate though?
Anyway will drop the patch when I re-spin the series.
-Sibi
> / dom_info->sustained_perf_level;
>
>
> Thanks,
> Cristian
>
next prev parent reply other threads:[~2023-11-30 19:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 6:57 [PATCH 0/3] firmware: arm_scmi: Miscellaneous fixes and opp count increase Sibi Sankar
2023-11-29 6:57 ` [PATCH 1/3] firmware: arm_scmi: Fix null pointer dereference during fastchannel init Sibi Sankar
2023-11-30 12:36 ` Cristian Marussi
2023-11-29 6:57 ` [PATCH 2/3] firmware: arm_scmi: Fix freq/power truncation in the perf protocol Sibi Sankar
2023-11-30 12:05 ` Sudeep Holla
2023-11-30 12:49 ` Cristian Marussi
2023-11-30 13:56 ` Sudeep Holla
2023-11-30 16:25 ` Cristian Marussi
2023-11-30 19:32 ` Sibi Sankar [this message]
2023-11-30 20:14 ` Sudeep Holla
2023-11-30 19:51 ` Sudeep Holla
2023-11-29 6:57 ` [PATCH 3/3] firmware: arm_scmi: Increase the maximum opp count Sibi Sankar
2023-11-30 13:00 ` Cristian Marussi
2023-11-30 19:16 ` Sibi Sankar
2023-12-04 13:55 ` (subset) [PATCH 0/3] firmware: arm_scmi: Miscellaneous fixes and opp count increase Sudeep Holla
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=c8e1adbf-a63e-5a6f-9b4a-e68a2af67779@quicinc.com \
--to=quic_sibis@quicinc.com \
--cc=cristian.marussi@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_asartor@quicinc.com \
--cc=quic_lingutla@quicinc.com \
--cc=quic_mdtipton@quicinc.com \
--cc=sudeep.holla@arm.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