Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3162528lqp; Tue, 26 Mar 2024 00:56:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTtyJEx1YORFCIH0v2IaH5hAF/mSH6Ccw7sU0bgQdUohSQdHRvwrTBLA0n9pR2Z5t5RSrHrOLJ37dtEFtwuAdLQhYh84iZXCnclwjGyw== X-Google-Smtp-Source: AGHT+IGsG/j96G0A9vBPcH1vzr9lNIIP3UUndHE6B//fZAUmL1wwDhEKGH5OhPrM9iCr85ytYL0g X-Received: by 2002:a50:d49c:0:b0:566:b442:16cf with SMTP id s28-20020a50d49c000000b00566b44216cfmr6873892edi.13.1711439803153; Tue, 26 Mar 2024 00:56:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711439803; cv=pass; d=google.com; s=arc-20160816; b=kyOEKayW3G42obkFZZmPiYUDSyVjeH+jk9XvaedW0EnHCslI3i4FsWju8TpVLfXAj4 +2oKKcu1zWi1SKSPJM2D0pGKGOIMB2U1Jx2VhoboTA7ig076LfQcRxZM/uOWY/XrqNAq wu8uF6W9BBL3IS3gnfB/OhmRXMmJKXXLAuaxMy1VkPzUItSR1LWuphsRY9bwv0XwMsfq rp9gbrA+ejGak06TfsUAApGum7jbiOgp2wGulmq1dI/X5WIYXoh7YqmnbjPM0z/Y7gq1 c6hHqVgm93aECPiBLq2kxIJt/7Dhc5vWA7pP8neBgPmKLTHnG5ChJOIvjT4KyJpWVGf6 GtbQ== 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=q3PckqHmeL8Qlv6PGSssocDsbW2N2t4rB3eMlEpT7SU=; fh=bX+mbKI6Rvceo7OX3C+9bccrFWeaqiE9jHxQ9hto/b0=; b=tCQt0CX9e3R79qbg8YYP33G3SoAk5eD/6wkjh6e/gOi0QHfTerfWpD+dtAKAI4ELNG E0lEWVMBzNBzSdCX1ZaLB+uLWlp4+VEYNWWvyoYPTr6aigqcx8HHrbaZ+UYz1tcwKXId 1nnDbV4qziy/ZHeD/vU2Xq7ixKQ1kgbYk45hvj+z4yVOkyIjzUz49pJRi5tBjOUeELTg Kgyu/efnAOKiZlRrl+hp7VFIc6rU8rtn2LbPXZn+fFt7YX/Bv6Vwrq2wzOKvpdrZca5I Svf/h39y8YIGOvsZTgJ8oDcuV7B9e2iA1rIPlQhlZBt8VbEGIj2Lbk/KDOvis9KIiD7x kHFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=MtRbwoAX; 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-118494-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118494-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s2-20020a056402520200b0056763d0295dsi3290979edd.333.2024.03.26.00.56.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 00:56:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118494-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=@bootlin.com header.s=gm1 header.b=MtRbwoAX; 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-118494-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118494-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 am.mirrors.kernel.org (Postfix) with ESMTPS id DE5EE1F37DC0 for ; Tue, 26 Mar 2024 07:56:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB3951327F7; Tue, 26 Mar 2024 07:56:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="MtRbwoAX" Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 5F8C113281F; Tue, 26 Mar 2024 07:56:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711439786; cv=none; b=rvDiuuaKcnPx/34jIHNVBYGthhRQmUnQ3X07SSHXHkD1bMTGou9JeN5f4MxixMEPp7GTl0MggzXmBe2gTeker2EBEgpjmCWVXIeCnBsfet2MALB2iPcx4GuguEeuJBHenT2NxWEBfFux8yspy3D8lVKQe5DUVz9ShB07kcbVfQk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711439786; c=relaxed/simple; bh=ZhjPFTOQpzOVcd27gwoGXa9xyp/xBd/MZT46RvxTdVM=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gI571iUWbxRr7h0+PZSnHiFdtWaLZWcHVExzEELmE4uQjxErkIunG1n0a5niEFcm13qvcE9l4ffODkcag3qc2/PWoGxRNy774Ez21Qy2wIP25Guu9aeVyZq25tTEoaZ2TvF4zsGK899NXIKSQ0B7GO7t+zlHTtth8b4/X9fIS3o= 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=MtRbwoAX; arc=none smtp.client-ip=217.70.183.196 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 6C092E0009; Tue, 26 Mar 2024 07:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1711439780; 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=q3PckqHmeL8Qlv6PGSssocDsbW2N2t4rB3eMlEpT7SU=; b=MtRbwoAXlKOJXFBo2uw1U3FfF18lh/9Un2QrPY99lbMOggoYxh4YoueN3OlcohCi2Yx0Gt RG3XxXY1xPbGjWLbb+g9yVDEzOT0hE5gbIqOorQx1UtF0HSmgYFpmg59R1SUpD91ifHS+p CxoKnuh6g7K/dpNExERJKrYq/nhKxpupBmWvKB41uSlylTWcNJ9n//izG8ruIcsqBiT5Tt ZZVyosb8aeJp4Beu/PVmJGzJLoHKJGRGHAt11MiG7R15BtQJRRjHUJZm7XoPsntxPuQaZd wCBMkXr3B41DnZdT+XoCjsDFIGsNqqOfI7wzvYDIt0/tA5KGCGwzLafl3w7qvA== Date: Tue, 26 Mar 2024 08:56:17 +0100 From: Herve Codina To: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Saravana Kannan , 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 v6 1/2] driver core: Introduce device_link_wait_removal() Message-ID: <20240326085617.0cf217d3@bootlin.com> In-Reply-To: <2024032548-rope-improper-4f67@gregkh> References: <20240325152140.198219-1-herve.codina@bootlin.com> <20240325152140.198219-2-herve.codina@bootlin.com> <2024032548-rope-improper-4f67@gregkh> 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 Mon, 25 Mar 2024 19:37:10 +0100 Greg Kroah-Hartman wrote: > On Mon, Mar 25, 2024 at 04:21:25PM +0100, Herve Codina wrote: > > The commit 80dd33cf72d1 ("drivers: base: Fix device link removal") > > introduces a workqueue to release the consumer and supplier devices used > > in the devlink. > > In the job queued, devices are release and in turn, when all the > > references to these devices are dropped, the release function of the > > device itself is called. > > > > Nothing is present to provide some synchronisation with this workqueue > > in order to ensure that all ongoing releasing operations are done and > > so, some other operations can be started safely. > > > > For instance, in the following sequence: > > 1) of_platform_depopulate() > > 2) of_overlay_remove() > > > > During the step 1, devices are released and related devlinks are removed > > (jobs pushed in the workqueue). > > During the step 2, OF nodes are destroyed but, without any > > synchronisation with devlink removal jobs, of_overlay_remove() can raise > > warnings related to missing of_node_put(): > > ERROR: memory leak, expected refcount 1 instead of 2 > > > > Indeed, the missing of_node_put() call is going to be done, too late, > > from the workqueue job execution. > > > > Introduce device_link_wait_removal() to offer a way to synchronize > > operations waiting for the end of devlink removals (i.e. end of > > workqueue jobs). > > Also, as a flushing operation is done on the workqueue, the workqueue > > used is moved from a system-wide workqueue to a local one. > > > > Cc: stable@vger.kernel.org > > Why is this for stable? You are just adding a new api, no one is using > it. > > Or if they are, you didn't send me that patch... The patch 2 in this current series uses the new api. Best regards, Hervé