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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 24 Mar 2014 10:20:29 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Nicholas Mc Guire <der.herr@...r.at>
Cc:	linux-rt-users@...r.kernel.org, linux-kernel@...r.kernel.org,
	tglx@...utronix.de,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH RT] drop migrate_disabled section in _cpu_down

On Mon, 24 Mar 2014 13:20:25 +0100
Nicholas Mc Guire <der.herr@...r.at> wrote:

> HI !
> 
> 
> Minor cleanup: drop unnecessary migrate_disable in _cpu_down
> 
> in kernel/cpu.c:_cpu_down
>     ...
>     cpumask_andnot(cpumask, cpu_online_mask, cpumask_of(cpu));
>     set_cpus_allowed_ptr(current, cpumask);
>     ...
>     migrate_disable();
>     mycpu = smp_processor_id();
>     if (mycpu == cpu) {
>             printk(KERN_ERR "Yuck! Still on unplug CPU\n!");
>             migrate_enable();
>             err = -EBUSY;
>             goto restore_cpus;
>     }
>     migrate_enable();
> 
> If we got migrated off "cpu" then we can not get migrate
> back as the cpus_allowed was updated. so if smp_processor_id(); returns
> anything != cpu we are fine even if migrated off to a third cpu between
> the mycpu = smp_processor_id() and the if (mycpu == cpu). No need for
> migration protection here.
> 
> Further the migrate disable is effectively only needed for the condition
> check in the if statement - so I think it could be replaced by:
> 
>     if (cpu==smp_processor_id()) {
>             pr_err("Yuck! Still on unplug CPU\n!");
>             err = -EBUSY;
>             goto restore_cpus;
>     }
> 
> even in the case that the cpus_allowed had not been updated.
> 
> Patch is against 3.12.13-rt21

This is checking for an anomaly, and it's in a very slow path. I feel
more comfortable with keeping the code as is, than to change it for a
micro optimization.

-- Steve


> 
> Signed-off-by: Nicholas Mc Guire <der.herr@...r.at>
--
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