Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4627825pxb; Tue, 5 Oct 2021 07:08:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy7w2frqUK5eW8UGEQrMV474rOzNlBbcmyJLNvlc4ccz8wgmGXpfa+xYIXBiS4VsK8gxl4 X-Received: by 2002:aa7:96e3:0:b0:44c:83be:19bc with SMTP id i3-20020aa796e3000000b0044c83be19bcmr3024859pfq.37.1633442908320; Tue, 05 Oct 2021 07:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633442908; cv=none; d=google.com; s=arc-20160816; b=YsaG4sA34GaGfdE9hoPvdz3vqyW+u1T8XIOG6V9sOvMNFBsdbs1Agc93s920B9cP2B 7DUXTR02PHEH5Hj8ZMhMQSgIxy62W32xNTGUJvLHCjRquU8I4y+BEqvLvKcWphJhZPRw z4/rNZ3bUb4ghfmrPhSMfMNd+Kw2t6BPBvyKNLWVnmD78qPzkWVcEjY+9r8qwsnPlTp1 tTcSQdh3jGaMp8QzUduCXBi1vyX2uoWQQ1ibf7g5Y2dzjkMRmDWYLhn6aRckQEseaHcQ 4FIotX9DFZe+a97pfph0OxwQa5ubjR3yTXn8Gv1ufF7AJfhwGudKoFetY5DAQ57vQhZq ePbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=VqvpTXzBkK0TeJQ5NfJBE7Up3bi+uOXfzRb6NfJA9+A=; b=vzgG8zEUbt8RS4Bz3PKTIpR7kyEUNwQe/rW++14FyfUj3paOO/r3T5JekqauJ3teDQ bhRJLyNkYteuycuuthbitBE5dlUoyGG8fQ4+uwq1xc2eznJPru/ew94XJoN6WCkXlbyJ 3H2amcvhihDBDhYQ4uILIK5WVvzUhc86NwpQWgFX8RaEmx0AQUbnmevsRgB9rqN0bvAf t91zSuEUwo2DyOY9aFJf0/kcx3zcW5C+tIFw1n7QpYX0pxKyIztbsubMqqls57mnEkGu I1gie5QtO+Dyae7VgwNRjQKzbjhKy/MRCdAYNs/g0rk06FV683G5VWgFaE30CazSj7Sl 5njQ== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si3288558pli.413.2021.10.05.07.08.09; Tue, 05 Oct 2021 07:08:28 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235465AbhJEOG6 (ORCPT + 99 others); Tue, 5 Oct 2021 10:06:58 -0400 Received: from mail-oi1-f173.google.com ([209.85.167.173]:35566 "EHLO mail-oi1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235255AbhJEOGv (ORCPT ); Tue, 5 Oct 2021 10:06:51 -0400 Received: by mail-oi1-f173.google.com with SMTP id n64so26372120oih.2; Tue, 05 Oct 2021 07:05:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VqvpTXzBkK0TeJQ5NfJBE7Up3bi+uOXfzRb6NfJA9+A=; b=0JXY7CKXim6dA9eF6zWi7PMesmYmzAGpWk2yZtYSEWnQY+SMrAsN6PuiVgryA8TIDq 28/31tGdcexTpO2mBY5/Nq0dQYZr2FejfH9BPOw4fAiTZAT05LOv7GyBBqekEgNeOcrM iB32wZ0KUP5ImY8qzBchIQk8up1bd04MtVDRvUbs6Ig7IR2nkROeCydLvI3C/E0Aum3B N7d2sMIUTDg/4b05n+MrJn92UOUJ422AgnFHfdBcKbFbx0pyuYxWwZ73WhH1VRy860Nw HlqI5TFlpeIUgQMoArzUAyjWaJbuhfTnPlZCOCPAOEB+VCHO+PgJUhAnhw4oJS3xcBVd VTsg== X-Gm-Message-State: AOAM530h7Zj0qwQ6JjqH9bUjjzg71CYzy32eNFq6Q6uW8rfH4FcWORH7 KpqL4k3ApzSCJt8NPU/CBBl+Lje7krXdCD9Y8vc= X-Received: by 2002:a05:6808:1816:: with SMTP id bh22mr2607411oib.69.1633442700589; Tue, 05 Oct 2021 07:05:00 -0700 (PDT) MIME-Version: 1.0 References: <20210930121246.22833-2-heikki.krogerus@linux.intel.com> <20210930150402.GA877907@bhelgaas> In-Reply-To: From: "Rafael J. Wysocki" Date: Tue, 5 Oct 2021 16:04:48 +0200 Message-ID: Subject: Re: [PATCH v2 1/2] PCI: Convert to device_create_managed_software_node() To: Heikki Krogerus Cc: Bjorn Helgaas , Greg Kroah-Hartman , "Rafael J. Wysocki" , Bjorn Helgaas , Andy Shevchenko , Zhangfei Gao , Linux Kernel Mailing List , Linux PCI Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 1, 2021 at 12:36 PM Heikki Krogerus wrote: > > 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. So I'm expecting a v3 of this.