diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-02 15:22:03 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-02 15:22:03 -0400 |
| commit | bb1775c9c43d9272235264377ffada1be2cfb401 (patch) | |
| tree | 1a1bd92492dff334f713b8737d6acdbb7ea877fb | |
| parent | 63c95654d8256db8aed2a4699ad6eba359400ef8 (diff) | |
| parent | 2aca46ce1b5c4b7d76566de72b16640ec674c008 (diff) | |
Merge tag 'metag-for-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag
Pull Metag architecture changes from James Hogan:
- Remove unused NUMA definition (SD_NODE_INIT)
- Refactor signal code to use struct ksignal
- IRQ migration cleanup to use irq_set_affinity
- Clean up main Kconfig file a little
* tag 'metag-for-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag:
sched: remove unused SCHED_INIT_NODE
metag: Use get_signal() signal_setup_done()
metag: Fix METAG Kconfig symbol select ordering
metag: Use irq_set_affinity instead of homebrewn code
| -rw-r--r-- | arch/metag/Kconfig | 2 | ||||
| -rw-r--r-- | arch/metag/include/asm/topology.h | 27 | ||||
| -rw-r--r-- | arch/metag/kernel/irq.c | 22 | ||||
| -rw-r--r-- | arch/metag/kernel/signal.c | 48 |
4 files changed, 25 insertions, 74 deletions
diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig index e56abd2c1b4f..b1d3c9c0eff8 100644 --- a/arch/metag/Kconfig +++ b/arch/metag/Kconfig | |||
| @@ -9,6 +9,7 @@ config METAG | |||
| 9 | select HAVE_ARCH_TRACEHOOK | 9 | select HAVE_ARCH_TRACEHOOK |
| 10 | select HAVE_C_RECORDMCOUNT | 10 | select HAVE_C_RECORDMCOUNT |
| 11 | select HAVE_DEBUG_KMEMLEAK | 11 | select HAVE_DEBUG_KMEMLEAK |
| 12 | select HAVE_DEBUG_STACKOVERFLOW | ||
| 12 | select HAVE_DYNAMIC_FTRACE | 13 | select HAVE_DYNAMIC_FTRACE |
| 13 | select HAVE_FTRACE_MCOUNT_RECORD | 14 | select HAVE_FTRACE_MCOUNT_RECORD |
| 14 | select HAVE_FUNCTION_TRACER | 15 | select HAVE_FUNCTION_TRACER |
| @@ -29,7 +30,6 @@ config METAG | |||
| 29 | select OF | 30 | select OF |
| 30 | select OF_EARLY_FLATTREE | 31 | select OF_EARLY_FLATTREE |
| 31 | select SPARSE_IRQ | 32 | select SPARSE_IRQ |
| 32 | select HAVE_DEBUG_STACKOVERFLOW | ||
| 33 | 33 | ||
| 34 | config STACKTRACE_SUPPORT | 34 | config STACKTRACE_SUPPORT |
| 35 | def_bool y | 35 | def_bool y |
diff --git a/arch/metag/include/asm/topology.h b/arch/metag/include/asm/topology.h index 8e9c0b3b9691..e95f874ded1b 100644 --- a/arch/metag/include/asm/topology.h +++ b/arch/metag/include/asm/topology.h | |||
| @@ -3,33 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #ifdef CONFIG_NUMA | 4 | #ifdef CONFIG_NUMA |
| 5 | 5 | ||
| 6 | /* sched_domains SD_NODE_INIT for Meta machines */ | ||
| 7 | #define SD_NODE_INIT (struct sched_domain) { \ | ||
| 8 | .parent = NULL, \ | ||
| 9 | .child = NULL, \ | ||
| 10 | .groups = NULL, \ | ||
| 11 | .min_interval = 8, \ | ||
| 12 | .max_interval = 32, \ | ||
| 13 | .busy_factor = 32, \ | ||
| 14 | .imbalance_pct = 125, \ | ||
| 15 | .cache_nice_tries = 2, \ | ||
| 16 | .busy_idx = 3, \ | ||
| 17 | .idle_idx = 2, \ | ||
| 18 | .newidle_idx = 0, \ | ||
| 19 | .wake_idx = 0, \ | ||
| 20 | .forkexec_idx = 0, \ | ||
| 21 | .flags = SD_LOAD_BALANCE \ | ||
| 22 | | SD_BALANCE_FORK \ | ||
| 23 | | SD_BALANCE_EXEC \ | ||
| 24 | | SD_BALANCE_NEWIDLE \ | ||
| 25 | | SD_SERIALIZE, \ | ||
| 26 | .last_balance = jiffies, \ | ||
| 27 | .balance_interval = 1, \ | ||
| 28 | .nr_balance_failed = 0, \ | ||
| 29 | .max_newidle_lb_cost = 0, \ | ||
| 30 | .next_decay_max_lb_cost = jiffies, \ | ||
| 31 | } | ||
| 32 | |||
| 33 | #define cpu_to_node(cpu) ((void)(cpu), 0) | 6 | #define cpu_to_node(cpu) ((void)(cpu), 0) |
| 34 | #define parent_node(node) ((void)(node), 0) | 7 | #define parent_node(node) ((void)(node), 0) |
| 35 | 8 | ||
diff --git a/arch/metag/kernel/irq.c b/arch/metag/kernel/irq.c index 3b4b7f6c0950..5385dd1216b7 100644 --- a/arch/metag/kernel/irq.c +++ b/arch/metag/kernel/irq.c | |||
| @@ -261,18 +261,6 @@ int __init arch_probe_nr_irqs(void) | |||
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | #ifdef CONFIG_HOTPLUG_CPU | 263 | #ifdef CONFIG_HOTPLUG_CPU |
| 264 | static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu) | ||
| 265 | { | ||
| 266 | struct irq_desc *desc = irq_to_desc(irq); | ||
| 267 | struct irq_chip *chip = irq_data_get_irq_chip(data); | ||
| 268 | unsigned long flags; | ||
| 269 | |||
| 270 | raw_spin_lock_irqsave(&desc->lock, flags); | ||
| 271 | if (chip->irq_set_affinity) | ||
| 272 | chip->irq_set_affinity(data, cpumask_of(cpu), false); | ||
| 273 | raw_spin_unlock_irqrestore(&desc->lock, flags); | ||
| 274 | } | ||
| 275 | |||
| 276 | /* | 264 | /* |
| 277 | * The CPU has been marked offline. Migrate IRQs off this CPU. If | 265 | * The CPU has been marked offline. Migrate IRQs off this CPU. If |
| 278 | * the affinity settings do not allow other CPUs, force them onto any | 266 | * the affinity settings do not allow other CPUs, force them onto any |
| @@ -281,10 +269,9 @@ static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu) | |||
| 281 | void migrate_irqs(void) | 269 | void migrate_irqs(void) |
| 282 | { | 270 | { |
| 283 | unsigned int i, cpu = smp_processor_id(); | 271 | unsigned int i, cpu = smp_processor_id(); |
| 284 | struct irq_desc *desc; | ||
| 285 | 272 | ||
| 286 | for_each_irq_desc(i, desc) { | 273 | for_each_active_irq(i) { |
| 287 | struct irq_data *data = irq_desc_get_irq_data(desc); | 274 | struct irq_data *data = irq_get_irq_data(i); |
| 288 | unsigned int newcpu; | 275 | unsigned int newcpu; |
| 289 | 276 | ||
| 290 | if (irqd_is_per_cpu(data)) | 277 | if (irqd_is_per_cpu(data)) |
| @@ -300,11 +287,8 @@ void migrate_irqs(void) | |||
| 300 | i, cpu); | 287 | i, cpu); |
| 301 | 288 | ||
| 302 | cpumask_setall(data->affinity); | 289 | cpumask_setall(data->affinity); |
| 303 | newcpu = cpumask_any_and(data->affinity, | ||
| 304 | cpu_online_mask); | ||
| 305 | } | 290 | } |
| 306 | 291 | irq_set_affinity(i, data->affinity); | |
| 307 | route_irq(data, i, newcpu); | ||
| 308 | } | 292 | } |
| 309 | } | 293 | } |
| 310 | #endif /* CONFIG_HOTPLUG_CPU */ | 294 | #endif /* CONFIG_HOTPLUG_CPU */ |
diff --git a/arch/metag/kernel/signal.c b/arch/metag/kernel/signal.c index 3be61cf0b147..b9e4a82d2bd4 100644 --- a/arch/metag/kernel/signal.c +++ b/arch/metag/kernel/signal.c | |||
| @@ -152,18 +152,18 @@ static void __user *get_sigframe(struct k_sigaction *ka, unsigned long sp, | |||
| 152 | return (void __user *)sp; | 152 | return (void __user *)sp; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 155 | static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, |
| 156 | sigset_t *set, struct pt_regs *regs) | 156 | struct pt_regs *regs) |
| 157 | { | 157 | { |
| 158 | struct rt_sigframe __user *frame; | 158 | struct rt_sigframe __user *frame; |
| 159 | int err = -EFAULT; | 159 | int err; |
| 160 | unsigned long code; | 160 | unsigned long code; |
| 161 | 161 | ||
| 162 | frame = get_sigframe(ka, regs->REG_SP, sizeof(*frame)); | 162 | frame = get_sigframe(&ksig->ka, regs->REG_SP, sizeof(*frame)); |
| 163 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 163 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
| 164 | goto out; | 164 | return -EFAULT; |
| 165 | 165 | ||
| 166 | err = copy_siginfo_to_user(&frame->info, info); | 166 | err = copy_siginfo_to_user(&frame->info, &ksig->info); |
| 167 | 167 | ||
| 168 | /* Create the ucontext. */ | 168 | /* Create the ucontext. */ |
| 169 | err |= __put_user(0, &frame->uc.uc_flags); | 169 | err |= __put_user(0, &frame->uc.uc_flags); |
| @@ -174,7 +174,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
| 174 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); | 174 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); |
| 175 | 175 | ||
| 176 | if (err) | 176 | if (err) |
| 177 | goto out; | 177 | return -EFAULT; |
| 178 | 178 | ||
| 179 | /* Set up to return from userspace. */ | 179 | /* Set up to return from userspace. */ |
| 180 | 180 | ||
| @@ -187,15 +187,15 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
| 187 | err |= __put_user(code, (unsigned long __user *)(&frame->retcode[1])); | 187 | err |= __put_user(code, (unsigned long __user *)(&frame->retcode[1])); |
| 188 | 188 | ||
| 189 | if (err) | 189 | if (err) |
| 190 | goto out; | 190 | return -EFAULT; |
| 191 | 191 | ||
| 192 | /* Set up registers for signal handler */ | 192 | /* Set up registers for signal handler */ |
| 193 | regs->REG_RTP = (unsigned long) frame->retcode; | 193 | regs->REG_RTP = (unsigned long) frame->retcode; |
| 194 | regs->REG_SP = (unsigned long) frame + sizeof(*frame); | 194 | regs->REG_SP = (unsigned long) frame + sizeof(*frame); |
| 195 | regs->REG_ARG1 = sig; | 195 | regs->REG_ARG1 = ksig->sig; |
| 196 | regs->REG_ARG2 = (unsigned long) &frame->info; | 196 | regs->REG_ARG2 = (unsigned long) &frame->info; |
| 197 | regs->REG_ARG3 = (unsigned long) &frame->uc; | 197 | regs->REG_ARG3 = (unsigned long) &frame->uc; |
| 198 | regs->REG_PC = (unsigned long) ka->sa.sa_handler; | 198 | regs->REG_PC = (unsigned long) ksig->ka.sa.sa_handler; |
| 199 | 199 | ||
| 200 | pr_debug("SIG deliver (%s:%d): sp=%p pc=%08x pr=%08x\n", | 200 | pr_debug("SIG deliver (%s:%d): sp=%p pc=%08x pr=%08x\n", |
| 201 | current->comm, current->pid, frame, regs->REG_PC, | 201 | current->comm, current->pid, frame, regs->REG_PC, |
| @@ -205,24 +205,19 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
| 205 | * effective cache flush - directed rather than 'full flush'. | 205 | * effective cache flush - directed rather than 'full flush'. |
| 206 | */ | 206 | */ |
| 207 | flush_cache_sigtramp(regs->REG_RTP, sizeof(frame->retcode)); | 207 | flush_cache_sigtramp(regs->REG_RTP, sizeof(frame->retcode)); |
| 208 | out: | 208 | |
| 209 | if (err) { | ||
| 210 | force_sigsegv(sig, current); | ||
| 211 | return -EFAULT; | ||
| 212 | } | ||
| 213 | return 0; | 209 | return 0; |
| 214 | } | 210 | } |
| 215 | 211 | ||
| 216 | static void handle_signal(unsigned long sig, siginfo_t *info, | 212 | static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
| 217 | struct k_sigaction *ka, struct pt_regs *regs) | ||
| 218 | { | 213 | { |
| 219 | sigset_t *oldset = sigmask_to_save(); | 214 | sigset_t *oldset = sigmask_to_save(); |
| 215 | int ret; | ||
| 220 | 216 | ||
| 221 | /* Set up the stack frame */ | 217 | /* Set up the stack frame */ |
| 222 | if (setup_rt_frame(sig, ka, info, oldset, regs)) | 218 | ret = setup_rt_frame(ksig, oldset, regs); |
| 223 | return; | ||
| 224 | 219 | ||
| 225 | signal_delivered(sig, info, ka, regs, test_thread_flag(TIF_SINGLESTEP)); | 220 | signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP)); |
| 226 | } | 221 | } |
| 227 | 222 | ||
| 228 | /* | 223 | /* |
| @@ -235,10 +230,8 @@ static void handle_signal(unsigned long sig, siginfo_t *info, | |||
| 235 | static int do_signal(struct pt_regs *regs, int syscall) | 230 | static int do_signal(struct pt_regs *regs, int syscall) |
| 236 | { | 231 | { |
| 237 | unsigned int retval = 0, continue_addr = 0, restart_addr = 0; | 232 | unsigned int retval = 0, continue_addr = 0, restart_addr = 0; |
| 238 | struct k_sigaction ka; | ||
| 239 | siginfo_t info; | ||
| 240 | int signr; | ||
| 241 | int restart = 0; | 233 | int restart = 0; |
| 234 | struct ksignal ksig; | ||
| 242 | 235 | ||
| 243 | /* | 236 | /* |
| 244 | * By the end of rt_sigreturn the context describes the point that the | 237 | * By the end of rt_sigreturn the context describes the point that the |
| @@ -275,7 +268,8 @@ static int do_signal(struct pt_regs *regs, int syscall) | |||
| 275 | * Get the signal to deliver. When running under ptrace, at this point | 268 | * Get the signal to deliver. When running under ptrace, at this point |
| 276 | * the debugger may change all our registers ... | 269 | * the debugger may change all our registers ... |
| 277 | */ | 270 | */ |
| 278 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 271 | get_signal(&ksig); |
| 272 | |||
| 279 | /* | 273 | /* |
| 280 | * Depending on the signal settings we may need to revert the decision | 274 | * Depending on the signal settings we may need to revert the decision |
| 281 | * to restart the system call. But skip this if a debugger has chosen to | 275 | * to restart the system call. But skip this if a debugger has chosen to |
| @@ -283,19 +277,19 @@ static int do_signal(struct pt_regs *regs, int syscall) | |||
| 283 | */ | 277 | */ |
| 284 | if (regs->REG_PC != restart_addr) | 278 | if (regs->REG_PC != restart_addr) |
| 285 | restart = 0; | 279 | restart = 0; |
| 286 | if (signr > 0) { | 280 | if (ksig.sig > 0) { |
| 287 | if (unlikely(restart)) { | 281 | if (unlikely(restart)) { |
| 288 | if (retval == -ERESTARTNOHAND | 282 | if (retval == -ERESTARTNOHAND |
| 289 | || retval == -ERESTART_RESTARTBLOCK | 283 | || retval == -ERESTART_RESTARTBLOCK |
| 290 | || (retval == -ERESTARTSYS | 284 | || (retval == -ERESTARTSYS |
| 291 | && !(ka.sa.sa_flags & SA_RESTART))) { | 285 | && !(ksig.ka.sa.sa_flags & SA_RESTART))) { |
| 292 | regs->REG_RETVAL = -EINTR; | 286 | regs->REG_RETVAL = -EINTR; |
| 293 | regs->REG_PC = continue_addr; | 287 | regs->REG_PC = continue_addr; |
| 294 | } | 288 | } |
| 295 | } | 289 | } |
| 296 | 290 | ||
| 297 | /* Whee! Actually deliver the signal. */ | 291 | /* Whee! Actually deliver the signal. */ |
| 298 | handle_signal(signr, &info, &ka, regs); | 292 | handle_signal(&ksig, regs); |
| 299 | return 0; | 293 | return 0; |
| 300 | } | 294 | } |
| 301 | 295 | ||
