GENERIC from Mon Oct 8 21:34:09 2012 +0300, r241356+tmpfs 5fad92b, vmcore.451 KDB: debugger backends: ddb KDB: current backend: ddb 524288K of memory above 4GB ignored Copyright (c) 1992-2012 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 10.0-CURRENT #0 r241356+5fad92b: Tue Oct 9 22:40:02 CEST 2012 pho@x4.osted.lan:/var/tmp/deviant2/sys/i386/compile/PHO i386 WARNING: WITNESS option enabled, expect reduced performance. WARNING: DIAGNOSTIC option enabled, expect reduced performance. CPU: AMD Phenom(tm) 9150e Quad-Core Processor (1800.02-MHz 686-class CPU) Origin = "AuthenticAMD" Id = 0x100f23 Family = 0x10 Model = 0x2 Stepping = 3 Features=0x178bfbff Features2=0x802009 AMD Features=0xee500800 AMD Features2=0x7ff TSC: P-state invariant real memory = 4294967296 (4096 MB) avail memory = 3531591680 (3367 MB) : Trying to mount root from ufs:/dev/ad4s1a [rw]... Setting hostuuid: 00000000-0000-0000-0000-00218515337d. Setting hostid: 0x6b64ac17. Starting ddb. Entropy harvesting: interrupts ethernet point_to_point kickstart. warning: total configured swap (4194304 pages) exceeds maximum recommended amount (3890432 pages). warning: increase kern.maxswzone or reduce amount of swap. Starting file system checks: /dev/ad4s1a: FILE SYSTEM CLEAN; SKIPPING CHECKS /dev/ad4s1a: clean, 601572 free (1548 frags, 75003 blocks, 0.2% fragmentation) /dev/ad4s1f: FILE SYSTEM CLEAN; SKIPPING CHECKS /dev/ad4s1f: clean, 140032 free (5216 frags, 16852 blocks, 0.5% fragmentation) /dev/label/tmp: FILE SYSTEM CLEAN; SKIPPING CHECKS /dev/label/tmp: clean, 41137469 free (5429 frags, 5141505 blocks, 0.0% fragmentation) /dev/ad4s1d: FILE SYSTEM CLEAN; SKIPPING CHECKS /dev/ad4s1d: clean, 2932866 free (233018 frags, 337481 blocks, 2.3% fragmentation) /dev/ad4s1e: FILE SYSTEM CLEAN; SKIPPING CHECKS /dev/ad4s1e: clean, 16028706 free (63810 frags, 1995612 blocks, 0.3% fragmentation) Mounting local file systems:. Setting hostname: x4.osted.lan. re0: link state changed to DOWN re0: link state changed to UP Starting Network: lo0 re0 fwe0 fwip0. lo0: flags=8049 metric 0 mtu 16384 options=600003 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4 inet 127.0.0.1 netmask 0xff000000 nd6 options=21 re0: flags=8843 metric 0 mtu 1500 options=8209b ether 00:21:85:15:33:7d inet 192.168.1.101 netmask 0xffffff00 broadcast 192.168.1.255 inet6 fe80::221:85ff:fe15:337d%re0 prefixlen 64 scopeid 0x1 nd6 options=29 media: Ethernet autoselect (100baseTX ) status: active fwe0: flags=8802 metric 0 mtu 1500 options=8 ether 02:dc:10:62:ad:eb nd6 options=29 ch 1 dma -1 fwip0: flags=8802 metric 0 mtu 1500 lladdr 0.dc.10.0.1.62.ad.eb.a.2.ff.fe.0.0.0.0 nd6 options=29 Starting devd. Starting Network: fwe0. fwe0: flags=8802 metric 0 mtu 1500 options=8 ether 02:dc:10:62:ad:eb nd6 options=29 ch 1 dma -1 Starting Network: fwip0. fwip0: flags=8802 metric 0 mtu 1500 lladdr 0.dc.10.0.1.62.ad.eb.a.2.ff.fe.0.0.0.0 nd6 options=29 add net default: gateway 192.168.1.1 add net ::ffff:0.0.0.0: gateway ::1 add net ::0.0.0.0: gateway ::1 add net fe80::: gateway ::1 add net ff02::: gateway ::1 ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg /usr/local/kde4/lib /usr/local/lib/compat /usr/local/lib/compat/pkg /usr/local/lib/gcc46 /usr/local/lib/mysql /usr/local/lib/nss /usr/local/lib/qt4 /usr/local/lib/virtualbox a.out ldconfig path: /usr/lib/aout /usr/lib/compat/aout Creating and/or trimming log files. Starting syslogd. No core dumps found. Additional ABI support: linux. Starting rpcbind. NFS access cache time=60 lock order reversal: 1st 0xe191cca0 bufwait (bufwait) @ kern/vfs_bio.c:2652 2nd 0xca8af600 dirhash (dirhash) @ ufs/ufs/ufs_dirhash.c:284 KDB: stack backtrace: db_trace_self_wrapper(c10a4f50,2e687361,38323a63,c1000a34,ca974694,...) at db_trace_self_wrapper+0x26 kdb_backtrace(c0af953b,c10a8aec,c13aefa0,11c,f2774844,...) at kdb_backtrace+0x2a _witness_debugger(c10a8aec,ca8af600,c10da8fe,c7d82818,c10da590,...) at _witness_debugger+0x25 witness_checkorder(ca8af600,9,c10da587,11c,0,...) at witness_checkorder+0x86f _sx_xlock(ca8af600,0,c10da587,11c,ca9659f8,...) at _sx_xlock+0xa5 ufsdirhash_acquire(e191cc40,ca9659f8,34,e23b87d4,f2774914,...) at ufsdirhash_acquire+0x48 ufsdirhash_add(ca9659f8,f27749c0,7d4,f2774900,f2774904,...) at ufsdirhash_add+0x13 ufs_direnter(ca967708,caf80000,f27749c0,f2774b5c,e1920860,...) at ufs_direnter+0x799 ufs_mkdir(f2774bec,c10ff139,c1220d20,ca967708,f2774c00,...) at ufs_mkdir+0xa6f VOP_MKDIR_APV(c120c840,f2774bec,f2774b5c,f2774b84,0,...) at VOP_MKDIR_APV+0x100 kern_mkdirat(ca9745e0,ffffff9c,28803020,0,1c0,...) at kern_mkdirat+0x291 kern_mkdir(ca9745e0,28803020,0,1c0,f2774cfc,...) at kern_mkdir+0x2e sys_mkdir(ca9745e0,f2774ccc,e4bd92e1,0,f2774cc4,...) at sys_mkdir+0x29 syscall(f2774d08) at syscall+0x2fe Xint0x80_syscall() at Xint0x80_syscall+0x21 --- syscall (136, FreeBSD ELF32, sys_mkdir), eip = 0x2816953f, esp = 0xbfbfd8fc, ebp = 0xbfbfdda8 --- Clearing /tmp (X related). Starting mountd. Starting nfsuserd. Starting nfsd. Recovering vi editor sessions:lock order reversal: 1st 0xcafb25f8 ufs (ufs) @ kern/vfs_lookup.c:545 2nd 0xe1925380 bufwait (bufwait) @ ufs/ffs/ffs_vnops.c:261 3rd 0xcafb2328 ufs (ufs) @ kern/vfs_subr.c:2159 KDB: stack backtrace: db_trace_self_wrapper(c10a4f50,3a632e73,a313632,c62b9100,28abd000,...) at db_trace_self_wrapper+0x26 kdb_backtrace(c0af953b,c10a8b05,c13aebb8,86f,f278634c,...) at kdb_backtrace+0x2a _witness_debugger(c10a8b05,cafb2328,c109042b,c7d827b0,c10b0c65,...) at _witness_debugger+0x25 witness_checkorder(cafb2328,9,c10b0c5c,86f,0,...) at witness_checkorder+0x86f __lockmgr_args(cafb2328,80100,cafb2394,0,0,...) at __lockmgr_args+0x915 ffs_lock(f2786458,c0b0bd2c,5e2,c0b0bd2c,c109e9bf,...) at ffs_lock+0xa1 VOP_LOCK1_APV(c120c840,f2786458,ca6d30b4,c1220aa0,cafb22d0,...) at VOP_LOCK1_APV+0xf3 _vn_lock(cafb22d0,80100,c10b0c5c,86f,ec,...) at _vn_lock+0x78 vget(cafb22d0,80100,ca6d3000,50,0,...) at vget+0xbb vfs_hash_get(ca878bb0,15edc5,80000,ca6d3000,f27865a4,...) at vfs_hash_get+0xed ffs_vgetf(ca878bb0,15edc5,80000,f27865a4,1,...) at ffs_vgetf+0x49 softdep_sync_buf(cafb25a0,e1925320,1,107,0,...) at softdep_sync_buf+0xac9 ffs_syncvnode(cafb25a0,1,0,c13aeba8,c11dcde8,...) at ffs_syncvnode+0x24c ffs_truncate(cafb25a0,200,0,880,ca879080,...) at ffs_truncate+0x8b5 ufs_direnter(cafb25a0,cafb22d0,f2786918,f2786bc0,0,...) at ufs_direnter+0x980 ufs_makeinode(f2786bc0,c120ce00,f2786b10,f2786a6c,c0eed080,...) at ufs_makeinode+0x65d ufs_create(f2786b10,c10ff300,c1220d20,cafb25a0,f2786b24,...) at ufs_create+0x30 VOP_CREATE_APV(c120c840,f2786b10,f2786bc0,f2786aa8,0,...) at VOP_CREATE_APV+0x100 vn_open_cred(f2786b80,f2786c20,1b0,0,ca879080,...) at vn_open_cred+0x20a vn_open(f2786b80,f2786c20,1b0,ca8fe888,0,...) at vn_open+0x3b kern_openat(ca6d3000,ffffff9c,28c72f60,0,a03,...) at kern_openat+0x1e2 kern_open(ca6d3000,28c72f60,0,a02,1b0,...) at kern_open+0x35 sys_open(ca6d3000,f2786ccc,37af2765,0,f2786cc4,...) at sys_open+0x30 syscall(f2786d08) at syscall+0x2fe Xint0x80_syscall() at Xint0x80_syscall+0x21 --- syscall (5, FreeBSD ELF32, sys_open), eip = 0x28422d0f, esp = 0xbfbfb52c, ebp = 0xbfbfb5b8 --- . Updating motd:. Starting ntpd. Starting default moused. Configuring syscons: keymap blanktime. Starting sshd. Starting cron. Local package initialization: backuplock order reversal: 1st 0xca928058 ufs (ufs) @ kern/vfs_mount.c:1256 2nd 0xca968328 devfs (devfs) @ ufs/ffs/ffs_softdep.c:1834 KDB: stack backtrace: db_trace_self_wrapper(c10a4f50,38313a63,a3433,caf7fe68,8,...) at db_trace_self_wrapper+0x26 kdb_backtrace(c0af953b,c10a8aec,c13ae6d8,72a,f2850984,...) at kdb_backtrace+0x2a _witness_debugger(c10a8aec,ca968328,c109b834,c7d82610,c10d6a02,...) at _witness_debugger+0x25 witness_checkorder(ca968328,9,c10d69f9,72a,ca968394,...) at witness_checkorder+0x86f __lockmgr_args(ca968328,80400,ca968394,0,0,...) at __lockmgr_args+0x915 vop_stdlock(f2850a8c,c13e3fe0,4,c109e9bf,ec,...) at vop_stdlock+0x65 VOP_LOCK1_APV(c11cbc40,f2850a8c,c13e3fe0,c1220aa0,ca9682d0,...) at VOP_LOCK1_APV+0xf3 _vn_lock(ca9682d0,80400,c10d69f9,72a,0,...) at _vn_lock+0x78 softdep_flushworklist(cac302ec,f2850b44,caa05000,612,ca9677cc,...) at softdep_flushworklist+0x47 ffs_sync(cac302ec,1,f2850b98,522,c1baf2b0,...) at ffs_sync+0x3bf dounmount(cac302ec,8080000,caa05000,4a3,ffffffff,...) at dounmount+0x400 sys_unmount(caa05000,f2850ccc,bac191df,0,f2850cc4,...) at sys_unmount+0x421 syscall(f2850d08) at syscall+0x2fe Xint0x80_syscall() at Xint0x80_syscall+0x21 --- syscall (22, FreeBSD ELF32, sys_unmount), eip = 0x280c46a7, esp = 0xbfbfd67c, ebp = 0xbfbfd748 --- ** /dev/label/tmp ** Last Mounted on /tmp ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 2809 files, 77176512 used, 41137469 free (5429 frags, 5141505 blocks, 0.0% fragmentation) ***** FILE SYSTEM IS CLEAN ***** ** /dev/label/tmp ** Last Mounted on /tmp ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 2809 files, 77176512 used, 41137469 free (5429 frags, 5141505 blocks, 0.0% fragmentation) ***** FILE SYSTEM IS CLEAN ***** fsck -y /tmp watchdogd. Starting inetd. Tue Oct 9 23:11:19 CEST 2012 FreeBSD/i386 (x4.osted.lan) (console) login: Oct 9 23:13:27 x4 su: pho to root on /dev/pts/0 Oct 9 23:13:47 x4 kernel: pid 1457 (creat), uid 1004 inumber 4 on /mnt: out of inodes Oct 9 23:13:58 x4 kernel: pid 1449 (creat), uid 1004 inumber 6 on /mnt: out of inodes Oct 9 23:13:59 x4 kernel: pid 1451 (creat), uid 1004 inumber 1920 on /mnt: out of inodes Oct 9 23:14:15 x4 kernel: pid 1453 (creat), uid 1004 inumber 1924 on /mnt: out of inodes Oct 9 23:14:20 x4 kernel: pid 1457 (creat), uid 1004 inumber 4 on /mnt: out of inodes Oct 9 23:14:23 x4 kernel: pid 1451 (creat), uid 1004 inumber 1920 on /mnt: out of inodes Oct 9 23:14:31 x4 kernel: pid 1465 (mkdir), uid 1004 inumber 703 on /mnt: out of inodes Expensive timeout(9) function: 0xc0ab7040(0xcc207000) 0.028487483 s Expensive timeout(9) function: 0xc0900950(0xc1406500) 0.056344398 s Expensive timeout(9) function: 0xc0866730(0xc8031000) 0.067750438 s ~KDB: enter: Break to debugger [ thread pid 11 tid 100005 ] Stopped at kdb_enter+0x3a: movl $0,kdb_why db> panic: mtx_lock() by idle thread 0xc7de42f0 on sleep mutex eventhandler @ ../../../kern/subr_eventhandler.c:251 cpuid = 2 Uptime: 42m20s Physical memory: 3435 MB Dumping 246 MB: 231 215 199 183 167 151 135 119 103 87 71 55 39 23 7 Dump complete Automatic reboot in 15 seconds - press a key on the console to abort Rebooting... cpu_reset: Restarting BSP cpu_reset_proxy: Stopped CPU 2 (kgdb) bt #0 doadump (textdump=0x1) at pcpu.h:249 #1 0xc0abd975 in kern_reboot (howto=0x104) at ../../../kern/kern_shutdown.c:449 #2 0xc0abd1e5 in panic (fmt=Variable "fmt" is not available. ) at ../../../kern/kern_shutdown.c:637 #3 0xc0aaa4c1 in _mtx_lock_flags (m=0xc127fe48, opts=0x0, file=0xc10a48d9 "../../../kern/subr_eventhandler.c", line=0xfb) at ../../../kern/kern_mutex.c:203 #4 0xc0af2559 in eventhandler_find_list (name=0xc101e0e8 "dcons_poll") at ../../../kern/subr_eventhandler.c:251 #5 0xc06a38e8 in dcons_os_checkc (dc=0xc1234980) at ../../../dev/dcons/dcons_os.c:177 #6 0xc06a3a2e in dcons_cngetc (cp=0xc11678c0) at ../../../dev/dcons/dcons_os.c:265 #7 0xc0a73afa in cncheckc () at ../../../kern/kern_cons.c:405 #8 0xc0a73b3a in cngetc () at ../../../kern/kern_cons.c:386 #9 0xc0529975 in db_readline (lstart=0xc122a6c0 "", lsize=0x78) at ../../../ddb/db_input.c:326 #10 0xc052a34a in db_read_line () at ../../../ddb/db_lex.c:56 #11 0xc0528466 in db_command_loop () at ../../../ddb/db_command.c:500 #12 0xc052a46d in db_trap (type=0x3, code=0x0) at ../../../ddb/db_main.c:231 #13 0xc0af4fd6 in kdb_trap (type=0x3, code=0x0, tf=0xc7b2bad4) at ../../../kern/subr_kdb.c:654 #14 0xc0ec4d24 in trap (frame=0xc7b2bad4) at ../../../i386/i386/trap.c:716 #15 0xc0eade2c in calltrap () at ../../../i386/i386/exception.s:169 #16 0xc0af4aba in kdb_enter (why=0xc0f0cc09 "break", msg=0xc10a4ef7 "Break to debugger") at cpufunc.h:71 #17 0xc0af4af8 in kdb_break () at ../../../kern/subr_kdb.c:273 #18 0xc092ed2d in uart_intr (arg=0xc818f000) at ../../../dev/uart/uart_core.c:125 #19 0xc0a90586 in intr_event_handle (ie=0xc7dc3c80, frame=0xc7b2bbd0) at ../../../kern/kern_intr.c:1445 #20 0xc0edb3a9 in intr_execute_handlers (isrc=0xc7e2b0d0, frame=0xc7b2bbd0) at ../../../x86/x86/intr_machdep.c:269 #21 0xc0edef56 in lapic_handle_intr (vector=0x30, frame=0xc7b2bbd0) at ../../../x86/x86/local_apic.c:787 #22 0xc0eae225 in Xapic_isr1 () at apic_vector.s:89 #23 0xc0ea9f35 in acpi_cpu_c1 () at ../../../i386/acpica/acpi_machdep.c:114 #24 0xc05410fe in acpi_cpu_idle () at ../../../dev/acpica/acpi_cpu.c:987 #25 0xc0eb3cdf in cpu_idle_acpi (busy=0x0) at ../../../i386/i386/machdep.c:1273 #26 0xc0eb6a49 in cpu_idle (busy=0x0) at ../../../i386/i386/machdep.c:1439 #27 0xc0ae6503 in sched_idletd (dummy=0x0) at ../../../kern/sched_ule.c:2609 #28 0xc0a8c318 in fork_exit (callout=0xc0ae62a0 , arg=0x0, frame=0xc7b2bd08) at ../../../kern/kern_fork.c:995 #29 0xc0eaded4 in fork_trampoline () at ../../../i386/i386/exception.s:276 (kgdb) f 4 #4 0xc0af2559 in eventhandler_find_list (name=0xc101e0e8 "dcons_poll") at ../../../kern/subr_eventhandler.c:251 251 mtx_lock(&eventhandler_mutex); (kgdb) l 246 247 if (!eventhandler_lists_initted) 248 return(NULL); 249 250 /* scan looking for the requested list */ 251 mtx_lock(&eventhandler_mutex); 252 list = _eventhandler_find_list(name); 253 if (list != NULL) 254 EHL_LOCK(list); 255 mtx_unlock(&eventhandler_mutex); (kgdb) p eventhandler_mutex $2 = {lock_object = {lo_name = 0xc10a48cc "eventhandler", lo_flags = 0x1030000, lo_data = 0x0, lo_witness = 0xc7d7def8}, mtx_lock = 0x4} (kgdb) git diff master diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c index 7041818..3835976 100644 --- a/lib/libc/stdlib/rand.c +++ b/lib/libc/stdlib/rand.c @@ -130,9 +130,10 @@ sranddev() if (!done) { struct timeval tv; + unsigned long junk; gettimeofday(&tv, NULL); - srand((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec); + srand((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk); } } diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c index a3c054e..4a1af54 100644 --- a/lib/libc/stdlib/random.c +++ b/lib/libc/stdlib/random.c @@ -312,9 +312,10 @@ srandomdev(void) if (!done) { struct timeval tv; + volatile unsigned long junk; gettimeofday(&tv, NULL); - srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec); + srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk); return; } diff --git a/share/examples/kld/dyn_sysctl/dyn_sysctl.c b/share/examples/kld/dyn_sysctl/dyn_sysctl.c index 743f34b..684f58d 100644 --- a/share/examples/kld/dyn_sysctl/dyn_sysctl.c +++ b/share/examples/kld/dyn_sysctl/dyn_sysctl.c @@ -163,7 +163,7 @@ load(module_t mod, int cmd, void *arg) static moduledata_t mod_data = { "dyn_sysctl", load, - NULL + 0 }; DECLARE_MODULE(dyn_sysctl, mod_data, SI_SUB_EXEC, SI_ORDER_ANY); diff --git a/share/examples/kld/firmware/fwconsumer/fw_consumer.c b/share/examples/kld/firmware/fwconsumer/fw_consumer.c index 421dcc6..6a51737 100644 --- a/share/examples/kld/firmware/fwconsumer/fw_consumer.c +++ b/share/examples/kld/firmware/fwconsumer/fw_consumer.c @@ -71,7 +71,7 @@ fw_consumer_modevent(module_t mod, int type, void *unused) static moduledata_t fw_consumer_mod = { "fw_consumer", fw_consumer_modevent, - NULL + 0 }; DECLARE_MODULE(fw_consumer, fw_consumer_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(fw_consumer, 1); diff --git a/share/man/man9/module.9 b/share/man/man9/module.9 index bd072a9..055dab9 100644 --- a/share/man/man9/module.9 +++ b/share/man/man9/module.9 @@ -99,7 +99,7 @@ static int foo_handler(module_t mod, int /*modeventtype_t*/ what, static moduledata_t mod_data= { "foo", foo_handler, - NULL + 0 }; MODULE_VERSION(foo, 1); diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index abce826..cd3ebc5 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -298,6 +298,11 @@ cpu_startup(dummy) vm_pager_bufferinit(); cpu_setregs(); + + /* + * Add BSP as an interrupt target. + */ + intr_add_cpu(0); } /* diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index d2e4aad..7276ce1 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -784,8 +784,6 @@ init_secondary(void) * We tell the I/O APIC code about all the CPUs we want to receive * interrupts. If we don't want certain CPUs to receive IRQs we * can simply not tell the I/O APIC code about them in this function. - * We also do not tell it about the BSP since it tells itself about - * the BSP internally to work with UP kernels and on UP machines. */ static void set_interrupt_apic_ids(void) @@ -796,8 +794,6 @@ set_interrupt_apic_ids(void) apic_id = cpu_apic_ids[i]; if (apic_id == -1) continue; - if (cpu_info[apic_id].cpu_bsp) - continue; if (cpu_info[apic_id].cpu_disabled) continue; diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h index 91c33e6..99a94b7 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/include/atomic.h @@ -226,7 +226,7 @@ atomic_fetchadd_long(volatile u_long *p, u_long v) static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ - __compiler_membar(); \ + __asm __volatile("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -240,7 +240,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ u_##TYPE tmp; \ \ tmp = *p; \ - __compiler_membar(); \ + __asm __volatile("" : : : "memory"); \ return (tmp); \ } \ struct __hack diff --git a/sys/amd64/include/intr_machdep.h b/sys/amd64/include/intr_machdep.h index 700e35f..9d066b1 100644 --- a/sys/amd64/include/intr_machdep.h +++ b/sys/amd64/include/intr_machdep.h @@ -140,9 +140,7 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index c2043f6..5afc9ce 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -1198,7 +1198,7 @@ linux_elf_modevent(module_t mod, int type, void *data) static moduledata_t linux_elf_mod = { "linuxelf", linux_elf_modevent, - NULL + 0 }; DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); diff --git a/sys/boot/forth/beastie.4th b/sys/boot/forth/beastie.4th index 68d47f6..5c1ca81 100644 --- a/sys/boot/forth/beastie.4th +++ b/sys/boot/forth/beastie.4th @@ -28,6 +28,7 @@ marker task-beastie.4th +include /boot/color.4th include /boot/delay.4th variable logoX diff --git a/sys/boot/forth/color.4th.8 b/sys/boot/forth/color.4th.8 index 5b6baf0..d0233ed 100644 --- a/sys/boot/forth/color.4th.8 +++ b/sys/boot/forth/color.4th.8 @@ -50,7 +50,7 @@ through the command: .Dl include color.4th .Pp This line is present in -.Pa /boot/loader.4th +.Pa /boot/beastie.4th file, so it is not needed (and should not be re-issued) in a normal setup. .Pp The commands provided by it are: @@ -102,6 +102,7 @@ loader_color="YES" .Sh SEE ALSO .Xr loader.conf 5 , .Xr loader 8 , +.Xr beastie.4th 8 , .Xr loader.4th 8 .Sh HISTORY The diff --git a/sys/boot/forth/loader.4th b/sys/boot/forth/loader.4th index e252cfe..437533a 100644 --- a/sys/boot/forth/loader.4th +++ b/sys/boot/forth/loader.4th @@ -40,7 +40,6 @@ s" arch-i386" environment? [if] [if] 2048 dictincrease ! \ 2048 additional cells each time include /boot/support.4th -include /boot/color.4th only forth also support-functions also builtins definitions @@ -65,12 +64,6 @@ only forth also support-functions also builtins definitions : boot 0= if ( interpreted ) get_arguments then - loader_color? if - ." Booting..." cr - else - ." Booting..." cr - then - \ Unload only if a path was passed dup if >r over r> swap diff --git a/sys/boot/forth/menu-commands.4th b/sys/boot/forth/menu-commands.4th index b4f7033..b49b716 100644 --- a/sys/boot/forth/menu-commands.4th +++ b/sys/boot/forth/menu-commands.4th @@ -164,8 +164,8 @@ marker task-menu-commands.4th @ \ dereference address into value 48 + \ convert to ASCII numeral - s" set root=${root_prefix}${root[N]}${root_suffix}" - \ command to assemble root image-path + s" set root=${root_prefix}${root[N]}${root_prefix}" + \ command to assemble full kernel-path -rot tuck 30 + c! swap \ replace 'N' with array index value evaluate \ sets $kernel to full kernel-path diff --git a/sys/boot/forth/menu.4th b/sys/boot/forth/menu.4th index dcfc94f..1059a12 100644 --- a/sys/boot/forth/menu.4th +++ b/sys/boot/forth/menu.4th @@ -488,11 +488,7 @@ create init_text8 255 allot menurow @ 2 + menurow ! menurow @ menuY @ + at-xy - s" menu_optionstext" getenv dup -1 <> if - type - else - drop ." Options:" - then + ." Options:" then \ If this is the ACPI menu option, act accordingly. @@ -935,23 +931,23 @@ create init_text8 255 allot s" menu_caption[x][y]" \ cycle_menuitem caption -rot 2dup 13 + c! rot \ replace 'x' - 48 -rot + 49 -rot begin 16 2over rot + c! \ replace 'y' 2dup unsetenv - rot 1+ dup 57 > 2swap rot + rot 1+ dup 56 > 2swap rot until 2drop drop s" ansi_caption[x][y]" \ cycle_menuitem ANSI caption -rot 2dup 13 + c! rot \ replace 'x' - 48 -rot + 49 -rot begin 16 2over rot + c! \ replace 'y' 2dup unsetenv - rot 1+ dup 57 > 2swap rot + rot 1+ dup 56 > 2swap rot until 2drop drop @@ -976,7 +972,6 @@ create init_text8 255 allot \ clear the "Options" menu separator flag s" menu_options" unsetenv - s" menu_optionstext" unsetenv 0 menuoptions ! ; diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c index 152f85b..1b4cb78 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c @@ -5526,7 +5526,7 @@ zfs_modevent(module_t mod, int type, void *unused __unused) static moduledata_t zfs_mod = { "zfsctrl", zfs_modevent, - NULL + 0 }; DECLARE_MODULE(zfsctrl, zfs_mod, SI_SUB_VFS, SI_ORDER_ANY); MODULE_DEPEND(zfsctrl, opensolaris, 1, 1, 1); diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c index 76c0e29..561a838 100644 --- a/sys/compat/svr4/svr4_sysvec.c +++ b/sys/compat/svr4/svr4_sysvec.c @@ -308,7 +308,7 @@ svr4_elf_modevent(module_t mod, int type, void *data) static moduledata_t svr4_elf_mod = { "svr4elf", svr4_elf_modevent, - NULL + 0 }; DECLARE_MODULE_TIED(svr4elf, svr4_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); MODULE_DEPEND(svr4elf, streams, 1, 1, 1); diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index 709c613b..6dcb821 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -275,7 +275,7 @@ ipf_modunload() static moduledata_t ipfiltermod = { "ipfilter", ipfilter_modevent, - NULL + 0 }; diff --git a/sys/contrib/rdma/rdma_addr.c b/sys/contrib/rdma/rdma_addr.c index 4d43e4b..b1717c0 100644 --- a/sys/contrib/rdma/rdma_addr.c +++ b/sys/contrib/rdma/rdma_addr.c @@ -407,7 +407,7 @@ addr_load(module_t mod, int cmd, void *arg) static moduledata_t mod_data = { "rdma_addr", addr_load, - NULL + 0 }; MODULE_VERSION(rdma_addr, 1); diff --git a/sys/contrib/rdma/rdma_cma.c b/sys/contrib/rdma/rdma_cma.c index 0806094..ea3d501 100644 --- a/sys/contrib/rdma/rdma_cma.c +++ b/sys/contrib/rdma/rdma_cma.c @@ -2990,7 +2990,7 @@ cma_load(module_t mod, int cmd, void *arg) static moduledata_t mod_data = { "rdma_cma", cma_load, - NULL + 0 }; MODULE_VERSION(rdma_cma, 1); diff --git a/sys/contrib/rdma/rdma_device.c b/sys/contrib/rdma/rdma_device.c index a96aa68..53cf31f 100644 --- a/sys/contrib/rdma/rdma_device.c +++ b/sys/contrib/rdma/rdma_device.c @@ -769,7 +769,7 @@ rdma_core_load(module_t mod, int cmd, void *arg) static moduledata_t mod_data = { "rdma_core", rdma_core_load, - NULL + 0 }; MODULE_VERSION(rdma_core, 1); diff --git a/sys/contrib/rdma/rdma_iwcm.c b/sys/contrib/rdma/rdma_iwcm.c index a20bf95..916abcd 100644 --- a/sys/contrib/rdma/rdma_iwcm.c +++ b/sys/contrib/rdma/rdma_iwcm.c @@ -1078,7 +1078,7 @@ iw_cm_load(module_t mod, int cmd, void *arg) static moduledata_t mod_data = { "rdma_iwcm", iw_cm_load, - NULL + 0 }; MODULE_VERSION(rdma_iwcm, 1); diff --git a/sys/crypto/rc4/rc4.c b/sys/crypto/rc4/rc4.c index c2d5f96..dbdbd7a 100644 --- a/sys/crypto/rc4/rc4.c +++ b/sys/crypto/rc4/rc4.c @@ -122,7 +122,7 @@ rc4_modevent(module_t mod, int type, void *unused) static moduledata_t rc4_mod = { "rc4", rc4_modevent, - NULL + 0 }; DECLARE_MODULE(rc4, rc4_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(rc4, 1); diff --git a/sys/dev/arcmsr/arcmsr.c b/sys/dev/arcmsr/arcmsr.c index af359be..044f7d2 100644 --- a/sys/dev/arcmsr/arcmsr.c +++ b/sys/dev/arcmsr/arcmsr.c @@ -753,11 +753,11 @@ static void arcmsr_report_srb_state(struct AdapterControlBlock *acb, struct Comm } break; default: - printf("arcmsr%d: scsi id=%d lun=%d isr got command error done,but got unknown DeviceStatus=0x%x \n" + printf("arcmsr%d: scsi id=%d lun=%d isr got command error done,but got unknow DeviceStatus=0x%x \n" , acb->pci_unit, target, lun ,srb->arcmsr_cdb.DeviceStatus); acb->devstate[target][lun]=ARECA_RAID_GONE; srb->pccb->ccb_h.status |= CAM_UNCOR_PARITY; - /*unknown error or crc error just for retry*/ + /*unknow error or crc error just for retry*/ arcmsr_srb_complete(srb, 1); break; } @@ -1789,7 +1789,7 @@ static void arcmsr_interrupt(struct AdapterControlBlock *acb) break; default: printf("arcmsr%d: interrupt service," - " unknown adapter type =%d\n", acb->pci_unit, acb->adapter_type); + " unknow adapter type =%d\n", acb->pci_unit, acb->adapter_type); break; } } diff --git a/sys/dev/bktr/bktr_mem.c b/sys/dev/bktr/bktr_mem.c index e4e5487..77c5971 100644 --- a/sys/dev/bktr/bktr_mem.c +++ b/sys/dev/bktr/bktr_mem.c @@ -182,7 +182,7 @@ bktr_retrieve_address(int unit, int type) static moduledata_t bktr_mem_mod = { "bktr_mem", bktr_mem_modevent, - NULL + 0 }; /* diff --git a/sys/dev/cxgb/cxgb_t3fw.c b/sys/dev/cxgb/cxgb_t3fw.c index fcfb5de..44a4103 100644 --- a/sys/dev/cxgb/cxgb_t3fw.c +++ b/sys/dev/cxgb/cxgb_t3fw.c @@ -43,7 +43,7 @@ cxgb_t3fw_modevent(module_t mod, int type, void *unused) static moduledata_t cxgb_t3fw_mod = { "cxgb_t3fw", cxgb_t3fw_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3fw, cxgb_t3fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3fw, 1); @@ -76,7 +76,7 @@ cxgb_t3b_protocol_sram_modevent(module_t mod, int type, void *unused) static moduledata_t cxgb_t3b_protocol_sram_mod = { "cxgb_t3b_protocol_sram", cxgb_t3b_protocol_sram_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3b_protocol_sram, cxgb_t3b_protocol_sram_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3b_protocol_sram, 1); @@ -109,7 +109,7 @@ cxgb_t3b_tp_eeprom_modevent(module_t mod, int type, void *unused) static moduledata_t cxgb_t3b_tp_eeprom_mod = { "cxgb_t3b_tp_eeprom", cxgb_t3b_tp_eeprom_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3b_tp_eeprom, cxgb_t3b_tp_eeprom_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3b_tp_eeprom, 1); @@ -142,7 +142,7 @@ cxgb_t3c_protocol_sram_modevent(module_t mod, int type, void *unused) static moduledata_t cxgb_t3c_protocol_sram_mod = { "cxgb_t3c_protocol_sram", cxgb_t3c_protocol_sram_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3c_protocol_sram, cxgb_t3c_protocol_sram_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3c_protocol_sram, 1); @@ -175,7 +175,7 @@ cxgb_t3c_tp_eeprom_modevent(module_t mod, int type, void *unused) static moduledata_t cxgb_t3c_tp_eeprom_mod = { "cxgb_t3c_tp_eeprom", cxgb_t3c_tp_eeprom_modevent, - NULL + 0 }; DECLARE_MODULE(cxgb_t3c_tp_eeprom, cxgb_t3c_tp_eeprom_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(cxgb_t3c_tp_eeprom, 1); diff --git a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c index cbdb130..c8652a0 100644 --- a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c +++ b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c @@ -290,7 +290,7 @@ iwch_modevent(module_t mod, int cmd, void *arg) static moduledata_t iwch_mod_data = { "iw_cxgb", iwch_modevent, - NULL + 0 }; MODULE_VERSION(iw_cxgb, 1); diff --git a/sys/dev/cxgb/ulp/tom/cxgb_tom.c b/sys/dev/cxgb/ulp/tom/cxgb_tom.c index bd70b06..8f0dd25 100644 --- a/sys/dev/cxgb/ulp/tom/cxgb_tom.c +++ b/sys/dev/cxgb/ulp/tom/cxgb_tom.c @@ -387,7 +387,7 @@ t3_tom_modevent(module_t mod, int cmd, void *arg) static moduledata_t t3_tom_moddata= { "t3_tom", t3_tom_modevent, - NULL + 0 }; MODULE_VERSION(t3_tom, 1); diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 5d47ad3..330172d 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -768,7 +768,7 @@ t4_tom_modevent(module_t mod, int cmd, void *arg) static moduledata_t t4_tom_moddata= { "t4_tom", t4_tom_modevent, - NULL + 0 }; MODULE_VERSION(t4_tom, 1); diff --git a/sys/dev/drm2/drm_drv.c b/sys/dev/drm2/drm_drv.c index efffcbb..33e50ea 100644 --- a/sys/dev/drm2/drm_drv.c +++ b/sys/dev/drm2/drm_drv.c @@ -74,7 +74,7 @@ drm_modevent(module_t mod, int type, void *data) static moduledata_t drm_mod = { "drmn", drm_modevent, - NULL + 0 }; DECLARE_MODULE(drmn, drm_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(drmn, 1); diff --git a/sys/dev/iscsi/initiator/iscsi.c b/sys/dev/iscsi/initiator/iscsi.c index 899501a..a93a685 100644 --- a/sys/dev/iscsi/initiator/iscsi.c +++ b/sys/dev/iscsi/initiator/iscsi.c @@ -855,9 +855,9 @@ iscsi_modevent(module_t mod, int what, void *arg) } moduledata_t iscsi_mod = { - "iscsi", - (modeventhand_t) iscsi_modevent, - NULL + "iscsi", + (modeventhand_t) iscsi_modevent, + 0 }; #ifdef ISCSI_ROOT diff --git a/sys/dev/mxge/mxge_eth_z8e.c b/sys/dev/mxge/mxge_eth_z8e.c index 497fd3b..570f654 100644 --- a/sys/dev/mxge/mxge_eth_z8e.c +++ b/sys/dev/mxge/mxge_eth_z8e.c @@ -39,7 +39,7 @@ mxge_eth_z8e_fw_modevent(module_t mod, int type, void *unused) static moduledata_t mxge_eth_z8e_fw_mod = { "mxge_eth_z8e_fw", mxge_eth_z8e_fw_modevent, - NULL + 0 }; DECLARE_MODULE(mxge_eth_z8e_fw, mxge_eth_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(mxge_eth_z8e_fw, 1); diff --git a/sys/dev/mxge/mxge_ethp_z8e.c b/sys/dev/mxge/mxge_ethp_z8e.c index d41a080..8d0e31b 100644 --- a/sys/dev/mxge/mxge_ethp_z8e.c +++ b/sys/dev/mxge/mxge_ethp_z8e.c @@ -39,7 +39,7 @@ mxge_ethp_z8e_fw_modevent(module_t mod, int type, void *unused) static moduledata_t mxge_ethp_z8e_fw_mod = { "mxge_ethp_z8e_fw", mxge_ethp_z8e_fw_modevent, - NULL + 0 }; DECLARE_MODULE(mxge_ethp_z8e_fw, mxge_ethp_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(mxge_ethp_z8e_fw, 1); diff --git a/sys/dev/mxge/mxge_rss_eth_z8e.c b/sys/dev/mxge/mxge_rss_eth_z8e.c index d41ab4a..d31907a 100644 --- a/sys/dev/mxge/mxge_rss_eth_z8e.c +++ b/sys/dev/mxge/mxge_rss_eth_z8e.c @@ -39,7 +39,7 @@ mxge_rss_eth_z8e_fw_modevent(module_t mod, int type, void *unused) static moduledata_t mxge_rss_eth_z8e_fw_mod = { "mxge_rss_eth_z8e_fw", mxge_rss_eth_z8e_fw_modevent, - NULL + 0 }; DECLARE_MODULE(mxge_rss_eth_z8e_fw, mxge_rss_eth_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(mxge_rss_eth_z8e_fw, 1); diff --git a/sys/dev/mxge/mxge_rss_ethp_z8e.c b/sys/dev/mxge/mxge_rss_ethp_z8e.c index 84cfe23..ca7be0e 100644 --- a/sys/dev/mxge/mxge_rss_ethp_z8e.c +++ b/sys/dev/mxge/mxge_rss_ethp_z8e.c @@ -39,7 +39,7 @@ mxge_rss_ethp_z8e_fw_modevent(module_t mod, int type, void *unused) static moduledata_t mxge_rss_ethp_z8e_fw_mod = { "mxge_rss_ethp_z8e_fw", mxge_rss_ethp_z8e_fw_modevent, - NULL + 0 }; DECLARE_MODULE(mxge_rss_ethp_z8e_fw, mxge_rss_ethp_z8e_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(mxge_rss_ethp_z8e_fw, 1); diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c index 11239ef..2017d79 100644 --- a/sys/dev/nvd/nvd.c +++ b/sys/dev/nvd/nvd.c @@ -93,7 +93,7 @@ static int nvd_modevent(module_t mod, int type, void *arg) moduledata_t nvd_mod = { "nvd", (modeventhand_t)nvd_modevent, - NULL + 0 }; DECLARE_MODULE(nvd, nvd_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 350e04a..edc536e 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -177,7 +177,7 @@ nvme_modevent(module_t mod, int type, void *arg) moduledata_t nvme_mod = { "nvme", (modeventhand_t)nvme_modevent, - NULL + 0 }; DECLARE_MODULE(nvme, nvme_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); diff --git a/sys/dev/rndtest/rndtest.c b/sys/dev/rndtest/rndtest.c index 1803e0d..4e42aa8c 100644 --- a/sys/dev/rndtest/rndtest.c +++ b/sys/dev/rndtest/rndtest.c @@ -402,7 +402,7 @@ rndtest_modevent(module_t mod, int type, void *unused) static moduledata_t rndtest_mod = { "rndtest", rndtest_modevent, - NULL + 0 }; DECLARE_MODULE(rndtest, rndtest_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(rndtest, 1); diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 73be7ff..ad2817f 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -171,7 +171,7 @@ streams_modevent(module_t mod, int type, void *unused) static moduledata_t streams_mod = { "streams", streams_modevent, - NULL + 0 }; DECLARE_MODULE(streams, streams_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); MODULE_VERSION(streams, 1); diff --git a/sys/dev/tdfx/tdfx_linux.c b/sys/dev/tdfx/tdfx_linux.c index e3d2197..0b769f0 100644 --- a/sys/dev/tdfx/tdfx_linux.c +++ b/sys/dev/tdfx/tdfx_linux.c @@ -78,7 +78,7 @@ tdfx_linux_modevent(struct module *mod __unused, int what, void *arg __unused) static moduledata_t tdfx_linux_mod = { "tdfx_linux", tdfx_linux_modevent, - NULL + 0 }; /* As in SYSCALL_MODULE */ diff --git a/sys/dev/usb/net/usb_ethernet.c b/sys/dev/usb/net/usb_ethernet.c index 6857bac..2a7bddf 100644 --- a/sys/dev/usb/net/usb_ethernet.c +++ b/sys/dev/usb/net/usb_ethernet.c @@ -549,7 +549,7 @@ uether_modevent(module_t mod, int type, void *data) static moduledata_t uether_mod = { "uether", uether_modevent, - NULL + 0 }; struct mbuf * diff --git a/sys/dev/utopia/utopia.c b/sys/dev/utopia/utopia.c index b9c68f3..a4e7331 100644 --- a/sys/dev/utopia/utopia.c +++ b/sys/dev/utopia/utopia.c @@ -668,7 +668,7 @@ utopia_mod_init(module_t mod, int what, void *arg) static moduledata_t utopia_mod = { "utopia", utopia_mod_init, - NULL + 0 }; DECLARE_MODULE(utopia, utopia_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); diff --git a/sys/dev/virtio/virtio.c b/sys/dev/virtio/virtio.c index bd893a2..1cac3c7 100644 --- a/sys/dev/virtio/virtio.c +++ b/sys/dev/virtio/virtio.c @@ -269,7 +269,7 @@ virtio_modevent(module_t mod, int type, void *unused) static moduledata_t virtio_mod = { "virtio", virtio_modevent, - NULL + 0 }; DECLARE_MODULE(virtio, virtio_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 5fb020b..ab0cc49 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -665,7 +665,9 @@ null_unlock(struct vop_unlock_args *ap) } /* - * XXXKIB + * Do not allow the VOP_INACTIVE to be bypassed to the lower layer, + * since the reference count on the lower vnode is not related with + * our. */ static int null_inactive(struct vop_inactive_args *ap __unused) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 5f1616c..20ef54e 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -154,6 +154,7 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp, enum vtype type, char *target, dev_t rdev, struct tmpfs_node **node) { struct tmpfs_node *nnode; + vm_object_t obj; /* If the root directory of the 'tmp' file system is not yet * allocated, this must be the request to do it. */ @@ -214,9 +215,14 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp, enum vtype type, break; case VREG: - nnode->tn_reg.tn_aobj = + obj = nnode->tn_reg.tn_aobj = vm_pager_allocate(OBJT_SWAP, NULL, 0, VM_PROT_DEFAULT, 0, NULL /* XXXKIB - tmpfs needs swap reservation */); + VM_OBJECT_LOCK(obj); + /* OBJ_TMPFS is set together with the setting of vp->v_object */ + vm_object_set_flag(obj, OBJ_NOSPLIT); + vm_object_clear_flag(obj, OBJ_ONEMAPPING); + VM_OBJECT_UNLOCK(obj); break; default: @@ -381,9 +387,11 @@ int tmpfs_alloc_vp(struct mount *mp, struct tmpfs_node *node, int lkflag, struct vnode **vpp) { - int error = 0; struct vnode *vp; + vm_object_t object; + int error; + error = 0; loop: TMPFS_NODE_LOCK(node); if ((vp = node->tn_vnode) != NULL) { @@ -453,13 +461,22 @@ loop: /* FALLTHROUGH */ case VLNK: /* FALLTHROUGH */ - case VREG: - /* FALLTHROUGH */ case VSOCK: break; case VFIFO: vp->v_op = &tmpfs_fifoop_entries; break; + case VREG: + object = node->tn_reg.tn_aobj; + VM_OBJECT_LOCK(object); + VI_LOCK(vp); + KASSERT(vp->v_object == NULL, ("Not NULL v_object in tmpfs")); + vp->v_object = object; + object->un_pager.swp.swp_tmpfs = vp; + vm_object_set_flag(object, OBJ_TMPFS); + VI_UNLOCK(vp); + VM_OBJECT_UNLOCK(object); + break; case VDIR: MPASS(node->tn_dir.tn_parent != NULL); if (node->tn_dir.tn_parent == node) @@ -470,7 +487,6 @@ loop: panic("tmpfs_alloc_vp: type %p %d", node, (int)node->tn_type); } - vnode_pager_setsize(vp, node->tn_size); error = insmntque(vp, mp); if (error) vp = NULL; @@ -1058,7 +1074,6 @@ retry: TMPFS_UNLOCK(tmp); node->tn_size = newsize; - vnode_pager_setsize(vp, newsize); return (0); } diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 368e1ca..f8aed5e 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -276,8 +276,6 @@ tmpfs_close(struct vop_close_args *v) { struct vnode *vp = v->a_vp; - MPASS(VOP_ISLOCKED(vp)); - /* Update node times. */ tmpfs_update(vp); @@ -437,7 +435,6 @@ tmpfs_setattr(struct vop_setattr_args *v) return error; } -/* --------------------------------------------------------------------- */ static int tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, vm_offset_t offset, size_t tlen, struct uio *uio) @@ -446,12 +443,21 @@ tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, int error, rv; VM_OBJECT_LOCK(tobj); - m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + m = vm_page_grab(tobj, idx, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (m->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(tobj, idx, NULL, NULL)) { rv = vm_pager_get_pages(tobj, &m, 1, 0); + m = vm_page_lookup(tobj, idx); + if (m == NULL) { + printf( + "tmpfs: vm_obj %p idx %jd null lookup rv %d\n", + tobj, idx, rv); + return (EIO); + } if (rv != VM_PAGER_OK) { + printf( + "tmpfs: vm_obj %p idx %jd valid %x pager error %d\n", + tobj, idx, m->valid, rv); vm_page_lock(m); vm_page_free(m); vm_page_unlock(m); @@ -461,132 +467,35 @@ tmpfs_nocacheread(vm_object_t tobj, vm_pindex_t idx, } else vm_page_zero_invalid(m, TRUE); } + vm_page_lock(m); + vm_page_hold(m); + vm_page_wakeup(m); + vm_page_unlock(m); VM_OBJECT_UNLOCK(tobj); error = uiomove_fromphys(&m, offset, tlen, uio); VM_OBJECT_LOCK(tobj); vm_page_lock(m); - vm_page_unwire(m, TRUE); + vm_page_unhold(m); vm_page_unlock(m); - vm_page_wakeup(m); VM_OBJECT_UNLOCK(tobj); return (error); } -static __inline int -tmpfs_nocacheread_buf(vm_object_t tobj, vm_pindex_t idx, - vm_offset_t offset, size_t tlen, void *buf) -{ - struct uio uio; - struct iovec iov; - - uio.uio_iovcnt = 1; - uio.uio_iov = &iov; - iov.iov_base = buf; - iov.iov_len = tlen; - - uio.uio_offset = 0; - uio.uio_resid = tlen; - uio.uio_rw = UIO_READ; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_td = curthread; - - return (tmpfs_nocacheread(tobj, idx, offset, tlen, &uio)); -} - -static int -tmpfs_mappedread(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) -{ - struct sf_buf *sf; - vm_pindex_t idx; - vm_page_t m; - vm_offset_t offset; - off_t addr; - size_t tlen; - char *ma; - int error; - - addr = uio->uio_offset; - idx = OFF_TO_IDX(addr); - offset = addr & PAGE_MASK; - tlen = MIN(PAGE_SIZE - offset, len); - - if ((vobj == NULL) || - (vobj->resident_page_count == 0 && vobj->cache == NULL)) - goto nocache; - - VM_OBJECT_LOCK(vobj); -lookupvpg: - if (((m = vm_page_lookup(vobj, idx)) != NULL) && - vm_page_is_valid(m, offset, tlen)) { - if ((m->oflags & VPO_BUSY) != 0) { - /* - * Reference the page before unlocking and sleeping so - * that the page daemon is less likely to reclaim it. - */ - vm_page_reference(m); - vm_page_sleep(m, "tmfsmr"); - goto lookupvpg; - } - vm_page_busy(m); - VM_OBJECT_UNLOCK(vobj); - error = uiomove_fromphys(&m, offset, tlen, uio); - VM_OBJECT_LOCK(vobj); - vm_page_wakeup(m); - VM_OBJECT_UNLOCK(vobj); - return (error); - } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { - KASSERT(offset == 0, - ("unexpected offset in tmpfs_mappedread for sendfile")); - if ((m->oflags & VPO_BUSY) != 0) { - /* - * Reference the page before unlocking and sleeping so - * that the page daemon is less likely to reclaim it. - */ - vm_page_reference(m); - vm_page_sleep(m, "tmfsmr"); - goto lookupvpg; - } - vm_page_busy(m); - VM_OBJECT_UNLOCK(vobj); - sched_pin(); - sf = sf_buf_alloc(m, SFB_CPUPRIVATE); - ma = (char *)sf_buf_kva(sf); - error = tmpfs_nocacheread_buf(tobj, idx, 0, tlen, ma); - if (error == 0) { - if (tlen != PAGE_SIZE) - bzero(ma + tlen, PAGE_SIZE - tlen); - uio->uio_offset += tlen; - uio->uio_resid -= tlen; - } - sf_buf_free(sf); - sched_unpin(); - VM_OBJECT_LOCK(vobj); - if (error == 0) - m->valid = VM_PAGE_BITS_ALL; - vm_page_wakeup(m); - VM_OBJECT_UNLOCK(vobj); - return (error); - } - VM_OBJECT_UNLOCK(vobj); -nocache: - error = tmpfs_nocacheread(tobj, idx, offset, tlen, uio); - - return (error); -} - static int tmpfs_read(struct vop_read_args *v) { struct vnode *vp = v->a_vp; struct uio *uio = v->a_uio; - struct tmpfs_node *node; vm_object_t uobj; size_t len; int resid; - int error = 0; + vm_pindex_t idx; + vm_offset_t offset; + off_t addr; + size_t tlen; node = VP_TO_TMPFS_NODE(vp); @@ -610,7 +519,11 @@ tmpfs_read(struct vop_read_args *v) len = MIN(node->tn_size - uio->uio_offset, resid); if (len == 0) break; - error = tmpfs_mappedread(vp->v_object, uobj, len, uio); + addr = uio->uio_offset; + idx = OFF_TO_IDX(addr); + offset = addr & PAGE_MASK; + tlen = MIN(PAGE_SIZE - offset, len); + error = tmpfs_nocacheread(uobj, idx, offset, tlen, uio); if ((error != 0) || (resid == uio->uio_resid)) break; } @@ -623,10 +536,10 @@ out: /* --------------------------------------------------------------------- */ static int -tmpfs_mappedwrite(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *uio) +tmpfs_mappedwrite(vm_object_t tobj, size_t len, struct uio *uio) { vm_pindex_t idx; - vm_page_t vpg, tpg; + vm_page_t tpg; vm_offset_t offset; off_t addr; size_t tlen; @@ -639,76 +552,44 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_object_t tobj, size_t len, struct uio *ui offset = addr & PAGE_MASK; tlen = MIN(PAGE_SIZE - offset, len); - if ((vobj == NULL) || - (vobj->resident_page_count == 0 && vobj->cache == NULL)) { - vpg = NULL; - goto nocache; - } - - VM_OBJECT_LOCK(vobj); -lookupvpg: - if (((vpg = vm_page_lookup(vobj, idx)) != NULL) && - vm_page_is_valid(vpg, offset, tlen)) { - if ((vpg->oflags & VPO_BUSY) != 0) { - /* - * Reference the page before unlocking and sleeping so - * that the page daemon is less likely to reclaim it. - */ - vm_page_reference(vpg); - vm_page_sleep(vpg, "tmfsmw"); - goto lookupvpg; - } - vm_page_busy(vpg); - vm_page_undirty(vpg); - VM_OBJECT_UNLOCK(vobj); - error = uiomove_fromphys(&vpg, offset, tlen, uio); - } else { - if (vm_page_is_cached(vobj, idx)) - vm_page_cache_free(vobj, idx, idx + 1); - VM_OBJECT_UNLOCK(vobj); - vpg = NULL; - } -nocache: VM_OBJECT_LOCK(tobj); - tpg = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + tpg = vm_page_grab(tobj, idx, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (tpg->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(tobj, idx, NULL, NULL)) { rv = vm_pager_get_pages(tobj, &tpg, 1, 0); + tpg = vm_page_lookup(tobj, idx); + if (tpg == NULL) { + printf( + "tmpfs: vm_obj %p idx %jd null lookup rv %d\n", + tobj, idx, rv); + return (EIO); + } if (rv != VM_PAGER_OK) { + printf( + "tmpfs: vm_obj %p idx %jd valid %x pager error %d\n", + tobj, idx, tpg->valid, rv); vm_page_lock(tpg); vm_page_free(tpg); vm_page_unlock(tpg); - error = EIO; - goto out; + VM_OBJECT_UNLOCK(tobj); + return (EIO); } } else vm_page_zero_invalid(tpg, TRUE); } + vm_page_lock(tpg); + vm_page_hold(tpg); + vm_page_wakeup(tpg); + vm_page_unlock(tpg); VM_OBJECT_UNLOCK(tobj); - if (vpg == NULL) - error = uiomove_fromphys(&tpg, offset, tlen, uio); - else { - KASSERT(vpg->valid == VM_PAGE_BITS_ALL, ("parts of vpg invalid")); - pmap_copy_page(vpg, tpg); - } + error = uiomove_fromphys(&tpg, offset, tlen, uio); VM_OBJECT_LOCK(tobj); - if (error == 0) { - KASSERT(tpg->valid == VM_PAGE_BITS_ALL, - ("parts of tpg invalid")); + if (error == 0) vm_page_dirty(tpg); - } vm_page_lock(tpg); - vm_page_unwire(tpg, TRUE); + vm_page_unhold(tpg); vm_page_unlock(tpg); - vm_page_wakeup(tpg); -out: VM_OBJECT_UNLOCK(tobj); - if (vpg != NULL) { - VM_OBJECT_LOCK(vobj); - vm_page_wakeup(vpg); - VM_OBJECT_UNLOCK(vobj); - } return (error); } @@ -766,7 +647,7 @@ tmpfs_write(struct vop_write_args *v) len = MIN(node->tn_size - uio->uio_offset, resid); if (len == 0) break; - error = tmpfs_mappedwrite(vp->v_object, uobj, len, uio); + error = tmpfs_mappedwrite(uobj, len, uio); if ((error != 0) || (resid == uio->uio_resid)) break; } @@ -1581,8 +1462,6 @@ tmpfs_inactive(struct vop_inactive_args *v) struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(vp)); - node = VP_TO_TMPFS_NODE(vp); if (node->tn_links == 0) @@ -1604,7 +1483,7 @@ tmpfs_reclaim(struct vop_reclaim_args *v) node = VP_TO_TMPFS_NODE(vp); tmp = VFS_TO_TMPFS(vp->v_mount); - vnode_destroy_vobject(vp); + vp->v_object = NULL; cache_purge(vp); TMPFS_NODE_LOCK(node); diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h b/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h index 55a03c9..7229f27 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_compat.h @@ -129,6 +129,10 @@ typedef dev_t os_dev_t; #define copy_from_user(dst, src, len) copyin((src), (dst), (len)) #endif +#ifndef barrier +#define barrier() __asm__ __volatile__("": : :"memory") +#endif + /* * Map simple global vairables to FreeBSD kernel equivalents */ diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_freebsd.h b/sys/gnu/fs/xfs/FreeBSD/xfs_freebsd.h index cc1d8df..a47c413 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_freebsd.h +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_freebsd.h @@ -162,7 +162,7 @@ */ #define EFSCORRUPTED 990 /* Filesystem is corrupted */ -#define SYNCHRONIZE() __compiler_membar() +#define SYNCHRONIZE() barrier() #define __return_address __builtin_return_address(0) /* diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 744c3cb..c194567 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -338,6 +338,11 @@ cpu_startup(dummy) #ifndef XEN cpu_setregs(); #endif + + /* + * Add BSP as an interrupt target. + */ + intr_add_cpu(0); } /* diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index 89c0430..2dfc9ba 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -823,8 +823,6 @@ init_secondary(void) * We tell the I/O APIC code about all the CPUs we want to receive * interrupts. If we don't want certain CPUs to receive IRQs we * can simply not tell the I/O APIC code about them in this function. - * We also do not tell it about the BSP since it tells itself about - * the BSP internally to work with UP kernels and on UP machines. */ static void set_interrupt_apic_ids(void) @@ -835,8 +833,6 @@ set_interrupt_apic_ids(void) apic_id = cpu_apic_ids[i]; if (apic_id == -1) continue; - if (cpu_info[apic_id].cpu_bsp) - continue; if (cpu_info[apic_id].cpu_disabled) continue; diff --git a/sys/i386/ibcs2/ibcs2_sysvec.c b/sys/i386/ibcs2/ibcs2_sysvec.c index 6a99bbc..5b6f680 100644 --- a/sys/i386/ibcs2/ibcs2_sysvec.c +++ b/sys/i386/ibcs2/ibcs2_sysvec.c @@ -133,6 +133,6 @@ ibcs2_modevent(module_t mod, int type, void *unused) static moduledata_t ibcs2_mod = { "ibcs2", ibcs2_modevent, - NULL + 0 }; DECLARE_MODULE_TIED(ibcs2, ibcs2_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h index 3b9d001..6ef5962 100644 --- a/sys/i386/include/atomic.h +++ b/sys/i386/include/atomic.h @@ -296,7 +296,7 @@ atomic_fetchadd_int(volatile u_int *p, u_int v) static __inline void \ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ { \ - __compiler_membar(); \ + __asm __volatile("" : : : "memory"); \ *p = v; \ } \ struct __hack @@ -310,7 +310,7 @@ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ u_##TYPE tmp; \ \ tmp = *p; \ - __compiler_membar(); \ + __asm __volatile("" : : : "memory"); \ return (tmp); \ } \ struct __hack diff --git a/sys/i386/include/intr_machdep.h b/sys/i386/include/intr_machdep.h index 004ed52..b5ba3c1 100644 --- a/sys/i386/include/intr_machdep.h +++ b/sys/i386/include/intr_machdep.h @@ -131,9 +131,7 @@ int elcr_probe(void); enum intr_trigger elcr_read_trigger(u_int irq); void elcr_resume(void); void elcr_write_trigger(u_int irq, enum intr_trigger trigger); -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep); #ifdef SMP diff --git a/sys/i386/isa/elink.c b/sys/i386/isa/elink.c index 11bf6ff..5fbfd36 100644 --- a/sys/i386/isa/elink.c +++ b/sys/i386/isa/elink.c @@ -87,7 +87,7 @@ elink_idseq(u_char p) static moduledata_t elink_mod = { "elink",/* module name */ NULL, /* event handler */ - NULL /* extra data */ + 0 /* extra data */ }; DECLARE_MODULE(elink, elink_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 39acb02..d4e23e1 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -1173,7 +1173,7 @@ linux_elf_modevent(module_t mod, int type, void *data) static moduledata_t linux_elf_mod = { "linuxelf", linux_elf_modevent, - NULL + 0 }; DECLARE_MODULE_TIED(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY); diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 30400b1..ef1920b 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -65,6 +65,10 @@ __FBSDID("$FreeBSD$"); * does not seem very useful */ +static __inline void compiler_memory_barrier(void) { + __asm __volatile("":::"memory"); +} + static void assert_rm(const struct lock_object *lock, int what); static void lock_rm(struct lock_object *lock, int how); #ifdef KDTRACE_HOOKS @@ -349,7 +353,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) td->td_critnest++; /* critical_enter(); */ - __compiler_membar(); + compiler_memory_barrier(); pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ @@ -357,7 +361,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) sched_pin(); - __compiler_membar(); + compiler_memory_barrier(); td->td_critnest--; diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 94dd127..c3f5fae 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1832,9 +1832,10 @@ kern_sendfile(struct thread *td, struct sendfile_args *uap, struct mbuf *m = NULL; struct sf_buf *sf; struct vm_page *pg; + struct vattr va; off_t off, xfsize, fsbytes = 0, sbytes = 0, rem = 0; int error, hdrlen = 0, mnw = 0; - int vfslocked; + int bsize, vfslocked; struct sendfile_sync *sfs = NULL; /* @@ -2031,6 +2032,20 @@ retry_space: */ space -= hdrlen; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + error = vn_lock(vp, LK_SHARED); + if (error != 0) { + VFS_UNLOCK_GIANT(vfslocked); + goto done; + } + error = VOP_GETATTR(vp, &va, td->td_ucred); + if (error != 0) { + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + goto done; + } + bsize = vp->v_mount->mnt_stat.f_iosize; + /* * Loop and construct maximum sized mbuf chain to be bulk * dumped into socket buffer. @@ -2040,7 +2055,6 @@ retry_space: vm_offset_t pgoff; struct mbuf *m0; - VM_OBJECT_LOCK(obj); /* * Calculate the amount to transfer. * Not to exceed a page, the EOF, @@ -2048,17 +2062,16 @@ retry_space: */ pgoff = (vm_offset_t)(off & PAGE_MASK); xfsize = omin(PAGE_SIZE - pgoff, - obj->un_pager.vnp.vnp_size - uap->offset - + va.va_size - uap->offset - fsbytes - loopbytes); if (uap->nbytes) rem = (uap->nbytes - fsbytes - loopbytes); else - rem = obj->un_pager.vnp.vnp_size - + rem = va.va_size - uap->offset - fsbytes - loopbytes; xfsize = omin(rem, xfsize); xfsize = omin(space - loopbytes, xfsize); if (xfsize <= 0) { - VM_OBJECT_UNLOCK(obj); done = 1; /* all data sent */ break; } @@ -2068,6 +2081,7 @@ retry_space: * if not found or wait and loop if busy. */ pindex = OFF_TO_IDX(off); + VM_OBJECT_LOCK(obj); pg = vm_page_grab(obj, pindex, VM_ALLOC_NOBUSY | VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_RETRY); @@ -2085,7 +2099,6 @@ retry_space: else if (uap->flags & SF_NODISKIO) error = EBUSY; else { - int bsize; ssize_t resid; /* @@ -2098,12 +2111,6 @@ retry_space: /* * Get the page from backing store. */ - vfslocked = VFS_LOCK_GIANT(vp->v_mount); - error = vn_lock(vp, LK_SHARED); - if (error != 0) - goto after_read; - bsize = vp->v_mount->mnt_stat.f_iosize; - /* * XXXMAC: Because we don't have fp->f_cred * here, we pass in NOCRED. This is probably @@ -2114,9 +2121,6 @@ retry_space: trunc_page(off), UIO_NOCOPY, IO_NODELOCKED | IO_VMIO | ((MAXBSIZE / bsize) << IO_SEQSHIFT), td->td_ucred, NOCRED, &resid, td); - VOP_UNLOCK(vp, 0); - after_read: - VFS_UNLOCK_GIANT(vfslocked); VM_OBJECT_LOCK(obj); vm_page_io_finish(pg); if (!error) @@ -2199,6 +2203,9 @@ retry_space: } } + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + /* Add the buffer chain to the socket buffer. */ if (m != NULL) { int mlen, err; diff --git a/sys/mips/include/cpufunc.h b/sys/mips/include/cpufunc.h index 3611d6e..513237f 100644 --- a/sys/mips/include/cpufunc.h +++ b/sys/mips/include/cpufunc.h @@ -70,7 +70,7 @@ static __inline void mips_barrier(void) { #if defined(CPU_CNMIPS) || defined(CPU_RMI) || defined(CPU_NLM) - __compiler_membar(); + __asm __volatile("" : : : "memory"); #else __asm __volatile (".set noreorder\n\t" "nop\n\t" diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 79bae53..15d4ee9 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -2124,7 +2124,7 @@ bstp_modevent(module_t mod, int type, void *data) static moduledata_t bstp_mod = { "bridgestp", bstp_modevent, - NULL + 0 }; DECLARE_MODULE(bridgestp, bstp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c index a2c35e4..03f3a1c 100644 --- a/sys/net/if_arcsubr.c +++ b/sys/net/if_arcsubr.c @@ -878,7 +878,7 @@ arc_modevent(module_t mod, int type, void *data) static moduledata_t arc_mod = { "arcnet", arc_modevent, - NULL + 0 }; DECLARE_MODULE(arcnet, arc_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c index 0ce1f1d..bb691e1 100644 --- a/sys/net/if_atmsubr.c +++ b/sys/net/if_atmsubr.c @@ -496,7 +496,7 @@ atm_modevent(module_t mod, int type, void *data) static moduledata_t atm_mod = { "atm", atm_modevent, - NULL + 0 }; DECLARE_MODULE(atm, atm_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 734e04a..5800831 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -523,7 +523,7 @@ bridge_modevent(module_t mod, int type, void *data) static moduledata_t bridge_mod = { "if_bridge", bridge_modevent, - NULL + 0 }; DECLARE_MODULE(if_bridge, bridge_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c index add215f..efd3fc7 100644 --- a/sys/net/if_enc.c +++ b/sys/net/if_enc.c @@ -181,7 +181,7 @@ enc_modevent(module_t mod, int type, void *data) static moduledata_t enc_mod = { "if_enc", enc_modevent, - NULL + 0 }; DECLARE_MODULE(if_enc, enc_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index 90f2ea9..2a67e18 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -978,7 +978,7 @@ epair_modevent(module_t mod, int type, void *data) static moduledata_t epair_mod = { "if_epair", epair_modevent, - NULL + 0 }; DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 39413a5..ba47194 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1237,7 +1237,7 @@ ether_modevent(module_t mod, int type, void *data) static moduledata_t ether_mod = { "ether", ether_modevent, - NULL + 0 }; void diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index 40289a8..db4c1d9 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -136,7 +136,7 @@ faithmodevent(mod, type, data) static moduledata_t faith_mod = { "if_faith", faithmodevent, - NULL + 0 }; DECLARE_MODULE(if_faith, faith_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 2b59f3a..d98029c 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -792,7 +792,7 @@ fddi_resolvemulti(ifp, llsa, sa) static moduledata_t fddi_mod = { "fddi", /* module name */ NULL, /* event handler */ - NULL /* extra data */ + 0 /* extra data */ }; DECLARE_MODULE(fddi, fddi_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index 9e996cc..5414d79 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -845,7 +845,7 @@ firewire_modevent(module_t mod, int type, void *data) static moduledata_t firewire_mod = { "if_firewire", firewire_modevent, - NULL + 0 }; DECLARE_MODULE(if_firewire, firewire_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 19906c7..783607b 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -272,7 +272,7 @@ gifmodevent(mod, type, data) static moduledata_t gif_mod = { "if_gif", gifmodevent, - NULL + 0 }; DECLARE_MODULE(if_gif, gif_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index e7905ea..8b250d7 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -973,7 +973,7 @@ gremodevent(module_t mod, int type, void *data) static moduledata_t gre_mod = { "if_gre", gremodevent, - NULL + 0 }; DECLARE_MODULE(if_gre, gre_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c index 1e251e4..91d67fd 100644 --- a/sys/net/if_iso88025subr.c +++ b/sys/net/if_iso88025subr.c @@ -823,7 +823,7 @@ iso88025_modevent(module_t mod, int type, void *data) static moduledata_t iso88025_mod = { "iso88025", iso88025_modevent, - NULL + 0 }; DECLARE_MODULE(iso88025, iso88025_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 5179306..e567e8e 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -211,7 +211,7 @@ lagg_modevent(module_t mod, int type, void *data) static moduledata_t lagg_mod = { "if_lagg", lagg_modevent, - NULL + 0 }; DECLARE_MODULE(if_lagg, lagg_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 31cda71..2850b38 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -205,7 +205,7 @@ loop_modevent(module_t mod, int type, void *data) static moduledata_t loop_mod = { "if_lo", loop_modevent, - NULL + 0 }; DECLARE_MODULE(if_lo, loop_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 0352f10..7c9c230 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -494,7 +494,7 @@ sppp_modevent(module_t mod, int type, void *unused) static moduledata_t spppmod = { "sppp", sppp_modevent, - NULL + 0 }; MODULE_VERSION(sppp, 1); DECLARE_MODULE(sppp, spppmod, SI_SUB_DRIVERS, SI_ORDER_ANY); diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index 863973f..b19c855 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -301,7 +301,7 @@ stfmodevent(mod, type, data) static moduledata_t stf_mod = { "if_stf", stfmodevent, - NULL + 0 }; DECLARE_MODULE(if_stf, stf_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index b2070ef..74e1d22 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -317,7 +317,7 @@ tunmodevent(module_t mod, int type, void *data) static moduledata_t tun_mod = { "if_tun", tunmodevent, - NULL + 0 }; DECLARE_MODULE(if_tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index d76fbdc..3bc3b67 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -762,7 +762,7 @@ vlan_modevent(module_t mod, int type, void *data) static moduledata_t vlan_mod = { "if_vlan", vlan_modevent, - NULL + 0 }; DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/net/zlib.c b/sys/net/zlib.c index c7bbb95..8fc8cab 100644 --- a/sys/net/zlib.c +++ b/sys/net/zlib.c @@ -5400,7 +5400,7 @@ zlib_modevent(module_t mod, int type, void *unused) static moduledata_t zlib_mod = { "zlib", zlib_modevent, - NULL + 0 }; DECLARE_MODULE(zlib, zlib_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(zlib, 1); diff --git a/sys/net80211/ieee80211_freebsd.c b/sys/net80211/ieee80211_freebsd.c index 844910f..b733d2f 100644 --- a/sys/net80211/ieee80211_freebsd.c +++ b/sys/net80211/ieee80211_freebsd.c @@ -822,7 +822,7 @@ wlan_modevent(module_t mod, int type, void *unused) static moduledata_t wlan_mod = { "wlan", wlan_modevent, - NULL + 0 }; DECLARE_MODULE(wlan, wlan_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(wlan, 1); diff --git a/sys/net80211/ieee80211_freebsd.h b/sys/net80211/ieee80211_freebsd.h index af5f1fa..abfc2c0 100644 --- a/sys/net80211/ieee80211_freebsd.h +++ b/sys/net80211/ieee80211_freebsd.h @@ -323,7 +323,7 @@ wlan_##name##_modevent(module_t mod, int type, void *unused) \ static moduledata_t name##_mod = { \ "wlan_" #name, \ wlan_##name##_modevent, \ - NULL \ + 0 \ }; \ DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ MODULE_VERSION(wlan_##name, version); \ diff --git a/sys/netgraph/atm/ngatmbase.c b/sys/netgraph/atm/ngatmbase.c index 1919f30..c5b0ced 100644 --- a/sys/netgraph/atm/ngatmbase.c +++ b/sys/netgraph/atm/ngatmbase.c @@ -51,7 +51,7 @@ static int ngatm_handler(module_t, int, void *); static moduledata_t ngatm_data = { "ngatmbase", ngatm_handler, - NULL + 0 }; MODULE_VERSION(ngatmbase, NGATMBASE_VERSION); diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c index d2c136c..1cb6179 100644 --- a/sys/netgraph/netflow/ng_netflow.c +++ b/sys/netgraph/netflow/ng_netflow.c @@ -832,7 +832,7 @@ ng_netflow_rcvdata (hook_p hook, item_p item) goto loopend; #endif /* - * Any unknown header (new extension or IPv6/IPv4 + * Any unknow header (new extension or IPv6/IPv4 * header for tunnels) ends loop. */ default: diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index ececf2d..94c00a1 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -3644,6 +3644,6 @@ igmp_modevent(module_t mod, int type, void *unused __unused) static moduledata_t igmp_mod = { "igmp", igmp_modevent, - NULL + 0 }; DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index d6c9b01..a5e766a 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -2145,7 +2145,7 @@ carp_modevent(module_t mod, int type, void *data) static moduledata_t carp_mod = { "carp", carp_modevent, - NULL + 0 }; DECLARE_MODULE(carp, carp_mod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 07fb9b0..4f5f1b3 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -834,7 +834,7 @@ div_modevent(module_t mod, int type, void *unused) static moduledata_t ipdivertmod = { "ipdivert", div_modevent, - NULL + 0 }; DECLARE_MODULE(ipdivert, ipdivertmod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 425fe3f..c52332d 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -2944,7 +2944,7 @@ ip_mroute_modevent(module_t mod, int type, void *unused) static moduledata_t ip_mroutemod = { "ip_mroute", ip_mroute_modevent, - NULL + 0 }; DECLARE_MODULE(ip_mroute, ip_mroutemod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index c38018f..7e498dd 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -570,7 +570,7 @@ toecore_mod_handler(module_t mod, int cmd, void *arg) static moduledata_t mod_data= { "toecore", toecore_mod_handler, - NULL + 0 }; MODULE_VERSION(toecore, 1); diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 2555b92..8ecd60e 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -2059,7 +2059,7 @@ ip6_mroute_modevent(module_t mod, int type, void *unused) static moduledata_t ip6_mroutemod = { "ip6_mroute", ip6_mroute_modevent, - NULL + 0 }; DECLARE_MODULE(ip6_mroute, ip6_mroutemod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 9d8bc8d..ba850b2 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -3309,6 +3309,6 @@ mld_modevent(module_t mod, int type, void *unused __unused) static moduledata_t mld_mod = { "mld", mld_modevent, - NULL + 0 }; DECLARE_MODULE(mld, mld_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index 09fe586..5624366 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -361,7 +361,7 @@ send_modevent(module_t mod, int type, void *unused) static moduledata_t sendmod = { "send", send_modevent, - NULL + 0 }; DECLARE_MODULE(send, sendmod, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); diff --git a/sys/netpfil/ipfw/ip_dn_glue.c b/sys/netpfil/ipfw/ip_dn_glue.c index 54eed75..2e4f460 100644 --- a/sys/netpfil/ipfw/ip_dn_glue.c +++ b/sys/netpfil/ipfw/ip_dn_glue.c @@ -315,10 +315,10 @@ static size_t pipesizemax8 = sizeof(struct dn_pipe_max8); /* Indicate 'ipfw' version * 1: from FreeBSD 7.2 * 0: from FreeBSD 8 - * -1: unknown (for now is unused) + * -1: unknow (for now is unused) * * It is update when a IP_DUMMYNET_DEL or IP_DUMMYNET_CONFIGURE request arrives - * NOTE: if a IP_DUMMYNET_GET arrives and the 'ipfw' version is unknown, + * NOTE: if a IP_DUMMYNET_GET arrives and the 'ipfw' version is unknow, * it is suppose to be the FreeBSD 8 version. */ static int is7 = 0; diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c index 8ac2fa8..e43a0ef 100644 --- a/sys/netpfil/ipfw/ip_fw2.c +++ b/sys/netpfil/ipfw/ip_fw2.c @@ -2756,7 +2756,7 @@ ipfw_modevent(module_t mod, int type, void *unused) static moduledata_t ipfwmod = { "ipfw", ipfw_modevent, - NULL + 0 }; /* Define startup order. */ diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c index b2800fc..94861b3 100644 --- a/sys/netpfil/ipfw/ip_fw_nat.c +++ b/sys/netpfil/ipfw/ip_fw_nat.c @@ -651,7 +651,7 @@ ipfw_nat_modevent(module_t mod, int type, void *unused) static moduledata_t ipfw_nat_mod = { "ipfw_nat", ipfw_nat_modevent, - NULL + 0 }; DECLARE_MODULE(ipfw_nat, ipfw_nat_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); diff --git a/sys/netpfil/ipfw/ip_fw_pfil.c b/sys/netpfil/ipfw/ip_fw_pfil.c index fa86de8..b2494e5 100644 --- a/sys/netpfil/ipfw/ip_fw_pfil.c +++ b/sys/netpfil/ipfw/ip_fw_pfil.c @@ -138,8 +138,11 @@ again: if (tag != NULL) { args.rule = *((struct ipfw_rule_ref *)(tag+1)); m_tag_delete(*m0, tag); - if (args.rule.info & IPFW_ONEPASS) + if (args.rule.info & IPFW_ONEPASS) { + if (mtod(*m0, struct ip *)->ip_v == 4) + SET_HOST_IPLEN(mtod(*m0, struct ip *)); return (0); + } } args.m = *m0; diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 9bd9ca8..20feea2 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -281,7 +281,7 @@ pflog_modevent(module_t mod, int type, void *data) return error; } -static moduledata_t pflog_mod = { "pflog", pflog_modevent, NULL }; +static moduledata_t pflog_mod = { "pflog", pflog_modevent, 0 }; #define PFLOG_MODVER 1 diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 9267e28..505d9a7 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -2402,7 +2402,7 @@ pfsync_modevent(module_t mod, int type, void *data) static moduledata_t pfsync_mod = { "pfsync", pfsync_modevent, - NULL + 0 }; #define PFSYNC_MODVER 1 diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 35b6d29..3037725 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3475,7 +3475,9 @@ pf_check_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, { int chk; + CURVNET_SET(ifp->if_vnet); chk = pf_test(PF_IN, ifp, m, inp); + CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); *m = NULL; @@ -3496,7 +3498,9 @@ pf_check_out(void *arg, struct mbuf **m, struct ifnet *ifp, int dir, (*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } + CURVNET_SET(ifp->if_vnet); chk = pf_test(PF_OUT, ifp, m, inp); + CURVNET_RESTORE(); if (chk && *m) { m_freem(*m); *m = NULL; @@ -3722,7 +3726,7 @@ pf_modevent(module_t mod, int type, void *data) static moduledata_t pf_mod = { "pf", pf_modevent, - NULL + 0 }; DECLARE_MODULE(pf, pf_mod, SI_SUB_PSEUDO, SI_ORDER_FIRST); diff --git a/sys/nfs/nfs_nfssvc.c b/sys/nfs/nfs_nfssvc.c index 929aa6a..9680eb7 100644 --- a/sys/nfs/nfs_nfssvc.c +++ b/sys/nfs/nfs_nfssvc.c @@ -147,7 +147,7 @@ nfssvc_modevent(module_t mod, int type, void *data) static moduledata_t nfssvc_mod = { "nfssvc", nfssvc_modevent, - NULL + NULL, }; DECLARE_MODULE(nfssvc, nfssvc_mod, SI_SUB_VFS, SI_ORDER_ANY); diff --git a/sys/nfsserver/nfs_srvsubs.c b/sys/nfsserver/nfs_srvsubs.c index 33a7edb..66a85c4 100644 --- a/sys/nfsserver/nfs_srvsubs.c +++ b/sys/nfsserver/nfs_srvsubs.c @@ -552,7 +552,7 @@ nfsrv_modevent(module_t mod, int type, void *data) static moduledata_t nfsserver_mod = { "nfsserver", nfsrv_modevent, - NULL + NULL, }; DECLARE_MODULE(nfsserver, nfsserver_mod, SI_SUB_VFS, SI_ORDER_ANY); diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 01357a5..2bc0e1f 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1171,7 +1171,7 @@ cryptodev_modevent(module_t mod, int type, void *unused) static moduledata_t cryptodev_mod = { "cryptodev", cryptodev_modevent, - NULL + 0 }; MODULE_VERSION(cryptodev, 1); DECLARE_MODULE(cryptodev, cryptodev_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); diff --git a/sys/pc98/include/bus.h b/sys/pc98/include/bus.h index 46d1a1b..69e80f0 100644 --- a/sys/pc98/include/bus.h +++ b/sys/pc98/include/bus.h @@ -593,7 +593,7 @@ bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, if (flags & BUS_SPACE_BARRIER_READ) __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); else - __compiler_membar(); + __asm __volatile("" : : : "memory"); } #ifdef BUS_SPACE_NO_LEGACY diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index b34966a..28763c1 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -273,6 +273,11 @@ cpu_startup(dummy) bufinit(); vm_pager_bufferinit(); cpu_setregs(); + + /* + * Add BSP as an interrupt target. + */ + intr_add_cpu(0); } /* diff --git a/sys/sparc64/include/atomic.h b/sys/sparc64/include/atomic.h index 447880a..06a1984 100644 --- a/sys/sparc64/include/atomic.h +++ b/sys/sparc64/include/atomic.h @@ -97,7 +97,7 @@ #define atomic_cas_acq(p, e, s, sz) ({ \ itype(sz) v; \ v = atomic_cas((p), (e), (s), sz); \ - __compiler_membar(); \ + __asm __volatile("" : : : "memory"); \ v; \ }) @@ -122,7 +122,7 @@ #define atomic_op_acq(p, op, v, sz) ({ \ itype(sz) t; \ t = atomic_op((p), op, (v), sz); \ - __compiler_membar(); \ + __asm __volatile("" : : : "memory"); \ t; \ }) @@ -139,7 +139,7 @@ #define atomic_load_acq(p, sz) ({ \ itype(sz) v; \ v = atomic_load((p), sz); \ - __compiler_membar(); \ + __asm __volatile("" : : : "memory"); \ v; \ }) diff --git a/sys/sparc64/include/intr_machdep.h b/sys/sparc64/include/intr_machdep.h index 6e472f7..6803fc62 100644 --- a/sys/sparc64/include/intr_machdep.h +++ b/sys/sparc64/include/intr_machdep.h @@ -91,10 +91,10 @@ struct intr_vector { extern ih_func_t *intr_handlers[]; extern struct intr_vector intr_vectors[]; -#ifdef SMP void intr_add_cpu(u_int cpu); -#endif +#ifdef SMP int intr_bind(int vec, u_char cpu); +#endif int intr_describe(int vec, void *ih, const char *descr); void intr_setup(int level, ih_func_t *ihf, int pri, iv_func_t *ivf, void *iva); diff --git a/sys/sparc64/sparc64/intr_machdep.c b/sys/sparc64/sparc64/intr_machdep.c index f8eb6d8..73f9fa6 100644 --- a/sys/sparc64/sparc64/intr_machdep.c +++ b/sys/sparc64/sparc64/intr_machdep.c @@ -456,7 +456,7 @@ intr_describe(int vec, void *ih, const char *descr) * allocate CPUs round-robin. */ -static cpuset_t intr_cpus = CPUSET_T_INITIALIZER(0x1); +static cpuset_t intr_cpus; static int current_cpu; static void @@ -554,4 +554,11 @@ intr_shuffle_irqs(void *arg __unused) } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); +#else /* !SMP */ +/* Use an empty stub for compatibility. */ +void +intr_add_cpu(u_int cpu __unused) +{ + +} #endif diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index 7c7c234..63be007 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -196,6 +196,11 @@ cpu_startup(void *arg) printf("machine: %s\n", sparc64_model); cpu_identify(rdpr(ver), PCPU_GET(clock), curcpu); + + /* + * Add BSP as an interrupt target. + */ + intr_add_cpu(0); } void diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index ad6aefc..d4c78a9 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -82,13 +82,6 @@ # define __GNUC_VA_LIST_COMPATIBILITY 1 #endif -/* - * Compiler memory barriers, specific to gcc and clang. - */ -#if defined(__GNUC__) -#define __compiler_membar() __asm __volatile(" " : : : "memory") -#endif - #ifndef __INTEL_COMPILER # define __GNUCLIKE_BUILTIN_NEXT_ARG 1 # define __GNUCLIKE_MATH_BUILTIN_RELOPS diff --git a/sys/tools/fw_stub.awk b/sys/tools/fw_stub.awk index 82ca821..0c7d567 100644 --- a/sys/tools/fw_stub.awk +++ b/sys/tools/fw_stub.awk @@ -215,7 +215,7 @@ printc("\t\treturn (error);\ static moduledata_t " modname "_fw_mod = {\ \"" modname "_fw\",\ " modname "_fw_modevent,\ - NULL\ + 0\ };\ DECLARE_MODULE(" modname "_fw, " modname "_fw_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ MODULE_VERSION(" modname "_fw, 1);\ diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index e0aab73..a84f968 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -1280,7 +1280,7 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize, error = EINVAL; goto done; } - if (obj->handle != vp) { + if (obj->type == OBJT_VNODE && obj->handle != vp) { vput(vp); vp = (struct vnode *)obj->handle; /* @@ -1331,7 +1331,14 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize, objsize = round_page(va.va_size); if (va.va_nlink == 0) flags |= MAP_NOSYNC; - obj = vm_pager_allocate(OBJT_VNODE, vp, objsize, prot, foff, cred); + if (obj->type == OBJT_VNODE) + obj = vm_pager_allocate(OBJT_VNODE, vp, objsize, prot, foff, + cred); + else { + KASSERT(obj->type == OBJT_DEFAULT || obj->type == OBJT_SWAP, + ("wrong object type")); + vm_object_reference(obj); + } if (obj == NULL) { error = ENOMEM; goto done; diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index abf7689..f417351 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -478,6 +478,7 @@ void vm_object_deallocate(vm_object_t object) { vm_object_t temp; + struct vnode *vp; while (object != NULL) { int vfslocked; @@ -527,15 +528,36 @@ vm_object_deallocate(vm_object_t object) VM_OBJECT_UNLOCK(object); return; } else if (object->ref_count == 1) { + if (object->type == OBJT_SWAP && + (object->flags & OBJ_TMPFS) != 0) { + vp = object->un_pager.swp.swp_tmpfs; + vhold(vp); + VM_OBJECT_UNLOCK(object); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vdrop(vp); + VM_OBJECT_LOCK(object); + if (object->type == OBJT_DEAD) { + VM_OBJECT_UNLOCK(object); + VOP_UNLOCK(vp, 0); + return; + } else if ((object->flags & OBJ_TMPFS) != 0) { + if (object->ref_count == 1) + VOP_UNSET_TEXT(vp); + VOP_UNLOCK(vp, 0); + } + } if (object->shadow_count == 0 && object->handle == NULL && (object->type == OBJT_DEFAULT || - object->type == OBJT_SWAP)) { + (object->type == OBJT_SWAP && + (object->flags & OBJ_TMPFS) == 0))) { vm_object_set_flag(object, OBJ_ONEMAPPING); } else if ((object->shadow_count == 1) && (object->handle == NULL) && (object->type == OBJT_DEFAULT || object->type == OBJT_SWAP)) { + KASSERT((object->flags & OBJ_TMPFS) == 0, + ("Shadowed tmpfs v_object")); vm_object_t robject; robject = LIST_FIRST(&object->shadow_head); @@ -822,7 +844,12 @@ vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end, mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED); VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - KASSERT(object->type == OBJT_VNODE, ("Not a vnode object")); + + /* + * The OBJ_MIGHTBEDIRTY flag is only set for the OBJT_VNODE + * objects. The check below prevents the function from + * operating on the non-vnode objects. + */ if ((object->flags & OBJ_MIGHTBEDIRTY) == 0 || object->resident_page_count == 0) return (TRUE); diff --git a/sys/vm/vm_object.h b/sys/vm/vm_object.h index daafd03..d7c5b75 100644 --- a/sys/vm/vm_object.h +++ b/sys/vm/vm_object.h @@ -155,6 +155,7 @@ struct vm_object { * see vm/swap_pager.h */ struct { + void *swp_tmpfs; int swp_bcount; } swp; } un_pager; @@ -173,6 +174,7 @@ struct vm_object { #define OBJ_COLORED 0x1000 /* pg_color is defined */ #define OBJ_ONEMAPPING 0x2000 /* One USE (a single, non-forked) mapping flag */ #define OBJ_DISCONNECTWNT 0x4000 /* disconnect from vnode wanted */ +#define OBJ_TMPFS 0x8000 #define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT) #define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT)) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index cc9063b..9183ba3 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -213,8 +213,7 @@ retry: msleep(object, VM_OBJECT_MTX(object), PDROP | PVM, "vadead", 0); } - if (vp->v_usecount == 0) - panic("vnode_pager_alloc: no vnode reference"); + KASSERT(vp->v_usecount != 0, ("vnode_pager_alloc: no vnode reference")); if (object == NULL) { /* @@ -379,7 +378,7 @@ vnode_pager_setsize(vp, nsize) vm_page_t m; vm_pindex_t nobjsize; - if ((object = vp->v_object) == NULL) + if ((object = vp->v_object) == NULL || object->type != OBJT_VNODE) return; /* ASSERT_VOP_ELOCKED(vp, "vnode_pager_setsize and not locked vnode"); */ VM_OBJECT_LOCK(object); diff --git a/sys/x86/include/bus.h b/sys/x86/include/bus.h index fb5babf..3b4342a 100644 --- a/sys/x86/include/bus.h +++ b/sys/x86/include/bus.h @@ -1014,7 +1014,7 @@ bus_space_barrier(bus_space_tag_t tag __unused, bus_space_handle_t bsh __unused, __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); #endif else - __compiler_membar(); + __asm __volatile("" : : : "memory"); #endif } diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c index 31cc80b..71e9006 100644 --- a/sys/x86/x86/intr_machdep.c +++ b/sys/x86/x86/intr_machdep.c @@ -452,7 +452,7 @@ DB_SHOW_COMMAND(irqs, db_show_irqs) * allocate CPUs round-robin. */ -static cpuset_t intr_cpus = CPUSET_T_INITIALIZER(0x1); +static cpuset_t intr_cpus; static int current_cpu; /* @@ -565,4 +565,11 @@ intr_next_cpu(void) return (PCPU_GET(apic_id)); } + +/* Use an empty stub for compatibility. */ +void +intr_add_cpu(u_int cpu __unused) +{ + +} #endif diff --git a/tools/regression/kthread/kld/kthrdlk.c b/tools/regression/kthread/kld/kthrdlk.c index a64dc2e..67825b6 100644 --- a/tools/regression/kthread/kld/kthrdlk.c +++ b/tools/regression/kthread/kld/kthrdlk.c @@ -193,11 +193,12 @@ kthrdlk_handler(module_t mod, int /*modeventtype_t*/ what, } static moduledata_t mod_data= { - "kthrdlk", - kthrdlk_handler, - NULL -}; + "kthrdlk", + kthrdlk_handler, + 0 + }; MODULE_VERSION(kthrdlk, 1); DECLARE_MODULE(kthrdlk, mod_data, SI_SUB_EXEC, SI_ORDER_ANY); + diff --git a/tools/regression/net80211/ccmp/test_ccmp.c b/tools/regression/net80211/ccmp/test_ccmp.c index da13ac7..d78be95 100644 --- a/tools/regression/net80211/ccmp/test_ccmp.c +++ b/tools/regression/net80211/ccmp/test_ccmp.c @@ -742,7 +742,7 @@ test_ccmp_modevent(module_t mod, int type, void *unused) static moduledata_t test_ccmp_mod = { "test_ccmp", test_ccmp_modevent, - NULL + 0 }; DECLARE_MODULE(test_ccmp, test_ccmp_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(test_ccmp, 1); diff --git a/tools/regression/net80211/tkip/test_tkip.c b/tools/regression/net80211/tkip/test_tkip.c index 3909bbd..5a63978 100644 --- a/tools/regression/net80211/tkip/test_tkip.c +++ b/tools/regression/net80211/tkip/test_tkip.c @@ -381,7 +381,7 @@ test_tkip_modevent(module_t mod, int type, void *unused) static moduledata_t test_tkip_mod = { "test_tkip", test_tkip_modevent, - NULL + 0 }; DECLARE_MODULE(test_tkip, test_tkip_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(test_tkip, 1); diff --git a/tools/regression/net80211/wep/test_wep.c b/tools/regression/net80211/wep/test_wep.c index 04bd054..b498195 100644 --- a/tools/regression/net80211/wep/test_wep.c +++ b/tools/regression/net80211/wep/test_wep.c @@ -328,7 +328,7 @@ test_wep_modevent(module_t mod, int type, void *unused) static moduledata_t test_wep_mod = { "test_wep", test_wep_modevent, - NULL + 0 }; DECLARE_MODULE(test_wep, test_wep_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); MODULE_VERSION(test_wep, 1); diff --git a/tools/tools/kttcp/sys/kttcp.c b/tools/tools/kttcp/sys/kttcp.c index dbaa9fc..0973960 100644 --- a/tools/tools/kttcp/sys/kttcp.c +++ b/tools/tools/kttcp/sys/kttcp.c @@ -268,7 +268,7 @@ kttcpdev_modevent(module_t mod, int type, void *unused) static moduledata_t kttcpdev_mod = { "kttcpdev", kttcpdev_modevent, - NULL + 0 }; MODULE_VERSION(kttcpdev, 1); DECLARE_MODULE(kttcpdev, kttcpdev_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); -- Test scenario: wip/tmpfs16.sh