From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: MIME-Version: 1.0 In-Reply-To: <20180604170801.GA17234@agluck-desk> References: <152800336321.17112.3300876636370683279.stgit@dwillia2-desk3.amr.corp.intel.com> <152800340082.17112.1154560126059273408.stgit@dwillia2-desk3.amr.corp.intel.com> <20180604170801.GA17234@agluck-desk> From: Dan Williams Date: Mon, 4 Jun 2018 10:39:48 -0700 Message-ID: Subject: Re: [PATCH v2 07/11] x86, memory_failure: Introduce {set, clear}_mce_nospec() To: "Luck, Tony" Cc: linux-nvdimm , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov , linux-edac@vger.kernel.org, X86 ML , Christoph Hellwig , Linux MM , linux-fsdevel , Jan Kara Content-Type: text/plain; charset="UTF-8" Sender: owner-linux-mm@kvack.org List-ID: On Mon, Jun 4, 2018 at 10:08 AM, Luck, Tony wrote: > On Sat, Jun 02, 2018 at 10:23:20PM -0700, Dan Williams wrote: >> +static inline int set_mce_nospec(unsigned long pfn) >> +{ >> + int rc; >> + >> + rc = set_memory_uc((unsigned long) __va(PFN_PHYS(pfn)), 1); > > You should really do the decoy_addr thing here that I had in mce_unmap_kpfn(). > Putting the virtual address of the page you mustn't accidentally prefetch > from into a register is a pretty good way to make sure that the processor > does do a prefetch. Maybe I'm misreading, but doesn't that make the page completely inaccessible? We still want to read pmem through the driver and the linear mapping with memcpy_mcsafe(). Alternatively I could just drop this patch and setup a private / alias mapping for the pmem driver to use. It seems aliased mappings would be the safer option, but I want to make sure I've comprehended your suggestion correctly?