diff options
author | Gerald Schaefer <geraldsc@de.ibm.com> | 2006-06-29 09:08:35 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-06-29 09:08:35 -0400 |
commit | 5b5dd21a8e6652fc8b58a32757575cc7fce2b54d (patch) | |
tree | 96c4981f00020fbbd3577cf459cf59335f716186 /arch/s390/appldata | |
parent | 585c3047a881d0f54b93a0dd8ab499b07ed25d09 (diff) |
[S390] appldata enhancements.
Add CPU ID and steal time, and make OS record size variable.
Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/appldata')
-rw-r--r-- | arch/s390/appldata/appldata.h | 24 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_base.c | 39 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_mem.c | 5 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_net_sum.c | 5 | ||||
-rw-r--r-- | arch/s390/appldata/appldata_os.c | 98 |
5 files changed, 108 insertions, 63 deletions
diff --git a/arch/s390/appldata/appldata.h b/arch/s390/appldata/appldata.h index e806a8922bbb..71d65eb30650 100644 --- a/arch/s390/appldata/appldata.h +++ b/arch/s390/appldata/appldata.h | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * Definitions and interface for Linux - z/VM Monitor Stream. | 4 | * Definitions and interface for Linux - z/VM Monitor Stream. |
5 | * | 5 | * |
6 | * Copyright (C) 2003 IBM Corporation, IBM Deutschland Entwicklung GmbH. | 6 | * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. |
7 | * | 7 | * |
8 | * Author: Gerald Schaefer <geraldsc@de.ibm.com> | 8 | * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> |
9 | */ | 9 | */ |
10 | 10 | ||
11 | //#define APPLDATA_DEBUG /* Debug messages on/off */ | 11 | //#define APPLDATA_DEBUG /* Debug messages on/off */ |
@@ -29,6 +29,22 @@ | |||
29 | #define CTL_APPLDATA_NET_SUM 2125 | 29 | #define CTL_APPLDATA_NET_SUM 2125 |
30 | #define CTL_APPLDATA_PROC 2126 | 30 | #define CTL_APPLDATA_PROC 2126 |
31 | 31 | ||
32 | #ifndef CONFIG_64BIT | ||
33 | |||
34 | #define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */ | ||
35 | #define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */ | ||
36 | #define APPLDATA_GEN_EVENT_RECORD 0x02 | ||
37 | #define APPLDATA_START_CONFIG_REC 0x03 | ||
38 | |||
39 | #else | ||
40 | |||
41 | #define APPLDATA_START_INTERVAL_REC 0x80 | ||
42 | #define APPLDATA_STOP_REC 0x81 | ||
43 | #define APPLDATA_GEN_EVENT_RECORD 0x82 | ||
44 | #define APPLDATA_START_CONFIG_REC 0x83 | ||
45 | |||
46 | #endif /* CONFIG_64BIT */ | ||
47 | |||
32 | #define P_INFO(x...) printk(KERN_INFO MY_PRINT_NAME " info: " x) | 48 | #define P_INFO(x...) printk(KERN_INFO MY_PRINT_NAME " info: " x) |
33 | #define P_ERROR(x...) printk(KERN_ERR MY_PRINT_NAME " error: " x) | 49 | #define P_ERROR(x...) printk(KERN_ERR MY_PRINT_NAME " error: " x) |
34 | #define P_WARNING(x...) printk(KERN_WARNING MY_PRINT_NAME " status: " x) | 50 | #define P_WARNING(x...) printk(KERN_WARNING MY_PRINT_NAME " status: " x) |
@@ -53,7 +69,11 @@ struct appldata_ops { | |||
53 | void *data; /* record data */ | 69 | void *data; /* record data */ |
54 | unsigned int size; /* size of record */ | 70 | unsigned int size; /* size of record */ |
55 | struct module *owner; /* THIS_MODULE */ | 71 | struct module *owner; /* THIS_MODULE */ |
72 | char mod_lvl[2]; /* modification level, EBCDIC */ | ||
56 | }; | 73 | }; |
57 | 74 | ||
58 | extern int appldata_register_ops(struct appldata_ops *ops); | 75 | extern int appldata_register_ops(struct appldata_ops *ops); |
59 | extern void appldata_unregister_ops(struct appldata_ops *ops); | 76 | extern void appldata_unregister_ops(struct appldata_ops *ops); |
77 | extern int appldata_diag(char record_nr, u16 function, unsigned long buffer, | ||
78 | u16 length, char *mod_lvl); | ||
79 | |||
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c index d0816d473854..61bc44626c04 100644 --- a/arch/s390/appldata/appldata_base.c +++ b/arch/s390/appldata/appldata_base.c | |||
@@ -5,9 +5,9 @@ | |||
5 | * Exports appldata_register_ops() and appldata_unregister_ops() for the | 5 | * Exports appldata_register_ops() and appldata_unregister_ops() for the |
6 | * data gathering modules. | 6 | * data gathering modules. |
7 | * | 7 | * |
8 | * Copyright (C) 2003 IBM Corporation, IBM Deutschland Entwicklung GmbH. | 8 | * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. |
9 | * | 9 | * |
10 | * Author: Gerald Schaefer <geraldsc@de.ibm.com> | 10 | * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | 13 | #include <linux/config.h> |
@@ -40,22 +40,6 @@ | |||
40 | 40 | ||
41 | #define TOD_MICRO 0x01000 /* nr. of TOD clock units | 41 | #define TOD_MICRO 0x01000 /* nr. of TOD clock units |
42 | for 1 microsecond */ | 42 | for 1 microsecond */ |
43 | #ifndef CONFIG_64BIT | ||
44 | |||
45 | #define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */ | ||
46 | #define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */ | ||
47 | #define APPLDATA_GEN_EVENT_RECORD 0x02 | ||
48 | #define APPLDATA_START_CONFIG_REC 0x03 | ||
49 | |||
50 | #else | ||
51 | |||
52 | #define APPLDATA_START_INTERVAL_REC 0x80 | ||
53 | #define APPLDATA_STOP_REC 0x81 | ||
54 | #define APPLDATA_GEN_EVENT_RECORD 0x82 | ||
55 | #define APPLDATA_START_CONFIG_REC 0x83 | ||
56 | |||
57 | #endif /* CONFIG_64BIT */ | ||
58 | |||
59 | 43 | ||
60 | /* | 44 | /* |
61 | * Parameter list for DIAGNOSE X'DC' | 45 | * Parameter list for DIAGNOSE X'DC' |
@@ -195,8 +179,8 @@ static void appldata_work_fn(void *data) | |||
195 | * | 179 | * |
196 | * prepare parameter list, issue DIAG 0xDC | 180 | * prepare parameter list, issue DIAG 0xDC |
197 | */ | 181 | */ |
198 | static int appldata_diag(char record_nr, u16 function, unsigned long buffer, | 182 | int appldata_diag(char record_nr, u16 function, unsigned long buffer, |
199 | u16 length) | 183 | u16 length, char *mod_lvl) |
200 | { | 184 | { |
201 | unsigned long ry; | 185 | unsigned long ry; |
202 | struct appldata_product_id { | 186 | struct appldata_product_id { |
@@ -214,7 +198,7 @@ static int appldata_diag(char record_nr, u16 function, unsigned long buffer, | |||
214 | .record_nr = record_nr, | 198 | .record_nr = record_nr, |
215 | .version_nr = {0xF2, 0xF6}, /* "26" */ | 199 | .version_nr = {0xF2, 0xF6}, /* "26" */ |
216 | .release_nr = {0xF0, 0xF1}, /* "01" */ | 200 | .release_nr = {0xF0, 0xF1}, /* "01" */ |
217 | .mod_lvl = {0xF0, 0xF0}, /* "00" */ | 201 | .mod_lvl = {mod_lvl[0], mod_lvl[1]}, |
218 | }; | 202 | }; |
219 | struct appldata_parameter_list appldata_parameter_list = { | 203 | struct appldata_parameter_list appldata_parameter_list = { |
220 | .diag = 0xDC, | 204 | .diag = 0xDC, |
@@ -467,24 +451,25 @@ appldata_generic_handler(ctl_table *ctl, int write, struct file *filp, | |||
467 | module_put(ops->owner); | 451 | module_put(ops->owner); |
468 | return -ENODEV; | 452 | return -ENODEV; |
469 | } | 453 | } |
470 | ops->active = 1; | ||
471 | ops->callback(ops->data); // init record | 454 | ops->callback(ops->data); // init record |
472 | rc = appldata_diag(ops->record_nr, | 455 | rc = appldata_diag(ops->record_nr, |
473 | APPLDATA_START_INTERVAL_REC, | 456 | APPLDATA_START_INTERVAL_REC, |
474 | (unsigned long) ops->data, ops->size); | 457 | (unsigned long) ops->data, ops->size, |
458 | ops->mod_lvl); | ||
475 | if (rc != 0) { | 459 | if (rc != 0) { |
476 | P_ERROR("START DIAG 0xDC for %s failed, " | 460 | P_ERROR("START DIAG 0xDC for %s failed, " |
477 | "return code: %d\n", ops->name, rc); | 461 | "return code: %d\n", ops->name, rc); |
478 | module_put(ops->owner); | 462 | module_put(ops->owner); |
479 | ops->active = 0; | ||
480 | } else { | 463 | } else { |
481 | P_INFO("Monitoring %s data enabled, " | 464 | P_INFO("Monitoring %s data enabled, " |
482 | "DIAG 0xDC started.\n", ops->name); | 465 | "DIAG 0xDC started.\n", ops->name); |
466 | ops->active = 1; | ||
483 | } | 467 | } |
484 | } else if ((buf[0] == '0') && (ops->active == 1)) { | 468 | } else if ((buf[0] == '0') && (ops->active == 1)) { |
485 | ops->active = 0; | 469 | ops->active = 0; |
486 | rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, | 470 | rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, |
487 | (unsigned long) ops->data, ops->size); | 471 | (unsigned long) ops->data, ops->size, |
472 | ops->mod_lvl); | ||
488 | if (rc != 0) { | 473 | if (rc != 0) { |
489 | P_ERROR("STOP DIAG 0xDC for %s failed, " | 474 | P_ERROR("STOP DIAG 0xDC for %s failed, " |
490 | "return code: %d\n", ops->name, rc); | 475 | "return code: %d\n", ops->name, rc); |
@@ -710,7 +695,8 @@ static void __exit appldata_exit(void) | |||
710 | list_for_each(lh, &appldata_ops_list) { | 695 | list_for_each(lh, &appldata_ops_list) { |
711 | ops = list_entry(lh, struct appldata_ops, list); | 696 | ops = list_entry(lh, struct appldata_ops, list); |
712 | rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, | 697 | rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, |
713 | (unsigned long) ops->data, ops->size); | 698 | (unsigned long) ops->data, ops->size, |
699 | ops->mod_lvl); | ||
714 | if (rc != 0) { | 700 | if (rc != 0) { |
715 | P_ERROR("STOP DIAG 0xDC for %s failed, " | 701 | P_ERROR("STOP DIAG 0xDC for %s failed, " |
716 | "return code: %d\n", ops->name, rc); | 702 | "return code: %d\n", ops->name, rc); |
@@ -739,6 +725,7 @@ MODULE_DESCRIPTION("Linux-VM Monitor Stream, base infrastructure"); | |||
739 | 725 | ||
740 | EXPORT_SYMBOL_GPL(appldata_register_ops); | 726 | EXPORT_SYMBOL_GPL(appldata_register_ops); |
741 | EXPORT_SYMBOL_GPL(appldata_unregister_ops); | 727 | EXPORT_SYMBOL_GPL(appldata_unregister_ops); |
728 | EXPORT_SYMBOL_GPL(appldata_diag); | ||
742 | 729 | ||
743 | #ifdef MODULE | 730 | #ifdef MODULE |
744 | /* | 731 | /* |
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c index f0e2fbed3d4c..7915a197d96d 100644 --- a/arch/s390/appldata/appldata_mem.c +++ b/arch/s390/appldata/appldata_mem.c | |||
@@ -4,9 +4,9 @@ | |||
4 | * Data gathering module for Linux-VM Monitor Stream, Stage 1. | 4 | * Data gathering module for Linux-VM Monitor Stream, Stage 1. |
5 | * Collects data related to memory management. | 5 | * Collects data related to memory management. |
6 | * | 6 | * |
7 | * Copyright (C) 2003 IBM Corporation, IBM Deutschland Entwicklung GmbH. | 7 | * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. |
8 | * | 8 | * |
9 | * Author: Gerald Schaefer <geraldsc@de.ibm.com> | 9 | * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
@@ -152,6 +152,7 @@ static struct appldata_ops ops = { | |||
152 | .callback = &appldata_get_mem_data, | 152 | .callback = &appldata_get_mem_data, |
153 | .data = &appldata_mem_data, | 153 | .data = &appldata_mem_data, |
154 | .owner = THIS_MODULE, | 154 | .owner = THIS_MODULE, |
155 | .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */ | ||
155 | }; | 156 | }; |
156 | 157 | ||
157 | 158 | ||
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c index 2a4c7432db4a..39b7bdecbf05 100644 --- a/arch/s390/appldata/appldata_net_sum.c +++ b/arch/s390/appldata/appldata_net_sum.c | |||
@@ -5,9 +5,9 @@ | |||
5 | * Collects accumulated network statistics (Packets received/transmitted, | 5 | * Collects accumulated network statistics (Packets received/transmitted, |
6 | * dropped, errors, ...). | 6 | * dropped, errors, ...). |
7 | * | 7 | * |
8 | * Copyright (C) 2003 IBM Corporation, IBM Deutschland Entwicklung GmbH. | 8 | * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. |
9 | * | 9 | * |
10 | * Author: Gerald Schaefer <geraldsc@de.ibm.com> | 10 | * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | 13 | #include <linux/config.h> |
@@ -152,6 +152,7 @@ static struct appldata_ops ops = { | |||
152 | .callback = &appldata_get_net_sum_data, | 152 | .callback = &appldata_get_net_sum_data, |
153 | .data = &appldata_net_sum_data, | 153 | .data = &appldata_net_sum_data, |
154 | .owner = THIS_MODULE, | 154 | .owner = THIS_MODULE, |
155 | .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */ | ||
155 | }; | 156 | }; |
156 | 157 | ||
157 | 158 | ||
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c index 99ddd3bf2fba..f2b44a2f1dec 100644 --- a/arch/s390/appldata/appldata_os.c +++ b/arch/s390/appldata/appldata_os.c | |||
@@ -4,9 +4,9 @@ | |||
4 | * Data gathering module for Linux-VM Monitor Stream, Stage 1. | 4 | * Data gathering module for Linux-VM Monitor Stream, Stage 1. |
5 | * Collects misc. OS related data (CPU utilization, running processes). | 5 | * Collects misc. OS related data (CPU utilization, running processes). |
6 | * | 6 | * |
7 | * Copyright (C) 2003 IBM Corporation, IBM Deutschland Entwicklung GmbH. | 7 | * Copyright (C) 2003,2006 IBM Corporation, IBM Deutschland Entwicklung GmbH. |
8 | * | 8 | * |
9 | * Author: Gerald Schaefer <geraldsc@de.ibm.com> | 9 | * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
@@ -44,11 +44,14 @@ struct appldata_os_per_cpu { | |||
44 | u32 per_cpu_system; /* ... spent in kernel mode */ | 44 | u32 per_cpu_system; /* ... spent in kernel mode */ |
45 | u32 per_cpu_idle; /* ... spent in idle mode */ | 45 | u32 per_cpu_idle; /* ... spent in idle mode */ |
46 | 46 | ||
47 | // New in 2.6 --> | 47 | /* New in 2.6 */ |
48 | u32 per_cpu_irq; /* ... spent in interrupts */ | 48 | u32 per_cpu_irq; /* ... spent in interrupts */ |
49 | u32 per_cpu_softirq; /* ... spent in softirqs */ | 49 | u32 per_cpu_softirq; /* ... spent in softirqs */ |
50 | u32 per_cpu_iowait; /* ... spent while waiting for I/O */ | 50 | u32 per_cpu_iowait; /* ... spent while waiting for I/O */ |
51 | // <-- New in 2.6 | 51 | |
52 | /* New in modification level 01 */ | ||
53 | u32 per_cpu_steal; /* ... stolen by hypervisor */ | ||
54 | u32 cpu_id; /* number of this CPU */ | ||
52 | } __attribute__((packed)); | 55 | } __attribute__((packed)); |
53 | 56 | ||
54 | struct appldata_os_data { | 57 | struct appldata_os_data { |
@@ -68,10 +71,9 @@ struct appldata_os_data { | |||
68 | u32 avenrun[3]; /* average nr. of running processes during */ | 71 | u32 avenrun[3]; /* average nr. of running processes during */ |
69 | /* the last 1, 5 and 15 minutes */ | 72 | /* the last 1, 5 and 15 minutes */ |
70 | 73 | ||
71 | // New in 2.6 --> | 74 | /* New in 2.6 */ |
72 | u32 nr_iowait; /* number of blocked threads | 75 | u32 nr_iowait; /* number of blocked threads |
73 | (waiting for I/O) */ | 76 | (waiting for I/O) */ |
74 | // <-- New in 2.6 | ||
75 | 77 | ||
76 | /* per cpu data */ | 78 | /* per cpu data */ |
77 | struct appldata_os_per_cpu os_cpu[0]; | 79 | struct appldata_os_per_cpu os_cpu[0]; |
@@ -79,6 +81,14 @@ struct appldata_os_data { | |||
79 | 81 | ||
80 | static struct appldata_os_data *appldata_os_data; | 82 | static struct appldata_os_data *appldata_os_data; |
81 | 83 | ||
84 | static struct appldata_ops ops = { | ||
85 | .ctl_nr = CTL_APPLDATA_OS, | ||
86 | .name = "os", | ||
87 | .record_nr = APPLDATA_RECORD_OS_ID, | ||
88 | .owner = THIS_MODULE, | ||
89 | .mod_lvl = {0xF0, 0xF1}, /* EBCDIC "01" */ | ||
90 | }; | ||
91 | |||
82 | 92 | ||
83 | static inline void appldata_print_debug(struct appldata_os_data *os_data) | 93 | static inline void appldata_print_debug(struct appldata_os_data *os_data) |
84 | { | 94 | { |
@@ -100,15 +110,17 @@ static inline void appldata_print_debug(struct appldata_os_data *os_data) | |||
100 | P_DEBUG("nr_cpus = %u\n", os_data->nr_cpus); | 110 | P_DEBUG("nr_cpus = %u\n", os_data->nr_cpus); |
101 | for (i = 0; i < os_data->nr_cpus; i++) { | 111 | for (i = 0; i < os_data->nr_cpus; i++) { |
102 | P_DEBUG("cpu%u : user = %u, nice = %u, system = %u, " | 112 | P_DEBUG("cpu%u : user = %u, nice = %u, system = %u, " |
103 | "idle = %u, irq = %u, softirq = %u, iowait = %u\n", | 113 | "idle = %u, irq = %u, softirq = %u, iowait = %u, " |
104 | i, | 114 | "steal = %u\n", |
115 | os_data->os_cpu[i].cpu_id, | ||
105 | os_data->os_cpu[i].per_cpu_user, | 116 | os_data->os_cpu[i].per_cpu_user, |
106 | os_data->os_cpu[i].per_cpu_nice, | 117 | os_data->os_cpu[i].per_cpu_nice, |
107 | os_data->os_cpu[i].per_cpu_system, | 118 | os_data->os_cpu[i].per_cpu_system, |
108 | os_data->os_cpu[i].per_cpu_idle, | 119 | os_data->os_cpu[i].per_cpu_idle, |
109 | os_data->os_cpu[i].per_cpu_irq, | 120 | os_data->os_cpu[i].per_cpu_irq, |
110 | os_data->os_cpu[i].per_cpu_softirq, | 121 | os_data->os_cpu[i].per_cpu_softirq, |
111 | os_data->os_cpu[i].per_cpu_iowait); | 122 | os_data->os_cpu[i].per_cpu_iowait, |
123 | os_data->os_cpu[i].per_cpu_steal); | ||
112 | } | 124 | } |
113 | 125 | ||
114 | P_DEBUG("sync_count_1 = %u\n", os_data->sync_count_1); | 126 | P_DEBUG("sync_count_1 = %u\n", os_data->sync_count_1); |
@@ -123,14 +135,13 @@ static inline void appldata_print_debug(struct appldata_os_data *os_data) | |||
123 | */ | 135 | */ |
124 | static void appldata_get_os_data(void *data) | 136 | static void appldata_get_os_data(void *data) |
125 | { | 137 | { |
126 | int i, j; | 138 | int i, j, rc; |
127 | struct appldata_os_data *os_data; | 139 | struct appldata_os_data *os_data; |
140 | unsigned int new_size; | ||
128 | 141 | ||
129 | os_data = data; | 142 | os_data = data; |
130 | os_data->sync_count_1++; | 143 | os_data->sync_count_1++; |
131 | 144 | ||
132 | os_data->nr_cpus = num_online_cpus(); | ||
133 | |||
134 | os_data->nr_threads = nr_threads; | 145 | os_data->nr_threads = nr_threads; |
135 | os_data->nr_running = nr_running(); | 146 | os_data->nr_running = nr_running(); |
136 | os_data->nr_iowait = nr_iowait(); | 147 | os_data->nr_iowait = nr_iowait(); |
@@ -154,9 +165,44 @@ static void appldata_get_os_data(void *data) | |||
154 | cputime_to_jiffies(kstat_cpu(i).cpustat.softirq); | 165 | cputime_to_jiffies(kstat_cpu(i).cpustat.softirq); |
155 | os_data->os_cpu[j].per_cpu_iowait = | 166 | os_data->os_cpu[j].per_cpu_iowait = |
156 | cputime_to_jiffies(kstat_cpu(i).cpustat.iowait); | 167 | cputime_to_jiffies(kstat_cpu(i).cpustat.iowait); |
168 | os_data->os_cpu[j].per_cpu_steal = | ||
169 | cputime_to_jiffies(kstat_cpu(i).cpustat.steal); | ||
170 | os_data->os_cpu[j].cpu_id = i; | ||
157 | j++; | 171 | j++; |
158 | } | 172 | } |
159 | 173 | ||
174 | os_data->nr_cpus = j; | ||
175 | |||
176 | new_size = sizeof(struct appldata_os_data) + | ||
177 | (os_data->nr_cpus * sizeof(struct appldata_os_per_cpu)); | ||
178 | if (ops.size != new_size) { | ||
179 | if (ops.active) { | ||
180 | rc = appldata_diag(APPLDATA_RECORD_OS_ID, | ||
181 | APPLDATA_START_INTERVAL_REC, | ||
182 | (unsigned long) ops.data, new_size, | ||
183 | ops.mod_lvl); | ||
184 | if (rc != 0) { | ||
185 | P_ERROR("os: START NEW DIAG 0xDC failed, " | ||
186 | "return code: %d, new size = %i\n", rc, | ||
187 | new_size); | ||
188 | P_INFO("os: stopping old record now\n"); | ||
189 | } else | ||
190 | P_INFO("os: new record size = %i\n", new_size); | ||
191 | |||
192 | rc = appldata_diag(APPLDATA_RECORD_OS_ID, | ||
193 | APPLDATA_STOP_REC, | ||
194 | (unsigned long) ops.data, ops.size, | ||
195 | ops.mod_lvl); | ||
196 | if (rc != 0) | ||
197 | P_ERROR("os: STOP OLD DIAG 0xDC failed, " | ||
198 | "return code: %d, old size = %i\n", rc, | ||
199 | ops.size); | ||
200 | else | ||
201 | P_INFO("os: old record size = %i stopped\n", | ||
202 | ops.size); | ||
203 | } | ||
204 | ops.size = new_size; | ||
205 | } | ||
160 | os_data->timestamp = get_clock(); | 206 | os_data->timestamp = get_clock(); |
161 | os_data->sync_count_2++; | 207 | os_data->sync_count_2++; |
162 | #ifdef APPLDATA_DEBUG | 208 | #ifdef APPLDATA_DEBUG |
@@ -165,15 +211,6 @@ static void appldata_get_os_data(void *data) | |||
165 | } | 211 | } |
166 | 212 | ||
167 | 213 | ||
168 | static struct appldata_ops ops = { | ||
169 | .ctl_nr = CTL_APPLDATA_OS, | ||
170 | .name = "os", | ||
171 | .record_nr = APPLDATA_RECORD_OS_ID, | ||
172 | .callback = &appldata_get_os_data, | ||
173 | .owner = THIS_MODULE, | ||
174 | }; | ||
175 | |||
176 | |||
177 | /* | 214 | /* |
178 | * appldata_os_init() | 215 | * appldata_os_init() |
179 | * | 216 | * |
@@ -181,26 +218,25 @@ static struct appldata_ops ops = { | |||
181 | */ | 218 | */ |
182 | static int __init appldata_os_init(void) | 219 | static int __init appldata_os_init(void) |
183 | { | 220 | { |
184 | int rc, size; | 221 | int rc, max_size; |
185 | 222 | ||
186 | size = sizeof(struct appldata_os_data) + | 223 | max_size = sizeof(struct appldata_os_data) + |
187 | (NR_CPUS * sizeof(struct appldata_os_per_cpu)); | 224 | (NR_CPUS * sizeof(struct appldata_os_per_cpu)); |
188 | if (size > APPLDATA_MAX_REC_SIZE) { | 225 | if (max_size > APPLDATA_MAX_REC_SIZE) { |
189 | P_ERROR("Size of record = %i, bigger than maximum (%i)!\n", | 226 | P_ERROR("Max. size of OS record = %i, bigger than maximum " |
190 | size, APPLDATA_MAX_REC_SIZE); | 227 | "record size (%i)\n", max_size, APPLDATA_MAX_REC_SIZE); |
191 | rc = -ENOMEM; | 228 | rc = -ENOMEM; |
192 | goto out; | 229 | goto out; |
193 | } | 230 | } |
194 | P_DEBUG("sizeof(os) = %i, sizeof(os_cpu) = %lu\n", size, | 231 | P_DEBUG("max. sizeof(os) = %i, sizeof(os_cpu) = %lu\n", max_size, |
195 | sizeof(struct appldata_os_per_cpu)); | 232 | sizeof(struct appldata_os_per_cpu)); |
196 | 233 | ||
197 | appldata_os_data = kmalloc(size, GFP_DMA); | 234 | appldata_os_data = kzalloc(max_size, GFP_DMA); |
198 | if (appldata_os_data == NULL) { | 235 | if (appldata_os_data == NULL) { |
199 | P_ERROR("No memory for %s!\n", ops.name); | 236 | P_ERROR("No memory for %s!\n", ops.name); |
200 | rc = -ENOMEM; | 237 | rc = -ENOMEM; |
201 | goto out; | 238 | goto out; |
202 | } | 239 | } |
203 | memset(appldata_os_data, 0, size); | ||
204 | 240 | ||
205 | appldata_os_data->per_cpu_size = sizeof(struct appldata_os_per_cpu); | 241 | appldata_os_data->per_cpu_size = sizeof(struct appldata_os_per_cpu); |
206 | appldata_os_data->cpu_offset = offsetof(struct appldata_os_data, | 242 | appldata_os_data->cpu_offset = offsetof(struct appldata_os_data, |
@@ -208,7 +244,7 @@ static int __init appldata_os_init(void) | |||
208 | P_DEBUG("cpu offset = %u\n", appldata_os_data->cpu_offset); | 244 | P_DEBUG("cpu offset = %u\n", appldata_os_data->cpu_offset); |
209 | 245 | ||
210 | ops.data = appldata_os_data; | 246 | ops.data = appldata_os_data; |
211 | ops.size = size; | 247 | ops.callback = &appldata_get_os_data; |
212 | rc = appldata_register_ops(&ops); | 248 | rc = appldata_register_ops(&ops); |
213 | if (rc != 0) { | 249 | if (rc != 0) { |
214 | P_ERROR("Error registering ops, rc = %i\n", rc); | 250 | P_ERROR("Error registering ops, rc = %i\n", rc); |