This stack check implementation leverages the compiler's profiling (gcc -p)
[linux-2.6.git] / kernel / ckrm / rbce / crbce.h
1 /* 
2  * crbce.h
3  *
4  * Copyright (C) Hubertus Franke, IBM Corp. 2003
5  * 
6  * This files contains the type definition of the record 
7  * created by the CRBCE CKRM classification engine
8  * 
9  * Changes
10  *
11  * 2003-11-11   Created                                 by H.Franke
12  * 2003-12-01   Sanitized for Delivery                  by H.Franke
13  *        
14  */
15
16 #ifndef CRBCE_RECORDS_H
17 #define CRBCE_RECORDS_H
18
19 #include <linux/autoconf.h>     
20 #include <linux/types.h>           
21 #include <linux/ckrm.h>
22 #include <linux/ckrm_ce.h>
23
24 #define CRBCE_UKCC_NAME   "crbce_ukcc"
25 #define CRBCE_UKCC_PATH   "/mnt/relayfs"
26
27 #define CRBCE_UKCC_PATH_NAME   CRBCE_UKCC_PATH"/"CRBCE_UKCC_NAME
28
29 #define CRBCE_MAX_CLASS_NAME_LEN  256
30
31 /****************************************************************
32  * 
33  *  CRBCE EVENT SET is and extension to the standard CKRM_EVENTS
34  *
35  ****************************************************************/
36 enum {
37
38         /* we use the standard CKRM_EVENT_<..> 
39          * to identify reclassification cause actions
40          * and extend by additional ones we need
41          */
42
43         /* up event flow */
44
45         CRBCE_REC_EXIT = CKRM_NUM_EVENTS,
46         CRBCE_REC_DATA_DELIMITER,
47         CRBCE_REC_SAMPLE,
48         CRBCE_REC_TASKINFO,
49         CRBCE_REC_SYS_INFO,
50         CRBCE_REC_CLASS_INFO,
51         CRBCE_REC_KERNEL_CMD_DONE,
52         CRBCE_REC_UKCC_FULL,
53
54         /* down command issueance */
55         CRBCE_REC_KERNEL_CMD,
56
57         CRBCE_NUM_EVENTS
58 };
59
60 struct task_sample_info {
61         uint32_t cpu_running;
62         uint32_t cpu_waiting;
63         uint32_t io_delayed;
64         uint32_t memio_delayed;
65 };
66
67 /*********************************************
68  *          KERNEL -> USER  records          *
69  *********************************************/
70
71 /* we have records with either a time stamp or not */
72 struct crbce_hdr {
73         int type;
74         pid_t pid;
75 };
76
77 struct crbce_hdr_ts {
78         int type;
79         pid_t pid;
80         uint32_t jiffies;
81         uint64_t cls;
82 };
83
84 /* individual records */
85
86 struct crbce_rec_fork {
87         struct crbce_hdr_ts hdr;
88         pid_t ppid;
89 };
90
91 struct crbce_rec_data_delim {
92         struct crbce_hdr_ts hdr;
93         int is_stop;            /* 0 start, 1 stop */
94 };
95
96 struct crbce_rec_task_data {
97         struct crbce_hdr_ts hdr;
98         struct task_sample_info sample;
99         struct task_delay_info delay;
100 };
101
102 struct crbce_ukcc_full {
103         struct crbce_hdr_ts hdr;
104 };
105
106 struct crbce_class_info {
107         struct crbce_hdr_ts hdr;
108         int action;
109         int namelen;
110         char name[CRBCE_MAX_CLASS_NAME_LEN];
111 };
112
113 /*********************************************
114  *           USER -> KERNEL records          *
115  *********************************************/
116
117 enum crbce_kernel_cmd {
118         CRBCE_CMD_START,
119         CRBCE_CMD_STOP,
120         CRBCE_CMD_SET_TIMER,
121         CRBCE_CMD_SEND_DATA,
122 };
123
124 struct crbce_command {
125         int type;               /* we need this for the K->U reflection */
126         int cmd;
127         uint32_t len;   /* added in the kernel for reflection */
128 };
129
130 #define set_cmd_hdr(rec,tok) \
131 ((rec).hdr.type=CRBCE_REC_KERNEL_CMD,(rec).hdr.cmd=(tok))
132
133 struct crbce_cmd_done {
134         struct crbce_command hdr;
135         int rc;
136 };
137
138 struct crbce_cmd {
139         struct crbce_command hdr;
140 };
141
142 struct crbce_cmd_send_data {
143         struct crbce_command hdr;
144         int delta_mode;
145 };
146
147 struct crbce_cmd_settimer {
148         struct crbce_command hdr;
149         uint32_t interval;      /* in msec .. 0 means stop */
150 };
151
152 #endif