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: <1392151870.5612.159.camel@misato.fc.hp.com>
Date:	Tue, 11 Feb 2014 13:51:10 -0700
From:	Toshi Kani <toshi.kani@...com>
To:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
Cc:	ego@...ux.vnet.ibm.com, "paulus@...ba.org" <paulus@...ba.org>,
	"oleg@...hat.com" <oleg@...hat.com>,
	"rusty@...tcorp.com.au" <rusty@...tcorp.com.au>,
	"peterz@...radead.org" <peterz@...radead.org>,
	"tglx@...utronix.de" <tglx@...utronix.de>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"mingo@...nel.org" <mingo@...nel.org>,
	"paulmck@...ux.vnet.ibm.com" <paulmck@...ux.vnet.ibm.com>,
	"tj@...nel.org" <tj@...nel.org>,
	"walken@...gle.com" <walken@...gle.com>,
	"linux@....linux.org.uk" <linux@....linux.org.uk>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH 01/51] CPU hotplug: Provide lockless versions of
 callback registration functions

On Wed, 2014-02-12 at 00:50 +0530, Srivatsa S. Bhat wrote:
> On 02/11/2014 11:05 PM, Toshi Kani wrote:
 :
> > How about this?  foo_cpu_notifier returns NOP when foo_notifier_ready is
> > false.
> > 
> >         register_cpu_notifier(&foobar_cpu_notifier);
> > 
> >         get_online_cpus();
> > 
> >         for_each_online_cpu(cpu)
> >                 init_cpu(cpu);
> > 
> > 	foo_notifier_ready = true;
> > 
> >         put_online_cpus();
> > 
> 
> Nah, that looks a lot like some quick-n-dirty hack ;-(
> It would also amount to burdening the various subsystems to add weird-looking
> pieces of code such as this in their callbacks:
> 
> 	if (!foo_notifier_ready)
> 		return NOTIFY_OK;
> 
> This only makes it all the more evident that the callback registration APIs
> exposed by the CPU hotplug core is poorly designed.
> 
> What we need instead, is an elegant, well-defined and easy-to-use set of
> interfaces/APIs exposed by the core CPU hotplug code to the various
> subsystems. I don't think we should worry so much about the fact that
> we can't use the familiar get/put_online_cpus() in this type of callback
> registration scenario. We can introduce a sane set of APIs that work
> well in such situations and use them consistently.

> For example, something like the code snippet shown below looks pretty
> neat to me:
> 
> 	cpu_notifier_register_begin();
> 
> 	for_each_online_cpu(cpu)
> 		init_cpu(cpu);
> 
> 	register_cpu_notifier(&foobar_cpu_notifier);
> 
> 	cpu_notifier_register_done();
> 
> What do you think?

I agree that it is cleaner for the callers as long as people understand
how to use them.  Can you document them properly so that they know when
they need to use them instead of the familiar get/put_online_cpus()?

Thanks,
-Toshi


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