Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1325073

Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show throttle stats

From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show throttle stats
Date 2016-02-03 10:10 +0100
Message-ID <qY1BL-8mh-7@gated-at.bofh.it> (permalink)
References <qXP7A-7Ux-7@gated-at.bofh.it> <qXP7B-7Ux-13@gated-at.bofh.it> <qY0Z3-7Sl-3@gated-at.bofh.it> <qY1ip-80l-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 03-02-16, 14:12, Shilpasri G Bhat wrote:
> I need the chip-id in the <attr>_show(). With just sysfs_create_group() I will
> get the cpufreq_global_kobject in the <attr>_show() and I will not be able to
> figure out the chip-id.

The more I look at it, the more I am convinced that keeping this
'chip' directory in /sys/devices/system/cpu/cpuX/cpufreq/ makes sense.

So, here is the deal:
- A 'chip' on your platforms can contain multiple group of CPUs, which
  are represented by policies in cpufreq core. i.e. A chip can have
  multiple policies.
- All CPUs present on the same chip are subject to same throttling
  outcomes.
- Right now you are putting the 'chip' directory in cpu/cpufreq/
  directory. Because that directory isn't specific to a policy, but
  entire cpufreq subsystem, you can't get a policy->cpu in the code
  for the kobject in question. And so you are *forced* to create a
  kobject, so that you can do container_of() and get chip->id.
- And then you also need to unnecessarily add another field in the
  chip directory 'chip_mask', that is nothing but an bitwise OR
  operation on policy->related_cpus, so that userspace can know which
  policies/CPUs are managed by the 'chip'.

What I can suggest is:
- Move this directory inside cpuX/cpufreq/ directory, in a similar way
  as to how we create 'stats' directory today.
- You can then get policy->cpu, to get chip->id out of it.
- The only disadvantage here is that the same chip directory will be
  replicated in multiple policies, but that makes it more readable.

Thoughts ?

-- 
viresh

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show throttle stats Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2016-02-02 20:50 +0100
  Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show  throttle stats Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-03 09:30 +0100
    Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show  throttle stats Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2016-02-03 09:50 +0100
      Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show  throttle stats Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-03 10:10 +0100
        Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show  throttle stats Gautham R Shenoy <ego@linux.vnet.ibm.com> - 2016-02-03 13:10 +0100
          Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show  throttle stats Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-03 15:10 +0100
            Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show  throttle stats Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> - 2016-02-03 17:30 +0100
              Re: [PATCH v8 6/6] cpufreq: powernv: Add sysfs attributes to show  throttle stats Viresh Kumar <viresh.kumar@linaro.org> - 2016-02-04 03:00 +0100

csiph-web