Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ipi related kpi change review request.



 Hi,

I've been working on the Xen SMP project for the last month, and I have a couple of patches that need review, so that the work can be incrementally merged into current regardless of SMP functionality ( but leading to it).

Here's the first such patch which alters a MD kpi. I'd be keen to know if the following ports are affected in any way by this: (they shouldn't be):

port-i386
port-amd64
port-xen

I'm not very happy with the way X86_IPI_TLB has been tacked onto the rest of the IPI stuff via a wrapper. The alternative method would be to massage LAPIC_TLB_MCAST_VECTOR and LAPIC_TLB_MCAST_VECTOR into a more generic LAPIC_IPI_VECTOR. Can't think of any other sensible approaches.

Furthermore, I would like to rename the lapic specific ipi notification functions to prefixes starting with lapic. ie; s/x86_ipi/lapic_ipi//
Please let me know if this is undesirable.

Cheers,

Cherry
diff -r bef0ae3eb8ef -r 5eff0616de45 
trunk/netbsd-src/sys/arch/x86/include/intrdefs.h
--- a/trunk/netbsd-src/sys/arch/x86/include/intrdefs.h  Fri Feb 11 16:05:03 
2011 +0530
+++ b/trunk/netbsd-src/sys/arch/x86/include/intrdefs.h  Sat Feb 12 01:09:31 
2011 +0530
@@ -65,6 +65,7 @@
 #define X86_IPI_XCALL                  0x00000040
 #define X86_IPI_ACPI_CPU_SLEEP         0x00000080
 #define X86_IPI_KPREEMPT               0x00000100
+#define X86_IPI_TLB                    0x00000200
 
 #define X86_NIPI               9
 
diff -r bef0ae3eb8ef -r 5eff0616de45 trunk/netbsd-src/sys/arch/x86/x86/ipi.c
--- a/trunk/netbsd-src/sys/arch/x86/x86/ipi.c   Fri Feb 11 16:05:03 2011 +0530
+++ b/trunk/netbsd-src/sys/arch/x86/x86/ipi.c   Sat Feb 12 01:09:31 2011 +0530
@@ -107,6 +107,16 @@
 x86_send_ipi(struct cpu_info *ci, int ipimask)
 {
        int ret;
+       
+       KASSERT(ci != NULL);
+
+       if (ipimask & X86_IPI_TLB) {    /* Wrapper for TLB event */
+               KASSERT(ipimask == X86_IPI_TLB);
+
+               ret = x86_ipi(LAPIC_TLB_MCAST_VECTOR,
+                             ci->ci_cpuid, LAPIC_DLMODE_FIXED))                
+               return ret;
+       }
 
        atomic_or_32(&ci->ci_ipis, ipimask);
 
@@ -132,6 +142,15 @@
        int count = 0;
        CPU_INFO_ITERATOR cii;
 
+       if (ipimask & X86_IPI_TLB) {    /* Wrapper for TLB event */
+               KASSERT(ipimask == X86_IPI_TLB);
+
+               if (x86_ipi(LAPIC_TLB_BCAST_VECTOR, LAPIC_DEST_ALLEXCL,
+                           LAPIC_DLMODE_FIXED)) {
+                       panic("x86_ipi() failed on Broadcast via lapic.\n");
+               }
+       }
+
        for (CPU_INFO_FOREACH(cii, ci)) {
                if (ci == self)
                        continue;
diff -r bef0ae3eb8ef -r 5eff0616de45 trunk/netbsd-src/sys/arch/x86/x86/pmap.c
--- a/trunk/netbsd-src/sys/arch/x86/x86/pmap.c  Fri Feb 11 16:05:03 2011 +0530
+++ b/trunk/netbsd-src/sys/arch/x86/x86/pmap.c  Sat Feb 12 01:09:31 2011 +0530
@@ -4542,8 +4542,7 @@
                        mb->mb_addr1 = sva;
                        mb->mb_addr2 = eva;
                        mb->mb_global = pte;
-                       x86_ipi(LAPIC_TLB_BCAST_VECTOR, LAPIC_DEST_ALLEXCL,
-                           LAPIC_DLMODE_FIXED);
+                       x86_broadcast_ipi(X86_IPI_TLB);
                        self->ci_need_tlbwait = 1;
                        splx(s);
                } else if ((pm->pm_cpus & ~self->ci_cpumask) != 0 ||
@@ -4581,9 +4580,9 @@
                                mb->mb_addr1 = sva;
                                mb->mb_addr2 = eva;
                                mb->mb_global = pte;
-                               if (x86_ipi(LAPIC_TLB_MCAST_VECTOR,
-                                   ci->ci_cpuid, LAPIC_DLMODE_FIXED))
+                               if (x86_send_ipi(ci, X86_IPI_TLB)) {
                                        panic("pmap_tlb_shootdown: ipi failed");
+                               }
                        }
                        self->ci_need_tlbwait = 1;
                        splx(s);
diff -r bef0ae3eb8ef -r 5eff0616de45 
trunk/netbsd-src/sys/arch/xen/include/intr.h
--- a/trunk/netbsd-src/sys/arch/xen/include/intr.h      Fri Feb 11 16:05:03 
2011 +0530
+++ b/trunk/netbsd-src/sys/arch/xen/include/intr.h      Sat Feb 12 01:09:31 
2011 +0530
@@ -177,7 +177,7 @@
 
 int x86_send_ipi(struct cpu_info *, int);
 void x86_broadcast_ipi(int);
-void x86_multicast_ipi(int, int);
+void x86_ipi_handler(void);
 
 #endif /* !_LOCORE */
 


Home | Main Index | Thread Index | Old Index