From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web08.796.1620239065495134536 for ; Wed, 05 May 2021 11:24:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U8RGDB7t; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620239064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LR1KDdSTrQx9CQlKg+frhFGRwvuRDwAqB7h9viur7gw=; b=U8RGDB7t1WMPqplRY0bqyOJh7Y9Zh0WLO9FTUhlnSAgrO+R6uwaNYKYObsbRgVTGXNLt5U mcQOl+f5A0FuZAQrbaYNRoVwQWnw7rGhSJIw2wQ397d2lUG7t9PVK51/+duMDeoTrnga5X OUv/1A0Pks+bDnFacVNEZnXBnfUHVYU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-fXA97kP9Nt6J1i0o00QzUw-1; Wed, 05 May 2021 14:24:22 -0400 X-MC-Unique: fXA97kP9Nt6J1i0o00QzUw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FAB980ED91; Wed, 5 May 2021 18:24:20 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-136.ams2.redhat.com [10.36.113.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74A6A620DE; Wed, 5 May 2021 18:24:18 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH RFC v2 04/28] MdePkg: Define the Page State Change VMGEXIT structures To: devel@edk2.groups.io, brijesh.singh@amd.com Cc: James Bottomley , Min Xu , Jiewen Yao , Tom Lendacky , Jordan Justen , Ard Biesheuvel , Erdem Aktas References: <20210430115148.22267-1-brijesh.singh@amd.com> <20210430115148.22267-5-brijesh.singh@amd.com> <47d74104-dd86-8bb9-ba5e-6c0e7371d5e4@redhat.com> <1a6adb61-54d4-68bd-fca7-8e67a034e11f@amd.com> From: "Laszlo Ersek" Message-ID: <117c9e77-3f36-7a78-4ccb-2c4caa2bced7@redhat.com> Date: Wed, 5 May 2021 20:24:17 +0200 MIME-Version: 1.0 In-Reply-To: <1a6adb61-54d4-68bd-fca7-8e67a034e11f@amd.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 05/04/21 20:53, Brijesh Singh wrote: > > On 5/4/21 7:33 AM, Laszlo Ersek wrote: >> On 04/30/21 13:51, Brijesh Singh wrote: >>> +typedef PACKED struct { >>> + UINT16 CurrentEntry; >>> + UINT16 EndEntry; >>> + UINT32 Rsvd; >>> +} SNP_PAGE_STATE_HEADER; >> (9) If my understanding of the spec is correct, "EndEntry" has >> *inclusive* meaning. That's unusual. Any particular reason for not >> making "EndEntry" exclusive (in the spec)? > > Sometimes guest may need to fill only few entries. The "EndEntry" will > give hint to hypervisor that it should stop processing after it reached > to the EndEntry. I understood the purpose of EndEntry. My question is why the entry identified by EndEntry *itself* needs to be processed. Put differently, I'm asking why your loop controlling expression is Info->Header.CurrentEntry <= Info->Header.EndEntry [1] and why not Info->Header.CurrentEntry < Info->Header.EndEntry [2] in patch #21 ("OvmfPkg/MemEncryptSevLib: Add support to validate system RAM"). In case [1], EndEntry is an inclusive limit. In case [2], EndEntry would be an exclusive limit. My question is why the spec defines EndEntry with inclusive rather than exclusive meaning. Using inclusive low bounds with exclusive high bounds has mental advantages: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html Is there a specific reason for which the spec chose the inclusive high bound? Thanks Laszlo