Re: [PROBLEM] hard-lock with kmemtrace, relayfs, and splice

From: Pekka Enberg
Date: Tue Oct 14 2008 - 03:05:37 EST


On Tue, 2008-10-14 at 08:13 +0300, Pekka Enberg wrote:
> Hi Tom,
>
> Tom Zanussi wrote:
> > To me, that sounds like how it should work - if kmemtrace is disabled,
> > it shouldn't be logging anything, and that's in fact what I saw when
> > debugging this - it started out disabled and therefore nothing being
> > logged to relay (printks confirmed that). When I wrote 1 to the enabled
> > file, data started getting logged to relay and to the *.out files.
> >
> > So I don't know why the enabled state behaves the way it does, or if
> > it's unexpected, but that anyway doesn't seem like a relay problem to
> > me.
>
> Oh, right. Looking at kmemtraced.c, we never enable kmemtrace, just
> disable it (which doesn't make much sense). Bug in README or the code.

Eduard, here's a fix for the userspace counterpart:

>From aa95e997458fd4d2a3b9a5c75e1452e22a3159af Mon Sep 17 00:00:00 2001
From: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
Date: Tue, 14 Oct 2008 10:03:51 +0300
Subject: [PATCH] kmemtrace: enable tracing in kmemtraced

If kmemtrace is not enabled at boot, we need to enable it before we start
relaying data to userspace.

Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---
kmemtraced.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kmemtraced.c b/kmemtraced.c
index 217478d..5cc1ada 100644
--- a/kmemtraced.c
+++ b/kmemtraced.c
@@ -165,8 +165,6 @@ int main(int argc, char *argv[])
if (!readers)
panic("Out of memory!\n");

- write_str("/sys/kernel/debug/kmemtrace/enabled", "0");
-
printf("Copying /proc/kallsyms...\n");
copy_kallsyms();

@@ -180,6 +178,8 @@ int main(int argc, char *argv[])
strerror(errno));
}

+ write_str("/sys/kernel/debug/kmemtrace/enabled", "1");
+
printf("Logging... Press Control-C to stop.\n");

while (sigwait(&signals, &signal) == 0) {
--
1.5.4.3



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/