Skip to contentSkip to conversation

batman-adv: Tracing and debugfs deprecation cleanups

PATCH New Sven Eckelmann 1 participant 6 messages Oct 21, 2018 Batman advanced

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

cover batman-adv: Tracing and debugfs deprecation cleanups

Hi,

the current master branch already contains support to store debug messages to the tracing buffer and to inform users about the deprecation of the debugfs functionality.

This patchset is now cleaning it up a little bit more and allows to the tracing infrastructure completely without BATMAN_ADV_DEBUGFS.

Kind regards,
Sven

Sven Eckelmann (5):
batman-adv: Drop unused lockdep include
batman-adv: Add includes for deprecation warning
batman-adv: Improve includes for trace functionality
batman-adv: Allow to use BATMAN_ADV_DEBUG without BATMAN_ADV_DEBUGFS
batman-adv: Fix description for BATMAN_ADV_DEBUG

 compat.h                    |  5 ----
 net/batman-adv/Kconfig      |  7 +++--
 net/batman-adv/bat_iv_ogm.c |  1 -
 net/batman-adv/debugfs.c    |  2 ++
 net/batman-adv/log.c        | 60 ++++++++++++++++++++-----------------
 net/batman-adv/trace.c      |  2 --
 net/batman-adv/trace.h      |  6 ++++
 7 files changed, 45 insertions(+), 38 deletions(-)
Signature · 1 line
2.19.1
author maintainer
#1 lore raw

PATCH 1/5 batman-adv: Drop unused lockdep include

The commit f36b93064420 ("batman-adv: Move OGM rebroadcast stats to orig_ifinfo") removed all used functionality of the include linux/lockdep.h from batadv_iv_ogm.c.

---
 net/batman-adv/bat_iv_ogm.c | 1 -
 1 file changed, 1 deletion(-)
net/batman-adv/bat_iv_ogm.c +0 -1
index d2227091..1d31ac84 100644
@@ -34,7 +34,6 @@
 #include <linux/kernel.h>
 #include <linux/kref.h>
 #include <linux/list.h>
-#include <linux/lockdep.h>
 #include <linux/netdevice.h>
 #include <linux/netlink.h>
 #include <linux/pkt_sched.h>
Signature · 1 line
2.19.1
author maintainer
#2 lore raw

PATCH 2/5 batman-adv: Add includes for deprecation warning

In reply to Sven Eckelmann

The commit fee04b6f72cf ("batman-adv: Mark debugfs functionality as deprecated") introduced various messages to inform the user about the deprecation of the debugfs based functionality. The messages also include the context/task in which this problem was observed.

The datastructures and functions to access this information require special headers. These should be included directly instead of depending on a more complex and fragile include chain.

---
 net/batman-adv/debugfs.c | 2 ++
 1 file changed, 2 insertions(+)
net/batman-adv/debugfs.c +2 -0
index 8b608a2e..d4a7702e 100644
@@ -19,6 +19,7 @@
 #include "debugfs.h"
 #include "main.h"
 
+#include <asm/current.h>
 #include <linux/dcache.h>
 #include <linux/debugfs.h>
 #include <linux/err.h>
@@ -27,6 +28,7 @@
 #include <linux/fs.h>
 #include <linux/netdevice.h>
 #include <linux/printk.h>
+#include <linux/sched.h>
 #include <linux/seq_file.h>
 #include <linux/stat.h>
 #include <linux/stddef.h>
Signature · 1 line
2.19.1
author maintainer
#3 lore raw

PATCH 3/5 batman-adv: Improve includes for trace functionality

In reply to Sven Eckelmann

The batadv_dbg trace event uses different functionality and datastructures which are not directly associated with the trace infrastructure. It should not be expected that the trace headers indirectly provide them and instead include the required headers directly.

---
 net/batman-adv/trace.c | 2 --
 net/batman-adv/trace.h | 6 ++++++
 2 files changed, 6 insertions(+), 2 deletions(-)
net/batman-adv/trace.c +0 -2
index 3d57f998..8e102421 100644
@@ -16,7 +16,5 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <linux/module.h>
-
 #define CREATE_TRACE_POINTS
 #include "trace.h"
net/batman-adv/trace.h +6 -0
index 3acda26a..104784be 100644
@@ -21,7 +21,13 @@
 
 #include "main.h"
 
+#include <linux/bug.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/percpu.h>
+#include <linux/printk.h>
 #include <linux/tracepoint.h>
+#include <linux/types.h>
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM batadv
Signature · 1 line
2.19.1
author maintainer
#4 lore raw

PATCH 4/5 batman-adv: Allow to use BATMAN_ADV_DEBUG without BATMAN_ADV_DEBUGFS

In reply to Sven Eckelmann

The BATMAN_ADV_DEBUGFS portion of batman-adv is marked as deprecated. Thus all required functionality should be available without it. The debug log was already modified to also output via the kernel tracing function but still retained its BATMAN_ADV_DEBUGFS functionality.

Separate the entry point for the debug log from the debugfs portions to make it possible to build with BATMAN_ADV_DEBUG and without BATMAN_ADV_DEBUGFS.

---
 compat.h               |  5 ----
 net/batman-adv/Kconfig |  2 +-
 net/batman-adv/log.c   | 60 +++++++++++++++++++++++-------------------
 3 files changed, 34 insertions(+), 33 deletions(-)
compat.h +0 -5
index 385b629c..559df2f3 100644
@@ -30,11 +30,6 @@
 
 #include "compat-autoconf.h"
 
-/* test for dependency CONFIG_BATMAN_ADV_DEBUG -> CONFIG_BATMAN_ADV_DEBUGFS */
-#if defined(CONFIG_BATMAN_ADV_DEBUG) && !defined(CONFIG_BATMAN_ADV_DEBUGFS)
-#error CONFIG_BATMAN_ADV_DEBUG=y requires CONFIG_BATMAN_ADV_DEBUGFS=y
-#endif
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
 
 /* wild hack for batadv_getlink_net only */
net/batman-adv/Kconfig +1 -1
index f75816f5..7b0e1fcd 100644
@@ -100,7 +100,7 @@ config BATMAN_ADV_DEBUGFS
 
 config BATMAN_ADV_DEBUG
 	bool "B.A.T.M.A.N. debugging"
-	depends on BATMAN_ADV_DEBUGFS
+	depends on BATMAN_ADV
 	help
 	  This is an option for use by developers; most people should
 	  say N here. This enables compilation of support for
net/batman-adv/log.c +33 -27

75 lines not on this page · raw message

Signature · 1 line
2.19.1
author maintainer
#5 lore raw

PATCH 5/5 batman-adv: Fix description for BATMAN_ADV_DEBUG

In reply to Sven Eckelmann

The debug messages of batman-adv are not printed to the kernel log at all but can be stored (depending on the compile setting) in the tracing buffer or the batadv specific log buffer. There is also no debug module parameter but a batadv netdev specific log_level setting to enable/disable different classes of debug messages at runtime.

---
 net/batman-adv/Kconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/batman-adv/Kconfig +3 -2
index 7b0e1fcd..082e9606 100644
@@ -104,8 +104,9 @@ config BATMAN_ADV_DEBUG
 	help
 	  This is an option for use by developers; most people should
 	  say N here. This enables compilation of support for
-	  outputting debugging information to the kernel log. The
-	  output is controlled via the module parameter debug.
+	  outputting debugging information to the debugfs log or tracing
+	  buffer. The output is controlled via the batadv netdev specific
+	  log_level setting.
 
 config BATMAN_ADV_TRACING
 	bool "B.A.T.M.A.N. tracing support"
Signature · 1 line
2.19.1