RE: [PATCH V4 1/3] usb: gadget: configfs: add UDC trace entry
From: Linyu Yuan (QUIC) <hidden>
Date: 2021-08-24 10:07:41
Hi,
-----Original Message----- From: Felipe Balbi <balbi@kernel.org> Sent: Tuesday, August 24, 2021 4:29 PM To: Linyu Yuan (QUIC) <redacted> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; linux- usb@vger.kernel.org Subject: Re: [PATCH V4 1/3] usb: gadget: configfs: add UDC trace entry Hi again, Felipe Balbi [off-list ref] writes:quoted
Linyu Yuan [off-list ref] writes:quoted
add trace in function gadget_dev_desc_UDC_store() will show when user space enable/disable the gadget. Signed-off-by: Linyu Yuan <redacted> --- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/configfs.c | 3 +++ drivers/usb/gadget/configfs_trace.c | 7 +++++++ drivers/usb/gadget/configfs_trace.h | 39+++++++++++++++++++++++++++++++++++++quoted
quoted
4 files changed, 50 insertions(+) create mode 100644 drivers/usb/gadget/configfs_trace.c create mode 100644 drivers/usb/gadget/configfs_trace.hdiff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index 130dad7..8e9c2b8 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile@@ -9,5 +9,6 @@ ccflags-y += -I$(srctree)/drivers/usb/gadget/udcquoted
quoted
obj-$(CONFIG_USB_LIBCOMPOSITE) += libcomposite.o libcomposite-y := usbstring.o config.o epautoconf.o libcomposite-y += composite.o functions.o configfs.ou_f.oquoted
quoted
+libcomposite-y += configfs_trace.o obj-$(CONFIG_USB_GADGET) += udc/ function/ legacy/diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 477e72a..f7f3af8 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c@@ -9,6 +9,7 @@ #include "configfs.h" #include "u_f.h" #include "u_os_desc.h" +#include "configfs_trace.h" int check_user_usb_string(const char *name, struct usb_gadget_strings *stringtab_dev)@@ -270,6 +271,8 @@ static ssize_t gadget_dev_desc_UDC_store(structconfig_item *item,quoted
quoted
if (name[len - 1] == '\n') name[len - 1] = '\0'; + trace_gadget_dev_desc_UDC_store(config_item_name(item),name);quoted
why tracing only the names? This gives us no insight into whatever bug
This patch only trace user space operation when enable a composition like below of android or similar thing in another way,
on property:sys.usb.config=mtp && property:sys.usb.configfs=1
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp"
symlink /config/usb_gadget/g1/functions/mtp.gs0 /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
quoted
may happen and we may want to use trace events to debug. Rather, try to think of trace events as tracking the lifetime of the UDC and gadget. Trace values that may change over time.
UDC already have trace https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/tree/drivers/usb/gadget/udc/trace.h?h=usb-linus I can't confirm if I understand your comment correctly ?
quoted
I also think that all three patches could be combined into a single commit, but that's up to discussion.nevermind this last paragraph, just saw that Greg asked you to split ;-) The first paragraph remains valid, though -- balbi