[PATCH V3 0/3] rust: Introduce CpuId and fix cpumask doctest

Viresh Kumar posted 3 patches 4 months ago
MAINTAINERS                    |   1 +
drivers/cpufreq/rcpufreq_dt.rs |   4 +-
rust/helpers/cpu.c             |   8 +++
rust/helpers/helpers.c         |   1 +
rust/kernel/cpu.rs             | 124 ++++++++++++++++++++++++++++++++-
rust/kernel/cpufreq.rs         |  27 ++++---
rust/kernel/cpumask.rs         |  51 ++++++++++----
7 files changed, 189 insertions(+), 27 deletions(-)
create mode 100644 rust/helpers/cpu.c
[PATCH V3 0/3] rust: Introduce CpuId and fix cpumask doctest
Posted by Viresh Kumar 4 months ago
Hello,

Here is another attempt at fixing the cpumask doctest. This series creates a new
abstraction `CpuId`, which is used to write a cleaner cpumask example which
doesn't fail in those corner cases.

Rebased over v6.16-rc1 + [1].

V2->V3:
- Include the separately sent patch as 3/3 and clarify about `unstable` CpuId.
- Add few debug_assert!().
- Improved comments, commit log.

V1->V2:
- Introduce CpuId.
- Use CpuId in cpufreq, opp, cpumask abstractions.
- Fix cpumask example.

--
Viresh

[1] https://lore.kernel.org/all/4823a58093c6dfa20df62b5c18da613621b9716e.1749554599.git.viresh.kumar@linaro.org/

Viresh Kumar (3):
  rust: cpu: Introduce CpuId abstraction
  rust: Use CpuId in place of raw CPU numbers
  rust: cpu: Add CpuId::current() to retrieve current CPU ID

 MAINTAINERS                    |   1 +
 drivers/cpufreq/rcpufreq_dt.rs |   4 +-
 rust/helpers/cpu.c             |   8 +++
 rust/helpers/helpers.c         |   1 +
 rust/kernel/cpu.rs             | 124 ++++++++++++++++++++++++++++++++-
 rust/kernel/cpufreq.rs         |  27 ++++---
 rust/kernel/cpumask.rs         |  51 ++++++++++----
 7 files changed, 189 insertions(+), 27 deletions(-)
 create mode 100644 rust/helpers/cpu.c


base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
prerequisite-patch-id: 1917103231ee798c4217f6da8bafa603b00e554c
-- 
2.31.1.272.g89b43f80a514
Re: [PATCH V3 0/3] rust: Introduce CpuId and fix cpumask doctest
Posted by Miguel Ojeda 4 months ago
On Tue, Jun 10, 2025 at 3:22 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> Here is another attempt at fixing the cpumask doctest. This series creates a new
> abstraction `CpuId`, which is used to write a cleaner cpumask example which
> doesn't fail in those corner cases.
>
> Rebased over v6.16-rc1 + [1].

Given this is growing, should we apply something trivial right away as
a fix meanwhile? Or are you planning to send this as a fix during the
-rcs?

Thanks!

Cheers,
Miguel
Re: [PATCH V3 0/3] rust: Introduce CpuId and fix cpumask doctest
Posted by Viresh Kumar 4 months ago
On 10-06-25, 19:10, Miguel Ojeda wrote:
> On Tue, Jun 10, 2025 at 3:22 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >
> > Here is another attempt at fixing the cpumask doctest. This series creates a new
> > abstraction `CpuId`, which is used to write a cleaner cpumask example which
> > doesn't fail in those corner cases.
> >
> > Rebased over v6.16-rc1 + [1].
> 
> Given this is growing, should we apply something trivial right away as
> a fix meanwhile? Or are you planning to send this as a fix during the
> -rcs?

Yeah, I am planning to send this for rc2 or rc3.

-- 
viresh