public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mjw@redhat.com>
To: Peter Teoh <htmldeveloper@gmail.com>
Cc: systemtap@sources.redhat.com, Om Narasimhan <om.turyx@gmail.com>
Subject: Re: systemtap question..
Date: Sat, 23 Aug 2008 12:51:00 -0000	[thread overview]
Message-ID: <1219495821.8017.10.camel@hermans.wildebeest.org> (raw)
In-Reply-To: <804dabb00808222127t3606302ds94056e7da6b0f30d@mail.gmail.com>

Hi Peter,

On Sat, 2008-08-23 at 12:27 +0800, Peter Teoh wrote:
> as discovered by narasimhan, the following script will lead to kernel
> freezing and hanged for me:
> 
> I execute via "stap -kvvv script.stp" command.

The kernel freezing is worrying. That should not happen. And it doesn't
for me. Do you have some more information? Kernel version, any
backtraces on the console when this happens, etc.

> Question is:  why does he get a compilation error when using the -u
> option?  (same for me as well, which goes away when removed?)

When you use -u stap doesn't remove unused parts of the script.
Without -u stap is "smart" and sees that you never actually use any of
the variables in your script:

WARNING: eliding unused variable identifier 'inode' at script.stp:3:7
WARNING: eliding unused variable identifier 'dev_nr' at script.stp:4:7
WARNING: eliding unused variable identifier 'inode' at script.stp:3:7
WARNING: eliding unused variable identifier 'dev_nr' at script.stp:4:7

If you add something like the following to your probe it will actually
use these variables and give an error about the code that assigns values
to them:

  printf("%s inode: %d, dev_nr: %d\n", probefunc(), inode, dev_nr);

semantic error: field 'f_dentry' not found (alternatives: f_u f_path
f_op f_count f_flags f_mode f_pos f_owner f_uid f_gid f_ra f_version
f_security private_data f_ep_links f_ep_lock f_mapping): identifier
'$file' at script.stp:3:15

And indeed you need to replace f_dentry with f_path->dentry for newer
kernels.

Cheers,

Mark

This is the full version of the script that works for me against
2.6.25.14:

probe kernel.function ("vfs_read"), kernel.function("vfs_write")
{
      inode = $file->f_path->dentry->d_inode->i_ino
      dev_nr = $file->f_path->dentry->d_inode->i_sb->s_dev
      printf("%s inode: %d, dev_nr: %d\n", probefunc(), inode, dev_nr);
}


  reply	other threads:[~2008-08-23 12:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <48ACFC02.3080002@gmail.com>
2008-08-23  4:28 ` Peter Teoh
2008-08-23 12:51   ` Mark Wielaard [this message]
2008-08-23 14:09   ` Frank Ch. Eigler
2006-09-06 18:41 Stone, Joshua I
     [not found] <1157546598.2847.28.camel@localhost.localdomain>
2006-09-06 13:36 ` Frank Ch. Eigler

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=1219495821.8017.10.camel@hermans.wildebeest.org \
    --to=mjw@redhat.com \
    --cc=htmldeveloper@gmail.com \
    --cc=om.turyx@gmail.com \
    --cc=systemtap@sources.redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).