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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham 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 8DA76C4160E for ; Tue, 2 Mar 2021 22:11:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7207664F3C for ; Tue, 2 Mar 2021 22:11:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2359723AbhCBWCm (ORCPT ); Tue, 2 Mar 2021 17:02:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234519AbhCBTVJ (ORCPT ); Tue, 2 Mar 2021 14:21:09 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C803DC06178A for ; Tue, 2 Mar 2021 11:20:24 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id u12so2690025pjr.2 for ; Tue, 02 Mar 2021 11:20:24 -0800 (PST) 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=nTR1gSY8AyYBmlkN5NsyaE59tkLRlPt3XQnuP/gtEls=; b=FYAaFJLMeUfXUwWCbf1ENPmBFy0H5/UzPli0k0XMaUSiA/XyNFmOM6M8gz9PTSZzPd 4oy+ZkmwVTFba1Hy/LJ45HqVSbLbMMmYiBYbqM9DkazTMipXqfsdXX/HFVdG0Kg+PG4/ Jw9G6Lrh5c/pwwUjafGnSmAVGjiSknjwRA3/XmN/SL9Y3xwir4FQ4qjnWGMRZ1K7Gs06 +l2/f67IZKCQ1cXg6+U/bxe8sekLMG7htcF5LHJXbyQ9/Fk8nAF5RRUbUb8MGQ07p/4x ctydUAtxPAvChUQdFQa7d+JC1eps48K7ZiNO+/glmI+fX+SSaJBnbXdOcOEAzQZgvyXn XAlw== 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=nTR1gSY8AyYBmlkN5NsyaE59tkLRlPt3XQnuP/gtEls=; b=ABVId2p5bBg3LMr8Vj9fzkBfndk2yfmUgoHyFBmLgA/27iOw+dyH7vG3Id1JZBkDZ3 PVHKB06X3u28Mko0gJrCY7ubjdIH20JYVoR3LK/LawvLpMiKyLMwMLwTEUUz29tMcVeP zILhZPpInHJCulEAXrqAo4z8ZBaEEXrktyf1A4PcyOjsUeTIPSiM7BKhSoW7sun+vgh0 SfrmaEmDl4GStAKBoShTiwtNmag4eyg1pHsUyGWNU+irPYpVjqnRFQ4lzn15dOekcD/P in0vqENtLLqPT4AJHs9xMMWACEFgbjkep4wgkoJUsSOVWI352TdmaxdRxgxteB+d8xq6 CzMw== X-Gm-Message-State: AOAM5300GIvs7gn4OGR+l1fT0eVFFakvQAfLYBxxfpNIgB2UCTSliswV 2UAIhEdaI6aKmz6FZrrpTp0nYQ== X-Google-Smtp-Source: ABdhPJzCY3Cp3rFD0UgLcAl5GfX9tJC8u7gu1D91cETA8vt2rNf28lrXCjk6d40ldU7B1AsGIPtJew== X-Received: by 2002:a17:902:9d82:b029:e4:b5a9:ff9f with SMTP id c2-20020a1709029d82b02900e4b5a9ff9fmr4944015plq.75.1614712824062; Tue, 02 Mar 2021 11:20:24 -0800 (PST) Received: from google.com ([2620:15c:f:10:805d:6324:3372:6183]) by smtp.gmail.com with ESMTPSA id w128sm22095590pfw.86.2021.03.02.11.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 11:20:23 -0800 (PST) Date: Tue, 2 Mar 2021 11:20:17 -0800 From: Sean Christopherson To: Babu Moger Cc: pbonzini@redhat.com, wanpengli@tencent.com, kvm@vger.kernel.org, joro@8bytes.org, x86@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, vkuznets@redhat.com, tglx@linutronix.de, jmattson@google.com Subject: Re: [PATCH] KVM: SVM: Clear the CR4 register on reset Message-ID: References: <161471109108.30811.6392805173629704166.stgit@bmoger-ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161471109108.30811.6392805173629704166.stgit@bmoger-ubuntu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 02, 2021, Babu Moger wrote: > This problem was reported on a SVM guest while executing kexec. > Kexec fails to load the new kernel when the PCID feature is enabled. > > When kexec starts loading the new kernel, it starts the process by > resetting the vCPU's and then bringing each vCPU online one by one. > The vCPU reset is supposed to reset all the register states before the > vCPUs are brought online. However, the CR4 register is not reset during > this process. If this register is already setup during the last boot, > all the flags can remain intact. The X86_CR4_PCIDE bit can only be > enabled in long mode. So, it must be enabled much later in SMP > initialization. Having the X86_CR4_PCIDE bit set during SMP boot can > cause a boot failures. > > Fix the issue by resetting the CR4 register in init_vmcb(). > > Signed-off-by: Babu Moger Cc: stable@vger.kernel.org The bug goes back too far to have a meaningful Fixes. Reviewed-by: Sean Christopherson On a related topic, I think we can clean up the RESET/INIT flows by hoisting the common code into kvm_vcpu_reset(). That would also provide good motivation for removing the init_vmcb() call in svm_create_vcpu(), which is fully redundant with the call in svm_vcpu_reset(). I'll put that on the todo list.