Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp862975ybl; Wed, 14 Aug 2019 07:08:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQ0rc18IqUGoTe3BLkU2K5H6KDWFz92ZsTvKvyg3ZePU4Kd30bFJfsn9Cx5WUN6wG+K7vt X-Received: by 2002:a17:90a:c386:: with SMTP id h6mr7283439pjt.122.1565791733539; Wed, 14 Aug 2019 07:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565791733; cv=none; d=google.com; s=arc-20160816; b=znBJs1VDBu9EPPNKijzDjpdMMmFl06iFxnjDS24SlnuLQuEDDfegGn8ACTjR081lQV lEiucnpUR90QRQnus+AnXnKVPfmjDX7aQEq7y++LqkWrCb8oBX3dMP3Twegxg1rAijZd DY79qQ6bU9weF+Pl9gfuBXdjx7StXwPIr24YMfCo4CBd53lmHBzDxJOyoHC0CrpewOvv jrz5GWtpba6coEL6wLebZ6BqqX9PsRRCAgp0uuU511lIgcX5NYmdiek1KQnPdFH2vCOU 9wvwWgQViWQ+jH8lRGoNl9Dsraud7D0fJjPkH3SGmfjThv2Wz75rjWlfrp8wB277Fcd9 BfTw== 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:openpgp:from:references:cc:to:subject; bh=n/0MfT9EW0M7U/nklrG8V8Yd0Iltg4541JOgSCkjXGo=; b=qXVKpeV9g62pYpJPGBNZXJoGC6brMuyOpK8XXmd+adoI/gyZGuhMcDPeNxuiM2BLVJ 7dQDGO7zzWeLG2pnNx+B+AbwNGK7YHLYehUW6bUJvP3mk+WIy5cDnCdweqY14Lte45PK iP5iX5EqvauM5oyvNno3BFqQNHXPfkcpOmP7URGjkusQBp9od21kQk2yM4GKRJ7pDaZC bkXWjSkQTN/d7+w/v2+wVfx9ums7gEUrkLY4KkepzC3A664DetjLjbgzyAXKKtdhTeSs b89/h4uWzMwh6Yu6tdIXuR9SwIEqj2vJyz93o2dTfQK7fHtutOBkcTQVsJBzuRJRh/Ko pCSQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10si2976843pjt.98.2019.08.14.07.08.36; Wed, 14 Aug 2019 07:08:53 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728010AbfHNOGL (ORCPT + 99 others); Wed, 14 Aug 2019 10:06:11 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51834 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726722AbfHNOGK (ORCPT ); Wed, 14 Aug 2019 10:06:10 -0400 Received: by mail-wm1-f66.google.com with SMTP id 207so4718202wma.1 for ; Wed, 14 Aug 2019 07:06:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=n/0MfT9EW0M7U/nklrG8V8Yd0Iltg4541JOgSCkjXGo=; b=eL6hAdGBMaLH6IM9vTtCOlIsp4SQ6Oa3P2FreIa5Lnuji2AiCyop1hsNULHATDaNpV h5SjEYWN/b0SKShkxxh1SgbierlrBxoS2ciNDoUpy/LIvxnxeQ7lBlkrzLQi2YWwOoDH cQNX/MPkLuehyZp7O69M8nCqGLoczgZ4WfX7KsWC22rcj3U3ldTjTvKPBnFgg+HEaez7 CkHKAvYCWD/LzIvKoeYZK51TZZbJsWXAQ1fPlHV8S48ftiOQr3EieBPYSXy3ZPL6xBsj uEdgKC7LnJ62DdnHriSs9kdIhQsFRgK/YRDn5Ryf5tNI2DXjssqncVgEF962XtCNaGhY tZOA== X-Gm-Message-State: APjAAAWjqiiWaHjVUg1PbSsHIUyT96fqgX2iXmFKeP9P72x3c66/PNE6 RR4bk/Yg5va/67YMliKD2kVaBg== X-Received: by 2002:a7b:c313:: with SMTP id k19mr8451686wmj.2.1565791568531; Wed, 14 Aug 2019 07:06:08 -0700 (PDT) Received: from [192.168.10.150] ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id k1sm17685794wru.49.2019.08.14.07.06.07 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 14 Aug 2019 07:06:07 -0700 (PDT) Subject: Re: [PATCH RESEND v4 0/9] Enable Sub-page Write Protection Support To: Yang Weijiang Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, sean.j.christopherson@intel.com, mst@redhat.com, rkrcmar@redhat.com, jmattson@google.com, yu.c.zhang@intel.com, alazar@bitdefender.com References: <20190814070403.6588-1-weijiang.yang@intel.com> <5db7a1fc-994f-f95b-5813-ffe1801dbfbc@redhat.com> <20190814140212.GA7625@local-michael-cet-test.sh.intel.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: <11c4dd6e-2d4f-f989-6fc8-a126550dce72@redhat.com> Date: Wed, 14 Aug 2019 16:06:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190814140212.GA7625@local-michael-cet-test.sh.intel.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 14/08/19 16:02, Yang Weijiang wrote: > On Wed, Aug 14, 2019 at 02:36:30PM +0200, Paolo Bonzini wrote: >> On 14/08/19 09:03, Yang Weijiang wrote: >>> EPT-Based Sub-Page write Protection(SPP)is a HW capability which allows >>> Virtual Machine Monitor(VMM) to specify write-permission for guest >>> physical memory at a sub-page(128 byte) granularity. When this >>> capability is enabled, the CPU enforces write-access check for sub-pages >>> within a 4KB page. >>> >>> The feature is targeted to provide fine-grained memory protection for >>> usages such as device virtualization, memory check-point and VM >>> introspection etc. >>> >>> SPP is active when the "sub-page write protection" (bit 23) is 1 in >>> Secondary VM-Execution Controls. The feature is backed with a Sub-Page >>> Permission Table(SPPT), SPPT is referenced via a 64-bit control field >>> called Sub-Page Permission Table Pointer (SPPTP) which contains a >>> 4K-aligned physical address. >>> >>> Right now, only 4KB physical pages are supported for SPP. To enable SPP >>> for certain physical page, we need to first make the physical page >>> write-protected, then set bit 61 of the corresponding EPT leaf entry. >>> While HW walks EPT, if bit 61 is set, it traverses SPPT with the guset >>> physical address to find out the sub-page permissions at the leaf entry. >>> If the corresponding bit is set, write to sub-page is permitted, >>> otherwise, SPP induced EPT violation is generated. >> >> Still no testcases? >> >> Paolo > > Hi, Paolo, > The testcases are included in selftest: https://lkml.org/lkml/2019/6/18/1197 > Good, thanks! Paolo