Received: by 10.223.185.116 with SMTP id b49csp3465985wrg; Sun, 25 Feb 2018 23:53:37 -0800 (PST) X-Google-Smtp-Source: AH8x227KTwJ3ylAdjPOm/+5LRnd1B5F16V2ICxE9U7pspJi4jKSG/h4Je4rFuKrVcVpZimOUpZfF X-Received: by 10.98.157.199 with SMTP id a68mr9761338pfk.59.1519631617043; Sun, 25 Feb 2018 23:53:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519631616; cv=none; d=google.com; s=arc-20160816; b=y4JVv/JTYpmbl9m/xfwy2yHN8lwhFH+ZnQOcMEtv+r4TTkyyAZIii8ct+z7O6fOXTr NzdXfeQpIwepUFuu13E76lED6XD53Dp7mcy1UjFJ0p0WbNB2JG5stF1d6tvk6nWH6V6H HYtmIga++bjooOJ3rExm3n9BOl0o1tbjtjkyNjUJiDmPE1EWqYf+ZKHE0kzCy4/6i3qv q+5/lyEa+92EXQQEL8dPrlUO5IfZxQYbdnZU12GEat7W31kZduE90KqGQAoSL+pDZIq+ iPrJ3Y0JzVATUErahAmIkLJFZZJy7kMBxldKs46+RQ3y1MZI6Ew5Qv8q00dlYDu5nFCh 8axg== 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:dkim-signature :arc-authentication-results; bh=4JkTMgaxLW7ZH4/w/Etm7+SPMjEnPBns9+hZaD0Av1g=; b=vEKpja85nFLIO7lEWM8w8+94AVzXF27fSnPaD4lDk6o71tJGdVe6JfI+uTmDIj7bdy 8j/vN3ZEQZZAcMrLEnaC5IlkwA+pRpui93yYsCIZq2zOK1NhGWBpSNkNUzKS4dX20/Q/ +WLm5n2nOkUaTcKwIjRWNQf2ZonkHzZIhqGRagFzywpY1XzPAS7qtBy18Y5LC682MGCk DYwie5JrzQ6Ct1AgYm/v7B4m6pqzPcPNKt1CL3H8IPl2Fw+/BhNEWhSIo89OfEFKHrC0 2GIbgtJ5IIABvfQtanX/WQYB2qQ0MbTdgyVkajPNCt0I2NsIsHlXuilRcX9dUifrGXVd k+Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=WbwRy6Nm; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20si6342239pfp.312.2018.02.25.23.53.22; Sun, 25 Feb 2018 23:53:36 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=WbwRy6Nm; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752172AbeBZHwe (ORCPT + 99 others); Mon, 26 Feb 2018 02:52:34 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:26722 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbeBZHwd (ORCPT ); Mon, 26 Feb 2018 02:52:33 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1Q7qSah009227; Mon, 26 Feb 2018 01:52:28 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519631548; bh=g62x9s/8sgrCmRnuMGt5QO4g60v9G/8PVxvC8qNKLlM=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=WbwRy6Nm3fcOCEkV497c4kk37yso5p1W+IoIhN+K2nfa706DdTiWHMTLzZzRI5MPw ry6e/wXivhMWQtsnYAYiaPJRUY9xH4mXBGMd8b17I4ix7FuUt5nQxQbciun5WMEkyo 05NhIgB2o+zHTk55ZWsPvxQnXMKoQEMCu1E+euMk= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1Q7qSQ5014953; Mon, 26 Feb 2018 01:52:28 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 26 Feb 2018 01:52:27 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 26 Feb 2018 01:52:27 -0600 Received: from [10.1.3.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1Q7qPL5029408; Mon, 26 Feb 2018 01:52:26 -0600 Subject: Re: [PATCH RFC] driver core: Reprobe consumer if it was unbound by dropped device_link To: Lukas Wunner CC: , , , , , "Rafael J . Wysocki" References: <57c1d52a5a8f5985dc1dd53260d7d68795be8ea2.1519321145.git.jsarha@ti.com> <20180225092223.GB923@wunner.de> From: Jyri Sarha Message-ID: <36c24c0e-59a1-12de-cfff-01c942862349@ti.com> Date: Mon, 26 Feb 2018 09:52:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180225092223.GB923@wunner.de> Content-Type: text/plain; charset="utf-8" Content-Language: en-GB Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/02/18 11:22, Lukas Wunner wrote: > On Thu, Feb 22, 2018 at 07:42:46PM +0200, Jyri Sarha wrote: >> Put consumer device to deferred probe list if it is unbound due to a >> dropped link to a supplier. >> >> When a device link supplier is unbound (either manually or because one >> of its own suppliers was unbound), its consumers are unbound as >> well. Currently if the supplier binds again after this the consumer >> does not automatically probe again. With this patch it does. > > Yes I think this makes sense, based on the rationale that the consumer > was automatically unbound, so by symmetry it should also be automatically > rebound. > > The only thing I don't understand is you wrote in an earlier e-mail of a > difference in behavior depending on whether driver_deferred_probe_add() > is called before or after device_release_driver_internal(). > That's really odd, it shouldn't make a difference. > In that version there was a couple of other bugs elsewhere in the system. I tried to reproduce that situation again multiple times, but I could not (even write those bugs back in there, and move the link creation back to panel bridge code). But even from reading the code that difference did not make any sense. I suspect a heisen-bug, after I have read the code and understood that the crash is not possible, it does not happen anymore :). With the current version I could not find any difference in behaviour depending on the order of device_release_driver_internal() and driver_deferred_probe_add() calls. I just thought having them in this order just lookes nicer. I stress tested the code by unloading and loading the panel driver in a tight loop, for several minutes, but it simply wont crash (not in this setup anyway). The probe of tilcdc eventually gracefully fails in a CMA failure. Best regards, Jyri > Thanks, > > Lukas > >> >> If this patch is not acceptable as such, how about adding this >> behavior behind a new device link flag? >> >> The idea to this patch was gotten from this post by Lucas Wunner: >> https://www.spinics.net/lists/dri-devel/msg166318.html >> >> Part of the code and the description is borrowed from him. >> >> cc: Lukas Wunner >> cc: Rafael J. Wysocki >> cc: Thierry Reding >> Signed-off-by: Jyri Sarha >> --- >> drivers/base/base.h | 1 + >> drivers/base/core.c | 2 ++ >> drivers/base/dd.c | 2 +- >> 3 files changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/base/base.h b/drivers/base/base.h >> index d800de6..39370eb 100644 >> --- a/drivers/base/base.h >> +++ b/drivers/base/base.h >> @@ -114,6 +114,7 @@ extern void device_release_driver_internal(struct device *dev, >> >> extern void driver_detach(struct device_driver *drv); >> extern int driver_probe_device(struct device_driver *drv, struct device *dev); >> +extern void driver_deferred_probe_add(struct device *dev); >> extern void driver_deferred_probe_del(struct device *dev); >> static inline int driver_match_device(struct device_driver *drv, >> struct device *dev) >> diff --git a/drivers/base/core.c b/drivers/base/core.c >> index b2261f9..0964ed5 100644 >> --- a/drivers/base/core.c >> +++ b/drivers/base/core.c >> @@ -570,6 +570,8 @@ void device_links_unbind_consumers(struct device *dev) >> >> device_release_driver_internal(consumer, NULL, >> consumer->parent); >> + driver_deferred_probe_add(consumer); >> + >> put_device(consumer); >> goto start; >> } >> diff --git a/drivers/base/dd.c b/drivers/base/dd.c >> index de6fd09..846ae78 100644 >> --- a/drivers/base/dd.c >> +++ b/drivers/base/dd.c >> @@ -140,7 +140,7 @@ static void deferred_probe_work_func(struct work_struct *work) >> } >> static DECLARE_WORK(deferred_probe_work, deferred_probe_work_func); >> >> -static void driver_deferred_probe_add(struct device *dev) >> +void driver_deferred_probe_add(struct device *dev) >> { >> mutex_lock(&deferred_probe_mutex); >> if (list_empty(&dev->p->deferred_probe)) { -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki