archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <>
To: Peter Zijlstra <>
Cc: Nick Desaulniers <>,
	Stephane Eranian <>,,,,,,,,,,
	Nathan Chancellor <>,
	clang-built-linux <>,
	Borislav Petkov <>, "H. Peter Anvin" <>,
Subject: Re: [PATCH] x86/resctrl: avoid compiler optimization in __resctrl_sched_in
Date: Tue, 7 Mar 2023 09:48:33 -0800	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Tue, Mar 7, 2023 at 3:36 AM Peter Zijlstra <> wrote:
> > I don't have a satisfactory answer yet, but am looking into this.
> Oh, geez, what a twisty tale that... So Linus knew back in '09 that "p"
> was icky, but it sorta was the only thing and it 'worked' -- until now
> :/

Yeah, so 'p' definitely is about the pointer, and I do worry that it
is only a dependency on exactly that - not the memory behind it.

I have this dim memory about us having talked about this with some gcc
person, and coming to the conclusion that it was all fine, but I
suspect it was in some very specific case where it might have been
fine for other reasons.

> Is there a way to explicitly order these things? barrier() obviously
> isn't going to help here.

So one "asm volatile" should always be ordered wrt another "asm volatile".

I have this other dim memory of it not even being clear whether "asm"
and "asm volatile" are ordered. I don't think they necessarily are
(with the obvious caveat that an asm without any arguments - a
so-called "basic asm" - is always volatile whether the "volatile" is
there or not).

I have a lot of dim memories, in other words. Should that worry me?

And then there's the "memory" clobber, of course.

But both of those are also going to disable CSE.

I do think that percpu_stable_op can use "p", but only when the value
is *truly* stable and there is no question about it being moved around
things that might modify it.


  reply	other threads:[~2023-03-07 17:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
     [not found] ` <>
     [not found]   ` <>
2023-03-07 11:35     ` [PATCH] x86/resctrl: avoid compiler optimization in __resctrl_sched_in Peter Zijlstra
2023-03-07 17:48       ` Linus Torvalds [this message]
2023-03-07 18:43       ` Segher Boessenkool
2023-03-07 20:43         ` Jakub Jelinek
2023-03-07 20:54           ` Linus Torvalds
2023-03-07 21:06             ` Linus Torvalds
2023-03-07 21:35               ` Luck, Tony
2023-03-07 21:58                 ` Nick Desaulniers
2023-03-08  6:13               ` Stephane Eranian
2023-03-08 23:25                 ` Linus Torvalds
2023-03-08 16:02               ` Moger, Babu
2023-03-07 21:11             ` Luck, Tony
2023-03-07 21:14               ` Linus Torvalds
2023-03-07 21:23                 ` Luck, Tony
2023-03-08  0:36                   ` Luck, Tony
2023-03-07 21:16               ` Nick Desaulniers
2023-03-07 21:19                 ` Linus Torvalds
2023-03-07 21:22                   ` Nick Desaulniers

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* 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).