Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1924228ybe; Thu, 12 Sep 2019 01:32:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyLmCgoJ3IyTTIjpz1SjPKx+GdhvwyT2pYdsOY20sywIwcWiN19+J35gA997zpgjT5HIHf X-Received: by 2002:a50:de8f:: with SMTP id c15mr41188571edl.47.1568277132494; Thu, 12 Sep 2019 01:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568277132; cv=none; d=google.com; s=arc-20160816; b=nXlbBkQVWlKyMe47Iknp3VrVTpx9trurKnLe3utaGGKsOtPhg0cjokkNNpV5//8De+ KeurdhJ97y1TMwlt3dWt+qStcIQHQ/21IzK/KHo+i6WPWDhPS3RNwRLvEVgBAh6KTnjV mTpFJXntCBaS8DR3L91uCpmPv8W+jhpTmQwDsj3TqgZcOcwxpzHFmUqTSjWuGnkfOjl6 skIMx/A7qRzgYN6+IDGMhRViA/Nlv/xlZ9+GVBVhrgyTzw1zmCWg8WxqWNNskzWLRBpM I/h0vbrcBadGvyDpBbN8bgx4CPE8c6NvBM6lC7BqU5hpDjaHzTJtXdWXRPLt4NNuMZJQ oG8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=vHhZUkG2iqN2iDqFfNX3OOGVNrN4leZfadAd1Ak+VM0=; b=wJOac3Omz5hPDBcH8O+sR6MPo4vpioHllflIHj+fhmRN+qxICXXZlvY8185Y1R3LvS ps29NHM6zNRZ7AhU0g4G9Yu2IQCGcSDNnQ2Uxbb9bVdUSTj1H3y37MeNsUsdebmEhhlJ FWm5oZOk9792KBMWQ9USrgMPaZ9aCzLzADnoUiSKku6KoJIeaJhH34rUVK9bzvUPoDr2 yiZKhsfIKFAOibZsH636Uh8HNr9ixJxo5xFavhZAuCKb20pIVZ2bCHXp2+HNY5MftdsP DQ/iqkf4BFR1mM/HoZe7rEWWeWgQVTBaw12QC9OcNBJTO9mZ744l8GiId2S0djUEhW7N 9pNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=m7EarGvP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s27si14830698edm.226.2019.09.12.01.31.49; Thu, 12 Sep 2019 01:32:12 -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; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=m7EarGvP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730263AbfILI3h (ORCPT + 99 others); Thu, 12 Sep 2019 04:29:37 -0400 Received: from ste-pvt-msa1.bahnhof.se ([213.80.101.70]:42115 "EHLO ste-pvt-msa1.bahnhof.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728296AbfILI3h (ORCPT ); Thu, 12 Sep 2019 04:29:37 -0400 Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTP id 675743F91C; Thu, 12 Sep 2019 10:29:33 +0200 (CEST) Authentication-Results: ste-pvt-msa1.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=m7EarGvP; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Flag: NO X-Spam-Score: -2.099 X-Spam-Level: X-Spam-Status: No, score=-2.099 tagged_above=-999 required=6.31 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Received: from ste-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (ste-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lpajRat96fZa; Thu, 12 Sep 2019 10:29:32 +0200 (CEST) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id 187F93F90F; Thu, 12 Sep 2019 10:29:25 +0200 (CEST) Received: from localhost.localdomain (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) by mail1.shipmail.org (Postfix) with ESMTPSA id 4FB84360187; Thu, 12 Sep 2019 10:29:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1568276965; bh=luKDkBGIFmeg9bXDWjkTh1tEq+rY9j/prCNGFv7UA68=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=m7EarGvPqZJGHyI5Mku4zUjIPhls4jBtfan2rMTPFQrq21B4f42Y0Kt4NG7VFrOmQ dwPEx0Ms6F8kyFFKJ/7uhNgTmSYZrF3CscC9oht0cJfcPWTR3cnVMJvlR6vsJJ1rri GzJePCNSVwIBO+qKLF1HjOH+Zj5jGnwp8WkymGy8= Subject: Re: [RFC PATCH 1/2] x86: Don't let pgprot_modify() change the page encryption bit To: Andy Lutomirski Cc: Christoph Hellwig , Dave Hansen , LKML , X86 ML , pv-drivers@vmware.com, Thomas Hellstrom , Dave Hansen , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , =?UTF-8?Q?Christian_K=c3=b6nig?= , Marek Szyprowski , Tom Lendacky References: <20190905103541.4161-1-thomas_os@shipmail.org> <20190905103541.4161-2-thomas_os@shipmail.org> <608bbec6-448e-f9d5-b29a-1984225eb078@intel.com> <20190905152438.GA18286@infradead.org> <10185AAF-BFB8-4193-A20B-B97794FB7E2F@amacapital.net> <92171412-eed7-40e9-2554-adb358e65767@shipmail.org> <76f89b46-7b14-9483-e552-eb52762adca0@shipmail.org> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28VMware=29?= Organization: VMware Inc. Message-ID: <2d7a87c5-a5b2-2df4-5fd6-486fe2df2928@shipmail.org> Date: Thu, 12 Sep 2019 10:29:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/11/19 8:03 PM, Andy Lutomirski wrote: > >> That distinction is important because if it ever comes to a choice >> between adding a new lock to protect vm_page_prot (and consequently slow >> down the whole vm system) and using the WRITE_ONCE solution in TTM, we >> should know what the implications are. As it turns out previous choices >> in this area actually seem to have opted for the lockless WRITE_ONCE / >> READ_ONCE / ptl solution. See __split_huge_pmd_locked() and >> vma_set_page_prot(). > I think it would be even better if the whole thing could work without > ever writing to vm_page_prot. This would be a requirement for vvar in > the unlikely event that the vvar vma ever supported splittable huge > pages. Fortunately, that seems unlikely :) Yeah, for TTM the situation is different since we want huge vm pagesĀ  at some point. But I re-read __split_huge_pmd_locked() and it actually looks like vm_page_prot is only accessed for anonymous vmas. For other vmas, it appears it just simply zaps the PMD, relying on re-faulting the page table enries if necessary (as also suggested by Christian in another thread). So perhaps we should be good never writing to vm_page_prot. /Thomas