Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2884464lqp; Mon, 25 Mar 2024 11:58:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX6FuqY5W/HURdn9H7he0CAJK+5wIsNMuk/9EbCMzrP4KlfP7hrP/j3kGCnvpnbTgtM1/J/3XnlHsWAr6uhpXigWh+xP5YfVd2SgLgHNg== X-Google-Smtp-Source: AGHT+IGUfBsX10PYBR1FVSPCBrXkTI+fNbqG1ae+XoLu3oBaisAdWFtHQ5SWkAK3uRFihdY+Y6kP X-Received: by 2002:a17:907:944f:b0:a49:56d4:d643 with SMTP id dl15-20020a170907944f00b00a4956d4d643mr3372176ejc.36.1711393115847; Mon, 25 Mar 2024 11:58:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711393115; cv=pass; d=google.com; s=arc-20160816; b=KrNi1/PXF1pE3Y0/dduFxxo9ODn0RoK6O8edCf4oy+oxm6i//2ep8mAjctp/Fn7uDo YTpQKBbJrVCcbK02QvDE6eGsdyG/usvtqAiTjeAT5dnW0VTtQ27/0yyIlfugHBDRokqp rv2r650Jd7UEz3cuIIOCc32/zkGpLuD3p/EPqiXhj3oLw6oe5OfZ2ZH7oktjl/qHi8SS 3mNe8Ps6XJcwGhxoZzFLDqTAY6xRyOoV0/7nPD81dizsP2GkFOFLhn0lG3qMa5FtunWh Z0AmpqiGaFi5YuwERPjkZR/toJNisEx+Xnax/PN6tMD6Nc4//1aoYhEVcfUZGnal6Y2T G7Qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3Eb4NHmnEHOIZVmZ7bgi/A4RykX2B1tdLFkoAWczAMI=; fh=NOh2pqQSOdGnci+2I5QNZYbrta9/RXb7EEXFRoyeq4w=; b=Mhf3vIPmd0tokB7E7QHknMSc0VAkVpJKgM8z9+wFNvG3QmJZLxrvJ+e/bdLQPs0j5a tSCrK263PbgNRqvFIQAaEETVjh5vMO3xp8r7hTD3iRi7nmlysXmD8XlLY9rKAiW4IP8H BtYNorVW52sTMI9tvqIrR+5cReNMPofyjaknMTyyI7cP+ZqD6kKMRNNH13kKxvOOhpy2 0rzkpRECSeBi69r12ISUxmiSyao7/CpWyVC4pjQW5sIu/Niymbd6Yh9O1gzd7y7XmMkB SocTp4+RCg9cd59vXDInbWldwbtBQb07prUuLs200DstSjrtFW5OTSMfP+ofjg6Yq7FI 3PLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eLzT+WEg; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-117725-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117725-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kx17-20020a170907775100b00a43f8d2e0b4si2801017ejc.835.2024.03.25.11.58.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 11:58:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117725-linux.lists.archive=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=@linuxfoundation.org header.s=korg header.b=eLzT+WEg; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-117725-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117725-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org 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 96BAA1FA4EC3 for ; Mon, 25 Mar 2024 18:47:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FC982AD17; Mon, 25 Mar 2024 18:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eLzT+WEg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A80819460; Mon, 25 Mar 2024 18:37:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711391833; cv=none; b=SozFsytfoCRZHzDfljpnpvKKk6DzRWnJZy1mKIMtQ83kwYCpiNhQhaPYlNtUrhKvuqna5t6PK1yRY2upe1JzIFp8Kmj5g6qkpPEwVHAf1uEHuWv/SOE61AOmU7HSPLRiTiox96xcRtYWmiR4GQCVPaViIPaR9/MX1wHHp6J1q1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711391833; c=relaxed/simple; bh=ozLed1RgSofEW/JhzPbh4DFYa4pZ4WP0p3K+tacDuL4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PypFyY3PtOqODSdITABIthncOYPQOtRmwsRoeZ9fLAD+kWPwKxJAq0+OQhdcwttZCdNm2OODCsbK3qMXHXIjvxnV3L9viniK4AP0TrggcAnJPaafyVGQrknC3QDrM75e/ZOU/jMKcUisVNeK86LhMOVW4KYYJRC1Oa7llPSXM0I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eLzT+WEg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6EFEC433F1; Mon, 25 Mar 2024 18:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711391833; bh=ozLed1RgSofEW/JhzPbh4DFYa4pZ4WP0p3K+tacDuL4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eLzT+WEgcFPrHqlwu8yvATEVwVaCuzHiW2benJYKJGo+cuEwq0Ralk2U6j87c8HYi 1i0hVGHlBbV9Qw9OhV8bop+B5MI5+Bt59k1PD8wSS0WHysuKTaulfTZnU51IXcOz1S 32+uNpXoVf8BQGmYU36Yjy2crV2COr/auNTvgQJk= Date: Mon, 25 Mar 2024 19:37:10 +0100 From: Greg Kroah-Hartman To: Herve Codina 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: <2024032548-rope-improper-4f67@gregkh> References: <20240325152140.198219-1-herve.codina@bootlin.com> <20240325152140.198219-2-herve.codina@bootlin.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240325152140.198219-2-herve.codina@bootlin.com> 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... greg k-h