Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3172750lqp; Tue, 26 Mar 2024 01:21:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZ1c87UfWEGDo0Rcfggh33NgZZYqTqbk5yF8qxK8NiW2oH6YzMN5O6HoIGC6gnPjfWwc0zDK5NnAY8XQxSx9WX4jZn3hydfaxcjalZmQ== X-Google-Smtp-Source: AGHT+IESioMl3d5MZFSEtFL7aI5b5u8hIiagHRozKlyv3i5/nxLS2pLRYqcMVSnExfevvnc6h9/d X-Received: by 2002:a05:6a00:21d2:b0:6e6:8df5:f77a with SMTP id t18-20020a056a0021d200b006e68df5f77amr487852pfj.31.1711441271890; Tue, 26 Mar 2024 01:21:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711441271; cv=pass; d=google.com; s=arc-20160816; b=j+46q/bMJ0TrowOAF0Rta0J2H2pD2xQmiYnHa+fcFbMNXcImswUS+8z7yFiSk5HaWW 4dVFyomd+9czyudyig97exeo0h9uxasjOm1VjWrR9UmoMA3MUI5a2XIfWnH7o4xS/704 f530cnWgzt/cIsyvq/IAFkDFEfmNw7t64cpfdAeeYw8yqbqgVeRVsakZaJ2Vg4lnGPz3 4ggxm2HUGmRr1ZSJQJ4+osSD4M/7jlluBgyQodHCLWtFNdAi1dBkA7XzswcRaFjBE82o OrsAE5xwG/OCARXl+2mxHohXCGNO7pXHCgiPyhVTTJKbsH5oZ+2WBK7903r8LUUBGruc DRjg== 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=bcDxJPH+jBF2yTlyHqOtokioanUMp6yTQqlMmLvi60o=; fh=obHShdzzrStz6MLBytkn6qK0yp50XiR7K7FW873R+Ho=; b=ksQ8YuJRCfPFIJqyJJLBH9GNh5AG96UjrVGraCZ7VtKYvySHGSrtmFyBBTUQKafntT lcpKDycJeJ/WpSSD990BPWnbvgcizCUpTTHc4klxWPYLG+iby9K88iOe2aWBpVA+CJxw M6xRk9A1/19aDngTBjCMB08Z6aWkmRg0MMxjv2Utcg3RU7JyqAn652rqWwwCI5pc9Vb8 XT3WFWpQtSSg+msy+P9E1q+GFVSTqdMOk/+h4U9MproxfuCZQLdVe51LjeLsGs5XfVSQ bc4zTP/c3k0k7D6PLIAUlo6nQSJ4f5+Zy06zRBV1nT1k1xmeEa3EODG5Bin7+xDtQmYO SOcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LDm8XQaP; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-118527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118527-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d33-20020a631d21000000b005dc85b86649si9051898pgd.686.2024.03.26.01.21.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 01:21:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LDm8XQaP; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-118527-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118527-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D15C6B21F35 for ; Tue, 26 Mar 2024 08:21:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 122011339A6; Tue, 26 Mar 2024 08:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LDm8XQaP" 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 F272E21A0D; Tue, 26 Mar 2024 08:20:51 +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=1711441252; cv=none; b=TgduVlkDqSyhQSUuO5lDmlQug5w96hO3aQ02gk2wNJr9gokLHhXm7L6V9JG4wiIH9SUpmTkUHrtMvCuendjGopJyyFhyu/1P7eNViawh1qPqV1vqZJdbMwDWRf65E8tAB7pv/CApegm9WjWnQpuxfpr1uCXxI/++qZFPx9Cwork= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711441252; c=relaxed/simple; bh=qz9xGWKw9TwZIZmkOtsqi7+FfSavXvo92wFhs8sRnkQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PEZM9m4sE1BCq2lLuaZ0NdqE2Uh1iWGk8j+z6fEK8qEoKxg3l2hyr/uSM1lbK5MATFj4W8EVJr/+4XNyih4RJCQ+f+Nc1VekxRM/Aa0SvjD9Gdw+fVOCLsEff+QHbKgduf7i1siaty9hFwuWrHFCd7pPWr0ZcBB4eYJhuIGbjVU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LDm8XQaP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E82CCC433C7; Tue, 26 Mar 2024 08:20:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711441251; bh=qz9xGWKw9TwZIZmkOtsqi7+FfSavXvo92wFhs8sRnkQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LDm8XQaPKUEiClyhmzcOTtjFSd3byVDHpoMPcmb6vbREBzl7cdpjcrT+vH/U0WQbm LukRcNmEVpHJ0XrmZvUNdLs52U4/MB11/5vIYuawqiNf+jDy9KtUj+wiuFJvpfHLpd Bj2BoKpm9BYgKf/PeoJcvrCq1NF+vBNnXnNmY1Ec= Date: Tue, 26 Mar 2024 09:20:48 +0100 From: Greg Kroah-Hartman To: Rob Herring Cc: Herve Codina , "Rafael J. Wysocki" , 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: <2024032634-suitable-jeeringly-37f2@gregkh> References: <20240325152140.198219-1-herve.codina@bootlin.com> <20240325152140.198219-2-herve.codina@bootlin.com> <20240325164401.GA276583-robh@kernel.org> 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: <20240325164401.GA276583-robh@kernel.org> On Mon, Mar 25, 2024 at 11:44:01AM -0500, Rob Herring 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 > > Signed-off-by: Herve Codina > > Tested-by: Luca Ceresoli > > Reviewed-by: Nuno Sa > > Reviewed-by: Saravana Kannan > > --- > > drivers/base/core.c | 26 +++++++++++++++++++++++--- > > include/linux/device.h | 1 + > > 2 files changed, 24 insertions(+), 3 deletions(-) > > Greg, can you ack and I'll take this series. Looks semi-sane: Acked-by: Greg Kroah-Hartman