public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Shi <alex.shi@intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: rob@landley.net, mingo@redhat.com, peterz@infradead.org,
	suresh.b.siddha@intel.com, arjan@linux.intel.com,
	vincent.guittot@linaro.org, tglx@linutronix.de,
	andre.przywara@amd.com, rjw@sisk.pl,
	paul.gortmaker@windriver.com, akpm@linux-foundation.org,
	paulmck@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	cl@linux.com, pjt@google.com
Subject: Re: [RFC PATCH 1/3] sched: add sched_policy and it's sysfs interface
Date: Thu, 08 Nov 2012 22:40:28 +0800	[thread overview]
Message-ID: <509BC45C.5040509@intel.com> (raw)
In-Reply-To: <20121107144137.GD14146@kroah.com>

On 11/07/2012 10:41 PM, Greg KH wrote:
> On Wed, Nov 07, 2012 at 08:27:17PM +0800, Alex Shi wrote:
>>>> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
>>>> index 6345294..5f6a573 100644
>>>> --- a/drivers/base/cpu.c
>>>> +++ b/drivers/base/cpu.c
>>>> @@ -330,4 +330,6 @@ void __init cpu_dev_init(void)
>>>>  		panic("Failed to register CPU subsystem");
>>>>  
>>>>  	cpu_dev_register_generic();
>>>> +
>>>> +	create_sysfs_sched_policy_group(cpu_subsys.dev_root);
>>>
>>> Are you sure you didn't just race with userspace, creating the sysfs
>>> files after the device was created and announced to userspace?
>>
>> Sorry for don't fully get you. Is the sysfs announced to userspace
>> just in 'mount -t sysfs sysfs /sys'?
> 
> No, when the struct device is registered with the driver core.
> 
>> The old powersaving interface: sched_smt_power_savings also
>> created here. and cpu_dev_init was called early before do_initcalls
>> which cpuidle/cpufreq sysfs were initialized.
>>
>> Do you mean this line need to init as core_initcall?
> 
> No, you need to make this as an attribute group for the device, so the
> driver core will create it automatically before it tells userspace that
> the device is now present.
> 
> Use the default attribute groups and you should be fine.

Thanks a lot for explanation! :)

It seems a misunderstanding here. I just create a sysfs group, no device
registered.
The code followed the cpuidle's implementation:

$ ls /sys/devices/system/cpu/cpuidle/
current_driver  current_governor_ro

Seems it's still better to move the group creation into sched/fair.c not
here.
> 
> Hope this helps,
> 
> greg k-h
> 


-- 
Thanks
    Alex

  reply	other threads:[~2012-11-08 14:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 13:09 [RFC PATCH 0/3] power aware scheduling Alex Shi
2012-11-06 13:09 ` [RFC PATCH 1/3] sched: add sched_policy and it's sysfs interface Alex Shi
2012-11-06 13:48   ` Greg KH
2012-11-07 12:27     ` Alex Shi
2012-11-07 14:41       ` Greg KH
2012-11-08 14:40         ` Alex Shi [this message]
2012-11-06 15:20   ` Luming Yu
2012-11-07 13:03     ` Alex Shi
2012-11-06 13:09 ` [RFC PATCH 2/3] sched: power aware load balance, Alex Shi
2012-11-06 19:51   ` Andrew Morton
2012-11-07 12:42     ` Alex Shi
2012-11-07  4:37   ` Preeti Murthy
2012-11-07 13:27     ` Alex Shi
2012-11-11 18:49       ` Preeti Murthy
2012-11-12  3:05         ` Alex Shi
2012-11-06 13:09 ` [RFC PATCH 3/3] sched: add power aware scheduling in fork/exec/wake Alex Shi

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=509BC45C.5040509@intel.com \
    --to=alex.shi@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andre.przywara@amd.com \
    --cc=arjan@linux.intel.com \
    --cc=cl@linux.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rjw@sisk.pl \
    --cc=rob@landley.net \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox