Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp327819rdh; Tue, 13 Feb 2024 19:45:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUHVltakGdMsxvuqEvteSwG0SuYlS97XNPM4FQdHENrkKliDLE9A8/+qT3/7o43oQPnQ66uYgiYZN549nzy8CtYhJJDmV2VxIMmc2GFdw== X-Google-Smtp-Source: AGHT+IEzSP9IXdQT4yuiyZTRt2Z2S700qdQbf31N/sboMzChP13GPIUkfqc6Yi0g/lf99p1XJpVI X-Received: by 2002:a17:906:5fd6:b0:a3c:9cc4:99a0 with SMTP id k22-20020a1709065fd600b00a3c9cc499a0mr623101ejv.16.1707882308850; Tue, 13 Feb 2024 19:45:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707882308; cv=pass; d=google.com; s=arc-20160816; b=HhplW/rxQ5AkMkcx0/6xs0luQvUySY99wT8JhNewgazzUDDULvICJhJnupxloe/7CV ug3CjuTR3d7m+MXFc9iLBRV2Osgo29n4IIH3o4x+tYveOuMzERR5Cvm7TSXgzWziWB0z nxVa+GVJqUYcxdFVHVTcAI+sQQAjR100AgNazBSqHf9JQjlbrRYJ+rRs+2HCFnIHrkn+ ZS2r9bJqlJW3nULPHkrV/EJCEpapiwLW6lp79OCBEqHd7buEqN0fjWxlvSDSMUkZNgaO NLppPVmItSgf7jM4edWI1Gatr9eetAKo0DjecDkmPlx4g4mWd970ZF7s2djxOI4kH348 JTMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=xdTms2KNxEQNoDVfOlewboipZEhREK6jYFWALQnd5FA=; fh=i0X3A4XmIM52p+7EuWRA7ZuYc+UIk4dJRSebquiMBfA=; b=nHqstZfvnhp4YznaB0ivqGRBGDDc4QSLJoLEkRxRd5OpkUUreQ41f6EtGxfMNaBNi8 sFXIlOzwFlmXKdsI/6LITtDJRmNfc8geTx8RMn7Ow+maHk4MeVJLQv5P9ERE5OGVUV4I ubLzxXosE4PP4NLkyeNqbqsswBm2fsN2p+zN80hsT9OmuXlNAJmXcEepx+ojq0oZpJx1 YV9q5s93/u5mDgc7I6eDDc18q+hiQDF/KJTdXSnDaYGgVG0ME3Y0bN/EYDHuxCi2u+S7 AdFPcxoOkuuCEWV+Ad2+TfX4PVlat+NLB7OQ83KTJqV1Wth8ts7iG0AmtUPcIq/Y0Bze hdkg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=U3YcoCss; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-64716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVhvfd9XQ1CHnze+8sc+5Nuosb1wvwSqBQbBVqryC/s1lSumGrwKcTMzdQPfyLJuLnvymdWKHbBoGruT76XkMIGPQdPc7tn/vlKD4RnCg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gr10-20020a170906e2ca00b00a3d283d3be1si622032ejb.840.2024.02.13.19.45.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 19:45:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=U3YcoCss; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-64716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64716-linux.lists.archive=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 6F2631F29BDC for ; Wed, 14 Feb 2024 03:45:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3526BA28; Wed, 14 Feb 2024 03:44:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="U3YcoCss" Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (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 1B06810A0F for ; Wed, 14 Feb 2024 03:44:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707882299; cv=none; b=d4D0FsvpDDEDCFR/NGgVT4pftyHGgBmxh5JoB48IWfNQxSG53cmSW9tEV6Eax32/d54M5hDgXUeMJ/KplyoL7ASammiZ9NIzSzdlcSD01vRpX1YJ0r9CU8LiZg/1VBtr7VggXhM4jqHmjWre2nafIHv/lfS0Wh6ljZKVzWTZXtY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707882299; c=relaxed/simple; bh=UUnUEzJ5jjH8ByEMpB5TAcY1gR1nRdoCWKhMnfRZjTA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=PCRKCMH5s7bYjNWgx9qckj7JU0b+5s3hjN+CHYPyT09E5XMrt7iR0SXXWxPvQ2Z2TyrRc+xx7wxxeEmVA09lMe78E3UlBatjx/iYOopAvRtepgMdX9bEw3xTFRrdLWJ6dxVImpfgXIIeyGPfyFLytFqvGUxI6lxRTF+DkEqiFUI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=U3YcoCss; arc=none smtp.client-ip=209.85.160.175 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=google.com Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-42a99dc9085so262891cf.0 for ; Tue, 13 Feb 2024 19:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707882295; x=1708487095; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xdTms2KNxEQNoDVfOlewboipZEhREK6jYFWALQnd5FA=; b=U3YcoCss3f7/3PmjPae7nfgc799BQ8PwWHJeoQ1vQ/7amakQUxevj4Ht0mYjYbFUDk HEIVsy5UfvRD6j0SdV9kZSuV4SvRm7zx5eRcJ5lYf7+FQjBwAufRuVCP4wFzPrUSBQ6K uBGZmLYfBgwiHcuxTMalYiZfKaDhJCNtvkYV/+iBTmjaAe5R+DBVX3Px2PlUYlu8u+ur RKtPyjH5G8By6TwQt4g+JnbtTu/ibrDk0aXGWG8EYOYi0eZC1M2hiLLYBeqgcKwwQ15c ekJ6GhMK3BQmTtAzULAMXp8t1HagJK2KHoKLZsk7ab4dOrcmv/yeYUJmxRgfTL+0+6OQ 96QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707882295; x=1708487095; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xdTms2KNxEQNoDVfOlewboipZEhREK6jYFWALQnd5FA=; b=Zmg5RIN31gRXu0tmShaFpDDqFUZmam5kdRjuDWpqEo7LQ+3jyFpuDx/MW8UH8F05Op ZGuNji06N/GQC52HAH+ZjkJIz1Pkw8+gsnHW6V/4ZIH3vfVboX0sJlmU81dk8np8ruPB CywORB3jFD0t7RLUncd8IRXrTtF+rHqt0M+gMFoGv6C+971cSaVkreiRsyopuUGd9Kb9 eKpV74g6sQP4Zj7Y5+Z9YZkXTl6onobafZvmQGwgM2+g3aHCFJScdOq1qkg4xaZe62/J NPY/wloGepJsJO6jZXROmTU5E6RiyqGPypelz3OrAjUKsYrCaYs2dq72/BIbD6/At5JP nR8A== X-Forwarded-Encrypted: i=1; AJvYcCUPdcpPiKfnvIjH+M1khLEFRO8Py3m7gg3pPmzXRroe18WNuuB2+zCksEkq4YYZVJO6SUq6TmgYfDrMtJTSweBUyc/CZ5sm7HKyY10y X-Gm-Message-State: AOJu0Yx15+hbDhkB34WZL9f9Nc5H1a4b5oQURnZMWsbwEK0zNsx2l7zO BElBzHJ+BKNbVT83l073qjPFrbzcF1uWkPTCrKChrUDLjWPElcpqaMVV1XqaAJK4YUI6gTMTPyM DBw3w3IoML4Nob3EBiXwxktgCeLTT88uF8QXt X-Received: by 2002:ac8:4f49:0:b0:42b:f8ef:9d60 with SMTP id i9-20020ac84f49000000b0042bf8ef9d60mr137168qtw.19.1707882294841; Tue, 13 Feb 2024 19:44:54 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240205-fix-device-links-overlays-v2-0-5344f8c79d57@analog.com> <20240205-fix-device-links-overlays-v2-2-5344f8c79d57@analog.com> <20240213145131.GA1180152-robh@kernel.org> <48a86fa6908a2a7a38a45dc6dbb5574c4a9d7400.camel@gmail.com> In-Reply-To: <48a86fa6908a2a7a38a45dc6dbb5574c4a9d7400.camel@gmail.com> From: Saravana Kannan Date: Tue, 13 Feb 2024 19:44:16 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] of: dynamic: flush devlinks workqueue before destroying the changeset To: =?UTF-8?B?TnVubyBTw6E=?= Cc: Rob Herring , Nuno Sa , Greg Kroah-Hartman , "Rafael J. Wysocki" , Frank Rowand , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Len Brown , linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Android Kernel Team Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 13, 2024 at 6:57=E2=80=AFAM Nuno S=C3=A1 wrote: > > On Tue, 2024-02-13 at 08:51 -0600, Rob Herring wrote: > > On Mon, Feb 12, 2024 at 01:10:27PM +0100, Nuno S=C3=A1 wrote: > > > On Mon, 2024-02-05 at 13:09 +0100, Nuno Sa wrote: > > > > Device links will drop their supplier + consumer refcounts > > > > asynchronously. That means that the refcount of the of_node attache= d to > > > > these devices will also be dropped asynchronously and so we cannot > > > > guarantee the DT overlay assumption that the of_node refcount must = be 1 in > > > > __of_changeset_entry_destroy(). > > > > > > > > Given the above, call the new fwnode_links_flush_queue() helper to = flush > > > > the devlink workqueue so we can be sure that all links are dropped = before > > > > doing the proper checks. > > > > > > > > Signed-off-by: Nuno Sa > > > > --- > > > > drivers/of/dynamic.c | 8 ++++++++ > > > > 1 file changed, 8 insertions(+) > > > > > > > > diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c > > > > index 3bf27052832f..b7153c72c9c9 100644 > > > > --- a/drivers/of/dynamic.c > > > > +++ b/drivers/of/dynamic.c > > > > @@ -14,6 +14,7 @@ > > > > #include > > > > #include > > > > #include > > > > +#include > > > > > > > > #include "of_private.h" > > > > > > > > @@ -518,6 +519,13 @@ EXPORT_SYMBOL(of_changeset_create_node); > > > > > > > > static void __of_changeset_entry_destroy(struct of_changeset_entry= *ce) > > > > { > > > > + /* > > > > + * device links drop their device references (and hence their > > > > of_node > > > > + * references) asynchronously on a dedicated workqueue. Hence we > > > > need > > > > + * to flush it to make sure everything is done before doing the > > > > below > > > > + * checks. > > > > + */ > > > > + fwnode_links_flush_queue(); > > > > if (ce->action =3D=3D OF_RECONFIG_ATTACH_NODE && > > > > of_node_check_flag(ce->np, OF_OVERLAY)) { > > > > if (kref_read(&ce->np->kobj.kref) > 1) { > > > > > > > > > > Hi Rob and Frank, > > > > > > Any way you could take a look at this and see if you're ok with the c= hange > > > in the > > > overlay code? > > > > > > On the devlink side , we already got the ok from Rafael. > > > > Didn't Saravana say he was going to look at this? As of yesterday, he's > > also a DT maintainer so deferring to him. > > > > Yeah, I did asked him but I guess he never had the time for it... Saravan= a, > could you please give some feedback on this? I think the most sensible pa= rt is > on the devlink side but I assume this is not going to be merged without a= n ack > from a DT maintainer... Sorry for the delay Nuno. I'll get to this. I promise. This week is a bit b= usy. -Saravana