Skip to content

Commit 6e7ad1a

Browse files
Saravana Kannangregkh
authored andcommitted
driver core: fw_devlink: Improve logs for cycle detection
The links in a cycle are not all logged in a consistent manner or not logged at all. Make them consistent by adding a "cycle:" string and log all the link in the cycles (even the child ==> parent dependency) so that it's easier to debug cycle detection code. Also, mark the start and end of a cycle so it's easy to tell when multiple cycles are logged back to back. Signed-off-by: Saravana Kannan <saravanak@google.com> Tested-by: Xu Yang <xu.yang_2@nxp.com> Link: https://lore.kernel.org/r/20240202095636.868578-4-saravanak@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6442d79 commit 6e7ad1a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/base/core.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static void __fwnode_link_del(struct fwnode_link *link)
125125
*/
126126
static void __fwnode_link_cycle(struct fwnode_link *link)
127127
{
128-
pr_debug("%pfwf: Relaxing link with %pfwf\n",
128+
pr_debug("%pfwf: cycle: depends on %pfwf\n",
129129
link->consumer, link->supplier);
130130
link->flags |= FWLINK_FLAG_CYCLE;
131131
}
@@ -1945,6 +1945,7 @@ static bool __fw_devlink_relax_cycles(struct device *con,
19451945

19461946
/* Termination condition. */
19471947
if (sup_dev == con) {
1948+
pr_debug("----- cycle: start -----\n");
19481949
ret = true;
19491950
goto out;
19501951
}
@@ -1976,8 +1977,11 @@ static bool __fw_devlink_relax_cycles(struct device *con,
19761977
else
19771978
par_dev = fwnode_get_next_parent_dev(sup_handle);
19781979

1979-
if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode))
1980+
if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode)) {
1981+
pr_debug("%pfwf: cycle: child of %pfwf\n", sup_handle,
1982+
par_dev->fwnode);
19801983
ret = true;
1984+
}
19811985

19821986
if (!sup_dev)
19831987
goto out;
@@ -1993,6 +1997,8 @@ static bool __fw_devlink_relax_cycles(struct device *con,
19931997

19941998
if (__fw_devlink_relax_cycles(con,
19951999
dev_link->supplier->fwnode)) {
2000+
pr_debug("%pfwf: cycle: depends on %pfwf\n", sup_handle,
2001+
dev_link->supplier->fwnode);
19962002
fw_devlink_relax_link(dev_link);
19972003
dev_link->flags |= DL_FLAG_CYCLE;
19982004
ret = true;
@@ -2072,6 +2078,7 @@ static int fw_devlink_create_devlink(struct device *con,
20722078
if (__fw_devlink_relax_cycles(con, sup_handle)) {
20732079
__fwnode_link_cycle(link);
20742080
flags = fw_devlink_get_flags(link->flags);
2081+
pr_debug("----- cycle: end -----\n");
20752082
dev_info(con, "Fixed dependency cycle(s) with %pfwf\n",
20762083
sup_handle);
20772084
}

0 commit comments

Comments
 (0)