All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Anthony PERARD <anthony@xenproject.org>
Subject: Re: [PATCH v2 5/8] tools/hvmloader: Retrieve (x2)APIC IDs from the APs themselves
Date: Tue, 28 May 2024 13:35:54 +0100	[thread overview]
Message-ID: <97f7caeb-85e8-488b-b763-9860720f02cb@cloud.com> (raw)
In-Reply-To: <ZlRJtN7h32uOHEOi@macbook>

On 27/05/2024 09:52, Roger Pau Monné wrote:
>> My intent here was to prevent the compiler omitting the write (though in
>> practice it didn't). I think the barrier is still required to prevent
>> reordering according to the spec.
> 
> Yes, my understating is that you added the ACCESS_ONCE() to possibly
> prevent the compiler from re-ordering the CPU_TO_X2APICID[ap_cpuid]) =
> read_apic_id() after the 'hlt' loop?

Yes, but not only that. Also preventing the compiler from eliding the
write altogether on the basis that it's not read after within the
function. I have suffered that particular behaviour on older versions of
GCC and it stung very much.

> 
> AFAICT the expressions in the `for` statement are considered sequence
> points, and the calling `read_apic_id()` could have side-effects, so
> the compiler won't be able to elide or move the setting of
> CPU_TO_X2APICID[] due to all side-effects of previous evaluations must
> be complete at sequence points.
> > I'm fine with leaving the wmb() + ACCESS_ONCE().
> 
> Thanks, Roger.

Cheers,
Alejandro


  reply	other threads:[~2024-05-28 12:36 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 12:39 [PATCH v2 0/8] x86: Expose consistent topology to guests Alejandro Vallejo
2024-05-08 12:39 ` [PATCH v2 1/8] xen/x86: Add initial x2APIC ID to the per-vLAPIC save area Alejandro Vallejo
2024-05-23 14:32   ` Roger Pau Monné
2024-05-24 10:58     ` Alejandro Vallejo
2024-05-24 11:15       ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 2/8] xen/x86: Simplify header dependencies in x86/hvm Alejandro Vallejo
2024-05-22  9:33   ` Jan Beulich
2024-05-22 15:24     ` Alejandro Vallejo
2024-05-23 14:37   ` Roger Pau Monné
2024-05-23 14:40     ` Jan Beulich
2024-05-23 14:52       ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 3/8] x86/vlapic: Move lapic_load_hidden migration checks to the check hook Alejandro Vallejo
2024-05-23 14:50   ` Roger Pau Monné
2024-05-24 11:16     ` Alejandro Vallejo
2024-05-24 12:53       ` Roger Pau Monné
2024-05-23 18:58   ` Andrew Cooper
2024-05-24  7:22     ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 4/8] tools/hvmloader: Wake APs with hypercalls and not with INIT+SIPI+SIPI Alejandro Vallejo
2024-05-08 19:13   ` Andrew Cooper
2024-05-09 11:04     ` Alejandro Vallejo
2024-05-09 17:50   ` [PATCH 4.5/8] tools/hvmloader: Further simplify SMP setup Andrew Cooper
2024-05-13 17:19     ` Alejandro Vallejo
2024-05-23 15:04     ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 5/8] tools/hvmloader: Retrieve (x2)APIC IDs from the APs themselves Alejandro Vallejo
2024-05-23 16:13   ` Roger Pau Monné
2024-05-24 15:16     ` Alejandro Vallejo
2024-05-27  8:55       ` Roger Pau Monné
2024-05-24  7:21   ` Roger Pau Monné
2024-05-24 15:15     ` Alejandro Vallejo
2024-05-27  8:52       ` Roger Pau Monné
2024-05-28 12:35         ` Alejandro Vallejo [this message]
2024-05-08 12:39 ` [PATCH v2 6/8] xen/lib: Add topology generator for x86 Alejandro Vallejo
2024-05-23 16:50   ` Roger Pau Monné
2024-05-28 13:28     ` Alejandro Vallejo
2024-05-08 12:39 ` [PATCH v2 7/8] xen/x86: Derive topologically correct x2APIC IDs from the policy Alejandro Vallejo
2024-05-24  8:39   ` Roger Pau Monné
2024-05-24 17:03     ` Alejandro Vallejo
2024-05-27  8:06       ` Roger Pau Monné
2024-05-08 12:39 ` [PATCH v2 8/8] xen/x86: Synthesise domain topologies Alejandro Vallejo
2024-05-24  8:58   ` Roger Pau Monné
2024-05-24 17:16     ` Alejandro Vallejo
2024-05-27  8:20       ` Roger Pau Monné
2024-05-28 14:06         ` Alejandro Vallejo

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=97f7caeb-85e8-488b-b763-9860720f02cb@cloud.com \
    --to=alejandro.vallejo@cloud.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.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.