Bug 13037 - blacklist false positives
Summary: blacklist false positives
Status: RESOLVED WORKSFORME
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-28 01:51 UTC by Frank Ch. Eigler
Modified: 2021-03-21 15:43 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2011-07-28 01:51:16 UTC
Until bug #6711 is implemented, and we're stuck with the
built-in blacklist, we need to tweak it a tad.  Here is
one regexp that needs to be tightened up, to limit itself
to genuine lock- rather than block-related functions.

 blfn += "|.*read_.*lock.*";

from https://bugzilla.redhat.com/show_bug.cgi?id=708255#c5
Comment 1 Mark Wielaard 2011-07-28 08:00:31 UTC
First try:

diff --git a/dwflpp.cxx b/dwflpp.cxx
index fda6afd..256b403 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -2986,7 +2986,9 @@ dwflpp::build_blacklist()

   // Lots of locks
   blfn += "|.*raw_.*lock.*";
-  blfn += "|.*read_.*lock.*";
+  blfn += "|.*read_lock.*";
+  blfn += "|.*read_unlock.*";
+  blfn += "|.*read_trylock.*";
   blfn += "|.*write_.*lock.*";
   blfn += "|.*spin_.*lock.*";
   blfn += "|.*rwlock_.*lock.*";

Which frees up the following (block and clock) functions for probing:

-ata_tf_read_block
-cdrom_read_block
-ext4_read_block_bitmap
-ext4_should_dioread_nolock
-pvclock_read_wallclock
-read_block_bitmap
-read_boot_clock
-read_persistent_clock
-read_tag_block
-sd_read_block_characteristics
-sd_read_block_limits
-thread_cpu_clock_get
-thread_cpu_clock_getres
-will_read_block

Still investigating the other [cb]lock related regexs.
Comment 2 Mark Wielaard 2011-07-28 12:08:46 UTC
This is what I ended up with. Tested against 2.6.35.13-92.fc14.x86_64, 2.6.18-274.el5 and 2.6.32-131.6.1.el6.x86_64.

commit 65d791538e9c4c52f6fe121f740d8b1e01d27033
Author: Mark Wielaard <mjw@redhat.com>
Date:   Thu Jul 28 14:02:09 2011 +0200

    PR13037 Make lock blacklist more specific.
    
    The dwflpp::build_blacklist() would also match things like _nolock,
    block or clock. Be more specific that we want to only match things
    like _lock, _unlock, _trylock or seq[un]lock.

diff --git a/dwflpp.cxx b/dwflpp.cxx
index fda6afd..1a904f1 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -2985,15 +2985,24 @@ dwflpp::build_blacklist()
   blfn += "|unknown_nmi_error";
 
   // Lots of locks
-  blfn += "|.*raw_.*lock.*";
-  blfn += "|.*read_.*lock.*";
-  blfn += "|.*write_.*lock.*";
-  blfn += "|.*spin_.*lock.*";
-  blfn += "|.*rwlock_.*lock.*";
-  blfn += "|.*rwsem_.*lock.*";
+  blfn += "|.*raw_.*_lock.*";
+  blfn += "|.*raw_.*_unlock.*";
+  blfn += "|.*raw_.*_trylock.*";
+  blfn += "|.*read_lock.*";
+  blfn += "|.*read_unlock.*";
+  blfn += "|.*read_trylock.*";
+  blfn += "|.*write_lock.*";
+  blfn += "|.*write_unlock.*";
+  blfn += "|.*write_trylock.*";
+  blfn += "|.*write_seqlock.*";
+  blfn += "|.*write_sequnlock.*";
+  blfn += "|.*spin_lock.*";
+  blfn += "|.*spin_unlock.*";
+  blfn += "|.*spin_trylock.*";
+  blfn += "|.*spin_is_locked.*";
+  blfn += "|rwsem_.*lock.*";
   blfn += "|.*mutex_.*lock.*";
   blfn += "|raw_.*";
-  blfn += "|.*seq_.*lock.*";
 
   // atomic functions
   blfn += "|atomic_.*";

All functions now not blacklisted end in _nolock, contain block or clock.

To get a list of blacklisted functions against a particular kernel run:
stap -vvv -l 'kernel.function("*")' 'module.function("*)' 2>&1 | grep ^probe | grep blacklisted$ | cut -f2 -d\ | cut -f1 -d\@ | sort -u
Comment 3 Frank Ch. Eigler 2016-05-26 17:55:58 UTC
no current known problems with the blacklist; it may be overridden with -g anyway