Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp306163yba; Sat, 4 May 2019 02:49:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXWaWkr/PKdRR2C4S/6vuLdFqbDfgqkbCH4dODAs4YaWmfXSTDFSKxdUbI+/WCYXqnjZuL X-Received: by 2002:a17:902:ac1:: with SMTP id 59mr17513659plp.294.1556963352169; Sat, 04 May 2019 02:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556963352; cv=none; d=google.com; s=arc-20160816; b=nLUI0WqEGt09EtlABx5NVN4Tk2pdQHXkxO0E3X61R8JD/dIsnmfEGExfzDbhtua/tq +A0pHR+H9VFvxY4mMKEVuPiM/IPhGvkv4LbRpGh/1+92FPcYX5REy6X19WK7eN9W+8tE CLNLMe6K18eDhhQKLqXXqylvXOGC+b8tre0cTZ78VasbjKuv2J+EpClQTasB2k1aGvqU eY0OZasi8Zjk8ISKwyv5AFQ45KFOsjlxnH2lChAciLXBLatj0Hn+DtKET5SVPOY1Okid tS5iZzbTTOyzgG7B4Ho5kbcY149FfRzQvIq0/DNovloa0ASpLofHErC7GuBCzh+ZPAyw TGsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=wMvUo2IbrWgBnrr8dIVRyX3DQ0pSJBx6mroT8QzYNmI=; b=bKdUq2dZXH9HlExPQmDycXrd4bgILnER2oEDS5v8Wz5LmT8+dl/MM87TQxpePWgYD5 kLwh6U9fHq2Bi56NkhKylt+jG/lUTSohIsdPhVIghQKhbByKWMEsACEHyO+gibLGysms 5E7jKBSib6K2x1gYYNPuzrWpCNSi0xpSsMvKP5OF1A+WaTtmKG1HobLTCvVH4afW950A 1odJytg4elAhBeg2fIXdYxhY+Zor6S6akM3lMChCtxLA2DA3ezwdm+Ih4yy4Fi2W2kHx +Xq8A3GvpuwpFxjBqYlEqn9MdilwmPiT99RAUiVtzZ1ji+ZGKymuMwbvLahZ3oqEVo5s ZFSw== ARC-Authentication-Results: i=1; mx.google.com; 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 k12si6490947pgi.107.2019.05.04.02.48.56; Sat, 04 May 2019 02:49:12 -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; 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 S1726694AbfEDJrb (ORCPT + 99 others); Sat, 4 May 2019 05:47:31 -0400 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:38129 "EHLO mail.osadl.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725823AbfEDJra (ORCPT ); Sat, 4 May 2019 05:47:30 -0400 Received: by mail.osadl.at (Postfix, from userid 1001) id AF5A55C0B0A; Sat, 4 May 2019 11:46:35 +0200 (CEST) Date: Sat, 4 May 2019 11:46:35 +0200 From: Nicholas Mc Guire To: Sakari Ailus Cc: Nicholas Mc Guire , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] media: smiapp: core: add range to usleep_range Message-ID: <20190504094635.GA27029@osadl.at> References: <1554603364-10500-1-git-send-email-hofrat@opentech.at> <20190430134944.6sutxdztj6crgo6w@valkosipuli.retiisi.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190430134944.6sutxdztj6crgo6w@valkosipuli.retiisi.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 04:49:44PM +0300, Sakari Ailus wrote: > Hi Nicholas, > > On Sun, Apr 07, 2019 at 04:16:02AM +0200, Nicholas Mc Guire wrote: > > Allow the hrtimer subsystem to coalesce delay timers of lower accuracy > > by providing a suitable range > > > > Signed-off-by: Nicholas Mc Guire > > --- > > > > Problem located by an experimental coccinelle script > > > > hrtimers in atomic context have limited accuracy due to possible > > context-switching and interruption so the accuracy is limited > > anyway. Giving the hrtimer subsystem a reasonable range for merging > > hrtimers helps to reduce the load on the hrtimer subsystem. As this > > delays do not seem to mandate high accuracy the range of a factor > > two seems acceptable. > > > > Patch was compile tested with: x86_64_defconfig + MEDIA_SUPPORT=m, > > MEDIA_CAMERA_SUPPORT=y, MEDIA_CONTROLLER=y, VIDEO_V4L2_SUBDEV_API=y, > > VIDEO_SMIAPP=m > > (with a number of sparse warnings on sizeof() usage) > > > > Patch is against 5.1-rc3 (localversion-next is next-20190405) > > The delays are exact for the reason that they are user-visible delays in > image capturing related use cases. Sometimes milliseconds matter, or at > least adding more does not help. > Actually it can be better iwith respect to jitter to let the hrtimer subsystem use an existing timer event than to have a close by second event and the accuracy is determined by the non-atomic context anyway - so while the proposed delay extension might be excessive in your case I would still suggest to try to get away from a range of 0 - even if you only end up with (1000,1050) that would be an advantage for the timer subsystem. thx! hofrat > > > > drivers/media/i2c/smiapp/smiapp-core.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c > > index 58a45c3..c0c29ec 100644 > > --- a/drivers/media/i2c/smiapp/smiapp-core.c > > +++ b/drivers/media/i2c/smiapp/smiapp-core.c > > @@ -1222,19 +1222,19 @@ static int smiapp_power_on(struct device *dev) > > dev_err(&client->dev, "failed to enable vana regulator\n"); > > return rval; > > } > > - usleep_range(1000, 1000); > > + usleep_range(1000, 2000); > > > > rval = clk_prepare_enable(sensor->ext_clk); > > if (rval < 0) { > > dev_dbg(&client->dev, "failed to enable xclk\n"); > > goto out_xclk_fail; > > } > > - usleep_range(1000, 1000); > > + usleep_range(1000, 2000); > > > > gpiod_set_value(sensor->xshutdown, 1); > > > > sleep = SMIAPP_RESET_DELAY(sensor->hwcfg->ext_clk); > > - usleep_range(sleep, sleep); > > + usleep_range(sleep, sleep*2); > > > > mutex_lock(&sensor->mutex); > > > > @@ -1381,7 +1381,7 @@ static int smiapp_power_off(struct device *dev) > > > > gpiod_set_value(sensor->xshutdown, 0); > > clk_disable_unprepare(sensor->ext_clk); > > - usleep_range(5000, 5000); > > + usleep_range(5000, 10000); > > regulator_disable(sensor->vana); > > sensor->streaming = false; > > > > -- > Sakari Ailus