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=-8.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 06F7AC433E7 for ; Wed, 2 Sep 2020 10:25:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9D3B2065E for ; Wed, 2 Sep 2020 10:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726771AbgIBKZZ (ORCPT ); Wed, 2 Sep 2020 06:25:25 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:47058 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726247AbgIBKZZ (ORCPT ); Wed, 2 Sep 2020 06:25:25 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 4090B1C0B7F; Wed, 2 Sep 2020 12:25:23 +0200 (CEST) Date: Wed, 2 Sep 2020 12:25:21 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: Re: [PATCH 4.19 053/125] media: gpio-ir-tx: improve precision of transmitted signal due to scheduling Message-ID: <20200902102521.GC3765@duo.ucw.cz> References: <20200901150934.576210879@linuxfoundation.org> <20200901150937.150292200@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="t0UkRYy7tHLRMCai" Content-Disposition: inline In-Reply-To: <20200901150937.150292200@linuxfoundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --t0UkRYy7tHLRMCai Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! >=20 > [ Upstream commit ea8912b788f8144e7d32ee61e5ccba45424bef83 ] >=20 > usleep_range() may take longer than the max argument due to scheduling, > especially under load. This is causing random errors in the transmitted > IR. Remove the usleep_range() in favour of busy-looping with udelay(). >=20 > Signed-off-by: Sean Young I don't believe this should be in stable. Yes, it probably fixes someone's remote control. It also introduces > half a second (!) with interrupts disabled (according to the code comments), which will break other devices on the system. Less intrusive solutions should be explored, first. Like.. if that part is time-critical, perhaps it should set itself at realtime priority, so that scheduler has motivation to schedule it at the right times? Perhaps usleep_range should be delta, delta+1? Perhaps udelay makes sense to use for more than 10usec? Best regards, Pavel > @@ -87,13 +87,8 @@ static int gpio_ir_tx(struct rc_dev *dev, unsigned int= *txbuf, > // space > edge =3D ktime_add_us(edge, txbuf[i]); > delta =3D ktime_us_delta(edge, ktime_get()); > - if (delta > 10) { > - spin_unlock_irqrestore(&gpio_ir->lock, flags); > - usleep_range(delta, delta + 10); > - spin_lock_irqsave(&gpio_ir->lock, flags); > - } else if (delta > 0) { > + if (delta > 0) > udelay(delta); > - } > } else { > // pulse > ktime_t last =3D ktime_add_us(edge, txbuf[i]); > --=20 > 2.25.1 >=20 >=20 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --t0UkRYy7tHLRMCai Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCX09zEQAKCRAw5/Bqldv6 8gtmAJ4whLb6KgxDaQ4G9FMHnFplfwvEUwCgo8yL6i1TXMs6lZakoDrMzLqk9mI= =/W/6 -----END PGP SIGNATURE----- --t0UkRYy7tHLRMCai--