Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1597444rdb; Mon, 2 Oct 2023 14:58:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyvU22H2yNouVvRsRKHnHsgXrdU+QkBYAcBGgOJ+wwofOz4zItbJfn3FXV2OsTUqONzely X-Received: by 2002:a05:6a00:3a1a:b0:68f:f650:3035 with SMTP id fj26-20020a056a003a1a00b0068ff6503035mr11506040pfb.12.1696283905717; Mon, 02 Oct 2023 14:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696283905; cv=none; d=google.com; s=arc-20160816; b=rPFqlaxTDI/TuMeUxm2S2fQTi992DWKbTBG2izeUYM4P5PBgw0fD/LJuatEtF0bg13 rzRNXYmhnCjwF0acPhAjDH0S6hpXBYjb1nO96qOHaHvxD/5SwjRGeBQ+DmBkFH64AKGd B7jXhLtnYg4YFTbar7awJBLSiDgYN0aMYjtXwS4uQguV4ZZlhr1Lx8+x/Lw6KKrWf6LK CcWcrzUoOFD/m3V+Avti279kOEfsd6irxNfYOAk7qEzqxjfoOJ/nTBQcZSWkduSjDRaA gr8p0FcAKYW9yxWyMrmJtmO06hNtylWrdCaeLuNGksVvHYEGpOvd85Ut6iVRNrifv8hc DpAg== 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=Y86AWWtsD8deWIYd/tc86/npyfYKbgsHuTwpWzSR7k8=; fh=Re1u6cd4bZebZYUnqC5VfHpbIRNUqxbOinNX9nmulBg=; b=OkhT3SCsfek+0eFw3fXTka5fe1gtl4YrP32fuUy+ZFO1NjXwS2JaJ3ZV9ku77AaDUm ShuPjrMcNm4Ve92S/ySxsvbAo0sG8HUb4JoVdAFCt8KhWpjkq1AH/Fd2kRHQ5Bv/Ke4C zDD5relG1mFITq9iksYh9+2vZL3wrUnfU0M3yc+hKollejiAy5bjv0DzifSc2V5A+gqD XQun1iUJwwxFGp44uAaZ6pFpUZVY0YxpCfMc1qe0PWKC+Xktr9gqCVnwD+4W10y2g99+ QmqxdhnyxZTqukuxL9L0ekIftTTYvB2KJTOugkLjG7d8TBiqlkjMXoLJn/8gpOlQAFm5 1kMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mHvsPlAt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 126-20020a630284000000b00565f611a1f8si26933011pgc.263.2023.10.02.14.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 14:58:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mHvsPlAt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CC60F807759E; Mon, 2 Oct 2023 14:46:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235047AbjJBVql (ORCPT + 99 others); Mon, 2 Oct 2023 17:46:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230014AbjJBVqk (ORCPT ); Mon, 2 Oct 2023 17:46:40 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF644CE for ; Mon, 2 Oct 2023 14:46:37 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-277564f049dso166449a91.1 for ; Mon, 02 Oct 2023 14:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696283197; x=1696887997; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Y86AWWtsD8deWIYd/tc86/npyfYKbgsHuTwpWzSR7k8=; b=mHvsPlAtygwBG7QOJPNJ84ThlHeoSO+2YjSWSckdB1AMPvOvJyhnTqyjhuqcSUvnhq IP+KKXn39cdvnd7iCaM/6ROsDEqiSkYUy6QnHGzwMXMmq3EupjN3NS70qy5LQ16KNBeR 5BH/2GgXFdJPUlq5DrFF4bOftMDDl8I4Qp2on0zn9MNaKV7qwQ4tMxEZW0U14b9Ptulj ZCtCoVrl4eeICKWNPjmvlxakdV1zXfnW1gLVWGxentgrBmfGjDElen32DbSYHsGrc76v qlWxXYZrX2XvyIOgHW+ouF8QXBOMMeaB7cFHoxZfO4jiFKj9uPw/3VsVbScapatdhPLu qppw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696283197; x=1696887997; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y86AWWtsD8deWIYd/tc86/npyfYKbgsHuTwpWzSR7k8=; b=dfQc/OIObcfX6NZJU4QHeEb713PiYf/qx47L7gtk+NUDmOzejlXAR62sBje9PQTiPy 22NAcJwEXpW9Xf3KdRnPSyrfxro2MAwS6amB5VymHyJL+A9+0hS8BZe/Emy4STHy4uWW WbKfh9XqU4wUtvbl/e3fnVbBw3fKw5Bya/bfEzSFZyipz2nmgr3txTDnhEcQrEk6oDGM BVBovcyEO2inP0Y5eMmf+VSpbj+Qv3sY9FF7qhou22tPGHd2Z6ZzjRLPwx/cj8W9xTFX EEcr+LLA9K+0O3fgQPzQr4ZNkU04/vKhYtv9QXM4EKqAWB0ZcrdMSg746CJf+gbkC7eP m7/g== X-Gm-Message-State: AOJu0Yx5R279JniuJOa4eMP/4x3vdOQ210K4/qjOSzqmvFARQ6mrZ/1b 4hdeq8zuWCxdGUSLjTLoeslSdQgB6xmeJna1DaD5BQ== X-Received: by 2002:a17:90a:3884:b0:26b:49de:13bd with SMTP id x4-20020a17090a388400b0026b49de13bdmr9890126pjb.36.1696283197079; Mon, 02 Oct 2023 14:46:37 -0700 (PDT) MIME-Version: 1.0 References: <20230912002703.3924521-1-acdunlap@google.com> <20230912002703.3924521-3-acdunlap@google.com> <20231002200426.GA4127272@dev-arch.thelio-3990X> <8c99f8d2-247d-ccee-3a0b-e95e547f8b9b@intel.com> In-Reply-To: <8c99f8d2-247d-ccee-3a0b-e95e547f8b9b@intel.com> From: Adam Dunlap Date: Mon, 2 Oct 2023 14:46:25 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] x86/sev-es: Only set x86_virt_bits to correct value To: Dave Hansen Cc: Nathan Chancellor , linux-kernel@vger.kernel.org, x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Sean Christopherson , Kim Phillips , Juergen Gross , Ashok Raj , Joerg Roedel , Tom Lendacky , David Hildenbrand , Mike Rapoport , "Kirill A. Shutemov" , Nikunj A Dadhania , Dionna Glaze , Peter Gonda , David Rientjes , Khalid ElMously , Jacob Xu , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 14:46:45 -0700 (PDT) On Mon, Oct 2, 2023 at 2:41=E2=80=AFPM Dave Hansen = wrote: > > On 10/2/23 13:04, Nathan Chancellor wrote: > > On Mon, Sep 11, 2023 at 05:27:03PM -0700, Adam Dunlap wrote: > >> Instead of setting x86_virt_bits to a possibly-correct value and then > >> correcting it later, do all the necessary checks before setting it. > >> > >> At this point, the #VC handler references boot_cpu_data.x86_virt_bits, > >> and in the previous version, it would be triggered by the cpuids betwe= en > >> the point at which it is set to 48 and when it is set to the correct > >> value. > >> > >> Suggested-by: Dave Hansen > >> Signed-off-by: Adam Dunlap > > Our continuous integration started seeing panics when booting ARCH=3Di3= 86 > > without KVM after this change landed in -tip as commit fbf6449f84bf > > ("x86/sev-es: Set x86_virt_bits to the correct value straight away, > > instead of a two-phase approach"): > > I can't reproduce this, but I'm running a gcc-built kernel and I haven't > tried very hard to replicate your qemu setup. > > I did notice, though, that the patch in question forgot to move one > assignment. Could you see if the attached patch fixes things for you? I reproduced the issue as Nathan described and your attached patch fixes it for me.