Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp333206lqb; Thu, 29 Feb 2024 02:14:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXhiExTVj/v8iCLcJqyWxVqXyaGYYjMYsF6gVFAhg5x6YD0I4ojubIBuskkvkTHRVIOs21ACnkymaxpuvGKvdQxjSxTVfN96T/EHxO7FA== X-Google-Smtp-Source: AGHT+IGq88qzoW0hs1lCmo/DSHpzRhtJHDDIsQbGDrKkYPnXwvPgM7+DgLq5AcH5zpzex0KEP9Ee X-Received: by 2002:a05:6871:4e42:b0:21f:6be5:fc57 with SMTP id uj2-20020a0568714e4200b0021f6be5fc57mr1569858oab.8.1709201685482; Thu, 29 Feb 2024 02:14:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709201685; cv=pass; d=google.com; s=arc-20160816; b=ub5eQvBNt2v18nWpH0GFC8Mz29l3o9VbJKwyz2ZGhqRv5yFLvHVZTa8jpSok6Cq2+Q jFEWRMfD3dHICqzYWNUxiL2QpVt/b1M6dVHhVWb8Fs6kGHW3cefC950NRl0wDHp7B+M9 UcWJyG/Ouj6Ht8vxwzhzgzNprzzVRJxeqLEzfHWQtBYSWz+zNbeXHaV1w17t9t61sOio njXe6rhD+O16Xz3IjoTi7GeT/AZNOLyWKLCjriJThbBZoca5Czc1UNF3xmQvtAP7gBTq j21d3JSA0txnJbbRkGGBGYcJGmGRTVQKhZVURP+Eu34V2dWABr9WjTqlPJsXAiJIxiuG 6+Rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=C0Qg6WyRbahfjflhKo2Gr2gpsraYYAk4H6zxz/KiuF4=; fh=xuf1gEU11SMYZRh9qL1tzMAATbnZj2AJpKLIzSFvZSI=; b=elF1l6ndipSNVS9shCdqluU4gR9qx8frQfck1NFKRJ3fG/+9kyiiJ8+eRmteAc1wRZ DQbwOg6OXvL42msCcRVC8weOW58rPUIUP2tsYqWKJpM3iYfyS8AFIcRSgZeKYz2gZPzo 62kLVCv6UOzqc3A3PigMilCIV/GMCriMiT4d6toofzvqPcozQcnO7RVdbekWF54Ktx9C HqEDIXXqo8bC60edmwJ6isYI0gwYqwmF4sxepIsbea6z2kCh8WObDUEr0xd/MWsG7lex OF7obKcbWVyEd3GoxQVhny4goq7DmikfP1i7Ly7jhVm8d+m4rnMUsL9SY5GbA8Xk3v1l D/Nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VfMcgvOY; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-86528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86528-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 35-20020a631063000000b005dc432da142si1081075pgq.479.2024.02.29.02.14.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 02:14:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VfMcgvOY; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-86528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86528-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 25BB22889DB for ; Thu, 29 Feb 2024 10:14:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EC1863CB5; Thu, 29 Feb 2024 10:14:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VfMcgvOY" Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70A8561665; Thu, 29 Feb 2024 10:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709201678; cv=none; b=mIjw7BO0haAUkmmQKNtzRrbyetlUPn+6v53P2bVxKLDGwz48YLojqKueoYJjoTB2H4KU36lWRnRgxIAZR2+iYaeHb2HToBjdiLQ557/0+laTl4JVXNtvNB0LkHpMDOGart23mM2IdYsn1Y6ho6l/pzc1YwRJPhuFgSLZqPq14RY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709201678; c=relaxed/simple; bh=N/24cYqXozyOmOacjrNVgBVLbi7RWjtfqxIR2O+6Iwo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MjrHgqcIYTMhyFtgGvPAdiXsg3pu7xuZTPT/DThBkYQ0IpmtjeHlHpNdJgpEr5LiRPq3YlQ/GCrJrvExfzSc0HV2jocFrgHcik+9BIX6VA+b9mXUUDADFyLQMjmIYzOxy4lxBhkcMyB8AW9des7PgiTxrdz50M3psYuAmiFcEZQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=VfMcgvOY; arc=none smtp.client-ip=217.70.183.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 5DB2560003; Thu, 29 Feb 2024 10:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709201672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C0Qg6WyRbahfjflhKo2Gr2gpsraYYAk4H6zxz/KiuF4=; b=VfMcgvOYZaY3xiZssK0Ck2+vdea62Zr400HIkIteqKIYTIRamm8Zvb10WEdn2HzGqKyKWA Qwi8tGsWypDoW2NX3GhWDwZMWjL/Cs3i9Qstgn/uqL3eWSGK7DjyXxrbG2uQ7dzQOYElY4 1KxFQhAG4KV+gtNB0L9AbZIS7MUbRNxGiEqJNPho10KN03/G5YP+1OTVThJevOSIaho6S9 DFeEJ16VUBD31OPV7yhA2eoEpU7N3zv82Xkbcgy59sY9BGxYoWsfOb90tIHmC99PUX/9k3 atBqJDpQeo1BBaZs5UEArjBtpCCNoHfD2m1tTH08qRs1/MQJh2ATSKFzA6k58A== Date: Thu, 29 Feb 2024 11:14:30 +0100 From: Herve Codina To: Nuno =?UTF-8?B?U8Oh?= Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Lizhi Hou , Max Zhen , Sonal Santan , Stefano Stabellini , Jonathan Cameron , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Luca Ceresoli , Nuno Sa , Thomas Petazzoni , stable@vger.kernel.org Subject: Re: [PATCH v2 2/2] of: overlay: Synchronize of_overlay_remove() with the devlink removals Message-ID: <20240229111430.54bdb6b1@bootlin.com> In-Reply-To: References: <20240229083953.607569-1-herve.codina@bootlin.com> <20240229083953.607569-3-herve.codina@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com On Thu, 29 Feb 2024 10:50:21 +0100 Nuno Sá wrote: > On Thu, 2024-02-29 at 09:39 +0100, Herve Codina wrote: > > In the following sequence: > >   1) of_platform_depopulate() > >   2) of_overlay_remove() > > > > During the step 1, devices are destroyed and devlinks are removed. > > During the step 2, OF nodes are destroyed but > > __of_changeset_entry_destroy() can raise warnings related to missing > > of_node_put(): > >   ERROR: memory leak, expected refcount 1 instead of 2 ... > > > > Indeed, during the devlink removals performed at step 1, the removal > > itself releasing the device (and the attached of_node) is done by a job > > queued in a workqueue and so, it is done asynchronously with respect to > > function calls. > > When the warning is present, of_node_put() will be called but wrongly > > too late from the workqueue job. > > > > In order to be sure that any ongoing devlink removals are done before > > the of_node destruction, synchronize the of_overlay_remove() with the > > devlink removals. > > > > Fixes: 80dd33cf72d1 ("drivers: base: Fix device link removal") > > Cc: stable@vger.kernel.org > > Signed-off-by: Herve Codina > > --- > >  drivers/of/overlay.c | 9 ++++++++- > >  1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c > > index 2ae7e9d24a64..99659ae9fb28 100644 > > --- a/drivers/of/overlay.c > > +++ b/drivers/of/overlay.c > > In the cover, you mention device.h inclusion but I'm not seeing it? This is > clearly up to the DT maintainers to decide but, IMHO, I would very much prefer > to see fwnode.h included in here rather than directly device.h (so yeah, > renaming the function to fwnode_*). But yeah, I might be biased by own series :) > Damned. I missed device.h in this patch. Without this one, the patch do not compile :( A fixup commit I missed to squash before sending. A v3 is planned to add this device.h. Nuno, do you prefer I wait few days before sending this v3 waiting for more replies or I send it right now and you re-do your comment on the v3 ? I would really prefer to send it now :) Sorry about my mistake. Best regards, Hervé -- Hervé Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com