From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Oleksii Kurochko <oleksii.kurochko@gmail.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH for-4.19] x86/mtrr: avoid system wide rendezvous when setting AP MTRRs
Date: Tue, 14 May 2024 15:10:52 +0200 [thread overview]
Message-ID: <ZkNi3HE4V_ErzyhR@macbook> (raw)
In-Reply-To: <435ccfc3-d4e3-4da4-838f-4fb0e8987eab@suse.com>
On Tue, May 14, 2024 at 01:57:13PM +0200, Jan Beulich wrote:
> On 13.05.2024 10:59, Roger Pau Monne wrote:
> > --- a/xen/arch/x86/cpu/mtrr/main.c
> > +++ b/xen/arch/x86/cpu/mtrr/main.c
> > @@ -573,14 +573,15 @@ void mtrr_ap_init(void)
> > if (!mtrr_if || hold_mtrr_updates_on_aps)
> > return;
> > /*
> > - * Ideally we should hold mtrr_mutex here to avoid mtrr entries changed,
> > - * but this routine will be called in cpu boot time, holding the lock
> > - * breaks it. This routine is called in two cases: 1.very earily time
> > - * of software resume, when there absolutely isn't mtrr entry changes;
> > - * 2.cpu hotadd time. We let mtrr_add/del_page hold cpuhotplug lock to
> > - * prevent mtrr entry changes
> > + * hold_mtrr_updates_on_aps takes care of preventing unnecessary MTRR
> > + * updates when batch starting the CPUs (see
> > + * mtrr_aps_sync_{begin,end}()).
> > + *
> > + * Otherwise just apply the current system wide MTRR values to this AP.
> > + * Note this doesn't require synchronization with the other CPUs, as
> > + * there are strictly no modifications of the current MTRR values.
> > */
> > - set_mtrr(~0U, 0, 0, 0);
> > + mtrr_set_all();
> > }
>
> While I agree with the change here, it doesn't go quite far enough. Originally
> I meant to ask that, with this (supposedly) sole use of ~0U gone, you please
> also drop the handling of that special case from set_mtrr(). But another
> similar call exist in mtrr_aps_sync_end(). Yet while that's "fine" for the
> boot case (watchdog being started only slightly later), it doesn't look to be
> for the S3 resume one: The watchdog is re-enabled quite a bit earlier there.
> I actually wonder whether mtrr_aps_sync_{begin,end}() wouldn't better
> themselves invoke watchdog_{dis,en}able(), thus also making the boot case
> explicitly safe, not just safe because of ordering.
Hm, I don't like disabling the watchdog, I guess it could be
acceptable here because both usages of mtrr_aps_sync_end() are limited
to specific scenarios (boot or resume from suspension). I can prepare
a separate patch, but I don't think the watchdog disabling should be
part of this patch.
Thanks, Roger.
next prev parent reply other threads:[~2024-05-14 13:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 8:59 [PATCH for-4.19] x86/mtrr: avoid system wide rendezvous when setting AP MTRRs Roger Pau Monne
2024-05-14 9:14 ` Oleksii K.
2024-05-14 11:09 ` Andrew Cooper
2024-05-14 11:50 ` Andrew Cooper
2024-05-14 13:50 ` Andrew Cooper
2024-05-14 14:43 ` Roger Pau Monné
2024-05-15 18:59 ` Andrew Cooper
2024-05-14 11:57 ` Jan Beulich
2024-05-14 13:10 ` Roger Pau Monné [this message]
2024-05-14 13:36 ` Jan Beulich
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=ZkNi3HE4V_ErzyhR@macbook \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=oleksii.kurochko@gmail.com \
--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.