Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp928164imu; Thu, 20 Dec 2018 07:30:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/VZPH6WmJotoio7tPsTBkIx1TS2Ph8SH63+wtnOnzWhTzQoEX9rMBt7NfqbuIsRyUEkjHpJ X-Received: by 2002:a17:902:584:: with SMTP id f4mr25335524plf.28.1545319805710; Thu, 20 Dec 2018 07:30:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545319805; cv=none; d=google.com; s=arc-20160816; b=HsNPJ9h/TpGaGuag1q2XfNoUJiAFqMAyTaBZmUA1VyBsMQESbUm/QuS1vAG7D6i7L2 83p/6111M67hH60xajsVwUwLd51Hv1Hzv3eb0vZJLsy318klwSNt2yb6IQfk2QXFSGAA xPzIUnXqDAIsFUh7T3j1bhcOCW3zKwnNz39w5Gdpinfb68fJ8vsPzaR/m4lEfhWUe/g7 6sdLbHmLJYFKZ4N/h88JWX+akDMj0ZB/VZWAcgpRWMEX43d7FWkmqrkIJOTTytR5dgXo Gva4Zsp79IxxCaxJ71iYrYYVOt45vqmfHfS66jDfHa4wjniV9DHWfAPr1thZ/UjQPgZj Bj2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=XMiM3DmsMK0uFSxzcXJQU11KHsnWS6JqEHwvsWPRKNM=; b=AVkT3WqzCZn4AIjuUEM9fWDomtTtTrCdkPvfm+TV66Uy9OB0Dil4Lho1dkv/uWT+C8 SxIpomHEHYZ/YqXMtewWInZno3j5JapfRbp7UxE3BUfVLHlB33yH77wQKyE5hM/FNayW 4AAbeg0q3E1ZOrtxfvTMQit6qoEv++e3zcqs30sJH6MhnbMIlWWQi4D7VSmSZBaQ1Ynv NclU7CmJkofZ8UKy1sdlBhePwrX7ZoLUcUQYSBtCDK1GKPD1uGUnF4jesYnWGTUj9p0D lD4+zpZo0yMDN7Z5PNRMgldcoX8qA7poHR9KzcHBrUrWOkiir69uh2Fjx0/SA9LNMdCN FM+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=nW4gTURC; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c191si2488127pfg.72.2018.12.20.07.29.50; Thu, 20 Dec 2018 07:30:05 -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=@samsung.com header.s=mail20170921 header.b=nW4gTURC; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731136AbeLTLv7 (ORCPT + 99 others); Thu, 20 Dec 2018 06:51:59 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:52664 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730616AbeLTLv7 (ORCPT ); Thu, 20 Dec 2018 06:51:59 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20181220115156euoutp01149a1215657e2ccefe72036ef637d127~yCEWOdfni0127401274euoutp01N for ; Thu, 20 Dec 2018 11:51:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20181220115156euoutp01149a1215657e2ccefe72036ef637d127~yCEWOdfni0127401274euoutp01N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1545306717; bh=XMiM3DmsMK0uFSxzcXJQU11KHsnWS6JqEHwvsWPRKNM=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=nW4gTURCAd4L9AkSupTG5vGT94r93JbkAAQpjcCKXKLNKBgkuHKhTagScG50HX1Pi 7ySzezR6IaFjgnk7/jNNsG7HM9AhbV6821oJdH0xK34gQFHo4tEX5oLYx67lf7IyOA hnHvpbDbRCegwA8MxjWTJXkMlkhc6iWyHTKlB7Ww= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181220115155eucas1p2c4bda5e566f5251e1aa74d4cfc58ed52~yCEU9Vgci2780027800eucas1p28; Thu, 20 Dec 2018 11:51:55 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 67.98.04441.B528B1C5; Thu, 20 Dec 2018 11:51:55 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20181220115154eucas1p1c40cf8ec2ff9192dd06a5bef9133333c~yCEUEBej22888628886eucas1p1Q; Thu, 20 Dec 2018 11:51:54 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20181220115154eusmtrp26fa016ad3368b24869c6afd3ced3ab90~yCET1OU4-1446314463eusmtrp2q; Thu, 20 Dec 2018 11:51:54 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-49-5c1b825ba5a5 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 2D.DA.04128.A528B1C5; Thu, 20 Dec 2018 11:51:54 +0000 (GMT) Received: from [106.120.43.17] (unknown [106.120.43.17]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20181220115153eusmtip1e8d1fbb7bd7f2bb8454c00c44e3356d2~yCETNMGe-2012720127eusmtip1h; Thu, 20 Dec 2018 11:51:53 +0000 (GMT) Subject: Re: [PATCH v4 2/3] driver core: add deferring probe reason to devices_deferred property To: Greg Kroah-Hartman Cc: Bartlomiej Zolnierkiewicz , Marek Szyprowski , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Javier Martinez Canillas , linux-arm-kernel@lists.infradead.org, andy.shevchenko@gmail.com, Mark Brown , Russell King - ARM Linux From: Andrzej Hajda Message-ID: Date: Thu, 20 Dec 2018 12:51:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181220111220.GA10978@kroah.com> Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0hTcRTH/e3e3V1Hk5/T2GH2wEF/aKWZRpdMqSgYFRn4T6lkUy9q6pQ7 H5l/aCq6lqlJKx2KhdnKRz5bPtJiho/E0jStiZq4f9JE8JFJ9HBeJf/7nHO+h+/3wKEJaa9Q TkerE1lOrYpVUGLS1L324WBwpkvIoWoLZr4VdiGmobhOyOinrRSTVVFHMY/uGxHTODMqZIbb SinGrO9ATO3bCRFTtqwnToiVw6NDhLLVMCFSNlbdopSvy2pEyqbH6cqFzk+UMr+5CimXGvdc pIPExyPY2OhklvP0vyqOKljWChPeuF9/NVdDZqB6hQ7Z04B9oKp0VqRDYlqKnyLImugg+GIZ QctsmcimkuIlBLrxw1sb/Q11JC8yIsix1CO+mEeQO2wlbConHAY/595tsDP2hoIBw4YHgVcF YLIuCG0DCrvB76YvlI0l2B9y+6Y37Ei8D+ay9QIb78SXQDtVvalxhL4SK2lje+wJ39vHNpjA e+HlfCnBswws1nKBzQywRQTPCuYRn/s03OmfFfHsBLM9zZu8C/62lgt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K8j7OkY4R4UxIrq1KL8uOLSnNSiw8x mgI9N5FZSjQ5H5hK8kriDU0NzS0sDc2NzY3NLJTEec8bVEYJCaQnlqRmp6YWpBbB9DFxcEo1 MN64bb6UxYJBZr5r68yM7ykdT1Wcfaa03WitdJYp8/wYoxF46HKreWe1YGD9h8ioyUq85yxm rE3Nab28u7dCTEImIumj/SNGj5z6GOkrFmlLFcN7HnFONE8y1j1+Tfnez0Xi3BXP17upPTDm C/69YWVbxP0tW1XUBU6q3H6ibeVzzoXZ/VePEktxRqKhFnNRcSIAH4Fci+0CAAA= X-CMS-MailID: 20181220115154eucas1p1c40cf8ec2ff9192dd06a5bef9133333c X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20181220102259eucas1p1884a0b68ce342239c2a43a74cc50725a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181220102259eucas1p1884a0b68ce342239c2a43a74cc50725a References: <20181220102247.4911-1-a.hajda@samsung.com> <20181220102247.4911-3-a.hajda@samsung.com> <20181220111220.GA10978@kroah.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20.12.2018 12:12, Greg Kroah-Hartman wrote: > On Thu, Dec 20, 2018 at 11:22:46AM +0100, Andrzej Hajda wrote: >> /sys/kernel/debug/devices_deferred property contains list of deferred devices. >> This list does not contain reason why the driver deferred probe, the patch >> improves it. >> The natural place to set the reason is probe_err function introduced recently, >> ie. if probe_err will be called with -EPROBE_DEFER instead of printk the message >> will be attached to deferred device and printed when user read devices_deferred >> property. >> >> Signed-off-by: Andrzej Hajda >> Reviewed-by: Mark Brown >> Reviewed-by: Javier Martinez Canillas >> Reviewed-by: Andy Shevchenko >> --- >> v4: >> - removed NULL check before kfree, >> - coding style tweaking. >> v3: >> - adjusted deferred_devs_show, to accept newline ended messages, >> - changed conditonal check to positive, >> - added R-b by Andy. >> v2: >> - changed __deferred_probe_set_msg args - like in __dev_printk, fits better, >> - use kasprintf instead of bunch of code, >> - keep consistent format of devices_deferred lines, >> - added R-Bs (again I hope changes above are not against it). >> --- >> --- >> drivers/base/base.h | 3 +++ >> drivers/base/core.c | 9 +++++---- >> drivers/base/dd.c | 21 ++++++++++++++++++++- >> 3 files changed, 28 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/base/base.h b/drivers/base/base.h >> index 7a419a7a6235..effbd5e7f9f1 100644 >> --- a/drivers/base/base.h >> +++ b/drivers/base/base.h >> @@ -75,6 +75,7 @@ struct device_private { >> struct klist_node knode_driver; >> struct klist_node knode_bus; >> struct list_head deferred_probe; >> + char *deferred_probe_msg; >> struct device *device; >> }; >> #define to_device_private_parent(obj) \ >> @@ -113,6 +114,8 @@ 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_del(struct device *dev); >> +extern void __deferred_probe_set_msg(const struct device *dev, >> + struct va_format *vaf); >> 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 7f644f3c41d3..d3eb5aeeaa28 100644 >> --- a/drivers/base/core.c >> +++ b/drivers/base/core.c >> @@ -3108,6 +3108,7 @@ define_dev_printk_level(_dev_info, KERN_INFO); >> * >> * This helper implements common pattern present in probe functions for error >> * checking: print message if the error is not -EPROBE_DEFER and propagate it. >> + * In case of -EPROBE_DEFER it sets defer probe reason. >> * It replaces code sequence: >> * if (err != -EPROBE_DEFER) >> * dev_err(dev, ...); >> @@ -3123,14 +3124,14 @@ int probe_err(const struct device *dev, int err, const char *fmt, ...) >> struct va_format vaf; >> va_list args; >> >> - if (err == -EPROBE_DEFER) >> - return err; >> - >> va_start(args, fmt); >> vaf.fmt = fmt; >> vaf.va = &args; >> >> - dev_err(dev, "error %d: %pV", err, &vaf); >> + if (err == -EPROBE_DEFER) >> + __deferred_probe_set_msg(dev, &vaf); >> + else >> + dev_err(dev, "error %d: %pV", err, &vaf); >> >> va_end(args); >> >> diff --git a/drivers/base/dd.c b/drivers/base/dd.c >> index 88713f182086..857aa4d1d45d 100644 >> --- a/drivers/base/dd.c >> +++ b/drivers/base/dd.c >> @@ -27,6 +27,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "base.h" >> #include "power/power.h" >> @@ -132,6 +133,8 @@ void driver_deferred_probe_del(struct device *dev) >> if (!list_empty(&dev->p->deferred_probe)) { >> dev_dbg(dev, "Removed from deferred list\n"); >> list_del_init(&dev->p->deferred_probe); >> + kfree(dev->p->deferred_probe_msg); >> + dev->p->deferred_probe_msg = NULL; >> } >> mutex_unlock(&deferred_probe_mutex); >> } >> @@ -202,6 +205,21 @@ void device_unblock_probing(void) >> driver_deferred_probe_trigger(); >> } >> >> +/* >> + * __deferred_probe_set_msg() - Set defer probe reason message for device >> + */ >> +void __deferred_probe_set_msg(const struct device *dev, struct va_format *vaf) >> +{ >> + const char *drv = dev_driver_string(dev); >> + >> + mutex_lock(&deferred_probe_mutex); >> + >> + kfree(dev->p->deferred_probe_msg); >> + dev->p->deferred_probe_msg = kasprintf(GFP_KERNEL, "%s: %pV", drv, vaf); > Why do you also need the dev driver string here? Don't you get it > automatically when you print out the list in deferred_devs_show()? Deferred device is not bound to driver. > > How about we just wait on this patch, it seems very unneeded. Or at > least I can't see who would need this, what can a user do with this > information? It should be quite helpful in case of deferred probing, solving mysteries why given device is not bound to the driver is very common in mobile world. And since deferal should not be treated as an error grepping dmesg often does not help. Regards Andrzej > > thanks, > > greg k-h > >