Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen/x86 Make MP-safe: make sure the xpq_queue* are ...
details: https://anonhg.NetBSD.org/src/rev/34fd28ace7f6
branches: trunk
changeset: 932406:34fd28ace7f6
user: bouyer <bouyer%NetBSD.org@localhost>
date: Wed May 06 19:50:26 2020 +0000
description:
Make MP-safe: make sure the xpq_queue* are flushed before making the
pages visible to UVM.
diffstat:
sys/arch/xen/x86/xen_bus_dma.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diffs (55 lines):
diff -r d15ecd171758 -r 34fd28ace7f6 sys/arch/xen/x86/xen_bus_dma.c
--- a/sys/arch/xen/x86/xen_bus_dma.c Wed May 06 19:49:00 2020 +0000
+++ b/sys/arch/xen/x86/xen_bus_dma.c Wed May 06 19:50:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xen_bus_dma.c,v 1.31 2020/04/25 15:26:17 bouyer Exp $ */
+/* $NetBSD: xen_bus_dma.c,v 1.32 2020/05/06 19:50:26 bouyer Exp $ */
/* NetBSD bus_dma.c,v 1.21 2005/04/16 07:53:35 yamt Exp */
/*-
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.31 2020/04/25 15:26:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_bus_dma.c,v 1.32 2020/05/06 19:50:26 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -146,15 +146,18 @@
pa = VM_PAGE_TO_PHYS(pg);
xpmap_ptom_map(pa, ptoa(mfn+i));
xpq_queue_machphys_update(((paddr_t)(mfn+i)) << PAGE_SHIFT, pa);
- /* while here, give extra pages back to UVM */
+ }
+ /* Flush updates through and flush the TLB */
+ xpq_queue_tlb_flush();
+ splx(s);
+ /* now that ptom/mtop are valid, give the extra pages back to UVM */
+ for (pg = mlistp->tqh_first, i = 0; pg != NULL; pg = pgnext, i++) {
+ pgnext = pg->pageq.queue.tqe_next;
if (i >= npagesreq) {
TAILQ_REMOVE(mlistp, pg, pageq.queue);
uvm_pagefree(pg);
}
}
- /* Flush updates through and flush the TLB */
- xpq_queue_tlb_flush();
- splx(s);
return 0;
failed:
@@ -190,11 +193,11 @@
pa = VM_PAGE_TO_PHYS(pg);
xpmap_ptom_map(pa, ptoa(mfn));
xpq_queue_machphys_update(((paddr_t)mfn) << PAGE_SHIFT, pa);
+ /* slow but we don't care */
+ xpq_queue_tlb_flush();
TAILQ_REMOVE(mlistp, pg, pageq.queue);
uvm_pagefree(pg);
}
- /* Flush updates through and flush the TLB */
- xpq_queue_tlb_flush();
splx(s);
return error;
}
Home |
Main Index |
Thread Index |
Old Index