patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / arch / s390 / appldata / appldata_base.c
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  *
8  * Copyright (C) 2003 IBM Corporation, IBM Deutschland Entwicklung GmbH.
9  *
10  * Author: Gerald Schaefer <geraldsc@de.ibm.com>
11  */
12
13 #include <linux/config.h>
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/slab.h>
17 #include <linux/errno.h>
18 #include <asm/uaccess.h>
19 #include <asm/io.h>
20 #include <linux/interrupt.h>
21 #include <linux/proc_fs.h>
22 #include <linux/page-flags.h>
23 #include <linux/swap.h>
24 #include <linux/pagemap.h>
25 #include <linux/sysctl.h>
26 #include <asm/timer.h>
27 //#include <linux/kernel_stat.h>
28
29 #include "appldata.h"
30
31
32 #define MY_PRINT_NAME   "appldata"              /* for debug messages, etc. */
33 #define APPLDATA_CPU_INTERVAL   10000           /* default (CPU) time for
34                                                    sampling interval in
35                                                    milliseconds */
36
37 #define TOD_MICRO       0x01000                 /* nr. of TOD clock units
38                                                    for 1 microsecond */
39 #ifndef CONFIG_ARCH_S390X
40
41 #define APPLDATA_START_INTERVAL_REC 0x00        /* Function codes for */
42 #define APPLDATA_STOP_REC           0x01        /* DIAG 0xDC      */
43 #define APPLDATA_GEN_EVENT_RECORD   0x02
44 #define APPLDATA_START_CONFIG_REC   0x03
45
46 #else
47
48 #define APPLDATA_START_INTERVAL_REC 0x80
49 #define APPLDATA_STOP_REC           0x81
50 #define APPLDATA_GEN_EVENT_RECORD   0x82
51 #define APPLDATA_START_CONFIG_REC   0x83
52
53 #endif /* CONFIG_ARCH_S390X */
54
55
56 /*
57  * Parameter list for DIAGNOSE X'DC'
58  */
59 #ifndef CONFIG_ARCH_S390X
60 struct appldata_parameter_list {
61         u16 diag;               /* The DIAGNOSE code X'00DC'          */
62         u8  function;           /* The function code for the DIAGNOSE */
63         u8  parlist_length;     /* Length of the parameter list       */
64         u32 product_id_addr;    /* Address of the 16-byte product ID  */
65         u16 reserved;
66         u16 buffer_length;      /* Length of the application data buffer  */
67         u32 buffer_addr;        /* Address of the application data buffer */
68 };
69 #else
70 struct appldata_parameter_list {
71         u16 diag;
72         u8  function;
73         u8  parlist_length;
74         u32 unused01;
75         u16 reserved;
76         u16 buffer_length;
77         u32 unused02;
78         u64 product_id_addr;
79         u64 buffer_addr;
80 };
81 #endif /* CONFIG_ARCH_S390X */
82
83 /*
84  * /proc entries (sysctl)
85  */
86 static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";
87 static int appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
88                                   void __user *buffer, size_t *lenp);
89 static int appldata_interval_handler(ctl_table *ctl, int write,
90                                          struct file *filp,
91                                          void __user *buffer,
92                                          size_t *lenp);
93
94 static struct ctl_table_header *appldata_sysctl_header;
95 static struct ctl_table appldata_table[] = {
96         {
97                 .ctl_name       = CTL_APPLDATA_TIMER,
98                 .procname       = "timer",
99                 .mode           = S_IRUGO | S_IWUSR,
100                 .proc_handler   = &appldata_timer_handler,
101         },
102         {
103                 .ctl_name       = CTL_APPLDATA_INTERVAL,
104                 .procname       = "interval",
105                 .mode           = S_IRUGO | S_IWUSR,
106                 .proc_handler   = &appldata_interval_handler,
107         },
108         { .ctl_name = 0 }
109 };
110
111 static struct ctl_table appldata_dir_table[] = {
112         {
113                 .ctl_name       = CTL_APPLDATA,
114                 .procname       = appldata_proc_name,
115                 .maxlen         = 0,
116                 .mode           = S_IRUGO | S_IXUGO,
117                 .child          = appldata_table,
118         },
119         { .ctl_name = 0 }
120 };
121
122 /*
123  * Timer
124  */
125 DEFINE_PER_CPU(struct vtimer_list, appldata_timer);
126 static atomic_t appldata_expire_count = ATOMIC_INIT(0);
127 static struct appldata_mod_vtimer_args {
128         struct vtimer_list *timer;
129         u64    expires;
130 } appldata_mod_vtimer_args;
131
132 static spinlock_t appldata_timer_lock = SPIN_LOCK_UNLOCKED;
133 static int appldata_interval = APPLDATA_CPU_INTERVAL;
134 static int appldata_timer_active;
135
136 /*
137  * Tasklet
138  */
139 static struct tasklet_struct appldata_tasklet_struct;
140
141 /*
142  * Ops list
143  */
144 static spinlock_t appldata_ops_lock = SPIN_LOCK_UNLOCKED;
145 static LIST_HEAD(appldata_ops_list);
146
147
148 /************************* timer, tasklet, DIAG ******************************/
149 /*
150  * appldata_timer_function()
151  *
152  * schedule tasklet and reschedule timer
153  */
154 static void appldata_timer_function(unsigned long data, struct pt_regs *regs)
155 {
156         P_DEBUG("   -= Timer =-\n");
157         P_DEBUG("CPU: %i, expire: %i\n", smp_processor_id(),
158                 atomic_read(&appldata_expire_count));
159         if (atomic_dec_and_test(&appldata_expire_count)) {
160                 atomic_set(&appldata_expire_count, num_online_cpus());
161                 tasklet_schedule((struct tasklet_struct *) data);
162         }
163 }
164
165 /*
166  * appldata_tasklet_function()
167  *
168  * call data gathering function for each (active) module
169  */
170 static void appldata_tasklet_function(unsigned long data)
171 {
172         struct list_head *lh;
173         struct appldata_ops *ops;
174         int i;
175
176         P_DEBUG("  -= Tasklet =-\n");
177         i = 0;
178         spin_lock(&appldata_ops_lock);
179         list_for_each(lh, &appldata_ops_list) {
180                 ops = list_entry(lh, struct appldata_ops, list);
181                 P_DEBUG("list_for_each loop: %i) active = %u, name = %s\n",
182                         ++i, ops->active, ops->name);
183                 if (ops->active == 1) {
184                         ops->callback(ops->data);
185                 }
186         }
187         spin_unlock(&appldata_ops_lock);
188 }
189
190 /*
191  * appldata_mod_vtimer_wrap()
192  *
193  * wrapper function for mod_virt_timer(), because smp_call_function_on()
194  * accepts only one parameter.
195  */
196 static void appldata_mod_vtimer_wrap(void *p) {
197         struct appldata_mod_vtimer_args *args = p;
198         mod_virt_timer(args->timer, args->expires);
199 }
200
201 /*
202  * appldata_diag()
203  *
204  * prepare parameter list, issue DIAG 0xDC
205  */
206 static int appldata_diag(char record_nr, u16 function, unsigned long buffer,
207                         u16 length)
208 {
209         unsigned long ry;
210         struct appldata_product_id {
211                 char prod_nr[7];                        /* product nr. */
212                 char prod_fn[2];                        /* product function */
213                 char record_nr;                         /* record nr. */
214                 char version_nr[2];                     /* version */
215                 char release_nr[2];                     /* release */
216                 char mod_lvl[2];                        /* modification lvl. */
217         } appldata_product_id = {
218         /* all strings are EBCDIC, record_nr is byte */
219                 .prod_nr    = {0xD3, 0xC9, 0xD5, 0xE4,
220                                 0xE7, 0xD2, 0xD9},      /* "LINUXKR" */
221                 .prod_fn    = {0xD5, 0xD3},             /* "NL" */
222                 .record_nr  = record_nr,
223                 .version_nr = {0xF2, 0xF6},             /* "26" */
224                 .release_nr = {0xF0, 0xF1},             /* "01" */
225                 .mod_lvl    = {0xF0, 0xF0},             /* "00" */
226         };
227         struct appldata_parameter_list appldata_parameter_list = {
228                                 .diag = 0xDC,
229                                 .function = function,
230                                 .parlist_length =
231                                         sizeof(appldata_parameter_list),
232                                 .buffer_length = length,
233                                 .product_id_addr =
234                                         (unsigned long) &appldata_product_id,
235                                 .buffer_addr = virt_to_phys((void *) buffer)
236         };
237
238         if (!MACHINE_IS_VM)
239                 return -ENOSYS;
240         ry = -1;
241         asm volatile(
242                         "diag %1,%0,0xDC\n\t"
243                         : "=d" (ry) : "d" (&(appldata_parameter_list)) : "cc");
244         return (int) ry;
245 }
246 /********************** timer, tasklet, DIAG <END> ***************************/
247
248
249 /****************************** /proc stuff **********************************/
250 /*
251  * appldata_timer_handler()
252  *
253  * Start/Stop timer, show status of timer (0 = not active, 1 = active)
254  */
255 static int
256 appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
257                            void __user *buffer, size_t *lenp)
258 {
259         int len, i;
260         char buf[2];
261         u64 per_cpu_interval;
262
263         if (!*lenp || filp->f_pos) {
264                 *lenp = 0;
265                 return 0;
266         }
267         if (!write) {
268                 len = sprintf(buf, appldata_timer_active ? "1\n" : "0\n");
269                 if (len > *lenp)
270                         len = *lenp;
271                 if (copy_to_user(buffer, buf, len))
272                         return -EFAULT;
273                 goto out;
274         }
275         per_cpu_interval = (u64) (appldata_interval*1000 /
276                                  num_online_cpus()) * TOD_MICRO;
277         len = *lenp;
278         if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len))
279                 return -EFAULT;
280         spin_lock(&appldata_timer_lock);
281         per_cpu_interval = (u64) (appldata_interval*1000 /
282                                  num_online_cpus()) * TOD_MICRO;
283         if ((buf[0] == '1') && (!appldata_timer_active)) {
284                 for (i = 0; i < num_online_cpus(); i++) {
285                         per_cpu(appldata_timer, i).expires = per_cpu_interval;
286                         smp_call_function_on(add_virt_timer_periodic,
287                                                 &per_cpu(appldata_timer, i),
288                                                 0, 1, i);
289                 }
290                 appldata_timer_active = 1;
291                 P_INFO("Monitoring timer started.\n");
292         } else if ((buf[0] == '0') && (appldata_timer_active)) {
293                 for (i = 0; i < num_online_cpus(); i++) {
294                         del_virt_timer(&per_cpu(appldata_timer, i));
295                 }
296                 appldata_timer_active = 0;
297                 P_INFO("Monitoring timer stopped.\n");
298         }
299         spin_unlock(&appldata_timer_lock);
300 out:
301         *lenp = len;
302         filp->f_pos += len;
303         return 0;
304 }
305
306 /*
307  * appldata_interval_handler()
308  *
309  * Set (CPU) timer interval for collection of data (in milliseconds), show
310  * current timer interval.
311  */
312 static int
313 appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
314                            void __user *buffer, size_t *lenp)
315 {
316         int len, i, interval;
317         char buf[16];
318         u64 per_cpu_interval;
319
320         if (!*lenp || filp->f_pos) {
321                 *lenp = 0;
322                 return 0;
323         }
324         if (!write) {
325                 len = sprintf(buf, "%i\n", appldata_interval);
326                 if (len > *lenp)
327                         len = *lenp;
328                 if (copy_to_user(buffer, buf, len))
329                         return -EFAULT;
330                 goto out;
331         }
332         len = *lenp;
333         if (copy_from_user(buf, buffer, len > sizeof(buf) ? sizeof(buf) : len)) {
334                 return -EFAULT;
335         }
336         sscanf(buf, "%i", &interval);
337         if (interval <= 0) {
338                 P_ERROR("Timer CPU interval has to be > 0!\n");
339                 return -EINVAL;
340         }
341
342         spin_lock(&appldata_timer_lock);
343         per_cpu_interval = (u64) (interval*1000 / num_online_cpus()) * TOD_MICRO;
344         appldata_interval = interval;
345         if (appldata_timer_active) {
346                 for (i = 0; i < num_online_cpus(); i++) {
347                         appldata_mod_vtimer_args.timer =
348                                         &per_cpu(appldata_timer, i);
349                         appldata_mod_vtimer_args.expires =
350                                         per_cpu_interval;
351                         smp_call_function_on(
352                                 appldata_mod_vtimer_wrap,
353                                 &appldata_mod_vtimer_args,
354                                 0, 1, i);
355                 }
356         }
357         spin_unlock(&appldata_timer_lock);
358
359         P_INFO("Monitoring CPU interval set to %u milliseconds.\n",
360                  interval);
361 out:
362         *lenp = len;
363         filp->f_pos += len;
364         return 0;
365 }
366
367 /*
368  * appldata_generic_handler()
369  *
370  * Generic start/stop monitoring and DIAG, show status of
371  * monitoring (0 = not in process, 1 = in process)
372  */
373 static int
374 appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
375                            void __user *buffer, size_t *lenp)
376 {
377         struct appldata_ops *ops = NULL, *tmp_ops;
378         int rc, len, found;
379         char buf[2];
380         struct list_head *lh;
381
382         found = 0;
383         spin_lock_bh(&appldata_ops_lock);
384         list_for_each(lh, &appldata_ops_list) {
385                 tmp_ops = list_entry(lh, struct appldata_ops, list);
386                 if (&tmp_ops->ctl_table[2] == ctl) {
387                         found = 1;
388                 }
389         }
390         if (!found) {
391                 spin_unlock_bh(&appldata_ops_lock);
392                 return -ENODEV;
393         }
394         ops = ctl->data;
395         if (!try_module_get(ops->owner)) {      // protect this function
396                 spin_unlock_bh(&appldata_ops_lock);
397                 return -ENODEV;
398         }
399         spin_unlock_bh(&appldata_ops_lock);
400
401         if (!*lenp || filp->f_pos) {
402                 *lenp = 0;
403                 module_put(ops->owner);
404                 return 0;
405         }
406         if (!write) {
407                 len = sprintf(buf, ops->active ? "1\n" : "0\n");
408                 if (len > *lenp)
409                         len = *lenp;
410                 if (copy_to_user(buffer, buf, len)) {
411                         module_put(ops->owner);
412                         return -EFAULT;
413                 }
414                 goto out;
415         }
416         len = *lenp;
417         if (copy_from_user(buf, buffer,
418                            len > sizeof(buf) ? sizeof(buf) : len)) {
419                 module_put(ops->owner);
420                 return -EFAULT;
421         }
422
423         spin_lock_bh(&appldata_ops_lock);
424         if ((buf[0] == '1') && (ops->active == 0)) {
425                 if (!try_module_get(ops->owner)) {      // protect tasklet
426                         spin_unlock_bh(&appldata_ops_lock);
427                         module_put(ops->owner);
428                         return -ENODEV;
429                 }
430                 ops->active = 1;
431                 ops->callback(ops->data);       // init record
432                 rc = appldata_diag(ops->record_nr,
433                                         APPLDATA_START_INTERVAL_REC,
434                                         (unsigned long) ops->data, ops->size);
435                 if (rc != 0) {
436                         P_ERROR("START DIAG 0xDC for %s failed, "
437                                 "return code: %d\n", ops->name, rc);
438                         module_put(ops->owner);
439                         ops->active = 0;
440                 } else {
441                         P_INFO("Monitoring %s data enabled, "
442                                 "DIAG 0xDC started.\n", ops->name);
443                 }
444         } else if ((buf[0] == '0') && (ops->active == 1)) {
445                 ops->active = 0;
446                 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC,
447                                 (unsigned long) ops->data, ops->size);
448                 if (rc != 0) {
449                         P_ERROR("STOP DIAG 0xDC for %s failed, "
450                                 "return code: %d\n", ops->name, rc);
451                 } else {
452                         P_INFO("Monitoring %s data disabled, "
453                                 "DIAG 0xDC stopped.\n", ops->name);
454                 }
455                 module_put(ops->owner);
456         }
457         spin_unlock_bh(&appldata_ops_lock);
458 out:
459         *lenp = len;
460         filp->f_pos += len;
461         module_put(ops->owner);
462         return 0;
463 }
464
465 /*************************** /proc stuff <END> *******************************/
466
467
468 /************************* module-ops management *****************************/
469 /*
470  * appldata_register_ops()
471  *
472  * update ops list, register /proc/sys entries
473  */
474 int appldata_register_ops(struct appldata_ops *ops)
475 {
476         struct list_head *lh;
477         struct appldata_ops *tmp_ops;
478         int i;
479
480         i = 0;
481
482         if ((ops->size > APPLDATA_MAX_REC_SIZE) ||
483                 (ops->size < 0)){
484                 P_ERROR("Invalid size of %s record = %i, maximum = %i!\n",
485                         ops->name, ops->size, APPLDATA_MAX_REC_SIZE);
486                 return -ENOMEM;
487         }
488         if ((ops->ctl_nr == CTL_APPLDATA) ||
489             (ops->ctl_nr == CTL_APPLDATA_TIMER) ||
490             (ops->ctl_nr == CTL_APPLDATA_INTERVAL)) {
491                 P_ERROR("ctl_nr %i already in use!\n", ops->ctl_nr);
492                 return -EBUSY;
493         }
494         ops->ctl_table = kmalloc(4*sizeof(struct ctl_table), GFP_KERNEL);
495         if (ops->ctl_table == NULL) {
496                 P_ERROR("Not enough memory for %s ctl_table!\n", ops->name);
497                 return -ENOMEM;
498         }
499         memset(ops->ctl_table, 0, 4*sizeof(struct ctl_table));
500
501         spin_lock_bh(&appldata_ops_lock);
502         list_for_each(lh, &appldata_ops_list) {
503                 tmp_ops = list_entry(lh, struct appldata_ops, list);
504                 P_DEBUG("register_ops loop: %i) name = %s, ctl = %i\n",
505                         ++i, tmp_ops->name, tmp_ops->ctl_nr);
506                 P_DEBUG("Comparing %s (ctl %i) with %s (ctl %i)\n",
507                         tmp_ops->name, tmp_ops->ctl_nr, ops->name,
508                         ops->ctl_nr);
509                 if (strncmp(tmp_ops->name, ops->name,
510                                 APPLDATA_PROC_NAME_LENGTH) == 0) {
511                         P_ERROR("Name \"%s\" already registered!\n", ops->name);
512                         kfree(ops->ctl_table);
513                         spin_unlock_bh(&appldata_ops_lock);
514                         return -EBUSY;
515                 }
516                 if (tmp_ops->ctl_nr == ops->ctl_nr) {
517                         P_ERROR("ctl_nr %i already registered!\n", ops->ctl_nr);
518                         kfree(ops->ctl_table);
519                         spin_unlock_bh(&appldata_ops_lock);
520                         return -EBUSY;
521                 }
522         }
523         list_add(&ops->list, &appldata_ops_list);
524         spin_unlock_bh(&appldata_ops_lock);
525
526         ops->ctl_table[0].ctl_name = CTL_APPLDATA;
527         ops->ctl_table[0].procname = appldata_proc_name;
528         ops->ctl_table[0].maxlen   = 0;
529         ops->ctl_table[0].mode     = S_IRUGO | S_IXUGO;
530         ops->ctl_table[0].child    = &ops->ctl_table[2];
531
532         ops->ctl_table[1].ctl_name = 0;
533
534         ops->ctl_table[2].ctl_name = ops->ctl_nr;
535         ops->ctl_table[2].procname = ops->name;
536         ops->ctl_table[2].mode     = S_IRUGO | S_IWUSR;
537         ops->ctl_table[2].proc_handler = appldata_generic_handler;
538         ops->ctl_table[2].data = ops;
539
540         ops->ctl_table[3].ctl_name = 0;
541
542         ops->sysctl_header = register_sysctl_table(ops->ctl_table,1);
543
544         P_INFO("%s-ops registered!\n", ops->name);
545         return 0;
546 }
547
548 /*
549  * appldata_unregister_ops()
550  *
551  * update ops list, unregister /proc entries, stop DIAG if necessary
552  */
553 void appldata_unregister_ops(struct appldata_ops *ops)
554 {
555         spin_lock_bh(&appldata_ops_lock);
556         unregister_sysctl_table(ops->sysctl_header);
557         list_del(&ops->list);
558         kfree(ops->ctl_table);
559         ops->ctl_table = NULL;
560         spin_unlock_bh(&appldata_ops_lock);
561         P_INFO("%s-ops unregistered!\n", ops->name);
562 }
563 /********************** module-ops management <END> **************************/
564
565
566 /******************************* init / exit *********************************/
567 /*
568  * appldata_init()
569  *
570  * init timer and tasklet, register /proc entries
571  */
572 static int __init appldata_init(void)
573 {
574         int i;
575
576         P_DEBUG("sizeof(parameter_list) = %lu\n",
577                 sizeof(struct appldata_parameter_list));
578
579         for (i = 0; i < num_online_cpus(); i++) {
580                 init_virt_timer(&per_cpu(appldata_timer, i));
581                 per_cpu(appldata_timer, i).function = appldata_timer_function;
582                 per_cpu(appldata_timer, i).data = (unsigned long)
583                                                 &appldata_tasklet_struct;
584         }
585         atomic_set(&appldata_expire_count, num_online_cpus());
586
587         appldata_sysctl_header = register_sysctl_table(appldata_dir_table, 1);
588 #ifdef MODULE
589         appldata_dir_table[0].de->owner = THIS_MODULE;
590         appldata_table[0].de->owner = THIS_MODULE;
591         appldata_table[1].de->owner = THIS_MODULE;
592 #endif
593
594         tasklet_init(&appldata_tasklet_struct, appldata_tasklet_function, 0);
595         P_DEBUG("Base interface initialized.\n");
596         return 0;
597 }
598
599 /*
600  * appldata_exit()
601  *
602  * stop timer and tasklet, unregister /proc entries
603  */
604 static void __exit appldata_exit(void)
605 {
606         struct list_head *lh;
607         struct appldata_ops *ops;
608         int rc, i;
609
610         P_DEBUG("Unloading module ...\n");
611         /*
612          * ops list should be empty, but just in case something went wrong...
613          */
614         spin_lock_bh(&appldata_ops_lock);
615         list_for_each(lh, &appldata_ops_list) {
616                 ops = list_entry(lh, struct appldata_ops, list);
617                 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC,
618                                 (unsigned long) ops->data, ops->size);
619                 if (rc != 0) {
620                         P_ERROR("STOP DIAG 0xDC for %s failed, "
621                                 "return code: %d\n", ops->name, rc);
622                 }
623         }
624         spin_unlock_bh(&appldata_ops_lock);
625
626         for (i = 0; i < num_online_cpus(); i++) {
627                 del_virt_timer(&per_cpu(appldata_timer, i));
628         }
629         appldata_timer_active = 0;
630
631         unregister_sysctl_table(appldata_sysctl_header);
632
633         tasklet_kill(&appldata_tasklet_struct);
634         P_DEBUG("... module unloaded!\n");
635 }
636 /**************************** init / exit <END> ******************************/
637
638
639 module_init(appldata_init);
640 module_exit(appldata_exit);
641 MODULE_LICENSE("GPL");
642 MODULE_AUTHOR("Gerald Schaefer");
643 MODULE_DESCRIPTION("Linux-VM Monitor Stream, base infrastructure");
644
645 EXPORT_SYMBOL_GPL(appldata_register_ops);
646 EXPORT_SYMBOL_GPL(appldata_unregister_ops);
647
648 #ifdef MODULE
649 /*
650  * Kernel symbols needed by appldata_mem and appldata_os modules.
651  * However, if this file is compiled as a module (for testing only), these
652  * symbols are not exported. In this case, we define them locally and export
653  * those.
654  */
655 void si_swapinfo(struct sysinfo *val)
656 {
657         val->freeswap = -1ul;
658         val->totalswap = -1ul;
659 }
660
661 unsigned long avenrun[3] = {-1 - FIXED_1/200, -1 - FIXED_1/200,
662                                 -1 - FIXED_1/200};
663 int nr_threads = -1;
664
665 void get_full_page_state(struct page_state *ps)
666 {
667         memset(ps, -1, sizeof(struct page_state));
668 }
669
670 unsigned long nr_running(void)
671 {
672         return -1;
673 }
674
675 unsigned long nr_iowait(void)
676 {
677         return -1;
678 }
679
680 /*unsigned long nr_context_switches(void)
681 {
682         return -1;
683 }*/
684 #endif /* MODULE */
685 EXPORT_SYMBOL_GPL(si_swapinfo);
686 EXPORT_SYMBOL_GPL(nr_threads);
687 EXPORT_SYMBOL_GPL(avenrun);
688 EXPORT_SYMBOL_GPL(get_full_page_state);
689 EXPORT_SYMBOL_GPL(nr_running);
690 EXPORT_SYMBOL_GPL(nr_iowait);
691 //EXPORT_SYMBOL_GPL(nr_context_switches);