aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/appldata
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/appldata')
-rw-r--r--arch/s390/appldata/appldata.h2
-rw-r--r--arch/s390/appldata/appldata_base.c132
-rw-r--r--arch/s390/appldata/appldata_mem.c4
-rw-r--r--arch/s390/appldata/appldata_net_sum.c4
-rw-r--r--arch/s390/appldata/appldata_os.c4
5 files changed, 17 insertions, 129 deletions
diff --git a/arch/s390/appldata/appldata.h b/arch/s390/appldata/appldata.h
index f0b23fc759ba..4a67f2b5f6aa 100644
--- a/arch/s390/appldata/appldata.h
+++ b/arch/s390/appldata/appldata.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/s390/appldata/appldata.h
3 *
4 * Definitions and interface for Linux - z/VM Monitor Stream. 2 * Definitions and interface for Linux - z/VM Monitor Stream.
5 * 3 *
6 * Copyright IBM Corp. 2003, 2008 4 * Copyright IBM Corp. 2003, 2008
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index 24bff4f1cc52..bae0f402bf2a 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * arch/s390/appldata/appldata_base.c
3 *
4 * Base infrastructure for Linux-z/VM Monitor Stream, Stage 1. 2 * Base infrastructure for Linux-z/VM Monitor Stream, Stage 1.
5 * Exports appldata_register_ops() and appldata_unregister_ops() for the 3 * Exports appldata_register_ops() and appldata_unregister_ops() for the
6 * data gathering modules. 4 * data gathering modules.
@@ -29,7 +27,7 @@
29#include <linux/suspend.h> 27#include <linux/suspend.h>
30#include <linux/platform_device.h> 28#include <linux/platform_device.h>
31#include <asm/appldata.h> 29#include <asm/appldata.h>
32#include <asm/timer.h> 30#include <asm/vtimer.h>
33#include <asm/uaccess.h> 31#include <asm/uaccess.h>
34#include <asm/io.h> 32#include <asm/io.h>
35#include <asm/smp.h> 33#include <asm/smp.h>
@@ -84,8 +82,7 @@ static struct ctl_table appldata_dir_table[] = {
84/* 82/*
85 * Timer 83 * Timer
86 */ 84 */
87static DEFINE_PER_CPU(struct vtimer_list, appldata_timer); 85static struct vtimer_list appldata_timer;
88static atomic_t appldata_expire_count = ATOMIC_INIT(0);
89 86
90static DEFINE_SPINLOCK(appldata_timer_lock); 87static DEFINE_SPINLOCK(appldata_timer_lock);
91static int appldata_interval = APPLDATA_CPU_INTERVAL; 88static int appldata_interval = APPLDATA_CPU_INTERVAL;
@@ -115,10 +112,7 @@ static LIST_HEAD(appldata_ops_list);
115 */ 112 */
116static void appldata_timer_function(unsigned long data) 113static void appldata_timer_function(unsigned long data)
117{ 114{
118 if (atomic_dec_and_test(&appldata_expire_count)) { 115 queue_work(appldata_wq, (struct work_struct *) data);
119 atomic_set(&appldata_expire_count, num_online_cpus());
120 queue_work(appldata_wq, (struct work_struct *) data);
121 }
122} 116}
123 117
124/* 118/*
@@ -131,7 +125,6 @@ static void appldata_work_fn(struct work_struct *work)
131 struct list_head *lh; 125 struct list_head *lh;
132 struct appldata_ops *ops; 126 struct appldata_ops *ops;
133 127
134 get_online_cpus();
135 mutex_lock(&appldata_ops_mutex); 128 mutex_lock(&appldata_ops_mutex);
136 list_for_each(lh, &appldata_ops_list) { 129 list_for_each(lh, &appldata_ops_list) {
137 ops = list_entry(lh, struct appldata_ops, list); 130 ops = list_entry(lh, struct appldata_ops, list);
@@ -140,7 +133,6 @@ static void appldata_work_fn(struct work_struct *work)
140 } 133 }
141 } 134 }
142 mutex_unlock(&appldata_ops_mutex); 135 mutex_unlock(&appldata_ops_mutex);
143 put_online_cpus();
144} 136}
145 137
146/* 138/*
@@ -168,20 +160,6 @@ int appldata_diag(char record_nr, u16 function, unsigned long buffer,
168 160
169/****************************** /proc stuff **********************************/ 161/****************************** /proc stuff **********************************/
170 162
171/*
172 * appldata_mod_vtimer_wrap()
173 *
174 * wrapper function for mod_virt_timer(), because smp_call_function_single()
175 * accepts only one parameter.
176 */
177static void __appldata_mod_vtimer_wrap(void *p) {
178 struct {
179 struct vtimer_list *timer;
180 u64 expires;
181 } *args = p;
182 mod_virt_timer_periodic(args->timer, args->expires);
183}
184
185#define APPLDATA_ADD_TIMER 0 163#define APPLDATA_ADD_TIMER 0
186#define APPLDATA_DEL_TIMER 1 164#define APPLDATA_DEL_TIMER 1
187#define APPLDATA_MOD_TIMER 2 165#define APPLDATA_MOD_TIMER 2
@@ -192,49 +170,28 @@ static void __appldata_mod_vtimer_wrap(void *p) {
192 * Add, delete or modify virtual timers on all online cpus. 170 * Add, delete or modify virtual timers on all online cpus.
193 * The caller needs to get the appldata_timer_lock spinlock. 171 * The caller needs to get the appldata_timer_lock spinlock.
194 */ 172 */
195static void 173static void __appldata_vtimer_setup(int cmd)
196__appldata_vtimer_setup(int cmd)
197{ 174{
198 u64 per_cpu_interval; 175 u64 timer_interval = (u64) appldata_interval * 1000 * TOD_MICRO;
199 int i;
200 176
201 switch (cmd) { 177 switch (cmd) {
202 case APPLDATA_ADD_TIMER: 178 case APPLDATA_ADD_TIMER:
203 if (appldata_timer_active) 179 if (appldata_timer_active)
204 break; 180 break;
205 per_cpu_interval = (u64) (appldata_interval*1000 / 181 appldata_timer.expires = timer_interval;
206 num_online_cpus()) * TOD_MICRO; 182 add_virt_timer_periodic(&appldata_timer);
207 for_each_online_cpu(i) {
208 per_cpu(appldata_timer, i).expires = per_cpu_interval;
209 smp_call_function_single(i, add_virt_timer_periodic,
210 &per_cpu(appldata_timer, i),
211 1);
212 }
213 appldata_timer_active = 1; 183 appldata_timer_active = 1;
214 break; 184 break;
215 case APPLDATA_DEL_TIMER: 185 case APPLDATA_DEL_TIMER:
216 for_each_online_cpu(i) 186 del_virt_timer(&appldata_timer);
217 del_virt_timer(&per_cpu(appldata_timer, i));
218 if (!appldata_timer_active) 187 if (!appldata_timer_active)
219 break; 188 break;
220 appldata_timer_active = 0; 189 appldata_timer_active = 0;
221 atomic_set(&appldata_expire_count, num_online_cpus());
222 break; 190 break;
223 case APPLDATA_MOD_TIMER: 191 case APPLDATA_MOD_TIMER:
224 per_cpu_interval = (u64) (appldata_interval*1000 /
225 num_online_cpus()) * TOD_MICRO;
226 if (!appldata_timer_active) 192 if (!appldata_timer_active)
227 break; 193 break;
228 for_each_online_cpu(i) { 194 mod_virt_timer_periodic(&appldata_timer, timer_interval);
229 struct {
230 struct vtimer_list *timer;
231 u64 expires;
232 } args;
233 args.timer = &per_cpu(appldata_timer, i);
234 args.expires = per_cpu_interval;
235 smp_call_function_single(i, __appldata_mod_vtimer_wrap,
236 &args, 1);
237 }
238 } 195 }
239} 196}
240 197
@@ -265,14 +222,12 @@ appldata_timer_handler(ctl_table *ctl, int write,
265 len = *lenp; 222 len = *lenp;
266 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) 223 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len))
267 return -EFAULT; 224 return -EFAULT;
268 get_online_cpus();
269 spin_lock(&appldata_timer_lock); 225 spin_lock(&appldata_timer_lock);
270 if (buf[0] == '1') 226 if (buf[0] == '1')
271 __appldata_vtimer_setup(APPLDATA_ADD_TIMER); 227 __appldata_vtimer_setup(APPLDATA_ADD_TIMER);
272 else if (buf[0] == '0') 228 else if (buf[0] == '0')
273 __appldata_vtimer_setup(APPLDATA_DEL_TIMER); 229 __appldata_vtimer_setup(APPLDATA_DEL_TIMER);
274 spin_unlock(&appldata_timer_lock); 230 spin_unlock(&appldata_timer_lock);
275 put_online_cpus();
276out: 231out:
277 *lenp = len; 232 *lenp = len;
278 *ppos += len; 233 *ppos += len;
@@ -305,20 +260,17 @@ appldata_interval_handler(ctl_table *ctl, int write,
305 goto out; 260 goto out;
306 } 261 }
307 len = *lenp; 262 len = *lenp;
308 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) { 263 if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len))
309 return -EFAULT; 264 return -EFAULT;
310 }
311 interval = 0; 265 interval = 0;
312 sscanf(buf, "%i", &interval); 266 sscanf(buf, "%i", &interval);
313 if (interval <= 0) 267 if (interval <= 0)
314 return -EINVAL; 268 return -EINVAL;
315 269
316 get_online_cpus();
317 spin_lock(&appldata_timer_lock); 270 spin_lock(&appldata_timer_lock);
318 appldata_interval = interval; 271 appldata_interval = interval;
319 __appldata_vtimer_setup(APPLDATA_MOD_TIMER); 272 __appldata_vtimer_setup(APPLDATA_MOD_TIMER);
320 spin_unlock(&appldata_timer_lock); 273 spin_unlock(&appldata_timer_lock);
321 put_online_cpus();
322out: 274out:
323 *lenp = len; 275 *lenp = len;
324 *ppos += len; 276 *ppos += len;
@@ -485,14 +437,12 @@ static int appldata_freeze(struct device *dev)
485 int rc; 437 int rc;
486 struct list_head *lh; 438 struct list_head *lh;
487 439
488 get_online_cpus();
489 spin_lock(&appldata_timer_lock); 440 spin_lock(&appldata_timer_lock);
490 if (appldata_timer_active) { 441 if (appldata_timer_active) {
491 __appldata_vtimer_setup(APPLDATA_DEL_TIMER); 442 __appldata_vtimer_setup(APPLDATA_DEL_TIMER);
492 appldata_timer_suspended = 1; 443 appldata_timer_suspended = 1;
493 } 444 }
494 spin_unlock(&appldata_timer_lock); 445 spin_unlock(&appldata_timer_lock);
495 put_online_cpus();
496 446
497 mutex_lock(&appldata_ops_mutex); 447 mutex_lock(&appldata_ops_mutex);
498 list_for_each(lh, &appldata_ops_list) { 448 list_for_each(lh, &appldata_ops_list) {
@@ -516,14 +466,12 @@ static int appldata_restore(struct device *dev)
516 int rc; 466 int rc;
517 struct list_head *lh; 467 struct list_head *lh;
518 468
519 get_online_cpus();
520 spin_lock(&appldata_timer_lock); 469 spin_lock(&appldata_timer_lock);
521 if (appldata_timer_suspended) { 470 if (appldata_timer_suspended) {
522 __appldata_vtimer_setup(APPLDATA_ADD_TIMER); 471 __appldata_vtimer_setup(APPLDATA_ADD_TIMER);
523 appldata_timer_suspended = 0; 472 appldata_timer_suspended = 0;
524 } 473 }
525 spin_unlock(&appldata_timer_lock); 474 spin_unlock(&appldata_timer_lock);
526 put_online_cpus();
527 475
528 mutex_lock(&appldata_ops_mutex); 476 mutex_lock(&appldata_ops_mutex);
529 list_for_each(lh, &appldata_ops_list) { 477 list_for_each(lh, &appldata_ops_list) {
@@ -567,53 +515,6 @@ static struct platform_driver appldata_pdrv = {
567 515
568/******************************* init / exit *********************************/ 516/******************************* init / exit *********************************/
569 517
570static void __cpuinit appldata_online_cpu(int cpu)
571{
572 init_virt_timer(&per_cpu(appldata_timer, cpu));
573 per_cpu(appldata_timer, cpu).function = appldata_timer_function;
574 per_cpu(appldata_timer, cpu).data = (unsigned long)
575 &appldata_work;
576 atomic_inc(&appldata_expire_count);
577 spin_lock(&appldata_timer_lock);
578 __appldata_vtimer_setup(APPLDATA_MOD_TIMER);
579 spin_unlock(&appldata_timer_lock);
580}
581
582static void __cpuinit appldata_offline_cpu(int cpu)
583{
584 del_virt_timer(&per_cpu(appldata_timer, cpu));
585 if (atomic_dec_and_test(&appldata_expire_count)) {
586 atomic_set(&appldata_expire_count, num_online_cpus());
587 queue_work(appldata_wq, &appldata_work);
588 }
589 spin_lock(&appldata_timer_lock);
590 __appldata_vtimer_setup(APPLDATA_MOD_TIMER);
591 spin_unlock(&appldata_timer_lock);
592}
593
594static int __cpuinit appldata_cpu_notify(struct notifier_block *self,
595 unsigned long action,
596 void *hcpu)
597{
598 switch (action) {
599 case CPU_ONLINE:
600 case CPU_ONLINE_FROZEN:
601 appldata_online_cpu((long) hcpu);
602 break;
603 case CPU_DEAD:
604 case CPU_DEAD_FROZEN:
605 appldata_offline_cpu((long) hcpu);
606 break;
607 default:
608 break;
609 }
610 return NOTIFY_OK;
611}
612
613static struct notifier_block __cpuinitdata appldata_nb = {
614 .notifier_call = appldata_cpu_notify,
615};
616
617/* 518/*
618 * appldata_init() 519 * appldata_init()
619 * 520 *
@@ -621,7 +522,10 @@ static struct notifier_block __cpuinitdata appldata_nb = {
621 */ 522 */
622static int __init appldata_init(void) 523static int __init appldata_init(void)
623{ 524{
624 int i, rc; 525 int rc;
526
527 appldata_timer.function = appldata_timer_function;
528 appldata_timer.data = (unsigned long) &appldata_work;
625 529
626 rc = platform_driver_register(&appldata_pdrv); 530 rc = platform_driver_register(&appldata_pdrv);
627 if (rc) 531 if (rc)
@@ -639,14 +543,6 @@ static int __init appldata_init(void)
639 goto out_device; 543 goto out_device;
640 } 544 }
641 545
642 get_online_cpus();
643 for_each_online_cpu(i)
644 appldata_online_cpu(i);
645 put_online_cpus();
646
647 /* Register cpu hotplug notifier */
648 register_hotcpu_notifier(&appldata_nb);
649
650 appldata_sysctl_header = register_sysctl_table(appldata_dir_table); 546 appldata_sysctl_header = register_sysctl_table(appldata_dir_table);
651 return 0; 547 return 0;
652 548
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index f7d3dc555bdb..02d9a1cf5057 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -1,10 +1,8 @@
1/* 1/*
2 * arch/s390/appldata/appldata_mem.c
3 *
4 * Data gathering module for Linux-VM Monitor Stream, Stage 1. 2 * Data gathering module for Linux-VM Monitor Stream, Stage 1.
5 * Collects data related to memory management. 3 * Collects data related to memory management.
6 * 4 *
7 * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. 5 * Copyright IBM Corp. 2003, 2006
8 * 6 *
9 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> 7 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com>
10 */ 8 */
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 5da7c562a90b..1370e358d49a 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -1,11 +1,9 @@
1/* 1/*
2 * arch/s390/appldata/appldata_net_sum.c
3 *
4 * Data gathering module for Linux-VM Monitor Stream, Stage 1. 2 * Data gathering module for Linux-VM Monitor Stream, Stage 1.
5 * Collects accumulated network statistics (Packets received/transmitted, 3 * Collects accumulated network statistics (Packets received/transmitted,
6 * dropped, errors, ...). 4 * dropped, errors, ...).
7 * 5 *
8 * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. 6 * Copyright IBM Corp. 2003, 2006
9 * 7 *
10 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> 8 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com>
11 */ 9 */
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c
index 4de031d6b76c..87521ba682e5 100644
--- a/arch/s390/appldata/appldata_os.c
+++ b/arch/s390/appldata/appldata_os.c
@@ -1,10 +1,8 @@
1/* 1/*
2 * arch/s390/appldata/appldata_os.c
3 *
4 * Data gathering module for Linux-VM Monitor Stream, Stage 1. 2 * Data gathering module for Linux-VM Monitor Stream, Stage 1.
5 * Collects misc. OS related data (CPU utilization, running processes). 3 * Collects misc. OS related data (CPU utilization, running processes).
6 * 4 *
7 * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. 5 * Copyright IBM Corp. 2003, 2006
8 * 6 *
9 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> 7 * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com>
10 */ 8 */