aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/kernel/hardwall.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-07 11:36:54 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-08-13 16:26:01 -0400
commitbc1a298f4e04833db4c430df59b90039f0170515 (patch)
tree802da739309efeab62317f62ec4f1989f3f7d8dd /arch/tile/kernel/hardwall.c
parent1182b69cb24c4f7d7ee8c8afe41b5ab2bc05a15b (diff)
tile: support CONFIG_PREEMPT
This change adds support for CONFIG_PREEMPT (full kernel preemption). In addition to the core support, this change includes a number of places where we fix up uses of smp_processor_id() and per-cpu variables. I also eliminate the PAGE_HOME_HERE and PAGE_HOME_UNKNOWN values for page homing, as it turns out they weren't being used. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel/hardwall.c')
-rw-r--r--arch/tile/kernel/hardwall.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c
index 7db8893d4fc5..df27a1fd94a3 100644
--- a/arch/tile/kernel/hardwall.c
+++ b/arch/tile/kernel/hardwall.c
@@ -272,9 +272,9 @@ static void hardwall_setup_func(void *info)
272 struct hardwall_info *r = info; 272 struct hardwall_info *r = info;
273 struct hardwall_type *hwt = r->type; 273 struct hardwall_type *hwt = r->type;
274 274
275 int cpu = smp_processor_id(); 275 int cpu = smp_processor_id(); /* on_each_cpu disables preemption */
276 int x = cpu % smp_width; 276 int x = cpu_x(cpu);
277 int y = cpu / smp_width; 277 int y = cpu_y(cpu);
278 int bits = 0; 278 int bits = 0;
279 if (x == r->ulhc_x) 279 if (x == r->ulhc_x)
280 bits |= W_PROTECT; 280 bits |= W_PROTECT;
@@ -317,6 +317,7 @@ static void hardwall_protect_rectangle(struct hardwall_info *r)
317 on_each_cpu_mask(&rect_cpus, hardwall_setup_func, r, 1); 317 on_each_cpu_mask(&rect_cpus, hardwall_setup_func, r, 1);
318} 318}
319 319
320/* Entered from INT_xDN_FIREWALL interrupt vector with irqs disabled. */
320void __kprobes do_hardwall_trap(struct pt_regs* regs, int fault_num) 321void __kprobes do_hardwall_trap(struct pt_regs* regs, int fault_num)
321{ 322{
322 struct hardwall_info *rect; 323 struct hardwall_info *rect;
@@ -325,7 +326,6 @@ void __kprobes do_hardwall_trap(struct pt_regs* regs, int fault_num)
325 struct siginfo info; 326 struct siginfo info;
326 int cpu = smp_processor_id(); 327 int cpu = smp_processor_id();
327 int found_processes; 328 int found_processes;
328 unsigned long flags;
329 struct pt_regs *old_regs = set_irq_regs(regs); 329 struct pt_regs *old_regs = set_irq_regs(regs);
330 330
331 irq_enter(); 331 irq_enter();
@@ -346,7 +346,7 @@ void __kprobes do_hardwall_trap(struct pt_regs* regs, int fault_num)
346 BUG_ON(hwt->disabled); 346 BUG_ON(hwt->disabled);
347 347
348 /* This tile trapped a network access; find the rectangle. */ 348 /* This tile trapped a network access; find the rectangle. */
349 spin_lock_irqsave(&hwt->lock, flags); 349 spin_lock(&hwt->lock);
350 list_for_each_entry(rect, &hwt->list, list) { 350 list_for_each_entry(rect, &hwt->list, list) {
351 if (cpumask_test_cpu(cpu, &rect->cpumask)) 351 if (cpumask_test_cpu(cpu, &rect->cpumask))
352 break; 352 break;
@@ -401,7 +401,7 @@ void __kprobes do_hardwall_trap(struct pt_regs* regs, int fault_num)
401 pr_notice("hardwall: no associated processes!\n"); 401 pr_notice("hardwall: no associated processes!\n");
402 402
403 done: 403 done:
404 spin_unlock_irqrestore(&hwt->lock, flags); 404 spin_unlock(&hwt->lock);
405 405
406 /* 406 /*
407 * We have to disable firewall interrupts now, or else when we 407 * We have to disable firewall interrupts now, or else when we
@@ -661,7 +661,7 @@ static int hardwall_deactivate(struct hardwall_type *hwt,
661 return -EINVAL; 661 return -EINVAL;
662 662
663 printk(KERN_DEBUG "Pid %d (%s) deactivated for %s hardwall: cpu %d\n", 663 printk(KERN_DEBUG "Pid %d (%s) deactivated for %s hardwall: cpu %d\n",
664 task->pid, task->comm, hwt->name, smp_processor_id()); 664 task->pid, task->comm, hwt->name, raw_smp_processor_id());
665 return 0; 665 return 0;
666} 666}
667 667
@@ -803,8 +803,8 @@ static void reset_xdn_network_state(struct hardwall_type *hwt)
803 /* Reset UDN coordinates to their standard value */ 803 /* Reset UDN coordinates to their standard value */
804 { 804 {
805 unsigned int cpu = smp_processor_id(); 805 unsigned int cpu = smp_processor_id();
806 unsigned int x = cpu % smp_width; 806 unsigned int x = cpu_x(cpu);
807 unsigned int y = cpu / smp_width; 807 unsigned int y = cpu_y(cpu);
808 __insn_mtspr(SPR_UDN_TILE_COORD, (x << 18) | (y << 7)); 808 __insn_mtspr(SPR_UDN_TILE_COORD, (x << 18) | (y << 7));
809 } 809 }
810 810