public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Lalancette <clalance@redhat.com>
To: kvm-devel@lists.sourceforge.net
Cc: Avi Kivity <avi@qumranet.com>
Subject: [PATCH]: Fix MSR_K7_EVNTSEL{0,3} for SVM
Date: Wed, 23 Apr 2008 14:23:14 -0400	[thread overview]
Message-ID: <480F7E92.6030709@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

Avi, Joerg,
     While trying to boot a RHEL-4 guest on latest KVM tip on an AMD machine, I
found that the guest would consistently crash when trying to setup the NMI
watchdog.  I traced it down to the following commit:

51ef1ac7b23ee32bfcc61c229d634fdc1c68b38a

It seems that in that commit, the K7_EVNTSEL MSR's were set to fail if the data
!= 0.  That test is actually fine, the problem is how the code around it is
generated.  That is, we are only supposed to go to unhandled if data != 0; but
for some reason, we are *always* going to unhandled, even when the data == 0.
That causes RHEL-4 kernel to crash.  If I rearrange the code to look like this:

	case MSR_K7_EVNTSEL0:
	case MSR_K7_EVNTSEL1:
	case MSR_K7_EVNTSEL2:
	case MSR_K7_EVNTSEL3:

		if (data != 0)
			return kvm_set_msr_common(vcpu, ecx, data);
		
	default:
		return kvm_set_msr_common(vcpu, ecx, data);
	}

Then everything works again.  A patch that does just this is attached.  It might
be slightly nicer to say "if (data == 0) return 0" and then just fall through to
the default case, but I don't much care either way.

Signed-off-by: Chris Lalancette <clalance@redhat.com>

[-- Attachment #2: kvm-66-msr-k7.patch --]
[-- Type: text/x-patch, Size: 463 bytes --]

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 89e0be2..ef550d7 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1291,10 +1291,9 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
 		 * performance counter emulation later.
 		 */
 		if (data != 0)
-			goto unhandled;
-		break;
+			return kvm_set_msr_common(vcpu, ecx, data);
+		
 	default:
-	unhandled:
 		return kvm_set_msr_common(vcpu, ecx, data);
 	}
 	return 0;

[-- Attachment #3: Type: text/plain, Size: 320 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

[-- Attachment #4: Type: text/plain, Size: 158 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

             reply	other threads:[~2008-04-23 18:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23 18:23 Chris Lalancette [this message]
2008-04-24  7:35 ` [PATCH]: Fix MSR_K7_EVNTSEL{0,3} for SVM Avi Kivity
     [not found]   ` <4810926E.3070900@redhat.com>
2008-04-24 15:20     ` Avi Kivity
2008-04-24 15:44       ` Chris Lalancette
2008-04-24 22:13       ` Chris Lalancette
2008-04-25  7:30         ` Avi Kivity
2008-04-25 13:06           ` Chris Lalancette
2008-04-25 18:43           ` Chris Lalancette
2008-04-28 12:46             ` Joerg Roedel
2008-04-28 14:17               ` Chris Lalancette
2008-04-28 15:57                 ` Joerg Roedel
2008-04-28 16:38                   ` Chris Lalancette
2008-04-28 16:41                 ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=480F7E92.6030709@redhat.com \
    --to=clalance@redhat.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox