From t-nagano@ah.jp.nec.com Thu Oct 4 08:58:47 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 04 Oct 2007 08:58:56 -0700 (PDT) Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [210.143.35.50]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l94Fwj6N021170 for ; Thu, 4 Oct 2007 08:58:47 -0700 Received: from tyo202.gate.nec.co.jp ([10.7.69.202]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l94Bm0hU019153; Thu, 4 Oct 2007 20:48:26 +0900 (JST) Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.160]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l94Bca5Z002335; Thu, 4 Oct 2007 20:38:36 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l94BcaY03655; Thu, 4 Oct 2007 20:38:36 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv3.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l94BcZB10368; Thu, 4 Oct 2007 20:38:35 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 7AFD0E48276; Thu, 4 Oct 2007 20:38:35 +0900 (JST) Message-ID: <4704D0BA.4090507@ah.jp.nec.com> Date: Thu, 04 Oct 2007 20:38:34 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: [PATCH 1/2] add tunable_notifier function Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1246 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb This patch adds new notifier function tunable_notifier_chain. Its base is atomic_notifier_chain. Thanks, --- Signed-off-by: Takenori Nagano --- diff -uprN linux-2.6.23-rc9.orig/include/linux/notifier.h linux-2.6.23-rc9/include/linux/notifier.h --- linux-2.6.23-rc9.orig/include/linux/notifier.h 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/include/linux/notifier.h 2007-10-03 14:48:04.288000000 +0900 @@ -13,6 +13,7 @@ #include #include #include +#include /* * Notifier chains are of four types: @@ -53,6 +54,14 @@ struct notifier_block { int priority; }; +struct tunable_notifier_block { + struct notifier_block *nb; + struct tunable_notifier_head *head; + struct dentry *dir; + struct dentry *pri_dentry; + struct dentry *desc_dentry; +}; + struct atomic_notifier_head { spinlock_t lock; struct notifier_block *head; @@ -63,6 +72,13 @@ struct blocking_notifier_head { struct notifier_block *head; }; +struct tunable_notifier_head { + spinlock_t lock; + struct notifier_block *head; + char *name; + struct dentry *dir; +}; + struct raw_notifier_head { struct notifier_block *head; }; @@ -81,6 +97,12 @@ struct srcu_notifier_head { init_rwsem(&(name)->rwsem); \ (name)->head = NULL; \ } while (0) +#define TUNABLE_INIT_NOTIFIER(val1, val2) do { \ + spin_lock_init(&(val1)->lock); \ + (val1)->head = NULL; \ + (val1)->name = val2; \ + (val1)->dir = NULL; \ + } while (0) #define RAW_INIT_NOTIFIER_HEAD(name) do { \ (name)->head = NULL; \ } while (0) @@ -96,6 +118,11 @@ extern void srcu_init_notifier_head(stru #define BLOCKING_NOTIFIER_INIT(name) { \ .rwsem = __RWSEM_INITIALIZER((name).rwsem), \ .head = NULL } +#define TUNABLE_NOTIFIER_INIT(val1, val2) { \ + .lock =__SPIN_LOCK_UNLOCKED(val1.lock), \ + .head = NULL, \ + .name = val2, \ + .dir = NULL } #define RAW_NOTIFIER_INIT(name) { \ .head = NULL } /* srcu_notifier_heads cannot be initialized statically */ @@ -106,6 +133,9 @@ extern void srcu_init_notifier_head(stru #define BLOCKING_NOTIFIER_HEAD(name) \ struct blocking_notifier_head name = \ BLOCKING_NOTIFIER_INIT(name) +#define TUNABLE_NOTIFIER_HEAD(name, val) \ + struct tunable_notifier_head name = \ + TUNABLE_NOTIFIER_INIT(name, val) #define RAW_NOTIFIER_HEAD(name) \ struct raw_notifier_head name = \ RAW_NOTIFIER_INIT(name) @@ -116,6 +146,8 @@ extern int atomic_notifier_chain_registe struct notifier_block *nb); extern int blocking_notifier_chain_register(struct blocking_notifier_head *nh, struct notifier_block *nb); +extern int tunable_notifier_chain_register(struct tunable_notifier_head *nh, + struct tunable_notifier_block *nb, char *name, char *desc); extern int raw_notifier_chain_register(struct raw_notifier_head *nh, struct notifier_block *nb); extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, @@ -125,6 +157,8 @@ extern int atomic_notifier_chain_unregis struct notifier_block *nb); extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, struct notifier_block *nb); +extern int tunable_notifier_chain_unregister(struct tunable_notifier_head *nh, + struct tunable_notifier_block *nb); extern int raw_notifier_chain_unregister(struct raw_notifier_head *nh, struct notifier_block *nb); extern int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh, @@ -138,6 +172,10 @@ extern int blocking_notifier_call_chain( unsigned long val, void *v); extern int __blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls); +extern int tunable_notifier_call_chain(struct tunable_notifier_head *nh, + unsigned long val, void *v); +extern int __tunable_notifier_call_chain(struct tunable_notifier_head *nh, + unsigned long val, void *v, int nr_to_call, int *nr_calls); extern int raw_notifier_call_chain(struct raw_notifier_head *nh, unsigned long val, void *v); extern int __raw_notifier_call_chain(struct raw_notifier_head *nh, diff -uprN linux-2.6.23-rc9.orig/kernel/sys.c linux-2.6.23-rc9/kernel/sys.c --- linux-2.6.23-rc9.orig/kernel/sys.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/kernel/sys.c 2007-10-03 14:48:15.160000000 +0900 @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -393,6 +394,234 @@ int blocking_notifier_call_chain(struct EXPORT_SYMBOL_GPL(blocking_notifier_call_chain); /* + * Tunable notifier chain routines. Registration and unregistration + * use a spinlock, and call_chain is synchronized by RCU (no locks). + * User can change the list order to use /sys/kernel/debug/list-name/. + */ + +static ssize_t priority_read(struct file *file, + char __user *user_buf, size_t count, loff_t *ppos) +{ + struct tunable_notifier_block *n = file->f_dentry->d_inode->i_private; + int priority = n->nb->priority; + char buf[64], *s; + + s = buf; + s += sprintf(s, "%d\n", priority); + + return simple_read_from_buffer((void __user *)user_buf, count, + ppos, buf, s - buf); +} + +static ssize_t priority_write(struct file *file, + const char __user *user_buf, size_t count, loff_t *ppos) +{ + struct tunable_notifier_block *n = file->f_dentry->d_inode->i_private; + struct tunable_notifier_head *nh = n->head; + char *buf, *end; + int ret = -ENOMEM, priority; + unsigned long tmp, flags; + + buf = kmalloc(count + 1, GFP_KERNEL); + if (!buf) + goto out; + + buf[count] = 0; + ret = -EFAULT; + if (copy_from_user(buf, user_buf, count)) + goto out_free; + + ret = -EINVAL; + tmp = simple_strtoul(buf, &end, 10); + if ((end == buf) || (tmp > INT_MAX)) + goto out_free; + + priority = (int)tmp; + n->nb->priority = priority; + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_unregister(&nh->head, n->nb); + if (ret) + goto out_unlock; + ret = notifier_chain_register(&nh->head, n->nb); + if (!ret) + ret = count; + +out_unlock: + spin_unlock_irqrestore(&nh->lock, flags); +out_free: + kfree(buf); +out: + return ret; + +} + +static const struct file_operations pri_fops = { + .read = priority_read, + .write = priority_write, +}; + +static ssize_t description_read(struct file *file, + char __user *user_buf, size_t count, loff_t *ppos) +{ + char *desc = file->f_dentry->d_inode->i_private; + int avail = strlen(desc); + + return simple_read_from_buffer(user_buf, count, ppos, desc, avail); +} + +static const struct file_operations desc_fops = { + .read = description_read, +}; + +/** + * tunable_notifier_chain_register - Add notifier to an tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @n: New entry in notifier chain + * @name: Pointer to the name of this notifier chain + * @desc: Pointer to the description of new entry + * + * Adds a notifier to an tunable notifier chain and makes control dir. + * + * Returns zero on success or %-ENODEV on failure. + */ + +int tunable_notifier_chain_register(struct tunable_notifier_head *nh, + struct tunable_notifier_block *n, char *name, char *desc) +{ + unsigned long flags; + int ret = -EINVAL; + struct dentry *nh_dir, *nb_dir, *pri_dentry, *desc_dentry = NULL; + + if (!name) + goto nb_fail; + + ret = -ENOMEM; + if (!nh->dir) { + nh_dir = debugfs_create_dir(nh->name, NULL); + if (!nh_dir) + return ret; + nh->dir = nh_dir; + } else + nh_dir = nh->dir; + + nb_dir = debugfs_create_dir(name, nh_dir); + if (!nb_dir) + goto nb_fail; + n->dir = nb_dir; + + pri_dentry = debugfs_create_file("priority",0600, nb_dir, n, &pri_fops); + if (!pri_dentry) + goto pri_fail; + n->pri_dentry = pri_dentry; + + if (desc) { + desc_dentry = debugfs_create_file("description", 0400, nb_dir, + desc, &desc_fops); + if (!desc_dentry) + goto desc_fail; + n->desc_dentry = desc_dentry; + } + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_register(&nh->head, n->nb); + spin_unlock_irqrestore(&nh->lock, flags); + + if (ret) + goto reg_fail; + + n->head = nh; + + return ret; + +reg_fail: + debugfs_remove(desc_dentry); +desc_fail: + debugfs_remove(pri_dentry); +pri_fail: + debugfs_remove(nb_dir); +nb_fail: + return ret; +} + +EXPORT_SYMBOL_GPL(tunable_notifier_chain_register); + +/** + * tunable_notifier_chain_unregister - Remove notifier from a tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @n: Entry to remove from notifier chain + * + * Removes a notifier from a tunable notifier chain. + * + * Retunrns zero on success or %-ENOENT on failure. + */ + +int tunable_notifier_chain_unregister(struct tunable_notifier_head *nh, + struct tunable_notifier_block *n) +{ + unsigned long flags; + int ret; + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_unregister(&nh->head, n->nb); + spin_unlock_irqrestore(&nh->lock, flags); + synchronize_rcu(); + + if (ret) + return ret; + + debugfs_remove(n->desc_dentry); + debugfs_remove(n->pri_dentry); + debugfs_remove(n->dir); + + return 0; +} + +EXPORT_SYMBOL_GPL(tunable_notifier_chain_unregister); + +/** + * __tunable_notifier_call_chain - Call functions in a tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @val: Value passed unmodified to notifier function + * @v: Pointer passed unmodified to notifier function + * @nt_to_call: See the comment for notifier_call_chain + * @nr_calls: See the comment for notifier_call_chain + * + * Calls each function in a notifier chain in turn. The functions + * run in an atomic context, so they must not block. + * This routine uses RCU to synchronize with changes to the chain. + * + * If the return value of the notifier can be and'ed + * with %NOTIFY_STOP_MASK then tunable_notifier_call_chain() + * will return immediately, with the return value of + * the notifier function which halted execution. + * Otherwise the return value is the return value + * of the last notifier function called. + */ + +int __kprobes __tunable_notifier_call_chain(struct tunable_notifier_head *nh, + unsigned long val, void *v, + int nr_to_call, int *nr_calls) +{ + int ret; + + rcu_read_lock(); + ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls); + rcu_read_unlock(); + return ret; +} + +EXPORT_SYMBOL_GPL(__tunable_notifier_call_chain); + +int __kprobes tunable_notifier_call_chain(struct tunable_notifier_head *nh, + unsigned long val, void *v) +{ + return __tunable_notifier_call_chain(nh, val, v, -1, NULL); +} + +EXPORT_SYMBOL_GPL(tunable_notifier_call_chain); + +/* * Raw notifier chain routines. There is no protection; * the caller must provide it. Use at your own risk! */ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 4 09:20:02 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 04 Oct 2007 09:20:08 -0700 (PDT) Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [210.143.35.50]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l94GJv16024132 for ; Thu, 4 Oct 2007 09:20:01 -0700 Received: from tyo202.gate.nec.co.jp ([10.7.69.202]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l94Bm0hS019153; Thu, 4 Oct 2007 20:48:26 +0900 (JST) Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.162]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l94Bc7dL001803; Thu, 4 Oct 2007 20:38:07 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l94Bc7u17555; Thu, 4 Oct 2007 20:38:07 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l94Bc6C01107; Thu, 4 Oct 2007 20:38:06 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 83609E48276; Thu, 4 Oct 2007 20:38:06 +0900 (JST) Message-ID: <4704D09D.6080503@ah.jp.nec.com> Date: Thu, 04 Oct 2007 20:38:05 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: [PATCH 0/2] add new notifier function Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1247 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Hi, These patches add new notifier function and implement it to panic_notifier_list. We used the hardcoded notifier chain so far, but it was not flexible. New notifier is very flexible, because user can change a list of order by debugfs. Please review, and give some comments. Thanks, Example) # cd /sys/kernel/debug/ # ls kprobes pktcdvd # insmod ipmi_msghandler.ko # ls kprobes panic_notifier_list pktcdvd # cd panic_notifier_list/ # ls ipmi_msghandler # insmod ipmi_watchdog.ko # ls ipmi_msghandler ipmi_wdog # cat ipmi_msghandler/priority 200 # cat ipmi_wdog/priority 150 # Kernel panic - not syncing: panic ipmi_msghandler : notifier calls panic_event(). ipmi_watchdog : notifier calls wdog_panic_handler(). .....(reboot) # cat ipmi_msghandler/priority 200 # cat ipmi_wdog/priority 150 # echo 300 > ipmi_wdog/priority # Kernel panic - not syncing: panic ipmi_watchdog : notifier calls wdog_panic_handler(). ipmi_msghandler : notifier calls panic_event(). -- Takenori Nagano --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 4 09:22:54 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 04 Oct 2007 09:23:03 -0700 (PDT) Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [210.143.35.50]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l94GJv18024132 for ; Thu, 4 Oct 2007 09:22:53 -0700 Received: from tyo202.gate.nec.co.jp ([10.7.69.202]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l94Bm0hW019153; Thu, 4 Oct 2007 20:48:26 +0900 (JST) Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.161]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l94Bcrs3002636; Thu, 4 Oct 2007 20:38:53 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l94Bcq109762; Thu, 4 Oct 2007 20:38:52 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv5.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l94Bcqv23152; Thu, 4 Oct 2007 20:38:52 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 0CD64E48276; Thu, 4 Oct 2007 20:38:52 +0900 (JST) Message-ID: <4704D0CA.4080001@ah.jp.nec.com> Date: Thu, 04 Oct 2007 20:38:50 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: [PATCH 2/2] implement new notifier function to panic_notifier_list Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1248 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb This patch implements new notifier function to panic_notifier_list. We can change the list of order by debugfs. Thanks, --- Signed-off-by: Takenori Nagano --- diff -uprN linux-2.6.23-rc9.orig/arch/alpha/kernel/setup.c linux-2.6.23-rc9/arch/alpha/kernel/setup.c --- linux-2.6.23-rc9.orig/arch/alpha/kernel/setup.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/alpha/kernel/setup.c 2007-10-04 09:49:34.440000000 +0900 @@ -45,14 +45,22 @@ #include #include -extern struct atomic_notifier_head panic_notifier_list; +extern struct tunable_notifier_head panic_notifier_list; static int alpha_panic_event(struct notifier_block *, unsigned long, void *); -static struct notifier_block alpha_panic_block = { +static struct notifier_block alpha_panic_block_base = { alpha_panic_event, NULL, INT_MAX /* try to do it first */ }; +static struct tunable_notifier_block alpha_panic_block = { + &alpha_panic_block_base, + NULL, + NULL, + NULL, + NULL +}; + #include #include #include @@ -522,8 +530,8 @@ setup_arch(char **cmdline_p) } /* Register a call for panic conditions. */ - atomic_notifier_chain_register(&panic_notifier_list, - &alpha_panic_block); + tunable_notifier_chain_register(&panic_notifier_list, + &alpha_panic_block, "alpha_panic", NULL); #ifdef CONFIG_ALPHA_GENERIC /* Assume that we've booted from SRM if we haven't booted from MILO. diff -uprN linux-2.6.23-rc9.orig/arch/arm/mach-omap1/board-voiceblue.c linux-2.6.23-rc9/arch/arm/mach-omap1/board-voiceblue.c --- linux-2.6.23-rc9.orig/arch/arm/mach-omap1/board-voiceblue.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/arm/mach-omap1/board-voiceblue.c 2007-10-04 09:53:17.008000000 +0900 @@ -228,14 +228,23 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init voiceblue_setup(void) { /* Setup panic notifier */ - notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_notifier_chain_register(&panic_notifier_list, &panic_block, + "VoiceBlue", NULL); return 0; } diff -uprN linux-2.6.23-rc9.orig/arch/mips/sgi-ip22/ip22-reset.c linux-2.6.23-rc9/arch/mips/sgi-ip22/ip22-reset.c --- linux-2.6.23-rc9.orig/arch/mips/sgi-ip22/ip22-reset.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/mips/sgi-ip22/ip22-reset.c 2007-10-04 10:04:51.752000000 +0900 @@ -226,10 +226,18 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init reboot_setup(void) { _machine_restart = sgi_machine_restart; @@ -239,7 +247,8 @@ static int __init reboot_setup(void) request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); init_timer(&blink_timer); blink_timer.function = blink_timeout; - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_notifier_chain_register(&panic_notifier_list, &panic_block, + "sgi-ip22", NULL); return 0; } diff -uprN linux-2.6.23-rc9.orig/arch/mips/sgi-ip32/ip32-reset.c linux-2.6.23-rc9/arch/mips/sgi-ip32/ip32-reset.c --- linux-2.6.23-rc9.orig/arch/mips/sgi-ip32/ip32-reset.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/mips/sgi-ip32/ip32-reset.c 2007-10-04 10:04:32.988000000 +0900 @@ -175,10 +175,18 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static __init int ip32_reboot_setup(void) { /* turn on the green led only */ @@ -193,7 +201,8 @@ static __init int ip32_reboot_setup(void init_timer(&blink_timer); blink_timer.function = blink_timeout; - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_notifier_chain_register(&panic_notifier_list, &panic_block, + "sgi-ip32", NULL); if (request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL)) panic("Can't allocate MACEISA RTC IRQ"); diff -uprN linux-2.6.23-rc9.orig/arch/parisc/kernel/pdc_chassis.c linux-2.6.23-rc9/arch/parisc/kernel/pdc_chassis.c --- linux-2.6.23-rc9.orig/arch/parisc/kernel/pdc_chassis.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/parisc/kernel/pdc_chassis.c 2007-10-04 10:03:22.624000000 +0900 @@ -101,11 +101,18 @@ static int pdc_chassis_panic_event(struc } -static struct notifier_block pdc_chassis_panic_block = { +static struct notifier_block pdc_chassis_panic_block_base = { .notifier_call = pdc_chassis_panic_event, .priority = INT_MAX, }; +static struct tunable_notifier_block pdc_chassis_panic_block = { + .nb = &pdc_chassis_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; /** * parisc_reboot_event() - Called by the reboot handler. @@ -144,8 +151,8 @@ void __init parisc_pdc_chassis_init(void PDC_CHASSIS_VER); /* initialize panic notifier chain */ - atomic_notifier_chain_register(&panic_notifier_list, - &pdc_chassis_panic_block); + tunable_notifier_chain_register(&panic_notifier_list, + &pdc_chassis_panic_block, "pdc_chassis", NULL); /* initialize reboot notifier chain */ register_reboot_notifier(&pdc_chassis_reboot_block); diff -uprN linux-2.6.23-rc9.orig/arch/powerpc/kernel/setup-common.c linux-2.6.23-rc9/arch/powerpc/kernel/setup-common.c --- linux-2.6.23-rc9.orig/arch/powerpc/kernel/setup-common.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/powerpc/kernel/setup-common.c 2007-10-04 10:12:59.352000000 +0900 @@ -534,14 +534,23 @@ static int ppc_panic_event(struct notifi return NOTIFY_DONE; } -static struct notifier_block ppc_panic_block = { +static struct notifier_block ppc_panic_block_base = { .notifier_call = ppc_panic_event, .priority = INT_MIN /* may not return; must be done last */ }; +static struct tunable_notifier_block ppc_panic_block = { + .nb = &ppc_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init setup_panic(void) { - atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block); + tunable_notifier_chain_register(&panic_notifier_list, &ppc_panic_block, + "powerpc", NULL); } #ifdef CONFIG_CHECK_CACHE_COHERENCY diff -uprN linux-2.6.23-rc9.orig/arch/ppc/platforms/prep_setup.c linux-2.6.23-rc9/arch/ppc/platforms/prep_setup.c --- linux-2.6.23-rc9.orig/arch/ppc/platforms/prep_setup.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/ppc/platforms/prep_setup.c 2007-10-04 13:33:55.108000000 +0900 @@ -712,12 +712,20 @@ ibm_statusled_panic(struct notifier_bloc return NOTIFY_DONE; } -static struct notifier_block ibm_statusled_block = { +static struct notifier_block ibm_statusled_block_base = { ibm_statusled_panic, NULL, INT_MAX /* try to do it first */ }; +static struct tunable_notifier_block ibm_statusled_block = { + &ibm_statusled_block_base, + NULL, + NULL, + NULL, + NULL +}; + static void ibm_statusled_progress(char *s, unsigned short hex) { @@ -732,8 +740,8 @@ ibm_statusled_progress(char *s, unsigned hex = 0xfff; if (!notifier_installed) { ++notifier_installed; - atomic_notifier_chain_register(&panic_notifier_list, - &ibm_statusled_block); + tunable_notifier_chain_register(&panic_notifier_list, + &ibm_statusled_block, "IBM_statusLED", NULL); } } else diff -uprN linux-2.6.23-rc9.orig/arch/s390/kernel/ipl.c linux-2.6.23-rc9/arch/s390/kernel/ipl.c --- linux-2.6.23-rc9.orig/arch/s390/kernel/ipl.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/s390/kernel/ipl.c 2007-10-04 13:33:45.216000000 +0900 @@ -1036,11 +1036,19 @@ static int shutdown_on_panic_notify(stru return NOTIFY_OK; } -static struct notifier_block shutdown_on_panic_nb = { +static struct notifier_block shutdown_on_panic_nb_base = { .notifier_call = shutdown_on_panic_notify, .priority = SHUTDOWN_ON_PANIC_PRIO }; +static struct tunable_notifier_block shutdown_on_panic_nb = { + .nb = &shutdown_on_panic_nb_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init dump_init(void) { int rc; @@ -1075,8 +1083,8 @@ static int __init shutdown_actions_init( firmware_unregister(&shutdown_actions_subsys); return rc; } - atomic_notifier_chain_register(&panic_notifier_list, - &shutdown_on_panic_nb); + tunable_notifier_chain_register(&panic_notifier_list, + &shutdown_on_panic_nb, "s390_ipl", NULL); return 0; } diff -uprN linux-2.6.23-rc9.orig/arch/s390/kernel/setup.c linux-2.6.23-rc9/arch/s390/kernel/setup.c --- linux-2.6.23-rc9.orig/arch/s390/kernel/setup.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/s390/kernel/setup.c 2007-10-04 13:36:51.792000000 +0900 @@ -173,11 +173,19 @@ static int vmpanic_notify(struct notifie #define PANIC_PRI_VMPANIC 0 -static struct notifier_block vmpanic_nb = { +static struct notifier_block vmpanic_nb_base = { .notifier_call = vmpanic_notify, .priority = PANIC_PRI_VMPANIC }; +static struct tunable_notifier_block vmpanic_nb = { + .nb = &vmpanic_nb_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init vmpanic_setup(char *str) { static int register_done __initdata = 0; @@ -186,8 +194,8 @@ static int __init vmpanic_setup(char *st vmpanic_cmd[127] = 0; if (!register_done) { register_done = 1; - atomic_notifier_chain_register(&panic_notifier_list, - &vmpanic_nb); + tunable_notifier_chain_register(&panic_notifier_list, + &vmpanic_nb, "s390_panic", NULL); } return 1; } diff -uprN linux-2.6.23-rc9.orig/arch/sparc64/kernel/sstate.c linux-2.6.23-rc9/arch/sparc64/kernel/sstate.c --- linux-2.6.23-rc9.orig/arch/sparc64/kernel/sstate.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/sparc64/kernel/sstate.c 2007-10-04 13:39:06.692000000 +0900 @@ -82,11 +82,19 @@ static int sstate_panic_event(struct not return NOTIFY_DONE; } -static struct notifier_block sstate_panic_block = { +static struct notifier_block sstate_panic_block_base = { .notifier_call = sstate_panic_event, .priority = INT_MAX, }; +static struct tunable_notifier_block sstate_panic_block = { + .nb = &sstate_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init sun4v_sstate_init(void) { unsigned long major, minor; @@ -99,6 +107,6 @@ void __init sun4v_sstate_init(void) hv_supports_soft_state = 1; prom_sun4v_guest_soft_state(); - atomic_notifier_chain_register(&panic_notifier_list, - &sstate_panic_block); + tunable_notifier_chain_register(&panic_notifier_list, + &sstate_panic_block, "sstate" ,NULL); } diff -uprN linux-2.6.23-rc9.orig/arch/um/drivers/mconsole_kern.c linux-2.6.23-rc9/arch/um/drivers/mconsole_kern.c --- linux-2.6.23-rc9.orig/arch/um/drivers/mconsole_kern.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/um/drivers/mconsole_kern.c 2007-10-04 15:30:04.784000000 +0900 @@ -928,16 +928,24 @@ static int notify_panic(struct notifier_ return(0); } -static struct notifier_block panic_exit_notifier = { +static struct notifier_block panic_exit_notifier_base = { .notifier_call = notify_panic, .next = NULL, .priority = 1 }; +static struct tunable_notifier_block panic_exit_notifier = { + .nb = &panic_exit_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int add_notifier(void) { - atomic_notifier_chain_register(&panic_notifier_list, - &panic_exit_notifier); + tunable_notifier_chain_register(&panic_notifier_list, + &panic_exit_notifier, "mconsole", NULL); return(0); } diff -uprN linux-2.6.23-rc9.orig/arch/um/kernel/um_arch.c linux-2.6.23-rc9/arch/um/kernel/um_arch.c --- linux-2.6.23-rc9.orig/arch/um/kernel/um_arch.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/um/kernel/um_arch.c 2007-10-04 13:42:53.880000000 +0900 @@ -478,16 +478,24 @@ static int panic_exit(struct notifier_bl return 0; } -static struct notifier_block panic_exit_notifier = { +static struct notifier_block panic_exit_notifier_base = { .notifier_call = panic_exit, .next = NULL, .priority = 0 }; +static struct tunable_notifier_block panic_exit_notifier = { + .nb = &panic_exit_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init setup_arch(char **cmdline_p) { - atomic_notifier_chain_register(&panic_notifier_list, - &panic_exit_notifier); + tunable_notifier_chain_register(&panic_notifier_list, + &panic_exit_notifier, "um", NULL); paging_init(); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; diff -uprN linux-2.6.23-rc9.orig/arch/xtensa/platform-iss/setup.c linux-2.6.23-rc9/arch/xtensa/platform-iss/setup.c --- linux-2.6.23-rc9.orig/arch/xtensa/platform-iss/setup.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/arch/xtensa/platform-iss/setup.c 2007-10-04 13:44:52.032000000 +0900 @@ -98,13 +98,22 @@ iss_panic_event(struct notifier_block *t return NOTIFY_DONE; } -static struct notifier_block iss_panic_block = { +static struct notifier_block iss_panic_block_base = { iss_panic_event, NULL, 0 }; +static struct tunable_notifier_block iss_panic_block = { + &iss_panic_block_base, + NULL, + NULL, + NULL, + NULL +}; + void __init platform_setup(char **p_cmdline) { - atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block); + tunable_notifier_chain_register(&panic_notifier_list, &iss_panic_block, + "iss_panic", NULL); } diff -uprN linux-2.6.23-rc9.orig/drivers/char/ipmi/ipmi_msghandler.c linux-2.6.23-rc9/drivers/char/ipmi/ipmi_msghandler.c --- linux-2.6.23-rc9.orig/drivers/char/ipmi/ipmi_msghandler.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/drivers/char/ipmi/ipmi_msghandler.c 2007-10-04 09:46:25.780000000 +0900 @@ -4070,12 +4070,20 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, .next = NULL, .priority = 200 /* priority: INT_MAX >= x >= 0 */ }; +static struct tunable_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int ipmi_init_msghandler(void) { int rv; @@ -4105,7 +4113,8 @@ static int ipmi_init_msghandler(void) setup_timer(&ipmi_timer, ipmi_timeout, 0); mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_notifier_chain_register(&panic_notifier_list, &panic_block, + "ipmi_msghandler", NULL); initialized = 1; @@ -4125,7 +4134,7 @@ static __exit void cleanup_ipmi(void) if (!initialized) return; - atomic_notifier_chain_unregister(&panic_notifier_list, &panic_block); + tunable_notifier_chain_unregister(&panic_notifier_list, &panic_block); /* This can't be called if any interfaces exist, so no worry about shutting down the interfaces. */ diff -uprN linux-2.6.23-rc9.orig/drivers/char/ipmi/ipmi_watchdog.c linux-2.6.23-rc9/drivers/char/ipmi/ipmi_watchdog.c --- linux-2.6.23-rc9.orig/drivers/char/ipmi/ipmi_watchdog.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/drivers/char/ipmi/ipmi_watchdog.c 2007-10-04 09:46:25.780000000 +0900 @@ -1055,12 +1055,19 @@ static int wdog_panic_handler(struct not return NOTIFY_OK; } -static struct notifier_block wdog_panic_notifier = { +static struct notifier_block wdog_panic_notifier_base = { .notifier_call = wdog_panic_handler, .next = NULL, .priority = 150 /* priority: INT_MAX >= x >= 0 */ }; +static struct tunable_notifier_block wdog_panic_notifier = { + .nb = &wdog_panic_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; static void ipmi_new_smi(int if_num, struct device *device) { @@ -1212,8 +1219,8 @@ static int __init ipmi_wdog_init(void) check_parms(); register_reboot_notifier(&wdog_reboot_notifier); - atomic_notifier_chain_register(&panic_notifier_list, - &wdog_panic_notifier); + tunable_notifier_chain_register(&panic_notifier_list, + &wdog_panic_notifier, "ipmi_wdog", NULL); rv = ipmi_smi_watcher_register(&smi_watcher); if (rv) { @@ -1221,7 +1228,7 @@ static int __init ipmi_wdog_init(void) if (preaction_val == WDOG_PRETIMEOUT_NMI) release_nmi(&ipmi_nmi_handler); #endif - atomic_notifier_chain_unregister(&panic_notifier_list, + tunable_notifier_chain_unregister(&panic_notifier_list, &wdog_panic_notifier); unregister_reboot_notifier(&wdog_reboot_notifier); printk(KERN_WARNING PFX "can't register smi watcher\n"); @@ -1243,7 +1250,7 @@ static void __exit ipmi_wdog_exit(void) release_nmi(&ipmi_nmi_handler); #endif - atomic_notifier_chain_unregister(&panic_notifier_list, + tunable_notifier_chain_unregister(&panic_notifier_list, &wdog_panic_notifier); unregister_reboot_notifier(&wdog_reboot_notifier); } diff -uprN linux-2.6.23-rc9.orig/drivers/lguest/lguest.c linux-2.6.23-rc9/drivers/lguest/lguest.c --- linux-2.6.23-rc9.orig/drivers/lguest/lguest.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/drivers/lguest/lguest.c 2007-10-04 15:32:39.408000000 +0900 @@ -880,16 +880,25 @@ static int lguest_panic(struct notifier_ return NOTIFY_DONE; } -static struct notifier_block paniced = { +static struct notifier_block paniced_base = { .notifier_call = lguest_panic }; +static struct tunable_notifier_block paniced = { + .nb = &paniced_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + /* Setting up memory is fairly easy. */ static __init char *lguest_memory_setup(void) { /* We do this here and not earlier because lockcheck barfs if we do it * before start_kernel() */ - atomic_notifier_chain_register(&panic_notifier_list, &paniced); + tunable_notifier_chain_register(&panic_notifier_list, &paniced, + "lguest", NULL); /* The Linux bootloader header contains an "e820" memory map: the * Launcher populated the first entry with our memory limit. */ diff -uprN linux-2.6.23-rc9.orig/drivers/misc/ibmasm/heartbeat.c linux-2.6.23-rc9/drivers/misc/ibmasm/heartbeat.c --- linux-2.6.23-rc9.orig/drivers/misc/ibmasm/heartbeat.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/drivers/misc/ibmasm/heartbeat.c 2007-10-04 09:46:25.780000000 +0900 @@ -48,16 +48,20 @@ static int panic_happened(struct notifie return 0; } -static struct notifier_block panic_notifier = { panic_happened, NULL, 1 }; +static struct notifier_block panic_notifier_base = { panic_happened, NULL, 1 }; + +static struct tunable_notifier_block panic_notifier = { &panic_notifier_base, + NULL, NULL, NULL, NULL}; void ibmasm_register_panic_notifier(void) { - atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier); + tunable_notifier_chain_register(&panic_notifier_list, &panic_notifier, + "ibmasm", NULL); } void ibmasm_unregister_panic_notifier(void) { - atomic_notifier_chain_unregister(&panic_notifier_list, + tunable_notifier_chain_unregister(&panic_notifier_list, &panic_notifier); } diff -uprN linux-2.6.23-rc9.orig/drivers/parisc/power.c linux-2.6.23-rc9/drivers/parisc/power.c --- linux-2.6.23-rc9.orig/drivers/parisc/power.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/drivers/parisc/power.c 2007-10-04 09:46:25.780000000 +0900 @@ -189,11 +189,18 @@ static int parisc_panic_event(struct not return NOTIFY_DONE; } -static struct notifier_block parisc_panic_block = { +static struct notifier_block parisc_panic_block_base = { .notifier_call = parisc_panic_event, .priority = INT_MAX, }; +static struct tunable_notifier_block parisc_panic_block = { + .nb = &parisc_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; static int __init power_init(void) { @@ -231,8 +238,8 @@ static int __init power_init(void) } /* Register a call for panic conditions. */ - atomic_notifier_chain_register(&panic_notifier_list, - &parisc_panic_block); + tunable_notifier_chain_register(&panic_notifier_list, + &parisc_panic_block, "parisc_panic", NULL); return 0; } @@ -241,7 +248,7 @@ static void __exit power_exit(void) { kthread_stop(power_task); - atomic_notifier_chain_unregister(&panic_notifier_list, + tunable_notifier_chain_unregister(&panic_notifier_list, &parisc_panic_block); pdc_soft_power_button(0); diff -uprN linux-2.6.23-rc9.orig/include/linux/kernel.h linux-2.6.23-rc9/include/linux/kernel.h --- linux-2.6.23-rc9.orig/include/linux/kernel.h 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/include/linux/kernel.h 2007-10-04 09:46:25.784000000 +0900 @@ -104,7 +104,7 @@ extern int cond_resched(void); (__x < 0) ? -__x : __x; \ }) -extern struct atomic_notifier_head panic_notifier_list; +extern struct tunable_notifier_head panic_notifier_list; extern long (*panic_blink)(long time); NORET_TYPE void panic(const char * fmt, ...) __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; diff -uprN linux-2.6.23-rc9.orig/kernel/panic.c linux-2.6.23-rc9/kernel/panic.c --- linux-2.6.23-rc9.orig/kernel/panic.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/kernel/panic.c 2007-10-04 09:46:25.784000000 +0900 @@ -28,7 +28,7 @@ static DEFINE_SPINLOCK(pause_on_oops_loc int panic_timeout; -ATOMIC_NOTIFIER_HEAD(panic_notifier_list); +TUNABLE_NOTIFIER_HEAD(panic_notifier_list, "panic_notifier_list"); EXPORT_SYMBOL(panic_notifier_list); @@ -96,7 +96,7 @@ NORET_TYPE void panic(const char * fmt, smp_send_stop(); #endif - atomic_notifier_call_chain(&panic_notifier_list, 0, buf); + tunable_notifier_call_chain(&panic_notifier_list, 0, buf); if (!panic_blink) panic_blink = no_blink; diff -uprN linux-2.6.23-rc9.orig/kernel/softlockup.c linux-2.6.23-rc9/kernel/softlockup.c --- linux-2.6.23-rc9.orig/kernel/softlockup.c 2007-10-02 12:24:52.000000000 +0900 +++ linux-2.6.23-rc9/kernel/softlockup.c 2007-10-04 09:46:25.784000000 +0900 @@ -31,10 +31,18 @@ softlock_panic(struct notifier_block *th return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = softlock_panic, }; +static struct tunable_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + /* * Returns seconds, approximately. We don't need nanosecond * resolution, and we don't need to waste time with a big divide when @@ -193,5 +201,6 @@ __init void spawn_softlockup_task(void) cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); register_cpu_notifier(&cpu_nfb); - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_notifier_chain_register(&panic_notifier_list, &panic_block, + "softlookup", NULL); } --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 4 22:03:21 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 04 Oct 2007 22:03:32 -0700 (PDT) Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [210.143.35.50]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9553Hqh017651 for ; Thu, 4 Oct 2007 22:03:20 -0700 Received: from tyo201.gate.nec.co.jp ([10.7.69.201]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l95531Rj027016; Fri, 5 Oct 2007 14:03:13 +0900 (JST) Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.160]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l954xiih026120; Fri, 5 Oct 2007 13:59:44 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l954xi719579; Fri, 5 Oct 2007 13:59:44 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l954xhC17773; Fri, 5 Oct 2007 13:59:43 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id B91B1E4828F; Fri, 5 Oct 2007 13:59:43 +0900 (JST) Message-ID: <4705C4BF.6060308@ah.jp.nec.com> Date: Fri, 05 Oct 2007 13:59:43 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Randy Dunlap CC: linux-kernel@vger.kernel.org, vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: Re: [PATCH 2/2] implement new notifier function to panic_notifier_list References: <4704D0CA.4080001@ah.jp.nec.com> <20071004090711.456b6338.randy.dunlap@oracle.com> In-Reply-To: <20071004090711.456b6338.randy.dunlap@oracle.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1249 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Randy Dunlap wrote: > On Thu, 04 Oct 2007 20:38:50 +0900 Takenori Nagano wrote: > >> This patch implements new notifier function to panic_notifier_list. We can >> change the list of order by debugfs. >> >> Thanks, >> >> --- >> >> Signed-off-by: Takenori Nagano >> >> --- >> * Returns seconds, approximately. We don't need nanosecond >> * resolution, and we don't need to waste time with a big divide when >> @@ -193,5 +201,6 @@ __init void spawn_softlockup_task(void) >> cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); >> register_cpu_notifier(&cpu_nfb); >> >> - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); >> + tunable_notifier_chain_register(&panic_notifier_list, &panic_block, >> + "softlookup", NULL); >> } > > "softlockup" Hi Randy, Thank you for reviewing. :) I'll fix next version. --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 4 22:13:12 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 04 Oct 2007 22:13:20 -0700 (PDT) Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [210.143.35.50]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l955D8Z2019161 for ; Thu, 4 Oct 2007 22:13:12 -0700 Received: from tyo201.gate.nec.co.jp ([10.7.69.201]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l955D06J029545; Fri, 5 Oct 2007 14:13:06 +0900 (JST) Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.160]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9556736002966; Fri, 5 Oct 2007 14:06:07 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l95567828355; Fri, 5 Oct 2007 14:06:07 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l95566C23781; Fri, 5 Oct 2007 14:06:07 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id D34AFFF0009; Fri, 5 Oct 2007 14:06:06 +0900 (JST) Message-ID: <4705C63E.7020408@ah.jp.nec.com> Date: Fri, 05 Oct 2007 14:06:06 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Randy Dunlap CC: linux-kernel@vger.kernel.org, vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: Re: [PATCH 1/2] add tunable_notifier function References: <4704D0BA.4090507@ah.jp.nec.com> <20071004091157.c35f3513.randy.dunlap@oracle.com> In-Reply-To: <20071004091157.c35f3513.randy.dunlap@oracle.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1250 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Randy Dunlap wrote: > On Thu, 04 Oct 2007 20:38:34 +0900 Takenori Nagano wrote: >> diff -uprN linux-2.6.23-rc9.orig/kernel/sys.c linux-2.6.23-rc9/kernel/sys.c >> --- linux-2.6.23-rc9.orig/kernel/sys.c 2007-10-02 12:24:52.000000000 +0900 >> +++ linux-2.6.23-rc9/kernel/sys.c 2007-10-03 14:48:15.160000000 +0900 >> @@ -38,6 +38,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -393,6 +394,234 @@ int blocking_notifier_call_chain(struct > >> +/** >> + * tunable_notifier_chain_register - Add notifier to an tunable notifier chain >> + * @nh: Pointer to head of the tunable notifier chain >> + * @n: New entry in notifier chain >> + * @name: Pointer to the name of this notifier chain > > Is @name the name of a notifier chain or of the new notifier entry? Hi Randy, @name: Pointer to the name of the new notifier entry. I'll change the explanation. Thanks, --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 4 22:45:52 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 04 Oct 2007 22:46:00 -0700 (PDT) Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.193]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l955jn8t024256 for ; Thu, 4 Oct 2007 22:45:51 -0700 Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.160]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l955h8Pi013913; Fri, 5 Oct 2007 14:43:08 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l955h8S18702; Fri, 5 Oct 2007 14:43:08 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv3.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l955h7B05773; Fri, 5 Oct 2007 14:43:07 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 518A2E480DD; Fri, 5 Oct 2007 14:43:07 +0900 (JST) Message-ID: <4705CEEA.6060100@ah.jp.nec.com> Date: Fri, 05 Oct 2007 14:43:06 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: vgoyal@in.ibm.com CC: linux-kernel@vger.kernel.org, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: Re: [PATCH 0/2] add new notifier function References: <4704D09D.6080503@ah.jp.nec.com> <20071005043354.GA4893@in.ibm.com> In-Reply-To: <20071005043354.GA4893@in.ibm.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1251 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Vivek Goyal wrote: > On Thu, Oct 04, 2007 at 08:38:05PM +0900, Takenori Nagano wrote: > > In summary, right now co-existence of kdb with kdump seems to be your pain > point. I would prefer that kdb just puts a break point on panic() and we move > on. If there are more candidates down the line and these can't be easily > executed in second kernel then we can re-visit this notification list > mechanism. Hi Vivek, Thank you for your comment. :-) I don't mind kdb and kdump problem now. Because my patches are not merged into mainline kernel yet. If they are merged, I think how we can resolve about RAS tools problem. >> # ls >> ipmi_msghandler ipmi_wdog >> # cat ipmi_msghandler/priority >> 200 >> # cat ipmi_wdog/priority >> 150 >> # >> Kernel panic - not syncing: panic >> ipmi_msghandler : notifier calls panic_event(). >> ipmi_watchdog : notifier calls wdog_panic_handler(). >> >> .....(reboot) >> > > We also need to implement a file which can give a consolidated view. All > the registered members and their priority. I tried to implement it, but its impact is large. And we can get all priority values using "ls" and "cat */priority". I'll implement it if user strongly expects it. ex) # cd panic_notifier_list # ls ipmi_msghandler ipmi_wdog # cat */priority 200 150 # Thanks, Takenori Nagano --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 4 22:51:47 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 04 Oct 2007 22:51:55 -0700 (PDT) Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l955pj5A025195 for ; Thu, 4 Oct 2007 22:51:46 -0700 Received: from mailgate3.nec.co.jp (mailgate54.nec.co.jp [10.7.69.193]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l955ncGw017740; Fri, 5 Oct 2007 14:49:38 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l955ncH17072; Fri, 5 Oct 2007 14:49:38 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv5.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l955nbv04840; Fri, 5 Oct 2007 14:49:37 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 9F6C8FF0009; Fri, 5 Oct 2007 14:49:37 +0900 (JST) Message-ID: <4705D070.7080403@ah.jp.nec.com> Date: Fri, 05 Oct 2007 14:49:36 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: vgoyal@in.ibm.com CC: linux-kernel@vger.kernel.org, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: Re: [PATCH 1/2] add tunable_notifier function References: <4704D0BA.4090507@ah.jp.nec.com> <20071005054205.GB4893@in.ibm.com> In-Reply-To: <20071005054205.GB4893@in.ibm.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1252 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Vivek Goyal wrote: > On Thu, Oct 04, 2007 at 08:38:34PM +0900, Takenori Nagano wrote: >> This patch adds new notifier function tunable_notifier_chain. Its base is >> atomic_notifier_chain. >> >> Thanks, >> >> --- >> >> Signed-off-by: Takenori Nagano >> >> --- >> diff -uprN linux-2.6.23-rc9.orig/include/linux/notifier.h >> linux-2.6.23-rc9/include/linux/notifier.h >> --- linux-2.6.23-rc9.orig/include/linux/notifier.h 2007-10-02 12:24:52.000000000 >> +0900 >> +++ linux-2.6.23-rc9/include/linux/notifier.h 2007-10-03 14:48:04.288000000 +0900 >> @@ -13,6 +13,7 @@ >> #include >> #include >> #include >> +#include >> >> /* >> * Notifier chains are of four types: >> @@ -53,6 +54,14 @@ struct notifier_block { >> int priority; >> }; >> >> +struct tunable_notifier_block { >> + struct notifier_block *nb; >> + struct tunable_notifier_head *head; >> + struct dentry *dir; >> + struct dentry *pri_dentry; >> + struct dentry *desc_dentry; >> +}; >> + > > Should this be tunable_atomic_notifier_block? I think there are two kind > of lists. One where handlers have to be atomic and other one where handlers > can be blocking one. I think you are making atomic one tunable. If that's > the case it should be reflected in the naming everywhere. Hi Vivek, Yes, it based on atomic_notifier_list. I think your opinion is reasonable. I'll change the name tunable_notifier to tunable_atomic_notifier. Thanks, Takenori Nagano --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 4 23:22:23 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 04 Oct 2007 23:22:29 -0700 (PDT) Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l956MJtP028937 for ; Thu, 4 Oct 2007 23:22:22 -0700 Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.162]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l956JheA021928; Fri, 5 Oct 2007 15:19:43 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l956JhP20265; Fri, 5 Oct 2007 15:19:43 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l956JhC00385; Fri, 5 Oct 2007 15:19:43 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id E2FEAE48286; Fri, 5 Oct 2007 15:19:42 +0900 (JST) Message-ID: <4705D77E.5000703@ah.jp.nec.com> Date: Fri, 05 Oct 2007 15:19:42 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: vgoyal@in.ibm.com CC: linux-kernel@vger.kernel.org, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: Re: [PATCH 2/2] implement new notifier function to panic_notifier_list References: <4704D0CA.4080001@ah.jp.nec.com> <20071005054952.GC4893@in.ibm.com> In-Reply-To: <20071005054952.GC4893@in.ibm.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1253 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Vivek Goyal wrote: > On Thu, Oct 04, 2007 at 08:38:50PM +0900, Takenori Nagano wrote: > >> @@ -522,8 +530,8 @@ setup_arch(char **cmdline_p) >> } >> >> /* Register a call for panic conditions. */ >> - atomic_notifier_chain_register(&panic_notifier_list, >> - &alpha_panic_block); >> + tunable_notifier_chain_register(&panic_notifier_list, >> + &alpha_panic_block, "alpha_panic", NULL); >> > > I think it might be good idea to somehow create provisions for another a > help string. This help string will inform admin that what a registered > user does? Ideally this should be visible in /sys/kernel/debug//description file. Hi Vivek, We can make description file with tunable_notifier_chain_register 4th argument. If developer sets 4th argument, tunable_notifier_chain_register makes /sys/kernel/debug//description file. Admin can get information from the description file. +/** + * tunable_notifier_chain_register - Add notifier to an tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @n: New entry in notifier chain + * @name: Pointer to the name of the new notifier entry + * @desc: Pointer to the description of new entry + * + * Adds a notifier to an tunable notifier chain and makes control dir. + * + * Returns zero on success or %-ENODEV on failure. + */ Thanks, Takenori Nagano --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kbaidarov@ru.mvista.com Mon Oct 8 10:37:27 2007 Received: with ECARTIS (v1.0.0; list kdb); Mon, 08 Oct 2007 10:37:35 -0700 (PDT) Received: from mail.dev.rtsoft.ru (rtsoft2.corbina.net [85.21.88.2] (may be forged)) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with SMTP id l98HbNVD026182 for ; Mon, 8 Oct 2007 10:37:26 -0700 Received: (qmail 18377 invoked from network); 8 Oct 2007 17:10:40 -0000 Received: from unknown (HELO localhost.localdomain) (192.168.1.130) by mail.dev.rtsoft.ru with SMTP; 8 Oct 2007 17:10:40 -0000 Date: Mon, 8 Oct 2007 21:09:36 +0400 From: Konstantin Baydarov To: kdb@oss.sgi.com Subject: [PATCH] Add support for USB Keyboard attached to UHCI Message-ID: <20071008210936.7eba734d@localhost.localdomain> X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.19; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-archive-position: 1254 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kbaidarov@ru.mvista.com Precedence: bulk X-list: kdb Patch adds support of USB keyboard attached to UHCI in KDB. Whole UHCI irq handler(uhci_irq) is called periodically by KDB poll code when irqs are disabled. I've tested patch with em64t pentiumd. USB keyboard attached to UHCI works OK except there is 1 issue: auto reply of pressed key doesn't work, but I don't think that is a critical issue. Patch against 2.6.23-rc8. Signed-off-by: Konstantin Baydarov arch/i386/Kconfig.debug | 4 ++-- drivers/char/keyboard.c | 11 +++++++++++ drivers/usb/host/uhci-hcd.c | 36 ++++++++++++++++++++++++++++++++++++ include/linux/kdb.h | 1 + kdb/kdbmain.c | 1 + 5 files changed, 51 insertions(+), 2 deletions(-) Index: linux-2.6.23-rc8/drivers/usb/host/uhci-hcd.c =================================================================== --- linux-2.6.23-rc8.orig/drivers/usb/host/uhci-hcd.c +++ linux-2.6.23-rc8/drivers/usb/host/uhci-hcd.c @@ -41,6 +41,10 @@ #include #include +#ifdef CONFIG_KDB_USB +#include +#endif + #include #include #include @@ -427,9 +431,37 @@ static irqreturn_t uhci_irq(struct usb_h spin_unlock_irqrestore(&uhci->lock, flags); } +#ifdef CONFIG_KDB_USB + if (kdb_kbd_delay_enter){ + kdb_kbd_delay_enter = 0; +#ifndef CONFIG_PREEMPT_HARDIRQS + kdb(KDB_REASON_KEYBOARD, 0, get_irq_regs()); +#else + KDB_ENTER(); +#endif + } +#endif + return IRQ_HANDLED; } +#ifdef CONFIG_KDB_USB +void +uhci_kdb_poll (void * __uhci, struct urb *urb) +{ + /* + * NOTE - we use the uhci_hcd from the urb rather than the + * __uhci parameter (which is NULL anyway). This ensures + * that we will process the proper controller for the urb. + */ + + if (!urb) /* can happen if no keyboard attached */ + return; + + uhci_irq(bus_to_hcd(urb->dev->bus)); +} +#endif /* CONFIG_KDB_USB */ + /* * Store the current frame number in uhci->frame_number if the controller * is runnning. Expand from 11 bits (of which we use only 10) to a @@ -661,6 +693,10 @@ static int uhci_start(struct usb_hcd *hc configure_hc(uhci); uhci->is_initialized = 1; start_rh(uhci); +#ifdef CONFIG_KDB_USB + kdb_usb_infos.poll_func = uhci_kdb_poll; + kdb_usb_infos.uhci = NULL; /* not used */ +#endif return 0; /* Index: linux-2.6.23-rc8/drivers/char/keyboard.c =================================================================== --- linux-2.6.23-rc8.orig/drivers/char/keyboard.c +++ linux-2.6.23-rc8/drivers/char/keyboard.c @@ -43,6 +43,7 @@ #include #ifdef CONFIG_KDB #include +void uhci_kdb_poll (void * __uhci, struct urb *urb); #endif /* CONFIG_KDB */ extern void ctrl_alt_del(void); @@ -1149,6 +1150,16 @@ static void kbd_keycode(unsigned int key #ifdef CONFIG_KDB if (down && !rep && keycode == KEY_PAUSE && kdb_on == 1) { +#ifdef CONFIG_KDB_USB + /* Is this USB keyboard attached to UHCI ? */ + if ((kdb_usb_infos.poll_func == uhci_kdb_poll) + && kdb_usb_infos.urb) + /* uhci_irq should be completed before kernel + * enters KDB + */ + kdb_kbd_delay_enter = 1; + else +#endif kdb(KDB_REASON_KEYBOARD, 0, get_irq_regs()); return; } Index: linux-2.6.23-rc8/include/linux/kdb.h =================================================================== --- linux-2.6.23-rc8.orig/include/linux/kdb.h +++ linux-2.6.23-rc8/include/linux/kdb.h @@ -162,5 +162,6 @@ int kdb_process_cpu(const struct task_st } extern const char kdb_serial_str[]; +extern int kdb_kbd_delay_enter; #endif /* !_KDB_H */ Index: linux-2.6.23-rc8/kdb/kdbmain.c =================================================================== --- linux-2.6.23-rc8.orig/kdb/kdbmain.c +++ linux-2.6.23-rc8/kdb/kdbmain.c @@ -53,6 +53,7 @@ volatile int kdb_flags; atomic_t kdb_event; atomic_t kdb_8250; +int kdb_kbd_delay_enter = 0; /* * kdb_lock protects updates to kdb_initial_cpu. Used to Index: linux-2.6.23-rc8/arch/i386/Kconfig.debug =================================================================== --- linux-2.6.23-rc8.orig/arch/i386/Kconfig.debug +++ linux-2.6.23-rc8/arch/i386/Kconfig.debug @@ -156,8 +156,8 @@ config KDB_CONTINUE_CATASTROPHIC setting to 2. config KDB_USB - bool "Support for USB Keyboard in KDB (OHCI only)" - depends on KDB && USB_OHCI_HCD + bool "Support for USB Keyboard in KDB (OHCI and UHCI only)" + depends on KDB && (USB_OHCI_HCD || USB_UHCI_HCD) help If you want to use kdb from a OHCI USB keyboard then say Y here. If you say N then kdb can only be used from a PC (AT) keyboard or a serial --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Tue Oct 9 00:42:33 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 09 Oct 2007 00:42:44 -0700 (PDT) Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.193]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l997gUSt014995 for ; Tue, 9 Oct 2007 00:42:33 -0700 Received: from mailgate3.nec.co.jp (mailgate54.nec.co.jp [10.7.69.197]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l997cp2i011833; Tue, 9 Oct 2007 16:38:51 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l997cpj13798; Tue, 9 Oct 2007 16:38:51 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv4.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l997coY19300; Tue, 9 Oct 2007 16:38:50 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 98531E4821C; Tue, 9 Oct 2007 16:38:50 +0900 (JST) Message-ID: <470B3008.9040003@ah.jp.nec.com> Date: Tue, 09 Oct 2007 16:38:48 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: "Eric W. Biederman" CC: linux-kernel@vger.kernel.org, vgoyal@in.ibm.com, k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: Re: [PATCH 0/2] add new notifier function References: <4704D09D.6080503@ah.jp.nec.com> In-Reply-To: Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1255 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Eric W. Biederman wrote: > Takenori Nagano writes: > >> Hi, >> >> These patches add new notifier function and implement it to panic_notifier_list. >> We used the hardcoded notifier chain so far, but it was not flexible. New >> notifier is very flexible, because user can change a list of order by debugfs. > > How is the lack of flexibility a problem? > Specifics please. Please read this again. http://www.gossamer-threads.com/lists/linux/kernel/797220?do=post_view_threaded#797220 Keith Owen said, > My stance is that _all_ the RAS tools (kdb, kgdb, nlkd, netdump, lkcd, > crash, kdump etc.) should be using a common interface that safely puts > the entire system in a stopped state and saves the state of each cpu. > Then each tool can do what it likes, instead of every RAS tool doing > its own thing and they all conflict with each other, which is why this > thread started. > > It is not the kernel's job to decide which RAS tool runs first, second > etc., it is the user's decision to set that policy. Different sites > will want different orders, some will say "go straight to kdump", other > sites will want to invoke a debugger first. Sites must be able to > define that policy, but we hard code the policy into the kernel. I agreed with him and I made new notifier function. > > My impression is that the purpose of this patchset is to build > infrastructure to sort out a conflict between kdb and the kexec code, > which it does not do, and it can not do if it does not own up to > it's real purpose. My motivation does not change. But I don't think kdump have to use notifer. I want to resolve this adopting the way which satisfy all users. Thanks, Takenori Nagano --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Wed Oct 17 23:48:01 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 17 Oct 2007 23:48:12 -0700 (PDT) Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9I6lwSa029764 for ; Wed, 17 Oct 2007 23:48:00 -0700 Received: from mailgate4.nec.co.jp (mailgate53.nec.co.jp [10.7.69.184]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9I6jH2g008706; Thu, 18 Oct 2007 15:45:17 +0900 (JST) Received: (from root@localhost) by mailgate4.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9I6jHt17609; Thu, 18 Oct 2007 15:45:17 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l9I6jGC10951; Thu, 18 Oct 2007 15:45:16 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 81EE3E48286; Thu, 18 Oct 2007 15:45:16 +0900 (JST) Message-ID: <471700FA.9030509@ah.jp.nec.com> Date: Thu, 18 Oct 2007 15:45:14 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: [PATCH 1/2] add tunable_notifier function ,take2 References: <4716FFDB.7090502@ah.jp.nec.com> In-Reply-To: <4716FFDB.7090502@ah.jp.nec.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1257 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb This patch adds new notifier function tunable_notifier_chain. Its base is atomic_notifier_chain. Thanks, --- Signed-off-by: Takenori Nagano --- diff -uprN linux-2.6.23.orig/include/linux/notifier.h linux-2.6.23/include/linux/notifier.h --- linux-2.6.23.orig/include/linux/notifier.h 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/include/linux/notifier.h 2007-10-18 09:59:13.732000000 +0900 @@ -13,6 +13,7 @@ #include #include #include +#include /* * Notifier chains are of four types: @@ -53,6 +54,14 @@ struct notifier_block { int priority; }; +struct tunable_atomic_notifier_block { + struct notifier_block *nb; + struct tunable_atomic_notifier_head *head; + struct dentry *dir; + struct dentry *pri_dentry; + struct dentry *desc_dentry; +}; + struct atomic_notifier_head { spinlock_t lock; struct notifier_block *head; @@ -63,6 +72,13 @@ struct blocking_notifier_head { struct notifier_block *head; }; +struct tunable_atomic_notifier_head { + spinlock_t lock; + struct notifier_block *head; + char *name; + struct dentry *dir; +}; + struct raw_notifier_head { struct notifier_block *head; }; @@ -81,6 +97,12 @@ struct srcu_notifier_head { init_rwsem(&(name)->rwsem); \ (name)->head = NULL; \ } while (0) +#define TUNABLE_ATOMIC_INIT_NOTIFIER(val1, val2) do { \ + spin_lock_init(&(val1)->lock); \ + (val1)->head = NULL; \ + (val1)->name = val2; \ + (val1)->dir = NULL; \ + } while (0) #define RAW_INIT_NOTIFIER_HEAD(name) do { \ (name)->head = NULL; \ } while (0) @@ -96,6 +118,11 @@ extern void srcu_init_notifier_head(stru #define BLOCKING_NOTIFIER_INIT(name) { \ .rwsem = __RWSEM_INITIALIZER((name).rwsem), \ .head = NULL } +#define TUNABLE_ATOMIC_NOTIFIER_INIT(val1, val2) { \ + .lock =__SPIN_LOCK_UNLOCKED(val1.lock), \ + .head = NULL, \ + .name = val2, \ + .dir = NULL } #define RAW_NOTIFIER_INIT(name) { \ .head = NULL } /* srcu_notifier_heads cannot be initialized statically */ @@ -106,6 +133,9 @@ extern void srcu_init_notifier_head(stru #define BLOCKING_NOTIFIER_HEAD(name) \ struct blocking_notifier_head name = \ BLOCKING_NOTIFIER_INIT(name) +#define TUNABLE_ATOMIC_NOTIFIER_HEAD(name, val) \ + struct tunable_atomic_notifier_head name = \ + TUNABLE_ATOMIC_NOTIFIER_INIT(name, val) #define RAW_NOTIFIER_HEAD(name) \ struct raw_notifier_head name = \ RAW_NOTIFIER_INIT(name) @@ -116,6 +146,10 @@ extern int atomic_notifier_chain_registe struct notifier_block *nb); extern int blocking_notifier_chain_register(struct blocking_notifier_head *nh, struct notifier_block *nb); +extern int tunable_atomic_notifier_chain_register( + struct tunable_atomic_notifier_head *nh, + struct tunable_atomic_notifier_block *nb, + char *name, char *desc); extern int raw_notifier_chain_register(struct raw_notifier_head *nh, struct notifier_block *nb); extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, @@ -125,6 +159,9 @@ extern int atomic_notifier_chain_unregis struct notifier_block *nb); extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, struct notifier_block *nb); +extern int tunable_atomic_notifier_chain_unregister( + struct tunable_atomic_notifier_head *nh, + struct tunable_atomic_notifier_block *nb); extern int raw_notifier_chain_unregister(struct raw_notifier_head *nh, struct notifier_block *nb); extern int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh, @@ -138,6 +175,13 @@ extern int blocking_notifier_call_chain( unsigned long val, void *v); extern int __blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls); +extern int tunable_atomic_notifier_call_chain( + struct tunable_atomic_notifier_head *nh, + unsigned long val, void *v); +extern int __tunable_atomic_notifier_call_chain( + struct tunable_atomic_notifier_head *nh, + unsigned long val, void *v, + int nr_to_call, int *nr_calls); extern int raw_notifier_call_chain(struct raw_notifier_head *nh, unsigned long val, void *v); extern int __raw_notifier_call_chain(struct raw_notifier_head *nh, diff -uprN linux-2.6.23.orig/kernel/sys.c linux-2.6.23/kernel/sys.c --- linux-2.6.23.orig/kernel/sys.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/kernel/sys.c 2007-10-18 10:08:52.728000000 +0900 @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -393,6 +394,243 @@ int blocking_notifier_call_chain(struct EXPORT_SYMBOL_GPL(blocking_notifier_call_chain); /* + * Tunable atomic notifier chain routines. Registration and unregistration + * use a spinlock, and call_chain is synchronized by RCU (no locks). + * User can change the list order to use /sys/kernel/debug/list-name/. + */ + +static ssize_t priority_read(struct file *file, + char __user *user_buf, size_t count, loff_t *ppos) +{ + struct tunable_atomic_notifier_block *n = + file->f_dentry->d_inode->i_private; + int priority = n->nb->priority; + char buf[64], *s; + + s = buf; + s += sprintf(s, "%d\n", priority); + + return simple_read_from_buffer((void __user *)user_buf, count, + ppos, buf, s - buf); +} + +static ssize_t priority_write(struct file *file, + const char __user *user_buf, size_t count, loff_t *ppos) +{ + struct tunable_atomic_notifier_block *n = + file->f_dentry->d_inode->i_private; + struct tunable_atomic_notifier_head *nh = n->head; + char *buf, *end; + int ret = -ENOMEM, priority; + unsigned long tmp, flags; + + buf = kmalloc(count + 1, GFP_KERNEL); + if (!buf) + goto out; + + buf[count] = 0; + ret = -EFAULT; + if (copy_from_user(buf, user_buf, count)) + goto out_free; + + ret = -EINVAL; + tmp = simple_strtoul(buf, &end, 10); + if ((end == buf) || (tmp > INT_MAX)) + goto out_free; + + priority = (int)tmp; + n->nb->priority = priority; + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_unregister(&nh->head, n->nb); + if (ret) + goto out_unlock; + ret = notifier_chain_register(&nh->head, n->nb); + if (!ret) + ret = count; + +out_unlock: + spin_unlock_irqrestore(&nh->lock, flags); +out_free: + kfree(buf); +out: + return ret; + +} + +static const struct file_operations pri_fops = { + .read = priority_read, + .write = priority_write, +}; + +static ssize_t description_read(struct file *file, + char __user *user_buf, size_t count, loff_t *ppos) +{ + char *desc = file->f_dentry->d_inode->i_private; + int avail = strlen(desc); + + return simple_read_from_buffer(user_buf, count, ppos, desc, avail); +} + +static const struct file_operations desc_fops = { + .read = description_read, +}; + +/** + * tunable_atomic_notifier_chain_register + * - Add notifier to an tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @n: New entry in notifier chain + * @name: Pointer to the name of the new notifier entry + * @desc: Pointer to the description of new entry + * + * Adds a notifier to an tunable notifier chain and makes control dir. + * + * Returns zero on success or %-ENODEV on failure. + */ + +int tunable_atomic_notifier_chain_register( + struct tunable_atomic_notifier_head *nh, + struct tunable_atomic_notifier_block *n, char *name, char *desc) +{ + unsigned long flags; + int ret = -EINVAL; + struct dentry *nh_dir, *nb_dir, *pri_dentry, *desc_dentry = NULL; + + if (!name) + goto nb_fail; + + ret = -ENOMEM; + if (!nh->dir) { + nh_dir = debugfs_create_dir(nh->name, NULL); + if (!nh_dir) + return ret; + nh->dir = nh_dir; + } else + nh_dir = nh->dir; + + nb_dir = debugfs_create_dir(name, nh_dir); + if (!nb_dir) + goto nb_fail; + n->dir = nb_dir; + + pri_dentry = debugfs_create_file("priority",0600, nb_dir, n, &pri_fops); + if (!pri_dentry) + goto pri_fail; + n->pri_dentry = pri_dentry; + + if (desc) { + desc_dentry = debugfs_create_file("description", 0400, nb_dir, + desc, &desc_fops); + if (!desc_dentry) + goto desc_fail; + n->desc_dentry = desc_dentry; + } + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_register(&nh->head, n->nb); + spin_unlock_irqrestore(&nh->lock, flags); + + if (ret) + goto reg_fail; + + n->head = nh; + + return ret; + +reg_fail: + debugfs_remove(desc_dentry); +desc_fail: + debugfs_remove(pri_dentry); +pri_fail: + debugfs_remove(nb_dir); +nb_fail: + return ret; +} + +EXPORT_SYMBOL_GPL(tunable_atomic_notifier_chain_register); + +/** + * tunable_atomic_notifier_chain_unregister + * - Remove notifier from a tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @n: Entry to remove from notifier chain + * + * Removes a notifier from a tunable notifier chain. + * + * Retunrns zero on success or %-ENOENT on failure. + */ + +int tunable_atomic_notifier_chain_unregister( + struct tunable_atomic_notifier_head *nh, + struct tunable_atomic_notifier_block *n) +{ + unsigned long flags; + int ret; + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_unregister(&nh->head, n->nb); + spin_unlock_irqrestore(&nh->lock, flags); + synchronize_rcu(); + + if (ret) + return ret; + + debugfs_remove(n->desc_dentry); + debugfs_remove(n->pri_dentry); + debugfs_remove(n->dir); + + return 0; +} + +EXPORT_SYMBOL_GPL(tunable_atomic_notifier_chain_unregister); + +/** + * __tunable_atomic_notifier_call_chain + * - Call functions in a tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @val: Value passed unmodified to notifier function + * @v: Pointer passed unmodified to notifier function + * @nt_to_call: See the comment for notifier_call_chain + * @nr_calls: See the comment for notifier_call_chain + * + * Calls each function in a notifier chain in turn. The functions + * run in an atomic context, so they must not block. + * This routine uses RCU to synchronize with changes to the chain. + * + * If the return value of the notifier can be and'ed + * with %NOTIFY_STOP_MASK then tunable_atomic_notifier_call_chain() + * will return immediately, with the return value of + * the notifier function which halted execution. + * Otherwise the return value is the return value + * of the last notifier function called. + */ + +int __kprobes __tunable_atomic_notifier_call_chain( + struct tunable_atomic_notifier_head *nh, + unsigned long val, void *v, + int nr_to_call, int *nr_calls) +{ + int ret; + + rcu_read_lock(); + ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls); + rcu_read_unlock(); + return ret; +} + +EXPORT_SYMBOL_GPL(__tunable_atomic_notifier_call_chain); + +int __kprobes tunable_atomic_notifier_call_chain( + struct tunable_atomic_notifier_head *nh, + unsigned long val, void *v) +{ + return __tunable_atomic_notifier_call_chain(nh, val, v, -1, NULL); +} + +EXPORT_SYMBOL_GPL(tunable_atomic_notifier_call_chain); + +/* * Raw notifier chain routines. There is no protection; * the caller must provide it. Use at your own risk! */ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Wed Oct 17 23:48:01 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 17 Oct 2007 23:48:11 -0700 (PDT) Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.193]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9I6lvAv029763 for ; Wed, 17 Oct 2007 23:48:00 -0700 Received: from mailgate4.nec.co.jp (mailgate53.nec.co.jp [10.7.69.184]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9I6jBEc013074; Thu, 18 Oct 2007 15:45:11 +0900 (JST) Received: (from root@localhost) by mailgate4.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9I6jBP17519; Thu, 18 Oct 2007 15:45:11 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv3.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l9I6jAB09938; Thu, 18 Oct 2007 15:45:10 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 3C53AE48286; Thu, 18 Oct 2007 15:45:10 +0900 (JST) Message-ID: <471700F4.1080200@ah.jp.nec.com> Date: Thu, 18 Oct 2007 15:45:08 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: [PATCH 0/2] add new notifier function ,take2 Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1256 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Hi, A big thanks to everybody who read and replied to first version. I have tried to incorporate reviewer's comments and suggestions. changelog take1 -> take2 - Rebased 2.6.23 - comment updated - renamed the notifiner name "tunable_notifier" to "tunable_atomic_notifier" - fixed typo These patches add new notifier function and implement it to panic_notifier_list. We used the hardcoded notifier chain so far, but it was not flexible. New notifier is very flexible, because user can change a list of order by debugfs. Thanks, Example) # cd /sys/kernel/debug/ # ls kprobes pktcdvd # insmod ipmi_msghandler.ko # ls kprobes panic_notifier_list pktcdvd # cd panic_notifier_list/ # ls ipmi_msghandler # insmod ipmi_watchdog.ko # ls ipmi_msghandler ipmi_wdog # cat ipmi_msghandler/priority 200 # cat ipmi_wdog/priority 150 # Kernel panic - not syncing: panic ipmi_msghandler : notifier calls panic_event(). ipmi_watchdog : notifier calls wdog_panic_handler(). .....(reboot) # cat ipmi_msghandler/priority 200 # cat ipmi_wdog/priority 150 # echo 300 > ipmi_wdog/priority # Kernel panic - not syncing: panic ipmi_watchdog : notifier calls wdog_panic_handler(). ipmi_msghandler : notifier calls panic_event(). -- Takenori Nagano --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Wed Oct 17 23:48:09 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 17 Oct 2007 23:48:25 -0700 (PDT) Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9I6m6dn029805 for ; Wed, 17 Oct 2007 23:48:08 -0700 Received: from mailgate3.nec.co.jp (mailgate54.nec.co.jp [10.7.69.195]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9I6jRWn008870; Thu, 18 Oct 2007 15:45:27 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9I6jRF06223; Thu, 18 Oct 2007 15:45:27 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv4.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l9I6jQY07207; Thu, 18 Oct 2007 15:45:26 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 7BFA8E48286; Thu, 18 Oct 2007 15:45:21 +0900 (JST) Message-ID: <471700FF.2050303@ah.jp.nec.com> Date: Thu, 18 Oct 2007 15:45:19 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: [PATCH 2/2] implement new notifier function to panic_notifier_list ,take2 References: <4716FFDB.7090502@ah.jp.nec.com> In-Reply-To: <4716FFDB.7090502@ah.jp.nec.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1258 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb This patch implements new notifier function to panic_notifier_list. We can change the list of order by debugfs. Thanks, --- Signed-off-by: Takenori Nagano --- diff -uprN linux-2.6.23.orig/arch/alpha/kernel/setup.c linux-2.6.23/arch/alpha/kernel/setup.c --- linux-2.6.23.orig/arch/alpha/kernel/setup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/alpha/kernel/setup.c 2007-10-18 08:56:53.928000000 +0900 @@ -45,14 +45,22 @@ #include #include -extern struct atomic_notifier_head panic_notifier_list; +extern struct tunable_atomic_notifier_head panic_notifier_list; static int alpha_panic_event(struct notifier_block *, unsigned long, void *); -static struct notifier_block alpha_panic_block = { +static struct notifier_block alpha_panic_block_base = { alpha_panic_event, NULL, INT_MAX /* try to do it first */ }; +static struct tunable_atomic_notifier_block alpha_panic_block = { + &alpha_panic_block_base, + NULL, + NULL, + NULL, + NULL +}; + #include #include #include @@ -522,8 +530,8 @@ setup_arch(char **cmdline_p) } /* Register a call for panic conditions. */ - atomic_notifier_chain_register(&panic_notifier_list, - &alpha_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &alpha_panic_block, "alpha_panic", NULL); #ifdef CONFIG_ALPHA_GENERIC /* Assume that we've booted from SRM if we haven't booted from MILO. diff -uprN linux-2.6.23.orig/arch/arm/mach-omap1/board-voiceblue.c linux-2.6.23/arch/arm/mach-omap1/board-voiceblue.c --- linux-2.6.23.orig/arch/arm/mach-omap1/board-voiceblue.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/arm/mach-omap1/board-voiceblue.c 2007-10-18 09:00:35.900000000 +0900 @@ -228,14 +228,23 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init voiceblue_setup(void) { /* Setup panic notifier */ - notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "VoiceBlue", NULL); return 0; } diff -uprN linux-2.6.23.orig/arch/mips/sgi-ip22/ip22-reset.c linux-2.6.23/arch/mips/sgi-ip22/ip22-reset.c --- linux-2.6.23.orig/arch/mips/sgi-ip22/ip22-reset.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/mips/sgi-ip22/ip22-reset.c 2007-10-18 09:01:33.408000000 +0900 @@ -226,10 +226,18 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init reboot_setup(void) { _machine_restart = sgi_machine_restart; @@ -239,7 +247,8 @@ static int __init reboot_setup(void) request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); init_timer(&blink_timer); blink_timer.function = blink_timeout; - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "sgi-ip22", NULL); return 0; } diff -uprN linux-2.6.23.orig/arch/mips/sgi-ip32/ip32-reset.c linux-2.6.23/arch/mips/sgi-ip32/ip32-reset.c --- linux-2.6.23.orig/arch/mips/sgi-ip32/ip32-reset.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/mips/sgi-ip32/ip32-reset.c 2007-10-18 09:02:20.496000000 +0900 @@ -175,10 +175,18 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static __init int ip32_reboot_setup(void) { /* turn on the green led only */ @@ -193,7 +201,8 @@ static __init int ip32_reboot_setup(void init_timer(&blink_timer); blink_timer.function = blink_timeout; - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "sgi-ip32", NULL); if (request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL)) panic("Can't allocate MACEISA RTC IRQ"); diff -uprN linux-2.6.23.orig/arch/parisc/kernel/pdc_chassis.c linux-2.6.23/arch/parisc/kernel/pdc_chassis.c --- linux-2.6.23.orig/arch/parisc/kernel/pdc_chassis.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/parisc/kernel/pdc_chassis.c 2007-10-18 08:56:54.052000000 +0900 @@ -101,11 +101,18 @@ static int pdc_chassis_panic_event(struc } -static struct notifier_block pdc_chassis_panic_block = { +static struct notifier_block pdc_chassis_panic_block_base = { .notifier_call = pdc_chassis_panic_event, .priority = INT_MAX, }; +static struct tunable_atomic_notifier_block pdc_chassis_panic_block = { + .nb = &pdc_chassis_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; /** * parisc_reboot_event() - Called by the reboot handler. @@ -144,8 +151,8 @@ void __init parisc_pdc_chassis_init(void PDC_CHASSIS_VER); /* initialize panic notifier chain */ - atomic_notifier_chain_register(&panic_notifier_list, - &pdc_chassis_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &pdc_chassis_panic_block, "pdc_chassis", NULL); /* initialize reboot notifier chain */ register_reboot_notifier(&pdc_chassis_reboot_block); diff -uprN linux-2.6.23.orig/arch/powerpc/kernel/setup-common.c linux-2.6.23/arch/powerpc/kernel/setup-common.c --- linux-2.6.23.orig/arch/powerpc/kernel/setup-common.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/powerpc/kernel/setup-common.c 2007-10-18 09:03:40.968000000 +0900 @@ -534,14 +534,23 @@ static int ppc_panic_event(struct notifi return NOTIFY_DONE; } -static struct notifier_block ppc_panic_block = { +static struct notifier_block ppc_panic_block_base = { .notifier_call = ppc_panic_event, .priority = INT_MIN /* may not return; must be done last */ }; +static struct tunable_atomic_notifier_block ppc_panic_block = { + .nb = &ppc_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init setup_panic(void) { - atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &ppc_panic_block, "powerpc", NULL); } #ifdef CONFIG_CHECK_CACHE_COHERENCY diff -uprN linux-2.6.23.orig/arch/ppc/platforms/prep_setup.c linux-2.6.23/arch/ppc/platforms/prep_setup.c --- linux-2.6.23.orig/arch/ppc/platforms/prep_setup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/ppc/platforms/prep_setup.c 2007-10-18 09:04:56.352000000 +0900 @@ -712,12 +712,20 @@ ibm_statusled_panic(struct notifier_bloc return NOTIFY_DONE; } -static struct notifier_block ibm_statusled_block = { +static struct notifier_block ibm_statusled_block_base = { ibm_statusled_panic, NULL, INT_MAX /* try to do it first */ }; +static struct tunable_atomic_notifier_block ibm_statusled_block = { + &ibm_statusled_block_base, + NULL, + NULL, + NULL, + NULL +}; + static void ibm_statusled_progress(char *s, unsigned short hex) { @@ -732,8 +740,9 @@ ibm_statusled_progress(char *s, unsigned hex = 0xfff; if (!notifier_installed) { ++notifier_installed; - atomic_notifier_chain_register(&panic_notifier_list, - &ibm_statusled_block); + tunable_atomic_notifier_chain_register( + &panic_notifier_list, &ibm_statusled_block, + "IBM_statusLED", NULL); } } else diff -uprN linux-2.6.23.orig/arch/s390/kernel/ipl.c linux-2.6.23/arch/s390/kernel/ipl.c --- linux-2.6.23.orig/arch/s390/kernel/ipl.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/s390/kernel/ipl.c 2007-10-18 08:56:54.132000000 +0900 @@ -1036,11 +1036,19 @@ static int shutdown_on_panic_notify(stru return NOTIFY_OK; } -static struct notifier_block shutdown_on_panic_nb = { +static struct notifier_block shutdown_on_panic_nb_base = { .notifier_call = shutdown_on_panic_notify, .priority = SHUTDOWN_ON_PANIC_PRIO }; +static struct tunable_atomic_notifier_block shutdown_on_panic_nb = { + .nb = &shutdown_on_panic_nb_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init dump_init(void) { int rc; @@ -1075,8 +1083,8 @@ static int __init shutdown_actions_init( firmware_unregister(&shutdown_actions_subsys); return rc; } - atomic_notifier_chain_register(&panic_notifier_list, - &shutdown_on_panic_nb); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &shutdown_on_panic_nb, "s390_ipl", NULL); return 0; } diff -uprN linux-2.6.23.orig/arch/s390/kernel/setup.c linux-2.6.23/arch/s390/kernel/setup.c --- linux-2.6.23.orig/arch/s390/kernel/setup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/s390/kernel/setup.c 2007-10-18 08:56:54.144000000 +0900 @@ -173,11 +173,19 @@ static int vmpanic_notify(struct notifie #define PANIC_PRI_VMPANIC 0 -static struct notifier_block vmpanic_nb = { +static struct notifier_block vmpanic_nb_base = { .notifier_call = vmpanic_notify, .priority = PANIC_PRI_VMPANIC }; +static struct tunable_atomic_notifier_block vmpanic_nb = { + .nb = &vmpanic_nb_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init vmpanic_setup(char *str) { static int register_done __initdata = 0; @@ -186,8 +194,8 @@ static int __init vmpanic_setup(char *st vmpanic_cmd[127] = 0; if (!register_done) { register_done = 1; - atomic_notifier_chain_register(&panic_notifier_list, - &vmpanic_nb); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &vmpanic_nb, "s390_panic", NULL); } return 1; } diff -uprN linux-2.6.23.orig/arch/sparc64/kernel/sstate.c linux-2.6.23/arch/sparc64/kernel/sstate.c --- linux-2.6.23.orig/arch/sparc64/kernel/sstate.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/sparc64/kernel/sstate.c 2007-10-18 09:05:46.620000000 +0900 @@ -82,11 +82,19 @@ static int sstate_panic_event(struct not return NOTIFY_DONE; } -static struct notifier_block sstate_panic_block = { +static struct notifier_block sstate_panic_block_base = { .notifier_call = sstate_panic_event, .priority = INT_MAX, }; +static struct tunable_atomic_notifier_block sstate_panic_block = { + .nb = &sstate_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init sun4v_sstate_init(void) { unsigned long major, minor; @@ -99,6 +107,6 @@ void __init sun4v_sstate_init(void) hv_supports_soft_state = 1; prom_sun4v_guest_soft_state(); - atomic_notifier_chain_register(&panic_notifier_list, - &sstate_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &sstate_panic_block, "sstate" ,NULL); } diff -uprN linux-2.6.23.orig/arch/um/drivers/mconsole_kern.c linux-2.6.23/arch/um/drivers/mconsole_kern.c --- linux-2.6.23.orig/arch/um/drivers/mconsole_kern.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/um/drivers/mconsole_kern.c 2007-10-18 09:06:25.144000000 +0900 @@ -928,16 +928,24 @@ static int notify_panic(struct notifier_ return(0); } -static struct notifier_block panic_exit_notifier = { +static struct notifier_block panic_exit_notifier_base = { .notifier_call = notify_panic, .next = NULL, .priority = 1 }; +static struct tunable_atomic_notifier_block panic_exit_notifier = { + .nb = &panic_exit_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int add_notifier(void) { - atomic_notifier_chain_register(&panic_notifier_list, - &panic_exit_notifier); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_exit_notifier, "mconsole", NULL); return(0); } diff -uprN linux-2.6.23.orig/arch/um/kernel/um_arch.c linux-2.6.23/arch/um/kernel/um_arch.c --- linux-2.6.23.orig/arch/um/kernel/um_arch.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/um/kernel/um_arch.c 2007-10-18 09:06:45.360000000 +0900 @@ -478,16 +478,24 @@ static int panic_exit(struct notifier_bl return 0; } -static struct notifier_block panic_exit_notifier = { +static struct notifier_block panic_exit_notifier_base = { .notifier_call = panic_exit, .next = NULL, .priority = 0 }; +static struct tunable_atomic_notifier_block panic_exit_notifier = { + .nb = &panic_exit_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init setup_arch(char **cmdline_p) { - atomic_notifier_chain_register(&panic_notifier_list, - &panic_exit_notifier); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_exit_notifier, "um", NULL); paging_init(); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; diff -uprN linux-2.6.23.orig/arch/xtensa/platform-iss/setup.c linux-2.6.23/arch/xtensa/platform-iss/setup.c --- linux-2.6.23.orig/arch/xtensa/platform-iss/setup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/xtensa/platform-iss/setup.c 2007-10-18 09:07:25.468000000 +0900 @@ -98,13 +98,22 @@ iss_panic_event(struct notifier_block *t return NOTIFY_DONE; } -static struct notifier_block iss_panic_block = { +static struct notifier_block iss_panic_block_base = { iss_panic_event, NULL, 0 }; +static struct tunable_atomic_notifier_block iss_panic_block = { + &iss_panic_block_base, + NULL, + NULL, + NULL, + NULL +}; + void __init platform_setup(char **p_cmdline) { - atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &iss_panic_block, "iss_panic", NULL); } diff -uprN linux-2.6.23.orig/drivers/char/ipmi/ipmi_msghandler.c linux-2.6.23/drivers/char/ipmi/ipmi_msghandler.c --- linux-2.6.23.orig/drivers/char/ipmi/ipmi_msghandler.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/char/ipmi/ipmi_msghandler.c 2007-10-18 09:08:31.012000000 +0900 @@ -4070,12 +4070,20 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, .next = NULL, .priority = 200 /* priority: INT_MAX >= x >= 0 */ }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int ipmi_init_msghandler(void) { int rv; @@ -4105,7 +4113,8 @@ static int ipmi_init_msghandler(void) setup_timer(&ipmi_timer, ipmi_timeout, 0); mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "ipmi_msghandler", NULL); initialized = 1; @@ -4125,7 +4134,8 @@ static __exit void cleanup_ipmi(void) if (!initialized) return; - atomic_notifier_chain_unregister(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &panic_block); /* This can't be called if any interfaces exist, so no worry about shutting down the interfaces. */ diff -uprN linux-2.6.23.orig/drivers/char/ipmi/ipmi_watchdog.c linux-2.6.23/drivers/char/ipmi/ipmi_watchdog.c --- linux-2.6.23.orig/drivers/char/ipmi/ipmi_watchdog.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/char/ipmi/ipmi_watchdog.c 2007-10-18 09:09:20.660000000 +0900 @@ -1055,12 +1055,19 @@ static int wdog_panic_handler(struct not return NOTIFY_OK; } -static struct notifier_block wdog_panic_notifier = { +static struct notifier_block wdog_panic_notifier_base = { .notifier_call = wdog_panic_handler, .next = NULL, .priority = 150 /* priority: INT_MAX >= x >= 0 */ }; +static struct tunable_atomic_notifier_block wdog_panic_notifier = { + .nb = &wdog_panic_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; static void ipmi_new_smi(int if_num, struct device *device) { @@ -1212,8 +1219,8 @@ static int __init ipmi_wdog_init(void) check_parms(); register_reboot_notifier(&wdog_reboot_notifier); - atomic_notifier_chain_register(&panic_notifier_list, - &wdog_panic_notifier); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &wdog_panic_notifier, "ipmi_wdog", NULL); rv = ipmi_smi_watcher_register(&smi_watcher); if (rv) { @@ -1221,8 +1228,8 @@ static int __init ipmi_wdog_init(void) if (preaction_val == WDOG_PRETIMEOUT_NMI) release_nmi(&ipmi_nmi_handler); #endif - atomic_notifier_chain_unregister(&panic_notifier_list, - &wdog_panic_notifier); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &wdog_panic_notifier); unregister_reboot_notifier(&wdog_reboot_notifier); printk(KERN_WARNING PFX "can't register smi watcher\n"); return rv; @@ -1243,8 +1250,8 @@ static void __exit ipmi_wdog_exit(void) release_nmi(&ipmi_nmi_handler); #endif - atomic_notifier_chain_unregister(&panic_notifier_list, - &wdog_panic_notifier); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &wdog_panic_notifier); unregister_reboot_notifier(&wdog_reboot_notifier); } module_exit(ipmi_wdog_exit); diff -uprN linux-2.6.23.orig/drivers/lguest/lguest.c linux-2.6.23/drivers/lguest/lguest.c --- linux-2.6.23.orig/drivers/lguest/lguest.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/lguest/lguest.c 2007-10-18 08:56:54.212000000 +0900 @@ -880,16 +880,25 @@ static int lguest_panic(struct notifier_ return NOTIFY_DONE; } -static struct notifier_block paniced = { +static struct notifier_block paniced_base = { .notifier_call = lguest_panic }; +static struct tunable_atomic_notifier_block paniced = { + .nb = &paniced_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + /* Setting up memory is fairly easy. */ static __init char *lguest_memory_setup(void) { /* We do this here and not earlier because lockcheck barfs if we do it * before start_kernel() */ - atomic_notifier_chain_register(&panic_notifier_list, &paniced); + tunable_atomic_notifier_chain_register(&panic_notifier_list, &paniced, + "lguest", NULL); /* The Linux bootloader header contains an "e820" memory map: the * Launcher populated the first entry with our memory limit. */ diff -uprN linux-2.6.23.orig/drivers/misc/ibmasm/heartbeat.c linux-2.6.23/drivers/misc/ibmasm/heartbeat.c --- linux-2.6.23.orig/drivers/misc/ibmasm/heartbeat.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/misc/ibmasm/heartbeat.c 2007-10-18 09:11:07.696000000 +0900 @@ -48,17 +48,21 @@ static int panic_happened(struct notifie return 0; } -static struct notifier_block panic_notifier = { panic_happened, NULL, 1 }; +static struct notifier_block panic_notifier_base = { panic_happened, NULL, 1 }; + +static struct tunable_atomic_notifier_block panic_notifier = { &panic_notifier_base, + NULL, NULL, NULL, NULL}; void ibmasm_register_panic_notifier(void) { - atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_notifier, "ibmasm", NULL); } void ibmasm_unregister_panic_notifier(void) { - atomic_notifier_chain_unregister(&panic_notifier_list, - &panic_notifier); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &panic_notifier); } diff -uprN linux-2.6.23.orig/drivers/parisc/power.c linux-2.6.23/drivers/parisc/power.c --- linux-2.6.23.orig/drivers/parisc/power.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/parisc/power.c 2007-10-18 09:11:36.880000000 +0900 @@ -189,11 +189,18 @@ static int parisc_panic_event(struct not return NOTIFY_DONE; } -static struct notifier_block parisc_panic_block = { +static struct notifier_block parisc_panic_block_base = { .notifier_call = parisc_panic_event, .priority = INT_MAX, }; +static struct tunable_atomic_notifier_block parisc_panic_block = { + .nb = &parisc_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; static int __init power_init(void) { @@ -231,8 +238,8 @@ static int __init power_init(void) } /* Register a call for panic conditions. */ - atomic_notifier_chain_register(&panic_notifier_list, - &parisc_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &parisc_panic_block, "parisc_panic", NULL); return 0; } @@ -241,8 +248,8 @@ static void __exit power_exit(void) { kthread_stop(power_task); - atomic_notifier_chain_unregister(&panic_notifier_list, - &parisc_panic_block); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &parisc_panic_block); pdc_soft_power_button(0); } diff -uprN linux-2.6.23.orig/include/linux/kernel.h linux-2.6.23/include/linux/kernel.h --- linux-2.6.23.orig/include/linux/kernel.h 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/include/linux/kernel.h 2007-10-18 08:56:54.216000000 +0900 @@ -104,7 +104,7 @@ extern int cond_resched(void); (__x < 0) ? -__x : __x; \ }) -extern struct atomic_notifier_head panic_notifier_list; +extern struct tunable_atomic_notifier_head panic_notifier_list; extern long (*panic_blink)(long time); NORET_TYPE void panic(const char * fmt, ...) __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; diff -uprN linux-2.6.23.orig/kernel/panic.c linux-2.6.23/kernel/panic.c --- linux-2.6.23.orig/kernel/panic.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/kernel/panic.c 2007-10-18 09:12:28.188000000 +0900 @@ -28,7 +28,7 @@ static DEFINE_SPINLOCK(pause_on_oops_loc int panic_timeout; -ATOMIC_NOTIFIER_HEAD(panic_notifier_list); +TUNABLE_ATOMIC_NOTIFIER_HEAD(panic_notifier_list, "panic_notifier_list"); EXPORT_SYMBOL(panic_notifier_list); @@ -96,7 +96,7 @@ NORET_TYPE void panic(const char * fmt, smp_send_stop(); #endif - atomic_notifier_call_chain(&panic_notifier_list, 0, buf); + tunable_atomic_notifier_call_chain(&panic_notifier_list, 0, buf); if (!panic_blink) panic_blink = no_blink; diff -uprN linux-2.6.23.orig/kernel/softlockup.c linux-2.6.23/kernel/softlockup.c --- linux-2.6.23.orig/kernel/softlockup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/kernel/softlockup.c 2007-10-18 09:13:09.260000000 +0900 @@ -31,10 +31,18 @@ softlock_panic(struct notifier_block *th return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = softlock_panic, }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + /* * Returns seconds, approximately. We don't need nanosecond * resolution, and we don't need to waste time with a big divide when @@ -193,5 +201,6 @@ __init void spawn_softlockup_task(void) cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); register_cpu_notifier(&cpu_nfb); - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "softlockup", NULL); } --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 18 01:55:27 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 18 Oct 2007 01:55:34 -0700 (PDT) Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.193]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9I8tPcL019653 for ; Thu, 18 Oct 2007 01:55:27 -0700 Received: from mailgate3.nec.co.jp (mailgate54.nec.co.jp [10.7.69.195]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9I8r3Cl014093; Thu, 18 Oct 2007 17:53:03 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9I8r3P16619; Thu, 18 Oct 2007 17:53:03 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv5.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l9I8r2v09441; Thu, 18 Oct 2007 17:53:02 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 6BFE3E48263; Thu, 18 Oct 2007 17:53:02 +0900 (JST) Message-ID: <47171EEC.4030408@ah.jp.nec.com> Date: Thu, 18 Oct 2007 17:53:00 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: [PATCH 1/2] add tunable_notifier function ,take2 References: <4716FFDB.7090502@ah.jp.nec.com> In-Reply-To: <4716FFDB.7090502@ah.jp.nec.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1260 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb This patch adds new notifier function tunable_notifier_chain. Its base is atomic_notifier_chain. Thanks, --- Signed-off-by: Takenori Nagano --- diff -uprN linux-2.6.23.orig/include/linux/notifier.h linux-2.6.23/include/linux/notifier.h --- linux-2.6.23.orig/include/linux/notifier.h 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/include/linux/notifier.h 2007-10-18 09:59:13.732000000 +0900 @@ -13,6 +13,7 @@ #include #include #include +#include /* * Notifier chains are of four types: @@ -53,6 +54,14 @@ struct notifier_block { int priority; }; +struct tunable_atomic_notifier_block { + struct notifier_block *nb; + struct tunable_atomic_notifier_head *head; + struct dentry *dir; + struct dentry *pri_dentry; + struct dentry *desc_dentry; +}; + struct atomic_notifier_head { spinlock_t lock; struct notifier_block *head; @@ -63,6 +72,13 @@ struct blocking_notifier_head { struct notifier_block *head; }; +struct tunable_atomic_notifier_head { + spinlock_t lock; + struct notifier_block *head; + char *name; + struct dentry *dir; +}; + struct raw_notifier_head { struct notifier_block *head; }; @@ -81,6 +97,12 @@ struct srcu_notifier_head { init_rwsem(&(name)->rwsem); \ (name)->head = NULL; \ } while (0) +#define TUNABLE_ATOMIC_INIT_NOTIFIER(val1, val2) do { \ + spin_lock_init(&(val1)->lock); \ + (val1)->head = NULL; \ + (val1)->name = val2; \ + (val1)->dir = NULL; \ + } while (0) #define RAW_INIT_NOTIFIER_HEAD(name) do { \ (name)->head = NULL; \ } while (0) @@ -96,6 +118,11 @@ extern void srcu_init_notifier_head(stru #define BLOCKING_NOTIFIER_INIT(name) { \ .rwsem = __RWSEM_INITIALIZER((name).rwsem), \ .head = NULL } +#define TUNABLE_ATOMIC_NOTIFIER_INIT(val1, val2) { \ + .lock =__SPIN_LOCK_UNLOCKED(val1.lock), \ + .head = NULL, \ + .name = val2, \ + .dir = NULL } #define RAW_NOTIFIER_INIT(name) { \ .head = NULL } /* srcu_notifier_heads cannot be initialized statically */ @@ -106,6 +133,9 @@ extern void srcu_init_notifier_head(stru #define BLOCKING_NOTIFIER_HEAD(name) \ struct blocking_notifier_head name = \ BLOCKING_NOTIFIER_INIT(name) +#define TUNABLE_ATOMIC_NOTIFIER_HEAD(name, val) \ + struct tunable_atomic_notifier_head name = \ + TUNABLE_ATOMIC_NOTIFIER_INIT(name, val) #define RAW_NOTIFIER_HEAD(name) \ struct raw_notifier_head name = \ RAW_NOTIFIER_INIT(name) @@ -116,6 +146,10 @@ extern int atomic_notifier_chain_registe struct notifier_block *nb); extern int blocking_notifier_chain_register(struct blocking_notifier_head *nh, struct notifier_block *nb); +extern int tunable_atomic_notifier_chain_register( + struct tunable_atomic_notifier_head *nh, + struct tunable_atomic_notifier_block *nb, + char *name, char *desc); extern int raw_notifier_chain_register(struct raw_notifier_head *nh, struct notifier_block *nb); extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh, @@ -125,6 +159,9 @@ extern int atomic_notifier_chain_unregis struct notifier_block *nb); extern int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, struct notifier_block *nb); +extern int tunable_atomic_notifier_chain_unregister( + struct tunable_atomic_notifier_head *nh, + struct tunable_atomic_notifier_block *nb); extern int raw_notifier_chain_unregister(struct raw_notifier_head *nh, struct notifier_block *nb); extern int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh, @@ -138,6 +175,13 @@ extern int blocking_notifier_call_chain( unsigned long val, void *v); extern int __blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls); +extern int tunable_atomic_notifier_call_chain( + struct tunable_atomic_notifier_head *nh, + unsigned long val, void *v); +extern int __tunable_atomic_notifier_call_chain( + struct tunable_atomic_notifier_head *nh, + unsigned long val, void *v, + int nr_to_call, int *nr_calls); extern int raw_notifier_call_chain(struct raw_notifier_head *nh, unsigned long val, void *v); extern int __raw_notifier_call_chain(struct raw_notifier_head *nh, diff -uprN linux-2.6.23.orig/kernel/sys.c linux-2.6.23/kernel/sys.c --- linux-2.6.23.orig/kernel/sys.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/kernel/sys.c 2007-10-18 10:08:52.728000000 +0900 @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -393,6 +394,243 @@ int blocking_notifier_call_chain(struct EXPORT_SYMBOL_GPL(blocking_notifier_call_chain); /* + * Tunable atomic notifier chain routines. Registration and unregistration + * use a spinlock, and call_chain is synchronized by RCU (no locks). + * User can change the list order to use /sys/kernel/debug/list-name/. + */ + +static ssize_t priority_read(struct file *file, + char __user *user_buf, size_t count, loff_t *ppos) +{ + struct tunable_atomic_notifier_block *n = + file->f_dentry->d_inode->i_private; + int priority = n->nb->priority; + char buf[64], *s; + + s = buf; + s += sprintf(s, "%d\n", priority); + + return simple_read_from_buffer((void __user *)user_buf, count, + ppos, buf, s - buf); +} + +static ssize_t priority_write(struct file *file, + const char __user *user_buf, size_t count, loff_t *ppos) +{ + struct tunable_atomic_notifier_block *n = + file->f_dentry->d_inode->i_private; + struct tunable_atomic_notifier_head *nh = n->head; + char *buf, *end; + int ret = -ENOMEM, priority; + unsigned long tmp, flags; + + buf = kmalloc(count + 1, GFP_KERNEL); + if (!buf) + goto out; + + buf[count] = 0; + ret = -EFAULT; + if (copy_from_user(buf, user_buf, count)) + goto out_free; + + ret = -EINVAL; + tmp = simple_strtoul(buf, &end, 10); + if ((end == buf) || (tmp > INT_MAX)) + goto out_free; + + priority = (int)tmp; + n->nb->priority = priority; + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_unregister(&nh->head, n->nb); + if (ret) + goto out_unlock; + ret = notifier_chain_register(&nh->head, n->nb); + if (!ret) + ret = count; + +out_unlock: + spin_unlock_irqrestore(&nh->lock, flags); +out_free: + kfree(buf); +out: + return ret; + +} + +static const struct file_operations pri_fops = { + .read = priority_read, + .write = priority_write, +}; + +static ssize_t description_read(struct file *file, + char __user *user_buf, size_t count, loff_t *ppos) +{ + char *desc = file->f_dentry->d_inode->i_private; + int avail = strlen(desc); + + return simple_read_from_buffer(user_buf, count, ppos, desc, avail); +} + +static const struct file_operations desc_fops = { + .read = description_read, +}; + +/** + * tunable_atomic_notifier_chain_register + * - Add notifier to an tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @n: New entry in notifier chain + * @name: Pointer to the name of the new notifier entry + * @desc: Pointer to the description of new entry + * + * Adds a notifier to an tunable notifier chain and makes control dir. + * + * Returns zero on success or %-ENODEV on failure. + */ + +int tunable_atomic_notifier_chain_register( + struct tunable_atomic_notifier_head *nh, + struct tunable_atomic_notifier_block *n, char *name, char *desc) +{ + unsigned long flags; + int ret = -EINVAL; + struct dentry *nh_dir, *nb_dir, *pri_dentry, *desc_dentry = NULL; + + if (!name) + goto nb_fail; + + ret = -ENOMEM; + if (!nh->dir) { + nh_dir = debugfs_create_dir(nh->name, NULL); + if (!nh_dir) + return ret; + nh->dir = nh_dir; + } else + nh_dir = nh->dir; + + nb_dir = debugfs_create_dir(name, nh_dir); + if (!nb_dir) + goto nb_fail; + n->dir = nb_dir; + + pri_dentry = debugfs_create_file("priority",0600, nb_dir, n, &pri_fops); + if (!pri_dentry) + goto pri_fail; + n->pri_dentry = pri_dentry; + + if (desc) { + desc_dentry = debugfs_create_file("description", 0400, nb_dir, + desc, &desc_fops); + if (!desc_dentry) + goto desc_fail; + n->desc_dentry = desc_dentry; + } + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_register(&nh->head, n->nb); + spin_unlock_irqrestore(&nh->lock, flags); + + if (ret) + goto reg_fail; + + n->head = nh; + + return ret; + +reg_fail: + debugfs_remove(desc_dentry); +desc_fail: + debugfs_remove(pri_dentry); +pri_fail: + debugfs_remove(nb_dir); +nb_fail: + return ret; +} + +EXPORT_SYMBOL_GPL(tunable_atomic_notifier_chain_register); + +/** + * tunable_atomic_notifier_chain_unregister + * - Remove notifier from a tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @n: Entry to remove from notifier chain + * + * Removes a notifier from a tunable notifier chain. + * + * Retunrns zero on success or %-ENOENT on failure. + */ + +int tunable_atomic_notifier_chain_unregister( + struct tunable_atomic_notifier_head *nh, + struct tunable_atomic_notifier_block *n) +{ + unsigned long flags; + int ret; + + spin_lock_irqsave(&nh->lock, flags); + ret = notifier_chain_unregister(&nh->head, n->nb); + spin_unlock_irqrestore(&nh->lock, flags); + synchronize_rcu(); + + if (ret) + return ret; + + debugfs_remove(n->desc_dentry); + debugfs_remove(n->pri_dentry); + debugfs_remove(n->dir); + + return 0; +} + +EXPORT_SYMBOL_GPL(tunable_atomic_notifier_chain_unregister); + +/** + * __tunable_atomic_notifier_call_chain + * - Call functions in a tunable notifier chain + * @nh: Pointer to head of the tunable notifier chain + * @val: Value passed unmodified to notifier function + * @v: Pointer passed unmodified to notifier function + * @nt_to_call: See the comment for notifier_call_chain + * @nr_calls: See the comment for notifier_call_chain + * + * Calls each function in a notifier chain in turn. The functions + * run in an atomic context, so they must not block. + * This routine uses RCU to synchronize with changes to the chain. + * + * If the return value of the notifier can be and'ed + * with %NOTIFY_STOP_MASK then tunable_atomic_notifier_call_chain() + * will return immediately, with the return value of + * the notifier function which halted execution. + * Otherwise the return value is the return value + * of the last notifier function called. + */ + +int __kprobes __tunable_atomic_notifier_call_chain( + struct tunable_atomic_notifier_head *nh, + unsigned long val, void *v, + int nr_to_call, int *nr_calls) +{ + int ret; + + rcu_read_lock(); + ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls); + rcu_read_unlock(); + return ret; +} + +EXPORT_SYMBOL_GPL(__tunable_atomic_notifier_call_chain); + +int __kprobes tunable_atomic_notifier_call_chain( + struct tunable_atomic_notifier_head *nh, + unsigned long val, void *v) +{ + return __tunable_atomic_notifier_call_chain(nh, val, v, -1, NULL); +} + +EXPORT_SYMBOL_GPL(tunable_atomic_notifier_call_chain); + +/* * Raw notifier chain routines. There is no protection; * the caller must provide it. Use at your own risk! */ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 18 01:55:20 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 18 Oct 2007 01:55:28 -0700 (PDT) Received: from tyo201.gate.nec.co.jp (TYO201.gate.nec.co.jp [202.32.8.193]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9I8tICK019634 for ; Thu, 18 Oct 2007 01:55:20 -0700 Received: from mailgate3.nec.co.jp (mailgate54.nec.co.jp [10.7.69.195]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9I8qiBe013612; Thu, 18 Oct 2007 17:52:44 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9I8qiN16202; Thu, 18 Oct 2007 17:52:44 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv3.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l9I8qhB29855; Thu, 18 Oct 2007 17:52:43 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id BAFAEE48263; Thu, 18 Oct 2007 17:52:43 +0900 (JST) Message-ID: <47171ED9.7010907@ah.jp.nec.com> Date: Thu, 18 Oct 2007 17:52:41 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Andrew Morton CC: vgoyal@in.ibm.com, linux-kernel@vger.kernel.org, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , kdb@oss.sgi.com Subject: Re: [PATCH 0/2] add new notifier function ,take2 References: <471700F4.1080200@ah.jp.nec.com> <20071018000651.35b26e42.akpm@linux-foundation.org> <20071018080621.GB8779@in.ibm.com> In-Reply-To: <20071018080621.GB8779@in.ibm.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1259 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Vivek Goyal wrote: > On Thu, Oct 18, 2007 at 12:06:51AM -0700, Andrew Morton wrote: >> On Thu, 18 Oct 2007 15:45:08 +0900 Takenori Nagano wrote: >> I can sort-of see what this is doing. Runtime-definable management of >> which notifier functions will be called on a panic? Or maybe I >> misunderstood. >> >> But even if I did understand, I don't understand why Linux needs this >> feature - what are the use cases, what is the value to our users? >> >> Can you please flesh that information out a bit more? >> > > Hi Andrew, > > Takenori wants to make kdb and kdump co-exist. Currently after panic() > panic_notifier_list is not executed if kdump is configured. Before list > is executed, system will boot into second kernel to capture the dump. Hence > if even if kdb was registered on panic_notifier_list, it will never get > a chance to run. Yes, it is true. But I don't mind only kdb and kdump co-exist. Keith Owen said, > > My stance is that _all_ the RAS tools (kdb, kgdb, nlkd, netdump, lkcd, > > crash, kdump etc.) should be using a common interface that safely puts > > the entire system in a stopped state and saves the state of each cpu. > > Then each tool can do what it likes, instead of every RAS tool doing > > its own thing and they all conflict with each other, which is why this > > thread started. > > > > It is not the kernel's job to decide which RAS tool runs first, second > > etc., it is the user's decision to set that policy. Different sites > > will want different orders, some will say "go straight to kdump", other > > sites will want to invoke a debugger first. Sites must be able to > > define that policy, but we hard code the policy into the kernel. I agreed with him and I made new notifier function that users can change the order. Priority value in notifier blocks are hardcoded. If users want to change list order, they have to rebuild kernel. I think it is very unhappy. This is our discussion. http://www.gossamer-threads.com/lists/linux/kernel/797220?do=post_view_threaded#797220 In addition, we can use new notifier function to reboot_notifier, die_chain if users want to use. >> The patches are somewhat wordwrapped - please check your email client >> configuration, thanks. Sorry, I'll resend. Thanks, Takenori --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 18 01:55:37 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 18 Oct 2007 01:55:47 -0700 (PDT) Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9I8tZ8r019676 for ; Thu, 18 Oct 2007 01:55:36 -0700 Received: from mailgate3.nec.co.jp (mailgate54.nec.co.jp [10.7.69.197]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9I8r6MK009734; Thu, 18 Oct 2007 17:53:06 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9I8r6b13938; Thu, 18 Oct 2007 17:53:06 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l9I8r5C01013; Thu, 18 Oct 2007 17:53:05 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id B58C5E48263; Thu, 18 Oct 2007 17:53:05 +0900 (JST) Message-ID: <47171EEF.7030109@ah.jp.nec.com> Date: Thu, 18 Oct 2007 17:53:03 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: linux-kernel@vger.kernel.org CC: vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: [PATCH 2/2] implement new notifier function to panic_notifier_list ,take2 References: <4716FFDB.7090502@ah.jp.nec.com> In-Reply-To: <4716FFDB.7090502@ah.jp.nec.com> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1261 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb This patch implements new notifier function to panic_notifier_list. We can change the list of order by debugfs. Thanks, --- Signed-off-by: Takenori Nagano --- diff -uprN linux-2.6.23.orig/arch/alpha/kernel/setup.c linux-2.6.23/arch/alpha/kernel/setup.c --- linux-2.6.23.orig/arch/alpha/kernel/setup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/alpha/kernel/setup.c 2007-10-18 08:56:53.928000000 +0900 @@ -45,14 +45,22 @@ #include #include -extern struct atomic_notifier_head panic_notifier_list; +extern struct tunable_atomic_notifier_head panic_notifier_list; static int alpha_panic_event(struct notifier_block *, unsigned long, void *); -static struct notifier_block alpha_panic_block = { +static struct notifier_block alpha_panic_block_base = { alpha_panic_event, NULL, INT_MAX /* try to do it first */ }; +static struct tunable_atomic_notifier_block alpha_panic_block = { + &alpha_panic_block_base, + NULL, + NULL, + NULL, + NULL +}; + #include #include #include @@ -522,8 +530,8 @@ setup_arch(char **cmdline_p) } /* Register a call for panic conditions. */ - atomic_notifier_chain_register(&panic_notifier_list, - &alpha_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &alpha_panic_block, "alpha_panic", NULL); #ifdef CONFIG_ALPHA_GENERIC /* Assume that we've booted from SRM if we haven't booted from MILO. diff -uprN linux-2.6.23.orig/arch/arm/mach-omap1/board-voiceblue.c linux-2.6.23/arch/arm/mach-omap1/board-voiceblue.c --- linux-2.6.23.orig/arch/arm/mach-omap1/board-voiceblue.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/arm/mach-omap1/board-voiceblue.c 2007-10-18 09:00:35.900000000 +0900 @@ -228,14 +228,23 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init voiceblue_setup(void) { /* Setup panic notifier */ - notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "VoiceBlue", NULL); return 0; } diff -uprN linux-2.6.23.orig/arch/mips/sgi-ip22/ip22-reset.c linux-2.6.23/arch/mips/sgi-ip22/ip22-reset.c --- linux-2.6.23.orig/arch/mips/sgi-ip22/ip22-reset.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/mips/sgi-ip22/ip22-reset.c 2007-10-18 09:01:33.408000000 +0900 @@ -226,10 +226,18 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init reboot_setup(void) { _machine_restart = sgi_machine_restart; @@ -239,7 +247,8 @@ static int __init reboot_setup(void) request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); init_timer(&blink_timer); blink_timer.function = blink_timeout; - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "sgi-ip22", NULL); return 0; } diff -uprN linux-2.6.23.orig/arch/mips/sgi-ip32/ip32-reset.c linux-2.6.23/arch/mips/sgi-ip32/ip32-reset.c --- linux-2.6.23.orig/arch/mips/sgi-ip32/ip32-reset.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/mips/sgi-ip32/ip32-reset.c 2007-10-18 09:02:20.496000000 +0900 @@ -175,10 +175,18 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static __init int ip32_reboot_setup(void) { /* turn on the green led only */ @@ -193,7 +201,8 @@ static __init int ip32_reboot_setup(void init_timer(&blink_timer); blink_timer.function = blink_timeout; - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "sgi-ip32", NULL); if (request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL)) panic("Can't allocate MACEISA RTC IRQ"); diff -uprN linux-2.6.23.orig/arch/parisc/kernel/pdc_chassis.c linux-2.6.23/arch/parisc/kernel/pdc_chassis.c --- linux-2.6.23.orig/arch/parisc/kernel/pdc_chassis.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/parisc/kernel/pdc_chassis.c 2007-10-18 08:56:54.052000000 +0900 @@ -101,11 +101,18 @@ static int pdc_chassis_panic_event(struc } -static struct notifier_block pdc_chassis_panic_block = { +static struct notifier_block pdc_chassis_panic_block_base = { .notifier_call = pdc_chassis_panic_event, .priority = INT_MAX, }; +static struct tunable_atomic_notifier_block pdc_chassis_panic_block = { + .nb = &pdc_chassis_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; /** * parisc_reboot_event() - Called by the reboot handler. @@ -144,8 +151,8 @@ void __init parisc_pdc_chassis_init(void PDC_CHASSIS_VER); /* initialize panic notifier chain */ - atomic_notifier_chain_register(&panic_notifier_list, - &pdc_chassis_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &pdc_chassis_panic_block, "pdc_chassis", NULL); /* initialize reboot notifier chain */ register_reboot_notifier(&pdc_chassis_reboot_block); diff -uprN linux-2.6.23.orig/arch/powerpc/kernel/setup-common.c linux-2.6.23/arch/powerpc/kernel/setup-common.c --- linux-2.6.23.orig/arch/powerpc/kernel/setup-common.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/powerpc/kernel/setup-common.c 2007-10-18 09:03:40.968000000 +0900 @@ -534,14 +534,23 @@ static int ppc_panic_event(struct notifi return NOTIFY_DONE; } -static struct notifier_block ppc_panic_block = { +static struct notifier_block ppc_panic_block_base = { .notifier_call = ppc_panic_event, .priority = INT_MIN /* may not return; must be done last */ }; +static struct tunable_atomic_notifier_block ppc_panic_block = { + .nb = &ppc_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init setup_panic(void) { - atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &ppc_panic_block, "powerpc", NULL); } #ifdef CONFIG_CHECK_CACHE_COHERENCY diff -uprN linux-2.6.23.orig/arch/ppc/platforms/prep_setup.c linux-2.6.23/arch/ppc/platforms/prep_setup.c --- linux-2.6.23.orig/arch/ppc/platforms/prep_setup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/ppc/platforms/prep_setup.c 2007-10-18 09:04:56.352000000 +0900 @@ -712,12 +712,20 @@ ibm_statusled_panic(struct notifier_bloc return NOTIFY_DONE; } -static struct notifier_block ibm_statusled_block = { +static struct notifier_block ibm_statusled_block_base = { ibm_statusled_panic, NULL, INT_MAX /* try to do it first */ }; +static struct tunable_atomic_notifier_block ibm_statusled_block = { + &ibm_statusled_block_base, + NULL, + NULL, + NULL, + NULL +}; + static void ibm_statusled_progress(char *s, unsigned short hex) { @@ -732,8 +740,9 @@ ibm_statusled_progress(char *s, unsigned hex = 0xfff; if (!notifier_installed) { ++notifier_installed; - atomic_notifier_chain_register(&panic_notifier_list, - &ibm_statusled_block); + tunable_atomic_notifier_chain_register( + &panic_notifier_list, &ibm_statusled_block, + "IBM_statusLED", NULL); } } else diff -uprN linux-2.6.23.orig/arch/s390/kernel/ipl.c linux-2.6.23/arch/s390/kernel/ipl.c --- linux-2.6.23.orig/arch/s390/kernel/ipl.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/s390/kernel/ipl.c 2007-10-18 08:56:54.132000000 +0900 @@ -1036,11 +1036,19 @@ static int shutdown_on_panic_notify(stru return NOTIFY_OK; } -static struct notifier_block shutdown_on_panic_nb = { +static struct notifier_block shutdown_on_panic_nb_base = { .notifier_call = shutdown_on_panic_notify, .priority = SHUTDOWN_ON_PANIC_PRIO }; +static struct tunable_atomic_notifier_block shutdown_on_panic_nb = { + .nb = &shutdown_on_panic_nb_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init dump_init(void) { int rc; @@ -1075,8 +1083,8 @@ static int __init shutdown_actions_init( firmware_unregister(&shutdown_actions_subsys); return rc; } - atomic_notifier_chain_register(&panic_notifier_list, - &shutdown_on_panic_nb); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &shutdown_on_panic_nb, "s390_ipl", NULL); return 0; } diff -uprN linux-2.6.23.orig/arch/s390/kernel/setup.c linux-2.6.23/arch/s390/kernel/setup.c --- linux-2.6.23.orig/arch/s390/kernel/setup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/s390/kernel/setup.c 2007-10-18 08:56:54.144000000 +0900 @@ -173,11 +173,19 @@ static int vmpanic_notify(struct notifie #define PANIC_PRI_VMPANIC 0 -static struct notifier_block vmpanic_nb = { +static struct notifier_block vmpanic_nb_base = { .notifier_call = vmpanic_notify, .priority = PANIC_PRI_VMPANIC }; +static struct tunable_atomic_notifier_block vmpanic_nb = { + .nb = &vmpanic_nb_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int __init vmpanic_setup(char *str) { static int register_done __initdata = 0; @@ -186,8 +194,8 @@ static int __init vmpanic_setup(char *st vmpanic_cmd[127] = 0; if (!register_done) { register_done = 1; - atomic_notifier_chain_register(&panic_notifier_list, - &vmpanic_nb); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &vmpanic_nb, "s390_panic", NULL); } return 1; } diff -uprN linux-2.6.23.orig/arch/sparc64/kernel/sstate.c linux-2.6.23/arch/sparc64/kernel/sstate.c --- linux-2.6.23.orig/arch/sparc64/kernel/sstate.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/sparc64/kernel/sstate.c 2007-10-18 09:05:46.620000000 +0900 @@ -82,11 +82,19 @@ static int sstate_panic_event(struct not return NOTIFY_DONE; } -static struct notifier_block sstate_panic_block = { +static struct notifier_block sstate_panic_block_base = { .notifier_call = sstate_panic_event, .priority = INT_MAX, }; +static struct tunable_atomic_notifier_block sstate_panic_block = { + .nb = &sstate_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init sun4v_sstate_init(void) { unsigned long major, minor; @@ -99,6 +107,6 @@ void __init sun4v_sstate_init(void) hv_supports_soft_state = 1; prom_sun4v_guest_soft_state(); - atomic_notifier_chain_register(&panic_notifier_list, - &sstate_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &sstate_panic_block, "sstate" ,NULL); } diff -uprN linux-2.6.23.orig/arch/um/drivers/mconsole_kern.c linux-2.6.23/arch/um/drivers/mconsole_kern.c --- linux-2.6.23.orig/arch/um/drivers/mconsole_kern.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/um/drivers/mconsole_kern.c 2007-10-18 09:06:25.144000000 +0900 @@ -928,16 +928,24 @@ static int notify_panic(struct notifier_ return(0); } -static struct notifier_block panic_exit_notifier = { +static struct notifier_block panic_exit_notifier_base = { .notifier_call = notify_panic, .next = NULL, .priority = 1 }; +static struct tunable_atomic_notifier_block panic_exit_notifier = { + .nb = &panic_exit_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int add_notifier(void) { - atomic_notifier_chain_register(&panic_notifier_list, - &panic_exit_notifier); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_exit_notifier, "mconsole", NULL); return(0); } diff -uprN linux-2.6.23.orig/arch/um/kernel/um_arch.c linux-2.6.23/arch/um/kernel/um_arch.c --- linux-2.6.23.orig/arch/um/kernel/um_arch.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/um/kernel/um_arch.c 2007-10-18 09:06:45.360000000 +0900 @@ -478,16 +478,24 @@ static int panic_exit(struct notifier_bl return 0; } -static struct notifier_block panic_exit_notifier = { +static struct notifier_block panic_exit_notifier_base = { .notifier_call = panic_exit, .next = NULL, .priority = 0 }; +static struct tunable_atomic_notifier_block panic_exit_notifier = { + .nb = &panic_exit_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + void __init setup_arch(char **cmdline_p) { - atomic_notifier_chain_register(&panic_notifier_list, - &panic_exit_notifier); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_exit_notifier, "um", NULL); paging_init(); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; diff -uprN linux-2.6.23.orig/arch/xtensa/platform-iss/setup.c linux-2.6.23/arch/xtensa/platform-iss/setup.c --- linux-2.6.23.orig/arch/xtensa/platform-iss/setup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/arch/xtensa/platform-iss/setup.c 2007-10-18 09:07:25.468000000 +0900 @@ -98,13 +98,22 @@ iss_panic_event(struct notifier_block *t return NOTIFY_DONE; } -static struct notifier_block iss_panic_block = { +static struct notifier_block iss_panic_block_base = { iss_panic_event, NULL, 0 }; +static struct tunable_atomic_notifier_block iss_panic_block = { + &iss_panic_block_base, + NULL, + NULL, + NULL, + NULL +}; + void __init platform_setup(char **p_cmdline) { - atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &iss_panic_block, "iss_panic", NULL); } diff -uprN linux-2.6.23.orig/drivers/char/ipmi/ipmi_msghandler.c linux-2.6.23/drivers/char/ipmi/ipmi_msghandler.c --- linux-2.6.23.orig/drivers/char/ipmi/ipmi_msghandler.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/char/ipmi/ipmi_msghandler.c 2007-10-18 09:08:31.012000000 +0900 @@ -4070,12 +4070,20 @@ static int panic_event(struct notifier_b return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = panic_event, .next = NULL, .priority = 200 /* priority: INT_MAX >= x >= 0 */ }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + static int ipmi_init_msghandler(void) { int rv; @@ -4105,7 +4113,8 @@ static int ipmi_init_msghandler(void) setup_timer(&ipmi_timer, ipmi_timeout, 0); mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "ipmi_msghandler", NULL); initialized = 1; @@ -4125,7 +4134,8 @@ static __exit void cleanup_ipmi(void) if (!initialized) return; - atomic_notifier_chain_unregister(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &panic_block); /* This can't be called if any interfaces exist, so no worry about shutting down the interfaces. */ diff -uprN linux-2.6.23.orig/drivers/char/ipmi/ipmi_watchdog.c linux-2.6.23/drivers/char/ipmi/ipmi_watchdog.c --- linux-2.6.23.orig/drivers/char/ipmi/ipmi_watchdog.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/char/ipmi/ipmi_watchdog.c 2007-10-18 09:09:20.660000000 +0900 @@ -1055,12 +1055,19 @@ static int wdog_panic_handler(struct not return NOTIFY_OK; } -static struct notifier_block wdog_panic_notifier = { +static struct notifier_block wdog_panic_notifier_base = { .notifier_call = wdog_panic_handler, .next = NULL, .priority = 150 /* priority: INT_MAX >= x >= 0 */ }; +static struct tunable_atomic_notifier_block wdog_panic_notifier = { + .nb = &wdog_panic_notifier_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; static void ipmi_new_smi(int if_num, struct device *device) { @@ -1212,8 +1219,8 @@ static int __init ipmi_wdog_init(void) check_parms(); register_reboot_notifier(&wdog_reboot_notifier); - atomic_notifier_chain_register(&panic_notifier_list, - &wdog_panic_notifier); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &wdog_panic_notifier, "ipmi_wdog", NULL); rv = ipmi_smi_watcher_register(&smi_watcher); if (rv) { @@ -1221,8 +1228,8 @@ static int __init ipmi_wdog_init(void) if (preaction_val == WDOG_PRETIMEOUT_NMI) release_nmi(&ipmi_nmi_handler); #endif - atomic_notifier_chain_unregister(&panic_notifier_list, - &wdog_panic_notifier); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &wdog_panic_notifier); unregister_reboot_notifier(&wdog_reboot_notifier); printk(KERN_WARNING PFX "can't register smi watcher\n"); return rv; @@ -1243,8 +1250,8 @@ static void __exit ipmi_wdog_exit(void) release_nmi(&ipmi_nmi_handler); #endif - atomic_notifier_chain_unregister(&panic_notifier_list, - &wdog_panic_notifier); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &wdog_panic_notifier); unregister_reboot_notifier(&wdog_reboot_notifier); } module_exit(ipmi_wdog_exit); diff -uprN linux-2.6.23.orig/drivers/lguest/lguest.c linux-2.6.23/drivers/lguest/lguest.c --- linux-2.6.23.orig/drivers/lguest/lguest.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/lguest/lguest.c 2007-10-18 08:56:54.212000000 +0900 @@ -880,16 +880,25 @@ static int lguest_panic(struct notifier_ return NOTIFY_DONE; } -static struct notifier_block paniced = { +static struct notifier_block paniced_base = { .notifier_call = lguest_panic }; +static struct tunable_atomic_notifier_block paniced = { + .nb = &paniced_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + /* Setting up memory is fairly easy. */ static __init char *lguest_memory_setup(void) { /* We do this here and not earlier because lockcheck barfs if we do it * before start_kernel() */ - atomic_notifier_chain_register(&panic_notifier_list, &paniced); + tunable_atomic_notifier_chain_register(&panic_notifier_list, &paniced, + "lguest", NULL); /* The Linux bootloader header contains an "e820" memory map: the * Launcher populated the first entry with our memory limit. */ diff -uprN linux-2.6.23.orig/drivers/misc/ibmasm/heartbeat.c linux-2.6.23/drivers/misc/ibmasm/heartbeat.c --- linux-2.6.23.orig/drivers/misc/ibmasm/heartbeat.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/misc/ibmasm/heartbeat.c 2007-10-18 09:11:07.696000000 +0900 @@ -48,17 +48,21 @@ static int panic_happened(struct notifie return 0; } -static struct notifier_block panic_notifier = { panic_happened, NULL, 1 }; +static struct notifier_block panic_notifier_base = { panic_happened, NULL, 1 }; + +static struct tunable_atomic_notifier_block panic_notifier = { &panic_notifier_base, + NULL, NULL, NULL, NULL}; void ibmasm_register_panic_notifier(void) { - atomic_notifier_chain_register(&panic_notifier_list, &panic_notifier); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_notifier, "ibmasm", NULL); } void ibmasm_unregister_panic_notifier(void) { - atomic_notifier_chain_unregister(&panic_notifier_list, - &panic_notifier); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &panic_notifier); } diff -uprN linux-2.6.23.orig/drivers/parisc/power.c linux-2.6.23/drivers/parisc/power.c --- linux-2.6.23.orig/drivers/parisc/power.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/drivers/parisc/power.c 2007-10-18 09:11:36.880000000 +0900 @@ -189,11 +189,18 @@ static int parisc_panic_event(struct not return NOTIFY_DONE; } -static struct notifier_block parisc_panic_block = { +static struct notifier_block parisc_panic_block_base = { .notifier_call = parisc_panic_event, .priority = INT_MAX, }; +static struct tunable_atomic_notifier_block parisc_panic_block = { + .nb = &parisc_panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; static int __init power_init(void) { @@ -231,8 +238,8 @@ static int __init power_init(void) } /* Register a call for panic conditions. */ - atomic_notifier_chain_register(&panic_notifier_list, - &parisc_panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &parisc_panic_block, "parisc_panic", NULL); return 0; } @@ -241,8 +248,8 @@ static void __exit power_exit(void) { kthread_stop(power_task); - atomic_notifier_chain_unregister(&panic_notifier_list, - &parisc_panic_block); + tunable_atomic_notifier_chain_unregister(&panic_notifier_list, + &parisc_panic_block); pdc_soft_power_button(0); } diff -uprN linux-2.6.23.orig/include/linux/kernel.h linux-2.6.23/include/linux/kernel.h --- linux-2.6.23.orig/include/linux/kernel.h 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/include/linux/kernel.h 2007-10-18 08:56:54.216000000 +0900 @@ -104,7 +104,7 @@ extern int cond_resched(void); (__x < 0) ? -__x : __x; \ }) -extern struct atomic_notifier_head panic_notifier_list; +extern struct tunable_atomic_notifier_head panic_notifier_list; extern long (*panic_blink)(long time); NORET_TYPE void panic(const char * fmt, ...) __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; diff -uprN linux-2.6.23.orig/kernel/panic.c linux-2.6.23/kernel/panic.c --- linux-2.6.23.orig/kernel/panic.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/kernel/panic.c 2007-10-18 09:12:28.188000000 +0900 @@ -28,7 +28,7 @@ static DEFINE_SPINLOCK(pause_on_oops_loc int panic_timeout; -ATOMIC_NOTIFIER_HEAD(panic_notifier_list); +TUNABLE_ATOMIC_NOTIFIER_HEAD(panic_notifier_list, "panic_notifier_list"); EXPORT_SYMBOL(panic_notifier_list); @@ -96,7 +96,7 @@ NORET_TYPE void panic(const char * fmt, smp_send_stop(); #endif - atomic_notifier_call_chain(&panic_notifier_list, 0, buf); + tunable_atomic_notifier_call_chain(&panic_notifier_list, 0, buf); if (!panic_blink) panic_blink = no_blink; diff -uprN linux-2.6.23.orig/kernel/softlockup.c linux-2.6.23/kernel/softlockup.c --- linux-2.6.23.orig/kernel/softlockup.c 2007-10-10 05:31:38.000000000 +0900 +++ linux-2.6.23/kernel/softlockup.c 2007-10-18 09:13:09.260000000 +0900 @@ -31,10 +31,18 @@ softlock_panic(struct notifier_block *th return NOTIFY_DONE; } -static struct notifier_block panic_block = { +static struct notifier_block panic_block_base = { .notifier_call = softlock_panic, }; +static struct tunable_atomic_notifier_block panic_block = { + .nb = &panic_block_base, + .head = NULL, + .dir = NULL, + .pri_dentry = NULL, + .desc_dentry = NULL +}; + /* * Returns seconds, approximately. We don't need nanosecond * resolution, and we don't need to waste time with a big divide when @@ -193,5 +201,6 @@ __init void spawn_softlockup_task(void) cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); register_cpu_notifier(&cpu_nfb); - atomic_notifier_chain_register(&panic_notifier_list, &panic_block); + tunable_atomic_notifier_chain_register(&panic_notifier_list, + &panic_block, "softlockup", NULL); } --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From bounce@yaari.com Fri Oct 19 20:16:02 2007 Received: with ECARTIS (v1.0.0; list kdb); Fri, 19 Oct 2007 20:16:09 -0700 (PDT) Received: from mail.yaari.com (mail.yaari.com [74.53.250.162]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9K3G0Wb021939 for ; Fri, 19 Oct 2007 20:16:01 -0700 Received: from mail.yaari.com (localhost [127.0.0.1]) by mail.yaari.com (Postfix) with ESMTP id 38B7DDF3A59 for ; Fri, 19 Oct 2007 21:08:05 -0500 (CDT) Received: by mail.yaari.com (Postfix, from userid 0) id EF83FDF3A60; Fri, 19 Oct 2007 21:08:04 -0500 (CDT) To: kdb@oss.sgi.com Subject: Subhash is your Yaar! :) Date: Fri, 19 Oct 2007 21:08:04 -0500 From: Subhash Reply-to: admin@yaari.com Message-ID: X-Priority: 1 X-Mailer: PHPMailer [version 1.73] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 X-archive-position: 1262 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: subhashg@gmail.com Precedence: bulk X-list: kdb CjxodG1sPgo8aGVhZD4KPC9oZWFkPgo8Ym9keT4KPHRhYmxlIGFsaWduPSJjZW50ZXIiIHdpZHRoP SI1NTAiIGhlaWdodD0iMjQ2IgpiYWNrZ3JvdW5kPSJodHRwOi8veWFhcmkuY29tL3ktdmlyYWwv aW1nL2JveC1hbGwuanBnIj48dHI+PHRkPgogIDxkaXYgaWQ9ImNvbnRhaW5lciIKc3R5bGU9InRl eHQtYWxpZ246Y2VudGVyO2ZvbnQtZmFtaWx5OlZlcmRhbmEsQXJpYWw7Zm9udC13ZWlnaHQ6Ym9s ZDtmb250LXNpemU6MTFwdDsiPgogICAgPHRhYmxlIHdpZHRoPSI5NyUiIGhlaWdodD0iOTAlIiBh bGlnbj0iY2VudGVyIiBzdHlsZT0ibWFyZ2luLXRvcDoxMHB4OyI+CiAgICAgIDx0ciB2YWxpZ249 Im1pZGRsZSI+CiAgICAgICAgPHRkIHdpZHRoPSIyMCUiPgogICAgICAgICAgPGltZyBzcmM9Imh0 dHA6Ly93d3cueWFhcmkuY29tL3VzZXJfMTAwcHhwaWMvbm9faW1nX2JpZy5qcGciCnN0eWxlPSJk aXNwbGF5OmJsb2NrO21hcmdpbjphdXRvO21hcmdpbi1ib3R0b206MTBweDtib3JkZXI6bm9uZTsi IC8+CiAgICAgICAgICA8ZGl2IHN0eWxlPSJmb250LXNpemU6OXB0O3RleHQtYWxpZ246Y2VudGVy OyI+U3ViaGFzaDwvZGl2PgogICAgICAgICAgPGRpdiBzdHlsZT0iZm9udC1zaXplOjlwdDtjb2xv cjojQjAwO3RleHQtYWxpZ246Y2VudGVyOyI+Q3VwZXJ0aW5vPC9kaXY+CiAgICAgICAgPC90ZD4K ICAgICAgICA8dGQ+CiAgICAgICAgICA8ZGl2IHN0eWxlPSJ0ZXh0LWFsaWduOmNlbnRlcjsiPlN1 Ymhhc2ggR29waW5hdGggd2FudHMgeW91IHRvIGpvaW4gWWFhcmkhPC9kaXY+CiAgICAgICAgICA8 ZGl2CnN0eWxlPSJmb250LXNpemU6MTNwdDttYXJnaW4tdG9wOjM1cHg7bWFyZ2luLWJvdHRvbTox MHB4O3RleHQtYWxpZ246Y2VudGVyO2ZvbnQtd2VpZ2h0OmJvbGQ7Ij5JcwpTdWJoYXNoIHlvdXIg ZnJpZW5kPzwvZGl2PgogICAgICAgICAgPGRpdiBhbGlnbj0iY2VudGVyIiBzdHlsZT0ibWFyZ2lu OjI1cHg7dGV4dC1hbGlnbjpjZW50ZXI7Ij4KICAgICAgICAgICAgPGEgaHJlZj0iaHR0cDovL3d3 dy55YWFyaS5jb20veS1yZWdpc3Rlci5waHA/aT02NkVPTkI2NlBXNDRNREREMTE5MTMwMDI4MCI+ CiAgICAgICAgICAgICAgPGltZyBzcmM9Imh0dHA6Ly95YWFyaS5jb20veS12aXJhbC9pbWcvYnV0 dG9uLXllcy5naWYiIGFsdD0iWWVzIgpzdHlsZT0iYm9yZGVyOm5vbmU7bWFyZ2luOjAgNXB4OyIv PjwvYT4KICAgICAgICAgICAgPGEgaHJlZj0iaHR0cDovL3d3dy55YWFyaS5jb20veS1yZWdpc3Rl ci5waHAiPgogICAgICAgICAgICAgIDxpbWcgc3JjPSJodHRwOi8veWFhcmkuY29tL3ktdmlyYWwv aW1nL2J1dHRvbi1uby5naWYiIGFsdD0iTm8iCnN0eWxlPSJib3JkZXI6bm9uZTttYXJnaW46MCA1 cHg7IiAvPjwvYT4KICAgICAgICAgIDwvZGl2PgogICAgICAgICAgPGRpdiBzdHlsZT0iZm9udC1z aXplOjlwdDt0ZXh0LWFsaWduOmNlbnRlcjsiPlBsZWFzZSByZXNwb25kIG9yIFN1Ymhhc2ggbWln aHQgdGhpbmsgeW91CnNhaWQgbm8gOig8L2Rpdj4KICAgICAgICA8L3RkPgogICAgICA8L3RyPgog ICAgPC90YWJsZT4KICA8L2Rpdj4KPC90ZD48L3RyPjwvdGFibGU+CjxwIGFsaWduPSJjZW50ZXIi IHN0eWxlPSJmb250LXNpemU6MTBwdCI+CiAgPGJyIC8+CiAgVG8gc3RvcCByZWNlaXZpbmcgZW1h aWxzIGZyb20gWWFhcmkuY29tLCBjbGljayA8YQpocmVmPSJodHRwOi8veWFhcmkuY29tL3ktZW1h aWwtb3B0LW91dC5waHA/cGFyYW09YTJSaVFHOXpjeTV6WjJrdVkyOXQiPmhlcmU8L2E+LgogIDxi ciAvPgogIElmIHlvdSBoYXZlIGFueSBjb25jZXJucyByZWdhcmRpbmcgdGhlIGNvbnRlbnQgb2Yg dGhpcyBtZXNzYWdlLCBwbGVhc2UgZW1haWwgYWJ1c2VAeWFhcmkuY29tLgogIDxiciAvPgogIDxz cGFuIHN0eWxlPSJmb250LXNpemU6OHB0Ij5ZYWFyaSBMTEMsIDM1OCBBbmdpZXIgQXZlLCBBdGxh bnRhLCBHQSAKMzAzMTI8L3NwYW4+CjwvcD4KPC9ib2R5Pgo8L2h0bWw+Cg== --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Wed Oct 24 23:50:28 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 24 Oct 2007 23:50:37 -0700 (PDT) Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9P6oPdW012450 for ; Wed, 24 Oct 2007 23:50:28 -0700 Received: from mailgate3.nec.co.jp (mailgate54.nec.co.jp [10.7.69.195]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9P6m2Ik009097; Thu, 25 Oct 2007 15:48:02 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9P6m2I09809; Thu, 25 Oct 2007 15:48:02 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv3.nec.co.jp (8.11.7/3.7W-MAILSV4-NEC) with ESMTP id l9P6m2B12917; Thu, 25 Oct 2007 15:48:02 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 00C88E482B5; Thu, 25 Oct 2007 15:48:01 +0900 (JST) Message-ID: <47203C21.2010505@ah.jp.nec.com> Date: Thu, 25 Oct 2007 15:48:01 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Nick Piggin CC: Andrew Morton , vgoyal@in.ibm.com, linux-kernel@vger.kernel.org, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , kdb@oss.sgi.com Subject: Re: [PATCH 0/2] add new notifier function ,take2 References: <471700F4.1080200@ah.jp.nec.com> <20071018080621.GB8779@in.ibm.com> <47171ED9.7010907@ah.jp.nec.com> <200710212200.04361.nickpiggin@yahoo.com.au> In-Reply-To: <200710212200.04361.nickpiggin@yahoo.com.au> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1263 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Nick Piggin wrote: >>> Is it possible to use a single bit of common code and a single >>> notifier for these things? Or is it too difficult? >> > >> > I'm sorry, I can't understand your image well. I'd like to know details of >> > your image. > > Rather than have each of "RAS tools" have their own notifier, and have > the user specify the priority of the notifiers, introduce some layer > which _knows_ that, for example, only one of these subsystems will be > called (it could arbitrate, perhaps distinguish between destructive and > non-destructive ones). It would need only a single notifier, but would > then have a specific way of calling into the ras modules. > > Does this make sense? I guess it is a lot more work to do, so maybe your > solution is the best one for now. Hi Nick, Thank you for your explanation. I understand. :-) This is crash_stop (the common infrastructure for debug tools) by Keith Owens. http://www.mail-archive.com/linux-arch@vger.kernel.org/msg01929.html Is it same as your idea? I think it is very nice solution for debug tools conflict problem. By the way, on old notify_chain, if admin wants to change the list order, admin have to recompile the kernel. My patches add new *generic* notify_chain which admin can modify the list order. My patches are not only for RAS tools problem. I'm happy if both patches are merged into mainline. :-) Thanks, Takenori --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 25 01:02:15 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 25 Oct 2007 01:02:26 -0700 (PDT) Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9P82Cpe001988 for ; Thu, 25 Oct 2007 01:02:14 -0700 Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.192]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9P801vU022411; Thu, 25 Oct 2007 17:00:01 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9P801e22943; Thu, 25 Oct 2007 17:00:01 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l9P800C09359; Thu, 25 Oct 2007 17:00:00 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 7EFEBE4823B; Thu, 25 Oct 2007 17:00:00 +0900 (JST) Message-ID: <47204CFF.50709@ah.jp.nec.com> Date: Thu, 25 Oct 2007 16:59:59 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Randy Dunlap CC: linux-kernel@vger.kernel.org, vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: Re: [PATCH 2/2] implement new notifier function to panic_notifier_list ,take2 References: <4716FFDB.7090502@ah.jp.nec.com> <47171EEF.7030109@ah.jp.nec.com> <20071024111100.0f5d8b58.rdunlap@xenotime.net> In-Reply-To: <20071024111100.0f5d8b58.rdunlap@xenotime.net> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1264 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Randy Dunlap wrote: > On Thu, 18 Oct 2007 17:53:03 +0900 Takenori Nagano wrote: > >> This patch implements new notifier function to panic_notifier_list. We can >> change the list of order by debugfs. > > Should be sysfs IMO. debugfs isn't (should not be) required. OK. We try to find an appropriate place. http://lkml.org/lkml/2007/10/24/54 >> Thanks, >> >> --- >> >> Signed-off-by: Takenori Nagano >> >> --- >> diff -uprN linux-2.6.23.orig/arch/alpha/kernel/setup.c linux-2.6.23/arch/alpha/kernel/setup.c >> --- linux-2.6.23.orig/arch/alpha/kernel/setup.c 2007-10-10 05:31:38.000000000 +0900 >> +++ linux-2.6.23/arch/alpha/kernel/setup.c 2007-10-18 08:56:53.928000000 +0900 >> @@ -45,14 +45,22 @@ >> #include >> #include >> >> -extern struct atomic_notifier_head panic_notifier_list; >> +extern struct tunable_atomic_notifier_head panic_notifier_list; >> static int alpha_panic_event(struct notifier_block *, unsigned long, void *); >> -static struct notifier_block alpha_panic_block = { >> +static struct notifier_block alpha_panic_block_base = { >> alpha_panic_event, >> NULL, >> INT_MAX /* try to do it first */ >> }; >> >> +static struct tunable_atomic_notifier_block alpha_panic_block = { >> + &alpha_panic_block_base, > > Use C99-style initializer. and NULLs aren't needed. OK. I'll fix. Thanks, Takenori > >> + NULL, >> + NULL, >> + NULL, >> + NULL >> +}; >> + >> #include >> #include >> #include > >> diff -uprN linux-2.6.23.orig/arch/arm/mach-omap1/board-voiceblue.c linux-2.6.23/arch/arm/mach-omap1/board-voiceblue.c >> --- linux-2.6.23.orig/arch/arm/mach-omap1/board-voiceblue.c 2007-10-10 05:31:38.000000000 +0900 >> +++ linux-2.6.23/arch/arm/mach-omap1/board-voiceblue.c 2007-10-18 09:00:35.900000000 +0900 >> @@ -228,14 +228,23 @@ static int panic_event(struct notifier_b >> return NOTIFY_DONE; >> } >> >> -static struct notifier_block panic_block = { >> +static struct notifier_block panic_block_base = { >> .notifier_call = panic_event, >> }; >> >> +static struct tunable_atomic_notifier_block panic_block = { >> + .nb = &panic_block_base, >> + .head = NULL, >> + .dir = NULL, >> + .pri_dentry = NULL, >> + .desc_dentry = NULL > > Drop the NULLs. > >> +}; >> + >> static int __init voiceblue_setup(void) >> { >> /* Setup panic notifier */ >> - notifier_chain_register(&panic_notifier_list, &panic_block); >> + tunable_atomic_notifier_chain_register(&panic_notifier_list, >> + &panic_block, "VoiceBlue", NULL); >> >> return 0; >> } >> diff -uprN linux-2.6.23.orig/arch/mips/sgi-ip22/ip22-reset.c linux-2.6.23/arch/mips/sgi-ip22/ip22-reset.c >> --- linux-2.6.23.orig/arch/mips/sgi-ip22/ip22-reset.c 2007-10-10 05:31:38.000000000 +0900 >> +++ linux-2.6.23/arch/mips/sgi-ip22/ip22-reset.c 2007-10-18 09:01:33.408000000 +0900 >> @@ -226,10 +226,18 @@ static int panic_event(struct notifier_b >> return NOTIFY_DONE; >> } >> >> -static struct notifier_block panic_block = { >> +static struct notifier_block panic_block_base = { >> .notifier_call = panic_event, >> }; >> >> +static struct tunable_atomic_notifier_block panic_block = { >> + .nb = &panic_block_base, >> + .head = NULL, >> + .dir = NULL, >> + .pri_dentry = NULL, >> + .desc_dentry = NULL > > Ditto. > >> +}; >> + >> static int __init reboot_setup(void) >> { >> _machine_restart = sgi_machine_restart; > >> diff -uprN linux-2.6.23.orig/arch/mips/sgi-ip32/ip32-reset.c linux-2.6.23/arch/mips/sgi-ip32/ip32-reset.c >> --- linux-2.6.23.orig/arch/mips/sgi-ip32/ip32-reset.c 2007-10-10 05:31:38.000000000 +0900 >> +++ linux-2.6.23/arch/mips/sgi-ip32/ip32-reset.c 2007-10-18 09:02:20.496000000 +0900 >> @@ -175,10 +175,18 @@ static int panic_event(struct notifier_b >> return NOTIFY_DONE; >> } >> >> -static struct notifier_block panic_block = { >> +static struct notifier_block panic_block_base = { >> .notifier_call = panic_event, >> }; >> >> +static struct tunable_atomic_notifier_block panic_block = { >> + .nb = &panic_block_base, >> + .head = NULL, >> + .dir = NULL, >> + .pri_dentry = NULL, >> + .desc_dentry = NULL > > Ditto. > >> +}; >> + >> static __init int ip32_reboot_setup(void) >> { >> /* turn on the green led only */ > >> diff -uprN linux-2.6.23.orig/arch/parisc/kernel/pdc_chassis.c linux-2.6.23/arch/parisc/kernel/pdc_chassis.c >> --- linux-2.6.23.orig/arch/parisc/kernel/pdc_chassis.c 2007-10-10 05:31:38.000000000 +0900 >> +++ linux-2.6.23/arch/parisc/kernel/pdc_chassis.c 2007-10-18 08:56:54.052000000 +0900 >> @@ -101,11 +101,18 @@ static int pdc_chassis_panic_event(struc >> } >> >> >> -static struct notifier_block pdc_chassis_panic_block = { >> +static struct notifier_block pdc_chassis_panic_block_base = { >> .notifier_call = pdc_chassis_panic_event, >> .priority = INT_MAX, >> }; >> >> +static struct tunable_atomic_notifier_block pdc_chassis_panic_block = { >> + .nb = &pdc_chassis_panic_block_base, >> + .head = NULL, >> + .dir = NULL, >> + .pri_dentry = NULL, >> + .desc_dentry = NULL > > Ditto... (I'll skip mentioning the rest of these.) > >> +}; >> >> /** >> * parisc_reboot_event() - Called by the reboot handler. > > > --- > ~Randy > > -- +=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+ NEC コンピュータソフトウェア事業本部 OSSプラットフォーム開発本部 永野 武則 (Takenori Nagano) TEL:8-23-57270(MyLine) 042-333-5383(外線) e-mail:t-nagano@ah.jp.nec.com +=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu Oct 25 01:04:41 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 25 Oct 2007 01:04:46 -0700 (PDT) Received: from tyo202.gate.nec.co.jp (TYO202.gate.nec.co.jp [202.32.8.206]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9P84bcA002150 for ; Thu, 25 Oct 2007 01:04:40 -0700 Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.161]) by tyo202.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l9P82DDK025962; Thu, 25 Oct 2007 17:02:13 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l9P82DC17944; Thu, 25 Oct 2007 17:02:13 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l9P82CC12139; Thu, 25 Oct 2007 17:02:12 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id B4EC8E4823B; Thu, 25 Oct 2007 17:02:12 +0900 (JST) Message-ID: <47204D84.1060706@ah.jp.nec.com> Date: Thu, 25 Oct 2007 17:02:12 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Randy Dunlap CC: linux-kernel@vger.kernel.org, vgoyal@in.ibm.com, "Eric W. Biederman" , k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org, Bernhard Walle , Keith Owens , Andrew Morton , kdb@oss.sgi.com Subject: Re: [PATCH 1/2] add tunable_notifier function ,take2 References: <4716FFDB.7090502@ah.jp.nec.com> <47171EEC.4030408@ah.jp.nec.com> <20071024111629.3e28b452.rdunlap@xenotime.net> In-Reply-To: <20071024111629.3e28b452.rdunlap@xenotime.net> Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1265 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Randy Dunlap wrote: > On Thu, 18 Oct 2007 17:53:00 +0900 Takenori Nagano wrote: > >> This patch adds new notifier function tunable_notifier_chain. Its base is >> atomic_notifier_chain. >> >> Thanks, >> >> --- >> >> Signed-off-by: Takenori Nagano >> >> --- >> diff -uprN linux-2.6.23.orig/kernel/sys.c linux-2.6.23/kernel/sys.c >> --- linux-2.6.23.orig/kernel/sys.c 2007-10-10 05:31:38.000000000 +0900 >> +++ linux-2.6.23/kernel/sys.c 2007-10-18 10:08:52.728000000 +0900 >> @@ -38,6 +38,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -393,6 +394,243 @@ int blocking_notifier_call_chain(struct >> EXPORT_SYMBOL_GPL(blocking_notifier_call_chain); > >> +/** >> + * tunable_atomic_notifier_chain_register >> + * - Add notifier to an tunable notifier chain > > Function name & short description must be on one (long?) line. :( OK. I'll fix next version. >> + >> +int __kprobes __tunable_atomic_notifier_call_chain( >> + struct tunable_atomic_notifier_head *nh, >> + unsigned long val, void *v, >> + int nr_to_call, int *nr_calls) >> +{ >> + int ret; >> + >> + rcu_read_lock(); >> + ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls); >> + rcu_read_unlock(); >> + return ret; >> +} >> + >> +EXPORT_SYMBOL_GPL(__tunable_atomic_notifier_call_chain); > > Blank line is usually omitted before EXPORT_SYMBOL.... OK. I'll fix, too. Thanks, Takenori > --- > ~Randy > > --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From jidong.xiao@gmail.com Wed Oct 31 06:39:28 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 31 Oct 2007 06:39:32 -0700 (PDT) Received: from el-out-1112.google.com (el-out-1112.google.com [209.85.162.176]) by oss.sgi.com (8.12.11.20060308/8.12.10/SuSE Linux 0.7) with ESMTP id l9VDdPuc016445 for ; Wed, 31 Oct 2007 06:39:28 -0700 Received: by el-out-1112.google.com with SMTP id v27so21501ele for ; Wed, 31 Oct 2007 06:39:29 -0700 (PDT) Received: by 10.142.126.17 with SMTP id y17mr1965698wfc.1193828327218; Wed, 31 Oct 2007 03:58:47 -0700 (PDT) Received: by 10.142.162.16 with HTTP; Wed, 31 Oct 2007 03:58:47 -0700 (PDT) Message-ID: <4104961b0710310358y58bc0e1bm797fe236c8feb409@mail.gmail.com> Date: Wed, 31 Oct 2007 18:58:47 +0800 From: "jidong xiao" To: kdb@oss.sgi.com Subject: Question on kdb_event MIME-Version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Disposition: inline X-archive-position: 1266 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: jidong.xiao@gmail.com Precedence: bulk X-list: kdb Hi,all Can anyone kindly explain the usage of kdb_event?Thank you very much! I saw this varible is used only in two places, inside kdb_printf() and kdb(), kdb_event is incremented and decremented. But I have no idea why do we need to use it in these two circumstance. Regards Jason --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.