PERFORCE change 138459 for review
John Baldwin
jhb at FreeBSD.org
Mon Mar 24 19:59:50 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=138459
Change 138459 by jhb at jhb_mutex on 2008/03/24 19:59:34
IFC @138458
Affected files ...
.. //depot/projects/smpng/sys/amd64/amd64/cpu_switch.S#19 integrate
.. //depot/projects/smpng/sys/amd64/amd64/genassym.c#21 integrate
.. //depot/projects/smpng/sys/amd64/amd64/nexus.c#29 integrate
.. //depot/projects/smpng/sys/amd64/amd64/pmap.c#79 integrate
.. //depot/projects/smpng/sys/amd64/ia32/ia32_signal.c#17 integrate
.. //depot/projects/smpng/sys/amd64/include/pcb.h#12 integrate
.. //depot/projects/smpng/sys/amd64/isa/atpic.c#18 integrate
.. //depot/projects/smpng/sys/arm/arm/elf_trampoline.c#15 integrate
.. //depot/projects/smpng/sys/arm/conf/AVILA#5 integrate
.. //depot/projects/smpng/sys/arm/conf/AVILA.hints#2 integrate
.. //depot/projects/smpng/sys/arm/xscale/ixp425/if_npe.c#7 integrate
.. //depot/projects/smpng/sys/arm/xscale/ixp425/ixdp425_pci.c#2 integrate
.. //depot/projects/smpng/sys/compat/linux/linux_futex.c#7 integrate
.. //depot/projects/smpng/sys/compat/linux/linux_futex.h#3 integrate
.. //depot/projects/smpng/sys/conf/NOTES#148 integrate
.. //depot/projects/smpng/sys/conf/files#213 integrate
.. //depot/projects/smpng/sys/conf/options#147 integrate
.. //depot/projects/smpng/sys/dev/aac/aac.c#60 integrate
.. //depot/projects/smpng/sys/dev/aac/aac_cam.c#24 integrate
.. //depot/projects/smpng/sys/dev/aac/aac_debug.c#19 integrate
.. //depot/projects/smpng/sys/dev/aac/aac_disk.c#24 integrate
.. //depot/projects/smpng/sys/dev/aac/aac_pci.c#46 integrate
.. //depot/projects/smpng/sys/dev/aac/aacvar.h#28 integrate
.. //depot/projects/smpng/sys/dev/ata/ata-raid.c#52 integrate
.. //depot/projects/smpng/sys/dev/ath/if_ath.c#55 integrate
.. //depot/projects/smpng/sys/dev/cxgb/cxgb_main.c#9 integrate
.. //depot/projects/smpng/sys/dev/cxgb/cxgb_offload.h#2 integrate
.. //depot/projects/smpng/sys/dev/cxgb/cxgb_sge.c#8 integrate
.. //depot/projects/smpng/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#4 integrate
.. //depot/projects/smpng/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#4 integrate
.. //depot/projects/smpng/sys/dev/dc/if_dc.c#16 integrate
.. //depot/projects/smpng/sys/dev/dc/if_dcreg.h#8 integrate
.. //depot/projects/smpng/sys/dev/drm/drm_pciids.h#8 integrate
.. //depot/projects/smpng/sys/dev/drm/i915_dma.c#6 integrate
.. //depot/projects/smpng/sys/dev/fxp/if_fxp.c#83 integrate
.. //depot/projects/smpng/sys/dev/gem/if_gem.c#35 integrate
.. //depot/projects/smpng/sys/dev/gem/if_gem_pci.c#24 integrate
.. //depot/projects/smpng/sys/dev/gem/if_gemreg.h#6 integrate
.. //depot/projects/smpng/sys/dev/gem/if_gemvar.h#16 integrate
.. //depot/projects/smpng/sys/dev/mfi/mfi.c#21 integrate
.. //depot/projects/smpng/sys/dev/re/if_re.c#59 integrate
.. //depot/projects/smpng/sys/dev/syscons/syscons.c#62 integrate
.. //depot/projects/smpng/sys/dev/usb/ehci.c#32 integrate
.. //depot/projects/smpng/sys/dev/usb/if_rum.c#4 integrate
.. //depot/projects/smpng/sys/dev/usb/ohci.c#46 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs#110 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdi.c#27 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdi.h#21 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdivar.h#19 integrate
.. //depot/projects/smpng/sys/fs/devfs/devfs_rule.c#18 integrate
.. //depot/projects/smpng/sys/fs/msdosfs/msdosfs_vfsops.c#57 integrate
.. //depot/projects/smpng/sys/geom/geom.h#51 integrate
.. //depot/projects/smpng/sys/geom/geom_subr.c#51 integrate
.. //depot/projects/smpng/sys/geom/part/g_part.c#7 integrate
.. //depot/projects/smpng/sys/geom/part/g_part.h#4 integrate
.. //depot/projects/smpng/sys/geom/part/g_part_apm.c#4 integrate
.. //depot/projects/smpng/sys/geom/part/g_part_bsd.c#3 integrate
.. //depot/projects/smpng/sys/geom/part/g_part_gpt.c#4 integrate
.. //depot/projects/smpng/sys/geom/part/g_part_mbr.c#3 integrate
.. //depot/projects/smpng/sys/geom/part/g_part_vtoc8.c#2 integrate
.. //depot/projects/smpng/sys/i386/i386/nexus.c#30 integrate
.. //depot/projects/smpng/sys/i386/i386/pmap.c#122 integrate
.. //depot/projects/smpng/sys/i386/isa/atpic.c#21 integrate
.. //depot/projects/smpng/sys/kern/bus_if.m#15 integrate
.. //depot/projects/smpng/sys/kern/kern_exit.c#129 integrate
.. //depot/projects/smpng/sys/kern/kern_fork.c#112 integrate
.. //depot/projects/smpng/sys/kern/kern_sig.c#138 integrate
.. //depot/projects/smpng/sys/kern/kern_switch.c#72 integrate
.. //depot/projects/smpng/sys/kern/kern_thr.c#44 integrate
.. //depot/projects/smpng/sys/kern/kern_thread.c#106 integrate
.. //depot/projects/smpng/sys/kern/kern_timeout.c#37 integrate
.. //depot/projects/smpng/sys/kern/sched_4bsd.c#73 integrate
.. //depot/projects/smpng/sys/kern/sched_ule.c#85 integrate
.. //depot/projects/smpng/sys/kern/subr_bus.c#68 integrate
.. //depot/projects/smpng/sys/kern/subr_sleepqueue.c#38 integrate
.. //depot/projects/smpng/sys/kern/subr_trap.c#87 integrate
.. //depot/projects/smpng/sys/kern/vfs_bio.c#109 integrate
.. //depot/projects/smpng/sys/kern/vfs_cluster.c#49 integrate
.. //depot/projects/smpng/sys/kern/vfs_default.c#54 integrate
.. //depot/projects/smpng/sys/kern/vfs_mount.c#78 integrate
.. //depot/projects/smpng/sys/kern/vfs_subr.c#148 integrate
.. //depot/projects/smpng/sys/kern/vfs_vnops.c#82 integrate
.. //depot/projects/smpng/sys/modules/geom/geom_part/Makefile#2 integrate
.. //depot/projects/smpng/sys/modules/geom/geom_part/geom_part_apm/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/geom/geom_part/geom_part_bsd/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/geom/geom_part/geom_part_gpt/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/geom/geom_part/geom_part_mbr/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/geom/geom_part/geom_part_vtoc8/Makefile#1 branch
.. //depot/projects/smpng/sys/net/bpf.c#74 integrate
.. //depot/projects/smpng/sys/net/bpf.h#23 integrate
.. //depot/projects/smpng/sys/net/bpf_buffer.c#1 branch
.. //depot/projects/smpng/sys/net/bpf_buffer.h#1 branch
.. //depot/projects/smpng/sys/net/bpf_zerocopy.c#1 branch
.. //depot/projects/smpng/sys/net/bpf_zerocopy.h#1 branch
.. //depot/projects/smpng/sys/net/bpfdesc.h#20 integrate
.. //depot/projects/smpng/sys/net/if_ethersubr.c#86 integrate
.. //depot/projects/smpng/sys/net/if_gre.c#35 integrate
.. //depot/projects/smpng/sys/netgraph/ng_tee.c#15 integrate
.. //depot/projects/smpng/sys/netinet/in_pcb.c#80 integrate
.. //depot/projects/smpng/sys/netinet/in_pcb.h#49 integrate
.. //depot/projects/smpng/sys/netipsec/key.c#21 integrate
.. //depot/projects/smpng/sys/netipsec/xform_tcp.c#5 integrate
.. //depot/projects/smpng/sys/nfs4client/nfs4_vfsops.c#22 integrate
.. //depot/projects/smpng/sys/nfs4client/nfs4_vnops.c#26 integrate
.. //depot/projects/smpng/sys/nfsclient/nfs_subs.c#34 integrate
.. //depot/projects/smpng/sys/nfsclient/nfs_vfsops.c#63 integrate
.. //depot/projects/smpng/sys/nfsclient/nfs_vnops.c#70 integrate
.. //depot/projects/smpng/sys/nfsserver/nfs_serv.c#56 integrate
.. //depot/projects/smpng/sys/pci/if_rlreg.h#40 integrate
.. //depot/projects/smpng/sys/pci/if_xl.c#73 integrate
.. //depot/projects/smpng/sys/pci/if_xlreg.h#21 integrate
.. //depot/projects/smpng/sys/sparc64/include/bus.h#30 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/bus_machdep.c#32 integrate
.. //depot/projects/smpng/sys/sys/aac_ioctl.h#2 integrate
.. //depot/projects/smpng/sys/sys/buf.h#50 integrate
.. //depot/projects/smpng/sys/sys/bufobj.h#10 integrate
.. //depot/projects/smpng/sys/sys/bus.h#31 integrate
.. //depot/projects/smpng/sys/sys/mbuf.h#75 integrate
.. //depot/projects/smpng/sys/sys/param.h#123 integrate
.. //depot/projects/smpng/sys/sys/proc.h#185 integrate
.. //depot/projects/smpng/sys/sys/runq.h#10 integrate
.. //depot/projects/smpng/sys/sys/sched.h#29 integrate
.. //depot/projects/smpng/sys/sys/sysctl.h#47 integrate
.. //depot/projects/smpng/sys/sys/vnode.h#84 integrate
.. //depot/projects/smpng/sys/ufs/ffs/ffs_inode.c#27 integrate
.. //depot/projects/smpng/sys/ufs/ffs/ffs_rawread.c#22 integrate
.. //depot/projects/smpng/sys/ufs/ffs/ffs_softdep.c#69 integrate
.. //depot/projects/smpng/sys/ufs/ffs/ffs_vfsops.c#99 integrate
.. //depot/projects/smpng/sys/ufs/ffs/ffs_vnops.c#58 integrate
.. //depot/projects/smpng/sys/vm/vm_mmap.c#66 integrate
Differences ...
==== //depot/projects/smpng/sys/amd64/amd64/cpu_switch.S#19 (text+ko) ====
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/amd64/cpu_switch.S,v 1.160 2007/08/22 05:06:14 jkoshy Exp $
+ * $FreeBSD: src/sys/amd64/amd64/cpu_switch.S,v 1.161 2008/03/23 23:09:06 peter Exp $
*/
#include <machine/asmacros.h>
@@ -69,16 +69,20 @@
* %rsi = newtd
*/
ENTRY(cpu_throw)
+ testq %rdi,%rdi
+ jnz 1f
+ movq PCPU(IDLETHREAD),%rdi
+1:
+ movq TD_PCB(%rdi),%r8 /* Old pcb */
movl PCPU(CPUID), %eax
- testq %rdi,%rdi /* no thread? */
- jz 1f
+ movq PCB_FSBASE(%r8),%r9
+ movq PCB_GSBASE(%r8),%r10
/* release bit from old pm_active */
movq TD_PROC(%rdi), %rdx /* oldtd->td_proc */
movq P_VMSPACE(%rdx), %rdx /* proc->p_vmspace */
LK btrl %eax, VM_PMAP+PM_ACTIVE(%rdx) /* clear old */
-1:
- movq TD_PCB(%rsi),%rdx /* newtd->td_proc */
- movq PCB_CR3(%rdx),%rdx
+ movq TD_PCB(%rsi),%r8 /* newtd->td_proc */
+ movq PCB_CR3(%r8),%rdx
movq %rdx,%cr3 /* new address space */
jmp swact
END(cpu_throw)
@@ -97,43 +101,24 @@
movq TD_PCB(%rdi),%r8
movq (%rsp),%rax /* Hardware registers */
+ movq %r15,PCB_R15(%r8)
+ movq %r14,PCB_R14(%r8)
+ movq %r13,PCB_R13(%r8)
+ movq %r12,PCB_R12(%r8)
+ movq %rbp,PCB_RBP(%r8)
+ movq %rsp,PCB_RSP(%r8)
+ movq %rbx,PCB_RBX(%r8)
movq %rax,PCB_RIP(%r8)
- movq %rbx,PCB_RBX(%r8)
- movq %rsp,PCB_RSP(%r8)
- movq %rbp,PCB_RBP(%r8)
- movq %r12,PCB_R12(%r8)
- movq %r13,PCB_R13(%r8)
- movq %r14,PCB_R14(%r8)
- movq %r15,PCB_R15(%r8)
+ movq PCB_FSBASE(%r8),%r9
+ movq PCB_GSBASE(%r8),%r10
testl $PCB_32BIT,PCB_FLAGS(%r8)
- jz 1f /* no, skip over */
-
- /* Save userland %gs */
- movl %gs,PCB_GS(%r8)
- movq PCB_GS32P(%r8),%rax
- movq (%rax),%rax
- movq %rax,PCB_GS32SD(%r8)
+ jnz store_gs /* static predict not taken */
+done_store_gs:
-1:
- /* Test if debug registers should be saved. */
testl $PCB_DBREGS,PCB_FLAGS(%r8)
- jz 1f /* no, skip over */
- movq %dr7,%rax /* yes, do the save */
- movq %rax,PCB_DR7(%r8)
- andq $0x0000fc00, %rax /* disable all watchpoints */
- movq %rax,%dr7
- movq %dr6,%rax
- movq %rax,PCB_DR6(%r8)
- movq %dr3,%rax
- movq %rax,PCB_DR3(%r8)
- movq %dr2,%rax
- movq %rax,PCB_DR2(%r8)
- movq %dr1,%rax
- movq %rax,PCB_DR1(%r8)
- movq %dr0,%rax
- movq %rax,PCB_DR0(%r8)
-1:
+ jnz store_dr /* static predict not taken */
+done_store_dr:
/* have we used fp, and need a save? */
cmpq %rdi,PCPU(FPCURTHREAD)
@@ -181,82 +166,138 @@
cmpq %rcx, %rdx
pause
je 1b
- lfence
#endif
/*
* At this point, we've switched address spaces and are ready
* to load up the rest of the next context.
*/
- movq TD_PCB(%rsi),%r8
+
+ /* Skip loading user fsbase/gsbase for kthreads */
+ testl $TDP_KTHREAD,TD_PFLAGS(%rsi)
+ jnz do_kthread
+ cmpq PCB_FSBASE(%r8),%r9
+ jz 1f
/* Restore userland %fs */
movl $MSR_FSBASE,%ecx
movl PCB_FSBASE(%r8),%eax
movl PCB_FSBASE+4(%r8),%edx
wrmsr
+1:
+ cmpq PCB_GSBASE(%r8),%r10
+ jz 2f
/* Restore userland %gs */
movl $MSR_KGSBASE,%ecx
movl PCB_GSBASE(%r8),%eax
movl PCB_GSBASE+4(%r8),%edx
wrmsr
+2:
+do_tss:
/* Update the TSS_RSP0 pointer for the next interrupt */
movq PCPU(TSSP), %rax
+ movq %r8, PCPU(RSP0)
+ movq %r8, PCPU(CURPCB)
addq $COMMON_TSS_RSP0, %rax
- leaq -16(%r8), %rbx
- movq %rbx, (%rax)
- movq %rbx, PCPU(RSP0)
+ movq %rsi, PCPU(CURTHREAD) /* into next thread */
+ movq %r8, (%rax)
- movq %r8, PCPU(CURPCB)
- movq %rsi, PCPU(CURTHREAD) /* into next thread */
+ /* Test if debug registers should be restored. */
+ testl $PCB_DBREGS,PCB_FLAGS(%r8)
+ jnz load_dr /* static predict not taken */
+done_load_dr:
testl $PCB_32BIT,PCB_FLAGS(%r8)
- jz 1f /* no, skip over */
+ jnz load_gs /* static predict not taken */
+done_load_gs:
+
+ /* Restore context. */
+ movq PCB_R15(%r8),%r15
+ movq PCB_R14(%r8),%r14
+ movq PCB_R13(%r8),%r13
+ movq PCB_R12(%r8),%r12
+ movq PCB_RBP(%r8),%rbp
+ movq PCB_RSP(%r8),%rsp
+ movq PCB_RBX(%r8),%rbx
+ movq PCB_RIP(%r8),%rax
+ movq %rax,(%rsp)
+ ret
+
+ /*
+ * We order these strangely for several reasons.
+ * 1: I wanted to use static branch prediction hints
+ * 2: Most athlon64/opteron cpus don't have them. They define
+ * a forward branch as 'predict not taken'. Intel cores have
+ * the 'rep' prefix to invert this.
+ * So, to make it work on both forms of cpu we do the detour.
+ * We use jumps rather than call in order to avoid the stack.
+ */
+
+do_kthread:
+ /*
+ * Copy old fs/gsbase to new kthread pcb for future switches
+ * This maintains curpcb->pcb_[fg]sbase as caches of the MSR
+ */
+ movq %r9,PCB_FSBASE(%r8)
+ movq %r10,PCB_GSBASE(%r8)
+ jmp do_tss
+
+store_gs:
+ movl %gs,PCB_GS(%r8)
+ movq PCB_GS32P(%r8),%rax
+ movq (%rax),%rax
+ movq %rax,PCB_GS32SD(%r8)
+ jmp done_store_gs
+load_gs:
/* Restore userland %gs while preserving kernel gsbase */
movq PCB_GS32P(%r8),%rax
- movq PCB_GS32SD(%r8),%rbx
- movq %rbx,(%rax)
+ movq PCB_GS32SD(%r8),%rcx
+ movq %rcx,(%rax)
movl $MSR_GSBASE,%ecx
rdmsr
movl PCB_GS(%r8),%gs
wrmsr
+ jmp done_load_gs
-1:
- /* Restore context. */
- movq PCB_RBX(%r8),%rbx
- movq PCB_RSP(%r8),%rsp
- movq PCB_RBP(%r8),%rbp
- movq PCB_R12(%r8),%r12
- movq PCB_R13(%r8),%r13
- movq PCB_R14(%r8),%r14
- movq PCB_R15(%r8),%r15
- movq PCB_RIP(%r8),%rax
- movq %rax,(%rsp)
+store_dr:
+ movq %dr7,%rax /* yes, do the save */
+ movq %dr0,%r15
+ movq %dr1,%r14
+ movq %dr2,%r13
+ movq %dr3,%r12
+ movq %dr6,%r11
+ andq $0x0000fc00, %rax /* disable all watchpoints */
+ movq %r15,PCB_DR0(%r8)
+ movq %r14,PCB_DR1(%r8)
+ movq %r13,PCB_DR2(%r8)
+ movq %r12,PCB_DR3(%r8)
+ movq %r11,PCB_DR6(%r8)
+ movq %rax,PCB_DR7(%r8)
+ movq %rax,%dr7
+ jmp done_store_dr
- /* Test if debug registers should be restored. */
- testl $PCB_DBREGS,PCB_FLAGS(%r8)
- jz 1f
- movq PCB_DR6(%r8),%rax
- movq %rax,%dr6
- movq PCB_DR3(%r8),%rax
- movq %rax,%dr3
- movq PCB_DR2(%r8),%rax
- movq %rax,%dr2
- movq PCB_DR1(%r8),%rax
- movq %rax,%dr1
- movq PCB_DR0(%r8),%rax
- movq %rax,%dr0
- /* But preserve reserved bits in %dr7 */
+load_dr:
movq %dr7,%rax
+ movq PCB_DR0(%r8),%r15
+ movq PCB_DR1(%r8),%r14
+ movq PCB_DR2(%r8),%r13
+ movq PCB_DR3(%r8),%r12
+ movq PCB_DR6(%r8),%r11
+ movq PCB_DR7(%r8),%rcx
+ movq %r15,%dr0
+ movq %r14,%dr1
+ /* Preserve reserved bits in %dr7 */
andq $0x0000fc00,%rax
- movq PCB_DR7(%r8),%rcx
andq $~0x0000fc00,%rcx
+ movq %r13,%dr2
+ movq %r12,%dr3
orq %rcx,%rax
+ movq %r11,%dr6
movq %rax,%dr7
-1:
- ret
+ jmp done_load_dr
+
END(cpu_switch)
/*
==== //depot/projects/smpng/sys/amd64/amd64/genassym.c#21 (text+ko) ====
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.166 2007/11/23 03:03:29 jkoshy Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/genassym.c,v 1.167 2008/03/23 22:46:37 peter Exp $");
#include "opt_compat.h"
#include "opt_kstack_pages.h"
@@ -86,6 +86,7 @@
ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
ASSYM(TDP_CALLCHAIN, TDP_CALLCHAIN);
+ASSYM(TDP_KTHREAD, TDP_KTHREAD);
ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
ASSYM(V_SYSCALL, offsetof(struct vmmeter, v_syscall));
==== //depot/projects/smpng/sys/amd64/amd64/nexus.c#29 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.79 2008/03/13 20:39:03 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.80 2008/03/20 21:24:32 jhb Exp $");
/*
* This code implements a `root nexus' for Intel Architecture
@@ -87,6 +87,9 @@
int unit);
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
u_long, u_long, u_long, u_int);
+#ifdef SMP
+static int nexus_bind_intr(device_t, device_t, struct resource *, int);
+#endif
static int nexus_config_intr(device_t, int, enum intr_trigger,
enum intr_polarity);
static int nexus_activate_resource(device_t, device_t, int, int,
@@ -128,6 +131,9 @@
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
+#ifdef SMP
+ DEVMETHOD(bus_bind_intr, nexus_bind_intr),
+#endif
DEVMETHOD(bus_config_intr, nexus_config_intr),
DEVMETHOD(bus_get_resource_list, nexus_get_reslist),
DEVMETHOD(bus_set_resource, nexus_set_resource),
@@ -458,6 +464,14 @@
return (intr_remove_handler(ih));
}
+#ifdef SMP
+static int
+nexus_bind_intr(device_t dev, device_t child, struct resource *irq, int cpu)
+{
+ return (intr_bind(rman_get_start(irq), cpu));
+}
+#endif
+
static int
nexus_config_intr(device_t dev, int irq, enum intr_trigger trig,
enum intr_polarity pol)
==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#79 (text+ko) ====
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.606 2008/03/04 18:50:15 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.609 2008/03/23 23:04:09 alc Exp $");
/*
* Manages physical address maps.
@@ -1861,12 +1861,8 @@
("pmap_collect: wired pte %#lx", tpte));
if (tpte & PG_A)
vm_page_flag_set(m, PG_REFERENCED);
- if (tpte & PG_M) {
- KASSERT((tpte & PG_RW),
- ("pmap_collect: modified page not writable: va: %#lx, pte: %#lx",
- va, tpte));
+ if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
vm_page_dirty(m);
- }
free = NULL;
pmap_unuse_pt(pmap, va, *pde, &free);
pmap_invalidate_page(pmap, va);
@@ -2311,12 +2307,8 @@
eva = sva + NBPDR;
for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_FRAME);
va < eva; va += PAGE_SIZE, m++) {
- if (oldpde & PG_M) {
- KASSERT((oldpde & PG_RW) != 0,
- ("pmap_remove_pde: modified 2mpage not writable: va: %#lx, pde: %#lx",
- va, oldpde));
+ if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
vm_page_dirty(m);
- }
if (oldpde & PG_A)
vm_page_flag_set(m, PG_REFERENCED);
if (TAILQ_EMPTY(&m->md.pv_list) &&
@@ -2364,12 +2356,8 @@
pmap->pm_stats.resident_count -= 1;
if (oldpte & PG_MANAGED) {
m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME);
- if (oldpte & PG_M) {
- KASSERT((oldpte & PG_RW),
- ("pmap_remove_pte: modified page not writable: va: %#lx, pte: %#lx",
- va, oldpte));
+ if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
vm_page_dirty(m);
- }
if (oldpte & PG_A)
vm_page_flag_set(m, PG_REFERENCED);
pmap_remove_entry(pmap, m, va);
@@ -2444,12 +2432,16 @@
pml4e = pmap_pml4e(pmap, sva);
if ((*pml4e & PG_V) == 0) {
va_next = (sva + NBPML4) & ~PML4MASK;
+ if (va_next < sva)
+ va_next = eva;
continue;
}
pdpe = pmap_pml4e_to_pdpe(pml4e, sva);
if ((*pdpe & PG_V) == 0) {
va_next = (sva + NBPDP) & ~PDPMASK;
+ if (va_next < sva)
+ va_next = eva;
continue;
}
@@ -2457,6 +2449,8 @@
* Calculate index for next page table.
*/
va_next = (sva + NBPDR) & ~PDRMASK;
+ if (va_next < sva)
+ va_next = eva;
pde = pmap_pdpe_to_pde(pdpe, sva);
ptpaddr = *pde;
@@ -2575,12 +2569,8 @@
/*
* Update the vm_page_t clean and reference bits.
*/
- if (tpte & PG_M) {
- KASSERT((tpte & PG_RW),
- ("pmap_remove_all: modified page not writable: va: %#lx, pte: %#lx",
- pv->pv_va, tpte));
+ if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
vm_page_dirty(m);
- }
free = NULL;
pmap_unuse_pt(pmap, pv->pv_va, *pde, &free);
pmap_invalidate_page(pmap, pv->pv_va);
@@ -2621,7 +2611,7 @@
* page mapping with a stored page table page has PG_A
* set.
*/
- if ((oldpde & PG_M) != 0)
+ if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
vm_page_dirty(m);
}
}
@@ -2672,16 +2662,22 @@
pml4e = pmap_pml4e(pmap, sva);
if ((*pml4e & PG_V) == 0) {
va_next = (sva + NBPML4) & ~PML4MASK;
+ if (va_next < sva)
+ va_next = eva;
continue;
}
pdpe = pmap_pml4e_to_pdpe(pml4e, sva);
if ((*pdpe & PG_V) == 0) {
va_next = (sva + NBPDP) & ~PDPMASK;
+ if (va_next < sva)
+ va_next = eva;
continue;
}
va_next = (sva + NBPDR) & ~PDRMASK;
+ if (va_next < sva)
+ va_next = eva;
pde = pmap_pdpe_to_pde(pdpe, sva);
ptpaddr = *pde;
@@ -2733,7 +2729,7 @@
vm_page_flag_set(m, PG_REFERENCED);
pbits &= ~PG_A;
}
- if ((pbits & PG_M) != 0) {
+ if ((pbits & (PG_M | PG_RW)) == (PG_M | PG_RW)) {
if (m == NULL)
m = PHYS_TO_VM_PAGE(pbits &
PG_FRAME);
@@ -2806,12 +2802,15 @@
return;
}
if ((oldpte & (PG_M | PG_RW)) == PG_RW) {
+ /*
+ * When PG_M is already clear, PG_RW can be cleared
+ * without a TLB invalidation.
+ */
if (!atomic_cmpset_long(pte, oldpte, oldpte & ~PG_RW))
goto retry;
oldpte &= ~PG_RW;
oldpteva = (oldpte & PG_FRAME & PDRMASK) |
(va & ~PDRMASK);
- pmap_invalidate_page(pmap, oldpteva);
CTR2(KTR_PMAP, "pmap_promote_pde: protect for va %#lx"
" in pmap %p", oldpteva, pmap);
}
@@ -3023,10 +3022,7 @@
PG_NX) == 0 && (newpte & PG_NX)))
invlva = TRUE;
}
- if (origpte & PG_M) {
- KASSERT((origpte & PG_RW),
- ("pmap_enter: modified page not writable: va: %#lx, pte: %#lx",
- va, origpte));
+ if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) {
if ((origpte & PG_MANAGED) != 0)
vm_page_dirty(om);
if ((newpte & PG_RW) == 0)
@@ -3084,7 +3080,7 @@
newpde |= PG_MANAGED;
/*
- * Create a PV entry for each of the managed pages.
+ * Abort this mapping if its PV entry could not be created.
*/
if (!pmap_pv_insert_pde(pmap, va, m)) {
free = NULL;
@@ -3485,16 +3481,22 @@
pml4e = pmap_pml4e(src_pmap, addr);
if ((*pml4e & PG_V) == 0) {
va_next = (addr + NBPML4) & ~PML4MASK;
+ if (va_next < addr)
+ va_next = end_addr;
continue;
}
pdpe = pmap_pml4e_to_pdpe(pml4e, addr);
if ((*pdpe & PG_V) == 0) {
va_next = (addr + NBPDP) & ~PDPMASK;
+ if (va_next < addr)
+ va_next = end_addr;
continue;
}
va_next = (addr + NBPDR) & ~PDRMASK;
+ if (va_next < addr)
+ va_next = end_addr;
pde = pmap_pdpe_to_pde(pdpe, addr);
srcptepaddr = *pde;
@@ -3797,10 +3799,7 @@
/*
* Update the vm_page_t clean/reference bits.
*/
- if (tpte & PG_M) {
- KASSERT((tpte & PG_RW) != 0,
- ("pmap_remove_pages: modified page not writable: va: %#lx, pte: %#lx",
- pv->pv_va, tpte));
+ if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) {
if ((tpte & PG_PS) != 0) {
for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++)
vm_page_dirty(mt);
@@ -3898,7 +3897,7 @@
pmap = PV_PMAP(pv);
PMAP_LOCK(pmap);
pte = pmap_pte(pmap, pv->pv_va);
- rv = (*pte & PG_M) != 0;
+ rv = (*pte & (PG_M | PG_RW)) == (PG_M | PG_RW);
PMAP_UNLOCK(pmap);
if (rv)
break;
@@ -4106,9 +4105,7 @@
}
}
}
- } else
- KASSERT((oldpde & PG_M) == 0,
- ("pmap_clear_modify: modified page not writable"));
+ }
PMAP_UNLOCK(pmap);
}
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
@@ -4118,7 +4115,7 @@
KASSERT((*pde & PG_PS) == 0, ("pmap_clear_modify: found"
" a 2mpage in page %p's pv list", m));
pte = pmap_pde_to_pte(pde, pv->pv_va);
- if (*pte & PG_M) {
+ if ((*pte & (PG_M | PG_RW)) == (PG_M | PG_RW)) {
atomic_clear_long(pte, PG_M);
pmap_invalidate_page(pmap, pv->pv_va);
}
@@ -4373,10 +4370,10 @@
pdep = pmap_pde(pmap, addr);
if (pdep != NULL && (*pdep & PG_V)) {
if (*pdep & PG_PS) {
- KASSERT((*pdep & PG_FRAME & PDRMASK) == 0,
- ("pmap_mincore: bad pde"));
pte = *pdep;
- pa = (*pdep & PG_FRAME) | (addr & PDRMASK);
+ /* Compute the physical address of the 4KB page. */
+ pa = ((*pdep & PG_PS_FRAME) | (addr & PDRMASK)) &
+ PG_FRAME;
} else {
pte = *pmap_pde_to_pte(pdep, addr);
pa = pte & PG_FRAME;
@@ -4397,7 +4394,7 @@
/*
* Modified by us
*/
- if (pte & PG_M)
+ if ((pte & (PG_M | PG_RW)) == (PG_M | PG_RW))
val |= MINCORE_MODIFIED|MINCORE_MODIFIED_OTHER;
else {
/*
==== //depot/projects/smpng/sys/amd64/ia32/ia32_signal.c#17 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_signal.c,v 1.16 2008/03/13 10:54:37 kib Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/ia32/ia32_signal.c,v 1.17 2008/03/23 22:44:56 peter Exp $");
#include "opt_compat.h"
@@ -715,10 +715,12 @@
struct trapframe *regs = td->td_frame;
struct pcb *pcb = td->td_pcb;
+ critical_enter();
wrmsr(MSR_FSBASE, 0);
wrmsr(MSR_KGSBASE, 0); /* User value while we're in the kernel */
pcb->pcb_fsbase = 0;
pcb->pcb_gsbase = 0;
+ critical_exit();
load_ds(_udatasel);
load_es(_udatasel);
load_fs(_udatasel);
==== //depot/projects/smpng/sys/amd64/include/pcb.h#12 (text+ko) ====
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)pcb.h 5.10 (Berkeley) 5/12/91
- * $FreeBSD: src/sys/amd64/include/pcb.h,v 1.63 2007/03/30 00:06:21 jkim Exp $
+ * $FreeBSD: src/sys/amd64/include/pcb.h,v 1.64 2008/03/23 22:45:51 peter Exp $
*/
#ifndef _AMD64_PCB_H_
@@ -55,6 +55,7 @@
register_t pcb_rip;
register_t pcb_fsbase;
register_t pcb_gsbase;
+ u_long pcb_flags;
u_int32_t pcb_ds;
u_int32_t pcb_es;
u_int32_t pcb_fs;
@@ -67,7 +68,6 @@
u_int64_t pcb_dr7;
struct savefpu pcb_save;
- u_long pcb_flags;
#define PCB_DBREGS 0x02 /* process using debug registers */
#define PCB_FPUINITDONE 0x08 /* fpu state is initialized */
#define PCB_32BIT 0x40 /* process has 32 bit context (segs etc) */
==== //depot/projects/smpng/sys/amd64/isa/atpic.c#18 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/isa/atpic.c,v 1.23 2008/03/16 10:58:02 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/isa/atpic.c,v 1.24 2008/03/20 21:53:27 jhb Exp $");
#include "opt_auto_eoi.h"
#include "opt_isa.h"
@@ -44,7 +44,6 @@
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
-#include <sys/mutex.h>
#include <machine/cpufunc.h>
#include <machine/frame.h>
@@ -208,12 +207,12 @@
struct atpic_intsrc *ai = (struct atpic_intsrc *)isrc;
struct atpic *ap = (struct atpic *)isrc->is_pic;
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
if (*ap->at_imen & IMEN_MASK(ai)) {
*ap->at_imen &= ~IMEN_MASK(ai);
outb(ap->at_ioaddr + ICU_IMR_OFFSET, *ap->at_imen);
}
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
}
static void
@@ -222,7 +221,7 @@
struct atpic_intsrc *ai = (struct atpic_intsrc *)isrc;
struct atpic *ap = (struct atpic *)isrc->is_pic;
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
if (ai->at_trigger != INTR_TRIGGER_EDGE) {
*ap->at_imen |= IMEN_MASK(ai);
outb(ap->at_ioaddr + ICU_IMR_OFFSET, *ap->at_imen);
@@ -240,16 +239,16 @@
_atpic_eoi_slave(isrc);
}
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
}
static void
atpic_eoi_master(struct intsrc *isrc)
{
#ifndef AUTO_EOI_1
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
_atpic_eoi_master(isrc);
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
#endif
}
@@ -257,9 +256,9 @@
atpic_eoi_slave(struct intsrc *isrc)
{
#ifndef AUTO_EOI_2
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
_atpic_eoi_slave(isrc);
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
#endif
}
@@ -351,10 +350,10 @@
if (bootverbose)
printf("atpic: Programming IRQ%u as %s\n", vector,
trig == INTR_TRIGGER_EDGE ? "edge/high" : "level/low");
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
elcr_write_trigger(atpic_vector(isrc), trig);
ai->at_trigger = trig;
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
return (0);
}
@@ -375,7 +374,7 @@
int imr_addr;
/* Reset the PIC and program with next four bytes. */
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
outb(pic->at_ioaddr, ICW1_RESET | ICW1_IC4);
imr_addr = pic->at_ioaddr + ICU_IMR_OFFSET;
@@ -407,7 +406,7 @@
/* OCW2_L1 sets priority order to 3-7, 0-2 (com2 first). */
if (!slave)
outb(pic->at_ioaddr, OCW2_R | OCW2_SL | OCW2_L1);
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
}
void
@@ -521,11 +520,11 @@
* pending. Reset read register back to IRR when done.
*/
port = ((struct atpic *)isrc->is_pic)->at_ioaddr;
- mtx_lock_spin(&icu_lock);
+ spinlock_enter();
outb(port, OCW3_SEL | OCW3_RR | OCW3_RIS);
isr = inb(port);
outb(port, OCW3_SEL | OCW3_RR);
- mtx_unlock_spin(&icu_lock);
+ spinlock_exit();
if ((isr & IRQ_MASK(7)) == 0)
return;
}
==== //depot/projects/smpng/sys/arm/arm/elf_trampoline.c#15 (text+ko) ====
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/elf_trampoline.c,v 1.18 2007/07/27 14:42:25 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/elf_trampoline.c,v 1.19 2008/03/22 20:34:07 cognet Exp $");
#include <machine/asm.h>
#include <sys/param.h>
#include <sys/elf32.h>
@@ -47,6 +47,7 @@
extern void *_end;
+void _start(void);
void __start(void);
void __startC(void);
==== //depot/projects/smpng/sys/arm/conf/AVILA#5 (text+ko) ====
@@ -16,7 +16,7 @@
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#
-# $FreeBSD: src/sys/arm/conf/AVILA,v 1.9 2008/03/12 10:11:55 jeff Exp $
+# $FreeBSD: src/sys/arm/conf/AVILA,v 1.10 2008/03/20 17:44:58 sam Exp $
machine arm
ident AVILA
@@ -91,7 +91,7 @@
device iicbb
device iic
-device ixpiic
+device ixpiic # I2C bus glue
device ixpwdog # watchdog timer
device ds1672 # DS1672 on I2C bus
device ad7418 # AD7418 on I2C bus
@@ -126,9 +126,12 @@
# Wireless NIC cards
device wlan # 802.11 support
-#device wlan_wep # 802.11 WEP support
-#device wlan_ccmp # 802.11 CCMP support
-#device wlan_tkip # 802.11 TKIP support
+device wlan_wep # 802.11 WEP support
+device wlan_ccmp # 802.11 CCMP support
+device wlan_tkip # 802.11 TKIP support
+device wlan_scan_sta
+device wlan_scan_ap
+device wlan_xauth
device ath # Atheros pci/cardbus NIC's
device ath_hal # Atheros HAL (Hardware Access Layer)
device ath_rate_sample # SampleRate tx rate control for ath
@@ -138,12 +141,15 @@
#device cryptodev
#device hifn # NB: Soekris minipci card known to work
-#device usb
-#options USB_DEBUG
-#device uhci
-#device ohci
-#device ehci
-#device ugen
-#device umass
-#device scbus # SCSI bus (required for SCSI)
-#device da # Direct Access (disks)
+device usb
+options USB_DEBUG
+device ohci
+device ehci
+device ugen
+device umass
+device scbus # SCSI bus (required for SCSI)
+device da # Direct Access (disks)
+
+device ural
+device zyd
+device wlan_amrr
==== //depot/projects/smpng/sys/arm/conf/AVILA.hints#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/arm/conf/AVILA.hints,v 1.2 2007/05/29 18:10:42 jhay Exp $
+# $FreeBSD: src/sys/arm/conf/AVILA.hints,v 1.3 2008/03/22 16:55:51 sam Exp $
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list