From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH RFC v2 4/5] x86/mwait-idle: enable interrupts before C1 on Xeons
Date: Thu, 20 Jan 2022 16:52:36 +0100 [thread overview]
Message-ID: <YemFRFaKRanqgpSW@Air-de-Roger> (raw)
In-Reply-To: <a0b3c3f6-2abc-353b-92f9-367fa57af8ef@suse.com>
On Thu, Jan 20, 2022 at 03:04:39PM +0100, Jan Beulich wrote:
> From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
>
> Enable local interrupts before requesting C1 on the last two generations
> of Intel Xeon platforms: Sky Lake, Cascade Lake, Cooper Lake, Ice Lake.
> This decreases average C1 interrupt latency by about 5-10%, as measured
> with the 'wult' tool.
>
> The '->enter()' function of the driver enters C-states with local
> interrupts disabled by executing the 'monitor' and 'mwait' pair of
> instructions. If an interrupt happens, the CPU exits the C-state and
> continues executing instructions after 'mwait'. It does not jump to
> the interrupt handler, because local interrupts are disabled. The
> cpuidle subsystem enables interrupts a bit later, after doing some
> housekeeping.
>
> With this patch, we enable local interrupts before requesting C1. In
> this case, if the CPU wakes up because of an interrupt, it will jump
> to the interrupt handler right away. The cpuidle housekeeping will be
> done after the pending interrupt(s) are handled.
>
> Enabling interrupts before entering a C-state has measurable impact
> for faster C-states, like C1. Deeper, but slower C-states like C6 do
> not really benefit from this sort of change, because their latency is
> a lot higher comparing to the delay added by cpuidle housekeeping.
>
> This change was also tested with cyclictest and dbench. In case of Ice
> Lake, the average cyclictest latency decreased by 5.1%, and the average
> 'dbench' throughput increased by about 0.8%. Both tests were run for 4
> hours with only C1 enabled (all other idle states, including 'POLL',
> were disabled). CPU frequency was pinned to HFM, and uncore frequency
> was pinned to the maximum value. The other platforms had similar
> single-digit percentage improvements.
>
> It is worth noting that this patch affects 'cpuidle' statistics a tiny
> bit. Before this patch, C1 residency did not include the interrupt
> handling time, but with this patch, it will include it. This is similar
> to what happens in case of the 'POLL' state, which also runs with
> interrupts enabled.
>
> Suggested-by: Len Brown <len.brown@intel.com>
> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> [Linux commit: c227233ad64c77e57db738ab0e46439db71822a3]
>
> We don't have a pointer into cpuidle_state_table[] readily available.
> To compensate, make use of the new flag only appearing for C1 and hence
> only in the first table entry.
We could likely use the 8 padding bits in acpi_processor_cx between
entry_method and method to store a flags field?
It would seems more resilient, as I guess at some point we could
enable interrupts for further states?
>
> Unlike Linux we want to disable IRQs again after MWAITing, as
> subsequently invoked functions assume so.
I'm also wondering whether there could be interrupts that rely on some
of the housekeeping that's done when returning from mwait. I guess
it's unlikely for an interrupt handler to have anything to do with the
TSC not having been restored.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
I think it's important to keep in sync with our upstream that's Linux
there.
Albeit I would prefer if we could carry the flags into acpi_processor_cx.
Thanks, Roger.
next prev parent reply other threads:[~2022-01-20 15:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 14:00 [PATCH v2 0/5] x86/mwait-idle: updates from Linux (and more) Jan Beulich
2022-01-20 14:01 ` [PATCH v2 1/5] x86/mwait-idle: stop exposing platform acronyms Jan Beulich
2022-01-20 14:31 ` Roger Pau Monné
2022-01-20 14:02 ` [PATCH v2 2/5] x86/mwait-idle: switch to using bool Jan Beulich
2022-01-20 14:34 ` Roger Pau Monné
2022-01-20 14:02 ` [PATCH v2 3/5] x86/mwait-idle: add SnowRidge C-state table Jan Beulich
2022-01-20 14:04 ` [PATCH RFC v2 4/5] x86/mwait-idle: enable interrupts before C1 on Xeons Jan Beulich
2022-01-20 15:52 ` Roger Pau Monné [this message]
2022-01-24 14:44 ` Jan Beulich
2022-01-25 12:43 ` Roger Pau Monné
2022-01-20 14:05 ` [PATCH RFC v2 5/5] x86/mwait-idle: squash stats update when not actually entering C-state Jan Beulich
2022-01-20 16:00 ` Roger Pau Monné
2022-01-20 16:21 ` Jan Beulich
2022-01-21 9:32 ` Roger Pau Monné
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=YemFRFaKRanqgpSW@Air-de-Roger \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 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.