Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp7125326imm; Tue, 24 Jul 2018 08:47:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcjU7KTpi+5TrnHtjaC/kOiXyVM4ByWOwK4/7IcAx1Mry7kSQj/H58LBbBRP573+vyBsv9I X-Received: by 2002:a62:4ece:: with SMTP id c197-v6mr7427663pfb.240.1532447249978; Tue, 24 Jul 2018 08:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532447249; cv=none; d=google.com; s=arc-20160816; b=w5w7GE/KsqjyCXAFLHZR9ejRsjsxBhAZIUggzmutfhbnz7ZqHH3CBa0Buqy/WAn+ep F/H/b5JidW+WGu0EeT8rd7lKzQgxY3aEqOKWaiEsVky7W4YnxC49YNu1F4TZ4khGwLUe ++9D+a7gcL8Y7YXozSWcIRjPgHGi1tx1lvjn38enT72Q+rCSlP6Z+OXg+6UjcMgNbgMl b/VvCSyOpy1SYAIvpjvo4/f5NiwV4w/0OyxX0UvFbE5D3RVh30QDTCH2j3sUwBvcsguj 6jTPMaKeHgeTQM5SWZ3qBfS7yIXzEES6MNcDEIHRfIV8O1OWg6vifjmyut33Uj6/kofQ zmGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :arc-authentication-results; bh=/J9RLa6MBu/SZsFrdIkjDaPAUYqTBaB6DeOx1378Nig=; b=PuAZcVX9goYpHjkXcj0AXKh2OmBK8D7vbegQheRC2Qy51RoIK6+fBxDjoSueOm14zf uCypQfNz+yV2+oDRzcV+5z8+1pH22tPsIbCDAbLmMKfAkOK946bFx/5YPR+AXV9f59CW PXeAj0oDK7CBTIfxHppaBWvwVlj0Yq2lN8BfgJrUA361UgAMBOTMyd5sj3y8nuKEs63z Qb6S9NsNtfpSQd7FYIUAq2ALZmKuYJJDPepF7MCy2EUIuWu0zJtflkuv+aoSTfIEv9IC bh5UTAmrm6wxDfZqKHpvualQ18yGvGKczxmTKkViuP2BotBlbzLWvfuAXJXIFT3mIn8m lxSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6-v6si10876423pgg.41.2018.07.24.08.47.15; Tue, 24 Jul 2018 08:47:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388463AbeGXQxM (ORCPT + 99 others); Tue, 24 Jul 2018 12:53:12 -0400 Received: from mga03.intel.com ([134.134.136.65]:35536 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388300AbeGXQxM (ORCPT ); Tue, 24 Jul 2018 12:53:12 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2018 08:46:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,398,1526367600"; d="scan'208";a="242919380" Received: from djiang5-desk3.ch.intel.com ([143.182.136.93]) by orsmga005.jf.intel.com with ESMTP; 24 Jul 2018 08:46:06 -0700 Subject: Re: [PATCH v6 11/13] x86/mm/pat: Prepare {reserve, free}_memtype() for "decoy" addresses To: Ingo Molnar , Dan Williams Cc: Tony Luck , linux-nvdimm@lists.01.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , linux-fsdevel@vger.kernel.org, Thomas Gleixner , hch@lst.de, linux-edac@vger.kernel.org References: <153154376846.34503.15480221419473501643.stgit@dwillia2-desk3.amr.corp.intel.com> <153154382700.34503.10197588570935341739.stgit@dwillia2-desk3.amr.corp.intel.com> <20180724073641.GA15984@gmail.com> From: Dave Jiang Openpgp: preference=signencrypt Autocrypt: addr=dave.jiang@intel.com; prefer-encrypt=mutual; keydata= xsPuBE6TbysRDACKOBHZT4ez/3/idMBVQP+cMIJAWfTTLqbHVYLdHMHh4h6IXWLqWgc9AYTx /ajdOrBVGSK9kMuvqRi0iRO1QLOMUAIc2n/44vh/3Fe54QYfgbndeXhHZi7YEwjiTCbpQ336 pS0rS2qQaA8GzFwu96OslLI05j9Ygaqy73qmuk3wxomIYiu9a97aN3oVv1RyTp6gJK1NWT3J On17P1yWUYPvY3KJtpVqnRLkLZeOIiOahgf9+qiYqPhKQI1Ycx4YhbqkNmDG1VqdMtEWREZO DpTti6oecydN37MW1Y+YSzWYDVLWfoLUr2tBveGCRLf/U2n+Tm2PlJR0IZq+BhtuIUVcRLQW vI+XenR8j3vHVNHs9UXW/FPB8Xb5fwY2bJniZ+B4G67nwelhMNWe7H9IcEaI7Eo32fZk+9fo x6GDAhdT0pEetwuhkmI0YYD7cQj1mEx1oEbzX2p/HRW9sHTSv0V2zKbkPvii3qgvCoDb1uLd 4661UoSG0CYaAx8TwBxUqjsBAO9FXDhLHZJadyHmWp64xQGnNgBathuqoSsIWgQWBpfhDACA OYftX52Wp4qc3ZT06NPzGTV35xr4DVftxxUHiwzB/bzARfK8tdoW4A44gN3P03DAu+UqLoqm UP/e8gSLEjoaebjMu8c2iuOhk1ayHkDPc2g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HGG5rLFPR/Yc5V0QpqkU8DhZDgEAoStRa/a6Mtq3Ri1H B84kFIqSQ9ME5049k6k1K7wdXcvOwE0ETpNvKxAEANGHLx0q/R99wzbVdnRthIZttNQ6M4R8 AAtEypE9JG3PLrEd9MUB5wf0fB/2Jypec3x935mRW3Zt1i+TrzjQDzMV5RyTtpWI7PwIh5IZ 0h4OV2yQHFVViHi6lubCRypQYiMzTmEKua3LeBGvUR9vVmpPJZ/UP6VajKqywjPHYBwLAAMF A/9B/PdGc1sZHno0ezuwZO2J9BOsvASNUzamO9to5P9VHTA6UqRvyfXJpNxLF1HjT4ax7Xn4 wGr6V1DCG3JYBmwIZjfinrLINKEK43L+sLbVVi8Mypc32HhNx/cPewROY2vPb4U7y3jhPBtt lt0ZMb75Lh7zY3TnGLOx1AEzmqwZSMJhBBgRCAAJBQJOk28rAhsMAAoJEGQVxPFmo7k+qiUB AKH0QWC+BBBn3pa9tzOz5hTrup+GIzf5TcuCsiAjISEqAPkBTGk5iiGrrHkxsz8VulDVpNxk o6nmKbYpUAltQObU2w== Message-ID: <896ea559-8fe5-9b2a-e763-407fae55cc01@intel.com> Date: Tue, 24 Jul 2018 08:46:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180724073641.GA15984@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/24/2018 12:36 AM, Ingo Molnar wrote: > > * Dan Williams wrote: > >> In preparation for using set_memory_uc() instead set_memory_np() for >> isolating poison from speculation, teach the memtype code to sanitize >> physical addresses vs __PHYSICAL_MASK. >> >> The motivation for using set_memory_uc() for this case is to allow >> ongoing access to persistent memory pages via the pmem-driver + >> memcpy_mcsafe() until the poison is repaired. >> >> Cc: Thomas Gleixner >> Cc: Ingo Molnar >> Cc: "H. Peter Anvin" >> Cc: Tony Luck >> Cc: Borislav Petkov >> Cc: >> Cc: >> Signed-off-by: Dan Williams >> --- >> arch/x86/mm/pat.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c >> index 1555bd7d3449..6788ffa990f8 100644 >> --- a/arch/x86/mm/pat.c >> +++ b/arch/x86/mm/pat.c >> @@ -512,6 +512,17 @@ static int free_ram_pages_type(u64 start, u64 end) >> return 0; >> } >> >> +static u64 sanitize_phys(u64 address) >> +{ >> + /* >> + * When changing the memtype for pages containing poison allow >> + * for a "decoy" virtual address (bit 63 clear) passed to >> + * set_memory_X(). __pa() on a "decoy" address results in a >> + * physical address with it 63 set. >> + */ >> + return address & __PHYSICAL_MASK; > > s/it/bit Thanks Ingo! I'll update when I pull in the patch. > > Thanks, > > Ingo > _______________________________________________ > Linux-nvdimm mailing list > Linux-nvdimm@lists.01.org > https://lists.01.org/mailman/listinfo/linux-nvdimm >