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=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 B3866C07E9B for ; Mon, 19 Jul 2021 20:04:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3CCAD6112D for ; Mon, 19 Jul 2021 20:04:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CCAD6112D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 885B78D00F4; Mon, 19 Jul 2021 16:04:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 835838D00EC; Mon, 19 Jul 2021 16:04:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 688998D00F4; Mon, 19 Jul 2021 16:04:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 3B6728D00EC for ; Mon, 19 Jul 2021 16:04:54 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C84C0184A770F for ; Mon, 19 Jul 2021 20:04:52 +0000 (UTC) X-FDA: 78380415624.09.D3FDD0C Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf22.hostedemail.com (Postfix) with ESMTP id 902061937 for ; Mon, 19 Jul 2021 20:04:52 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id j3so10229202plx.7 for ; Mon, 19 Jul 2021 13:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=6mrIddCBqzP9Q52MJPTxcpi1gB+yoljcisd3OcU3iwY=; b=UWN1mAIBvoS4DLrVaNW+rWGV/OZ2BCPW1+LGCZCkgQnV1zqBepdR60rAsAMa59hVmO nAUA+PfURyO6iS6RnTJ/RAb2NwXk0KVXwdW6NfzkuMsV4Cqx+o0gFm9aqhJKswk+l3nR bNjZdMU+6WNseInEDkXhoGcgSsbVi+7dW6ND228Zz6niJ42x7HaEbUYFZznbuHQ2TRap gb8xMjdUuXKbVf9BD8weBoqPaxhQIyDMb9WWs558ZtLU6bie+ua0+N2mEt2UC4UUjikh UUTmXFdsL7HEujwsHb18XcFjh0PkGuAP9CZjgUN8nmIpuMxfPEwOGH3SSjtoD0x3IvKQ HtVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6mrIddCBqzP9Q52MJPTxcpi1gB+yoljcisd3OcU3iwY=; b=LIlkX+hsaCK4Ms99OF0Lxwmo8VpsO3uMawvYu58622/XdRTJr87x9l/c2Kfhu0pS3y bjNYfHPy4eigu4jdLvuBT5LsUAu1jNNPnBjiI/5gfCrtbdI+tQEnZjZYvw2XFgSBC7JP l0qDbRA2uPDT8xbXAdNxGNxPpiDFw/XXI/ChbX/OIY59naHHlKfZTUHjPS3VnMRKtsak wrIDET/VNUOuyvyej5ZyQw2iQa0vTLYKdjyQKsll4vwUHOWXHVurmCePLhbz3w5/alwZ zBvoCS3OBUEfYRsHnHrqjwe2l6gs07DQpWbLopG5lKRus4IXFJ1Gy8q3o84UpPllX6gF JW8A== X-Gm-Message-State: AOAM531WNCpXD3N3ThU0BnwcCjLOAeDaWRegjBRySxLDLZRq9vcaMoQK yovkQ5ifVFWblMUbnYqt1oJFQg== X-Google-Smtp-Source: ABdhPJyWwkctPggHtVzSznHpuN2o7lMFAaGwb6T+Lhzg1Hc0ZtDLw1R7db1DHG1Rcj+uWzfPnXseTw== X-Received: by 2002:a17:902:bcc3:b029:11c:5ffb:61fb with SMTP id o3-20020a170902bcc3b029011c5ffb61fbmr20657848pls.18.1626725091240; Mon, 19 Jul 2021 13:04:51 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id w5sm21451077pfq.130.2021.07.19.13.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 13:04:50 -0700 (PDT) Date: Mon, 19 Jul 2021 20:04:46 +0000 From: Sean Christopherson To: Brijesh Singh Cc: 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 , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , Michael Roth , Vlastimil Babka , tony.luck@intel.com, npmccallum@redhat.com, brijesh.ksingh@gmail.com Subject: Re: [PATCH Part2 RFC v4 32/40] KVM: SVM: Add support to handle GHCB GPA register VMGEXIT Message-ID: References: <20210707183616.5620-1-brijesh.singh@amd.com> <20210707183616.5620-33-brijesh.singh@amd.com> <35b1c6c6-b8f1-6ec6-e55c-f2e552e29527@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35b1c6c6-b8f1-6ec6-e55c-f2e552e29527@amd.com> Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=UWN1mAIB; spf=pass (imf22.hostedemail.com: domain of seanjc@google.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=seanjc@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam02 X-Stat-Signature: r7yiknuonzxmqza6pjazbopw7rpfz8x6 X-Rspamd-Queue-Id: 902061937 X-HE-Tag: 1626725092-141804 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 Fri, Jul 16, 2021, Brijesh Singh wrote: > > On 7/16/21 3:45 PM, Sean Christopherson wrote: > > On Wed, Jul 07, 2021, Brijesh Singh wrote: > >> + /* SEV-SNP guest requires that the GHCB GPA must be registered */ > >> + if (sev_snp_guest(svm->vcpu.kvm) && !ghcb_gpa_is_registered(svm, ghcb_gpa)) { > >> + vcpu_unimpl(&svm->vcpu, "vmgexit: GHCB GPA [%#llx] is not registered.\n", ghcb_gpa); > > I saw this a few other place. vcpu_unimpl() is not the right API. KVM supports > > the guest request, the problem is that the GHCB spec _requires_ KVM to terminate > > the guest in this case. > > What is the preferred method to log it so that someone debugging know > what went wrong. Using the kernel log is probably a bad choice in general for this error. Because this and the other GHCB GPA sanity checks can be triggered from the guest, any kernel logging needs to be ratelimited. Ratelimiting is problematic because it means some errors may not be logged; that's quite unlikely in this case, but it's less than ideal. The other issue is that KVM can't dump the RIP because guest state is encrypted, e.g. KVM can provide the task PID, but that's it. The best solution I can think of at the moment would be some form of KVM_EXIT_INTERNAL_ERROR, i.e. kick out to userspace with a meaningful error code and the bad GPA so that userspace can take action. I believe Jim also has some thoughts on how to improve "logging" of guest errors, but he's on vacation for a few weeks.