[PATCH v2 for 6.19 0/4] Revise the EM YNL spec to be clearer

Changwoo Min posted 4 patches 1 month ago
.../netlink/specs/dev-energymodel.yaml        | 175 ++++++++++++++
Documentation/netlink/specs/em.yaml           | 113 ----------
MAINTAINERS                                   |   8 +-
include/uapi/linux/dev_energymodel.h          |  82 +++++++
include/uapi/linux/energy_model.h             |  63 ------
kernel/power/em_netlink.c                     | 213 ++++++++++++------
kernel/power/em_netlink_autogen.c             |  58 +++--
kernel/power/em_netlink_autogen.h             |  22 +-
8 files changed, 449 insertions(+), 285 deletions(-)
create mode 100644 Documentation/netlink/specs/dev-energymodel.yaml
delete mode 100644 Documentation/netlink/specs/em.yaml
create mode 100644 include/uapi/linux/dev_energymodel.h
delete mode 100644 include/uapi/linux/energy_model.h
[PATCH v2 for 6.19 0/4] Revise the EM YNL spec to be clearer
Posted by Changwoo Min 1 month ago
This patch set addresses all the concerns raised at [1] to make the EM YNL spec
clearer. It includes the following changes:

- Fix the lint errors (1/4). 
- Rename em.yaml to dev-energymodel.yaml (2/4).  “dev-energymodel” was used
  instead of “device-energy-model”, which was originally proposed [2], because
  the netlink protocol name cannot exceed GENL_NAMSIZ(16). In addition, docs
  strings and flags attributes were added.
- Change cpus' type from string to u64 array of CPU ids (3/4).
- Add dump to get-perf-domains in the EM YNL spec (4/4). A user can fetch
  either information about a specific performance domain with do or information
  about all performance domains with dump. 

ChangeLog v1 -> v2:
- Remove perf-domains in the YNL spec, as do and dump of get-perf-domains
  share the reply format using perf-domain-attrs (4/4).
- Add example outputs of get-perf-domains and get-perf-table for ease of
  understanding (cover letter).

This can be tested using the tool, tools/net/ynl/pyynl/cli.py, for example,
with the following commands:

  $> tools/net/ynl/pyynl/cli.py \
     --spec Documentation/netlink/specs/dev-energymodel.yaml \
     --dump get-perf-domains

    > [{'cpus': [0, 1],                                                                     
    >   'flags': {'perf-domain-skip-inefficiencies', 'perf-domain-microwatts'},             
    >   'perf-domain-id': 0},                                                               
    >  {'cpus': [2, 3, 4], 'flags': {'perf-domain-microwatts'}, 'perf-domain-id': 1},       
    >  {'cpus': [5, 6], 'flags': {'perf-domain-microwatts'}, 'perf-domain-id': 2},          
    >  {'cpus': [7], 'flags': {'perf-domain-microwatts'}, 'perf-domain-id': 3}] 

  $> tools/net/ynl/pyynl/cli.py \
     --spec Documentation/netlink/specs/dev-energymodel.yaml \
     --do get-perf-domains --json '{"perf-domain-id": 0}'

    > {'cpus': [0, 1],                                                                    
    >  'flags': {'perf-domain-skip-inefficiencies', 'perf-domain-microwatts'},            
    >  'perf-domain-id': 0}

  $> tools/net/ynl/pyynl/cli.py \
     --spec Documentation/netlink/specs/dev-energymodel.yaml \
     --do get-perf-table --json '{"perf-domain-id": 0}'

    > {'perf-domain-id': 0,                                                               
    >  'perf-state': [{'cost': 2984,                                                      
    >                  'flags': {'perf-state-inefficient'},                               
    >                  'frequency': 364800,                                               
    >                  'performance': 34,                                                 
    >                  'power': 10147},                
    >                                                                                                    
    >                 ...
    >                 
    >                 {'cost': 6982,
    >                  'flags': set(),
    >                  'frequency': 2265600,
    >                  'performance': 216,
    >                  'power': 150816}]}

  $> tools/net/ynl/pyynl/cli.py \
     --spec Documentation/netlink/specs/dev-energymodel.yaml \
     --subscribe event  --sleep 10

[1] https://lore.kernel.org/lkml/CAD4GDZy-aeWsiY=-ATr+Y4PzhMX71DFd_mmdMk4rxn3YG8U5GA@mail.gmail.com/
[2] https://lore.kernel.org/lkml/CAJZ5v0gpYQwC=1piaX-PNoyeoYJ7uw=DtAGdTVEXAsi4bnSdbA@mail.gmail.com/

Changwoo Min (4):
  PM: EM: Fix yamllint warnings in the EM YNL spec
  PM: EM: Rename em.yaml to dev-energymodel.yaml
  PM: EM: Change cpus' type from string to u64 array in the EM YNL spec
  PM: EM: Add dump to get-perf-domains in the EM YNL spec

 .../netlink/specs/dev-energymodel.yaml        | 175 ++++++++++++++
 Documentation/netlink/specs/em.yaml           | 113 ----------
 MAINTAINERS                                   |   8 +-
 include/uapi/linux/dev_energymodel.h          |  82 +++++++
 include/uapi/linux/energy_model.h             |  63 ------
 kernel/power/em_netlink.c                     | 213 ++++++++++++------
 kernel/power/em_netlink_autogen.c             |  58 +++--
 kernel/power/em_netlink_autogen.h             |  22 +-
 8 files changed, 449 insertions(+), 285 deletions(-)
 create mode 100644 Documentation/netlink/specs/dev-energymodel.yaml
 delete mode 100644 Documentation/netlink/specs/em.yaml
 create mode 100644 include/uapi/linux/dev_energymodel.h
 delete mode 100644 include/uapi/linux/energy_model.h

-- 
2.52.0

Re: [PATCH v2 for 6.19 0/4] Revise the EM YNL spec to be clearer
Posted by Donald Hunter 4 weeks, 1 day ago
Changwoo Min <changwoo@igalia.com> writes:

> This patch set addresses all the concerns raised at [1] to make the EM YNL spec
> clearer. It includes the following changes:
>
> - Fix the lint errors (1/4). 
> - Rename em.yaml to dev-energymodel.yaml (2/4).  “dev-energymodel” was used
>   instead of “device-energy-model”, which was originally proposed [2], because
>   the netlink protocol name cannot exceed GENL_NAMSIZ(16). In addition, docs
>   strings and flags attributes were added.
> - Change cpus' type from string to u64 array of CPU ids (3/4).
> - Add dump to get-perf-domains in the EM YNL spec (4/4). A user can fetch
>   either information about a specific performance domain with do or information
>   about all performance domains with dump. 
>
> ChangeLog v1 -> v2:
> - Remove perf-domains in the YNL spec, as do and dump of get-perf-domains
>   share the reply format using perf-domain-attrs (4/4).
> - Add example outputs of get-perf-domains and get-perf-table for ease of
>   understanding (cover letter).

v2 looks good, thanks!

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Re: [PATCH v2 for 6.19 0/4] Revise the EM YNL spec to be clearer
Posted by Rafael J. Wysocki 4 weeks ago
On Thu, Jan 8, 2026 at 10:39 AM Donald Hunter <donald.hunter@gmail.com> wrote:
>
> Changwoo Min <changwoo@igalia.com> writes:
>
> > This patch set addresses all the concerns raised at [1] to make the EM YNL spec
> > clearer. It includes the following changes:
> >
> > - Fix the lint errors (1/4).
> > - Rename em.yaml to dev-energymodel.yaml (2/4).  “dev-energymodel” was used
> >   instead of “device-energy-model”, which was originally proposed [2], because
> >   the netlink protocol name cannot exceed GENL_NAMSIZ(16). In addition, docs
> >   strings and flags attributes were added.
> > - Change cpus' type from string to u64 array of CPU ids (3/4).
> > - Add dump to get-perf-domains in the EM YNL spec (4/4). A user can fetch
> >   either information about a specific performance domain with do or information
> >   about all performance domains with dump.
> >
> > ChangeLog v1 -> v2:
> > - Remove perf-domains in the YNL spec, as do and dump of get-perf-domains
> >   share the reply format using perf-domain-attrs (4/4).
> > - Add example outputs of get-perf-domains and get-perf-table for ease of
> >   understanding (cover letter).
>
> v2 looks good, thanks!
>
> Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

Applied as 6.19-rc material, thanks!