Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp981523pxp; Wed, 16 Mar 2022 23:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZMbIVl3Dq2k/tBqyRpgwhG/GA1xKYmz3qDQ4Hhl4Y11xqLqi8/C2kRuTrjMpumTdUFWo8 X-Received: by 2002:a17:903:11cf:b0:153:4723:61de with SMTP id q15-20020a17090311cf00b00153472361demr3504409plh.50.1647498181283; Wed, 16 Mar 2022 23:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647498181; cv=none; d=google.com; s=arc-20160816; b=alanpfF6oFPIAZOKDeOHXlLEUs17RDOteRuDJ+Ep1sMixbvkVojhATwHMm29TwZuJd XolfrL5Jg4YB9JnvWNay1E5N+NCuTstvEd/9oJr1/fL/Vm9JhfbmSe1apVeHEbPlZA29 gltf6L7DPegLFELe3wncN1iyCyyq8NYNIi2CLrh/Pa6+86VawdAhYC+Zvs4TU6kD2hbr I+Jb3kk7GEFWUDLuiymerQMKC773VAhxpxiS91khJ3vt4Ss17EyMJYnqw8nzFyjyFZe2 e0T1wqXNq4iR2gMYX6QU7kGgDZ+itdUtUe0nnaR5VMSEoyrTw0/p31iOLxM8o1jL3qzJ seGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=8A3cxPbkf5/imDcGfqUsgEkAZ/Yq4pAldU3s8K2mQzc=; b=kcL8+e7T2c7pysNEm/Ov6WQILBw4AS83RPCLjN8NnHTW+ZH5a0UIVF5qEMzIGD45Wl 676gZkdjNuERIDhrMU4OTPPM/jqG5u7X2+vlsOPdh0N7+EeQl1/28xdAmh067OhLoyHb EBFANhs+mtp79Qae9OUAQxMcZhQtwvA95R2oF+un9AeGhlYHv4XnSUBkdvflJFSe/aU1 +pBGLy9T3o/7uBKDRa5ZM7wuZiE/HXqmZXfw6+LxLL6sSk0jsyb3bYBezMB1gC9xE2Xy 4F6bp3NCbk7mGNa3s54/ge8UFz8ip8G36M5G88x8MqxIOuCPm1+lqN+yDxzKCt8nF6nZ hriQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tfX+LbUt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t3-20020aa79383000000b004f6d4447a93si3520781pfe.360.2022.03.16.23.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 23:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=tfX+LbUt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C425026A965; Wed, 16 Mar 2022 22:08:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243436AbiCNRgN (ORCPT + 99 others); Mon, 14 Mar 2022 13:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234321AbiCNRgL (ORCPT ); Mon, 14 Mar 2022 13:36:11 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A9C2659B for ; Mon, 14 Mar 2022 10:35:00 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id s25so28474466lfs.10 for ; Mon, 14 Mar 2022 10:35:00 -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=SssiOr4v1twNh3mvOQHBQP8fIfXQk6gXjEEjQQO/FZb1HAGqCrcKPxb/RlIF9TW9D6 ZeCvRHN8Nci96aN8hS/fDtQuo4S4Mb0vWk+Xq3Z844CUCnKj7fdte2BkJ0qSqXsZjLN2 Gh6AnaAPxjCcZrntYga9fpo/YN2vmwUcY8sO//O/xSXGwrnhO0722axy5h7j11IDd/XS i1zJApLyb4s4wgeTq7WY2eV8L1W+hWNs9tdEJ72aV15Xut49r666rnoKU86Lv5/CXVsG p1v+nXf7dGr6mO0yITQqeRedkWLuhIzHP+x9EMIWb6pNLEZlnkzas9qQ1uyIUElPbwLa G+zQ== X-Gm-Message-State: AOAM530RXbVNdvS5iIKJzuTJ1THwsTa3a2lxNi127lfgKoDYOabCHWiE Qc3MKkRshfydpGU+RymPGJpnL2jImOfkRGKLyE1cow== 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-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >