aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-07-03 18:13:18 -0400
committerTejun Heo <tj@kernel.org>2009-07-03 18:13:18 -0400
commitc43768cbb7655ea5ff782ae250f6e2ef4297cf98 (patch)
tree3982e41dde3eecaa3739a5d1a8ed18d04bd74f01 /arch/s390/kernel
parent1a8dd307cc0a2119be4e578c517795464e6dabba (diff)
parent746a99a5af60ee676afa2ba469ccd1373493c7e7 (diff)
Merge branch 'master' into for-next
Pull linus#master to merge PER_CPU_DEF_ATTRIBUTES and alpha build fix changes. As alpha in percpu tree uses 'weak' attribute instead of inline assembly, there's no need for __used attribute. Conflicts: arch/alpha/include/asm/percpu.h arch/mn10300/kernel/vmlinux.lds.S include/linux/percpu-defs.h
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/kprobes.c18
-rw-r--r--arch/s390/kernel/smp.c28
-rw-r--r--arch/s390/kernel/time.c16
-rw-r--r--arch/s390/kernel/vtime.c27
4 files changed, 46 insertions, 43 deletions
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 9bb2f6241d9f..86783efa24ee 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -154,39 +154,35 @@ void __kprobes get_instruction_type(struct arch_specific_insn *ainsn)
154 154
155static int __kprobes swap_instruction(void *aref) 155static int __kprobes swap_instruction(void *aref)
156{ 156{
157 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
158 unsigned long status = kcb->kprobe_status;
157 struct ins_replace_args *args = aref; 159 struct ins_replace_args *args = aref;
160 int rc;
158 161
159 return probe_kernel_write(args->ptr, &args->new, sizeof(args->new)); 162 kcb->kprobe_status = KPROBE_SWAP_INST;
163 rc = probe_kernel_write(args->ptr, &args->new, sizeof(args->new));
164 kcb->kprobe_status = status;
165 return rc;
160} 166}
161 167
162void __kprobes arch_arm_kprobe(struct kprobe *p) 168void __kprobes arch_arm_kprobe(struct kprobe *p)
163{ 169{
164 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
165 unsigned long status = kcb->kprobe_status;
166 struct ins_replace_args args; 170 struct ins_replace_args args;
167 171
168 args.ptr = p->addr; 172 args.ptr = p->addr;
169 args.old = p->opcode; 173 args.old = p->opcode;
170 args.new = BREAKPOINT_INSTRUCTION; 174 args.new = BREAKPOINT_INSTRUCTION;
171
172 kcb->kprobe_status = KPROBE_SWAP_INST;
173 stop_machine(swap_instruction, &args, NULL); 175 stop_machine(swap_instruction, &args, NULL);
174 kcb->kprobe_status = status;
175} 176}
176 177
177void __kprobes arch_disarm_kprobe(struct kprobe *p) 178void __kprobes arch_disarm_kprobe(struct kprobe *p)
178{ 179{
179 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
180 unsigned long status = kcb->kprobe_status;
181 struct ins_replace_args args; 180 struct ins_replace_args args;
182 181
183 args.ptr = p->addr; 182 args.ptr = p->addr;
184 args.old = BREAKPOINT_INSTRUCTION; 183 args.old = BREAKPOINT_INSTRUCTION;
185 args.new = p->opcode; 184 args.new = p->opcode;
186
187 kcb->kprobe_status = KPROBE_SWAP_INST;
188 stop_machine(swap_instruction, &args, NULL); 185 stop_machine(swap_instruction, &args, NULL);
189 kcb->kprobe_status = status;
190} 186}
191 187
192void __kprobes arch_remove_kprobe(struct kprobe *p) 188void __kprobes arch_remove_kprobe(struct kprobe *p)
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index fd8e3111a4e8..2270730f5354 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -856,13 +856,20 @@ static ssize_t show_idle_count(struct sys_device *dev,
856{ 856{
857 struct s390_idle_data *idle; 857 struct s390_idle_data *idle;
858 unsigned long long idle_count; 858 unsigned long long idle_count;
859 unsigned int sequence;
859 860
860 idle = &per_cpu(s390_idle, dev->id); 861 idle = &per_cpu(s390_idle, dev->id);
861 spin_lock(&idle->lock); 862repeat:
863 sequence = idle->sequence;
864 smp_rmb();
865 if (sequence & 1)
866 goto repeat;
862 idle_count = idle->idle_count; 867 idle_count = idle->idle_count;
863 if (idle->idle_enter) 868 if (idle->idle_enter)
864 idle_count++; 869 idle_count++;
865 spin_unlock(&idle->lock); 870 smp_rmb();
871 if (idle->sequence != sequence)
872 goto repeat;
866 return sprintf(buf, "%llu\n", idle_count); 873 return sprintf(buf, "%llu\n", idle_count);
867} 874}
868static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); 875static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL);
@@ -872,15 +879,22 @@ static ssize_t show_idle_time(struct sys_device *dev,
872{ 879{
873 struct s390_idle_data *idle; 880 struct s390_idle_data *idle;
874 unsigned long long now, idle_time, idle_enter; 881 unsigned long long now, idle_time, idle_enter;
882 unsigned int sequence;
875 883
876 idle = &per_cpu(s390_idle, dev->id); 884 idle = &per_cpu(s390_idle, dev->id);
877 spin_lock(&idle->lock);
878 now = get_clock(); 885 now = get_clock();
886repeat:
887 sequence = idle->sequence;
888 smp_rmb();
889 if (sequence & 1)
890 goto repeat;
879 idle_time = idle->idle_time; 891 idle_time = idle->idle_time;
880 idle_enter = idle->idle_enter; 892 idle_enter = idle->idle_enter;
881 if (idle_enter != 0ULL && idle_enter < now) 893 if (idle_enter != 0ULL && idle_enter < now)
882 idle_time += now - idle_enter; 894 idle_time += now - idle_enter;
883 spin_unlock(&idle->lock); 895 smp_rmb();
896 if (idle->sequence != sequence)
897 goto repeat;
884 return sprintf(buf, "%llu\n", idle_time >> 12); 898 return sprintf(buf, "%llu\n", idle_time >> 12);
885} 899}
886static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL); 900static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL);
@@ -908,11 +922,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
908 case CPU_ONLINE: 922 case CPU_ONLINE:
909 case CPU_ONLINE_FROZEN: 923 case CPU_ONLINE_FROZEN:
910 idle = &per_cpu(s390_idle, cpu); 924 idle = &per_cpu(s390_idle, cpu);
911 spin_lock_irq(&idle->lock); 925 memset(idle, 0, sizeof(struct s390_idle_data));
912 idle->idle_enter = 0;
913 idle->idle_time = 0;
914 idle->idle_count = 0;
915 spin_unlock_irq(&idle->lock);
916 if (sysfs_create_group(&s->kobj, &cpu_online_attr_group)) 926 if (sysfs_create_group(&s->kobj, &cpu_online_attr_group))
917 return NOTIFY_BAD; 927 return NOTIFY_BAD;
918 break; 928 break;
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 215330a2c128..d4c8e9c47c81 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -36,7 +36,6 @@
36#include <linux/notifier.h> 36#include <linux/notifier.h>
37#include <linux/clocksource.h> 37#include <linux/clocksource.h>
38#include <linux/clockchips.h> 38#include <linux/clockchips.h>
39#include <linux/bootmem.h>
40#include <asm/uaccess.h> 39#include <asm/uaccess.h>
41#include <asm/delay.h> 40#include <asm/delay.h>
42#include <asm/s390_ext.h> 41#include <asm/s390_ext.h>
@@ -62,9 +61,6 @@
62 61
63u64 sched_clock_base_cc = -1; /* Force to data section. */ 62u64 sched_clock_base_cc = -1; /* Force to data section. */
64 63
65static ext_int_info_t ext_int_info_cc;
66static ext_int_info_t ext_int_etr_cc;
67
68static DEFINE_PER_CPU(struct clock_event_device, comparators); 64static DEFINE_PER_CPU(struct clock_event_device, comparators);
69 65
70/* 66/*
@@ -255,15 +251,11 @@ void __init time_init(void)
255 stp_reset(); 251 stp_reset();
256 252
257 /* request the clock comparator external interrupt */ 253 /* request the clock comparator external interrupt */
258 if (register_early_external_interrupt(0x1004, 254 if (register_external_interrupt(0x1004, clock_comparator_interrupt))
259 clock_comparator_interrupt,
260 &ext_int_info_cc) != 0)
261 panic("Couldn't request external interrupt 0x1004"); 255 panic("Couldn't request external interrupt 0x1004");
262 256
263 /* request the timing alert external interrupt */ 257 /* request the timing alert external interrupt */
264 if (register_early_external_interrupt(0x1406, 258 if (register_external_interrupt(0x1406, timing_alert_interrupt))
265 timing_alert_interrupt,
266 &ext_int_etr_cc) != 0)
267 panic("Couldn't request external interrupt 0x1406"); 259 panic("Couldn't request external interrupt 0x1406");
268 260
269 if (clocksource_register(&clocksource_tod) != 0) 261 if (clocksource_register(&clocksource_tod) != 0)
@@ -1445,14 +1437,14 @@ static void __init stp_reset(void)
1445{ 1437{
1446 int rc; 1438 int rc;
1447 1439
1448 stp_page = alloc_bootmem_pages(PAGE_SIZE); 1440 stp_page = (void *) get_zeroed_page(GFP_ATOMIC);
1449 rc = chsc_sstpc(stp_page, STP_OP_CTRL, 0x0000); 1441 rc = chsc_sstpc(stp_page, STP_OP_CTRL, 0x0000);
1450 if (rc == 0) 1442 if (rc == 0)
1451 set_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags); 1443 set_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags);
1452 else if (stp_online) { 1444 else if (stp_online) {
1453 pr_warning("The real or virtual hardware system does " 1445 pr_warning("The real or virtual hardware system does "
1454 "not provide an STP interface\n"); 1446 "not provide an STP interface\n");
1455 free_bootmem((unsigned long) stp_page, PAGE_SIZE); 1447 free_page((unsigned long) stp_page);
1456 stp_page = NULL; 1448 stp_page = NULL;
1457 stp_online = 0; 1449 stp_online = 0;
1458 } 1450 }
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index c8eb7255332b..c41bb0d416e1 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -25,13 +25,9 @@
25#include <asm/irq_regs.h> 25#include <asm/irq_regs.h>
26#include <asm/cputime.h> 26#include <asm/cputime.h>
27 27
28static ext_int_info_t ext_int_info_timer;
29
30static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer); 28static DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
31 29
32DEFINE_PER_CPU(struct s390_idle_data, s390_idle) = { 30DEFINE_PER_CPU(struct s390_idle_data, s390_idle);
33 .lock = __SPIN_LOCK_UNLOCKED(s390_idle.lock)
34};
35 31
36static inline __u64 get_vtimer(void) 32static inline __u64 get_vtimer(void)
37{ 33{
@@ -153,11 +149,13 @@ void vtime_start_cpu(void)
153 vq->elapsed -= vq->idle - S390_lowcore.async_enter_timer; 149 vq->elapsed -= vq->idle - S390_lowcore.async_enter_timer;
154 } 150 }
155 151
156 spin_lock(&idle->lock); 152 idle->sequence++;
153 smp_wmb();
157 idle->idle_time += idle_time; 154 idle->idle_time += idle_time;
158 idle->idle_enter = 0ULL; 155 idle->idle_enter = 0ULL;
159 idle->idle_count++; 156 idle->idle_count++;
160 spin_unlock(&idle->lock); 157 smp_wmb();
158 idle->sequence++;
161} 159}
162 160
163void vtime_stop_cpu(void) 161void vtime_stop_cpu(void)
@@ -244,15 +242,23 @@ cputime64_t s390_get_idle_time(int cpu)
244{ 242{
245 struct s390_idle_data *idle; 243 struct s390_idle_data *idle;
246 unsigned long long now, idle_time, idle_enter; 244 unsigned long long now, idle_time, idle_enter;
245 unsigned int sequence;
247 246
248 idle = &per_cpu(s390_idle, cpu); 247 idle = &per_cpu(s390_idle, cpu);
249 spin_lock(&idle->lock); 248
250 now = get_clock(); 249 now = get_clock();
250repeat:
251 sequence = idle->sequence;
252 smp_rmb();
253 if (sequence & 1)
254 goto repeat;
251 idle_time = 0; 255 idle_time = 0;
252 idle_enter = idle->idle_enter; 256 idle_enter = idle->idle_enter;
253 if (idle_enter != 0ULL && idle_enter < now) 257 if (idle_enter != 0ULL && idle_enter < now)
254 idle_time = now - idle_enter; 258 idle_time = now - idle_enter;
255 spin_unlock(&idle->lock); 259 smp_rmb();
260 if (idle->sequence != sequence)
261 goto repeat;
256 return idle_time; 262 return idle_time;
257} 263}
258 264
@@ -557,8 +563,7 @@ void init_cpu_vtimer(void)
557void __init vtime_init(void) 563void __init vtime_init(void)
558{ 564{
559 /* request the cpu timer external interrupt */ 565 /* request the cpu timer external interrupt */
560 if (register_early_external_interrupt(0x1005, do_cpu_timer_interrupt, 566 if (register_external_interrupt(0x1005, do_cpu_timer_interrupt))
561 &ext_int_info_timer) != 0)
562 panic("Couldn't request external interrupt 0x1005"); 567 panic("Couldn't request external interrupt 0x1005");
563 568
564 /* Enable cpu timer interrupts on the boot cpu. */ 569 /* Enable cpu timer interrupts on the boot cpu. */