summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpufreq.c54
-rw-r--r--kernel/exec_domain.c4
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/intermodule.c2
-rw-r--r--kernel/ksyms.c4
-rw-r--r--kernel/module.c41
-rw-r--r--kernel/params.c7
-rw-r--r--kernel/printk.c16
8 files changed, 68 insertions, 64 deletions
diff --git a/kernel/cpufreq.c b/kernel/cpufreq.c
index c8208fb2191a..5dff6da1a73f 100644
--- a/kernel/cpufreq.c
+++ b/kernel/cpufreq.c
@@ -365,7 +365,7 @@ int cpufreq_set(unsigned int freq, unsigned int cpu)
{
struct cpufreq_policy policy;
down(&cpufreq_driver_sem);
- if (!cpufreq_driver || !cpu_max_freq) {
+ if (!cpufreq_driver || !freq || (cpu > NR_CPUS)) {
up(&cpufreq_driver_sem);
return -EINVAL;
}
@@ -377,7 +377,20 @@ int cpufreq_set(unsigned int freq, unsigned int cpu)
up(&cpufreq_driver_sem);
- return cpufreq_set_policy(&policy);
+ if (policy.cpu == CPUFREQ_ALL_CPUS)
+ {
+ unsigned int i;
+ unsigned int ret = 0;
+ for (i=0; i<NR_CPUS; i++)
+ {
+ policy.cpu = i;
+ if (cpu_online(i))
+ ret |= cpufreq_set_policy(&policy);
+ }
+ return ret;
+ }
+ else
+ return cpufreq_set_policy(&policy);
}
EXPORT_SYMBOL_GPL(cpufreq_set);
@@ -842,7 +855,6 @@ EXPORT_SYMBOL(cpufreq_get_policy);
*/
int cpufreq_set_policy(struct cpufreq_policy *policy)
{
- unsigned int i;
int ret;
down(&cpufreq_driver_sem);
@@ -889,24 +901,12 @@ int cpufreq_set_policy(struct cpufreq_policy *policy)
up(&cpufreq_notifier_sem);
- if (policy->cpu == CPUFREQ_ALL_CPUS) {
- for (i=0;i<NR_CPUS;i++) {
- cpufreq_driver->policy[i].min = policy->min;
- cpufreq_driver->policy[i].max = policy->max;
- cpufreq_driver->policy[i].policy = policy->policy;
- }
- } else {
- cpufreq_driver->policy[policy->cpu].min = policy->min;
- cpufreq_driver->policy[policy->cpu].max = policy->max;
- cpufreq_driver->policy[policy->cpu].policy = policy->policy;
- }
+ cpufreq_driver->policy[policy->cpu].min = policy->min;
+ cpufreq_driver->policy[policy->cpu].max = policy->max;
+ cpufreq_driver->policy[policy->cpu].policy = policy->policy;
#ifdef CONFIG_CPU_FREQ_24_API
- if (policy->cpu == CPUFREQ_ALL_CPUS) {
- for (i=0;i<NR_CPUS;i++)
- cpu_cur_freq[i] = policy->max;
- } else
- cpu_cur_freq[policy->cpu] = policy->max;
+ cpu_cur_freq[policy->cpu] = policy->max;
#endif
ret = cpufreq_driver->setpolicy(policy);
@@ -920,15 +920,6 @@ EXPORT_SYMBOL(cpufreq_set_policy);
/*********************************************************************
- * DYNAMIC CPUFREQ SWITCHING *
- *********************************************************************/
-#ifdef CONFIG_CPU_FREQ_DYNAMIC
-/* TBD */
-#endif /* CONFIG_CPU_FREQ_DYNAMIC */
-
-
-
-/*********************************************************************
* EXTERNALLY AFFECTING FREQUENCY CHANGES *
*********************************************************************/
@@ -967,12 +958,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs);
#ifdef CONFIG_CPU_FREQ_24_API
- if (freqs->cpu == CPUFREQ_ALL_CPUS) {
- int i;
- for (i=0;i<NR_CPUS;i++)
- cpu_cur_freq[i] = freqs->new;
- } else
- cpu_cur_freq[freqs->cpu] = freqs->new;
+ cpu_cur_freq[freqs->cpu] = freqs->new;
#endif
break;
}
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index 162a5c23e606..5d53353d57b0 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -82,7 +82,7 @@ lookup_exec_domain(u_long personality)
read_lock(&exec_domains_lock);
for (ep = exec_domains; ep; ep = ep->next) {
if (pers >= ep->pers_low && pers <= ep->pers_high)
- if (try_inc_mod_count(ep->module))
+ if (try_module_get(ep->module))
goto out;
}
@@ -97,7 +97,7 @@ lookup_exec_domain(u_long personality)
for (ep = exec_domains; ep; ep = ep->next) {
if (pers >= ep->pers_low && pers <= ep->pers_high)
- if (try_inc_mod_count(ep->module))
+ if (try_module_get(ep->module))
goto out;
}
#endif
diff --git a/kernel/fork.c b/kernel/fork.c
index 6f7298827344..60d6d54142c6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -757,7 +757,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
p->thread_info->preempt_count = 1;
#endif
p->did_exec = 0;
- p->swappable = 0;
p->state = TASK_UNINTERRUPTIBLE;
copy_flags(clone_flags, p);
@@ -841,7 +840,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
p->parent_exec_id = p->self_exec_id;
/* ok, now we should be set up.. */
- p->swappable = 1;
if (clone_flags & CLONE_DETACHED)
p->exit_signal = -1;
else
@@ -1078,7 +1076,7 @@ void __init proc_caches_init(void)
vm_area_cachep = kmem_cache_create("vm_area_struct",
sizeof(struct vm_area_struct), 0,
- SLAB_HWCACHE_ALIGN, NULL, NULL);
+ 0, NULL, NULL);
if(!vm_area_cachep)
panic("vma_init: Cannot alloc vm_area_struct SLAB cache");
diff --git a/kernel/intermodule.c b/kernel/intermodule.c
index 9228ca4fe035..5171df7d70fb 100644
--- a/kernel/intermodule.c
+++ b/kernel/intermodule.c
@@ -123,7 +123,7 @@ const void *inter_module_get(const char *im_name)
list_for_each(tmp, &ime_list) {
ime = list_entry(tmp, struct inter_module_entry, list);
if (strcmp(ime->im_name, im_name) == 0) {
- if (try_inc_mod_count(ime->owner))
+ if (try_module_get(ime->owner))
result = ime->userdata;
break;
}
diff --git a/kernel/ksyms.c b/kernel/ksyms.c
index cd49778dd1f3..414ab402325e 100644
--- a/kernel/ksyms.c
+++ b/kernel/ksyms.c
@@ -98,6 +98,10 @@ EXPORT_SYMBOL(set_shrinker);
EXPORT_SYMBOL(remove_shrinker);
EXPORT_SYMBOL(kmalloc);
EXPORT_SYMBOL(kfree);
+#ifdef CONFIG_SMP
+EXPORT_SYMBOL(kmalloc_percpu);
+EXPORT_SYMBOL(kfree_percpu);
+#endif
EXPORT_SYMBOL(vfree);
EXPORT_SYMBOL(__vmalloc);
EXPORT_SYMBOL(vmalloc);
diff --git a/kernel/module.c b/kernel/module.c
index 4b789cf97f5d..6d2e66e9bf37 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -569,24 +569,19 @@ static int param_set_byte(const char *val, struct kernel_param *kp)
return 0;
}
-static int param_string(const char *name, const char *val,
- unsigned int min, unsigned int max,
- char *dest)
+/* Bounds checking done below */
+static int obsparm_copy_string(const char *val, struct kernel_param *kp)
{
- if (strlen(val) < min || strlen(val) > max) {
- printk(KERN_ERR
- "Parameter %s length must be %u-%u characters\n",
- name, min, max);
- return -EINVAL;
- }
- strcpy(dest, val);
+ strcpy(kp->arg, val);
return 0;
}
extern int set_obsolete(const char *val, struct kernel_param *kp)
{
unsigned int min, max;
- char *p, *endp;
+ unsigned int size, maxsize;
+ char *endp;
+ const char *p;
struct obsolete_modparm *obsparm = kp->arg;
if (!val) {
@@ -618,10 +613,32 @@ extern int set_obsolete(const char *val, struct kernel_param *kp)
return param_array(kp->name, val, min, max, obsparm->addr,
sizeof(long), param_set_long);
case 's':
- return param_string(kp->name, val, min, max, obsparm->addr);
+ return param_array(kp->name, val, min, max, obsparm->addr,
+ sizeof(char *), param_set_charp);
+
+ case 'c':
+ /* Undocumented: 1-5c50 means 1-5 strings of up to 49 chars,
+ and the decl is "char xxx[5][50];" */
+ p = endp+1;
+ maxsize = simple_strtol(p, &endp, 10);
+ /* We check lengths here (yes, this is a hack). */
+ p = val;
+ while (p[size = strcspn(p, ",")]) {
+ if (size >= maxsize)
+ goto oversize;
+ p += size+1;
+ }
+ if (size >= maxsize)
+ goto oversize;
+ return param_array(kp->name, val, min, max, obsparm->addr,
+ maxsize, obsparm_copy_string);
}
printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type);
return -EINVAL;
+ oversize:
+ printk(KERN_ERR
+ "Parameter %s doesn't fit in %u chars.\n", kp->name, maxsize);
+ return -EINVAL;
}
static int obsolete_params(const char *name,
diff --git a/kernel/params.c b/kernel/params.c
index 5c5e9b3c23fe..0e9938a6bf23 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -233,6 +233,7 @@ int param_array(const char *name,
int ret;
unsigned int count = 0;
struct kernel_param kp;
+ char save;
/* Get the name right for errors. */
kp.name = name;
@@ -247,7 +248,6 @@ int param_array(const char *name,
/* We expect a comma-separated list of values. */
do {
int len;
- char save;
if (count > max) {
printk(KERN_ERR "%s: can only take %i arguments\n",
@@ -256,18 +256,17 @@ int param_array(const char *name,
}
len = strcspn(val, ",");
- /* Temporarily nul-terminate and parse */
+ /* nul-terminate and parse */
save = val[len];
((char *)val)[len] = '\0';
ret = set(val, &kp);
- ((char *)val)[len] = save;
if (ret != 0)
return ret;
kp.arg += elemsize;
val += len+1;
count++;
- } while (val[-1] == ',');
+ } while (save == ',');
if (count < min) {
printk(KERN_ERR "%s: needs at least %i arguments\n",
diff --git a/kernel/printk.c b/kernel/printk.c
index bb1bcb0d723f..ffe724fabc0e 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -27,6 +27,7 @@
#include <linux/interrupt.h> /* For in_interrupt() */
#include <linux/config.h>
#include <linux/delay.h>
+#include <linux/smp.h>
#include <asm/uaccess.h>
@@ -42,10 +43,6 @@
#define LOG_BUF_MASK (LOG_BUF_LEN-1)
-#ifndef arch_consoles_callable
-#define arch_consoles_callable() (1)
-#endif
-
/* printk's without a loglevel use this.. */
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
@@ -447,10 +444,12 @@ asmlinkage int printk(const char *fmt, ...)
log_level_unknown = 1;
}
- if (!arch_consoles_callable()) {
+ if (!cpu_online(smp_processor_id())) {
/*
- * On some architectures, the consoles are not usable
- * on secondary CPUs early in the boot process.
+ * Some console drivers may assume that per-cpu resources have
+ * been allocated. So don't allow them to be called by this
+ * CPU until it is officially up. We shouldn't be calling into
+ * random console drivers on a CPU which doesn't exist yet..
*/
spin_unlock_irqrestore(&logbuf_lock, flags);
goto out;
@@ -638,7 +637,8 @@ void register_console(struct console * console)
}
if (console->flags & CON_PRINTBUFFER) {
/*
- * release_console_sem() will print out the buffered messages for us.
+ * release_console_sem() will print out the buffered messages
+ * for us.
*/
spin_lock_irqsave(&logbuf_lock, flags);
con_start = log_start;