X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fedac%2Fedac_mc.c;h=8a7a3ab745aaef4e25a859fff01887c038efbf3a;hb=f2fe42abbf0d99a8c4b96f1cc55db10ac35d2fb9;hp=4be9bd0a1267890604b815785a5bf425cd6154fa;hpb=0f36b018b2e314d45af86449f1a97facb1fbe300;p=powerpc.git diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 4be9bd0a12..8a7a3ab745 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -14,7 +14,6 @@ #include -#include #include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include @@ -39,6 +39,12 @@ #define EDAC_MC_VERSION "edac_mc Ver: 2.0.0 " __DATE__ +/* For now, disable the EDAC sysfs code. The sysfs interface that EDAC + * presents to user space needs more thought, and is likely to change + * substantially. + */ +#define DISABLE_EDAC_SYSFS + #ifdef CONFIG_EDAC_DEBUG /* Values of 0 to 4 will generate output */ int edac_debug_level = 1; @@ -48,7 +54,7 @@ EXPORT_SYMBOL(edac_debug_level); /* EDAC Controls, setable by module parameter, and sysfs */ static int log_ue = 1; static int log_ce = 1; -static int panic_on_ue = 1; +static int panic_on_ue; static int poll_msec = 1000; static int check_pci_parity = 0; /* default YES check PCI parity */ @@ -59,6 +65,8 @@ static atomic_t pci_parity_count = ATOMIC_INIT(0); static DECLARE_MUTEX(mem_ctls_mutex); static struct list_head mc_devices = LIST_HEAD_INIT(mc_devices); +static struct task_struct *edac_thread; + /* Structure of the whitelist and blacklist arrays */ struct edac_pci_device_list { unsigned int vendor; /* Vendor ID */ @@ -78,6 +86,8 @@ static int pci_whitelist_count ; /* START sysfs data and methods */ +#ifndef DISABLE_EDAC_SYSFS + static const char *mem_types[] = { [MEM_EMPTY] = "Empty", [MEM_RESERVED] = "Reserved", @@ -133,11 +143,13 @@ static struct kobject edac_pci_kobj; * /sys/devices/system/edac/mc; * data structures and methods */ +#if 0 static ssize_t memctrl_string_show(void *ptr, char *buffer) { char *value = (char*) ptr; return sprintf(buffer, "%s\n", value); } +#endif static ssize_t memctrl_int_show(void *ptr, char *buffer) { @@ -208,7 +220,9 @@ struct memctrl_dev_attribute attr_##_name = { \ }; /* cwrow attribute f*/ +#if 0 MEMCTRL_STRING_ATTR(mc_version,EDAC_MC_VERSION,S_IRUGO,memctrl_string_show,NULL); +#endif /* csrow control files */ MEMCTRL_ATTR(panic_on_ue,S_IRUGO|S_IWUSR,memctrl_int_show,memctrl_int_store); @@ -223,7 +237,6 @@ static struct memctrl_dev_attribute *memctrl_attr[] = { &attr_log_ue, &attr_log_ce, &attr_poll_msec, - &attr_mc_version, NULL, }; @@ -239,6 +252,7 @@ static struct kobj_type ktype_memctrl = { .default_attrs = (struct attribute **) memctrl_attr, }; +#endif /* DISABLE_EDAC_SYSFS */ /* Initialize the main sysfs entries for edac: * /sys/devices/system/edac @@ -249,6 +263,11 @@ static struct kobj_type ktype_memctrl = { * !0 FAILURE */ static int edac_sysfs_memctrl_setup(void) +#ifdef DISABLE_EDAC_SYSFS +{ + return 0; +} +#else { int err=0; @@ -281,6 +300,7 @@ static int edac_sysfs_memctrl_setup(void) return err; } +#endif /* DISABLE_EDAC_SYSFS */ /* * MC teardown: @@ -288,6 +308,7 @@ static int edac_sysfs_memctrl_setup(void) */ static void edac_sysfs_memctrl_teardown(void) { +#ifndef DISABLE_EDAC_SYSFS debugf0("MC: " __FILE__ ": %s()\n", __func__); /* Unregister the MC's kobject */ @@ -298,8 +319,11 @@ static void edac_sysfs_memctrl_teardown(void) /* Unregister the 'edac' object */ sysdev_class_unregister(&edac_class); +#endif /* DISABLE_EDAC_SYSFS */ } +#ifndef DISABLE_EDAC_SYSFS + /* * /sys/devices/system/edac/pci; * data structures and methods @@ -310,6 +334,8 @@ struct list_control { int *count; }; + +#if 0 /* Output the list as: vendor_id:device:id<,vendor_id:device_id> */ static ssize_t edac_pci_list_string_show(void *ptr, char *buffer) { @@ -431,6 +457,7 @@ static ssize_t edac_pci_list_string_store(void *ptr, const char *buffer, return count; } +#endif static ssize_t edac_pci_int_show(void *ptr, char *buffer) { int *value = ptr; @@ -499,6 +526,7 @@ struct edac_pci_dev_attribute edac_pci_attr_##_name = { \ .store = _store, \ }; +#if 0 static struct list_control pci_whitelist_control = { .list = pci_whitelist, .count = &pci_whitelist_count @@ -521,6 +549,7 @@ EDAC_PCI_STRING_ATTR(pci_parity_blacklist, S_IRUGO|S_IWUSR, edac_pci_list_string_show, edac_pci_list_string_store); +#endif /* PCI Parity control files */ EDAC_PCI_ATTR(check_pci_parity,S_IRUGO|S_IWUSR,edac_pci_int_show,edac_pci_int_store); @@ -532,8 +561,6 @@ static struct edac_pci_dev_attribute *edac_pci_attr[] = { &edac_pci_attr_check_pci_parity, &edac_pci_attr_panic_on_pci_parity, &edac_pci_attr_pci_parity_count, - &edac_pci_attr_pci_parity_whitelist, - &edac_pci_attr_pci_parity_blacklist, NULL, }; @@ -549,11 +576,18 @@ static struct kobj_type ktype_edac_pci = { .default_attrs = (struct attribute **) edac_pci_attr, }; +#endif /* DISABLE_EDAC_SYSFS */ + /** * edac_sysfs_pci_setup() * */ static int edac_sysfs_pci_setup(void) +#ifdef DISABLE_EDAC_SYSFS +{ + return 0; +} +#else { int err; @@ -577,16 +611,20 @@ static int edac_sysfs_pci_setup(void) } return err; } - +#endif /* DISABLE_EDAC_SYSFS */ static void edac_sysfs_pci_teardown(void) { +#ifndef DISABLE_EDAC_SYSFS debugf0("MC: " __FILE__ ": %s()\n", __func__); kobject_unregister(&edac_pci_kobj); kobject_put(&edac_pci_kobj); +#endif } +#ifndef DISABLE_EDAC_SYSFS + /* EDAC sysfs CSROW data structures and methods */ /* Set of more detailed csrow attribute show/store functions */ @@ -1040,6 +1078,8 @@ static struct kobj_type ktype_mci = { .default_attrs = (struct attribute **) mci_attr, }; +#endif /* DISABLE_EDAC_SYSFS */ + #define EDAC_DEVICE_SYMLINK "device" /* @@ -1051,6 +1091,11 @@ static struct kobj_type ktype_mci = { * !0 Failure */ static int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) +#ifdef DISABLE_EDAC_SYSFS +{ + return 0; +} +#else { int i; int err; @@ -1119,12 +1164,14 @@ fail: return err; } +#endif /* DISABLE_EDAC_SYSFS */ /* * remove a Memory Controller instance */ static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) { +#ifndef DISABLE_EDAC_SYSFS int i; debugf0("MC: " __FILE__ ": %s()\n", __func__); @@ -1141,6 +1188,7 @@ static void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) kobject_unregister(&mci->edac_mci_kobj); kobject_put(&mci->edac_mci_kobj); +#endif /* DISABLE_EDAC_SYSFS */ } /* END OF sysfs data and methods */ @@ -2028,7 +2076,6 @@ static inline void check_mc_devices (void) */ static void do_edac_check(void) { - debugf3("MC: " __FILE__ ": %s()\n", __func__); check_mc_devices(); @@ -2036,62 +2083,16 @@ static void do_edac_check(void) do_pci_parity_check(); } - -/* - * EDAC thread state information - */ -struct bs_thread_info -{ - struct task_struct *task; - struct completion *event; - char *name; - void (*run)(void); -}; - -static struct bs_thread_info bs_thread; - -/* - * edac_kernel_thread - * This the kernel thread that processes edac operations - * in a normal thread environment - */ static int edac_kernel_thread(void *arg) { - struct bs_thread_info *thread = (struct bs_thread_info *) arg; - - /* detach thread */ - daemonize(thread->name); - - current->exit_signal = SIGCHLD; - allow_signal(SIGKILL); - thread->task = current; - - /* indicate to starting task we have started */ - complete(thread->event); - - /* loop forever, until we are told to stop */ - while(thread->run != NULL) { - void (*run)(void); - - /* call the function to check the memory controllers */ - run = thread->run; - if (run) - run(); - - if (signal_pending(current)) - flush_signals(current); - - /* ensure we are interruptable */ - set_current_state(TASK_INTERRUPTIBLE); + while (!kthread_should_stop()) { + do_edac_check(); /* goto sleep for the interval */ - schedule_timeout((HZ * poll_msec) / 1000); + schedule_timeout_interruptible((HZ * poll_msec) / 1000); try_to_freeze(); } - /* notify waiter that we are exiting */ - complete(thread->event); - return 0; } @@ -2101,9 +2102,6 @@ static int edac_kernel_thread(void *arg) */ static int __init edac_mc_init(void) { - int ret; - struct completion event; - printk(KERN_INFO "MC: " __FILE__ " version " EDAC_MC_VERSION "\n"); /* @@ -2131,24 +2129,15 @@ static int __init edac_mc_init(void) return -ENODEV; } - /* Create our kernel thread */ - init_completion(&event); - bs_thread.event = &event; - bs_thread.name = "kedac"; - bs_thread.run = do_edac_check; - /* create our kernel thread */ - ret = kernel_thread(edac_kernel_thread, &bs_thread, CLONE_KERNEL); - if (ret < 0) { + edac_thread = kthread_run(edac_kernel_thread, NULL, "kedac"); + if (IS_ERR(edac_thread)) { /* remove the sysfs entries */ edac_sysfs_memctrl_teardown(); edac_sysfs_pci_teardown(); - return -ENOMEM; + return PTR_ERR(edac_thread); } - /* wait for our kernel theard ack that it is up and running */ - wait_for_completion(&event); - return 0; } @@ -2159,21 +2148,9 @@ static int __init edac_mc_init(void) */ static void __exit edac_mc_exit(void) { - struct completion event; - debugf0("MC: " __FILE__ ": %s()\n", __func__); - init_completion(&event); - bs_thread.event = &event; - - /* As soon as ->run is set to NULL, the task could disappear, - * so we need to hold tasklist_lock until we have sent the signal - */ - read_lock(&tasklist_lock); - bs_thread.run = NULL; - send_sig(SIGKILL, bs_thread.task, 1); - read_unlock(&tasklist_lock); - wait_for_completion(&event); + kthread_stop(edac_thread); /* tear down the sysfs device */ edac_sysfs_memctrl_teardown();