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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140506204248.GH27738@htj.dyndns.org>
Date:	Tue, 6 May 2014 16:42:48 -0400
From:	Tejun Heo <tj@...nel.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	peterz@...radead.org, tglx@...utronix.de, mingo@...nel.org,
	rusty@...tcorp.com.au, fweisbec@...il.com, hch@...radead.org,
	mgorman@...e.de, riel@...hat.com, bp@...e.de, rostedt@...dmis.org,
	mgalbraith@...e.de, ego@...ux.vnet.ibm.com,
	paulmck@...ux.vnet.ibm.com, oleg@...hat.com, rjw@...ysocki.net,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] CPU hotplug, stop-machine: Plug race-window that
 leads to "IPI-to-offline-CPU"

On Tue, May 06, 2014 at 01:40:54PM -0700, Andrew Morton wrote:
> On Tue, 06 May 2014 23:33:03 +0530 "Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com> wrote:
> 
> > --- a/kernel/stop_machine.c
> > +++ b/kernel/stop_machine.c
> > @@ -165,12 +165,21 @@ static void ack_state(struct multi_stop_data *msdata)
> >  		set_state(msdata, msdata->state + 1);
> >  }
> >  
> > +/* Holding area for active CPUs, to let all the non-active CPUs go first */
> > +static void hold_active_cpus(struct multi_stop_data *msdata,
> > +			     int num_active_cpus)
> > +{
> > +	/* Wait until all the non-active threads ack the state */
> > +	while (atomic_read(&msdata->thread_ack) > num_active_cpus)
> > +		cpu_relax();
> > +}
> 
> The code comments are a bit lame.  Can we do a better job of explaining
> the overall dynamic behaviour?  Help readers to understand the problem
> which hold_active_cpus() is solving and how it solves it?

Does it even need to be a separate function?  I kinda really dislike
trivial helpers which are used only once.  It obfuscates more than
helping anything.  I think proper comment where the actual
synchronization is happening along with open coded wait would be
easier to follow.

Thanks.

-- 
tejun
--
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