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] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 01 May 2013 16:49:36 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Toshi Kani <toshi.kani@...com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	isimatu.yasuaki@...fujitsu.com,
	vasilis.liaskovitis@...fitbricks.com
Subject: Re: [PATCH 2/3 RFC] Driver core: Use generic offline/online for CPU offline/online

On Tuesday, April 30, 2013 05:42:06 PM Toshi Kani wrote:
> On Mon, 2013-04-29 at 14:28 +0200, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > 
> > Rework the CPU hotplug code in drivers/base/cpu.c to use the
> > generic offline/online support introduced previously instead of
> > its own CPU-specific code.
> > 
> > For this purpose, modify cpu_subsys to provide offline and online
> > callbacks for CONFIG_HOTPLUG_CPU set and remove the code handling
> > the CPU-specific 'online' sysfs attribute.
> > 
> > This modification is not supposed to change the user-observable
> > behavior of the kernel (i.e. the 'online' attribute will be present
> > in exactly the same place in sysfs and should trigger exactly the
> > same actions as before).
> > 
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > ---
> >  drivers/base/cpu.c |   62 ++++++++++++-----------------------------------------
> >  1 file changed, 15 insertions(+), 47 deletions(-)
> > 
> > Index: linux-pm/drivers/base/cpu.c
> > ===================================================================
> > --- linux-pm.orig/drivers/base/cpu.c
> > +++ linux-pm/drivers/base/cpu.c
> > @@ -16,66 +16,25 @@
> >  
> >  #include "base.h"
> >  
> > -struct bus_type cpu_subsys = {
> > -	.name = "cpu",
> > -	.dev_name = "cpu",
> > -};
> > -EXPORT_SYMBOL_GPL(cpu_subsys);
> > -
> >  static DEFINE_PER_CPU(struct device *, cpu_sys_devices);
> >  
> >  #ifdef CONFIG_HOTPLUG_CPU
> > -static ssize_t show_online(struct device *dev,
> > -			   struct device_attribute *attr,
> > -			   char *buf)
> > +static int cpu_subsys_online(struct device *dev)
> >  {
> > -	struct cpu *cpu = container_of(dev, struct cpu, dev);
> > -
> > -	return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id));
> > +	return cpu_up(dev->id);
> >  }
> >  
> > -static ssize_t __ref store_online(struct device *dev,
> > -				  struct device_attribute *attr,
> > -				  const char *buf, size_t count)
> > +static int cpu_subsys_offline(struct device *dev)
> >  {
> > -	struct cpu *cpu = container_of(dev, struct cpu, dev);
> > -	ssize_t ret;
> > -
> > -	cpu_hotplug_driver_lock();
> 
> By replacing cpu_hotplug_driver_lock() with lock_device_offline() in
> patch 1/3, it no longer protects from other places that still use
> cpu_hotplug_device_lock(), such as save_mc_for_early().

Yes.

What about taking cpu_hotplug_driver_lock() around cpu_up() and
cpu_down() in cpu_subsys_online() and cpu_subsys_offline()?

Alternatively, I can just replace cpu_hotplug_driver_lock() with
lock_device_offline() everywhere.

Thanks,
Rafael


> > -	switch (buf[0]) {
> > -	case '0':
> > -		ret = cpu_down(cpu->dev.id);
> > -		if (!ret)
> > -			kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
> > -		break;
> > -	case '1':
> > -		ret = cpu_up(cpu->dev.id);
> > -		if (!ret)
> > -			kobject_uevent(&dev->kobj, KOBJ_ONLINE);
> > -		break;
> > -	default:
> > -		ret = -EINVAL;
> > -	}
> > -	cpu_hotplug_driver_unlock();
> > -
> > -	if (ret >= 0)
> > -		ret = count;
> > -	return ret;
> > +	return cpu_down(dev->id);
> >  }
> > -static DEVICE_ATTR(online, 0644, show_online, store_online);
> 
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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