Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * arch/s390/appldata/appldata_base.c |
| 3 | * |
| 4 | * Base infrastructure for Linux-z/VM Monitor Stream, Stage 1. |
| 5 | * Exports appldata_register_ops() and appldata_unregister_ops() for the |
| 6 | * data gathering modules. |
| 7 | * |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 8 | * Copyright IBM Corp. 2003, 2009 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * |
Gerald Schaefer | 5b5dd21 | 2006-06-29 15:08:35 +0200 | [diff] [blame] | 10 | * Author: Gerald Schaefer <gerald.schaefer@de.ibm.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
Gerald Schaefer | e7534b0 | 2008-12-25 13:39:41 +0100 | [diff] [blame] | 13 | #define KMSG_COMPONENT "appldata" |
| 14 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
| 15 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/module.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/slab.h> |
| 19 | #include <linux/errno.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <linux/interrupt.h> |
| 21 | #include <linux/proc_fs.h> |
Heiko Carstens | 2dcea57 | 2006-09-29 01:58:41 -0700 | [diff] [blame] | 22 | #include <linux/mm.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <linux/swap.h> |
| 24 | #include <linux/pagemap.h> |
| 25 | #include <linux/sysctl.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/notifier.h> |
| 27 | #include <linux/cpu.h> |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 28 | #include <linux/workqueue.h> |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 29 | #include <linux/suspend.h> |
| 30 | #include <linux/platform_device.h> |
Gerald Schaefer | 1f38d61 | 2006-09-20 15:59:26 +0200 | [diff] [blame] | 31 | #include <asm/appldata.h> |
| 32 | #include <asm/timer.h> |
| 33 | #include <asm/uaccess.h> |
| 34 | #include <asm/io.h> |
| 35 | #include <asm/smp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | #include "appldata.h" |
| 38 | |
| 39 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | #define APPLDATA_CPU_INTERVAL 10000 /* default (CPU) time for |
| 41 | sampling interval in |
| 42 | milliseconds */ |
| 43 | |
| 44 | #define TOD_MICRO 0x01000 /* nr. of TOD clock units |
| 45 | for 1 microsecond */ |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 46 | |
| 47 | static struct platform_device *appldata_pdev; |
| 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | /* |
| 50 | * /proc entries (sysctl) |
| 51 | */ |
| 52 | static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata"; |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 53 | static int appldata_timer_handler(ctl_table *ctl, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 55 | static int appldata_interval_handler(ctl_table *ctl, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | void __user *buffer, |
| 57 | size_t *lenp, loff_t *ppos); |
| 58 | |
| 59 | static struct ctl_table_header *appldata_sysctl_header; |
| 60 | static struct ctl_table appldata_table[] = { |
| 61 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | .procname = "timer", |
| 63 | .mode = S_IRUGO | S_IWUSR, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 64 | .proc_handler = appldata_timer_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | }, |
| 66 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | .procname = "interval", |
| 68 | .mode = S_IRUGO | S_IWUSR, |
Eric W. Biederman | 6d45611 | 2009-11-16 03:11:48 -0800 | [diff] [blame] | 69 | .proc_handler = appldata_interval_handler, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | }, |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 71 | { }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | static struct ctl_table appldata_dir_table[] = { |
| 75 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | .procname = appldata_proc_name, |
| 77 | .maxlen = 0, |
| 78 | .mode = S_IRUGO | S_IXUGO, |
| 79 | .child = appldata_table, |
| 80 | }, |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 81 | { }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | /* |
| 85 | * Timer |
| 86 | */ |
Heiko Carstens | 2b67fc4 | 2007-02-05 21:16:47 +0100 | [diff] [blame] | 87 | static DEFINE_PER_CPU(struct vtimer_list, appldata_timer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 88 | static atomic_t appldata_expire_count = ATOMIC_INIT(0); |
| 89 | |
| 90 | static DEFINE_SPINLOCK(appldata_timer_lock); |
| 91 | static int appldata_interval = APPLDATA_CPU_INTERVAL; |
| 92 | static int appldata_timer_active; |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 93 | static int appldata_timer_suspended = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | |
| 95 | /* |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 96 | * Work queue |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | */ |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 98 | static struct workqueue_struct *appldata_wq; |
David Howells | 6d5aefb | 2006-12-05 19:36:26 +0000 | [diff] [blame] | 99 | static void appldata_work_fn(struct work_struct *work); |
| 100 | static DECLARE_WORK(appldata_work, appldata_work_fn); |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
| 103 | /* |
| 104 | * Ops list |
| 105 | */ |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 106 | static DEFINE_MUTEX(appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | static LIST_HEAD(appldata_ops_list); |
| 108 | |
| 109 | |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 110 | /*************************** timer, work, DIAG *******************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | /* |
| 112 | * appldata_timer_function() |
| 113 | * |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 114 | * schedule work and reschedule timer |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | */ |
Heiko Carstens | 9d0a57c | 2006-10-11 15:31:26 +0200 | [diff] [blame] | 116 | static void appldata_timer_function(unsigned long data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | if (atomic_dec_and_test(&appldata_expire_count)) { |
| 119 | atomic_set(&appldata_expire_count, num_online_cpus()); |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 120 | queue_work(appldata_wq, (struct work_struct *) data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | } |
| 122 | } |
| 123 | |
| 124 | /* |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 125 | * appldata_work_fn() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | * |
| 127 | * call data gathering function for each (active) module |
| 128 | */ |
David Howells | 6d5aefb | 2006-12-05 19:36:26 +0000 | [diff] [blame] | 129 | static void appldata_work_fn(struct work_struct *work) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | { |
| 131 | struct list_head *lh; |
| 132 | struct appldata_ops *ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | |
Gerald Schaefer | 1760537 | 2008-05-30 10:03:28 +0200 | [diff] [blame] | 134 | get_online_cpus(); |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 135 | mutex_lock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | list_for_each(lh, &appldata_ops_list) { |
| 137 | ops = list_entry(lh, struct appldata_ops, list); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | if (ops->active == 1) { |
| 139 | ops->callback(ops->data); |
| 140 | } |
| 141 | } |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 142 | mutex_unlock(&appldata_ops_mutex); |
Gerald Schaefer | 1760537 | 2008-05-30 10:03:28 +0200 | [diff] [blame] | 143 | put_online_cpus(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | } |
| 145 | |
| 146 | /* |
| 147 | * appldata_diag() |
| 148 | * |
| 149 | * prepare parameter list, issue DIAG 0xDC |
| 150 | */ |
Gerald Schaefer | 5b5dd21 | 2006-06-29 15:08:35 +0200 | [diff] [blame] | 151 | int appldata_diag(char record_nr, u16 function, unsigned long buffer, |
| 152 | u16 length, char *mod_lvl) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | { |
Gerald Schaefer | 1f38d61 | 2006-09-20 15:59:26 +0200 | [diff] [blame] | 154 | struct appldata_product_id id = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | .prod_nr = {0xD3, 0xC9, 0xD5, 0xE4, |
Gerald Schaefer | 1f38d61 | 2006-09-20 15:59:26 +0200 | [diff] [blame] | 156 | 0xE7, 0xD2, 0xD9}, /* "LINUXKR" */ |
| 157 | .prod_fn = 0xD5D3, /* "NL" */ |
Gerald Schaefer | 1f38d61 | 2006-09-20 15:59:26 +0200 | [diff] [blame] | 158 | .version_nr = 0xF2F6, /* "26" */ |
| 159 | .release_nr = 0xF0F1, /* "01" */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | }; |
| 161 | |
Gerald Schaefer | 925afbd | 2006-09-28 16:55:23 +0200 | [diff] [blame] | 162 | id.record_nr = record_nr; |
| 163 | id.mod_lvl = (mod_lvl[0]) << 8 | mod_lvl[1]; |
Gerald Schaefer | 1f38d61 | 2006-09-20 15:59:26 +0200 | [diff] [blame] | 164 | return appldata_asm(&id, function, (void *) buffer, length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | } |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 166 | /************************ timer, work, DIAG <END> ****************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | |
| 168 | |
| 169 | /****************************** /proc stuff **********************************/ |
| 170 | |
| 171 | /* |
| 172 | * appldata_mod_vtimer_wrap() |
| 173 | * |
Heiko Carstens | 3bb447f | 2007-07-27 12:29:08 +0200 | [diff] [blame] | 174 | * wrapper function for mod_virt_timer(), because smp_call_function_single() |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | * accepts only one parameter. |
| 176 | */ |
| 177 | static void __appldata_mod_vtimer_wrap(void *p) { |
| 178 | struct { |
| 179 | struct vtimer_list *timer; |
| 180 | u64 expires; |
| 181 | } *args = p; |
Gerald Schaefer | 43ae8a1 | 2009-04-14 15:36:21 +0200 | [diff] [blame] | 182 | mod_virt_timer_periodic(args->timer, args->expires); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | #define APPLDATA_ADD_TIMER 0 |
| 186 | #define APPLDATA_DEL_TIMER 1 |
| 187 | #define APPLDATA_MOD_TIMER 2 |
| 188 | |
| 189 | /* |
| 190 | * __appldata_vtimer_setup() |
| 191 | * |
| 192 | * Add, delete or modify virtual timers on all online cpus. |
| 193 | * The caller needs to get the appldata_timer_lock spinlock. |
| 194 | */ |
| 195 | static void |
| 196 | __appldata_vtimer_setup(int cmd) |
| 197 | { |
| 198 | u64 per_cpu_interval; |
| 199 | int i; |
| 200 | |
| 201 | switch (cmd) { |
| 202 | case APPLDATA_ADD_TIMER: |
| 203 | if (appldata_timer_active) |
| 204 | break; |
| 205 | per_cpu_interval = (u64) (appldata_interval*1000 / |
| 206 | num_online_cpus()) * TOD_MICRO; |
| 207 | for_each_online_cpu(i) { |
| 208 | per_cpu(appldata_timer, i).expires = per_cpu_interval; |
Heiko Carstens | 3bb447f | 2007-07-27 12:29:08 +0200 | [diff] [blame] | 209 | smp_call_function_single(i, add_virt_timer_periodic, |
| 210 | &per_cpu(appldata_timer, i), |
Jens Axboe | 8691e5a | 2008-06-06 11:18:06 +0200 | [diff] [blame] | 211 | 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | } |
| 213 | appldata_timer_active = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | break; |
| 215 | case APPLDATA_DEL_TIMER: |
| 216 | for_each_online_cpu(i) |
| 217 | del_virt_timer(&per_cpu(appldata_timer, i)); |
| 218 | if (!appldata_timer_active) |
| 219 | break; |
| 220 | appldata_timer_active = 0; |
| 221 | atomic_set(&appldata_expire_count, num_online_cpus()); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | break; |
| 223 | case APPLDATA_MOD_TIMER: |
| 224 | per_cpu_interval = (u64) (appldata_interval*1000 / |
| 225 | num_online_cpus()) * TOD_MICRO; |
| 226 | if (!appldata_timer_active) |
| 227 | break; |
| 228 | for_each_online_cpu(i) { |
| 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; |
Heiko Carstens | 3bb447f | 2007-07-27 12:29:08 +0200 | [diff] [blame] | 235 | smp_call_function_single(i, __appldata_mod_vtimer_wrap, |
Jens Axboe | 8691e5a | 2008-06-06 11:18:06 +0200 | [diff] [blame] | 236 | &args, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | } |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /* |
| 242 | * appldata_timer_handler() |
| 243 | * |
| 244 | * Start/Stop timer, show status of timer (0 = not active, 1 = active) |
| 245 | */ |
| 246 | static int |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 247 | appldata_timer_handler(ctl_table *ctl, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 249 | { |
| 250 | int len; |
| 251 | char buf[2]; |
| 252 | |
| 253 | if (!*lenp || *ppos) { |
| 254 | *lenp = 0; |
| 255 | return 0; |
| 256 | } |
| 257 | if (!write) { |
| 258 | len = sprintf(buf, appldata_timer_active ? "1\n" : "0\n"); |
| 259 | if (len > *lenp) |
| 260 | len = *lenp; |
| 261 | if (copy_to_user(buffer, buf, len)) |
| 262 | return -EFAULT; |
| 263 | goto out; |
| 264 | } |
| 265 | len = *lenp; |
| 266 | if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) |
| 267 | return -EFAULT; |
Gerald Schaefer | 1760537 | 2008-05-30 10:03:28 +0200 | [diff] [blame] | 268 | get_online_cpus(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | spin_lock(&appldata_timer_lock); |
| 270 | if (buf[0] == '1') |
| 271 | __appldata_vtimer_setup(APPLDATA_ADD_TIMER); |
| 272 | else if (buf[0] == '0') |
| 273 | __appldata_vtimer_setup(APPLDATA_DEL_TIMER); |
| 274 | spin_unlock(&appldata_timer_lock); |
Gerald Schaefer | 1760537 | 2008-05-30 10:03:28 +0200 | [diff] [blame] | 275 | put_online_cpus(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | out: |
| 277 | *lenp = len; |
| 278 | *ppos += len; |
| 279 | return 0; |
| 280 | } |
| 281 | |
| 282 | /* |
| 283 | * appldata_interval_handler() |
| 284 | * |
| 285 | * Set (CPU) timer interval for collection of data (in milliseconds), show |
| 286 | * current timer interval. |
| 287 | */ |
| 288 | static int |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 289 | appldata_interval_handler(ctl_table *ctl, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 291 | { |
| 292 | int len, interval; |
| 293 | char buf[16]; |
| 294 | |
| 295 | if (!*lenp || *ppos) { |
| 296 | *lenp = 0; |
| 297 | return 0; |
| 298 | } |
| 299 | if (!write) { |
| 300 | len = sprintf(buf, "%i\n", appldata_interval); |
| 301 | if (len > *lenp) |
| 302 | len = *lenp; |
| 303 | if (copy_to_user(buffer, buf, len)) |
| 304 | return -EFAULT; |
| 305 | goto out; |
| 306 | } |
| 307 | len = *lenp; |
| 308 | if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) { |
| 309 | return -EFAULT; |
| 310 | } |
Gerald Schaefer | 95425f1 | 2006-10-27 12:39:13 +0200 | [diff] [blame] | 311 | interval = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | sscanf(buf, "%i", &interval); |
Gerald Schaefer | d3ae942 | 2008-07-14 09:59:34 +0200 | [diff] [blame] | 313 | if (interval <= 0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 315 | |
Gerald Schaefer | 1760537 | 2008-05-30 10:03:28 +0200 | [diff] [blame] | 316 | get_online_cpus(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | spin_lock(&appldata_timer_lock); |
| 318 | appldata_interval = interval; |
| 319 | __appldata_vtimer_setup(APPLDATA_MOD_TIMER); |
| 320 | spin_unlock(&appldata_timer_lock); |
Gerald Schaefer | 1760537 | 2008-05-30 10:03:28 +0200 | [diff] [blame] | 321 | put_online_cpus(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | out: |
| 323 | *lenp = len; |
| 324 | *ppos += len; |
| 325 | return 0; |
| 326 | } |
| 327 | |
| 328 | /* |
| 329 | * appldata_generic_handler() |
| 330 | * |
| 331 | * Generic start/stop monitoring and DIAG, show status of |
| 332 | * monitoring (0 = not in process, 1 = in process) |
| 333 | */ |
| 334 | static int |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 335 | appldata_generic_handler(ctl_table *ctl, int write, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 337 | { |
| 338 | struct appldata_ops *ops = NULL, *tmp_ops; |
| 339 | int rc, len, found; |
| 340 | char buf[2]; |
| 341 | struct list_head *lh; |
| 342 | |
| 343 | found = 0; |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 344 | mutex_lock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | list_for_each(lh, &appldata_ops_list) { |
| 346 | tmp_ops = list_entry(lh, struct appldata_ops, list); |
| 347 | if (&tmp_ops->ctl_table[2] == ctl) { |
| 348 | found = 1; |
| 349 | } |
| 350 | } |
| 351 | if (!found) { |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 352 | mutex_unlock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | return -ENODEV; |
| 354 | } |
| 355 | ops = ctl->data; |
| 356 | if (!try_module_get(ops->owner)) { // protect this function |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 357 | mutex_unlock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | return -ENODEV; |
| 359 | } |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 360 | mutex_unlock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | |
| 362 | if (!*lenp || *ppos) { |
| 363 | *lenp = 0; |
| 364 | module_put(ops->owner); |
| 365 | return 0; |
| 366 | } |
| 367 | if (!write) { |
| 368 | len = sprintf(buf, ops->active ? "1\n" : "0\n"); |
| 369 | if (len > *lenp) |
| 370 | len = *lenp; |
| 371 | if (copy_to_user(buffer, buf, len)) { |
| 372 | module_put(ops->owner); |
| 373 | return -EFAULT; |
| 374 | } |
| 375 | goto out; |
| 376 | } |
| 377 | len = *lenp; |
| 378 | if (copy_from_user(buf, buffer, |
| 379 | len > sizeof(buf) ? sizeof(buf) : len)) { |
| 380 | module_put(ops->owner); |
| 381 | return -EFAULT; |
| 382 | } |
| 383 | |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 384 | mutex_lock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | if ((buf[0] == '1') && (ops->active == 0)) { |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 386 | // protect work queue callback |
| 387 | if (!try_module_get(ops->owner)) { |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 388 | mutex_unlock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | module_put(ops->owner); |
| 390 | return -ENODEV; |
| 391 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | ops->callback(ops->data); // init record |
| 393 | rc = appldata_diag(ops->record_nr, |
| 394 | APPLDATA_START_INTERVAL_REC, |
Gerald Schaefer | 5b5dd21 | 2006-06-29 15:08:35 +0200 | [diff] [blame] | 395 | (unsigned long) ops->data, ops->size, |
| 396 | ops->mod_lvl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | if (rc != 0) { |
Gerald Schaefer | e7534b0 | 2008-12-25 13:39:41 +0100 | [diff] [blame] | 398 | pr_err("Starting the data collection for %s " |
| 399 | "failed with rc=%d\n", ops->name, rc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 400 | module_put(ops->owner); |
Gerald Schaefer | d3ae942 | 2008-07-14 09:59:34 +0200 | [diff] [blame] | 401 | } else |
Gerald Schaefer | 5b5dd21 | 2006-06-29 15:08:35 +0200 | [diff] [blame] | 402 | ops->active = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | } else if ((buf[0] == '0') && (ops->active == 1)) { |
| 404 | ops->active = 0; |
| 405 | rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, |
Gerald Schaefer | 5b5dd21 | 2006-06-29 15:08:35 +0200 | [diff] [blame] | 406 | (unsigned long) ops->data, ops->size, |
| 407 | ops->mod_lvl); |
Gerald Schaefer | d3ae942 | 2008-07-14 09:59:34 +0200 | [diff] [blame] | 408 | if (rc != 0) |
Gerald Schaefer | e7534b0 | 2008-12-25 13:39:41 +0100 | [diff] [blame] | 409 | pr_err("Stopping the data collection for %s " |
| 410 | "failed with rc=%d\n", ops->name, rc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | module_put(ops->owner); |
| 412 | } |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 413 | mutex_unlock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | out: |
| 415 | *lenp = len; |
| 416 | *ppos += len; |
| 417 | module_put(ops->owner); |
| 418 | return 0; |
| 419 | } |
| 420 | |
| 421 | /*************************** /proc stuff <END> *******************************/ |
| 422 | |
| 423 | |
| 424 | /************************* module-ops management *****************************/ |
| 425 | /* |
| 426 | * appldata_register_ops() |
| 427 | * |
| 428 | * update ops list, register /proc/sys entries |
| 429 | */ |
| 430 | int appldata_register_ops(struct appldata_ops *ops) |
| 431 | { |
Roel Kluin | 13f8b7c | 2008-10-28 11:10:18 +0100 | [diff] [blame] | 432 | if (ops->size > APPLDATA_MAX_REC_SIZE) |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 433 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 434 | |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 435 | ops->ctl_table = kzalloc(4 * sizeof(struct ctl_table), GFP_KERNEL); |
| 436 | if (!ops->ctl_table) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | return -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 439 | mutex_lock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 440 | list_add(&ops->list, &appldata_ops_list); |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 441 | mutex_unlock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | ops->ctl_table[0].procname = appldata_proc_name; |
| 444 | ops->ctl_table[0].maxlen = 0; |
| 445 | ops->ctl_table[0].mode = S_IRUGO | S_IXUGO; |
| 446 | ops->ctl_table[0].child = &ops->ctl_table[2]; |
| 447 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | ops->ctl_table[2].procname = ops->name; |
| 449 | ops->ctl_table[2].mode = S_IRUGO | S_IWUSR; |
| 450 | ops->ctl_table[2].proc_handler = appldata_generic_handler; |
| 451 | ops->ctl_table[2].data = ops; |
| 452 | |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 453 | ops->sysctl_header = register_sysctl_table(ops->ctl_table); |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 454 | if (!ops->sysctl_header) |
| 455 | goto out; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | return 0; |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 457 | out: |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 458 | mutex_lock(&appldata_ops_mutex); |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 459 | list_del(&ops->list); |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 460 | mutex_unlock(&appldata_ops_mutex); |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 461 | kfree(ops->ctl_table); |
| 462 | return -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | } |
| 464 | |
| 465 | /* |
| 466 | * appldata_unregister_ops() |
| 467 | * |
| 468 | * update ops list, unregister /proc entries, stop DIAG if necessary |
| 469 | */ |
| 470 | void appldata_unregister_ops(struct appldata_ops *ops) |
| 471 | { |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 472 | mutex_lock(&appldata_ops_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | list_del(&ops->list); |
Gerald Schaefer | b1ad171 | 2009-04-23 13:58:07 +0200 | [diff] [blame] | 474 | mutex_unlock(&appldata_ops_mutex); |
Al Viro | 330d57f | 2005-11-04 10:18:40 +0000 | [diff] [blame] | 475 | unregister_sysctl_table(ops->sysctl_header); |
Heiko Carstens | 37e3a6a | 2007-11-20 11:13:34 +0100 | [diff] [blame] | 476 | kfree(ops->ctl_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | } |
| 478 | /********************** module-ops management <END> **************************/ |
| 479 | |
| 480 | |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 481 | /**************************** suspend / resume *******************************/ |
| 482 | static int appldata_freeze(struct device *dev) |
| 483 | { |
| 484 | struct appldata_ops *ops; |
| 485 | int rc; |
| 486 | struct list_head *lh; |
| 487 | |
| 488 | get_online_cpus(); |
| 489 | spin_lock(&appldata_timer_lock); |
| 490 | if (appldata_timer_active) { |
| 491 | __appldata_vtimer_setup(APPLDATA_DEL_TIMER); |
| 492 | appldata_timer_suspended = 1; |
| 493 | } |
| 494 | spin_unlock(&appldata_timer_lock); |
| 495 | put_online_cpus(); |
| 496 | |
| 497 | mutex_lock(&appldata_ops_mutex); |
| 498 | list_for_each(lh, &appldata_ops_list) { |
| 499 | ops = list_entry(lh, struct appldata_ops, list); |
| 500 | if (ops->active == 1) { |
| 501 | rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, |
| 502 | (unsigned long) ops->data, ops->size, |
| 503 | ops->mod_lvl); |
| 504 | if (rc != 0) |
| 505 | pr_err("Stopping the data collection for %s " |
| 506 | "failed with rc=%d\n", ops->name, rc); |
| 507 | } |
| 508 | } |
| 509 | mutex_unlock(&appldata_ops_mutex); |
| 510 | return 0; |
| 511 | } |
| 512 | |
| 513 | static int appldata_restore(struct device *dev) |
| 514 | { |
| 515 | struct appldata_ops *ops; |
| 516 | int rc; |
| 517 | struct list_head *lh; |
| 518 | |
| 519 | get_online_cpus(); |
| 520 | spin_lock(&appldata_timer_lock); |
| 521 | if (appldata_timer_suspended) { |
| 522 | __appldata_vtimer_setup(APPLDATA_ADD_TIMER); |
| 523 | appldata_timer_suspended = 0; |
| 524 | } |
| 525 | spin_unlock(&appldata_timer_lock); |
| 526 | put_online_cpus(); |
| 527 | |
| 528 | mutex_lock(&appldata_ops_mutex); |
| 529 | list_for_each(lh, &appldata_ops_list) { |
| 530 | ops = list_entry(lh, struct appldata_ops, list); |
| 531 | if (ops->active == 1) { |
| 532 | ops->callback(ops->data); // init record |
| 533 | rc = appldata_diag(ops->record_nr, |
| 534 | APPLDATA_START_INTERVAL_REC, |
| 535 | (unsigned long) ops->data, ops->size, |
| 536 | ops->mod_lvl); |
| 537 | if (rc != 0) { |
| 538 | pr_err("Starting the data collection for %s " |
| 539 | "failed with rc=%d\n", ops->name, rc); |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | mutex_unlock(&appldata_ops_mutex); |
| 544 | return 0; |
| 545 | } |
| 546 | |
| 547 | static int appldata_thaw(struct device *dev) |
| 548 | { |
| 549 | return appldata_restore(dev); |
| 550 | } |
| 551 | |
Alexey Dobriyan | 4714521 | 2009-12-14 18:00:08 -0800 | [diff] [blame] | 552 | static const struct dev_pm_ops appldata_pm_ops = { |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 553 | .freeze = appldata_freeze, |
| 554 | .thaw = appldata_thaw, |
| 555 | .restore = appldata_restore, |
| 556 | }; |
| 557 | |
| 558 | static struct platform_driver appldata_pdrv = { |
| 559 | .driver = { |
| 560 | .name = "appldata", |
| 561 | .owner = THIS_MODULE, |
| 562 | .pm = &appldata_pm_ops, |
| 563 | }, |
| 564 | }; |
| 565 | /************************* suspend / resume <END> ****************************/ |
| 566 | |
| 567 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | /******************************* init / exit *********************************/ |
| 569 | |
Heiko Carstens | 84b36a8 | 2007-06-19 13:10:03 +0200 | [diff] [blame] | 570 | static void __cpuinit appldata_online_cpu(int cpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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) |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 575 | &appldata_work; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Satyam Sharma | 076fc80 | 2007-10-12 16:11:32 +0200 | [diff] [blame] | 582 | static void __cpuinit appldata_offline_cpu(int cpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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()); |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 587 | queue_work(appldata_wq, &appldata_work); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | } |
| 589 | spin_lock(&appldata_timer_lock); |
| 590 | __appldata_vtimer_setup(APPLDATA_MOD_TIMER); |
| 591 | spin_unlock(&appldata_timer_lock); |
| 592 | } |
| 593 | |
Satyam Sharma | 11b8bf0 | 2007-10-12 16:11:31 +0200 | [diff] [blame] | 594 | static int __cpuinit appldata_cpu_notify(struct notifier_block *self, |
| 595 | unsigned long action, |
| 596 | void *hcpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | { |
| 598 | switch (action) { |
| 599 | case CPU_ONLINE: |
Rafael J. Wysocki | 8bb7844 | 2007-05-09 02:35:10 -0700 | [diff] [blame] | 600 | case CPU_ONLINE_FROZEN: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | appldata_online_cpu((long) hcpu); |
| 602 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | case CPU_DEAD: |
Rafael J. Wysocki | 8bb7844 | 2007-05-09 02:35:10 -0700 | [diff] [blame] | 604 | case CPU_DEAD_FROZEN: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | appldata_offline_cpu((long) hcpu); |
| 606 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 607 | default: |
| 608 | break; |
| 609 | } |
| 610 | return NOTIFY_OK; |
| 611 | } |
| 612 | |
Heiko Carstens | 84b36a8 | 2007-06-19 13:10:03 +0200 | [diff] [blame] | 613 | static struct notifier_block __cpuinitdata appldata_nb = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 614 | .notifier_call = appldata_cpu_notify, |
| 615 | }; |
| 616 | |
| 617 | /* |
| 618 | * appldata_init() |
| 619 | * |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 620 | * init timer, register /proc entries |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 621 | */ |
| 622 | static int __init appldata_init(void) |
| 623 | { |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 624 | int i, rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 625 | |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 626 | rc = platform_driver_register(&appldata_pdrv); |
| 627 | if (rc) |
| 628 | return rc; |
| 629 | |
| 630 | appldata_pdev = platform_device_register_simple("appldata", -1, NULL, |
| 631 | 0); |
| 632 | if (IS_ERR(appldata_pdev)) { |
| 633 | rc = PTR_ERR(appldata_pdev); |
| 634 | goto out_driver; |
| 635 | } |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 636 | appldata_wq = create_singlethread_workqueue("appldata"); |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 637 | if (!appldata_wq) { |
| 638 | rc = -ENOMEM; |
| 639 | goto out_device; |
| 640 | } |
Gerald Schaefer | f26d583 | 2005-06-04 15:43:33 -0700 | [diff] [blame] | 641 | |
Gerald Schaefer | 1760537 | 2008-05-30 10:03:28 +0200 | [diff] [blame] | 642 | get_online_cpus(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 643 | for_each_online_cpu(i) |
| 644 | appldata_online_cpu(i); |
Gerald Schaefer | 1760537 | 2008-05-30 10:03:28 +0200 | [diff] [blame] | 645 | put_online_cpus(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | |
| 647 | /* Register cpu hotplug notifier */ |
Chandra Seetharaman | be6b5a3 | 2006-07-30 03:03:37 -0700 | [diff] [blame] | 648 | register_hotcpu_notifier(&appldata_nb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 649 | |
Eric W. Biederman | 0b4d414 | 2007-02-14 00:34:09 -0800 | [diff] [blame] | 650 | appldata_sysctl_header = register_sysctl_table(appldata_dir_table); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | return 0; |
Gerald Schaefer | 524dbcd | 2009-06-16 10:30:36 +0200 | [diff] [blame] | 652 | |
| 653 | out_device: |
| 654 | platform_device_unregister(appldata_pdev); |
| 655 | out_driver: |
| 656 | platform_driver_unregister(&appldata_pdrv); |
| 657 | return rc; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 658 | } |
| 659 | |
Satyam Sharma | 076fc80 | 2007-10-12 16:11:32 +0200 | [diff] [blame] | 660 | __initcall(appldata_init); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 661 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 662 | /**************************** init / exit <END> ******************************/ |
| 663 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | EXPORT_SYMBOL_GPL(appldata_register_ops); |
| 665 | EXPORT_SYMBOL_GPL(appldata_unregister_ops); |
Gerald Schaefer | 5b5dd21 | 2006-06-29 15:08:35 +0200 | [diff] [blame] | 666 | EXPORT_SYMBOL_GPL(appldata_diag); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 667 | |
Gerald Schaefer | 0c3252d | 2008-07-14 09:57:27 +0200 | [diff] [blame] | 668 | #ifdef CONFIG_SWAP |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 669 | EXPORT_SYMBOL_GPL(si_swapinfo); |
Gerald Schaefer | 0c3252d | 2008-07-14 09:57:27 +0200 | [diff] [blame] | 670 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | EXPORT_SYMBOL_GPL(nr_threads); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 672 | EXPORT_SYMBOL_GPL(nr_running); |
| 673 | EXPORT_SYMBOL_GPL(nr_iowait); |