From: Oleg Keri <okerixx@gmail.com>
To: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Beata Michalska <beata.michalska@arm.com>,
Sumit Gupta <sumitg@nvidia.com>,
Prasanna Kumar T S M <ptsm@linux.microsoft.com>,
Russell King <linux@armlinux.org.uk>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Sudeep Holla <sudeep.holla@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
driver-core@lists.linux.dev, linux-pm@vger.kernel.org
Subject: Re: [PATCH v1 1/2] arm64: topology: fix arch_freq_get_on_cpu() overflow above 4.19 GHz
Date: Wed, 9 Sep 2026 21:18:16 +0200 [thread overview]
Message-ID: <178898149654.33757.7826789084252321894@gmail.com> (raw)
In-Reply-To: <20260909113625.000063be@oss.qualcomm.com>
Good point - that reads much better than reusing scale as scratch. Taken
for v2:
scale = arch_scale_freq_capacity(cpu);
freq = (scale * arch_scale_freq_ref(cpu)) >> SCHED_CAPACITY_SHIFT;
Same semantics, and it makes it obvious that both the multiply and the
shift stay in 64 bits and only the final value is narrowed - which is the
whole point of the fix.
Agreed on leaving arch_scale_freq_capacity() out of the expression too.
This file is arm64 only, so unsigned long is 64 bits and it would be safe
here, but it stops being self-evident to the reader and the cast that
would make it evident is worse than keeping the temporary.
Thanks for the review.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Keri <okerixx@gmail.com>
To: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Beata Michalska <beata.michalska@arm.com>,
Sumit Gupta <sumitg@nvidia.com>,
Prasanna Kumar T S M <ptsm@linux.microsoft.com>,
Russell King <linux@armlinux.org.uk>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Sudeep Holla <sudeep.holla@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
driver-core@lists.linux.dev, linux-pm@vger.kernel.org
Subject: Re: [PATCH v1 1/2] arm64: topology: fix arch_freq_get_on_cpu() overflow above 4.19 GHz
Date: Wed, 9 Sep 2026 21:18:16 +0200 [thread overview]
Message-ID: <178898149654.33757.7826789084252321894@gmail.com> (raw)
In-Reply-To: <20260909113625.000063be@oss.qualcomm.com>
Good point - that reads much better than reusing scale as scratch. Taken
for v2:
scale = arch_scale_freq_capacity(cpu);
freq = (scale * arch_scale_freq_ref(cpu)) >> SCHED_CAPACITY_SHIFT;
Same semantics, and it makes it obvious that both the multiply and the
shift stay in 64 bits and only the final value is narrowed - which is the
whole point of the fix.
Agreed on leaving arch_scale_freq_capacity() out of the expression too.
This file is arm64 only, so unsigned long is 64 bits and it would be safe
here, but it stops being self-evident to the reader and the cast that
would make it evident is worse than keeping the temporary.
Thanks for the review.
next prev parent reply other threads:[~2026-09-09 19:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 16:37 [PATCH v1 0/2] arm64/cpufreq: report and track frequencies above 4.19 GHz Oleg Keri
2026-09-06 16:37 ` Oleg Keri
2026-09-06 16:37 ` [PATCH v1 1/2] arm64: topology: fix arch_freq_get_on_cpu() overflow " Oleg Keri
2026-09-06 16:37 ` Oleg Keri
2026-09-09 18:36 ` Jonathan Cameron
2026-09-09 18:36 ` Jonathan Cameron
2026-09-09 19:18 ` Oleg Keri [this message]
2026-09-09 19:18 ` Oleg Keri
2026-09-06 16:37 ` [PATCH v1 2/2] cpufreq: update capacity_freq_ref when the boost state changes Oleg Keri
2026-09-06 16:37 ` Oleg Keri
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=178898149654.33757.7826789084252321894@gmail.com \
--to=okerixx@gmail.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=beata.michalska@arm.com \
--cc=catalin.marinas@arm.com \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=jonathan.cameron@oss.qualcomm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=ptsm@linux.microsoft.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@kernel.org \
--cc=sumitg@nvidia.com \
--cc=viresh.kumar@linaro.org \
--cc=will@kernel.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.