public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	suganuma <suganuma@hpc.bs1.fc.nec.co.jp>,
	Anton Blanchard <antonb@au.ibm.com>,
	Jason McMullan <jmcmullan@linuxcare.com>
Subject: Re: [ANNOUNCE] HotPlug CPU patch against 2.4.5
Date: Tue, 26 Jun 2001 10:07:34 -0700	[thread overview]
Message-ID: <20010626100734.A20758@kroah.com> (raw)
In-Reply-To: <m15BG8K-001UIwC@mozart>
In-Reply-To: <m15BG8K-001UIwC@mozart>; from rusty@rustcorp.com.au on Sat, Jun 16, 2001 at 11:29:00PM +1000

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

On Sat, Jun 16, 2001 at 11:29:00PM +1000, Rusty Russell wrote:
> Hi all,
> 
> 	http://sourceforge.net/projects/lhcs/
> 
> 	Version 0.3 (untested) of the HotPlug CPU Patch is out, with
> ia64 and x86 support.

Here's a patch to the patch that adds /sbin/hotplug support (sorry, I
couldn't resist...)

It also fixes a '}' problem in fs/proc/proc_misc.c

thanks,

greg k-h

[-- Attachment #2: cpu-hotplug-2.4.5.patch --]
[-- Type: text/plain, Size: 2204 bytes --]

diff -Naur -X /home/greg/linux/dontdiff linux-2.4.5-hotplug/fs/proc/proc_misc.c linux-2.4.5-hotplug-greg/fs/proc/proc_misc.c
--- linux-2.4.5-hotplug/fs/proc/proc_misc.c	Tue Jun 26 09:23:00 2001
+++ linux-2.4.5-hotplug-greg/fs/proc/proc_misc.c	Tue Jun 26 09:43:57 2001
@@ -295,6 +295,7 @@
 			jif - (  kstat.per_cpu_user[i] \
 			           + kstat.per_cpu_nice[i] \
 			           + kstat.per_cpu_system[i]));
+	}
 	len += sprintf(page + len,
 		"page %u %u\n"
                 "swap %u %u\n"
diff -Naur -X /home/greg/linux/dontdiff linux-2.4.5-hotplug/kernel/cpu.c linux-2.4.5-hotplug-greg/kernel/cpu.c
--- linux-2.4.5-hotplug/kernel/cpu.c	Tue Jun 26 09:23:00 2001
+++ linux-2.4.5-hotplug-greg/kernel/cpu.c	Tue Jun 26 10:00:45 2001
@@ -8,6 +8,7 @@
 #include <linux/notifier.h>
 #include <linux/sched.h>
 #include <linux/sched.h>
+#include <linux/kmod.h>		/* for hotplug_path */
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
@@ -17,6 +18,38 @@
 
 static struct notifier_block *cpu_chain = NULL;
 
+#ifdef CONFIG_HOTPLUG
+/* Notify userspace when a cpu event occurs,
+ * by running '/sbin/hotplug cpu' with certain
+ * environment variables set.
+ */
+static int cpu_run_sbin_hotplug(unsigned int cpu, char *action)
+{
+	char *argv[3], *envp[5], cpu_str[12], action_str[32];
+	int i;
+
+	sprintf(cpu_str, "CPU=%d", cpu);
+	sprintf(action_str, "ACTION=%s", action);
+
+	i = 0;
+	argv[i++] = hotplug_path;
+	argv[i++] = "cpu";
+	argv[i] = 0;
+
+	i = 0;
+	/* minimal command environment */
+	envp [i++] = "HOME=/";
+	envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+	envp [i++] = cpu_str;
+	envp [i++] = action_str;
+	envp [i] = 0;
+
+	return call_usermodehelper(argv [0], argv, envp);
+}
+#else
+#define cpu_run_sbin_hotplug(cpu, action) ({ 0; })
+#endif
+
 /* Should really be in a header somewhere. */
 asmlinkage long sys_sched_get_priority_max(int policy);
 
@@ -120,6 +153,8 @@
 	/* Die, CPU, die! */
 	__cpu_die(cpu);
 
+	cpu_run_sbin_hotplug(cpu, "remove");
+
  out:
 	up(&cpucontrol);
 	return ret;
@@ -145,6 +180,8 @@
 	/* Friendly to make sure everyone knows it's up before we
 	   return */
 	__synchronize_kernel();
+
+	cpu_run_sbin_hotplug(cpu, "add");
 
  out:
 	up(&cpucontrol);

  parent reply	other threads:[~2001-06-26 17:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-16 13:29 [ANNOUNCE] HotPlug CPU patch against 2.4.5 Rusty Russell
2001-06-16 13:59 ` Christoph Hellwig
2001-06-17  5:32   ` Rusty Russell
2001-06-17  5:40     ` Alexander Viro
2001-06-26 17:07 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-07-03  8:30 Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010626100734.A20758@kroah.com \
    --to=greg@kroah.com \
    --cc=antonb@au.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jmcmullan@linuxcare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=suganuma@hpc.bs1.fc.nec.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox