Fwd: systemtap script, counts syscall failures....

Jaroslav Reznik jreznik at redhat.com
Tue Apr 7 13:48:27 UTC 2009


Hi,
I'm forwarding email from our kernel guy who's counting syscall failures...

From IRC chat:

[10:47] <aarapov>                SYSCALL          PROCESS   PID COUNT ERRSTR       
ARGSTR
[10:47] <aarapov>               sys_read          firefox  4028   517  11 
(EAGAIN) 3, 0x00000000025392f4, 4096
[10:47] <aarapov>               sys_read          konsole  4042   364  11 
(EAGAIN) 8, 0x00000000010c7244, 4096
[10:47] <aarapov>               sys_read                X  2991   214  11 
(EAGAIN) 52, 0x0000000001c80fc0, 7584
[10:47] <aarapov>               sys_read          klipper  3478   150  11 
(EAGAIN) 14, 0x0000000000aa9814, 4096
[10:47] <aarapov>               sys_read           kopete  3449    23  11 
(EAGAIN) 8, 0x00000000020c2e44, 4096
[10:47] <aarapov>               sys_read             kwin  3405    10  11 
(EAGAIN) 7, 0x0000000000e80834, 4096
[10:47] <aarapov>               sys_read           plasma  3412     8  11 
(EAGAIN) 3, 0x0000000001a5a9a4, 4096
[10:47] <aarapov>               sys_read         kwalletd  3459     6  11 
(EAGAIN) 12, 0x0000000001d8a094, 4096
[10:47] <aarapov>  sys_inotify_add_watch          firefox  4028     4   2 
(ENOENT) 57, "/home/aarapov/.local/share/applications", 16789446
[10:47] <aarapov>               sys_read        gpg-agent  3317     3  11 
(EAGAIN) 3, 0x0000000000cd62e0, 128
[10:47] <aarapov>           sys_newlstat           plasma  3412     2   2 
(ENOENT) "tmpfs", 0x00007fffbe0741f0
[10:47] <aarapov>               sys_read            kded4  3586     2  11 
(EAGAIN) 8, 0x000000000072cd54, 4096
[10:47] <aarapov>               sys_read            kded4  3369     2  11 
(EAGAIN) 8, 0x00000000020f7484, 4096
[10:47] <aarapov>           sys_newlstat           plasma  3412     1   2 
(ENOENT) "swap", 0x00007fffbe0741f0
[10:47] <aarapov>              sys_futex        automount  4364     1 110 
(ETIMEDOUT) 0x00007fb3b017af64, FUTEX_WAIT_PRIVATE, 773
[10:47] <aarapov>              sys_futex        automount  4364     1 110 
(ETIMEDOUT) 0x00007fb3b017af64, FUTEX_WAIT_PRIVATE, 771
[10:47] <aarapov>              sys_futex        automount  4364     1 110 
(ETIMEDOUT) 0x00007fb3b017af64, FUTEX_WAIT_PRIVATE, 769
[10:47] <aarapov>              sys_futex        automount  4364     1 110 
(ETIMEDOUT) 0x00007fb3b017af64, FUTEX_WAIT_PRIVATE, 767
[10:48] <aarapov>              sys_futex        automount  4364     1 110 
(ETIMEDOUT) 0x00007fb3b017af64, FUTEX_WAIT_PRIVATE, 765
[10:48] <aarapov>           sys_newlstat           plasma  3412     1  13 
(EACCES) "/dev/vg_mirror/lv_swap", 0x00007fffbe0741f0
[10:48] <aarapov> kde apps, 2nd place after firefox by having Errs from 
various syscalls. :)
[10:48] <aarapov> place for imporvement.
[10:48] <aarapov> FYI. :)
[10:48] <aarapov> I can give you systemtap script that generates it.
[10:48] <aarapov> COUNT / per second
[10:49] <aarapov> for example, kopete does failing sys_read 23 times per 
second.
[10:49] <jreznik> hmm
[10:49] <aarapov> the main question, that should arise - what the hell is he 
doing ?
[10:50] <aarapov> :)
[10:50] <aarapov> this all for the case if your life needs to be more 
interesting.

Jaroslav
----------  Forwarded Message  ----------

Subject: systemtap script, counts syscall failures....
Date: Tuesday 07 April 2009
From: Anton Arapov <aarapov at redhat.com>
To: Jaroslav Reznik <jreznik at redhat.com>


Jaroslav,

how to use:

yum install systemtap
debuginfo-install kernel
# ./errsnoop.stp

-- 
-Anton


-------------------------------------------------------
-- 
Jaroslav Řezník <jreznik at redhat.com>
Associate Software Engineer - Base Operating Systems Brno

Office: +420 532 294 275
Mobile: +420 731 455 332
Red Hat, Inc.                               http://cz.redhat.com/
-------------- next part --------------
#!/bin/sh
//usr/bin/env stap -DSTP_NO_OVERLOAD $@ $0; exit $?
# errsnoop.stp
# Copyright (C) 2009 Eugene Teo <eugeneteo at kernel.sg>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# attack "stupid userspace" apps
#

global error, trace

probe syscall.* {
	trace[tid(), probefunc()] = argstr
}

probe syscall.*.return {
	t = tid(); p = probefunc()
	if ([t, p] in trace) {
		argstr = trace[t, p]
		delete trace[t, p]
	}

	errstr = errno_str(errno = returnval())
	if (errno < 0 && strlen(errstr) > 0) {
		errstr = sprintf("%3d (%s)", -errno, errstr)
		error[probefunc(), execname(), pid(), errstr, argstr] <<< 1
	}
}

probe timer.s(5) {
	printf("\033[2J\033[1;1H")
	printf("%22s %16s %5s %5s %-12s %s\n",
			"SYSCALL", "PROCESS", "PID", "COUNT", "ERRSTR", "ARGSTR")
	foreach([func, proc, pid, errstr, argstr] in error- limit 20) {
		printf("%22s %16s %5d %5d %-12s %s\n", func, proc, pid,
				@count(error[func, proc, pid, errstr, argstr]),
				errstr, argstr)
	}
	delete error
}


More information about the kde mailing list