diff mbox series

[net-next,v1,2/3] net: rds: add option for GCOV profiling

Message ID 20240626012834.5678-3-allison.henderson@oracle.com (mailing list archive)
State Accepted
Commit bc75dcc3cea797974913c6ccdbe17ed470be3da6
Headers show
Series selftests: rds selftest | expand

Commit Message

Allison Henderson June 26, 2024, 1:28 a.m. UTC
From: Vegard Nossum <vegard.nossum@oracle.com>

To better our unit tests we need code coverage to be part of the kernel.
This patch borrows heavily from how CONFIG_GCOV_PROFILE_FTRACE is
implemented

Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
---
 net/rds/Kconfig  | 9 +++++++++
 net/rds/Makefile | 5 +++++
 2 files changed, 14 insertions(+)

Comments

Jakub Kicinski June 27, 2024, 11:28 p.m. UTC | #1
On Tue, 25 Jun 2024 18:28:33 -0700 allison.henderson@oracle.com wrote:
> From: Vegard Nossum <vegard.nossum@oracle.com>
> 
> To better our unit tests we need code coverage to be part of the kernel.
> This patch borrows heavily from how CONFIG_GCOV_PROFILE_FTRACE is
> implemented

Hi Florian, IIRC you were able to generate test coverage reports for
nftables / netfilter. Is this the approach you used? I'm not sure how
well adding a Kconfig knob for every module would scale..
diff mbox series

Patch

diff --git a/net/rds/Kconfig b/net/rds/Kconfig
index 75cd696963b2..f007730aa2bb 100644
--- a/net/rds/Kconfig
+++ b/net/rds/Kconfig
@@ -26,3 +26,12 @@  config RDS_DEBUG
 	bool "RDS debugging messages"
 	depends on RDS
 	default n
+
+config GCOV_PROFILE_RDS
+	bool "Enable GCOV profiling on RDS"
+	depends on GCOV_KERNEL
+	help
+	  Enable GCOV profiling on RDS for checking which functions/lines
+	  are executed.
+
+	  If unsure, say N.
diff --git a/net/rds/Makefile b/net/rds/Makefile
index 8fdc118e2927..3af1ca1d965c 100644
--- a/net/rds/Makefile
+++ b/net/rds/Makefile
@@ -15,3 +15,8 @@  rds_tcp-y :=		tcp.o tcp_connect.o tcp_listen.o tcp_recv.o \
 			tcp_send.o tcp_stats.o
 
 ccflags-$(CONFIG_RDS_DEBUG)	:=	-DRDS_DEBUG
+
+# for GCOV coverage profiling
+ifdef CONFIG_GCOV_PROFILE_RDS
+GCOV_PROFILE := y
+endif