linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Ankur Arora <ankur.a.arora@oracle.com>
Cc: linux-pm@vger.kernel.org, kvm@vger.kernel.org,
	Sudeep Holla <sudeep.holla@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, catalin.marinas@arm.com,
	will@kernel.org, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, x86@kernel.org, hpa@zytor.com, pbonzini@redhat.com,
	wanpengli@tencent.com, vkuznets@redhat.com, rafael@kernel.org,
	daniel.lezcano@linaro.org, peterz@infradead.org, arnd@arndb.de,
	lenb@kernel.org, mark.rutland@arm.com, harisokn@amazon.com,
	joao.m.martins@oracle.com, boris.ostrovsky@oracle.com,
	konrad.wilk@oracle.com
Subject: Re: [PATCH 8/9] arm64: support cpuidle-haltpoll
Date: Mon, 24 Jun 2024 11:54:59 +0100	[thread overview]
Message-ID: <ZnlQg9kcAWG443re@bogus> (raw)
In-Reply-To: <871q4pc0f9.fsf@oracle.com>

On Fri, Jun 21, 2024 at 04:59:22PM -0700, Ankur Arora wrote:
> 
> Sudeep Holla <sudeep.holla@arm.com> writes:
> 
> > On Tue, Apr 30, 2024 at 11:37:29AM -0700, Ankur Arora wrote:
> >> Add architectural support for the cpuidle-haltpoll driver by defining
> >> arch_haltpoll_*(). Also select ARCH_HAS_OPTIMIZED_POLL since we have
> >> an optimized polling mechanism via smp_cond_load*().
> >>
> >> Add the configuration option, ARCH_CPUIDLE_HALTPOLL to allow
> >> cpuidle-haltpoll to be selected.
> >>
> >> Note that we limit cpuidle-haltpoll support to when the event-stream is
> >> available. This is necessary because polling via smp_cond_load_relaxed()
> >> uses WFE to wait for a store which might not happen for an prolonged
> >> period of time. So, ensure the event-stream is around to provide a
> >> terminating condition.
> >>
> >
> > Currently the event stream is configured 10kHz(1 signal per 100uS IIRC).
> > But the information in the cpuidle states for exit latency and residency
> > is set to 0(as per drivers/cpuidle/poll_state.c). Will this not cause any
> > performance issues ?
> 
> No I don't think there's any performance issue.
>

Thanks for the confirmation, that was my assumption as well.

> When the core is waiting in WFE for &thread_info->flags to
> change, and set_nr_if_polling() happens, the CPU will come out
> of the wait quickly.
> So, the exit latency, residency can be reasonably set to 0.
>

Sure

> If, however, there is no store to &thread_info->flags, then the event
> stream is what would cause us to come out of the WFE and check if
> the poll timeout has been exceeded.
> In that case, there was no work to be done, so there was nothing
> to wake up from.
>

This is exactly what I was referring when I asked about performance, but
it looks like it is not a concern for the reason specified about.

> So, in either circumstance there's no performance loss.
>
> However, when we are polling under the haltpoll governor, this might
> mean that we spend more time polling than determined based on the
> guest_halt_poll_ns. But, that would only happen in the last polling
> iteration.
>
> So, I'd say, at worst no performance loss. But, we would sometimes
> poll for longer than necessary before exiting to the host.
>

Does it make sense to add some comment that implies briefly what we
have discussed here ? Mainly why 0 exit and target residency values
are fine and how worst case WFE wakeup doesn't impact the performance.

--
Regards,
Sudeep


  reply	other threads:[~2024-06-24 10:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30 18:37 [PATCH 0/9] Enable haltpoll for arm64 Ankur Arora
2024-04-30 18:37 ` [PATCH 1/9] cpuidle: rename ARCH_HAS_CPU_RELAX to ARCH_HAS_OPTIMIZED_POLL Ankur Arora
2024-05-02  1:33   ` Christoph Lameter (Ampere)
2024-05-03  4:13     ` Ankur Arora
2024-05-03 17:07       ` Christoph Lameter (Ampere)
2024-05-06 21:27         ` Ankur Arora
2024-04-30 18:37 ` [PATCH 2/9] Kconfig: move ARCH_HAS_OPTIMIZED_POLL to arch/Kconfig Ankur Arora
2024-04-30 18:37 ` [PATCH 3/9] cpuidle-haltpoll: condition on ARCH_CPUIDLE_HALTPOLL Ankur Arora
2024-05-22 16:09   ` Joao Martins
2024-04-30 18:37 ` [PATCH 4/9] cpuidle-haltpoll: define arch_haltpoll_supported() Ankur Arora
2024-05-01 11:48   ` kernel test robot
2024-05-22 16:09   ` Joao Martins
2024-06-05  5:47     ` Ankur Arora
2024-04-30 18:37 ` [PATCH 5/9] governors/haltpoll: drop kvm_para_available() check Ankur Arora
2024-04-30 18:37 ` [PATCH 6/9] cpuidle/poll_state: poll via smp_cond_load_relaxed() Ankur Arora
2024-04-30 18:37 ` [PATCH 7/9] arm64: define TIF_POLLING_NRFLAG Ankur Arora
2024-04-30 18:37 ` [PATCH 8/9] arm64: support cpuidle-haltpoll Ankur Arora
2024-05-30 23:07   ` Okanovic, Haris
2024-06-04 23:09     ` Ankur Arora
2024-06-19 12:17   ` Sudeep Holla
2024-06-21 23:59     ` Ankur Arora
2024-06-24 10:54       ` Sudeep Holla [this message]
2024-06-25  1:17         ` Ankur Arora
2024-04-30 18:37 ` [PATCH 9/9] cpuidle/poll_state: limit POLL_IDLE_RELAX_COUNT on arm64 Ankur Arora
2024-04-30 18:56 ` [PATCH 0/9] Enable haltpoll for arm64 Ankur Arora

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=ZnlQg9kcAWG443re@bogus \
    --to=sudeep.holla@arm.com \
    --cc=ankur.a.arora@oracle.com \
    --cc=arnd@arndb.de \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=harisokn@amazon.com \
    --cc=hpa@zytor.com \
    --cc=joao.m.martins@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).