diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 09:43:54 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 10:06:11 -0400 |
commit | 7b1bb388bc879ffcc6c69b567816d5c354afe42b (patch) | |
tree | 5a217fdfb0b5e5a327bdcd624506337c1ae1fe32 /kernel/params.c | |
parent | 7d754596756240fa918b94cd0c3011c77a638987 (diff) | |
parent | 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe (diff) |
Merge 'Linux v3.0' into Litmus
Some notes:
* Litmus^RT scheduling class is the topmost scheduling class
(above stop_sched_class).
* scheduler_ipi() function (e.g., in smp_reschedule_interrupt())
may increase IPI latencies.
* Added path into schedule() to quickly re-evaluate scheduling
decision without becoming preemptive again. This used to be
a standard path before the removal of BKL.
Conflicts:
Makefile
arch/arm/kernel/calls.S
arch/arm/kernel/smp.c
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/smp.c
arch/x86/kernel/syscall_table_32.S
include/linux/hrtimer.h
kernel/printk.c
kernel/sched.c
kernel/sched_fair.c
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 84 |
1 files changed, 62 insertions, 22 deletions
diff --git a/kernel/params.c b/kernel/params.c index 08107d181758..ed72e1330862 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -95,7 +95,7 @@ static int parse_one(char *param, | |||
95 | /* Find parameter */ | 95 | /* Find parameter */ |
96 | for (i = 0; i < num_params; i++) { | 96 | for (i = 0; i < num_params; i++) { |
97 | if (parameq(param, params[i].name)) { | 97 | if (parameq(param, params[i].name)) { |
98 | /* Noone handled NULL, so do it here. */ | 98 | /* No one handled NULL, so do it here. */ |
99 | if (!val && params[i].ops->set != param_set_bool) | 99 | if (!val && params[i].ops->set != param_set_bool) |
100 | return -EINVAL; | 100 | return -EINVAL; |
101 | DEBUGP("They are equal! Calling %p\n", | 101 | DEBUGP("They are equal! Calling %p\n", |
@@ -297,21 +297,15 @@ EXPORT_SYMBOL(param_ops_charp); | |||
297 | int param_set_bool(const char *val, const struct kernel_param *kp) | 297 | int param_set_bool(const char *val, const struct kernel_param *kp) |
298 | { | 298 | { |
299 | bool v; | 299 | bool v; |
300 | int ret; | ||
300 | 301 | ||
301 | /* No equals means "set"... */ | 302 | /* No equals means "set"... */ |
302 | if (!val) val = "1"; | 303 | if (!val) val = "1"; |
303 | 304 | ||
304 | /* One of =[yYnN01] */ | 305 | /* One of =[yYnN01] */ |
305 | switch (val[0]) { | 306 | ret = strtobool(val, &v); |
306 | case 'y': case 'Y': case '1': | 307 | if (ret) |
307 | v = true; | 308 | return ret; |
308 | break; | ||
309 | case 'n': case 'N': case '0': | ||
310 | v = false; | ||
311 | break; | ||
312 | default: | ||
313 | return -EINVAL; | ||
314 | } | ||
315 | 309 | ||
316 | if (kp->flags & KPARAM_ISBOOL) | 310 | if (kp->flags & KPARAM_ISBOOL) |
317 | *(bool *)kp->arg = v; | 311 | *(bool *)kp->arg = v; |
@@ -719,9 +713,7 @@ void destroy_params(const struct kernel_param *params, unsigned num) | |||
719 | params[i].ops->free(params[i].arg); | 713 | params[i].ops->free(params[i].arg); |
720 | } | 714 | } |
721 | 715 | ||
722 | static void __init kernel_add_sysfs_param(const char *name, | 716 | static struct module_kobject * __init locate_module_kobject(const char *name) |
723 | struct kernel_param *kparam, | ||
724 | unsigned int name_skip) | ||
725 | { | 717 | { |
726 | struct module_kobject *mk; | 718 | struct module_kobject *mk; |
727 | struct kobject *kobj; | 719 | struct kobject *kobj; |
@@ -729,10 +721,7 @@ static void __init kernel_add_sysfs_param(const char *name, | |||
729 | 721 | ||
730 | kobj = kset_find_obj(module_kset, name); | 722 | kobj = kset_find_obj(module_kset, name); |
731 | if (kobj) { | 723 | if (kobj) { |
732 | /* We already have one. Remove params so we can add more. */ | ||
733 | mk = to_module_kobject(kobj); | 724 | mk = to_module_kobject(kobj); |
734 | /* We need to remove it before adding parameters. */ | ||
735 | sysfs_remove_group(&mk->kobj, &mk->mp->grp); | ||
736 | } else { | 725 | } else { |
737 | mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL); | 726 | mk = kzalloc(sizeof(struct module_kobject), GFP_KERNEL); |
738 | BUG_ON(!mk); | 727 | BUG_ON(!mk); |
@@ -743,15 +732,36 @@ static void __init kernel_add_sysfs_param(const char *name, | |||
743 | "%s", name); | 732 | "%s", name); |
744 | if (err) { | 733 | if (err) { |
745 | kobject_put(&mk->kobj); | 734 | kobject_put(&mk->kobj); |
746 | printk(KERN_ERR "Module '%s' failed add to sysfs, " | 735 | printk(KERN_ERR |
747 | "error number %d\n", name, err); | 736 | "Module '%s' failed add to sysfs, error number %d\n", |
748 | printk(KERN_ERR "The system will be unstable now.\n"); | 737 | name, err); |
749 | return; | 738 | printk(KERN_ERR |
739 | "The system will be unstable now.\n"); | ||
740 | return NULL; | ||
750 | } | 741 | } |
751 | /* So that exit path is even. */ | 742 | |
743 | /* So that we hold reference in both cases. */ | ||
752 | kobject_get(&mk->kobj); | 744 | kobject_get(&mk->kobj); |
753 | } | 745 | } |
754 | 746 | ||
747 | return mk; | ||
748 | } | ||
749 | |||
750 | static void __init kernel_add_sysfs_param(const char *name, | ||
751 | struct kernel_param *kparam, | ||
752 | unsigned int name_skip) | ||
753 | { | ||
754 | struct module_kobject *mk; | ||
755 | int err; | ||
756 | |||
757 | mk = locate_module_kobject(name); | ||
758 | if (!mk) | ||
759 | return; | ||
760 | |||
761 | /* We need to remove old parameters before adding more. */ | ||
762 | if (mk->mp) | ||
763 | sysfs_remove_group(&mk->kobj, &mk->mp->grp); | ||
764 | |||
755 | /* These should not fail at boot. */ | 765 | /* These should not fail at boot. */ |
756 | err = add_sysfs_param(mk, kparam, kparam->name + name_skip); | 766 | err = add_sysfs_param(mk, kparam, kparam->name + name_skip); |
757 | BUG_ON(err); | 767 | BUG_ON(err); |
@@ -796,6 +806,35 @@ static void __init param_sysfs_builtin(void) | |||
796 | } | 806 | } |
797 | } | 807 | } |
798 | 808 | ||
809 | ssize_t __modver_version_show(struct module_attribute *mattr, | ||
810 | struct module *mod, char *buf) | ||
811 | { | ||
812 | struct module_version_attribute *vattr = | ||
813 | container_of(mattr, struct module_version_attribute, mattr); | ||
814 | |||
815 | return sprintf(buf, "%s\n", vattr->version); | ||
816 | } | ||
817 | |||
818 | extern const struct module_version_attribute *__start___modver[]; | ||
819 | extern const struct module_version_attribute *__stop___modver[]; | ||
820 | |||
821 | static void __init version_sysfs_builtin(void) | ||
822 | { | ||
823 | const struct module_version_attribute **p; | ||
824 | struct module_kobject *mk; | ||
825 | int err; | ||
826 | |||
827 | for (p = __start___modver; p < __stop___modver; p++) { | ||
828 | const struct module_version_attribute *vattr = *p; | ||
829 | |||
830 | mk = locate_module_kobject(vattr->module_name); | ||
831 | if (mk) { | ||
832 | err = sysfs_create_file(&mk->kobj, &vattr->mattr.attr); | ||
833 | kobject_uevent(&mk->kobj, KOBJ_ADD); | ||
834 | kobject_put(&mk->kobj); | ||
835 | } | ||
836 | } | ||
837 | } | ||
799 | 838 | ||
800 | /* module-related sysfs stuff */ | 839 | /* module-related sysfs stuff */ |
801 | 840 | ||
@@ -875,6 +914,7 @@ static int __init param_sysfs_init(void) | |||
875 | } | 914 | } |
876 | module_sysfs_initialized = 1; | 915 | module_sysfs_initialized = 1; |
877 | 916 | ||
917 | version_sysfs_builtin(); | ||
878 | param_sysfs_builtin(); | 918 | param_sysfs_builtin(); |
879 | 919 | ||
880 | return 0; | 920 | return 0; |