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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 208EAC433F5 for ; Mon, 14 Mar 2022 17:34:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AF1C6B0072; Mon, 14 Mar 2022 13:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 75F088D0002; Mon, 14 Mar 2022 13:34:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 600F48D0001; Mon, 14 Mar 2022 13:34:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id 517356B0072 for ; Mon, 14 Mar 2022 13:34:57 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 00FAA9F868 for ; Mon, 14 Mar 2022 17:34:57 +0000 (UTC) X-FDA: 79243692234.20.A7BED84 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf21.hostedemail.com (Postfix) with ESMTP id 2D1C51C001C for ; Mon, 14 Mar 2022 17:34:56 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id w12so28462349lfr.9 for ; Mon, 14 Mar 2022 10:34:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=8A3cxPbkf5/imDcGfqUsgEkAZ/Yq4pAldU3s8K2mQzc=; b=tfX+LbUtQWULAhzeWtmsYWPMAURZzqdsjSM/aDGl+qglrfZ5bNzfGleMtHFaTt3jZv 3UyQ5yndXqQ8IyXR6tjdhKwpYv9aaculLUgdA6PMil4v28IhdiEX2uhZI0KYNH460tQ6 GKcfKXGVcGVxcLcjPvKm3Y+xr7jKp0lTmNP15knWHThq1yVvN8ocGYyB/el//U+71WsO 9kxkVPpZ6bjpiPklFVZMRSxBgbjd89SZz6rNYPQo0Uto/u5sjUUJwJwIeOikglGO6VNE lvYLAnfBrGRNUOM81j19C9LApg+tiwD55XcFvJbf4tDEynsa5BMJpjgefQARvNRiNVXn Zf9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=8A3cxPbkf5/imDcGfqUsgEkAZ/Yq4pAldU3s8K2mQzc=; b=mdhgiHSSot0j55FPCnUU3/UP+dFNMbAekB7tVXtBozSROmo4jxJTn6F7X1cldEY3r5 ODSUNbcgFEW2FzP4HtE6QT46rOahAVtp38qvKIJlUHuuMk3MdepkuxR8yyvH2vwSAj8n OXlUraBhH4Y+/HFJ2+ec3xHIO2lanvFC5eYt9icUAl0zipOrCb04zWac4mnp6/zATOpV IsPSaDQRtPKVC1flbz2VHijxEDIrSBZ/dBhfb+U2IS4dKZVRZNN1bk6SJIW+0DqOXj36 /5mVSzCfZ+xjs6N3BxVQ0lukVbV+DOrM6jmuhoil3pQBjQr1FNE43TJVh6xLAozt9bvd XwJw== X-Gm-Message-State: AOAM533jlEux9Ih7R95yUVm4Y809f6wrDKmMcmX5TqS15nvy78oicEum jb43xDrPQSSmvUXA4FotzTXRd7tHH88QI+9AIJpLkQ== X-Google-Smtp-Source: ABdhPJwyJUQnuBymc31Rm47cQ/NdVZrkI9p8VQjPdQxJrZbxv7kE4yinBibZy7OcE53BDtGYf0q134NUBFysmwbOxgc= X-Received: by 2002:a19:ca07:0:b0:448:7eab:f1a with SMTP id a7-20020a19ca07000000b004487eab0f1amr7790394lfg.456.1647279294144; Mon, 14 Mar 2022 10:34:54 -0700 (PDT) MIME-Version: 1.0 References: <20220307213356.2797205-1-brijesh.singh@amd.com> <20220307213356.2797205-33-brijesh.singh@amd.com> <20220310212504.2kt6sidexljh2s6p@amd.com> In-Reply-To: From: Peter Gonda Date: Mon, 14 Mar 2022 11:34:42 -0600 Message-ID: Subject: Re: [PATCH v12 32/46] x86/compressed/64: Add support for SEV-SNP CPUID table in #VC handlers To: Joerg Roedel Cc: Michael Roth , Brijesh Singh , "the arch/x86 maintainers" , LKML , kvm list , linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , Vlastimil Babka , "Kirill A . Shutemov" , Andi Kleen , "Dr . David Alan Gilbert" , brijesh.ksingh@gmail.com, Tony Luck , Marc Orr , Sathyanarayanan Kuppuswamy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: j3pdxu8apu7a1xa4gsg7wccnfehjbxqq Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=tfX+LbUt; spf=pass (imf21.hostedemail.com: domain of pgonda@google.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=pgonda@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2D1C51C001C X-HE-Tag: 1647279296-269417 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, Mar 11, 2022 at 10:06 AM Joerg Roedel wrote: > > On Thu, Mar 10, 2022 at 03:25:04PM -0600, Michael Roth wrote: > > Joerg, do you have more background on that? Would it make sense, outsid= e > > of this series, to change it to a terminate? Maybe with a specific set > > of error codes for ES_{OK,UNSUPPORTED,VMM_ERROR,DECODE_FAILED}? > > This seems to be a left over from development of the SEV-ES guest > patch-set. I wanted to see whether the VM crashed due to a triple fault > or an error in the #VC handler. The halt loop can be replaced by > termination request now. > > > > I am still working on why the early_printk()s in that function are no= t > > > working, it seems that they lead to a different halt. > > > > I don't see a different halt. They just don't seem to print anything. > > (keep in mind you still need to advance the IP or else the guest is > > still gonna end up spinning here, even if you're removing the halt loop > > for testing purposes) > > The early_printks() also cause #VC exceptions, and if that handling is > broken for some reason nothing will be printed. > > > > > > working, it seems that they lead to a different halt. Have you tested > > > any of those error paths manually? For example if you set your CPUID > > > bits to explicitly fail here do you see the expected printks? > > > > I think at that point in the code, when the XSAVE stuff is setup, the > > console hasn't been enabled yet, so messages would get buffered until t= hey > > get flushed later (which won't happen since there's halt loop after). I > > know in some cases devs will dump the log buffer from memory instead to= get > > at the error messages for early failures. (Maybe that's also why Joerg > > decided to use a halt loop there instead of terminating?) > > It is hard to dump the log-buffer from encrypted memory :) But I > remember having seen messages from these early_printks under SEV-ES for > different bugs. Not sure why they don't appear in this situation. > > > So maybe reworking the error handling in handle_vc_boot_ghcb() to use > > sev_es_terminate() might be warranted, but probably worth checking with > > Joerg first, and should be done as a separate series since it is not > > SNP-related. > > I am fine with this change. I'll send a patch out for that. I was also thinking about adding a vcpu run exit reason for termination. It would be nice to get a more informative exit reason than -EINVAL in userspace. Thoughts? > > Regards, > > -- > J=C3=B6rg R=C3=B6del > jroedel@suse.de > > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5 > 90409 N=C3=BCrnberg > Germany > > (HRB 36809, AG N=C3=BCrnberg) > Gesch=C3=A4ftsf=C3=BChrer: Ivo Totev >