Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp135331ybi; Tue, 2 Jul 2019 17:44:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9lV99jU4wJhS/yJxHc2DW9eFigFbqZzyHDQzD9K6C3hkggNMBC4RHC0+VdJHhbzxl7kAA X-Received: by 2002:a17:90a:ad41:: with SMTP id w1mr8757889pjv.52.1562114655395; Tue, 02 Jul 2019 17:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562114655; cv=none; d=google.com; s=arc-20160816; b=uWc1prMqJ5z4J8FxkuFqPO9gJY/ceiiqxw5W6i0VhLiE1YT2Ox+uZjK55uPNOyvpf1 E/Ednu/UK6pxkv7OCAYbXqcO5udiTOstn4ZNL/RaBxb5YQCm4uF2JozyV6hgvAjXH8Dv def2eOzMNNkdSQxevrKATtPQ81b8W3V23GiuXjqM8ty3WuC4Ohv8m+IYu3IwPLO9Q++D vLI4rWk/D2Hmh3300lB5oTIkKM0IRt7LhcV60TocoxVYOFq4yql+crOZGRPtfdlzPqyL PMalV5/CO1b+QSmYwdSlf/yzZyDlgnfuH0F/8/Uy/LKao/7JI4Vvpl6gl0aIKaw2FfIf oaYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature; bh=gCmLrnIJcz2LAcU1ZDXNEmFJOWVfxhFHWqBqHzE0EXc=; b=et2sjlzB1onJDTaOX6Aaor2TLzwPKVUcBUlsd6Q75JLBES4e/1ofTnAyk3lMoVvh0E ozBwVQcg52QYvirMMpZOoKtanJdRMaCXJlns9taLWnTh3A75wWIxO23M8HAlXzRU4dK5 LQfxKRt4hPfrzVRhgZYKONYf7R59bag2J/zMuwSVdYqOqxz3NYH4v1hU3REbuMMVxxrs FS+LIg3qk4Pxop/QuYjSBbPSf8W4leN4E+QzJ1KK9MF6cqM+iCk3EevLiPLD0mWhkMaD EyYmnYjeUq63H5zzRfHVWwmNePLF8ax4e7gjhdmCcHwTy3vzwEgDsR0avnPD1sA2GsNr shSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=PHnDSrVD; dkim=pass header.i=@codeaurora.org header.s=default header.b=YkMHRIYL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8si182602pji.85.2019.07.02.17.43.59; Tue, 02 Jul 2019 17:44:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=PHnDSrVD; dkim=pass header.i=@codeaurora.org header.s=default header.b=YkMHRIYL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727232AbfGCAmS (ORCPT + 99 others); Tue, 2 Jul 2019 20:42:18 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46206 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726430AbfGCAmS (ORCPT ); Tue, 2 Jul 2019 20:42:18 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8D5D66025A; Wed, 3 Jul 2019 00:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1562112231; bh=Ehzb5REbZ1sAGqR0DY72rQI/Hyw2RX9/t1g57kj00rs=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PHnDSrVDwfgQJgf0I+W+KiUM86AS4rE6Fy2Av270knbxo+bEBYplTz/ZCPQuEe2I4 fNzPDwaSZmBiKo5VrP0sRQRLEYzURkM4UWHUZJhyn8FZwrHSNghuSX7UHfV8XAd558 BbrAULrw8EBM7HOh+AHyh++3rcGV3X4HoXZMpYAc= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from [10.46.160.165] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: collinsd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 257F66025A; Wed, 3 Jul 2019 00:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1562112230; bh=Ehzb5REbZ1sAGqR0DY72rQI/Hyw2RX9/t1g57kj00rs=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=YkMHRIYLA5V46KlIhru4A3fnsbCSkndtSW9zs2Cjaim0N2J64OYjzq8THiO9uc63G pjPnWHJwm0B583nkQzsUveSzVv0Jwe2j5cWQBRKv6eBvXzKhEPU3zEIbNuGVe7J29W 0dOSvKmHAXUZVMS609/mKWBo3oXa1snC9A6dFOjs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 257F66025A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=collinsd@codeaurora.org Subject: Re: [PATCH v3 0/4] Solve postboot supplier cleanup and optimize probe ordering To: Saravana Kannan , Rob Herring , Mark Rutland , Greg Kroah-Hartman , "Rafael J. Wysocki" , Frank Rowand Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com References: <20190702004811.136450-1-saravanak@google.com> From: David Collins Message-ID: <7900c670-5b3a-f950-dec9-70d98d94a84f@codeaurora.org> Date: Tue, 2 Jul 2019 17:03:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190702004811.136450-1-saravanak@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Saravana, On 7/1/19 5:48 PM, Saravana Kannan wrote: ... > TODO: > - For the case of consumer child sub-nodes being added by a parent > device after late_initcall_sync we might be able to address that by > recursively parsing all child nodes and adding all their suppliers as > suppliers of the parent node too. The parent probe will add the > children before its probe is completed and that will prevent the > supplier's sync_state from being executed before the children are > probed. > > But I'll write that part once I see how this series is received. I don't think that this scheme will work in all cases. It can also lead to probing deadlock. Here is an example: Three DT devices (top level A with subnodes B and C): /A /A/B /A/C C is a consumer of B. When device A is created, a search of its subnodes will find the link from C to B. Since device B hasn't been created yet, of_link_to_suppliers() will fail and add A to the wait_for_suppliers list. This will cause the probe of A to fail with -EPROBE_DEFER (thanks to the check in device_links_check_suppliers()). As a result device B will not be created and device A will never probe. You could try to resolve this situation by detecting the cycle and *not* adding A to the wait_for_suppliers list. However, that would get us back to the problem we had before. A would be allowed to probe which would then result in devices being added for B and C. If the device for B is added before C, then it would be allowed to immediately probe and (assuming this all takes place after late_initcall_sync thanks to modules) its sync_state() callback would be called since no consumer devices are linked to B. Please note that to change this example from theoretical to practical, replace "A" with apps_rsc, "B" with pmi8998-rpmh-regulators, and "C" with pm8998-rpmh-regulators in [1]. Take care, David [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/sdm845-mtp.dts?h=v5.2-rc7#n55 -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project