Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3979797pxf; Tue, 16 Mar 2021 02:40:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRrLnp6If+7gHEIp7G65G6V3nipv8u/CPLAC960vfIDbK8nBXqLBsVrTGIwTsAwhIL74ic X-Received: by 2002:a17:906:380b:: with SMTP id v11mr29204891ejc.183.1615887603838; Tue, 16 Mar 2021 02:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615887603; cv=none; d=google.com; s=arc-20160816; b=ALRf1Iu2zEf+icrWGDrZwRQsvFcYKzHbOHshRxBquJdjwHT8Upaz5Gz6ETpcRFWtSQ Y3kCj+VZZGZtwGH4sKAV5V7XMW8/qiNNK6zQAhhX2vTVD2JU8ajJ97j0X3f24QNkdIE+ edLqFF4/AlYz2+G1VjZH/H3ow8kRwvHmWH8kdwdMCZ0LV/Wtt7ArAR29Vafz9NJvLX9Q gbsmQ0LZGCf8TYRrzRHq+HaAVNyYVV1t0b2j8rHWVVp472u9fFJgp6O+f0fUg2Bl++Nb 6mX2I5YnZRqkyUBmPg5fuKFgdUzvhFs0tXRomIBA1SWJfdNWDEElkQJVv1pQRU5albJp FBUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=BVQIkfpEdKs4pIjfXI9dulTLMGkoy0O0vXFsicNI+UY=; b=wcgxMp8J5zcYWfCq9NNx8tsVYmXe/JykoHEc/vPO/eGPDY3lzYm3HUpiE1QamE8ISt s19VPv3iZcTzcpkwULvV9V8H9H5orgzI24EZgVptU5hsaBGJApYVccZBbSPKkAyTEUdK FWrMkLpTzp6OIZOZOpxuml8tnqtKQZZk9FhzP7MgzY5ZxpQ0Qw0wLih5UjvLG9KJvSaK 1tZnqXJl/A7sNQyFsgTsAp1SzZLyiYZ7p1i8MYR/7E76YUWeZ4E48uGmWBoH3FUteBS4 ZgTZ2WlPZ/ZkVMaSov2931BruIdn9fdDa8BJo+o0SwDfr6PvLSF3WA75KIvwnw17Vf0Y Gd+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rl1si12650187ejb.115.2021.03.16.02.39.40; Tue, 16 Mar 2021 02:40:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234891AbhCPIcs (ORCPT + 99 others); Tue, 16 Mar 2021 04:32:48 -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.