All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC
@ 2015-01-20 16:35 Radim Krčmář
  2015-01-20 16:35 ` [PATCH kvm-unit-tests 1/2] lib/x86: fix apic_id() " Radim Krčmář
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Radim Krčmář @ 2015-01-20 16:35 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

We failed smptest [1/2], but didn't notice [2/2].

APICv returns 0 on APIC MMIO reads under x2APIC,
KVM returns real APIC ID instead.

Do we want to test this weirdness in another unit test?
(I'll post a patch for KVM after checking that there aren't quirks.)


Radim Krčmář (2):
  lib/x86: fix apic_id() under x2APIC
  x86: smptest: use report

 lib/x86/apic.c | 2 +-
 x86/smptest.c  | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
2.2.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH kvm-unit-tests 1/2] lib/x86: fix apic_id() under x2APIC
  2015-01-20 16:35 [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC Radim Krčmář
@ 2015-01-20 16:35 ` Radim Krčmář
  2015-01-20 16:35 ` [PATCH kvm-unit-tests 2/2] x86: smptest: use report Radim Krčmář
  2015-01-20 16:38 ` [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Radim Krčmář @ 2015-01-20 16:35 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

We used MMIO (xAPIC) for x2APIC.
This is the same as using xAPIC in globally disabled mode.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 lib/x86/apic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/x86/apic.c b/lib/x86/apic.c
index 6876d85fac95..9c42c4d0a4fc 100644
--- a/lib/x86/apic.c
+++ b/lib/x86/apic.c
@@ -70,7 +70,7 @@ static void x2apic_icr_write(u32 val, u32 dest)
 
 static uint32_t x2apic_id(void)
 {
-    return xapic_read(APIC_ID);
+    return x2apic_read(APIC_ID);
 }
 
 static const struct apic_ops x2apic_ops = {
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH kvm-unit-tests 2/2] x86: smptest: use report
  2015-01-20 16:35 [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC Radim Krčmář
  2015-01-20 16:35 ` [PATCH kvm-unit-tests 1/2] lib/x86: fix apic_id() " Radim Krčmář
@ 2015-01-20 16:35 ` Radim Krčmář
  2015-01-20 16:38 ` [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Radim Krčmář @ 2015-01-20 16:35 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

smptest was failing and we didn't notice, turn it into unit test.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 x86/smptest.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/x86/smptest.c b/x86/smptest.c
index 37805999b3b0..acda22e18314 100644
--- a/x86/smptest.c
+++ b/x86/smptest.c
@@ -1,6 +1,8 @@
 #include "libcflat.h"
 #include "smp.h"
 
+unsigned nipis;
+
 static void ipi_test(void *data)
 {
     int n = (long)data;
@@ -8,6 +10,8 @@ static void ipi_test(void *data)
     printf("ipi called, cpu %d\n", n);
     if (n != smp_id())
 	printf("but wrong cpu %d\n", smp_id());
+    else
+        nipis++;
 }
 
 int main()
@@ -21,5 +25,7 @@ int main()
     printf("found %d cpus\n", ncpus);
     for (i = 0; i < ncpus; ++i)
 	on_cpu(i, ipi_test, (void *)(long)i);
-    return 0;
+
+    report("IPI to each CPU", nipis == ncpus);
+    return report_summary();
 }
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC
  2015-01-20 16:35 [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC Radim Krčmář
  2015-01-20 16:35 ` [PATCH kvm-unit-tests 1/2] lib/x86: fix apic_id() " Radim Krčmář
  2015-01-20 16:35 ` [PATCH kvm-unit-tests 2/2] x86: smptest: use report Radim Krčmář
@ 2015-01-20 16:38 ` Paolo Bonzini
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2015-01-20 16:38 UTC (permalink / raw)
  To: Radim Krčmář, kvm



On 20/01/2015 17:35, Radim Krčmář wrote:
> We failed smptest [1/2], but didn't notice [2/2].
> 
> APICv returns 0 on APIC MMIO reads under x2APIC,
> KVM returns real APIC ID instead.
> 
> Do we want to test this weirdness in another unit test?
> (I'll post a patch for KVM after checking that there aren't quirks.)
> 
> 
> Radim Krčmář (2):
>   lib/x86: fix apic_id() under x2APIC
>   x86: smptest: use report
> 
>  lib/x86/apic.c | 2 +-
>  x86/smptest.c  | 8 +++++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 

Thanks, applying.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-20 16:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-20 16:35 [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC Radim Krčmář
2015-01-20 16:35 ` [PATCH kvm-unit-tests 1/2] lib/x86: fix apic_id() " Radim Krčmář
2015-01-20 16:35 ` [PATCH kvm-unit-tests 2/2] x86: smptest: use report Radim Krčmář
2015-01-20 16:38 ` [PATCH kvm-unit-tests 0/2] x86: do not use MMIO interface under x2APIC Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.