Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1182433pxb; Fri, 1 Oct 2021 05:27:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd0MW3Z7Tp94/abKGq8QV2F8PQGXwXYRMH0Wp7Cmy1sTKniR9QtEraS65eysyXOaN5roea X-Received: by 2002:a05:6402:410:: with SMTP id q16mr10004016edv.286.1633091267497; Fri, 01 Oct 2021 05:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633091267; cv=none; d=google.com; s=arc-20160816; b=d83mLNYBS+wz54/jEa1pHf9NMdyzX5XJKBJkJcTRleMD6Yt3tlOcs4JtEcUjSSf812 ZZeRo41gIpnGH9XFCPK317gxsBlf3+DoTW9tMACxziJ6mwGs++jDZrNZ9xOnXa87lOFo +GuU4eaz+2YH99rD7sUruz97sn6a7VZknAa8bHckUQtAx72m8KwaNYKdh+IyxubQrqy9 Y4IY+iq0Gtu0GyIqZV5KqYpJu/KCix5oJ0LyLegLs43XcWcQak+7qpv/9GKqlr/+bUL3 7KFr1lZoHnvjXEk6ywpS0ELMkmOwxpfZK37rrPVUeUDCi7jXi4ov2iINRG8agqGoEqHQ Lj0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=UnnSwFcQC5j7q7/GcbP+cl8c3kJhUzwoFn1/JxdckBo=; b=UxhHSWFvrovBn98+9AQzpnPefzaOZPWDQmp7mRin5omxZonNd7EOduU1o5Jorlrd5W gL9TmCajdAV5Ljq89daszlydgnN9xov5vkerQ/4ttc750tEsYszv5tbK3kOHqccdN9tm 9d4G4Gmd9ZFAdwNQ9krr/2nVwDKrJ5e2wV9iF6e2IBl9fUaZiArg4HuN6KgTU+D7nwyH 49CRG/RbaFNPGm4uA/KJGNGhKckKQgSCEvYLQ+p4ifVzAvkI6x3kbRQf6uF/FsK9QM+m L7nr9Zszr1gOPaKwvY7M8KCRkWXhutQU/SXAy96+PTr27th7lA1fOi5M7IMoINrLkHPZ CoBg== 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 15si7837900ejg.670.2021.10.01.05.27.21; Fri, 01 Oct 2021 05:27:47 -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 S1352624AbhJAKic (ORCPT + 99 others); Fri, 1 Oct 2021 06:38:32 -0400 Received: from mga14.intel.com ([192.55.52.115]:37232 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbhJAKib (ORCPT ); Fri, 1 Oct 2021 06:38:31 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10123"; a="225053546" X-IronPort-AV: E=Sophos;i="5.85,337,1624345200"; d="scan'208";a="225053546" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2021 03:36:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,337,1624345200"; d="scan'208";a="619007355" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 01 Oct 2021 03:36:44 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 01 Oct 2021 13:36:43 +0300 Date: Fri, 1 Oct 2021 13:36:43 +0300 From: Heikki Krogerus To: Bjorn Helgaas Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Bjorn Helgaas , Andy Shevchenko , Zhangfei Gao , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v2 1/2] PCI: Convert to device_create_managed_software_node() Message-ID: References: <20210930121246.22833-2-heikki.krogerus@linux.intel.com> <20210930150402.GA877907@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210930150402.GA877907@bhelgaas> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 10:04:02AM -0500, Bjorn Helgaas wrote: > On Thu, Sep 30, 2021 at 03:12:45PM +0300, Heikki Krogerus wrote: > > In quirk_huawei_pcie_sva(), use device_create_managed_software_node() > > instead of device_add_properties() to set the "dma-can-stall" > > property. > > > > Reviewed-by: Andy Shevchenko > > Acked-by: Zhangfei Gao > > Signed-off-by: Heikki Krogerus > > --- > > Hi, > > > > The commit message now says what Bjorn requested, except I left out > > the claim that the patch fixes a lifetime issue. > > Thanks. > > The commit log should help reviewers determine whether the change is > safe and necessary. So far it doesn't have any hints along that line. > > Comparing device_add_properties() [1] and > device_create_managed_software_node() [2], the only difference in this > case is that the latter sets "swnode->managed = true". The function > comment says "managed" means the lifetime of the swnode is tied to the > lifetime of dev, hence my question about a lifetime issue. > > I can see that one reason for this change is to remove the last caller > of device_add_properties(), so device_add_properties() itself can be > removed. That's a good reason for wanting to do it, and the commit > log could mention it. Fair enough. I need to explain the why as well as the what. I'll improve the commit message, but just to be clear, the goal is actually not to get rid of device_add_properties(). It is removed in the second patch together with device_remove_properties() because there are simply no more users for that API. > But it doesn't help me figure out whether it's safe. For that, > I need to know the effect of setting "managed = true". Obviously > it means *something*, but I don't know what. It looks like the only > test is in software_node_notify(): > > device_del > device_platform_notify_remove > software_node_notify_remove > sysfs_remove_link(dev_name) > sysfs_remove_link("software_node") > if (swnode->managed) <-- > set_secondary_fwnode(dev, NULL) > kobject_put(&swnode->kobj) > device_remove_properties > if (is_software_node()) > fwnode_remove_software_node > kobject_put(&swnode->kobj) > set_secondary_fwnode(dev, NULL) > > I'm not sure what's going on here; it looks like some redundancy with > multiple calls of kobject_put() and set_secondary_fwnode(). Maybe you > are in the process of removing device_remove_properties() as well as > device_add_properties()? It'll get removed, but that's not the goal. The goal is to get rid of the call to it in device_del(), so not the function itself. That call is the problem here as explained in commit 151f6ff78cdf ("software node: Provide replacement for device_add_properties()"). I'll split the second patch, and first only remove that device_remove_properties() call from device_del(), and only after that remove the functions themselves. thanks, -- heikki