Source-Changes-HG archive

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

[src/netbsd-3]: src/sys/arch/xen/include Pull up revision 1.6 (requested by b...



details:   https://anonhg.NetBSD.org/src/rev/25b26d56cdc4
branches:  netbsd-3
changeset: 575939:25b26d56cdc4
user:      tron <tron%NetBSD.org@localhost>
date:      Sat May 28 16:28:00 2005 +0000

description:
Pull up revision 1.6 (requested by bouyer in ticket #355):
Always call the xpq_queue*() functions at splvm(), so that it's safe to call
them from interrupt context.
xpq_flush_queue() is called from IPL_NET in if_xennet.c, and
other xpq_queue* functions may be called from interrupt context via
pmap_kenter*(). Should fix port-xen/30153.
Thanks to Jason Thorpe and YAMAMOTO Takashi for enlightments on this issue.

diffstat:

 sys/arch/xen/include/xenfunc.h |   8 ++++++-
 sys/arch/xen/include/xenpmap.h |  44 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 2 deletions(-)

diffs (180 lines):

diff -r a14fee79c9bd -r 25b26d56cdc4 sys/arch/xen/include/xenfunc.h
--- a/sys/arch/xen/include/xenfunc.h    Sat May 28 16:27:46 2005 +0000
+++ b/sys/arch/xen/include/xenfunc.h    Sat May 28 16:28:00 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xenfunc.h,v 1.4.2.1 2005/05/01 22:02:12 tron Exp $     */
+/*     $NetBSD: xenfunc.h,v 1.4.2.2 2005/05/28 16:28:00 tron Exp $     */
 
 /*
  *
@@ -53,8 +53,10 @@
 static __inline void 
 invlpg(u_int addr)
 {
+       int s = splvm();
        xpq_queue_invlpg(addr);
        xpq_flush_queue();
+       splx(s);
 }  
 
 static __inline void
@@ -92,16 +94,20 @@
 static __inline void
 _lcr3(u_int val, char *file, int line)
 {
+       int s = splvm();
 /*     __PRINTK(("lcr3 %08x at %s:%d\n", val, file, line)); */
        xpq_queue_pt_switch(xpmap_ptom(val) & PG_FRAME);
        xpq_flush_queue();
+       splx(s);
 }
 
 static __inline void
 tlbflush(void)
 {
+       int s = splvm();
        xpq_queue_tlb_flush();
        xpq_flush_queue();
+       splx(s);
 }
 
 #define        tlbflushg()     tlbflush()      /* we don't use PGE */
diff -r a14fee79c9bd -r 25b26d56cdc4 sys/arch/xen/include/xenpmap.h
--- a/sys/arch/xen/include/xenpmap.h    Sat May 28 16:27:46 2005 +0000
+++ b/sys/arch/xen/include/xenpmap.h    Sat May 28 16:28:00 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xenpmap.h,v 1.4.2.1 2005/04/21 17:09:12 tron Exp $     */
+/*     $NetBSD: xenpmap.h,v 1.4.2.2 2005/05/28 16:28:00 tron Exp $     */
 
 /*
  *
@@ -83,87 +83,129 @@
 #define        PDE_GET(_pdp)                                           \
        (pmap_valid_entry(*(_pdp)) ? xpmap_mtop(*(_pdp)) : *(_pdp))
 #define PDE_SET(_pdp,_mapdp,_npde) do {                                \
+       int s = splvm();                                        \
        xpq_queue_pde_update((_mapdp), xpmap_ptom((_npde)));    \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PDE_CLEAR(_pdp,_mapdp) do {                            \
+       int s = splvm();                                        \
        xpq_queue_pde_update((_mapdp), 0);                      \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define        PTE_GET(_ptp)                                           \
        (pmap_valid_entry(*(_ptp)) ? xpmap_mtop(*(_ptp)) : *(_ptp))
 #define        PTE_GET_MA(_ptp)                                        \
        *(_ptp)
 #define PTE_SET(_ptp,_maptp,_npte) do {                                \
+       int s = splvm();                                        \
        xpq_queue_pte_update((_maptp), xpmap_ptom((_npte)));    \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_SET_MA(_ptp,_maptp,_npte) do {                     \
+       int s = splvm();                                        \
        xpq_queue_pte_update((_maptp), (_npte));                \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_SET_MA_UNCHECKED(_ptp,_maptp,_npte) do {           \
+       s = splvm();                                            \
        xpq_queue_unchecked_pte_update((_maptp), (_npte));      \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_CLEAR(_ptp,_maptp) do {                            \
+       int s = splvm();                                        \
        xpq_queue_pte_update((_maptp), 0);                      \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_ATOMIC_SET(_ptp,_maptp,_npte,_opte) do {           \
+       int s;                                                  \
        (_opte) = PTE_GET(_ptp);                                \
+       s = splvm();                                            \
        xpq_queue_pte_update((_maptp), xpmap_ptom((_npte)));    \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_ATOMIC_SET_MA(_ptp,_maptp,_npte,_opte) do {                \
+       int s;                                                  \
        (_opte) = *(_ptp);                                      \
+       s = splvm();                                            \
        xpq_queue_pte_update((_maptp), (_npte));                \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_ATOMIC_CLEAR(_ptp,_maptp,_opte) do {               \
+       int s;                                                  \
        (_opte) = PTE_GET(_ptp);                                \
+       s = splvm();                                            \
        xpq_queue_pte_update((_maptp), 0);                      \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_ATOMIC_CLEAR_MA(_ptp,_maptp,_opte) do {            \
+       int s;                                                  \
        (_opte) = *(_ptp);                                      \
+       s = splvm();                                            \
        xpq_queue_pte_update((_maptp), 0);                      \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PDE_CLEARBITS(_pdp,_mapdp,_bits) do {                  \
+       int s = splvm();                                        \
        xpq_queue_pte_update((_mapdp), *(_pdp) & ~((_bits) & ~PG_FRAME)); \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_CLEARBITS(_ptp,_maptp,_bits) do {                  \
+       int s = splvm();                                        \
        xpq_queue_pte_update((_maptp), *(_ptp) & ~((_bits) & ~PG_FRAME)); \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PDE_ATOMIC_CLEARBITS(_pdp,_mapdp,_bits) do {           \
+       int s = splvm();                                        \
        xpq_queue_pde_update((_mapdp), *(_pdp) & ~((_bits) & ~PG_FRAME)); \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_ATOMIC_CLEARBITS(_ptp,_maptp,_bits) do {           \
+       int s = splvm();                                        \
        xpq_queue_pte_update((_maptp), *(_ptp) & ~((_bits) & ~PG_FRAME)); \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_SETBITS(_ptp,_maptp,_bits) do {                    \
+       int s = splvm();                                        \
        xpq_queue_pte_update((_maptp), *(_ptp) | ((_bits) & ~PG_FRAME)); \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PDE_ATOMIC_SETBITS(_pdp,_mapdp,_bits) do {             \
+       int s = splvm();                                        \
        xpq_queue_pde_update((_mapdp), *(_pdp) | ((_bits) & ~PG_FRAME)); \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PTE_ATOMIC_SETBITS(_ptp,_maptp,_bits) do {             \
+       int s = splvm();                                        \
        xpq_queue_pte_update((_maptp), *(_ptp) | ((_bits) & ~PG_FRAME)); \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define PDE_COPY(_dpdp,_madpdp,_spdp) do {                     \
+       int s = splvm();                                        \
        xpq_queue_pde_update((_madpdp), *(_spdp));              \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 #define        PTE_UPDATES_FLUSH() do {                                \
+       int s = splvm();                                        \
        xpq_flush_queue();                                      \
+       splx(s);                                                \
 } while (/*CONSTCOND*/0)
 
 #endif



Home | Main Index | Thread Index | Old Index