lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 18 Feb 2013 13:36:19 +0100
From:	Vincent Guittot <vincent.guittot@...aro.org>
To:	linux-kernel@...r.kernel.org, linaro-dev@...ts.linaro.org,
	peterz@...radead.org, mingo@...nel.org, fweisbec@...il.com,
	rostedt@...dmis.org, efault@....de
Cc:	Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH v3 1/2] sched: fix init NOHZ_IDLE flag

On 8 February 2013 19:05, Vincent Guittot <vincent.guittot@...aro.org> 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.
> We set the NOHZ_IDLE flag when nr_busy_cpus is initialized to 0 in order to
> have a coherent configuration.
>
> The patch 2/2 protects this init against an update of NOHZ_IDLE flag because
> a NULL sched_domain is attached to the CPU during the build of the new
> sched_domain so nohz_kick_needed and set_cpu_sd_state_busy are not called and
> can't clear the NOHZ_IDLE flag

Hi Frederic,

With this v3, the initialization of  NOHZ_IDLE and nr_busy_cpus is be
protected against any race condition because the initial state is the
idle state so if a cpu enters idle, it keeps the same state and we
can't set a busy state until the initialization is complete thanks to
the NULL domain.

Regards,
Vincent

>
> Signed-off-by: Vincent Guittot <vincent.guittot@...aro.org>
> ---
>  kernel/sched/core.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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)
> --
> 1.7.9.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ