public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	"Brown, Len" <len.brown@intel.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: driver model, duplicate names question
Date: Tue, 16 Jul 2013 11:54:31 -0700	[thread overview]
Message-ID: <51E596E7.5040504@linux.intel.com> (raw)
In-Reply-To: <20130716183149.GA6164@kroah.com>

Hi,

I am assigned to do add a powercap class. There are several 
technologies, which will allow to
add a power budget to an individual device. For example, you can set a 
power budget to
a individual physical cpu package, each core and uncore devices, GPUs, 
DRAM etc.

+The Power Capping framework organizes power capping devices under a tree structure.
+At the root level, each device is under some "controller", which is the enabler
+of technology. For example this can be "RAPL".
+Under each controllers, there are multiple power zones, which can be independently
+monitored and controlled.
+Each power zone can be organized as a tree with parent, children and siblings.
+Each power zone defines attributes to enable power monitoring and constraints.
+
+Example Sys-FS Interface
+
+/sys/class/power_cap/intel-rapl
+├── package-0
+│   ├── constraint-0
+│   │   ├── name
+│   │   ├── power_limit_uw
+│   │   └── time_window_us
+│   ├── constraint-1
+│   │   ├── name
+│   │   ├── power_limit_uw
+│   │   └── time_window_us
+│   ├── core
+│   │   ├── constraint-0
+│   │   │   ├── name
+│   │   │   ├── power_limit_uw
+│   │   │   └── time_window_us
+│   │   ├── energy_uj
+│   │   └── max_energy_range_uj
+│   ├── dram
+│   │   ├── constraint-0
+│   │   │   ├── name
+│   │   │   ├── power_limit_uw
+│   │   │   └── time_window_us
+│   │   ├── energy_uj
+│   │   └── max_energy_range_uj
+│   ├── energy_uj
+│   ├── max_energy_range_uj
+│   └── max_power_range_uw
+├── package-1
+│   ├── constraint-0
+│   │   ├── name
+│   │   ├── power_limit_uw
+│   │   └── time_window_us
+│   ├── constraint-1
+│   │   ├── name
+│   │   ├── power_limit_uw
+│   │   └── time_window_us
+│   ├── core
+│   │   ├── constraint-0
+│   │   │   ├── name
+│   │   │   ├── power_limit_uw
+│   │   │   └── time_window_us
+│   │   ├── energy_uj
+│   │   └── max_energy_range_uj
+│   ├── dram
+│   │   ├── constraint-0
+│   │   │   ├── name
+│   │   │   ├── power_limit_uw
+│   │   │   └── time_window_us
+│   │   ├── energy_uj
+│   │   └── max_energy_range_uj
+│   ├── energy_uj
+│   ├── max_energy_range_uj
+│   └── max_power_range_uw
+├── power
+│   ├── async
+│   ├── autosuspend_delay_ms
+│   ├── control
+│   ├── runtime_active_kids
+│   ├── runtime_active_time
+│   ├── runtime_enabled
+│   ├── runtime_status
+│   ├── runtime_suspended_time
+│   └── runtime_usage
+├── subsystem -> ../../../../class/power_cap
+└── uevent
+
+For example, above powercap sys-fs tree represents RAPL(Running Average Power Limit)
+type controls available in the Intel® 64 and IA-32 Processor Architectures. Here
+under controller "intel-rapl" there are two CPU packages (package-0/1), which can
+provide power monitoring and controls. A RAPL controller provides control for each
+CPU package, so it can have one node for each package. In addition to providing
+monitoring and control at package level, each package is further divided into
+power zones (called domains in the RAPL specifications). Here zones represent controls
+for core and dram  parts. These zones can be represented as children of package.
+Under RAPL framework there are two constraints, one for short term and one for long term,
+with two different time windows. These can be represented as two constraints, with
+different time windows, power limits and names.


Thanks,
Srinivas




On 07/16/2013 11:31 AM, Greg KH wrote:
> On Tue, Jul 16, 2013 at 11:29:42AM -0700, Srinivas Pandruvada wrote:
>> Thanks for the quick response. Here I am creating virtual devices using
>> device_register.
>> I have attached a simple test program, which will give error.
>>
>> This is my intention:
>>
>> $> cd /sys/class/test_class
>> $> ls
>> power_zone_cpu_package_0
>> power_zone_cpu_package_1
> Wait, you are mixing a class and a "real" bus up.  This will fail as
> your devices all end up on the virtual "bus" with the same name, in the
> same location on the bus (look in /sys/devices/virtual/ for where they
> will end up at.
>
> That will fail, and rightly so.
>
> Try using this with the proper 'struct bus_type' and let me know if
> creating a device there with the same name will also fail.
>
> Oh crud, it will, because we can't create symlinks with the same bus
> type in the /sys/bus/BUSTYPE/devices/ directory.
>
> So, don't use the same name for a device on the same bus, that way
> causes confusion :)
>
> Let's get back to your original "problem", what again are you trying to
> solve?  There should be a way to resolve this without having to deal
> with duplicate names, perhaps you just want an attribute group with a
> common name?
>
> thanks,
>
> greg k-h
>


  reply	other threads:[~2013-07-16 18:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 16:34 driver model, duplicate names question Srinivas Pandruvada
2013-07-16 16:44 ` Greg KH
2013-07-16 18:29   ` Srinivas Pandruvada
2013-07-16 18:31     ` Greg KH
2013-07-16 18:54       ` Srinivas Pandruvada [this message]
2013-07-16 19:04         ` Greg KH
2013-07-16 19:33           ` Srinivas Pandruvada
2013-07-16 19:32             ` Greg KH
2013-07-16 20:11               ` Srinivas Pandruvada
     [not found]               ` <51E6D95B.1070203@linux.intel.com>
2013-07-17 17:48                 ` Greg KH
2013-07-17 18:09               ` Srinivas Pandruvada
2013-07-17 18:31                 ` Greg KH
2013-07-17 18:55                   ` Srinivas Pandruvada

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=51E596E7.5040504@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /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