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=-7.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 E711EC49361 for ; Wed, 16 Jun 2021 13:06:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 942DB61356 for ; Wed, 16 Jun 2021 13:06:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 942DB61356 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2C05F6B0070; Wed, 16 Jun 2021 09:06:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 26F636B0071; Wed, 16 Jun 2021 09:06:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 110616B0072; Wed, 16 Jun 2021 09:06:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0143.hostedemail.com [216.40.44.143]) by kanga.kvack.org (Postfix) with ESMTP id D39536B0070 for ; Wed, 16 Jun 2021 09:06:57 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7126E907F for ; Wed, 16 Jun 2021 13:06:57 +0000 (UTC) X-FDA: 78259612074.15.C91B612 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 7B9F7A00026F for ; Wed, 16 Jun 2021 13:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623848816; 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: in-reply-to:in-reply-to:references:references; bh=4FsZ+W5sZrXednhxFcSgtJDgo1UvbrnapydD3pMYxu0=; b=SbnoJVFbPc5m3jCfd3MfFq2/voG3/eKBafj6zQrzQ2K0/I5sr24JLyXz7iYGKn79hrhPIP F7vzhX9mVE5BUH25HHwyh1ihfYiAi/yLv/HwklIECiDwzSQ0C4xgJ3JM2X86NjuNwkKpn7 5SdknqJzhttPYRokwApNi9imHBNGmeA= 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-499-sU_-JDyPP9G0uvfGozhLNg-1; Wed, 16 Jun 2021 09:06:55 -0400 X-MC-Unique: sU_-JDyPP9G0uvfGozhLNg-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 BAC9E801B3E; Wed, 16 Jun 2021 13:06:51 +0000 (UTC) Received: from work-vm (ovpn-115-42.ams2.redhat.com [10.36.115.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA5666062C; Wed, 16 Jun 2021 13:06:44 +0000 (UTC) Date: Wed, 16 Jun 2021 14:06:42 +0100 From: "Dr. David Alan Gilbert" To: Brijesh Singh Cc: Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , tony.luck@intel.com, npmccallum@redhat.com Subject: Re: [PATCH Part1 RFC v3 11/22] x86/sev: Add helper for validating pages in early enc attribute changes Message-ID: References: <20210602140416.23573-1-brijesh.singh@amd.com> <20210602140416.23573-12-brijesh.singh@amd.com> <70db789d-b1aa-c355-2d16-51ace4666b3f@amd.com> <9f012bcb-4756-600d-6fe8-b1db9b972f17@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9f012bcb-4756-600d-6fe8-b1db9b972f17@amd.com> User-Agent: Mutt/2.0.7 (2021-05-04) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SbnoJVFb; spf=none (imf07.hostedemail.com: domain of dgilbert@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=dgilbert@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 7B9F7A00026F X-Stat-Signature: gf4k7pax1pnerr1af3fjetad638ut7dq X-HE-Tag: 1623848806-733136 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: * Brijesh Singh (brijesh.singh@amd.com) wrote: > > On 6/16/21 7:03 AM, Borislav Petkov wrote: > > On Wed, Jun 16, 2021 at 06:00:09AM -0500, Brijesh Singh wrote: > >> I am trying to be consistent with previous VMGEXIT implementations. If > >> the command itself failed then use the command specific error code to > >> tell hypervisor why we terminated but if the hypervisor violated the > >> GHCB specification then use the "general request termination". > > I feel like we're running in circles here: I ask about debuggability > > and telling the user what exactly failed and you're giving me some > > explanation about what the error codes mean. I can see what they mean. > > > > So let me try again: > > > > Imagine you're a guest owner and you haven't written the SNP code and > > you don't know how it works. > > > > You start a guest in the public cloud and it fails because the > > hypervisor violates the GHCB protocol and all that guest prints before > > it dies is > > > > "general request termination" > > > The GHCB specification does not define a unique error code for every > possible condition. Now that we have reserved reason set 1 for the > Linux-specific error code, we could add a new error code to cover the > cases for the protocol violation. I was highlighting that we should not > overload the meaning of GHCB_TERM_PSC. In my mind, the GHCB_TERM_PSC > error code is used when the guest sees that the hypervisor failed to > change the state . The failure maybe because the guest provided a bogus > GPA or invalid operation code, or RMPUPDATE failure or HV does not > support SNP feature etc etc. But in this case, the failure was due to > the protocol error, and IMO we should not use the GHCB_TERM_PSC. > Additionally, we should also update CPUID and other VMGEXITs to use the > new error code instead of "general request termination" so that its > consistent. > > > If you still think that GHCB_TERM_PSC is valid here, then I am okay with it. I'd kind of agree with Borislav, the more hints we can have as to the actual failure reason the better - so if you've got multiple cases where the guest thinks the hypervisor has screwed up, find a way to give an error code to tell us which one. Dave > -Brijesh > > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK