linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] gcov kernel support
@ 2009-02-26 13:50 Peter Oberparleiter
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Oberparleiter @ 2009-02-26 13:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Andi Kleen, Huang Ying, Li Wei, Jeff Dike

This is a resend of the gcov kernel support patchset (see further
below for an in-depth introduction). Patch base is 2.6.29-rc6.

This version fixes a few problems identified by Li Wei <W.Li@Sun.COM>:
* node->parent is always NULL, causing NULL-pointer dereference in
  remove_node()
* unsafe list traversing in reset_write() since remove_node may
  affect multiple list_heads
* . and .. in .gcda path strings are not handled correctly

Thanks to Li Wei for reporting these problems and proposing fixes!


Patchset overview:

[PATCH 1/4] kernel: constructor support
[PATCH 2/4] seq_file: add function to write binary data
[PATCH 3/4] gcov: add gcov profiling infrastructure
[PATCH 4/4] gcov: enable GCOV_PROFILE_ALL for x86_64

===

Introduction:

This patch set enables the use of GCC's coverage testing tool gcov [1]
with the Linux kernel. Coverage data of a running kernel is exported
in gcov-compatible format via the "gcov" debugfs directory. To get
coverage data for a specific file, change to the kernel build
directory and use gcov with the -o option as follows (requires root):

# cd /tmp/linux-out
# gcov -o /sys/kernel/debug/gcov/tmp/linux-out/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.


Known issues:

* some architecture specific problems: the patch has been tested
  successfully on s390 and x86, the use of gcov profiling flags
  for the entire kernel needs to be tested per architecture before
  it can be enabled
* 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




^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH 0/4] gcov kernel support
@ 2009-06-02 11:43 Peter Oberparleiter
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Oberparleiter @ 2009-06-02 11:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Andi Kleen, Huang Ying, Li Wei, Michael Ellerman,
	Ingo Molnar, Heiko Carstens, Martin Schwidefsky

This patchset implements support for performing kernel code coverage
measurements based on gcc's gcov mechanism. It can be used to improve
kernel code quality by identifying code parts which are not exercised
during test cases. Patch base is 2.6.30-rc7.

Changes since last version:
* removed __gcov_execve (assuming no kernel function will be called
  execve)

Patch overview:
[PATCH 1/4] kernel: constructor support
[PATCH 2/4] seq_file: add function to write binary data
[PATCH 3/4] gcov: add gcov profiling infrastructure
[PATCH 4/4] gcov: enable GCOV_PROFILE_ALL for x86_64

For more information see Documentation/gcov.txt and the previous post:
http://marc.info/?l=linux-kernel&m=123565658224661


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH 0/4] gcov kernel support
@ 2009-05-19 14:24 Peter Oberparleiter
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Oberparleiter @ 2009-05-19 14:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, Andi Kleen, Huang Ying, Li Wei, Michael Ellerman,
	Ingo Molnar, Heiko Carstens, Martin Schwidefsky

This patchset implements support for performing kernel code coverage
measurements based on gcc's gcov mechanism. It can be used to improve
kernel code quality by identifying code parts which are not exercised
during test cases. Patch base is 2.6.30-rc6.

Patch feedback has been integrated. There were no further comments
since the last version. In my opinion this patchset is ready for
inclusion into the -mm tree.

Patch overview:
[PATCH 1/4] kernel: constructor support
[PATCH 2/4] seq_file: add function to write binary data
[PATCH 3/4] gcov: add gcov profiling infrastructure
[PATCH 4/4] gcov: enable GCOV_PROFILE_ALL for x86_64

For more information see Documentation/gcov.txt and the previous post:
http://marc.info/?l=linux-kernel&m=123565658224661


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH 0/4] gcov kernel support
@ 2009-05-12 15:38 Peter Oberparleiter
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Oberparleiter @ 2009-05-12 15:38 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Andi Kleen, Huang Ying, Li Wei, Michael Ellerman,
	Ingo Molnar, Heiko Carstens, Martin Schwidefsky

This patchset implements support for performing kernel code coverage
measurements based on gcc's gcov mechanism. It can be used to improve
kernel code quality by identifying code parts which are not exercised
during test cases. Patch base is 2.6.30-rc5.

Changes since last version:
* updated to 2.6.30-rc5
* moved __ctors_start and __ctors_end declaration to
  include/asm-generic/sections.h

Patch overview:
[PATCH 1/4] kernel: constructor support
[PATCH 2/4] seq_file: add function to write binary data
[PATCH 3/4] gcov: add gcov profiling infrastructure
[PATCH 4/4] gcov: enable GCOV_PROFILE_ALL for x86_64

For more information see Documentation/gcov.txt and the previous post:
http://marc.info/?l=linux-kernel&m=123565658224661


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH 0/4] gcov kernel support
@ 2009-05-08 15:44 Peter Oberparleiter
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Oberparleiter @ 2009-05-08 15:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Andi Kleen, Huang Ying, Li Wei, Michael Ellerman,
	Ingo Molnar, Heiko Carstens, Martin Schwidefsky

This patchset implements support for performing kernel code coverage
measurements based on gcc's gcov mechanism. It can be used to improve
kernel code quality by identifying code parts which are not exercised
during test cases. Patch base is 2.6.30-rc4.

Changes since last version:
* moved compiler version assertion to include/linux/compiler-gcc3.h
* moved all module-specific code under CONFIG_MODULES
* added symbolic names for gcda file record numbers
* split seq_write_gcov_int() into two functions
* coding style changes:
  * fixed multi-line comments
  * added braces for multi-line blocks
  * improved rc and error label usage
  * made local variable initialization consistent
  * added initialization indentation
  * improved readability by using local variables

Patch overview:
[PATCH 1/4] kernel: constructor support
[PATCH 2/4] seq_file: add function to write binary data
[PATCH 3/4] gcov: add gcov profiling infrastructure
[PATCH 4/4] gcov: enable GCOV_PROFILE_ALL for x86_64

For more information see Documentation/gcov.txt and the previous post:
http://marc.info/?l=linux-kernel&m=123565658224661


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH 0/4] gcov kernel support
@ 2009-05-07 12:45 Peter Oberparleiter
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Oberparleiter @ 2009-05-07 12:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, Andi Kleen, Huang Ying, Li Wei, Michael Ellerman

This patchset implements support for performing kernel code coverage
measurements based on gcc's gcov mechanism. It can be used to improve
kernel code quality by identifying code parts which are not exercised
during test cases. Patch base is 2.6.30-rc4.

Changes since last version:
* fix return code of gcov_seq_show

Patch overview:
[PATCH 1/4] kernel: constructor support
[PATCH 2/4] seq_file: add function to write binary data
[PATCH 3/4] gcov: add gcov profiling infrastructure
[PATCH 4/4] gcov: enable GCOV_PROFILE_ALL for x86_64

For more information see Documentation/gcov.txt and the previous post:
http://marc.info/?l=linux-kernel&m=123565658224661


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH 0/4] gcov kernel support
@ 2009-02-03 12:46 Peter Oberparleiter
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Oberparleiter @ 2009-02-03 12:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Andi Kleen, Huang Ying, Jeff Dike

This is a resend of the gcov kernel support patchset (see further
below for an in-depth introduction). Patch base is 2.6.29-rc3.

A previous attempt to get this patchset included into the mainline
kernel stalled when a number of issues remained unfixed. This
version addresses all known issues:

User mode Linux conflicts in the constructor mechanism were resolved.
The current approach does no longer affect linking of .ctors sections
on UML.

Selecting option "Profile entire kernel" has triggered linker,
runtime or tool chain issues on some platforms (e.g. ppc, x86_64)
while it worked on others (s390, x86_32). To prevent breaking
"make allyesconfig" type tests, this option is now restricted to
architectures for which it has been tested and found working.
New architectures can be added by follow-on patches once positive
test feedback is available.


Patchset overview:

[PATCH 1/4] kernel: constructor support
[PATCH 2/4] seq_file: add function to write binary data
[PATCH 3/4] gcov: add gcov profiling infrastructure
[PATCH 4/4] gcov: enable GCOV_PROFILE_ALL for x86_64

===

Introduction:

This patch set enables the use of GCC's coverage testing tool gcov [1]
with the Linux kernel. Coverage data of a running kernel is exported
in gcov-compatible format via the "gcov" debugfs directory. To get
coverage data for a specific file, change to the kernel build
directory and use gcov with the -o option as follows (requires root):

# cd /tmp/linux-out
# gcov -o /sys/kernel/debug/gcov/tmp/linux-out/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.


Known issues:

* some architecture specific problems: the patch has been tested
  successfully on s390 and x86, the use of gcov profiling flags
  for the entire kernel needs to be tested per architecture before
  it can be enabled
* 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




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-06-02 11:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-26 13:50 [PATCH 0/4] gcov kernel support Peter Oberparleiter
  -- strict thread matches above, loose matches on Subject: below --
2009-06-02 11:43 Peter Oberparleiter
2009-05-19 14:24 Peter Oberparleiter
2009-05-12 15:38 Peter Oberparleiter
2009-05-08 15:44 Peter Oberparleiter
2009-05-07 12:45 Peter Oberparleiter
2009-02-03 12:46 Peter Oberparleiter

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 NNTP newsgroup(s).