From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21C35C433E5 for ; Tue, 14 Jul 2020 20:00:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E374B20EDD for ; Tue, 14 Jul 2020 20:00:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E374B20EDD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2E37E8D0006; Tue, 14 Jul 2020 16:00:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 295728D0001; Tue, 14 Jul 2020 16:00:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AA948D0006; Tue, 14 Jul 2020 16:00:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0200.hostedemail.com [216.40.44.200]) by kanga.kvack.org (Postfix) with ESMTP id 057C98D0001 for ; Tue, 14 Jul 2020 16:00:46 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A631C180AD804 for ; Tue, 14 Jul 2020 20:00:45 +0000 (UTC) X-FDA: 77037749250.02.fold02_320e25526ef3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 5CA7750001A4FA09 for ; Tue, 14 Jul 2020 20:00:44 +0000 (UTC) X-HE-Tag: fold02_320e25526ef3 X-Filterd-Recvd-Size: 4650 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jul 2020 20:00:42 +0000 (UTC) IronPort-SDR: ivprWIvJEVO77IkP2SwK4SCTkdArUsVzN1iQ04v2eNM1zLyUUCjrq28B+CR1aD/nSoTDbcvtLc YCmxZgKDPd7Q== X-IronPort-AV: E=McAfee;i="6000,8403,9682"; a="128579690" X-IronPort-AV: E=Sophos;i="5.75,352,1589266800"; d="scan'208";a="128579690" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2020 13:00:41 -0700 IronPort-SDR: 4MS2nxEKSwXjwkPrhbmJP1OzdSRAj8lQAiaaHjC1Noo6yhxlz0lTa5uR4dcxyj5kZWZTGL1LmE m/OZlhrKMlvg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,352,1589266800"; d="scan'208";a="299658353" Received: from iweiny-desk2.sc.intel.com ([10.3.52.147]) by orsmga002.jf.intel.com with ESMTP; 14 Jul 2020 13:00:40 -0700 Date: Tue, 14 Jul 2020 13:00:40 -0700 From: Ira Weiny To: Dave Hansen Cc: Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , x86@kernel.org, Dave Hansen , Dan Williams , Vishal Verma , Andrew Morton , Fenghua Yu , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [RFC PATCH 12/15] kmap: Add stray write protection for device pages Message-ID: <20200714200040.GF3008823@iweiny-DESK2.sc.intel.com> References: <20200714070220.3500839-1-ira.weiny@intel.com> <20200714070220.3500839-13-ira.weiny@intel.com> <20200714084451.GQ10769@hirez.programming.kicks-ass.net> <20200714190615.GC3008823@iweiny-DESK2.sc.intel.com> <20200714192930.GH5523@worktop.programming.kicks-ass.net> <50d472d8-e4d9-dd35-f31f-268aa69c76e2@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50d472d8-e4d9-dd35-f31f-268aa69c76e2@intel.com> User-Agent: Mutt/1.11.1 (2018-12-01) X-Rspamd-Queue-Id: 5CA7750001A4FA09 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jul 14, 2020 at 12:42:11PM -0700, Dave Hansen wrote: > On 7/14/20 12:29 PM, Peter Zijlstra wrote: > > On Tue, Jul 14, 2020 at 12:06:16PM -0700, Ira Weiny wrote: > >> On Tue, Jul 14, 2020 at 10:44:51AM +0200, Peter Zijlstra wrote: > >>> So, if I followed along correctly, you're proposing to do a WRMSR per > >>> k{,un}map{_atomic}(), sounds like excellent performance all-round :-( > >> Only to pages which have this additional protection, ie not DRAM. > >> > >> User mappings of this memory is not affected (would be covered by User PKeys if > >> desired). User mappings to persistent memory are the primary use case and the > >> performant path. > > Because performance to non-volatile memory doesn't matter? I think Dave > > has a better answer here ... > > So, these WRMSRs are less evil than normal. They're architecturally > non-serializing instructions, just like the others in the SDM WRMSR > documentation: > > Note that WRMSR to the IA32_TSC_DEADLINE MSR (MSR index 6E0H) > and the X2APIC MSRs (MSR indices 802H to 83FH) are not > serializing. > > This section of the SDM needs to be updated for the PKRS. Also note > that the PKRS WRMSR is similar in its ordering properties to WRPKRU: > > WRPKRU will never execute speculatively. Memory accesses > affected by PKRU register will not execute (even speculatively) > until all prior executions of WRPKRU have completed execution > and updated the PKRU register. > > Which means we don't have to do silliness like LFENCE before WRMSR to > get ordering *back*. This is another tidbit that needs to get added to > the SDM. It should probably also get captured in the changelog. > > But, either way, this *will* make accessing PMEM more expensive from the > kernel. No escaping that. But, we've also got customers saying they > won't deploy PMEM until we mitigate this stray write issue. Those folks > are quite willing to pay the increased in-kernel cost for increased > protection from stray kernel writes. Intel is also quite motivated > because we really like increasing the number of PMEM deployments. :) > > Ira, can you make sure this all gets pulled into the changelogs somewhere? Yes of course. Thanks for writing that up. Ira