All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Sean Young <sean@mess.org>
Cc: "Ivaylo Dimitrov" <ivo.g.dimitrov.75@gmail.com>,
	linux-media@vger.kernel.org,
	"Russell King" <linux@armlinux.org.uk>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Timo Kokkonen" <timo.t.kokkonen@iki.fi>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Sicelo A . Mhlongo" <absicsz@gmail.com>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v5 2/2] media: rc: remove ir-rx51 in favour of generic pwm-ir-tx
Date: Tue, 26 Sep 2023 10:37:44 +0300	[thread overview]
Message-ID: <20230926073744.GA5285@atomide.com> (raw)
In-Reply-To: <ZRKFUb1vRtn82bgn@gofer.mess.org>

* Sean Young <sean@mess.org> [230926 07:16]:
> On Mon, Sep 25, 2023 at 07:06:44PM +0300, Ivaylo Dimitrov wrote:
> > On 1.09.23 г. 17:18 ч., Sean Young wrote:
> > > The ir-rx51 is a pwm-based TX driver specific to the N900. This can be
> > > handled entirely by the generic pwm-ir-tx driver, and in fact the
> > > pwm-ir-tx driver has been compatible with ir-rx51 from the start.
> > > 
> > 
> > Unfortunately, pwm-ir-tx does not work on n900. My investigation shows that
> > for some reason usleep_range() sleeps for at least 300-400 us more than what
> > interval it is requested to sleep. I played with cyclictest from rt-tests
> > package and it gives similar results - increasing the priority helps, but I
> > was not able to make it sleep for less that 300 us in average. I tried
> > cpu_latency_qos_add_request() in pwm-ir-tx, but it made no difference.
> > 
> > I get similar results on motorola droid4 (OMAP4), albeit there average sleep
> > is in 200-300 us range, which makes me believe that either OMAPs have issues
> > with hrtimers or the config we use has some issue which leads to scheduler
> > latency. Or, something else...
> 
> The pwm-ir-tx driver does suffer from this problem, but I was under the
> impression that the ir-rx51 has the same problem.
> 
> > In either case help is appreciated to dig further trying to find the reason
> > for such a big delay.
> 
> pwm-ir-tx uses usleep_range() and ir-rx51 uses hrtimers. I thought that
> usleep_range() uses hrtimers; however if you're not seeing the same delay
> on ir-rx51 then maybe it's time to switch pwm-ir-tx to hrtimers.

Maybe using fsleep() fixes this issue? See commit c6af13d33475 ("timer: add
fsleep for flexible sleeping"), and Documentation/timers/timers-howto.rst.

The long wake-up time for an idle state could explain the values. I think
Ivaylo already tested with most cpuidle states disabled via sysfs though.

> I don't have a n900 to test on, unfortunately.

If you want one for development, the maemo folks cc:ed here likely have
some available devices.

Regards,

Tony

WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: Sean Young <sean@mess.org>
Cc: "Ivaylo Dimitrov" <ivo.g.dimitrov.75@gmail.com>,
	linux-media@vger.kernel.org,
	"Russell King" <linux@armlinux.org.uk>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Timo Kokkonen" <timo.t.kokkonen@iki.fi>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Sicelo A . Mhlongo" <absicsz@gmail.com>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v5 2/2] media: rc: remove ir-rx51 in favour of generic pwm-ir-tx
Date: Tue, 26 Sep 2023 10:37:44 +0300	[thread overview]
Message-ID: <20230926073744.GA5285@atomide.com> (raw)
In-Reply-To: <ZRKFUb1vRtn82bgn@gofer.mess.org>

* Sean Young <sean@mess.org> [230926 07:16]:
> On Mon, Sep 25, 2023 at 07:06:44PM +0300, Ivaylo Dimitrov wrote:
> > On 1.09.23 г. 17:18 ч., Sean Young wrote:
> > > The ir-rx51 is a pwm-based TX driver specific to the N900. This can be
> > > handled entirely by the generic pwm-ir-tx driver, and in fact the
> > > pwm-ir-tx driver has been compatible with ir-rx51 from the start.
> > > 
> > 
> > Unfortunately, pwm-ir-tx does not work on n900. My investigation shows that
> > for some reason usleep_range() sleeps for at least 300-400 us more than what
> > interval it is requested to sleep. I played with cyclictest from rt-tests
> > package and it gives similar results - increasing the priority helps, but I
> > was not able to make it sleep for less that 300 us in average. I tried
> > cpu_latency_qos_add_request() in pwm-ir-tx, but it made no difference.
> > 
> > I get similar results on motorola droid4 (OMAP4), albeit there average sleep
> > is in 200-300 us range, which makes me believe that either OMAPs have issues
> > with hrtimers or the config we use has some issue which leads to scheduler
> > latency. Or, something else...
> 
> The pwm-ir-tx driver does suffer from this problem, but I was under the
> impression that the ir-rx51 has the same problem.
> 
> > In either case help is appreciated to dig further trying to find the reason
> > for such a big delay.
> 
> pwm-ir-tx uses usleep_range() and ir-rx51 uses hrtimers. I thought that
> usleep_range() uses hrtimers; however if you're not seeing the same delay
> on ir-rx51 then maybe it's time to switch pwm-ir-tx to hrtimers.

Maybe using fsleep() fixes this issue? See commit c6af13d33475 ("timer: add
fsleep for flexible sleeping"), and Documentation/timers/timers-howto.rst.

The long wake-up time for an idle state could explain the values. I think
Ivaylo already tested with most cpuidle states disabled via sysfs though.

> I don't have a n900 to test on, unfortunately.

If you want one for development, the maemo folks cc:ed here likely have
some available devices.

Regards,

Tony

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-09-26  7:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 14:18 [PATCH v5 0/2] Remove ir-rx51 driver Sean Young
2023-09-01 14:18 ` [PATCH v5 1/2] dt-bindings: media: remove nokia,n900-ir as pwm-ir-tx is compatible Sean Young
2023-09-02 10:50   ` Conor Dooley
2023-09-04 14:28     ` Lee Jones
2023-09-01 14:18 ` [PATCH v5 2/2] media: rc: remove ir-rx51 in favour of generic pwm-ir-tx Sean Young
2023-09-01 14:18   ` Sean Young
2023-09-06 16:04   ` Uwe Kleine-König
2023-09-06 16:04     ` Uwe Kleine-König
2023-09-25 16:06   ` Ivaylo Dimitrov
2023-09-25 16:06     ` Ivaylo Dimitrov
2023-09-26  7:16     ` Sean Young
2023-09-26  7:16       ` Sean Young
2023-09-26  7:37       ` Tony Lindgren [this message]
2023-09-26  7:37         ` Tony Lindgren
2023-09-26 12:54         ` Ivaylo Dimitrov
2023-09-26 12:54           ` Ivaylo Dimitrov
2023-09-26 12:43       ` Ivaylo Dimitrov
2023-09-26 12:43         ` Ivaylo Dimitrov
2023-09-26 20:18         ` Sean Young
2023-09-26 20:18           ` Sean Young
2023-09-29  8:49           ` Ivaylo Dimitrov
2023-09-29  8:49             ` Ivaylo Dimitrov
2023-09-29 16:20             ` Sean Young
2023-09-29 16:20               ` Sean Young
2023-09-29 21:08               ` Uwe Kleine-König
2023-09-29 21:08                 ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230926073744.GA5285@atomide.com \
    --to=tony@atomide.com \
    --cc=absicsz@gmail.com \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mchehab@kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=sean@mess.org \
    --cc=thierry.reding@gmail.com \
    --cc=timo.t.kokkonen@iki.fi \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.