On 11/12/2009 03:05 PM, Gleb Natapov wrote:
On Thu, Nov 12, 2009 at 01:41:31PM +0100, Jan Kiszka wrote:
Gleb Natapov wrote:
On Wed, Nov 11, 2009 at 05:29:47PM -0200, Marcelo Tosatti wrote:
I suppose a complete fix would be to follow the "Conditions for
Generating a Double Fault" with support for handling exceptions
serially.
But this works for me.
I prefer proper solution. Like one attached (this is combination of ths
patch by Eddie Dong and my fix):
Nice, preferred here as well. I only have a minor comment below.
Move Double-Fault generation logic out of page fault
exception generating function to cover more generic case.
Signed-off-by: Eddie Dong<eddie.dong@xxxxxxxxx>
Signed-off-by: Gleb Natapov<gleb@xxxxxxxxxx>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 76c8375..88c4490 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -248,12 +248,61 @@ void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data)
}
EXPORT_SYMBOL_GPL(kvm_set_apic_base);
+#define EXCPT_BENIGN 0
+#define EXCPT_CONTRIBUTORY 1
+#define EXCPT_PF 2
+
+static int exception_class(int vector)
+{
+ if (vector == 14)
+ return EXCPT_PF;
+ else if (vector == DE_VECTOR || (vector>= TS_VECTOR&& vector<= GP_VECTOR))
+ return EXCPT_CONTRIBUTORY;
+ else
+ return EXCPT_BENIGN;
+}
It's actually less readable. I know 11 is between 10 and 13, but is
NP_VECTOR between TS_VECTOR and GP_VECTOR?
This is better as a switch, or even:
u8 exception_class[] = {
[PF_VECTOR] EXPT_PF,
etc.
--
error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html