From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A238C07E9D for ; Mon, 19 Jul 2021 12:22:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F31D61222 for ; Mon, 19 Jul 2021 12:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236747AbhGSLly (ORCPT ); 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-acpi@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