[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrVKLv5DPByFcj7E5SBbv4mFt7mGQ9j-HU7G5u_aPGCYsQ@mail.gmail.com>
Date: Wed, 14 Oct 2020 08:45:37 -0700
From: Andy Lutomirski <luto@...nel.org>
To: Ankur Arora <ankur.a.arora@...cle.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux-MM <linux-mm@...ck.org>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Michal Hocko <mhocko@...nel.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
X86 ML <x86@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
Arnd Bergmann <arnd@...db.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Ira Weiny <ira.weiny@...el.com>,
linux-arch <linux-arch@...r.kernel.org>
Subject: Re: [PATCH 5/8] x86/clear_page: add clear_page_uncached()
On Wed, Oct 14, 2020 at 1:33 AM Ankur Arora <ankur.a.arora@...cle.com> wrote:
>
> Define clear_page_uncached() as an alternative_call() to clear_page_nt()
> if the CPU sets X86_FEATURE_NT_GOOD and fallback to clear_page() if it
> doesn't.
>
> Similarly define clear_page_uncached_flush() which provides an SFENCE
> if the CPU sets X86_FEATURE_NT_GOOD.
As long as you keep "NT" or "MOVNTI" in the names and keep functions
in arch/x86, I think it's reasonable to expect that callers understand
that MOVNTI has bizarre memory ordering rules. But once you give
something a generic name like "clear_page_uncached" and stick it in
generic code, I think the semantics should be more obvious.
How about:
clear_page_uncached_unordered() or clear_page_uncached_incoherent()
and
flush_after_clear_page_uncached()
After all, a naive reader might expect "uncached" to imply "caches are
off and this is coherent with everything". And the results of getting
this wrong will be subtle and possibly hard-to-reproduce corruption.
--Andy
Powered by blists - more mailing lists