Re: [PATCH v3 2/3] ab8500: make res_to_temp tables public

2013-02-22 Thread Guenter Roeck
On Thu, Feb 21, 2013 at 02:24:23PM -0800, Anton Vorontsov wrote:
> On Thu, Feb 21, 2013 at 06:32:40PM +0800, Hongbo Zhang wrote:
> > These NTC resistance to temperature tables should be public, so others such 
> > as
> > ab8500 hwmon driver can look up these tables to convert NTC resistance to
> > temperature.
> > 
> > Signed-off-by: Hongbo Zhang 
> > ---
> 
> For 1/3 and 2/3 patches:
> 
> Acked-by: Anton Vorontsov 
> 
> (Do you need EXPORT_SYMBOL()? You don't use this from modules?)
> 
I would think so. Also, the variables should be exported through an include
file.

The variable names are quite generic for global variables; we need to find
something more specific/descriptive.

There is also some overlap with functionality in drivers/hwmon/ntc_thermistor.c.
Wonder if it would be possible to unify the code.

Guenter

> Thanks.
> 
> >  drivers/power/ab8500_bmdata.c | 8 ++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c
> > index f034ae4..53f3324 100644
> > --- a/drivers/power/ab8500_bmdata.c
> > +++ b/drivers/power/ab8500_bmdata.c
> > @@ -11,7 +11,7 @@
> >   * Note that the res_to_temp table must be strictly sorted by falling 
> > resistance
> >   * values to work.
> >   */
> > -static struct abx500_res_to_temp temp_tbl_A_thermistor[] = {
> > +struct abx500_res_to_temp temp_tbl_A_thermistor[] = {
> > {-5, 53407},
> > { 0, 48594},
> > { 5, 43804},
> > @@ -29,7 +29,9 @@ static struct abx500_res_to_temp temp_tbl_A_thermistor[] 
> > = {
> > {65, 12500},
> >  };
> >  
> > -static struct abx500_res_to_temp temp_tbl_B_thermistor[] = {
> > +int temp_tbl_A_size = ARRAY_SIZE(temp_tbl_A_thermistor);
> > +
> > +struct abx500_res_to_temp temp_tbl_B_thermistor[] = {
> > {-5, 20},
> > { 0, 159024},
> > { 5, 151921},
> > @@ -47,6 +49,8 @@ static struct abx500_res_to_temp temp_tbl_B_thermistor[] 
> > = {
> > {65,  82869},
> >  };
> >  
> > +int temp_tbl_B_size = ARRAY_SIZE(temp_tbl_B_thermistor);
> > +
> >  static struct abx500_v_to_cap cap_tbl_A_thermistor[] = {
> > {4171,  100},
> > {4114,   95},
> > -- 
> > 1.8.0
> 

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


Re: [PATCH v3 2/3] ab8500: make res_to_temp tables public

2013-02-22 Thread Anton Vorontsov
On Thu, Feb 21, 2013 at 06:32:40PM +0800, Hongbo Zhang wrote:
> These NTC resistance to temperature tables should be public, so others such as
> ab8500 hwmon driver can look up these tables to convert NTC resistance to
> temperature.
> 
> Signed-off-by: Hongbo Zhang 
> ---

For 1/3 and 2/3 patches:

Acked-by: Anton Vorontsov 

(Do you need EXPORT_SYMBOL()? You don't use this from modules?)

Thanks.

>  drivers/power/ab8500_bmdata.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c
> index f034ae4..53f3324 100644
> --- a/drivers/power/ab8500_bmdata.c
> +++ b/drivers/power/ab8500_bmdata.c
> @@ -11,7 +11,7 @@
>   * Note that the res_to_temp table must be strictly sorted by falling 
> resistance
>   * values to work.
>   */
> -static struct abx500_res_to_temp temp_tbl_A_thermistor[] = {
> +struct abx500_res_to_temp temp_tbl_A_thermistor[] = {
>   {-5, 53407},
>   { 0, 48594},
>   { 5, 43804},
> @@ -29,7 +29,9 @@ static struct abx500_res_to_temp temp_tbl_A_thermistor[] = {
>   {65, 12500},
>  };
>  
> -static struct abx500_res_to_temp temp_tbl_B_thermistor[] = {
> +int temp_tbl_A_size = ARRAY_SIZE(temp_tbl_A_thermistor);
> +
> +struct abx500_res_to_temp temp_tbl_B_thermistor[] = {
>   {-5, 20},
>   { 0, 159024},
>   { 5, 151921},
> @@ -47,6 +49,8 @@ static struct abx500_res_to_temp temp_tbl_B_thermistor[] = {
>   {65,  82869},
>  };
>  
> +int temp_tbl_B_size = ARRAY_SIZE(temp_tbl_B_thermistor);
> +
>  static struct abx500_v_to_cap cap_tbl_A_thermistor[] = {
>   {4171,  100},
>   {4114,   95},
> -- 
> 1.8.0

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


Re: [PATCH v4] sched: fix init NOHZ_IDLE flag

2013-02-22 Thread Frederic Weisbecker
On Thu, Feb 21, 2013 at 09:29:16AM +0100, Vincent Guittot wrote:
> On my smp platform which is made of 5 cores in 2 clusters, I have the
> nr_busy_cpu field of sched_group_power struct that is not null when the
> platform is fully idle. The root cause seems to be:
> During the boot sequence, some CPUs reach the idle loop and set their
> NOHZ_IDLE flag while waiting for others CPUs to boot. But the nr_busy_cpus
> field is initialized later with the assumption that all CPUs are in the busy
> state whereas some CPUs have already set their NOHZ_IDLE flag.
> During the initialization of the sched_domain, we set the NOHZ_IDLE flag when
> nr_busy_cpus is initialized to 0 in order to have a coherent configuration.
> If a CPU enters idle and call set_cpu_sd_state_idle during the build of the
> new sched_domain it will not corrupt the initial state
> set_cpu_sd_state_busy is modified and clears the NOHZ_IDLE only if a non NULL
> sched_domain is attached to the CPU (which is the case during the rebuild)
> 
> Change since V3;
>  - NOHZ flag is not cleared if a NULL domain is attached to the CPU
>  - Remove patch 2/2 which becomes useless with latest modifications
> 
> Change since V2:
>  - change the initialization to idle state instead of busy state so a CPU that
>enters idle during the build of the sched_domain will not corrupt the
>initialization state
> 
> Change since V1:
>  - remove the patch for SCHED softirq on an idle core use case as it was
>a side effect of the other use cases.
> 
> Signed-off-by: Vincent Guittot 
> ---
>  kernel/sched/core.c |4 +++-
>  kernel/sched/fair.c |9 +++--
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 26058d0..c730a4e 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5884,7 +5884,9 @@ static void init_sched_groups_power(int cpu, struct 
> sched_domain *sd)
>   return;
>  
>   update_group_power(sd, cpu);
> - atomic_set(&sg->sgp->nr_busy_cpus, sg->group_weight);
> + atomic_set(&sg->sgp->nr_busy_cpus, 0);
> + set_bit(NOHZ_IDLE, nohz_flags(cpu));
> +
>  }
>  
>  int __weak arch_sd_sibling_asym_packing(void)
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 81fa536..2701a92 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5403,15 +5403,20 @@ static inline void set_cpu_sd_state_busy(void)
>  {
>   struct sched_domain *sd;
>   int cpu = smp_processor_id();
> + int clear = 0;
>  
>   if (!test_bit(NOHZ_IDLE, nohz_flags(cpu)))
>   return;
> - clear_bit(NOHZ_IDLE, nohz_flags(cpu));
>  
>   rcu_read_lock();
> - for_each_domain(cpu, sd)
> + for_each_domain(cpu, sd) {
>   atomic_inc(&sd->groups->sgp->nr_busy_cpus);
> + clear = 1;
> + }
>   rcu_read_unlock();
> +
> + if (likely(clear))
> + clear_bit(NOHZ_IDLE, nohz_flags(cpu));

I fear there is still a race window:

  = CPU 0 = = CPU 1 =
 // NOHZ_IDLE is set
 set_cpu_sd_state_busy() {
 dom1 = rcu_dereference(dom1);
 inc(dom1->nr_busy_cpus)

rcu_assign_pointer(dom 1, NULL)
// create new domain
init_sched_group_power() {
atomic_set(&tmp->nr_busy_cpus, 0);
set_bit(NOHZ_IDLE, nohz_flags(cpu 1));
rcu_assign_pointer(dom 1, tmp)


  
  clear_bit(NOHZ_IDLE, nohz_flags(cpu));
  }


I don't know if there is any sane way to deal with this issue other than
having nr_busy_cpus and nohz_flags in the same object sharing the same
lifecycle.

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


Re: [PATCH v4] sched: fix init NOHZ_IDLE flag

2013-02-22 Thread Vincent Guittot
On 22 February 2013 13:32, Frederic Weisbecker  wrote:
> On Thu, Feb 21, 2013 at 09:29:16AM +0100, Vincent Guittot wrote:
>> On my smp platform which is made of 5 cores in 2 clusters, I have the
>> nr_busy_cpu field of sched_group_power struct that is not null when the
>> platform is fully idle. The root cause seems to be:
>> During the boot sequence, some CPUs reach the idle loop and set their
>> NOHZ_IDLE flag while waiting for others CPUs to boot. But the nr_busy_cpus
>> field is initialized later with the assumption that all CPUs are in the busy
>> state whereas some CPUs have already set their NOHZ_IDLE flag.
>> During the initialization of the sched_domain, we set the NOHZ_IDLE flag when
>> nr_busy_cpus is initialized to 0 in order to have a coherent configuration.
>> If a CPU enters idle and call set_cpu_sd_state_idle during the build of the
>> new sched_domain it will not corrupt the initial state
>> set_cpu_sd_state_busy is modified and clears the NOHZ_IDLE only if a non NULL
>> sched_domain is attached to the CPU (which is the case during the rebuild)
>>
>> Change since V3;
>>  - NOHZ flag is not cleared if a NULL domain is attached to the CPU
>>  - Remove patch 2/2 which becomes useless with latest modifications
>>
>> Change since V2:
>>  - change the initialization to idle state instead of busy state so a CPU 
>> that
>>enters idle during the build of the sched_domain will not corrupt the
>>initialization state
>>
>> Change since V1:
>>  - remove the patch for SCHED softirq on an idle core use case as it was
>>a side effect of the other use cases.
>>
>> Signed-off-by: Vincent Guittot 
>> ---
>>  kernel/sched/core.c |4 +++-
>>  kernel/sched/fair.c |9 +++--
>>  2 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 26058d0..c730a4e 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -5884,7 +5884,9 @@ static void init_sched_groups_power(int cpu, struct 
>> sched_domain *sd)
>>   return;
>>
>>   update_group_power(sd, cpu);
>> - atomic_set(&sg->sgp->nr_busy_cpus, sg->group_weight);
>> + atomic_set(&sg->sgp->nr_busy_cpus, 0);
>> + set_bit(NOHZ_IDLE, nohz_flags(cpu));
>> +
>>  }
>>
>>  int __weak arch_sd_sibling_asym_packing(void)
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 81fa536..2701a92 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -5403,15 +5403,20 @@ static inline void set_cpu_sd_state_busy(void)
>>  {
>>   struct sched_domain *sd;
>>   int cpu = smp_processor_id();
>> + int clear = 0;
>>
>>   if (!test_bit(NOHZ_IDLE, nohz_flags(cpu)))
>>   return;
>> - clear_bit(NOHZ_IDLE, nohz_flags(cpu));
>>
>>   rcu_read_lock();
>> - for_each_domain(cpu, sd)
>> + for_each_domain(cpu, sd) {
>>   atomic_inc(&sd->groups->sgp->nr_busy_cpus);
>> + clear = 1;
>> + }
>>   rcu_read_unlock();
>> +
>> + if (likely(clear))
>> + clear_bit(NOHZ_IDLE, nohz_flags(cpu));
>
> I fear there is still a race window:
>
>   = CPU 0 = = CPU 1 =
>  // NOHZ_IDLE is set
>  set_cpu_sd_state_busy() {
>  dom1 = rcu_dereference(dom1);
>  inc(dom1->nr_busy_cpus)
>
> rcu_assign_pointer(dom 1, NULL)
> // create new domain
> init_sched_group_power() {
> atomic_set(&tmp->nr_busy_cpus, 0);
> set_bit(NOHZ_IDLE, nohz_flags(cpu 1));
> rcu_assign_pointer(dom 1, tmp)
>
>
>
>   clear_bit(NOHZ_IDLE, nohz_flags(cpu));
>   }
>
>
> I don't know if there is any sane way to deal with this issue other than
> having nr_busy_cpus and nohz_flags in the same object sharing the same
> lifecycle.

I wanted to avoid having to use the sd pointer for testing NOHZ_IDLE
flag because it occurs each time we go into idle but it seems to be
not easily feasible.
Another solution could be to add a synchronization step between
rcu_assign_pointer(dom 1, NULL) and create new domain to ensure that
all pending access to old sd values, has finished but this will imply
a potential delay in the rebuild  of sched_domain and i'm not sure
that it's acceptable

Vincent

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


Re: [RFC/PATCH 1/5] context tracking: conditionalize guest support based on CONFIG_KVM

2013-02-22 Thread Frederic Weisbecker
On Wed, Feb 20, 2013 at 11:41:38AM -0800, Kevin Hilman wrote:
> So that it can build on !KVM systems too.
> 
> Signed-off-by: Kevin Hilman 
> ---
>  kernel/context_tracking.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
> index 74f68f4..6fe96b1 100644
> --- a/kernel/context_tracking.c
> +++ b/kernel/context_tracking.c
> @@ -1,5 +1,7 @@
>  #include 
> +#ifdef CONFIG_KVM
>  #include 
> +#endif

The header should take care of the off-case, no need to ifdef its inclusion.

>  #include 
>  #include 
>  #include 
> @@ -62,6 +64,7 @@ void user_exit(void)
>   local_irq_restore(flags);
>  }
>  
> +#ifdef CONFIG_KVM
>  void guest_enter(void)
>  {
>   if (vtime_accounting_enabled())
> @@ -79,6 +82,7 @@ void guest_exit(void)
>   __guest_exit();
>  }
>  EXPORT_SYMBOL_GPL(guest_exit);
> +#endif

Kvm might be built as a module so we can't actually do this unfortunately.

Thanks.

>  
>  void context_tracking_task_switch(struct task_struct *prev,
>struct task_struct *next)
> -- 
> 1.8.1.2
> 

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


big.LITTLE MP status Feb 22, 2013

2013-02-22 Thread David Zinman
https://wiki.linaro.org/projects/big.LITTLE.MP

Work Items for functional completion:
  https://wiki.linaro.org/projects/big.LITTLE.MP/WorkItems

Roadmap Cards:
  Improving HMP Linux scheduling - http://cards.linaro.org/browse/CARD-190

Blueprints and bugs are all now in a single Launchpad project for big.LITTLE:
  https://launchpad.net/linaro-big-little-system


Version 15 of big LITTLE MP has been pulled into the baseline.

Updates:
---
- Rebased over 3.8-rc7
- Stats: Total distinct patches: 36
  - Dropped Patches: Two patches from cpufreq-fixes-v2 (3):
causing some failures.

Details: http://lists.linaro.org/pipermail/linaro-dev/2013-February/015370.html


Items under review:
=

Bugs fix submissions:
1 - Fix the nr_busy_cpus to prevent spurious Idle Load Balance
2 - Fix the load tracking with RT tasks
3 - Fix the active migration when 1 task is running on the pulled CPU

Patches:
1 - Packing small tasks
2 - Force migration of a standalone long running task for LITTLE to big
3 - Use per task load tracking to evaluate the CPU load instead of the
nice priority
4 - Don't move small tasks during periodic load balance, packing small
tasks will do it for us so the scheduler should focus on long running
tasks
5 - Tune sched_domain for HMP


QA
===

big.LITTLE MP LAVA Dashboard
http://validation.linaro.org/lava-server/dashboard/image-reports/linaro-android_vexpress-linaro-mp

Testing:
http://lists.linaro.org/pipermail/linaro-dev/2013-February/015372.html

Bugs:

https://bugs.launchpad.net/linaro-big-little-system/+bug/1083573

https://bugs.launchpad.net/linaro-big-little-system/+bug/1087149:
 - Complicated and being investigated.


-- 
David Zinman, Project Manager
Linaro.org | Open source software for ARM SoCs


bL MP sched_test_results - Summary-Week-7.pdf
Description: Adobe PDF document
___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


big.LITTLE MP Scheduler test summary-Week-8

2013-02-22 Thread Naresh Kamboju
Hi,

Calendar Week 8, 2013: Here is test result summary for big.LITTLE MP
Scheduler test on TC2 platform with Android image

sched_tests.git No of Test Cases Tests Run Tests Pass Tests Fail Absolute
pass rate (%) Failure Analysis/Comments
Regression20 19 19 0 100 -
mpbasicsuite 10 9 9 1 90 -
mpcoresuite 4 4 4 0 75 -
mpextendedsuite 6 6 4 2 66.7 -
mploadbalance  2 2 2 0 100 -

Android Build:
https://android-build.linaro.org/builds/~linaro-android-restricted/vexpress-linaro-mp-test/#build=140

Linux kernel:
Linux version 3.8.0-00922-ge33868e (jenkins-build@ip-10-10-27-33) (gcc
version 4.7.3 20130205 (prerelease) (Linaro GCC 4.7-2013.02-1~dev) ) #1 SMP
Wed Feb 20 04:49:44 UTC 2013

Results spread sheet:
https://docs.google.com/a/linaro.org/spreadsheet/ccc?key=0Ai9ggMs8bsGJdER3azBqWGtXNjRwb1UzSnZ4RGg3OUE#gid=1

Best regards
Naresh Kamboju
___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev