lkml.org 
[lkml]   [2001]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [ANNOUNCE] HotPlug CPU patch against 2.4.5
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
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);
\
 
 \ /
  Last update: 2005-03-22 12:55    [W:0.078 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site