aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@de.ibm.com>2005-06-25 17:55:33 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:24:37 -0400
commit66a464dbc8e0345b6f972b92bf1118e043d7c987 (patch)
tree4c8f83ce6b1879556025fe77b97629a8380aa4dd /include/asm-s390
parent6b979de395c7e1b7e59f74a870e1d1911853eccb (diff)
[PATCH] s390: debug feature changes
This patch changes the memory allocation method for the s390 debug feature. Trace buffers had been allocated using the get_free_pages() function before. Therefore it was not possible to get big memory areas in a running system due to memory fragmentation. Now the trace buffers are subdivided into several subbuffers with pagesize. Therefore it is now possible to allocate more memory for the trace buffers and more trace records can be written. In addition to that, dynamic specification of the size of the trace buffers is implemented. It is now possible to change the size of a trace buffer using a new debugfs file instance. When writing a number into this file, the trace buffer size is changed to 'number * pagesize'. In the past all the traces could be obtained from userspace by accessing files in the "proc" filesystem. Now with debugfs we have a new filesystem which should be used for debugging purposes. This patch moves the debug feature from procfs to debugfs. Since the interface of debug_register() changed, all device drivers, which use the debug feature had to be adjusted. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-s390')
-rw-r--r--include/asm-s390/debug.h48
1 files changed, 29 insertions, 19 deletions
diff --git a/include/asm-s390/debug.h b/include/asm-s390/debug.h
index 6bbcdea42a86..92360d90144b 100644
--- a/include/asm-s390/debug.h
+++ b/include/asm-s390/debug.h
@@ -9,6 +9,8 @@
9#ifndef DEBUG_H 9#ifndef DEBUG_H
10#define DEBUG_H 10#define DEBUG_H
11 11
12#include <linux/config.h>
13#include <linux/fs.h>
12#include <linux/string.h> 14#include <linux/string.h>
13 15
14/* Note: 16/* Note:
@@ -31,19 +33,18 @@ struct __debug_entry{
31} __attribute__((packed)); 33} __attribute__((packed));
32 34
33 35
34#define __DEBUG_FEATURE_VERSION 1 /* version of debug feature */ 36#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */
35 37
36#ifdef __KERNEL__ 38#ifdef __KERNEL__
37#include <linux/spinlock.h> 39#include <linux/spinlock.h>
38#include <linux/kernel.h> 40#include <linux/kernel.h>
39#include <linux/time.h> 41#include <linux/time.h>
40#include <linux/proc_fs.h>
41 42
42#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ 43#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */
43#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */ 44#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */
44#define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */ 45#define DEBUG_FLUSH_ALL -1 /* parameter to flush all areas */
45#define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */ 46#define DEBUG_MAX_VIEWS 10 /* max number of views in proc fs */
46#define DEBUG_MAX_PROCF_LEN 64 /* max length for a proc file name */ 47#define DEBUG_MAX_NAME_LEN 64 /* max length for a debugfs file name */
47#define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */ 48#define DEBUG_DEFAULT_LEVEL 3 /* initial debug level */
48 49
49#define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */ 50#define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */
@@ -64,16 +65,17 @@ typedef struct debug_info {
64 spinlock_t lock; 65 spinlock_t lock;
65 int level; 66 int level;
66 int nr_areas; 67 int nr_areas;
67 int page_order; 68 int pages_per_area;
68 int buf_size; 69 int buf_size;
69 int entry_size; 70 int entry_size;
70 debug_entry_t** areas; 71 debug_entry_t*** areas;
71 int active_area; 72 int active_area;
72 int *active_entry; 73 int *active_pages;
73 struct proc_dir_entry* proc_root_entry; 74 int *active_entries;
74 struct proc_dir_entry* proc_entries[DEBUG_MAX_VIEWS]; 75 struct dentry* debugfs_root_entry;
76 struct dentry* debugfs_entries[DEBUG_MAX_VIEWS];
75 struct debug_view* views[DEBUG_MAX_VIEWS]; 77 struct debug_view* views[DEBUG_MAX_VIEWS];
76 char name[DEBUG_MAX_PROCF_LEN]; 78 char name[DEBUG_MAX_NAME_LEN];
77} debug_info_t; 79} debug_info_t;
78 80
79typedef int (debug_header_proc_t) (debug_info_t* id, 81typedef int (debug_header_proc_t) (debug_info_t* id,
@@ -98,7 +100,7 @@ int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view,
98 int area, debug_entry_t* entry, char* out_buf); 100 int area, debug_entry_t* entry, char* out_buf);
99 101
100struct debug_view { 102struct debug_view {
101 char name[DEBUG_MAX_PROCF_LEN]; 103 char name[DEBUG_MAX_NAME_LEN];
102 debug_prolog_proc_t* prolog_proc; 104 debug_prolog_proc_t* prolog_proc;
103 debug_header_proc_t* header_proc; 105 debug_header_proc_t* header_proc;
104 debug_format_proc_t* format_proc; 106 debug_format_proc_t* format_proc;
@@ -120,7 +122,7 @@ debug_entry_t* debug_exception_common(debug_info_t* id, int level,
120 122
121/* Debug Feature API: */ 123/* Debug Feature API: */
122 124
123debug_info_t* debug_register(char* name, int pages_index, int nr_areas, 125debug_info_t* debug_register(char* name, int pages, int nr_areas,
124 int buf_size); 126 int buf_size);
125 127
126void debug_unregister(debug_info_t* id); 128void debug_unregister(debug_info_t* id);
@@ -132,7 +134,8 @@ void debug_stop_all(void);
132extern inline debug_entry_t* 134extern inline debug_entry_t*
133debug_event(debug_info_t* id, int level, void* data, int length) 135debug_event(debug_info_t* id, int level, void* data, int length)
134{ 136{
135 if ((!id) || (level > id->level)) return NULL; 137 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
138 return NULL;
136 return debug_event_common(id,level,data,length); 139 return debug_event_common(id,level,data,length);
137} 140}
138 141
@@ -140,7 +143,8 @@ extern inline debug_entry_t*
140debug_int_event(debug_info_t* id, int level, unsigned int tag) 143debug_int_event(debug_info_t* id, int level, unsigned int tag)
141{ 144{
142 unsigned int t=tag; 145 unsigned int t=tag;
143 if ((!id) || (level > id->level)) return NULL; 146 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
147 return NULL;
144 return debug_event_common(id,level,&t,sizeof(unsigned int)); 148 return debug_event_common(id,level,&t,sizeof(unsigned int));
145} 149}
146 150
@@ -148,14 +152,16 @@ extern inline debug_entry_t *
148debug_long_event (debug_info_t* id, int level, unsigned long tag) 152debug_long_event (debug_info_t* id, int level, unsigned long tag)
149{ 153{
150 unsigned long t=tag; 154 unsigned long t=tag;
151 if ((!id) || (level > id->level)) return NULL; 155 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
156 return NULL;
152 return debug_event_common(id,level,&t,sizeof(unsigned long)); 157 return debug_event_common(id,level,&t,sizeof(unsigned long));
153} 158}
154 159
155extern inline debug_entry_t* 160extern inline debug_entry_t*
156debug_text_event(debug_info_t* id, int level, const char* txt) 161debug_text_event(debug_info_t* id, int level, const char* txt)
157{ 162{
158 if ((!id) || (level > id->level)) return NULL; 163 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
164 return NULL;
159 return debug_event_common(id,level,txt,strlen(txt)); 165 return debug_event_common(id,level,txt,strlen(txt));
160} 166}
161 167
@@ -167,7 +173,8 @@ debug_sprintf_event(debug_info_t* id,int level,char *string,...)
167extern inline debug_entry_t* 173extern inline debug_entry_t*
168debug_exception(debug_info_t* id, int level, void* data, int length) 174debug_exception(debug_info_t* id, int level, void* data, int length)
169{ 175{
170 if ((!id) || (level > id->level)) return NULL; 176 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
177 return NULL;
171 return debug_exception_common(id,level,data,length); 178 return debug_exception_common(id,level,data,length);
172} 179}
173 180
@@ -175,7 +182,8 @@ extern inline debug_entry_t*
175debug_int_exception(debug_info_t* id, int level, unsigned int tag) 182debug_int_exception(debug_info_t* id, int level, unsigned int tag)
176{ 183{
177 unsigned int t=tag; 184 unsigned int t=tag;
178 if ((!id) || (level > id->level)) return NULL; 185 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
186 return NULL;
179 return debug_exception_common(id,level,&t,sizeof(unsigned int)); 187 return debug_exception_common(id,level,&t,sizeof(unsigned int));
180} 188}
181 189
@@ -183,14 +191,16 @@ extern inline debug_entry_t *
183debug_long_exception (debug_info_t* id, int level, unsigned long tag) 191debug_long_exception (debug_info_t* id, int level, unsigned long tag)
184{ 192{
185 unsigned long t=tag; 193 unsigned long t=tag;
186 if ((!id) || (level > id->level)) return NULL; 194 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
195 return NULL;
187 return debug_exception_common(id,level,&t,sizeof(unsigned long)); 196 return debug_exception_common(id,level,&t,sizeof(unsigned long));
188} 197}
189 198
190extern inline debug_entry_t* 199extern inline debug_entry_t*
191debug_text_exception(debug_info_t* id, int level, const char* txt) 200debug_text_exception(debug_info_t* id, int level, const char* txt)
192{ 201{
193 if ((!id) || (level > id->level)) return NULL; 202 if ((!id) || (level > id->level) || (id->pages_per_area == 0))
203 return NULL;
194 return debug_exception_common(id,level,txt,strlen(txt)); 204 return debug_exception_common(id,level,txt,strlen(txt));
195} 205}
196 206