Loading arch/x86_64/kernel/mce_amd.c +29 −83 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ #include <asm/idle.h> #define PFX "mce_threshold: " #define VERSION "version 1.1.0" #define VERSION "version 1.1.1" #define NR_BANKS 6 #define NR_BLOCKS 9 #define THRESHOLD_MAX 0xFFF Loading Loading @@ -325,13 +325,13 @@ static ssize_t store_error_count(struct threshold_block *b, .store = _store, \ }; #define ATTR_FIELDS(name) \ #define RW_ATTR(name) \ static struct threshold_attr name = \ THRESHOLD_ATTR(name, 0644, show_## name, store_## name) ATTR_FIELDS(interrupt_enable); ATTR_FIELDS(threshold_limit); ATTR_FIELDS(error_count); RW_ATTR(interrupt_enable); RW_ATTR(threshold_limit); RW_ATTR(error_count); static struct attribute *default_attrs[] = { &interrupt_enable.attr, Loading Loading @@ -537,7 +537,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) /* create dir/files for all valid threshold banks */ static __cpuinit int threshold_create_device(unsigned int cpu) { int bank; unsigned int bank; int err = 0; for (bank = 0; bank < NR_BANKS; ++bank) { Loading Loading @@ -620,7 +620,7 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank) static __cpuinit void threshold_remove_device(unsigned int cpu) { int bank; unsigned int bank; for (bank = 0; bank < NR_BANKS; ++bank) { if (!(per_cpu(bank_map, cpu) & 1 << bank)) Loading @@ -629,54 +629,7 @@ static __cpuinit void threshold_remove_device(unsigned int cpu) } } /* link all existing siblings when first core comes up */ static __cpuinit int threshold_create_symlinks(unsigned int cpu) { int bank, err = 0; unsigned int lcpu = 0; if (cpu_data[cpu].cpu_core_id) return 0; for_each_cpu_mask(lcpu, cpu_core_map[cpu]) { if (lcpu == cpu) continue; for (bank = 0; bank < NR_BANKS; ++bank) { if (!(per_cpu(bank_map, cpu) & 1 << bank)) continue; if (!shared_bank[bank]) continue; err = threshold_create_bank(lcpu, bank); } } return err; } /* remove all symlinks before first core dies. */ static __cpuinit void threshold_remove_symlinks(unsigned int cpu) { int bank; unsigned int lcpu = 0; if (cpu_data[cpu].cpu_core_id) return; for_each_cpu_mask(lcpu, cpu_core_map[cpu]) { if (lcpu == cpu) continue; for (bank = 0; bank < NR_BANKS; ++bank) { if (!(per_cpu(bank_map, cpu) & 1 << bank)) continue; if (!shared_bank[bank]) continue; threshold_remove_bank(lcpu, bank); } } } #else /* !CONFIG_HOTPLUG_CPU */ static __cpuinit void threshold_create_symlinks(unsigned int cpu) { } static __cpuinit void threshold_remove_symlinks(unsigned int cpu) { } static void threshold_remove_device(unsigned int cpu) { } Loading @@ -695,13 +648,6 @@ static int threshold_cpu_callback(struct notifier_block *nfb, switch (action) { case CPU_ONLINE: threshold_create_device(cpu); threshold_create_symlinks(cpu); break; case CPU_DOWN_PREPARE: threshold_remove_symlinks(cpu); break; case CPU_DOWN_FAILED: threshold_create_symlinks(cpu); break; case CPU_DEAD: threshold_remove_device(cpu); Loading @@ -719,7 +665,7 @@ static struct notifier_block threshold_cpu_notifier = { static __init int threshold_init_device(void) { int lcpu = 0; unsigned lcpu = 0; /* to hit CPUs online before the notifier is up */ for_each_online_cpu(lcpu) { Loading Loading
arch/x86_64/kernel/mce_amd.c +29 −83 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ #include <asm/idle.h> #define PFX "mce_threshold: " #define VERSION "version 1.1.0" #define VERSION "version 1.1.1" #define NR_BANKS 6 #define NR_BLOCKS 9 #define THRESHOLD_MAX 0xFFF Loading Loading @@ -325,13 +325,13 @@ static ssize_t store_error_count(struct threshold_block *b, .store = _store, \ }; #define ATTR_FIELDS(name) \ #define RW_ATTR(name) \ static struct threshold_attr name = \ THRESHOLD_ATTR(name, 0644, show_## name, store_## name) ATTR_FIELDS(interrupt_enable); ATTR_FIELDS(threshold_limit); ATTR_FIELDS(error_count); RW_ATTR(interrupt_enable); RW_ATTR(threshold_limit); RW_ATTR(error_count); static struct attribute *default_attrs[] = { &interrupt_enable.attr, Loading Loading @@ -537,7 +537,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) /* create dir/files for all valid threshold banks */ static __cpuinit int threshold_create_device(unsigned int cpu) { int bank; unsigned int bank; int err = 0; for (bank = 0; bank < NR_BANKS; ++bank) { Loading Loading @@ -620,7 +620,7 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank) static __cpuinit void threshold_remove_device(unsigned int cpu) { int bank; unsigned int bank; for (bank = 0; bank < NR_BANKS; ++bank) { if (!(per_cpu(bank_map, cpu) & 1 << bank)) Loading @@ -629,54 +629,7 @@ static __cpuinit void threshold_remove_device(unsigned int cpu) } } /* link all existing siblings when first core comes up */ static __cpuinit int threshold_create_symlinks(unsigned int cpu) { int bank, err = 0; unsigned int lcpu = 0; if (cpu_data[cpu].cpu_core_id) return 0; for_each_cpu_mask(lcpu, cpu_core_map[cpu]) { if (lcpu == cpu) continue; for (bank = 0; bank < NR_BANKS; ++bank) { if (!(per_cpu(bank_map, cpu) & 1 << bank)) continue; if (!shared_bank[bank]) continue; err = threshold_create_bank(lcpu, bank); } } return err; } /* remove all symlinks before first core dies. */ static __cpuinit void threshold_remove_symlinks(unsigned int cpu) { int bank; unsigned int lcpu = 0; if (cpu_data[cpu].cpu_core_id) return; for_each_cpu_mask(lcpu, cpu_core_map[cpu]) { if (lcpu == cpu) continue; for (bank = 0; bank < NR_BANKS; ++bank) { if (!(per_cpu(bank_map, cpu) & 1 << bank)) continue; if (!shared_bank[bank]) continue; threshold_remove_bank(lcpu, bank); } } } #else /* !CONFIG_HOTPLUG_CPU */ static __cpuinit void threshold_create_symlinks(unsigned int cpu) { } static __cpuinit void threshold_remove_symlinks(unsigned int cpu) { } static void threshold_remove_device(unsigned int cpu) { } Loading @@ -695,13 +648,6 @@ static int threshold_cpu_callback(struct notifier_block *nfb, switch (action) { case CPU_ONLINE: threshold_create_device(cpu); threshold_create_symlinks(cpu); break; case CPU_DOWN_PREPARE: threshold_remove_symlinks(cpu); break; case CPU_DOWN_FAILED: threshold_create_symlinks(cpu); break; case CPU_DEAD: threshold_remove_device(cpu); Loading @@ -719,7 +665,7 @@ static struct notifier_block threshold_cpu_notifier = { static __init int threshold_init_device(void) { int lcpu = 0; unsigned lcpu = 0; /* to hit CPUs online before the notifier is up */ for_each_online_cpu(lcpu) { Loading