Skip to contentSkip to conversation

driver core: enable trace events (devres)

PATCH Superseded Andy Shevchenko 3 participants 3 messages Apr 1, 2021 Driver core

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core: enable trace events (devres)

Enable trace events for driver core. For now only devres is supported.

---
 drivers/base/Makefile |  3 +++
 drivers/base/devres.c | 12 ++++++++--
 drivers/base/trace.c  | 10 ++++++++
 drivers/base/trace.h  | 56 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 drivers/base/trace.c
 create mode 100644 drivers/base/trace.h
drivers/base/Makefile +3 -0
index 8b93a7f291ec..ef8e44a7d288 100644
@@ -30,3 +30,6 @@ obj-y			+= test/
 
 ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
 
+# define_trace.h needs to know how to find our header
+CFLAGS_trace.o		:= -I$(src)
+obj-$(CONFIG_TRACING)	+= trace.o
drivers/base/devres.c +10 -2
index 8746f2212781..b8af6eddd13b 100644
@@ -14,6 +14,7 @@
 #include <asm/sections.h>
 
 #include "base.h"
+#include "trace.h"
 
 struct devres_node {
 	struct list_head		entry;
@@ -54,7 +55,7 @@ static void set_node_dbginfo(struct devres_node *node, const char *name,
 	node->size = size;
 }
 
-static void devres_log(struct device *dev, struct devres_node *node,
+static void devres_dbg(struct device *dev, struct devres_node *node,
 		       const char *op)
 {
 	if (unlikely(log_devres))
@@ -63,9 +64,16 @@ static void devres_log(struct device *dev, struct devres_node *node,
 }
 #else /* CONFIG_DEBUG_DEVRES */
 #define set_node_dbginfo(node, n, s)	do {} while (0)
-#define devres_log(dev, node, op)	do {} while (0)
+#define devres_dbg(dev, node, op)	do {} while (0)
 #endif /* CONFIG_DEBUG_DEVRES */
 
+static void devres_log(struct device *dev, struct devres_node *node,
+		       const char *op)
+{
+	trace_devres_log(dev, op, node, node->name, node->size);
+	devres_dbg(dev, node, op);
+}
+
 /*
  * Release functions for devres group.  These callbacks are used only
  * for identification.
drivers/base/trace.c new file +10 -0
new file mode 100644
index 000000000000..b24b0a309c4a
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Device core Trace Support
+ * Copyright (C) 2021, Intel Corporation
+ *
+ * Author: Andy Shevchenko <[email protected]>
+ */
+
+#define CREATE_TRACE_POINTS
+#include "trace.h"
drivers/base/trace.h new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
2.30.2
#1 lore raw
Quoted 1 line · Andy Shevchenko

Enable trace events for driver core. For now only devres is supported.

That says _what_ this does, but not _why_ this is needed or wanted.

And you really don't even describe the "what" at all here either :(

Please be much more verbose when adding new features.

thanks,

greg k-h

#2 lore raw
In reply to Andy Shevchenko
I love your patch! Yet something to improve:

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on driver-core/driver-core-testing] [also build test ERROR on v5.12-rc5 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/driver-core-enable-trace-events-devres/20210402-052313
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git d225ef6fda7ce9ff7d28764bd1cceea2d0215e8b
config: powerpc-randconfig-r004-20210401 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 1c268a8ff4e90a85d0e634350b1104080614cf2b)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/0day-ci/linux/commit/b5937c2a88864ab50f9a0e1ba3b98ddb7068279d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andy-Shevchenko/driver-core-enable-trace-events-devres/20210402-052313 git checkout b5937c2a88864ab50f9a0e1ba3b98ddb7068279d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> drivers/base/devres.c:73:40: error: no member named 'name' in 'struct devres_node'
           trace_devres_log(dev, op, node, node->name, node->size);
                                           ~~~~  ^
>> drivers/base/devres.c:73:52: error: no member named 'size' in 'struct devres_node'
           trace_devres_log(dev, op, node, node->name, node->size);
                                                       ~~~~  ^

2 errors generated.

vim +73 drivers/base/devres.c

    69	
    70	static void devres_log(struct device *dev, struct devres_node *node,
    71			       const char *op)
    72	{
  > 73		trace_devres_log(dev, op, node, node->name, node->size);
    74		devres_dbg(dev, node, op);
    75	}
    76	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org