From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21849 invoked by alias); 30 Mar 2006 15:43:40 -0000 Received: (qmail 21841 invoked by uid 22791); 30 Mar 2006 15:43:39 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 30 Mar 2006 15:43:37 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k2UFhZxR008901 for ; Thu, 30 Mar 2006 10:43:35 -0500 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.11.6) with ESMTP id k2UFhZcg003300 for ; Thu, 30 Mar 2006 10:43:35 -0500 Received: from touchme.toronto.redhat.com (IDENT:postfix@touchme.toronto.redhat.com [172.16.14.9]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id k2UFhYxX006396 for ; Thu, 30 Mar 2006 10:43:34 -0500 Received: from ton.toronto.redhat.com (ton.toronto.redhat.com [172.16.14.15]) by touchme.toronto.redhat.com (Postfix) with ESMTP id CDEA08002B7 for ; Thu, 30 Mar 2006 10:43:34 -0500 (EST) Received: from ton.toronto.redhat.com (localhost.localdomain [127.0.0.1]) by ton.toronto.redhat.com (8.13.1/8.13.1) with ESMTP id k2UFhY7F012408 for ; Thu, 30 Mar 2006 10:43:34 -0500 Received: (from fche@localhost) by ton.toronto.redhat.com (8.13.1/8.13.1/Submit) id k2UFhYGR012407 for systemtap@sources.redhat.com; Thu, 30 Mar 2006 10:43:34 -0500 Date: Thu, 30 Mar 2006 15:43:00 -0000 From: "Frank Ch. Eigler" To: systemtap@sources.redhat.com Subject: static probes Message-ID: <20060330154333.GM599@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q1/txt/msg00901.txt.bz2 Hi - I committed a part of a prototype for static instrumentation macros, from . To use it, #include "stapmark.h" in your kernel or module source file of choice, and add macro calls of this form to any old spot: STAP_MARK_(name,arg1,...) For example, in kernel/sched.c (context_switch), around the the switch_to() call, you can plop STAP_MARK_NN(context_switch,next->pid,prev->pid); Then recompile your module or kernel as needed. (The identifies each argument type: "N" = int64_t number, "S" = const char * string. The name field is any reasonably unique identifier.) When not used by an active systemtap probe, these markers cost very little (I'll quantify it for the OLS paper), so theoretically they can be sprinkled around generously. When used by an active systemtap probe, the cost is much smaller than a kprobe in the same place - something like a djprobe. To place a probe on such a marker, the CVS systemtap now understands probe kernel.mark("name") { ... } or probe module("m").mark("name") { ... } Wildcards in the names are supported as usual. For these probes, systemtap does NOT require/use debugging information, so we're not at the mercy of gcc. The above works, and seems to not crash during gentle testing. The instrumentation macros should not need to change incompatibly, so you can theoretically go ahead and add markers without having to redo it later. This draft has a couple of shortcomings: - The arguments passed at the STAP_MARK macro are not yet available to the script-side probe handler, but will soon be $arg1, etc. - The translator parses /proc/kallsyms and /boot/System.map to fetch the kernel/module symbol tables, until elfutils gets a handy API (bug #2461). - Concurrent use of the same markers from multiple probes/sessions is not supported, and is not completely protected against by the translator-generated setup/teardown code. - Oops, forgot support for zero-argument markers. Will fix pronto. - FChE