[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200902102521.GC3765@duo.ucw.cz>
Date: Wed, 2 Sep 2020 12:25:21 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Sean Young <sean@...s.org>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 053/125] media: gpio-ir-tx: improve precision of
transmitted signal due to scheduling
Hi!
>
> [ Upstream commit ea8912b788f8144e7d32ee61e5ccba45424bef83 ]
>
> 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().
>
> Signed-off-by: Sean Young <sean@...s.org>
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 = ktime_add_us(edge, txbuf[i]);
> delta = 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 = ktime_add_us(edge, txbuf[i]);
> --
> 2.25.1
>
>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists