Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3641075pxv; Mon, 19 Jul 2021 05:24:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCrA6E5mY2nvwAIQDe4QkdL/30BlHgWgOfCsgt38m9E/Jr9Q2hXgHfR5FgJx5MVWBlZw1+ X-Received: by 2002:a92:d8d1:: with SMTP id l17mr16526607ilo.187.1626697489397; Mon, 19 Jul 2021 05:24:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626697489; cv=none; d=google.com; s=arc-20160816; b=NF5b3CscHsHqPoWLo8sqsvJfhaLxnaCaULhPTqa16hrA+Pp6LP8nx++rHjFG+W+Z9c kvdVY1gafd1EtnHmkfREFfnvmgIdpIccEIm9iYu31iXhttdhJ+KybEuETXcHm+/XGEOV rzz7nVYP+zY8m2Ep4X+TN5wUIeCMXTX/pyhEpI1FO64eiAFqQonur2D7IMgTJ+JwBnV0 t/MjHyWR9Pild1eSh6zaJZGsJC4Qj1kPJzPDTyeAYmyg/HRMN73W/Xfs/3r6Mc+i2p0r 9vxuYWxGUQeS9tunWn+2ouh2naKYVcQvBFfPWwvGU05njTHtLOd78Jxoz25P/RIGtJiZ OeVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=y58L6v7Lv4vnO2J9641zFE2TXbCjrNs36hcEd9hRYW0=; b=KYvTVSPf92ITS9eav7O1YXwJD5ma/1z6+Sao38Hha2veovPIe9G+FucZ8sRqWYo+XH ucp0m8w6ZW6MlUbgUyxHJJtp2vQXnT1l2Dtv0NilyUmiUyMU1wkAACnTbPauRtiuGkHU q/gwgSUz6FrAzlnvoBLGIfl7NgIT8frrlckLhLUx+LGB190M2iBqmwVreZwxo6rKojze DnpGOt1qG7BBmfWGpYk7R8FIcdysd186xxg4wPsu6rXnuW/FjCBuHSvsaEPXC3bIY6W9 mbcIUuY6DGZyPWOleZg5C1VWpeu1F2gatjj+bKEHHj2ahweUCSlt957cYA9gIycb1J1K Lkww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r4si11997423ilb.105.2021.07.19.05.24.37; Mon, 19 Jul 2021 05:24:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236915AbhGSLly (ORCPT + 99 others); Mon, 19 Jul 2021 07:41:54 -0400 Received: from mga09.intel.com ([134.134.136.24]:19753 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236918AbhGSLlv (ORCPT ); Mon, 19 Jul 2021 07:41:51 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10049"; a="211042056" X-IronPort-AV: E=Sophos;i="5.84,252,1620716400"; d="scan'208";a="211042056" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 05:22:31 -0700 X-IronPort-AV: E=Sophos;i="5.84,252,1620716400"; d="scan'208";a="430831674" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 05:22:29 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1m5SHu-00FVcR-V4; Mon, 19 Jul 2021 15:22:22 +0300 Date: Mon, 19 Jul 2021 15:22:22 +0300 From: Andy Shevchenko To: Laurentiu Tudor Cc: Jon Nettleton , Heikki Krogerus , Greg Kroah-Hartman , "Rafael J . Wysocki" , ACPI Devel Maling List , Linux Kernel Mailing List Subject: Re: [PATCH] software node: balance refcount for managed sw nodes Message-ID: References: <20210716101602.1891-1-laurentiu.tudor@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 19, 2021 at 03:00:17PM +0300, Laurentiu Tudor wrote: > On 7/16/2021 8:21 PM, Jon Nettleton wrote: > > On Fri, Jul 16, 2021 at 2:17 PM Andy Shevchenko > > wrote: > >> > >> On Fri, Jul 16, 2021 at 01:16:02PM +0300, laurentiu.tudor@nxp.com wrote: > >>> From: Laurentiu Tudor > >>> > >>> software_node_notify(), on KOBJ_REMOVE drops the refcount twice on managed > >>> software nodes, thus leading to underflow errors. Balance the refcount by > >>> bumping it in the device_create_managed_software_node() function. > >>> > >>> The error [1] was encountered after adding a .shutdown() op to our > >>> fsl-mc-bus driver. > >> > >> Looking into the history of adding ->shutdown() to dwc3 driver (it got reverted > >> later on), I can tell that probably something is wrong in the ->shutdown() > >> method itself. > > > > Isn't the other alternative to just remove the second kobject_put from > > KOBJ_REMOVE ? > > > > Or maybe on top of Heikki's suggestion, replace the calls to > sysfs_create_link() from KOBJ_ADD with sysfs_create_link_nowarn()? _noearn will hide the problem. It was there, it was removed from there. Perhaps we have to understand the root cause better (some specific flow?). Any insight from you on the flow when the issue appears? I.o.w. what happened on the big picture that we got into the warning you see? -- With Best Regards, Andy Shevchenko