public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: ltp-list@lists.sourceforge.net,
	ltp-coverage@lists.sourceforge.net,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [RFC PATCH 0/8] gcov kernel support
Date: Mon, 21 Apr 2008 14:34:05 +0200	[thread overview]
Message-ID: <480C89BD.8080909@de.ibm.com> (raw)

This set of patches enables the use of GCC's coverage testing tool
gcov [1] with kernel 2.6.25. Coverage data for the running kernel is
exported via debugfs in a gcov-compatible format. To get coverage
data for a specific file, simply use gcov with the -o option:

# gcov -o /sys/kernel/debug/gcov/tmp/linux-2.6.25/kernel spinlock.c

This will create source code files annotated with execution counts
in the current directory. In addition, graphical gcov front-ends such
as lcov [2] can be used to automate the process of collecting data
for the entire kernel and provide coverage overviews in HTML format.

Possible uses:

* debugging (has this line been executed at all?)
* test improvement (how do I change my test to cover these lines?)
* minimizing kernel configurations (do I need this option if the
  associated code is never executed?)


Patch overview:

[patch 1/8] kernel: call constructors
[patch 2/8] kbuild: let addtree result in absolute paths only
[patch 3/8] kbuild: convert include and source paths
[patch 4/8] module: add MODULE_STATE_GOING notifier call
[patch 5/8] module: add function to map address to containing module
[patch 6/8] seq_file: add function to write binary data
[patch 7/8] gcov: add gcov profiling infrastructure
[patch 8/8] gcov: architecture specific compile flag adjustments

Patches 1-6 introduce/change functionality required for gcov's
profiling mechanism to work. Patch 7 implements the actual gcov
support and debugfs interface. Patch 8 is required for architecture
specific adjustments.


Known issues:

* some architecture specific problems: the patch has been tested
  successfully on s390 and i386. Known problems exist on x86_64 and
  arm (to be investigated)
* GCC's profiling mechanism together with optimization sometimes
  produces skewed data (see [1])
* GCC's profiling code assumes single-threaded execution
* gcov assumes that a program has finished when coverage data is
  analyzed

Despite these issues, the data which can be obtained has been proven
to be sufficiently accurate for most practical uses.


History:

Hubertus Franke <frankeh@us.ibm.com> wrote the first version of this
patch around 2002. Since then it has been adapted to new versions of
the kernel and GCC with contributions by several people (see file
kernel/gcov/fs.c, write me if I missed anyone). Due to regular
requests, I rewrote the gcov-kernel patch from scratch so that it
would (hopefully) be fit for inclusion into the upstream kernel.

--
[1] http://gcc.gnu.org/onlinedocs/gcc/Gcov.html
[2] http://ltp.sourceforge.net/coverage/lcov.php





                 reply	other threads:[~2008-04-21 12:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=480C89BD.8080909@de.ibm.com \
    --to=peter.oberparleiter@de.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltp-coverage@lists.sourceforge.net \
    --cc=ltp-list@lists.sourceforge.net \
    /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