From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC967C433E6 for ; Tue, 1 Sep 2020 13:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B88E9206FA for ; Tue, 1 Sep 2020 13:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbgIANrt (ORCPT ); Tue, 1 Sep 2020 09:47:49 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2725 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728241AbgIANrG (ORCPT ); Tue, 1 Sep 2020 09:47:06 -0400 Received: from lhreml710-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id AA6FADA0A00693C13AF8; Tue, 1 Sep 2020 14:46:57 +0100 (IST) Received: from localhost (10.52.122.233) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Tue, 1 Sep 2020 14:46:57 +0100 Date: Tue, 1 Sep 2020 14:45:20 +0100 From: Jonathan Cameron To: Stephen Boyd CC: Doug Anderson , Jonathan Cameron , Alexandru Ardelean , Daniel Campello , Enrico Granata , Hartmut Knaack , "Lars-Peter Clausen" , Peter Meerwald-Stadler , linux-iio , LKML , Dmitry Torokhov Subject: Re: [PATCH] iio: sx9310: Prefer async probe Message-ID: <20200901144520.0000576c@Huawei.com> In-Reply-To: <159894383586.334488.2938301456606601581@swboyd.mtv.corp.google.com> References: <20200828170052.1.Id02b2f451b3eed71ddd580f4b8b44b3e33e84970@changeid> <20200829161230.398e0051@archlinux> <20200829181754.52d3cc3b@archlinux> <159894383586.334488.2938301456606601581@swboyd.mtv.corp.google.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.122.233] X-ClientProxiedBy: lhreml710-chm.china.huawei.com (10.201.108.61) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 1 Sep 2020 00:03:55 -0700 Stephen Boyd wrote: > Quoting Doug Anderson (2020-08-31 11:59:37) > > On Sat, Aug 29, 2020 at 10:18 AM Jonathan Cameron wrote: > > > Agreed. However, I'd like a comment next to the place we turn it on > > > saying what delays we are trying to mitigate by enabling it in this > > > driver. > > > > OK, I used function graph to get a trace. Some of the time is simply > > i2c transfers, which we do A LOT of during initialization (and i2c > > transfers aren't known for being instant). However, that's not the > > big problem. Check out the regmap_read_poll_timeout() in > > sx9310_init_compensation(). 20 ms per sleep with a 2 second timeout. > > This seems to eat over around 220 ms of the time on my system. > > > > So how do you want to do this? Do you want me to re-post the patch > > and mention the regmap_read_poll_timeout() in the commit message? Do > > you want to just add that to the commit message yourself? > > > > I think the suggestion is to put a comment next to the > PROBE_PREFER_ASYNCHRONOUS flag indicating that > sx9310_init_compensation() can take a while. Yup. That's what I meant. Sorry for lack of clarity. A comment in the code stops others copying it without making sure they understand whether it is relevant in their case. No one is going to look in commit messages. > Should the compensation be > delayed even further though to some time when userspace opens the device > node? It's tricky because we may hit it on an individual sysfs read. We could spin off a thread to do it I suppose, though that would be more or less the same as allowing async probe. Jonathan