Skip to contentSkip to conversation

always report x2apic as supported feature

PATCH Applied Gleb Natapov 4 participants 7 messages Jul 12, 2009 – Jul 16, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 always report x2apic as supported feature

We emulate x2apic in software, so host support is not required.

arch/x86/kvm/x86.c +3 -0
index 00844eb..c256da7 100644
@@ -1497,6 +1497,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 	case 1:
 		entry->edx &= kvm_supported_word0_x86_features;
 		entry->ecx &= kvm_supported_word4_x86_features;
+		/* we support x2apic emulation even if host does not support
+		   it since we emulate x2apic in software */
+		entry->ecx |= F(X2APIC);
 		break;
 	/* function 2 entries are STATEFUL. That is, repeated cpuid commands
 	 * may return different values. This forces us to get_cpu() before

--
Gleb.

Applied
#1 lore raw
Quoted 3 lines · Gleb Natapov

We emulate x2apic in software, so host support is not required.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
In reply to Gleb Natapov
Quoted 18 lines · Gleb Natapov

We emulate x2apic in software, so host support is not required.

arch/x86/kvm/x86.c +3 -1
index 00844eb..c256da7 100644
@@ -1497,6 +1497,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 	case 1:
 		entry->edx &= kvm_supported_word0_x86_features;
 		entry->ecx &= kvm_supported_word4_x86_features;
+		/* we support x2apic emulation even if host does not support
+		   it since we emulate x2apic in software */
+		entry->ecx |= F(X2APIC);
 		break;
 	/* function 2 entries are STATEFUL. That is, repeated cpuid commands
 	 * may return different values. This forces us to get_cpu() before
--
Quoted 1 line

Gleb.

What if you have an older host that does not support emulate x2apic?

#3 lore raw
Quoted 14 lines · On Thursday 16 July 2009 07:01:30 Marcelo Tosatti wrote:
Quoted 13 lines · Gleb Natapov

We emulate x2apic in software, so host support is not required.

arch/x86/kvm/x86.c +2 -0
index 00844eb..c256da7 100644
@@ -1497,6 +1497,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2
 *entry, u32 function, case 1:
 		entry->edx &= kvm_supported_word0_x86_features;
 		entry->ecx &= kvm_supported_word4_x86_features;
+		/* we support x2apic emulation even if host does not support
+		   it since we emulate x2apic in software */
Quoted 8 lines
Quoted 6 lines
arch/x86/kvm/x86.c +1 -1
+		entry->ecx |= F(X2APIC);
 		break;
 	/* function 2 entries are STATEFUL. That is, repeated cpuid commands
 	 * may return different values. This forces us to get_cpu() before
--

Gleb.

What if you have an older host that does not support emulate x2apic?

Due to interrupt remapping can't be enabled with KVM now, I think older host would just ignore this info... (The new one can work without interrupt remapping with KVM).

By the way, I saw X2APIC in host supported CPUID feature list(1.ecx), which I don't think it's very properly. Host x2apic feature have nothing to do with KVM, we do the emulation all the way. I suggest to remove the mask for host, and give a comment that we would emulate all x2apic behaviour here, rather than "even if", which I think it's a little misleading.

Signature · 2 lines
regards
Yang, Sheng
#4 lore raw
Quoted 24 lines · Sheng Yang
Quoted 14 lines · On Thursday 16 July 2009 07:01:30 Marcelo Tosatti wrote:
Quoted 13 lines · Gleb Natapov

We emulate x2apic in software, so host support is not required.

arch/x86/kvm/x86.c +2 -0
index 00844eb..c256da7 100644
@@ -1497,6 +1497,9 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2
 *entry, u32 function, case 1:
 		entry->edx &= kvm_supported_word0_x86_features;
 		entry->ecx &= kvm_supported_word4_x86_features;
+		/* we support x2apic emulation even if host does not support
+		   it since we emulate x2apic in software */
Quoted 8 lines
Quoted 6 lines
arch/x86/kvm/x86.c +1 -1
+		entry->ecx |= F(X2APIC);
 		break;
 	/* function 2 entries are STATEFUL. That is, repeated cpuid commands
 	 * may return different values. This forces us to get_cpu() before
--

Gleb.

What if you have an older host that does not support emulate x2apic?

Quoted 5 lines

Due to interrupt remapping can't be enabled with KVM now, I think older host would just ignore this info... (The new one can work without interrupt remapping with KVM).

By the way, I saw X2APIC in host supported CPUID feature list(1.ecx), which I

Where have you seen it? If you mean kvm_supported_word4_x86_features then it is not what is supported by the host, but what is supported by KVM. Host unsupported bits are dropped from there before reporting to userspace. That is why this patch what necessary.

Quoted 8 lines

don't think it's very properly. Host x2apic feature have nothing to do with KVM, we do the emulation all the way. I suggest to remove the mask for host, and give a comment that we would emulate all x2apic behaviour here, rather than "even if", which I think it's a little misleading.

Signature · 2 lines
regards
Yang, Sheng

--
Gleb.

#5 lore raw
Quoted 29 lines · On Thursday 16 July 2009 14:00:15 Gleb Natapov wrote:
Quoted 28 lines · Sheng Yang
Quoted 14 lines · On Thursday 16 July 2009 07:01:30 Marcelo Tosatti wrote:
Quoted 13 lines · Gleb Natapov

We emulate x2apic in software, so host support is not required.

arch/x86/kvm/x86.c +0 -0
index 00844eb..c256da7 100644
@@ -1497,6 +1497,9 @@ static void do_cpuid_ent(struct

kvm_cpuid_entry2 *entry, u32 function, case 1:

arch/x86/kvm/x86.c +2 -0
 		entry->edx &= kvm_supported_word0_x86_features;
 		entry->ecx &= kvm_supported_word4_x86_features;
+		/* we support x2apic emulation even if host does not support
+		   it since we emulate x2apic in software */
Quoted 8 lines
Quoted 6 lines
arch/x86/kvm/x86.c +1 -0
+		entry->ecx |= F(X2APIC);
 		break;
 	/* function 2 entries are STATEFUL. That is, repeated cpuid

commands * may return different values. This forces us to get_cpu() before --
Gleb.

What if you have an older host that does not support emulate x2apic?

Due to interrupt remapping can't be enabled with KVM now, I think older host would just ignore this info... (The new one can work without interrupt remapping with KVM).

Quoted 7 lines
Quoted 2 lines

By the way, I saw X2APIC in host supported CPUID feature list(1.ecx), which I

Where have you seen it? If you mean kvm_supported_word4_x86_features then it is not what is supported by the host, but what is supported by KVM. Host unsupported bits are dropped from there before reporting to userspace. That is why this patch what necessary.

Yes, that's what I mean. x2apic feature needn't judged by host feature, we can always set the bit to support it, no need for a filter. I think put it in the kvm_supported_word4_x86_features is a little misleading means that KVM support it through host feature rather than emulation.

Anyway, not a big deal.

Signature · 2 lines
regards
Yang, Sheng
Quoted 12 lines
Quoted 9 lines

don't think it's very properly. Host x2apic feature have nothing to do with KVM, we do the emulation all the way. I suggest to remove the mask for host, and give a comment that we would emulate all x2apic behaviour here, rather than "even if", which I think it's a little misleading.

--
regards
Yang, Sheng

--
Gleb.

#6 lore raw
Quoted 38 lines · Sheng Yang
Quoted 29 lines · On Thursday 16 July 2009 14:00:15 Gleb Natapov wrote:
Quoted 28 lines · Sheng Yang
Quoted 14 lines · On Thursday 16 July 2009 07:01:30 Marcelo Tosatti wrote:
Quoted 13 lines · Gleb Natapov

We emulate x2apic in software, so host support is not required.

arch/x86/kvm/x86.c +0 -0
index 00844eb..c256da7 100644
@@ -1497,6 +1497,9 @@ static void do_cpuid_ent(struct

kvm_cpuid_entry2 *entry, u32 function, case 1:

arch/x86/kvm/x86.c +2 -0
 		entry->edx &= kvm_supported_word0_x86_features;
 		entry->ecx &= kvm_supported_word4_x86_features;
+		/* we support x2apic emulation even if host does not support
+		   it since we emulate x2apic in software */
Quoted 8 lines
Quoted 6 lines
arch/x86/kvm/x86.c +1 -0
+		entry->ecx |= F(X2APIC);
 		break;
 	/* function 2 entries are STATEFUL. That is, repeated cpuid

commands * may return different values. This forces us to get_cpu() before --
Gleb.

What if you have an older host that does not support emulate x2apic?

Due to interrupt remapping can't be enabled with KVM now, I think older host would just ignore this info... (The new one can work without interrupt remapping with KVM).

Quoted 7 lines
Quoted 2 lines

By the way, I saw X2APIC in host supported CPUID feature list(1.ecx), which I

Where have you seen it? If you mean kvm_supported_word4_x86_features then it is not what is supported by the host, but what is supported by KVM. Host unsupported bits are dropped from there before reporting to userspace. That is why this patch what necessary.

Quoted 5 lines

Yes, that's what I mean. x2apic feature needn't judged by host feature, we can always set the bit to support it, no need for a filter. I think put it in the kvm_supported_word4_x86_features is a little misleading means that KVM support it through host feature rather than emulation.

Yeah, I put it there initially since I misunderstood how things work and thought that it will be reported to userspace (and usercpace had a bug that prevented me from discovering the problem).

--
Gleb.