From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 421 invoked by alias); 28 Oct 2008 15:40:16 -0000 Received: (qmail 365 invoked by uid 22791); 28 Oct 2008 15:40:13 -0000 X-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_33,J_CHICKENPOX_34,J_CHICKENPOX_35,J_CHICKENPOX_73,KAM_MX,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 28 Oct 2008 15:39:37 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id m9SFdZnw005188 for ; Tue, 28 Oct 2008 11:39:35 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m9SFdYgt027950 for ; Tue, 28 Oct 2008 11:39:34 -0400 Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.16.60.26]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id m9SFdXQA026094 for ; Tue, 28 Oct 2008 11:39:33 -0400 From: Jeff Moyer To: systemtap@sourceware.org Subject: Re: Simplifying examples by improving vfs tapset References: <4905D5F6.60807@redhat.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Tue, 28 Oct 2008 15:40:00 -0000 In-Reply-To: <4905D5F6.60807@redhat.com> (William Cohen's message of "Mon, 27 Oct 2008 10:53:42 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2008-q4/txt/msg00220.txt.bz2 William Cohen writes: > I am looking through the examples being used in the SystemTap > beginners guide and trying to streamline them a bit. One > simplification is the minimize the use of raw kernel.function() and > module().function() probes by using tapset aliases instead. Probing > the raw C functions is not so meaningful for average users. Plus they > don't know what arguments might be available at those functions. The > tapsets should minimize raw functions. When looking to convert some of > the probes to use the vfs tapsets, I noticed that a number of the vfs > tapsets don't have dev or devname defined, e.g. vfs.read{.return} and > vfs.write{.return}. This result in ugly code such as in disktop.stp > probe handlers: > > dev = __file_dev($file) > devname = __find_bdevname(dev,__file_bdev($file)) > > > The dev and devname should be consistently available for vfs > tapset. This would eliminate the need for internal systemtap tapset > functions to be used in the probe handlers and would make examples > such as disktop.stp simpler. There appears to be ugliness in > systemtap.examples/io/iostat-scsi.stp. > > Attached is the suggested patch to for the vfs.stp stapset and the > disktop.stp example. > > -Will > diff --git a/tapset/vfs.stp b/tapset/vfs.stp > index 7f2312d..2ac8256 100644 > --- a/tapset/vfs.stp > +++ b/tapset/vfs.stp > @@ -800,6 +800,8 @@ probe vfs.read = kernel.function ("vfs_read") > pos = $pos > buf = $buf > bytes_to_read = $count > + dev = __file_dev($file) > + devname = __find_bdevname(dev, __file_bdev($file)) > } > > probe vfs.read.return = kernel.function ("vfs_read").return > @@ -808,6 +810,8 @@ probe vfs.read.return = kernel.function ("vfs_read").return > pos = $pos > buf = $buf > bytes_to_read = $count > + dev = __file_dev($file) > + devname = __find_bdevname(dev, __file_bdev($file)) > > ret = $return > bytes_read = ret > 0 ? ret : 0 > @@ -844,6 +848,8 @@ probe vfs.write = kernel.function ("vfs_write") > pos = $pos > buf = $buf > bytes_to_write = $count > + dev = __file_dev($file) > + devname = __find_bdevname(dev, __file_bdev($file)) > } > > probe vfs.write.return = kernel.function ("vfs_write").return > @@ -852,6 +858,8 @@ probe vfs.write.return = kernel.function ("vfs_write").return > pos = $pos > buf = $buf > bytes_to_write = $count > + dev = __file_dev($file) > + devname = __find_bdevname(dev, __file_bdev($file)) > > ret = $return > bytes_written = ret > 0 ? ret : 0 What about readv and writev? I had modified my local copy of disktop.stp to take these into account (hooking into do_readv_writev). I will post those updates if you like, once I figure out why I ran into a problem with the array assignments. (I had to read from the io_stat array before writing to it, otherwise the written values didn't show up.) One other improvement that could be made to the script is AIO support. Cheers, Jeff