From patchwork Fri Feb 2 09:22:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravana Kannan X-Patchwork-Id: 195747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp311407dyc; Fri, 2 Feb 2024 01:36:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFz79dVwuFd9vwxZjur9HFwEnrafv5t3QFWMIOLYFirDFVemAsY8YgT2YO2QKij4al3n5qv X-Received: by 2002:a17:906:4ec9:b0:a36:8802:ffc5 with SMTP id i9-20020a1709064ec900b00a368802ffc5mr916259ejv.7.1706866586748; Fri, 02 Feb 2024 01:36:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706866586; cv=pass; d=google.com; s=arc-20160816; b=VTFr+3sC7utO4NmXKhf4YL3zEPOQU8d/6doT8tc8OfHudBJF+QpF2K+8U9qIxGRkqN 2xC3wHrtyQIUmzWMpBXOq4LDeZsjLFL+6gG2NoKwTQXdWWLBVYzKDNNl94rG0SLxKLmO 9zfGrLUortD3ReN1JaiOxk/zQUN3f8tPv4uXkKw30K4D+itIA61Y/SGGDWO4ufLtD1Sg gMp7vG03aOyQmXyZVhXMk2xFYF2CS31HBOyTl4N87gK/vXRg+ju4XL8Lk2bLh0ftFsrO NVr7+SrOYbuYm6xzmY8ynTXuShgC4S58mN9uo3rjfoPTTov5liHWHMzA/ufa5EPZ/HMn 8DbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=daL4XB8bCp+vh8RMiM1+uZyeaTeJtdmdzdYfvAgKrYE=; fh=4w2wMiSyMcedQiW9Y5v1xYyk2Su4Ac3R6ZT9jURT8v0=; b=x6Uydg0j/mmGgF8WG+BX9G5CXlqN9Q5I4Yzrw7xgJIzDC1Xc7p33A8HKIF+J7BRGD0 B5815OtaOeoav1mnMwSZP3c5VGKch0vpIJIoGKtJaFwNrp8fvDD1zV6bYW8GTwqwPZqv uGzzUKiflhCIhjbt1kks5UTdI+k3dRvpdlq4twoyiv/i5Ft5uXIfwLxQA46W3EKaHLOv HL95+/BKCchlQpgxU5I/5L56KtJsPO/ONsdBxqFDrJPEOlnhFRfgqO8MFntreN1X8xLe jtXXm2J5iGMPNjhIx662TahjhucDFuJYwEaPr86v4Y8DPIYhMtq4xFNj9XlUl7zUSTLv GEbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XAtGc7il; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-49570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49570-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCUY6zBxKsLOHg6IPNwTcPT73xpaiI8mr1VpsZA4qa9CNyRgtJkNsEFALJUBifg+XqOXbZdGnCp1XAGP0f4H6wg2oNvfVA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n17-20020a170906379100b00a36cdcee3desi646205ejc.964.2024.02.02.01.36.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 01:36:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=XAtGc7il; arc=pass (i=1 spf=pass spfdomain=flex--saravanak.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-49570-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49570-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9862F1F2D285 for ; Fri, 2 Feb 2024 09:27:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C86F07F7DB; Fri, 2 Feb 2024 09:23:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XAtGc7il" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 705917F486 for ; Fri, 2 Feb 2024 09:23:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706865784; cv=none; b=u1dSdzCLUnr9kh1IdQkuUJ2pN/DBEeub+JbzxxwJ2NHU258dvvyNeMRJPVXjJCw/u0FqKL1Lij8mAgTi/IfDJFiWLznvwdKcfP4eGud0MrFydlxamNo82O4Cmc3lV+vMiDdVdteURPg6SyxLUvBKNpU2dMSaSLpHgBmLsUYByrI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706865784; c=relaxed/simple; bh=d5iHkLoKQ8sjTlEpS17LaVao7OCj1mW9ysVyF9v8tcQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=Nn4ous9A+tPOV2snTAnY/ZtL8IQassWBGc52+QRC2alfoO4sPr6RZ3CmS0eTURrTocyEanm/UrENNTffTbBbVKEvjA022RFTAsmsc0E9SIYcroU4cPLQG0G2RHvlLq+ZLkWItzoREh9JfoRHXGK0ONq79WBoAPADPY8kx5UKzes= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=XAtGc7il; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--saravanak.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-604186a5775so22242957b3.1 for ; Fri, 02 Feb 2024 01:23:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706865781; x=1707470581; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=daL4XB8bCp+vh8RMiM1+uZyeaTeJtdmdzdYfvAgKrYE=; b=XAtGc7ilxk0h7ynIvyZU5VI8VTyQGZglr2qGTG62aqFdmlLfYwVHLacjD/nhRI9pY9 wJ2ULa7M+xT5sbv0BuARZz+rfqbOCyTO7f/IOS2uYXcQGeyL0cYFEDeJ8CxObozOK5Xq DDMoxqcsyVPpJ3BujiI7kQB92fCdV1eW7cgaX0WGIwlDL0nGAgc/t0gE/O7Re1v/WvVn Y0Ia/1BGoQM12GxVl4meMnBmizOmVVXTZtMiiuC7Nt17b6E0OZ1/vkRDRtvlSvbrCmiu mTUY/8OZ4r3UpNr+JpSoZcrzhBhLLmTcExpwjc9R/MlW8xtYbxU5C+XhRPVOc/4QoPk9 uRNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706865781; x=1707470581; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=daL4XB8bCp+vh8RMiM1+uZyeaTeJtdmdzdYfvAgKrYE=; b=QgtLV4CFvCvhFyIvbghjMdys9iOWKaDUlvQiiROY9Ta03CeA1aN+xK3hXpxWjfoyFU 7+IfonFavwPS1V4Ks7EQMTJZ2FuLCBMNNiMYjWJpt7WIjyPsNCjjHl+G8YZbeNN7PUIk c1UIgG1KJfTsp1Y2E2jvHKCfRsVQt5g5a/s/PO7QyWGrsKIr9vSpLUYJJ0Od2r5SCZKM +q1E+SuzR6PHfOdRdf72y7jNsLn1EicPQtY3ZjenhMqnvTGsO1OJSRU8g3Pens+eNPvk AXJ78fTnppEiSk2lXvAfLx0vdtt/LlnMcVpA+LxQmXDFcIgrOLr5DPk+XlOoL/90RGlT x5FA== X-Gm-Message-State: AOJu0YzwvRuohwA18oN2aO4hWLWz4n08rgwOfd6h7g/HSFdts00uZIHq WI12am1S/PY1/DlwjSKtp50ZsYRj+TO5rfdUeP1lsCBBkpEjMfkfUFsvc0sngJEtgxmWW0l4I6n Cy3EQ0S2XNenarg== X-Received: from saravanak.san.corp.google.com ([2620:15c:2d:3:6f0:da10:9cb3:5b3]) (user=saravanak job=sendgmr) by 2002:a05:690c:2911:b0:5ff:78d0:b4b2 with SMTP id eg17-20020a05690c291100b005ff78d0b4b2mr214000ywb.3.1706865781565; Fri, 02 Feb 2024 01:23:01 -0800 (PST) Date: Fri, 2 Feb 2024 01:22:49 -0800 In-Reply-To: <20240202092250.786276-1-saravanak@google.com> Message-Id: <20240202092250.786276-4-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240202092250.786276-1-saravanak@google.com> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Subject: [PATCH v1 3/3] driver core: fw_devlink: Improve logs for cycle detection From: Saravana Kannan To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Saravana Kannan Cc: Xu Yang , kernel-team@android.com, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789779338423039264 X-GMAIL-MSGID: 1789779338423039264 The links in a cycle are not all logged in a consistent manner or not logged at all. Make them consistent 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 --- drivers/base/core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index e3d666461835..084d9648e254 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -125,7 +125,7 @@ static void __fwnode_link_del(struct fwnode_link *link) */ static void __fwnode_link_cycle(struct fwnode_link *link) { - pr_debug("%pfwf: Relaxing link with %pfwf\n", + pr_debug("%pfwf: cycle: depends on %pfwf\n", link->consumer, link->supplier); link->flags |= FWLINK_FLAG_CYCLE; } @@ -1945,6 +1945,7 @@ static bool __fw_devlink_relax_cycles(struct device *con, /* Termination condition. */ if (sup_dev == con) { + pr_debug("----- cycle: start -----\n"); ret = true; goto out; } @@ -1976,8 +1977,11 @@ static bool __fw_devlink_relax_cycles(struct device *con, else par_dev = fwnode_get_next_parent_dev(sup_handle); - if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode)) + if (par_dev && __fw_devlink_relax_cycles(con, par_dev->fwnode)) { + pr_debug("%pfwf: cycle: depends on %pfwf\n", sup_handle, + par_dev->fwnode); ret = true; + } if (!sup_dev) goto out; @@ -1993,6 +1997,8 @@ static bool __fw_devlink_relax_cycles(struct device *con, if (__fw_devlink_relax_cycles(con, dev_link->supplier->fwnode)) { + pr_debug("%pfwf: cycle: depends on %pfwf\n", sup_handle, + dev_link->supplier->fwnode); fw_devlink_relax_link(dev_link); dev_link->flags |= DL_FLAG_CYCLE; ret = true; @@ -2072,6 +2078,7 @@ static int fw_devlink_create_devlink(struct device *con, if (__fw_devlink_relax_cycles(con, sup_handle)) { __fwnode_link_cycle(link); flags = fw_devlink_get_flags(link->flags); + pr_debug("----- cycle: end -----\n"); dev_info(con, "Fixed dependency cycle(s) with %pfwf\n", sup_handle); }