From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bandan Das Subject: Re: [PATCH] Use WARN_ON_ONCE for missing X86_FEATURE_NRIPS Date: Tue, 06 Oct 2015 13:59:27 -0400 Message-ID: References: <560D1C6E.2060803@suse.com> <560D278F.10801@redhat.com> <20151006102838.GD20886@8bytes.org> Mime-Version: 1.0 Content-Type: text/plain Cc: Paolo Bonzini , kvm@vger.kernel.org, Dirk =?utf-8?Q?M=C3=BCller?= To: Joerg Roedel Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56715 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752611AbbJFR7a (ORCPT ); Tue, 6 Oct 2015 13:59:30 -0400 In-Reply-To: <20151006102838.GD20886@8bytes.org> (Joerg Roedel's message of "Tue, 6 Oct 2015 12:28:38 +0200") Sender: kvm-owner@vger.kernel.org List-ID: Joerg Roedel writes: > On Thu, Oct 01, 2015 at 06:31:27PM -0400, Bandan Das wrote: >> >> @@ -514,7 +514,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) >> >> struct vcpu_svm *svm = to_svm(vcpu); >> >> >> >> if (svm->vmcb->control.next_rip != 0) { >> >> - WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS)); >> >> + WARN_ON_ONCE(!static_cpu_has(X86_FEATURE_NRIPS)); >> >> svm->next_rip = svm->vmcb->control.next_rip; >> >> } > > I looked again how this could possibly be triggered, and I am somewhat > confused now. > > So svm->vmcb->control.next_rip is only written by hardware or in > svm_check_intercept(). Both cases write only to this field, if the > hardware supports X86_FEATURE_NRIPS. The write in nested_svm_vmexit only Not until commit f104765b4f81fd74d69e0eb161e89096deade2db. So, an older L1 kernel will trigger it. > targets the guests VMCB, and we don't use that one again. > > So I can't see how the WARN_ON above could be triggered. Do I miss > something or might this also be a miscompilation of static_cpu_has? > > > Joerg