mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Okanovic, Haris" <harisokn@amazon.com>
To: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-assembly@vger.kernel.org" <linux-assembly@vger.kernel.org>
Cc: "peterz@infradead.org" <peterz@infradead.org>,
	"Saidi, Ali" <alisaidi@amazon.com>,
	"Blake, Geoff" <blakgeof@amazon.com>,
	"Silver, Brian" <silverbr@amazon.com>
Subject: Re: [PATCH 3/3] arm64: cpuidle: Add arm_poll_idle
Date: Tue, 2 Apr 2024 02:30:23 +0000	[thread overview]
Message-ID: <738769693c52ed23e35850325ee414ab131a06ea.camel@amazon.com> (raw)
In-Reply-To: <20240402014706.3969151-3-harisokn@amazon.com>

On Mon, 2024-04-01 at 20:47 -0500, Haris Okanovic wrote:
> +static int __cpuidle arm_idle_wfe_poll(struct cpuidle_device *dev,
> +                               struct cpuidle_driver *drv, int idx)
> +{
> +       u64 time_start, time_limit;
> +
> +       time_start = local_clock();
> +       dev->poll_time_limit = false;
> +
> +       local_irq_enable();

Re this comment from Peter Zijlstra [1], should I use
raw_local_irq_enable() instead? I see examples of both under
drivers/cpuidle/.

[1]
https://elixir.bootlin.com/linux/v6.9-rc2/source/include/linux/cpuidle.h#L119

> +
> +       if (current_set_polling_and_test())
> +               goto end;
> +
> +       time_limit = cpuidle_poll_time(drv, dev);
> +
> +       do {
> +               // exclusive read arms the monitor for wfe
> +               if (__READ_ONCE_EX(current_thread_info()->flags) &
> _TIF_NEED_RESCHED)
> +                       goto end;
> +
> +               // may exit prematurely, see ARM_ARCH_TIMER_EVTSTREAM
> +               wfe();
> +       } while (local_clock() - time_start < time_limit);
> +
> +       dev->poll_time_limit = true;
> +
> +end:
> +       current_clr_polling();
> +       return idx;
> +}
> +

Thanks,
Haris Okanovic


  reply	other threads:[~2024-04-02  2:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  1:47 [PATCH 1/3] arm64: Add TIF_POLLING_NRFLAG Haris Okanovic
2024-04-02  1:47 ` [PATCH 2/3] arm64: add __READ_ONCE_EX() Haris Okanovic
2024-04-02 16:48   ` Mark Rutland
2024-04-08 14:51   ` David Laight
2024-04-02  1:47 ` [PATCH 3/3] arm64: cpuidle: Add arm_poll_idle Haris Okanovic
2024-04-02  2:30   ` Okanovic, Haris [this message]
2024-04-02 17:23   ` Mark Rutland
2024-04-02 23:17     ` Ankur Arora
2024-04-05 19:36       ` Okanovic, Haris
2024-04-05 20:22         ` Ankur Arora
2024-04-05 20:05     ` Okanovic, Haris

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=738769693c52ed23e35850325ee414ab131a06ea.camel@amazon.com \
    --to=harisokn@amazon.com \
    --cc=alisaidi@amazon.com \
    --cc=blakgeof@amazon.com \
    --cc=linux-assembly@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=silverbr@amazon.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®