From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: adeos-main@gna.org, xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH] use vmalloc'ed trace buffer
Date: Thu, 15 Jun 2006 13:20:11 +0200 [thread overview]
Message-ID: <4491426B.50508@domain.hid> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 440 bytes --]
Hi Philippe,
here is the cleaned up and configurable version of my vmalloc hack for
the I-pipe tracer.
As it has a slight performance impact to use virtual memory for the
trace buffer (running "hackbench 10" in parallel to "latency -p 100" on
a 266 MHz P-MMX: 227 vs. 244 s hackbench runtime), I left this option
off by default. If there is any kind of CONFIG combination that cries
for default on, we can easily add it.
Jan
[-- Attachment #1.2: tracer-dyn-buffer-v2.patch --]
[-- Type: text/plain, Size: 4234 bytes --]
Index: linux-2.6.16.1/kernel/ipipe/Kconfig
===================================================================
--- linux-2.6.16.1.orig/kernel/ipipe/Kconfig
+++ linux-2.6.16.1/kernel/ipipe/Kconfig
@@ -34,3 +34,12 @@ config IPIPE_TRACE_SHIFT
---help---
The number of trace points to hold tracing data for each
trace path, as a power of 2.
+
+config IPIPE_TRACE_VMALLOC
+ bool "Use vmalloc'ed trace buffer"
+ depends on IPIPE_TRACE
+ ---help---
+ Instead of reserving static kernel data, the required buffer
+ is allocated via vmalloc during boot-up when this option is
+ enabled. This can help to start systems that are low on memory,
+ but it slightly degrades overall performance.
Index: linux-2.6.16.1/kernel/ipipe/tracer.c
===================================================================
--- linux-2.6.16.1.orig/kernel/ipipe/tracer.c
+++ linux-2.6.16.1/kernel/ipipe/tracer.c
@@ -2,7 +2,7 @@
* kernel/ipipe/tracer.c
*
* Copyright (C) 2005 Luotao Fu.
- * 2005 Jan Kiszka.
+ * 2005, 2006 Jan Kiszka.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,6 +27,7 @@
#include <linux/seq_file.h>
#include <linux/proc_fs.h>
#include <linux/ctype.h>
+#include <linux/vmalloc.h>
#include <linux/ipipe_trace.h>
#include <asm/uaccess.h>
@@ -86,7 +87,13 @@ enum ipipe_trace_type
};
-int ipipe_trace_enable = 1;
+#ifdef CONFIG_IPIPE_TRACE_VMALLOC
+#define IPIPE_DEFAULT_TRACE_STATE 0
+
+static struct ipipe_trace_path *trace_paths[NR_CPUS];
+
+#else /* !CONFIG_IPIPE_TRACE_VMALLOC */
+#define IPIPE_DEFAULT_TRACE_STATE 1
static struct ipipe_trace_path trace_paths[NR_CPUS][IPIPE_TRACE_PATHS] =
{ [0 ... NR_CPUS-1] =
@@ -94,6 +101,10 @@ static struct ipipe_trace_path trace_pat
{ .begin = -1, .end = -1 }
}
};
+#endif /* CONFIG_IPIPE_TRACE_VMALLOC */
+
+int ipipe_trace_enable = IPIPE_DEFAULT_TRACE_STATE;
+
static int active_path[NR_CPUS] =
{ [0 ... NR_CPUS-1] = IPIPE_DEFAULT_ACTIVE };
static int max_path[NR_CPUS] =
@@ -1097,10 +1108,30 @@ __ipipe_create_trace_proc_val(struct pro
}
}
-void __init __ipipe_init_trace_proc(void)
+void __init __ipipe_init_tracer(void)
{
struct proc_dir_entry *trace_dir;
struct proc_dir_entry *entry;
+#ifdef CONFIG_IPIPE_TRACE_VMALLOC
+ int cpu, path;
+
+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
+ trace_paths[cpu] = vmalloc(
+ sizeof(struct ipipe_trace_path) * IPIPE_TRACE_PATHS);
+ if (!trace_paths) {
+ printk(KERN_ERR "I-pipe: "
+ "insufficient memory for trace buffer.\n");
+ return;
+ }
+ memset(trace_paths[cpu], 0,
+ sizeof(struct ipipe_trace_path) * IPIPE_TRACE_PATHS);
+ for (path = 0; path < IPIPE_TRACE_PATHS; path++) {
+ trace_paths[cpu][path].begin = -1;
+ trace_paths[cpu][path].end = -1;
+ }
+ }
+ ipipe_trace_enable = 1;
+#endif /* CONFIG_IPIPE_TRACE_VMALLOC */
trace_dir = create_proc_entry("trace", S_IFDIR, ipipe_proc_root);
Index: linux-2.6.16.1/include/linux/ipipe.h
===================================================================
--- linux-2.6.16.1.orig/include/linux/ipipe.h
+++ linux-2.6.16.1/include/linux/ipipe.h
@@ -329,9 +329,9 @@ void ipipe_init(void);
void ipipe_init_proc(void);
#ifdef CONFIG_IPIPE_TRACE
-void __ipipe_init_trace_proc(void);
+void __ipipe_init_tracer(void);
#else /* !CONFIG_IPIPE_TRACE */
-#define __ipipe_init_trace_proc() do { } while(0)
+#define __ipipe_init_tracer() do { } while(0)
#endif /* CONFIG_IPIPE_TRACE */
#else /* !CONFIG_PROC_FS */
Index: linux-2.6.16.1/kernel/ipipe/core.c
===================================================================
--- linux-2.6.16.1.orig/kernel/ipipe/core.c
+++ linux-2.6.16.1/kernel/ipipe/core.c
@@ -1012,8 +1012,9 @@ void ipipe_init_proc(void)
{
ipipe_proc_root = create_proc_entry("ipipe",S_IFDIR, 0);
create_proc_read_entry("version",0444,ipipe_proc_root,&__ipipe_version_info_proc,NULL);
- __ipipe_init_trace_proc();
__ipipe_add_domain_proc(ipipe_root_domain);
+
+ __ipipe_init_tracer();
}
#endif /* CONFIG_PROC_FS */
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next reply other threads:[~2006-06-15 11:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-15 11:20 Jan Kiszka [this message]
2006-06-15 14:57 ` [Xenomai-core] Re: [PATCH] use vmalloc'ed trace buffer Philippe Gerum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4491426B.50508@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=adeos-main@gna.org \
--cc=rpm@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.