aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-05-30 08:34:22 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-06-25 03:37:30 -0400
commitb46ddf5d187d603f72389ac047a99e80edb6285d (patch)
treebdd50cc014cfc9e112ffbecb6a3978b309a4b586 /litmus
parent12e4158927c733d15917e3406cdf1c20885b30f9 (diff)
Use vmalloc() to allocate Feather-Trace buffers
Allocating contiguous buffers with kmalloc() is subject to severe maximum size limits. For Feather-Trace to work, we don't actually need *physically* contiguous memory; virtually contiguous memory is sufficient. By switching to vmalloc(), the code gets simpler and we can support much larger buffers. For convenience, this patch also adds a configuration option for the desired Feather-Trace buffer size and increases the default size.
Diffstat (limited to 'litmus')
-rw-r--r--litmus/Kconfig18
-rw-r--r--litmus/ftdev.c19
-rw-r--r--litmus/trace.c6
3 files changed, 24 insertions, 19 deletions
diff --git a/litmus/Kconfig b/litmus/Kconfig
index 795fbe1a769e..6a4e8c08e321 100644
--- a/litmus/Kconfig
+++ b/litmus/Kconfig
@@ -231,6 +231,24 @@ config SCHED_OVERHEAD_TRACE
231 Export event stream for overhead tracing. 231 Export event stream for overhead tracing.
232 Say Yes for overhead tracing. 232 Say Yes for overhead tracing.
233 233
234config SCHED_OVERHEAD_TRACE_SHIFT
235 int "Buffer size for Feather-Trace overhead data"
236 depends on SCHED_OVERHEAD_TRACE
237 range 15 32
238 default 22
239 help
240
241 Select the buffer size for the Feather-Trace overhead tracing
242 infrastructure (/dev/litmus/ft_trace0 & ftcat) as a power of two. The
243 larger the buffer, the less likely the chance of buffer overflows if
244 the ftcat process is starved by real-time activity. In machines with
245 large memories, large buffer sizes are recommended.
246
247 Examples: 16 => 2 MB
248 24 => 512 MB
249 26 => 2G MB
250
251
234config SCHED_DEBUG_TRACE 252config SCHED_DEBUG_TRACE
235 bool "TRACE() debugging" 253 bool "TRACE() debugging"
236 default y 254 default y
diff --git a/litmus/ftdev.c b/litmus/ftdev.c
index 99bc39ffbcef..7126c61e8b4c 100644
--- a/litmus/ftdev.c
+++ b/litmus/ftdev.c
@@ -5,6 +5,7 @@
5#include <asm/uaccess.h> 5#include <asm/uaccess.h>
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/device.h> 7#include <linux/device.h>
8#include <linux/vmalloc.h>
8 9
9#include <litmus/litmus.h> 10#include <litmus/litmus.h>
10#include <litmus/feather_trace.h> 11#include <litmus/feather_trace.h>
@@ -21,13 +22,9 @@ struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size)
21 if (!buf) 22 if (!buf)
22 return NULL; 23 return NULL;
23 24
24 total = (total / PAGE_SIZE) + (total % PAGE_SIZE != 0);
25 while (pages < total) {
26 order++;
27 pages *= 2;
28 }
29 25
30 mem = (char*) __get_free_pages(GFP_KERNEL, order); 26 mem = vmalloc(total);
27
31 if (!mem) { 28 if (!mem) {
32 kfree(buf); 29 kfree(buf);
33 return NULL; 30 return NULL;
@@ -36,7 +33,7 @@ struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size)
36 if (!init_ft_buffer(buf, count, size, 33 if (!init_ft_buffer(buf, count, size,
37 mem + (count * size), /* markers at the end */ 34 mem + (count * size), /* markers at the end */
38 mem)) { /* buffer objects */ 35 mem)) { /* buffer objects */
39 free_pages((unsigned long) mem, order); 36 vfree(mem);
40 kfree(buf); 37 kfree(buf);
41 return NULL; 38 return NULL;
42 } 39 }
@@ -49,13 +46,7 @@ void free_ft_buffer(struct ft_buffer* buf)
49 size_t total; 46 size_t total;
50 47
51 if (buf) { 48 if (buf) {
52 total = (buf->slot_size + 1) * buf->slot_count; 49 vfree(buf->buffer_mem);
53 total = (total / PAGE_SIZE) + (total % PAGE_SIZE != 0);
54 while (pages < total) {
55 order++;
56 pages *= 2;
57 }
58 free_pages((unsigned long) buf->buffer_mem, order);
59 kfree(buf); 50 kfree(buf);
60 } 51 }
61} 52}
diff --git a/litmus/trace.c b/litmus/trace.c
index 7dbb98e4a3cd..9286569f2523 100644
--- a/litmus/trace.c
+++ b/litmus/trace.c
@@ -207,11 +207,7 @@ feather_callback void save_timestamp_hide_irq(unsigned long event)
207/* DEVICE FILE DRIVER */ 207/* DEVICE FILE DRIVER */
208/******************************************************************************/ 208/******************************************************************************/
209 209
210/* 210#define NO_TIMESTAMPS (2 << CONFIG_SCHED_OVERHEAD_TRACE_SHIFT)
211 * should be 8M; it is the max we can ask to buddy system allocator (MAX_ORDER)
212 * and we might not get as much
213 */
214#define NO_TIMESTAMPS (2 << 16)
215 211
216static int alloc_timestamp_buffer(struct ftdev* ftdev, unsigned int idx) 212static int alloc_timestamp_buffer(struct ftdev* ftdev, unsigned int idx)
217{ 213{