Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751667AbdFURrm (ORCPT ); Wed, 21 Jun 2017 13:47:42 -0400 Received: from mga01.intel.com ([192.55.52.88]:21826 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbdFURrl (ORCPT ); Wed, 21 Jun 2017 13:47:41 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,369,1493708400"; d="scan'208";a="117659852" Date: Wed, 21 Jun 2017 10:47:40 -0700 From: "Luck, Tony" To: Borislav Petkov Cc: Dave Hansen , Naoya Horiguchi , x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yazen Ghannam Subject: Re: [PATCH] mm/hwpoison: Clear PRESENT bit for kernel 1:1 mappings of poison pages Message-ID: <20170621174740.npbtg2e4o65tyrss@intel.com> References: <20170616190200.6210-1-tony.luck@intel.com> <20170619180147.qolal6mz2wlrjbxk@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170619180147.qolal6mz2wlrjbxk@pd.tnic> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1852 Lines: 59 On Mon, Jun 19, 2017 at 08:01:47PM +0200, Borislav Petkov wrote: > (drop stable from CC) > > You could use git's --suppress-cc= option when sending. I would if I could work out how to use it. From reading the manual page there seem to be a few options to this, but none of them appear to just drop a specific address (apart from my own). :-( > > +#ifdef CONFIG_X86_64 > > + > > +void arch_unmap_kpfn(unsigned long pfn) > > +{ > > I guess you can move the ifdeffery inside the function. If I do, then the compiler will emit an empty function. It's only a couple of bytes for the "ret" ... but why? I may change it to: #if defined(arch_unmap_kpfn) && defined(CONFIG_MEMORY_FAILURE) to narrow down further when we need this. > > +#if PGDIR_SHIFT + 9 < 63 /* 9 because cpp doesn't grok ilog2(PTRS_PER_PGD) */ > > Please no side comments. Ok. > Also, explain why the build-time check. (Sign-extension going away for VA > space yadda yadda..., 5 2/3 level paging :-)) Will add. > Also, I'm assuming this whole "workaround" of sorts should be Intel-only? I'd assume that other X86 implementations would face similar issues (unless they have extremely cautious pre-fetchers and/or no speculation). I'm also assuming that non-X86 architectures that do recovery may want this too ... hence hooking the arch_unmap_kpfn() function into the generic memory_failure() code. > > + decoy_addr = (pfn << PAGE_SHIFT) + (PAGE_OFFSET ^ BIT(63)); > > +#else > > +#error "no unused virtual bit available" > > +#endif > > + > > + if (set_memory_np(decoy_addr, 1)) > > + pr_warn("Could not invalidate pfn=0x%lx from 1:1 map \n", pfn); > > WARNING: unnecessary whitespace before a quoted newline > #107: FILE: arch/x86/kernel/cpu/mcheck/mce.c:1089: > + pr_warn("Could not invalidate pfn=0x%lx from 1:1 map \n", pfn); Oops! Will fix. -Tony