From: Borislav Petkov <bp@alien8.de>
To: Qian Cai <cai@lca.pw>
Cc: tglx@linutronix.de, mingo@redhat.com,
dave.hansen@linux.intel.com, luto@kernel.org,
peterz@infradead.org, elver@google.com, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] x86/mm/pat: fix a data race in cpa_inc_4k_install
Date: Tue, 21 Jan 2020 08:27:44 +0100 [thread overview]
Message-ID: <20200121072744.GA7808@zn.tnic> (raw)
In-Reply-To: <20200121041200.2260-1-cai@lca.pw>
On Mon, Jan 20, 2020 at 11:12:00PM -0500, Qian Cai wrote:
> diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
> index 20823392f4f2..31e4a73ae70e 100644
> --- a/arch/x86/mm/pat/set_memory.c
> +++ b/arch/x86/mm/pat/set_memory.c
> @@ -128,7 +128,7 @@ static inline void cpa_inc_2m_checked(void)
>
> static inline void cpa_inc_4k_install(void)
> {
> - cpa_4k_install++;
> + WRITE_ONCE(cpa_4k_install, READ_ONCE(cpa_4k_install) + 1);
> }
>
> static inline void cpa_inc_lp_sameprot(int level)
> --
Fix a data race, says your subject?
If it had to be honest, it probably should say "Make the code ugly
because the next tool can't handle it".
Frankly, I'm not a fan of all this "change the kernel to fix the tool"
attitude.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2020-01-21 7:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-21 4:12 Qian Cai
2020-01-21 7:27 ` Borislav Petkov [this message]
2020-01-21 8:19 ` Marco Elver
2020-01-21 9:16 ` Borislav Petkov
2020-01-21 9:26 ` Marco Elver
2020-01-21 9:50 ` Peter Zijlstra
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=20200121072744.GA7808@zn.tnic \
--to=bp@alien8.de \
--cc=cai@lca.pw \
--cc=dave.hansen@linux.intel.com \
--cc=elver@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--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
all inboxes | Powered by JetHome®