Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/751602/?format=api
{ "id": 751602, "url": "http://patchwork.ozlabs.org/api/patches/751602/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1492475525-10827-1-git-send-email-tyreld@linux.vnet.ibm.com/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<1492475525-10827-1-git-send-email-tyreld@linux.vnet.ibm.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1492475525-10827-1-git-send-email-tyreld@linux.vnet.ibm.com/", "date": "2017-04-18T00:32:05", "name": "of: introduce event tracepoints for dynamic device_node lifecyle", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": false, "hash": "704699279936c0970d12cf6a32d13407cd8dd00f", "submitter": { "id": 35498, "url": "http://patchwork.ozlabs.org/api/people/35498/?format=api", "name": "Tyrel Datwyler", "email": "tyreld@linux.vnet.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1492475525-10827-1-git-send-email-tyreld@linux.vnet.ibm.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/751602/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/751602/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>", "X-Original-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Delivered-To": [ "patchwork-incoming@ozlabs.org", "linuxppc-dev@lists.ozlabs.org" ], "Received": [ "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3w6R1h1nhVz9s3w\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 18 Apr 2017 10:33:12 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3w6R1h11d4zDqJt\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 18 Apr 2017 10:33:12 +1000 (AEST)", "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3w6R0c18p3zDq7Z\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tTue, 18 Apr 2017 10:32:15 +1000 (AEST)", "from pps.filterd (m0098396.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id\n\tv3I0SiWh008124\n\tfor <linuxppc-dev@lists.ozlabs.org>; Mon, 17 Apr 2017 20:32:14 -0400", "from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 29w0p6gyk1-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Mon, 17 Apr 2017 20:32:14 -0400", "from localhost\n\tby e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from <tyreld@linux.vnet.ibm.com>; \n\tMon, 17 Apr 2017 18:32:13 -0600", "from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18)\n\tby e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tMon, 17 Apr 2017 18:32:08 -0600", "from b03ledav006.gho.boulder.ibm.com\n\t(b03ledav006.gho.boulder.ibm.com [9.17.130.237])\n\tby b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v3I0W8xP10879436; Mon, 17 Apr 2017 17:32:08 -0700", "from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 0595AC6037;\n\tMon, 17 Apr 2017 18:32:08 -0600 (MDT)", "from ltcalpine2-lp2.aus.stglabs.ibm.com (unknown [9.40.195.185])\n\tby b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP id 56AA3C6042;\n\tMon, 17 Apr 2017 18:32:07 -0600 (MDT)" ], "From": "Tyrel Datwyler <tyreld@linux.vnet.ibm.com>", "To": "robh+dt@kernel.org", "Subject": "[PATCH] of: introduce event tracepoints for dynamic device_node\n\tlifecyle", "Date": "Mon, 17 Apr 2017 20:32:05 -0400", "X-Mailer": "git-send-email 1.8.3.1", "X-TM-AS-GCONF": "00", "x-cbid": "17041800-0008-0000-0000-000007A0B0F8", "X-IBM-SpamModules-Scores": "", "X-IBM-SpamModules-Versions": "BY=3.00006935; HX=3.00000240; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000208; SDB=6.00848885; UDB=6.00419109;\n\tIPR=6.00627525; \n\tBA=6.00005292; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015073;\n\tXFM=3.00000013; UTC=2017-04-18 00:32:11", "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused", "x-cbparentid": "17041800-0009-0000-0000-0000418EE7DB", "Message-Id": "<1492475525-10827-1-git-send-email-tyreld@linux.vnet.ibm.com>", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-04-17_22:, , signatures=0", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=1\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001\n\tdefinitions=main-1704180003", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.23", "Precedence": "list", "List-Id": "Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>", "List-Unsubscribe": "<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>", "List-Archive": "<http://lists.ozlabs.org/pipermail/linuxppc-dev/>", "List-Post": "<mailto:linuxppc-dev@lists.ozlabs.org>", "List-Help": "<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>", "List-Subscribe": "<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>", "Cc": "devicetree@vger.kernel.org, frowand.list@gmail.com,\n\tlinux-kernel@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, \n\tTyrel Datwyler <tyreld@linux.vnet.ibm.com>, nfont@linux.vnet.ibm.com, \n\tlinuxppc-dev@lists.ozlabs.org", "Errors-To": "linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org", "Sender": "\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>" }, "content": "This patch introduces event tracepoints for tracking a device_nodes\nreference cycle as well as reconfig notifications generated in response\nto node/property manipulations.\n\nWith the recent upstreaming of the refcount API several device_node\nunderflows and leaks have come to my attention in the pseries (DLPAR) dynamic\nlogical partitioning code (ie. POWER speak for hotplugging virtual and physcial\nresources at runtime such as cpus or IOAs). These tracepoints provide a\neasy and quick mechanism for validating the reference counting of\ndevice_nodes during their lifetime.\n\nFurther, when pseries lpars are migrated to a different machine we\nperform a live update of our device tree to bring it into alignment with the\nconfiguration of the new machine. The of_reconfig_notify trace point\nprovides a mechanism that can be turned for debuging the device tree\nmodifications with out having to build a custom kernel to get at the\nDEBUG code introduced by commit 00aa3720.\n\nThe following trace events are provided: of_node_get, of_node_put,\nof_node_release, and of_reconfig_notify. These trace points require a kernel\nbuilt with ftrace support to be enabled. In a typical environment where\ndebugfs is mounted at /sys/kernel/debug the entire set of tracepoints\ncan be set with the following:\n\n echo \"of:*\" > /sys/kernel/debug/tracing/set_event\n\nor\n\n echo 1 > /sys/kernel/debug/tracing/of/enable\n\nThe following shows the trace point data from a DLPAR remove of a cpu\nfrom a pseries lpar:\n\ncat /sys/kernel/debug/tracing/trace | grep \"POWER8@10\"\n\ncpuhp/23-147 [023] .... 128.324827:\n\tof_node_put: refcount=5, dn->full_name=/cpus/PowerPC,POWER8@10\ncpuhp/23-147 [023] .... 128.324829:\n\tof_node_put: refcount=4, dn->full_name=/cpus/PowerPC,POWER8@10\ncpuhp/23-147 [023] .... 128.324829:\n\tof_node_put: refcount=3, dn->full_name=/cpus/PowerPC,POWER8@10\ncpuhp/23-147 [023] .... 128.324831:\n\tof_node_put: refcount=2, dn->full_name=/cpus/PowerPC,POWER8@10\n drmgr-7284 [009] .... 128.439000:\n\tof_node_put: refcount=1, dn->full_name=/cpus/PowerPC,POWER8@10\n drmgr-7284 [009] .... 128.439002:\n\tof_reconfig_notify: action=DETACH_NODE, dn->full_name=/cpus/PowerPC,POWER8@10,\n\t\t\t prop->name=null, old_prop->name=null\n drmgr-7284 [009] .... 128.439015:\n\tof_node_put: refcount=0, dn->full_name=/cpus/PowerPC,POWER8@10\n drmgr-7284 [009] .... 128.439016:\n\tof_node_release: dn->full_name=/cpus/PowerPC,POWER8@10, dn->_flags=4\n\nSigned-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>\n---\n drivers/of/dynamic.c | 30 ++++++---------\n include/trace/events/of.h | 93 +++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 105 insertions(+), 18 deletions(-)\n create mode 100644 include/trace/events/of.h", "diff": "diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c\nindex 888fdbc..85c0966 100644\n--- a/drivers/of/dynamic.c\n+++ b/drivers/of/dynamic.c\n@@ -16,6 +16,9 @@\n \n #include \"of_private.h\"\n \n+#define CREATE_TRACE_POINTS\n+#include <trace/events/of.h>\n+\n /**\n * of_node_get() - Increment refcount of a node\n * @node:\tNode to inc refcount, NULL is supported to simplify writing of\n@@ -25,8 +28,10 @@\n */\n struct device_node *of_node_get(struct device_node *node)\n {\n-\tif (node)\n+\tif (node) {\n \t\tkobject_get(&node->kobj);\n+\t\ttrace_of_node_get(refcount_read(&node->kobj.kref.refcount), node->full_name);\n+\t}\n \treturn node;\n }\n EXPORT_SYMBOL(of_node_get);\n@@ -38,8 +43,10 @@ struct device_node *of_node_get(struct device_node *node)\n */\n void of_node_put(struct device_node *node)\n {\n-\tif (node)\n+\tif (node) {\n+\t\ttrace_of_node_put(refcount_read(&node->kobj.kref.refcount) - 1, node->full_name);\n \t\tkobject_put(&node->kobj);\n+\t}\n }\n EXPORT_SYMBOL(of_node_put);\n \n@@ -92,24 +99,9 @@ int of_reconfig_notifier_unregister(struct notifier_block *nb)\n int of_reconfig_notify(unsigned long action, struct of_reconfig_data *p)\n {\n \tint rc;\n-#ifdef DEBUG\n-\tstruct of_reconfig_data *pr = p;\n \n-\tswitch (action) {\n-\tcase OF_RECONFIG_ATTACH_NODE:\n-\tcase OF_RECONFIG_DETACH_NODE:\n-\t\tpr_debug(\"notify %-15s %s\\n\", action_names[action],\n-\t\t\tpr->dn->full_name);\n-\t\tbreak;\n-\tcase OF_RECONFIG_ADD_PROPERTY:\n-\tcase OF_RECONFIG_REMOVE_PROPERTY:\n-\tcase OF_RECONFIG_UPDATE_PROPERTY:\n-\t\tpr_debug(\"notify %-15s %s:%s\\n\", action_names[action],\n-\t\t\tpr->dn->full_name, pr->prop->name);\n-\t\tbreak;\n+\ttrace_of_reconfig_notify(action, p);\n \n-\t}\n-#endif\n \trc = blocking_notifier_call_chain(&of_reconfig_chain, action, p);\n \treturn notifier_to_errno(rc);\n }\n@@ -326,6 +318,8 @@ void of_node_release(struct kobject *kobj)\n \tstruct device_node *node = kobj_to_device_node(kobj);\n \tstruct property *prop = node->properties;\n \n+\ttrace_of_node_release(node);\n+\n \t/* We should never be releasing nodes that haven't been detached. */\n \tif (!of_node_check_flag(node, OF_DETACHED)) {\n \t\tpr_err(\"ERROR: Bad of_node_put() on %s\\n\", node->full_name);\ndiff --git a/include/trace/events/of.h b/include/trace/events/of.h\nnew file mode 100644\nindex 0000000..0d53271\n--- /dev/null\n+++ b/include/trace/events/of.h\n@@ -0,0 +1,93 @@\n+#undef TRACE_SYSTEM\n+#define TRACE_SYSTEM of\n+\n+#if !defined(_TRACE_OF_H) || defined(TRACE_HEADER_MULTI_READ)\n+#define _TRACE_OF_H\n+\n+#include <linux/of.h>\n+#include <linux/tracepoint.h>\n+\n+DECLARE_EVENT_CLASS(of_node_ref_template,\n+\n+\tTP_PROTO(int refcount, const char* dn_name),\n+\n+\tTP_ARGS(refcount, dn_name),\n+\n+\tTP_STRUCT__entry(\n+\t\t__string(dn_name, dn_name)\n+\t\t__field(int, refcount)\n+\t),\n+\n+\tTP_fast_assign(\n+\t\t__assign_str(dn_name, dn_name);\n+\t\t__entry->refcount = refcount;\n+\t),\n+\n+\tTP_printk(\"refcount=%d, dn->full_name=%s\",\n+\t\t __entry->refcount, __get_str(dn_name))\n+);\n+\n+DEFINE_EVENT(of_node_ref_template, of_node_get,\n+\t TP_PROTO(int refcount, const char* dn_name),\n+\t TP_ARGS(refcount, dn_name));\n+\n+DEFINE_EVENT(of_node_ref_template, of_node_put,\n+\t TP_PROTO(int refcount, const char* dn_name),\n+\t TP_ARGS(refcount, dn_name));\n+\n+TRACE_EVENT(of_node_release,\n+\n+\tTP_PROTO(struct device_node *dn),\n+\n+\tTP_ARGS(dn),\n+\n+\tTP_STRUCT__entry(\n+\t\t__string(dn_name, dn->full_name)\n+\t\t__field(unsigned long, flags)\n+\t),\n+\n+\tTP_fast_assign(\n+\t\t__assign_str(dn_name, dn->full_name);\n+\t\t__entry->flags = dn->_flags;\n+\t),\n+\n+\tTP_printk(\"dn->full_name=%s, dn->_flags=%lu\", \n+\t\t __get_str(dn_name), __entry->flags)\n+);\n+\n+#define of_reconfig_action_names \\\n+\t{OF_RECONFIG_ATTACH_NODE, \"ATTACH_NODE\"}, \\\n+\t{OF_RECONFIG_DETACH_NODE, \"DETACH_NODE\"}, \\\n+\t{OF_RECONFIG_ADD_PROPERTY, \"ADD_PROPERTY\"}, \\\n+\t{OF_RECONFIG_REMOVE_PROPERTY, \"REMOVE_PROPERTY\"}, \\\n+\t{OF_RECONFIG_UPDATE_PROPERTY, \"UPDATE_PROPERTY\"}\n+\n+TRACE_EVENT(of_reconfig_notify,\n+\n+\tTP_PROTO(unsigned long action, struct of_reconfig_data *ord),\n+\n+\tTP_ARGS(action, ord),\n+\n+\tTP_STRUCT__entry(\n+\t\t__field(unsigned long, action)\n+\t\t__string(dn_name, ord->dn->full_name)\n+\t\t__string(prop_name, ord->prop ? ord->prop->name : \"null\")\n+\t\t__string(oldprop_name, ord->old_prop ? ord->old_prop->name : \"null\")\n+\t),\n+\n+\tTP_fast_assign(\n+\t\t__entry->action = action;\n+\t\t__assign_str(dn_name, ord->dn->full_name);\n+\t\t__assign_str(prop_name, ord->prop ? ord->prop->name : \"null\");\n+\t\t__assign_str(oldprop_name, ord->old_prop ? ord->old_prop->name : \"null\");\n+\t),\n+\n+\tTP_printk(\"action=%s, dn->full_name=%s, prop->name=%s, old_prop->name=%s\",\n+\t\t __print_symbolic(__entry->action, of_reconfig_action_names),\n+\t\t __get_str(dn_name), __get_str(prop_name), __get_str(oldprop_name))\n+);\n+\n+#endif /*\t_TRACE_OF_H */\n+\n+/* This part must be outside protection */\n+#include <trace/define_trace.h>\n", "prefixes": [] }