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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 DB6E4C433DB for ; Tue, 16 Mar 2021 08:33:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E84965006 for ; Tue, 16 Mar 2021 08:33:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234914AbhCPIcu (ORCPT ); Tue, 16 Mar 2021 04:32:50 -0400 Received: from 8bytes.org ([81.169.241.247]:59264 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234889AbhCPIcm (ORCPT ); Tue, 16 Mar 2021 04:32:42 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 9DB1B2DA; Tue, 16 Mar 2021 09:32:36 +0100 (CET) Date: Tue, 16 Mar 2021 09:32:35 +0100 From: Joerg Roedel To: Maxim Levitsky Cc: kvm@vger.kernel.org, Vitaly Kuznetsov , linux-kernel@vger.kernel.org, Thomas Gleixner , Wanpeng Li , Kieran Bingham , Jessica Yu , Jan Kiszka , Andrew Morton , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Sean Christopherson , Jim Mattson , Borislav Petkov , Stefano Garzarella , "H. Peter Anvin" , Paolo Bonzini , Ingo Molnar , Borislav Petkov Subject: Re: [PATCH 3/3] KVM: SVM: allow to intercept all exceptions for debug Message-ID: References: <20210315221020.661693-1-mlevitsk@redhat.com> <20210315221020.661693-4-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210315221020.661693-4-mlevitsk@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maxim, On Tue, Mar 16, 2021 at 12:10:20AM +0200, Maxim Levitsky wrote: > -static int (*const svm_exit_handlers[])(struct kvm_vcpu *vcpu) = { > +static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu) = { Can you keep this const and always set the necessary handlers? If exceptions are not intercepted they will not be used. > @@ -333,7 +334,9 @@ static inline void clr_exception_intercept(struct vcpu_svm *svm, u32 bit) > struct vmcb *vmcb = svm->vmcb01.ptr; > > WARN_ON_ONCE(bit >= 32); > - vmcb_clr_intercept(&vmcb->control, INTERCEPT_EXCEPTION_OFFSET + bit); > + > + if (!((1 << bit) & debug_intercept_exceptions)) > + vmcb_clr_intercept(&vmcb->control, INTERCEPT_EXCEPTION_OFFSET + bit); This will break SEV-ES guests, as those will not cause an intercept but now start to get #VC exceptions on every other exception that is raised. SEV-ES guests are not prepared for that and will not even boot, so please don't enable this feature for them.