Re: svn commit: r228430 - head/sys/kern
On 12/12/11 18:46, Andriy Gapon wrote: Author: avg Date: Mon Dec 12 07:46:10 2011 New Revision: 228430 URL: http://svn.freebsd.org/changeset/base/228430 Log: kern_racct: move sys/systm.h inclusion to its proper place This should fix the build failure introduced with r228424. Also remove duplicate inclusion of sys/param.h. Pointyhat to:avg MFC after: 1 week lstewart@lstewart3:head svn up Updating '.': At revision 228430. lstewart@lstewart3:head make -DNO_CLEAN KERNCONF=LINT buildkernel [...] cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/work/svn/freebsd_mirror/head/sys -I/work/svn/freebsd_mirror/head/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -DGPROF -falign-functions=16 -DGPROF4 -DGUPROF -fno-builtin -fno-omit-frame-pointer -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror -pg -mprofiler-epilogue /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c cc1: warnings being treated as errors In file included from /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c:52: /work/svn/freebsd_mirror/head/sys/sys/sx.h: In function '__sx_xlock': /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: implicit declaration of function 'SCHEDULER_STOPPED' /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: nested extern declaration of 'SCHEDULER_STOPPED' [-Wnested-externs] *** Error code 1 Stop in /usr/obj/work/svn/freebsd_mirror/head/sys/LINT. *** Error code 1 Stop in /work/svn/freebsd_mirror/head. *** Error code 1 Stop in /work/svn/freebsd_mirror/head. Perhaps another place which needs a fix similar to r228430? Cheers, Lawrence ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228430 - head/sys/kern
On 12/12/11 20:21, Lawrence Stewart wrote: On 12/12/11 18:46, Andriy Gapon wrote: Author: avg Date: Mon Dec 12 07:46:10 2011 New Revision: 228430 URL: http://svn.freebsd.org/changeset/base/228430 Log: kern_racct: move sys/systm.h inclusion to its proper place This should fix the build failure introduced with r228424. Also remove duplicate inclusion of sys/param.h. Pointyhat to: avg MFC after: 1 week lstewart@lstewart3:head svn up Updating '.': At revision 228430. lstewart@lstewart3:head make -DNO_CLEAN KERNCONF=LINT buildkernel [...] cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/work/svn/freebsd_mirror/head/sys -I/work/svn/freebsd_mirror/head/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -DGPROF -falign-functions=16 -DGPROF4 -DGUPROF -fno-builtin -fno-omit-frame-pointer -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror -pg -mprofiler-epilogue /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c cc1: warnings being treated as errors In file included from /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c:52: /work/svn/freebsd_mirror/head/sys/sys/sx.h: In function '__sx_xlock': /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: implicit declaration of function 'SCHEDULER_STOPPED' /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: nested extern declaration of 'SCHEDULER_STOPPED' [-Wnested-externs] *** Error code 1 Stop in /usr/obj/work/svn/freebsd_mirror/head/sys/LINT. *** Error code 1 Stop in /work/svn/freebsd_mirror/head. *** Error code 1 Stop in /work/svn/freebsd_mirror/head. Perhaps another place which needs a fix similar to r228430? Other files that also require fixing: sys/kern/vfs_cache.c sys/security/mac/mac_framework.c sys/security/mac/mac_priv.c Cheers, Lawrence ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228431 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/viawd sys/i386/conf sys/modules sys/modules/viawd
Author: fabient Date: Mon Dec 12 09:50:33 2011 New Revision: 228431 URL: http://svn.freebsd.org/changeset/base/228431 Log: Add watchdog support for VIA south bridge chipset. Tested on VT8251, VX900 but CX700, VX800, VX855 should works. MFC after:1 month Sponsored by: NETASQ Added: head/share/man/man4/viawd.4 (contents, props changed) head/sys/dev/viawd/ head/sys/dev/viawd/viawd.c (contents, props changed) head/sys/dev/viawd/viawd.h (contents, props changed) head/sys/modules/viawd/ head/sys/modules/viawd/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/NOTES head/sys/modules/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileMon Dec 12 07:46:10 2011 (r228430) +++ head/share/man/man4/MakefileMon Dec 12 09:50:33 2011 (r228431) @@ -499,6 +499,7 @@ MAN=aac.4 \ vga.4 \ vge.4 \ viapm.4 \ + ${_viawd.4} \ vinum.4 \ vkbd.4 \ vlan.4 \ @@ -711,6 +712,7 @@ _speaker.4= speaker.4 _spkr.4= spkr.4 _tpm.4=tpm.4 _urtw.4= urtw.4 +_viawd.4= viawd.4 _wpi.4=wpi.4 _xen.4=xen.4 Added: head/share/man/man4/viawd.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/viawd.4 Mon Dec 12 09:50:33 2011(r228431) @@ -0,0 +1,79 @@ +.\- +.\ Copyright (c) 2011 Fabien Thomas fabi...@freebsd.org +.\ All rights reserved. +.\ +.\ Redistribution and use in source and binary forms, with or without +.\ modification, are permitted provided that the following conditions +.\ are met: +.\ 1. Redistributions of source code must retain the above copyright +.\notice, this list of conditions and the following disclaimer. +.\ 2. Redistributions in binary form must reproduce the above copyright +.\notice, this list of conditions and the following disclaimer in the +.\documentation and/or other materials provided with the distribution. +.\ +.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND +.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\ SUCH DAMAGE. +.\ +.\ $FreeBSD$ +.\ +.Dd December 7, 2011 +.Dt VIAWD 4 +.Os +.Sh NAME +.Nm viawd +.Nd device driver for VIA south bridge watchdog timer +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd device viawd +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +viawd_load=YES +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr watchdog 4 +support for the watchdog interrupt timer present on +VIA south bridge chipset (VT8251, CX700, VX800, VX855, VX900). +.Pp +The VIA south bridge have a built-in watchdog timer, +which can be enabled and disabled by user's program and set between +1 to 1023 seconds. +.Pp +The +.Nm +driver when unloaded with running watchdog will reschedule the watchdog +to 5 minutes. +.Sh SEE ALSO +.Xr watchdog 4 , +.Xr watchdog 8 , +.Xr watchdogd 8 , +.Xr watchdog 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Fabien Thomas Aq fabi...@freebsd.org . Modified: head/sys/amd64/conf/NOTES == --- head/sys/amd64/conf/NOTES Mon Dec 12 07:46:10 2011(r228430) +++ head/sys/amd64/conf/NOTES Mon Dec 12 09:50:33 2011(r228431) @@ -458,6 +458,7 @@ device tpm # device ichwd device amdsbwd +device viawd # # Temperature sensors: Modified: head/sys/conf/files.amd64 == --- head/sys/conf/files.amd64 Mon Dec 12 07:46:10 2011(r228430) +++ head/sys/conf/files.amd64 Mon Dec 12 09:50:33 2011(r228431) @@ -260,6 +260,7 @@ dev/tpm/tpm.c optional
svn commit: r228432 - head/sys/vm
Author: kib Date: Mon Dec 12 10:04:04 2011 New Revision: 228432 URL: http://svn.freebsd.org/changeset/base/228432 Log: Fix printf. Submitted by: az MFC after:1 week Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cMon Dec 12 09:50:33 2011(r228431) +++ head/sys/vm/swap_pager.cMon Dec 12 10:04:04 2011(r228432) @@ -233,7 +233,7 @@ swap_reserve_by_cred(vm_ooffset_t incr, } if (!res ppsratecheck(lastfail, curfail, 1)) { printf(uid %d, pid %d: swap reservation for %jd bytes failed\n, - curproc-p_pid, uip-ui_uid, incr); + uip-ui_uid, curproc-p_pid, incr); } #ifdef RACCT ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228434 - head/sys/sys
Author: kib Date: Mon Dec 12 10:10:49 2011 New Revision: 228434 URL: http://svn.freebsd.org/changeset/base/228434 Log: Add definitions for GNU-specific STT_GNU_IFUNC symbol type, and R_{386,X86_64}_IRELATIVE relocations. MFC after:3 weeks Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h == --- head/sys/sys/elf_common.h Mon Dec 12 10:05:13 2011(r228433) +++ head/sys/sys/elf_common.h Mon Dec 12 10:10:49 2011(r228434) @@ -503,6 +503,7 @@ typedef struct { #defineSTT_TLS 6 /* TLS object. */ #defineSTT_NUM 7 #defineSTT_LOOS10 /* Reserved range for operating system */ +#defineSTT_GNU_IFUNC 10 #defineSTT_HIOS12 /* specific semantics. */ #defineSTT_LOPROC 13 /* reserved range for processor */ #defineSTT_HIPROC 15 /* specific semantics. */ @@ -612,6 +613,7 @@ typedef struct { #defineR_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ #defineR_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ #defineR_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ +#defineR_386_IRELATIVE 42 /* PLT entry resolved indirectly at runtime */ #defineR_ARM_NONE 0 /* No relocation. */ #defineR_ARM_PC24 1 @@ -961,6 +963,7 @@ typedef struct { #defineR_X86_64_DTPOFF32 21 /* Offset in TLS block */ #defineR_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */ #defineR_X86_64_TPOFF3223 /* Offset in static TLS block */ +#defineR_X86_64_IRELATIVE 37 #endif /* !_SYS_ELF_COMMON_H_ */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228430 - head/sys/kern
on 12/12/2011 11:50 Lawrence Stewart said the following: On 12/12/11 20:21, Lawrence Stewart wrote: On 12/12/11 18:46, Andriy Gapon wrote: Author: avg Date: Mon Dec 12 07:46:10 2011 New Revision: 228430 URL: http://svn.freebsd.org/changeset/base/228430 Log: kern_racct: move sys/systm.h inclusion to its proper place This should fix the build failure introduced with r228424. Also remove duplicate inclusion of sys/param.h. Pointyhat to: avg MFC after: 1 week lstewart@lstewart3:head svn up Updating '.': At revision 228430. lstewart@lstewart3:head make -DNO_CLEAN KERNCONF=LINT buildkernel [...] cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I/work/svn/freebsd_mirror/head/sys -I/work/svn/freebsd_mirror/head/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -DGPROF -falign-functions=16 -DGPROF4 -DGUPROF -fno-builtin -fno-omit-frame-pointer -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror -pg -mprofiler-epilogue /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c cc1: warnings being treated as errors In file included from /work/svn/freebsd_mirror/head/sys/kern/kern_sx.c:52: /work/svn/freebsd_mirror/head/sys/sys/sx.h: In function '__sx_xlock': /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: implicit declaration of function 'SCHEDULER_STOPPED' /work/svn/freebsd_mirror/head/sys/sys/sx.h:154: warning: nested extern declaration of 'SCHEDULER_STOPPED' [-Wnested-externs] *** Error code 1 Stop in /usr/obj/work/svn/freebsd_mirror/head/sys/LINT. *** Error code 1 Stop in /work/svn/freebsd_mirror/head. *** Error code 1 Stop in /work/svn/freebsd_mirror/head. Perhaps another place which needs a fix similar to r228430? Other files that also require fixing: sys/kern/vfs_cache.c sys/security/mac/mac_framework.c sys/security/mac/mac_priv.c Thank you. I should have tried to compile LINT myself :-( -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228433 - in head/sys: kern security/mac
On Mon, Dec 12, 2011 at 10:05:13AM +, Andriy Gapon wrote: Author: avg Date: Mon Dec 12 10:05:13 2011 New Revision: 228433 URL: http://svn.freebsd.org/changeset/base/228433 Log: put sys/systm.h at its proper place or add it if missing Reported by:lstewart, tinderbox Pointyhat to: avg, attilio MFC after: 1 week MFC with: r228430 Modified: head/sys/kern/kern_sx.c head/sys/kern/vfs_cache.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_priv.c It means that previously sx.h did not required systm.h and now it does ? Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarations into sys/lock.h ? pgprgVxxvGLW9.pgp Description: PGP signature
Re: svn commit: r228433 - in head/sys: kern security/mac
on 12/12/2011 12:15 Kostik Belousov said the following: On Mon, Dec 12, 2011 at 10:05:13AM +, Andriy Gapon wrote: Author: avg Date: Mon Dec 12 10:05:13 2011 New Revision: 228433 URL: http://svn.freebsd.org/changeset/base/228433 Log: put sys/systm.h at its proper place or add it if missing Reported by: lstewart, tinderbox Pointyhat to: avg, attilio MFC after: 1 week MFC with: r228430 Modified: head/sys/kern/kern_sx.c head/sys/kern/vfs_cache.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_priv.c It means that previously sx.h did not required systm.h and now it does ? Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarations into sys/lock.h ? Strictly speaking it's sys/lockstat.h that now requires systm.h. I am not an expert in FreeBSD header file organization, so I will just follow whatever the experts advise. -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64
Author: kib Date: Mon Dec 12 11:03:14 2011 New Revision: 228435 URL: http://svn.freebsd.org/changeset/base/228435 Log: Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to rtld on 386 and amd64. This adds runtime bits neccessary for the use of the dispatch functions from the dynamically-linked executables and shared libraries. To allow use of external references from the dispatch function, resolution of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries for PLT are prepared, and normal resolution of the GOT entries is finished. Similar to how it is done by GNU, IRELATIVE relocations are resolved in advance, instead of normal lazy handling for PLT. Move the init_pltgot() call before the relocations for the object are processed. MFC after:3 weeks Modified: head/libexec/rtld-elf/amd64/reloc.c head/libexec/rtld-elf/arm/reloc.c head/libexec/rtld-elf/i386/reloc.c head/libexec/rtld-elf/ia64/reloc.c head/libexec/rtld-elf/mips/reloc.c head/libexec/rtld-elf/powerpc/reloc.c head/libexec/rtld-elf/powerpc64/reloc.c head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld.h head/libexec/rtld-elf/sparc64/reloc.c Modified: head/libexec/rtld-elf/amd64/reloc.c == --- head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 10:10:49 2011 (r228434) +++ head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 11:03:14 2011 (r228435) @@ -344,11 +344,22 @@ reloc_plt(Obj_Entry *obj) for (rela = obj-pltrela; rela relalim; rela++) { Elf_Addr *where; - assert(ELF_R_TYPE(rela-r_info) == R_X86_64_JMP_SLOT); - - /* Relocate the GOT slot pointing into the PLT. */ - where = (Elf_Addr *)(obj-relocbase + rela-r_offset); - *where += (Elf_Addr)obj-relocbase; + switch(ELF_R_TYPE(rela-r_info)) { + case R_X86_64_JMP_SLOT: + /* Relocate the GOT slot pointing into the PLT. */ + where = (Elf_Addr *)(obj-relocbase + rela-r_offset); + *where += (Elf_Addr)obj-relocbase; + break; + + case R_X86_64_IRELATIVE: + obj-irelative = true; + break; + + default: + _rtld_error(Unknown relocation type %x in PLT, + (unsigned int)ELF_R_TYPE(rela-r_info)); + return (-1); + } } return 0; } @@ -368,19 +379,91 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS const Elf_Sym *def; const Obj_Entry *defobj; - assert(ELF_R_TYPE(rela-r_info) == R_X86_64_JMP_SLOT); - where = (Elf_Addr *)(obj-relocbase + rela-r_offset); - def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj, true, NULL, - lockstate); - if (def == NULL) - return -1; - target = (Elf_Addr)(defobj-relocbase + def-st_value + rela-r_addend); - reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); + switch (ELF_R_TYPE(rela-r_info)) { + case R_X86_64_JMP_SLOT: + where = (Elf_Addr *)(obj-relocbase + rela-r_offset); + def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def-st_info) == STT_GNU_IFUNC) { + obj-gnu_ifunc = true; + continue; + } + target = (Elf_Addr)(defobj-relocbase + def-st_value + rela-r_addend); + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); + break; + + case R_X86_64_IRELATIVE: + break; + + default: + _rtld_error(Unknown relocation type %x in PLT, + (unsigned int)ELF_R_TYPE(rela-r_info)); + return (-1); + } } obj-jmpslots_done = true; return 0; } +int +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) +{ +const Elf_Rela *relalim; +const Elf_Rela *rela; + +relalim = (const Elf_Rela *)((char *)obj-pltrela + obj-pltrelasize); +for (rela = obj-pltrela; rela relalim; rela++) { + Elf_Addr *where, target, *ptr; + + switch (ELF_R_TYPE(rela-r_info)) { + case R_X86_64_JMP_SLOT: + break; + + case R_X86_64_IRELATIVE: + ptr = (Elf_Addr *)(obj-relocbase + rela-r_addend); + where = (Elf_Addr *)(obj-relocbase + rela-r_offset); + target = ((Elf_Addr (*)(void))ptr)(); + *where = target; + break; + } +} +return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) +{ +const Elf_Rela *relalim; +const Elf_Rela *rela; + +if (!obj-gnu_ifunc) + return (0); +relalim = (const Elf_Rela *)((char *)obj-pltrela + obj-pltrelasize); +for (rela = obj-pltrela; rela relalim; rela++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; + + switch (ELF_R_TYPE(rela-r_info)) { + case R_X86_64_JMP_SLOT: + where = (Elf_Addr
Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64
On Mon, Dec 12, 2011 at 11:03:15AM +, Konstantin Belousov wrote: Author: kib Date: Mon Dec 12 11:03:14 2011 New Revision: 228435 URL: http://svn.freebsd.org/changeset/base/228435 Log: Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to rtld on 386 and amd64. This adds runtime bits neccessary for the use of the dispatch functions from the dynamically-linked executables and shared libraries. To allow use of external references from the dispatch function, resolution of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries for PLT are prepared, and normal resolution of the GOT entries is finished. Similar to how it is done by GNU, IRELATIVE relocations are resolved in advance, instead of normal lazy handling for PLT. Move the init_pltgot() call before the relocations for the object are processed. MFC after: 3 weeks An example use of the facilities is provided at http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/02/07 Inner working is described by http://www.airs.com/blog/archives/403 To use this feature on FreeBSD, you need patched gas from recent binutils. Patch is available at http://people.freebsd.org/~kib/misc/gas_ifunc_freebsd.1.patch. The 4.6 gcc should be configured with --enable-gnu-indirect-function option to turn on the 'ifunc' function attributes, no patch for compiler is required. Only dynamically linked executables and shared objects are supported, support for static binaries requires changes for csu. Since in-tree toolchain cannot handle dispatch, and I am only interested in the dynamic linking case, I did not modified csu. If we ever need dispatch for system libraries (cases like CPU-optimized string functions, or math) and have a capable toolchain, I promise to add support for static binaries. I handled just x86oids. If maintainer of missed architecture wants to implement dispatch, I am willing to help (as usual). Does anybody on toolchain@ know how to submit the gas change to maintainers for inclusion into mainline, or better, can submit it himself ? I assume that no copyright assignment is required for this trivial flip of settings. pgpiata7FkuwI.pgp Description: PGP signature
Re: svn commit: r228330 - in head: include sys/sys
On 11 Dec 2011, at 21:12, Andreas Tobler wrote: As far as I understand, GCC does not support this attribute [[noreturn]] yet. But it defines both, __cplusplus and __cplusplus=201103L. On gcc-4.7 __cplusplus=201103L is the default when we build libstdc++. Advertising C++11 compatibility and then not supporting fairly simple C++11 features seems like a pretty major GCC bug. So I think we have to extend the check as below or we can reorder the defines that GNUC is before the __cplusplus __cplusplus= 201103L. I'd rather prefer the standard version to the non-standard version, but maybe we can add an extra check to see if your compiler incompetent. David___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228436 - in head: sys/dev/cpuctl usr.sbin/cpucontrol
Author: fabient Date: Mon Dec 12 12:30:44 2011 New Revision: 228436 URL: http://svn.freebsd.org/changeset/base/228436 Log: Add VIA microde update support to cpuctl(4) and cpucontrol(8). Support have been tested with X2 CPU and QuadCore CPU. MFC after:1 month Added: head/usr.sbin/cpucontrol/via.c (contents, props changed) head/usr.sbin/cpucontrol/via.h (contents, props changed) Modified: head/sys/dev/cpuctl/cpuctl.c head/usr.sbin/cpucontrol/Makefile head/usr.sbin/cpucontrol/cpucontrol.c Modified: head/sys/dev/cpuctl/cpuctl.c == --- head/sys/dev/cpuctl/cpuctl.cMon Dec 12 11:03:14 2011 (r228435) +++ head/sys/dev/cpuctl/cpuctl.cMon Dec 12 12:30:44 2011 (r228436) @@ -74,6 +74,8 @@ static int cpuctl_do_update(int cpu, cpu static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td); static int update_amd(int cpu, cpuctl_update_args_t *args, struct thread *td); +static int update_via(int cpu, cpuctl_update_args_t *args, +struct thread *td); static struct cdev **cpuctl_devs; static MALLOC_DEFINE(M_CPUCTL, cpuctl, CPUCTL buffer); @@ -281,8 +283,10 @@ cpuctl_do_update(int cpu, cpuctl_update_ vendor[12] = '\0'; if (strncmp(vendor, INTEL_VENDOR_ID, sizeof(INTEL_VENDOR_ID)) == 0) ret = update_intel(cpu, data, td); - else if(strncmp(vendor, INTEL_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) + else if(strncmp(vendor, AMD_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) ret = update_amd(cpu, data, td); + else if(strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) == 0) + ret = update_via(cpu, data, td); else ret = ENXIO; return (ret); @@ -402,6 +406,81 @@ fail: return (ret); } +static int +update_via(int cpu, cpuctl_update_args_t *args, struct thread *td) +{ + void *ptr = NULL; + uint64_t rev0, rev1, res; + uint32_t tmp[4]; + int is_bound = 0; + int oldcpu; + int ret; + + if (args-size == 0 || args-data == NULL) { + DPRINTF([cpuctl,%d]: zero-sized firmware image, __LINE__); + return (EINVAL); + } + if (args-size UCODE_SIZE_MAX) { + DPRINTF([cpuctl,%d]: firmware image too large, __LINE__); + return (EINVAL); + } + + /* +* 4 byte alignment required. +*/ + ptr = malloc(args-size + 16, M_CPUCTL, M_WAITOK); + ptr = (void *)(16 + ((intptr_t)ptr ~0xf)); + if (copyin(args-data, ptr, args-size) != 0) { + DPRINTF([cpuctl,%d]: copyin %p-%p of %zd bytes failed, + __LINE__, args-data, ptr, args-size); + ret = EFAULT; + goto fail; + } + oldcpu = td-td_oncpu; + is_bound = cpu_sched_is_bound(td); + set_cpu(cpu, td); + critical_enter(); + rdmsr_safe(MSR_BIOS_SIGN, rev0); /* Get current micorcode revision. */ + + /* +* Perform update. +*/ + wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); + do_cpuid(1, tmp); + + /* +* Result are in low byte of MSR FCR5: +* 0x00: No update has been attempted since RESET. +* 0x01: The last attempted update was successful. +* 0x02: The last attempted update was unsuccessful due to a bad +* environment. No update was loaded and any preexisting +* patches are still active. +* 0x03: The last attempted update was not applicable to this processor. +* No update was loaded and any preexisting patches are still +* active. +* 0x04: The last attempted update was not successful due to an invalid +* update data block. No update was loaded and any preexisting +* patches are still active +*/ + rdmsr_safe(0x1205, res); + res = 0xff; + critical_exit(); + rdmsr_safe(MSR_BIOS_SIGN, rev1); /* Get new microcode revision. */ + restore_cpu(oldcpu, is_bound, td); + + DPRINTF([cpu,%d]: rev0=%x rev1=%x res=%x\n, __LINE__, + (unsigned)(rev0 32), (unsigned)(rev1 32), (unsigned)res); + + if (res != 0x01) + ret = EINVAL; + else + ret = 0; +fail: + if (ptr != NULL) + contigfree(ptr, args-size, M_CPUCTL); + return (ret); +} + int cpuctl_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) { Modified: head/usr.sbin/cpucontrol/Makefile == --- head/usr.sbin/cpucontrol/Makefile Mon Dec 12 11:03:14 2011 (r228435) +++ head/usr.sbin/cpucontrol/Makefile Mon Dec 12 12:30:44 2011 (r228436) @@ -2,6 +2,6 @@ PROG= cpucontrol MAN= cpucontrol.8 -SRCS= cpucontrol.c intel.c amd.c +SRCS= cpucontrol.c
Re: svn commit: r228415 - head/sys/dev/e1000
On Sun, Dec 11, 2011 at 06:46:14PM +, Jack F Vogel wrote: Author: jfv Date: Sun Dec 11 18:46:14 2011 New Revision: 228415 URL: http://svn.freebsd.org/changeset/base/228415 Log: Last change still had an issue, one more time... Jack, the previous commit (rev. 228387) removed netmap support from if_igb.c I believe it was unintentional. Can you put it back, or do you want me to handle it ? cheers luigi Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.cSun Dec 11 17:32:37 2011 (r228414) +++ head/sys/dev/e1000/if_em.cSun Dec 11 18:46:14 2011 (r228415) @@ -1045,8 +1045,8 @@ em_ioctl(struct ifnet *ifp, u_long comma struct ifreq*ifr = (struct ifreq *)data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; - boolavoid_reset = FALSE; #endif + boolavoid_reset = FALSE; int error = 0; if (adapter-in_detach) @@ -1062,7 +1062,6 @@ em_ioctl(struct ifnet *ifp, u_long comma if (ifa-ifa_addr-sa_family == AF_INET6) avoid_reset = TRUE; #endif -#if defined(INET) || defined(INET6) /* ** Calling init results in link renegotiation, ** so we avoid doing it when possible. @@ -1071,11 +1070,12 @@ em_ioctl(struct ifnet *ifp, u_long comma ifp-if_flags |= IFF_UP; if (!(ifp-if_drv_flags IFF_DRV_RUNNING)) em_init(adapter); +#ifdef INET if (!(ifp-if_flags IFF_NOARP)) arp_ifinit(ifp, ifa); +#endif } else error = ether_ioctl(ifp, command, data); -#endif break; case SIOCSIFMTU: { Modified: head/sys/dev/e1000/if_igb.c == --- head/sys/dev/e1000/if_igb.c Sun Dec 11 17:32:37 2011 (r228414) +++ head/sys/dev/e1000/if_igb.c Sun Dec 11 18:46:14 2011 (r228415) @@ -992,8 +992,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm struct ifreq*ifr = (struct ifreq *)data; #if defined(INET) || defined(INET6) struct ifaddr *ifa = (struct ifaddr *)data; - boolavoid_reset = FALSE; #endif + boolavoid_reset = FALSE; int error = 0; if (adapter-in_detach) @@ -1009,7 +1009,6 @@ igb_ioctl(struct ifnet *ifp, u_long comm if (ifa-ifa_addr-sa_family == AF_INET6) avoid_reset = TRUE; #endif -#if defined(INET) || defined(INET6) /* ** Calling init results in link renegotiation, ** so we avoid doing it when possible. @@ -1018,11 +1017,12 @@ igb_ioctl(struct ifnet *ifp, u_long comm ifp-if_flags |= IFF_UP; if (!(ifp-if_drv_flags IFF_DRV_RUNNING)) igb_init(adapter); +#ifdef INET if (!(ifp-if_flags IFF_NOARP)) arp_ifinit(ifp, ifa); +#endif } else error = ether_ioctl(ifp, command, data); -#endif break; case SIOCSIFMTU: { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228438 - head/sys/dev/hwpmc
Author: fabient Date: Mon Dec 12 13:12:55 2011 New Revision: 228438 URL: http://svn.freebsd.org/changeset/base/228438 Log: There's a small set of events on Nehalem, that are not supported in processors with CPUID signature 06_1AH, 06_1EH, and 06_1FH. Refuse to allocate them on unsupported model. Submitted by: Davide Italiano davide.itali...@gmail.com MFC after:1 month Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c == --- head/sys/dev/hwpmc/hwpmc_core.c Mon Dec 12 12:33:38 2011 (r228437) +++ head/sys/dev/hwpmc/hwpmc_core.c Mon Dec 12 13:12:55 2011 (r228438) @@ -41,6 +41,7 @@ __FBSDID($FreeBSD$); #include machine/apicvar.h #include machine/cpu.h #include machine/cpufunc.h +#include machine/md_var.h #include machine/specialreg.h #defineCORE_CPUID_REQUEST 0xA @@ -1553,7 +1554,7 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - int n; + int n, model; enum pmc_event ev; struct iap_event_descr *ie; uint32_t c, caps, config, cpuflag, evsel, mask; @@ -1573,6 +1574,16 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_architectural_event_is_unsupported(ev)) return (EOPNOTSUPP); + /* +* A small number of events are not supported in all the +* processors based on a given microarchitecture. +*/ + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + model = ((cpu_id 0xF) 12) | ((cpu_id 0xF0) 4); + if (core_cputype == PMC_CPU_INTEL_COREI7 model != 0x2E) + return (EINVAL); + } + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228433 - in head/sys: kern security/mac
On Mon, 12 Dec 2011, Andriy Gapon wrote: on 12/12/2011 12:15 Kostik Belousov said the following: On Mon, Dec 12, 2011 at 10:05:13AM +, Andriy Gapon wrote: Author: avg Date: Mon Dec 12 10:05:13 2011 New Revision: 228433 URL: http://svn.freebsd.org/changeset/base/228433 Log: put sys/systm.h at its proper place or add it if missing Reported by: lstewart, tinderbox Pointyhat to: avg, attilio MFC after:1 week MFC with: r228430 Modified: head/sys/kern/kern_sx.c head/sys/kern/vfs_cache.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_priv.c It means that previously sx.h did not required systm.h and now it does ? Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarations into sys/lock.h ? Strictly speaking it's sys/lockstat.h that now requires systm.h. I am not an expert in FreeBSD header file organization, so I will just follow whatever the experts advise. sys/systm.h should always be included second (after sys/param.h) since it defines interfaces like KASSERT() and now SCHEDULER_STOPPED() that _might_ be used in other headers. KASSERT() was already used in a few critical headers. However, this shouldn't necessary in practice since KASSERT() and SCHEDULER_STOPPED() are implemented as macros. The other headers should also use macros and not use inline functions, so that they don't depend on the include order. The sys headers that use SCHEDULER_STOPPED(), namely sys/lockstat.h and sys/mutex.h already don't use any inline functions, although they use rather bloated macros that give too much inlining in a different way to inline functions. The compilation failures occurred because other headers use inline functions that use the macros that use SCHEDULER_STOPPED(). sys/sx.h seems to be the main offender. It uses LOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(). This horribly named interface now uses SCHEDULER_STOPPED(). When lockstat profiling is configured, the expansion in nested macros becomes even larger. I think the SCHEDULER_STOPPED() call should be in lock_profile_obtain_lock_success(), not in the macro that invokes it. The usual excuse for bloated macros and inlines -- that they execute only a small amount of code in the usual case -- applies inversely here, since it is the unusual case of SCHEDULER_STOPPED() that is optimized by testing in the macro to avoid the function call. sys/sx.h's excessive dependencies on other headers can also be seen in its namespace pollution. It includes nested all of the following: - sys/pcpu.h: Needed for some reason(?) - sys/lock_profile.h sys/lockstat.h: These are more reasonable. sx.h uses lock profiling, etc., so it needs the lock profiling interfaces defined somewhere in cases where they are actually referenced, and since sx.h uses inline functions the lock profiling interfaces are _always_ referenced if sx.h is included, even if they are not used because the sx.h inlines that reference them are not referenced. If sx.h used macros instead of inlines, then the lock profiling headers would only be used sometimes, and then including them nested would save having to include them in .c files that don't really know about them. But style rules forbid such nested includes, since they result in almost every header including every other header via transitive closure of creeping pollution, and make it very hard to see the actual dependencies. davidg cleaned up the vm header pollution in 1995. Despite attempts to keep it under control, pollution in other headers is probably 10 times larger than it was then :-(. - machine/atomic.h: bogus. This is standard namespace pollution in sys/systm.h, and it is a style bug not to depend on this, since it is usually a not just a style bug to not include sys/systm.h. This style bug used to be only in mutex.h among sys headers. I fixed it there long ago in my version. Now it is also in refcount.h, rwlock.h and sx.h. Some of the other bugs in this area are including sys/types.h instead of sys/param.h and not including sys/systm.h at all. This discussion shows that sys/systm.h _may_ be a prerequisite for almost any system header in the kernel (_KERNEL defined). Even if not including sys/systm.h at all (or sorted alphabetically) works when it is tested and committed, another header may grow a dependency on sys/systm.h, though it shouldn't. Similarly for sys/types.h. sys/param.h provides lots of standard namespace pollution that _may_ be depended on. It is also hard to test whether minimal headers work in all cases even before the future, due to some things depending on options and the labyrinth include dependencies sometimes being satisifed accidentally by pollution in unrelated headers. sys/systm.h may be the wrong place for critical macros like KASSERT(). I've thought of putting it in sys/param.h instead, but there is already too much non-parameter and other pollution there. If I knew what systm stood for,
Re: svn commit: r228431 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/viawd sys/i386/conf sys/modules sys/modules/viawd
On Monday, December 12, 2011 4:50:34 am Fabien Thomas wrote: Author: fabient Date: Mon Dec 12 09:50:33 2011 New Revision: 228431 URL: http://svn.freebsd.org/changeset/base/228431 Log: Add watchdog support for VIA south bridge chipset. Tested on VT8251, VX900 but CX700, VX800, VX855 should works. MFC after: 1 month Sponsored by: NETASQ Eh, please don't use pci_find_device() but use a PCI probe routine instead. What should happen in this case is that this should be a child of 'isab' and it should attach based on the PCI ID of the 'isab' device. You can find that by fetching the PCI ID of the parent device in your identify routine like so: /* Look for a supported VIA south bridge. */ static struct viawd_device * viawd_find(device_t dev) { struct viawd_device *id; if (pci_get_vendor(dev) != VENDORID_VIA) return (NULL); for (id = viawd_devices; id-desc != NULL; id++) if (pci_get_device(dev) == id-device) return (id); return (NULL); } static void viawd_identify(driver_t *driver, device_t parent) { if (viawd_find(parent) == NULL) return; if (device_find_child(parent, driver-name, -1) == NULL) BUS_ADD_CHILD(parent, 0, driver-name, 0); } static int viawd_probe(device_t dev) { struct viawd_device *id; id = viawd_find(device_get_parent(dev)); KASSERT(id != NULL, (parent should be a valid VIA SB)); device_set_desc(dev, id-desc); return (BUS_GENERIC_PROBE); } static int viawd_attach(device_t dev) { device_t sb_dev; ... sb_dev = device_get_parent(dev); ... } (Note use of device_set_desc(), you only need device_set_desc_copy() if your strings are not constant.) Also, please remove wd_bst and wd_bsh. Instead, change the read/write macros like so: #define viawd_read_wd_4(sc, off)bus_read_4((sc)-wd_res, (off)) #define viawd_write_wd_4(sc, off, val) \ bus_write_r((sc)-wd_res, (off), (val)) (I would even consider dropping the _wd from their names since it is redundant since viawd already has wd in the name.) Finally, it looks like viawd_modevent() is debugging? It can probably be removed now? Added: head/share/man/man4/viawd.4 (contents, props changed) head/sys/dev/viawd/ head/sys/dev/viawd/viawd.c (contents, props changed) head/sys/dev/viawd/viawd.h (contents, props changed) head/sys/modules/viawd/ head/sys/modules/viawd/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/conf/NOTES head/sys/modules/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/Makefile Mon Dec 12 07:46:10 2011 (r228430) +++ head/share/man/man4/Makefile Mon Dec 12 09:50:33 2011 (r228431) @@ -499,6 +499,7 @@ MAN= aac.4 \ vga.4 \ vge.4 \ viapm.4 \ + ${_viawd.4} \ vinum.4 \ vkbd.4 \ vlan.4 \ @@ -711,6 +712,7 @@ _speaker.4= speaker.4 _spkr.4= spkr.4 _tpm.4= tpm.4 _urtw.4= urtw.4 +_viawd.4=viawd.4 _wpi.4= wpi.4 _xen.4= xen.4 Added: head/share/man/man4/viawd.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/viawd.4 Mon Dec 12 09:50:33 2011 (r228431) @@ -0,0 +1,79 @@ +.\- +.\ Copyright (c) 2011 Fabien Thomas fabi...@freebsd.org +.\ All rights reserved. +.\ +.\ Redistribution and use in source and binary forms, with or without +.\ modification, are permitted provided that the following conditions +.\ are met: +.\ 1. Redistributions of source code must retain the above copyright +.\notice, this list of conditions and the following disclaimer. +.\ 2. Redistributions in binary form must reproduce the above copyright +.\notice, this list of conditions and the following disclaimer in the +.\documentation and/or other materials provided with the distribution. +.\ +.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND +.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
Re: svn commit: r228433 - in head/sys: kern security/mac
2011/12/12 Andriy Gapon a...@freebsd.org: on 12/12/2011 12:15 Kostik Belousov said the following: On Mon, Dec 12, 2011 at 10:05:13AM +, Andriy Gapon wrote: Author: avg Date: Mon Dec 12 10:05:13 2011 New Revision: 228433 URL: http://svn.freebsd.org/changeset/base/228433 Log: put sys/systm.h at its proper place or add it if missing Reported by: lstewart, tinderbox Pointyhat to: avg, attilio MFC after: 1 week MFC with: r228430 Modified: head/sys/kern/kern_sx.c head/sys/kern/vfs_cache.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_priv.c It means that previously sx.h did not required systm.h and now it does ? Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarations into sys/lock.h ? Strictly speaking it's sys/lockstat.h that now requires systm.h. I am not an expert in FreeBSD header file organization, so I will just follow whatever the experts advise. I think that we should revert this part of the patch and just fix dtrace_probe() for pollution, this way we get the same effect and avoid namespace pollution (and still improve the MFC situation). I'll make a patch available in the next hour. Attilio -- Peace can only be achieved by understanding - A. Einstein ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228433 - in head/sys: kern security/mac
2011/12/12 Attilio Rao atti...@freebsd.org: 2011/12/12 Andriy Gapon a...@freebsd.org: on 12/12/2011 12:15 Kostik Belousov said the following: On Mon, Dec 12, 2011 at 10:05:13AM +, Andriy Gapon wrote: Author: avg Date: Mon Dec 12 10:05:13 2011 New Revision: 228433 URL: http://svn.freebsd.org/changeset/base/228433 Log: put sys/systm.h at its proper place or add it if missing Reported by: lstewart, tinderbox Pointyhat to: avg, attilio MFC after: 1 week MFC with: r228430 Modified: head/sys/kern/kern_sx.c head/sys/kern/vfs_cache.c head/sys/security/mac/mac_framework.c head/sys/security/mac/mac_priv.c It means that previously sx.h did not required systm.h and now it does ? Might be, you should move SCHEDULER_STOPPED and stop_scheduler declarations into sys/lock.h ? Strictly speaking it's sys/lockstat.h that now requires systm.h. I am not an expert in FreeBSD header file organization, so I will just follow whatever the experts advise. I think that we should revert this part of the patch and just fix dtrace_probe() for pollution, this way we get the same effect and avoid namespace pollution (and still improve the MFC situation). I'll make a patch available in the next hour. More precisely, what do you think about the patch below? I just didn't revert the moving of systm.h under param.h because Bruce seems to prefer that. I'm starting test-compile right now, let me know your preference. Attilio Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c === --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (revision 228438) +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (working copy) @@ -5877,6 +5877,9 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintp volatile uint16_t *flags; hrtime_t now; + if (SCHEDULER_STOPPED()) + return; + #if defined(sun) /* * Kick out immediately if this CPU is still being born (in which case Index: sys/security/mac/mac_priv.c === --- sys/security/mac/mac_priv.c (revision 228438) +++ sys/security/mac/mac_priv.c (working copy) @@ -42,7 +42,6 @@ __FBSDID($FreeBSD$); #include opt_mac.h #include sys/param.h -#include sys/systm.h #include sys/kernel.h #include sys/priv.h #include sys/sdt.h Index: sys/sys/lockstat.h === --- sys/sys/lockstat.h (revision 228438) +++ sys/sys/lockstat.h (working copy) @@ -185,24 +185,17 @@ extern uint64_t lockstat_nsecs(void); #defineLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \ uint32_t id; \ \ - if (!SCHEDULER_STOPPED()) { \ - lock_profile_obtain_lock_success((lp)-lock_object, c, wt, \ - f, l); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0,\ - 0, 0); \ - }\ + lock_profile_obtain_lock_success((lp)-lock_object, c, wt, f, l); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ } while (0) #defineLOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do { \ uint32_t id; \ \ - if (!SCHEDULER_STOPPED()) { \ - lock_profile_release_lock((lp)-lock_object); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0,\ - 0, 0); \ - }\ + lock_profile_release_lock((lp)-lock_object); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ } while (0) #else /* !KDTRACE_HOOKS */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228433 - in head/sys: kern security/mac
on 12/12/2011 19:05 Attilio Rao said the following: More precisely, what do you think about the patch below? I just didn't revert the moving of systm.h under param.h because Bruce seems to prefer that. I'm starting test-compile right now, let me know your preference. The patch looks good to me. Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c === --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (revision 228438) +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (working copy) @@ -5877,6 +5877,9 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintp volatile uint16_t *flags; hrtime_t now; + if (SCHEDULER_STOPPED()) + return; + I think that this could even be panicstr != NULL, there is probably no use for DTrace at panic time. #if defined(sun) /* * Kick out immediately if this CPU is still being born (in which case Index: sys/security/mac/mac_priv.c === --- sys/security/mac/mac_priv.c (revision 228438) +++ sys/security/mac/mac_priv.c (working copy) @@ -42,7 +42,6 @@ __FBSDID($FreeBSD$); #include opt_mac.h #include sys/param.h -#include sys/systm.h #include sys/kernel.h #include sys/priv.h #include sys/sdt.h I would even keep this inclusion, just for the why not reason. Index: sys/sys/lockstat.h === --- sys/sys/lockstat.h (revision 228438) +++ sys/sys/lockstat.h (working copy) @@ -185,24 +185,17 @@ extern uint64_t lockstat_nsecs(void); #defineLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \ uint32_t id; \ \ - if (!SCHEDULER_STOPPED()) { \ - lock_profile_obtain_lock_success((lp)-lock_object, c, wt, \ - f, l); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0,\ - 0, 0); \ - }\ + lock_profile_obtain_lock_success((lp)-lock_object, c, wt, f, l); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ } while (0) #defineLOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do { \ uint32_t id; \ \ - if (!SCHEDULER_STOPPED()) { \ - lock_profile_release_lock((lp)-lock_object); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0,\ - 0, 0); \ - }\ + lock_profile_release_lock((lp)-lock_object); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ } while (0) #else /* !KDTRACE_HOOKS */ -- Andriy Gapon ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64
On Mon, Dec 12, 2011 at 11:03:15AM +, Konstantin Belousov wrote: To allow use of external references from the dispatch function, resolution of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries for PLT are prepared, and normal resolution of the GOT entries is finished. Similar to how it is done by GNU, IRELATIVE relocations are resolved in advance, instead of normal lazy handling for PLT. Are you sure that you didn't introduce major locking issues with this? Joerg ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228435 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64
On Mon, Dec 12, 2011 at 06:17:09PM +0100, Joerg Sonnenberger wrote: On Mon, Dec 12, 2011 at 11:03:15AM +, Konstantin Belousov wrote: To allow use of external references from the dispatch function, resolution of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries for PLT are prepared, and normal resolution of the GOT entries is finished. Similar to how it is done by GNU, IRELATIVE relocations are resolved in advance, instead of normal lazy handling for PLT. Are you sure that you didn't introduce major locking issues with this? What do you mean, exactly ? The dispatcher function is called under the bind lock, yes. pgpvsj1j4j2W4.pgp Description: PGP signature
svn commit: r228441 - head/sys/dev/e1000
Author: mdf Date: Mon Dec 12 18:27:34 2011 New Revision: 228441 URL: http://svn.freebsd.org/changeset/base/228441 Log: Consistently use types in e1000 driver code: - Two struct members eee_disable are used in a function that expects an int *, so declare them int, not bool. - igb_tx_ctx_setup() returns a boolean value, so declare it bool, not int. - igb_header_split is passed to TUNABLE_INT, so delcare it int, not bool. - igb_tso_setup() returns a bool, so declare it bool, not boolean_t. - Do not re-define bool/true/false if the symbols already exist. MFC after:2 weeks Sponsored by: Isilon Systems, LLC Modified: head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_osdep.h head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/e1000_hw.h == --- head/sys/dev/e1000/e1000_hw.h Mon Dec 12 18:27:28 2011 (r228440) +++ head/sys/dev/e1000/e1000_hw.h Mon Dec 12 18:27:34 2011 (r228441) @@ -911,13 +911,13 @@ struct e1000_dev_spec_ich8lan { E1000_MUTEX nvm_mutex; E1000_MUTEX swflag_mutex; bool nvm_k1_enabled; - bool eee_disable; + int eee_disable; }; struct e1000_dev_spec_82575 { bool sgmii_active; bool global_device_reset; - bool eee_disable; + int eee_disable; bool module_plugged; u32 mtu; }; Modified: head/sys/dev/e1000/e1000_osdep.h == --- head/sys/dev/e1000/e1000_osdep.hMon Dec 12 18:27:28 2011 (r228440) +++ head/sys/dev/e1000/e1000_osdep.hMon Dec 12 18:27:34 2011 (r228441) @@ -73,9 +73,11 @@ #define STATIC static #define FALSE 0 -#define false FALSE #define TRUE 1 +#ifndef __bool_true_false_are_defined +#define false FALSE #define true TRUE +#endif #define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */ #define PCI_COMMAND_REGISTER PCIR_COMMAND @@ -96,7 +98,9 @@ typedef int64_t s64; typedef int32_ts32; typedef int16_ts16; typedef int8_t s8; +#ifndef __bool_true_false_are_defined typedef boolean_t bool; +#endif #define __le16 u16 #define __le32 u32 Modified: head/sys/dev/e1000/if_igb.c == --- head/sys/dev/e1000/if_igb.c Mon Dec 12 18:27:28 2011(r228440) +++ head/sys/dev/e1000/if_igb.c Mon Dec 12 18:27:34 2011(r228441) @@ -223,7 +223,7 @@ static __inline void igb_rx_input(struct static booligb_rxeof(struct igb_queue *, int, int *); static voidigb_rx_checksum(u32, struct mbuf *, u32); -static int igb_tx_ctx_setup(struct tx_ring *, struct mbuf *); +static booligb_tx_ctx_setup(struct tx_ring *, struct mbuf *); static booligb_tso_setup(struct tx_ring *, struct mbuf *, int, struct ip *, struct tcphdr *); static voidigb_set_promisc(struct adapter *); @@ -335,7 +335,7 @@ TUNABLE_INT(hw.igb.max_interrupt_rate, ** into the header and thus use no cluster. Its ** a very workload dependent type feature. */ -static bool igb_header_split = FALSE; +static int igb_header_split = FALSE; TUNABLE_INT(hw.igb.hdr_split, igb_header_split); /* @@ -3441,7 +3441,7 @@ igb_free_transmit_buffers(struct tx_ring * Setup work for hardware segmentation offload (TSO) * **/ -static boolean_t +static bool igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, int ehdrlen, struct ip *ip, struct tcphdr *th) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228442 - head/sys/cam/scsi
Author: mdf Date: Mon Dec 12 18:43:18 2011 New Revision: 228442 URL: http://svn.freebsd.org/changeset/base/228442 Log: Do not use the sometimes-reserved work 'bool' for a variable name. MFC after:2 weeks Sponsored by: Isilon Systems, LLC Modified: head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/scsi/scsi_xpt.c == --- head/sys/cam/scsi/scsi_xpt.cMon Dec 12 18:27:34 2011 (r228441) +++ head/sys/cam/scsi/scsi_xpt.cMon Dec 12 18:43:18 2011 (r228442) @@ -1811,14 +1811,14 @@ scsi_find_quirk(struct cam_ed *device) static int sysctl_cam_search_luns(SYSCTL_HANDLER_ARGS) { - int error, bool; + int error, val; - bool = cam_srch_hi; - error = sysctl_handle_int(oidp, bool, 0, req); + val = cam_srch_hi; + error = sysctl_handle_int(oidp, val, 0, req); if (error != 0 || req-newptr == NULL) return (error); - if (bool == 0 || bool == 1) { - cam_srch_hi = bool; + if (val == 0 || val == 1) { + cam_srch_hi = val; return (0); } else { return (EINVAL); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228330 - in head: include sys/sys
On Sun, Dec 11, 2011, David Chisnall wrote: On 11 Dec 2011, at 21:12, Andreas Tobler wrote: As far as I understand, GCC does not support this attribute [[noreturn]] yet. But it defines both, __cplusplus and __cplusplus=201103L. On gcc-4.7 __cplusplus=201103L is the default when we build libstdc++. Advertising C++11 compatibility and then not supporting fairly simple C++11 features seems like a pretty major GCC bug. So I think we have to extend the check as below or we can reorder the defines that GNUC is before the __cplusplus __cplusplus= 201103L. I'd rather prefer the standard version to the non-standard version, but maybe we can add an extra check to see if your compiler incompetent. The reality is that none of the open source compilers even fully support C99. We try to make sure the FreeBSD headers don't blow up with other compilers, although some of the support for the Intel compiler and ancient versions of gcc has rotted. It is ugly at times, but many of the compiler-specific details are abstracted away in macros in sys/cdefs.h. Note that for the POSIX/XSI/C standards, we actually define our own visibility macros, because the standard ones are such a mess. We will presumably need one for C1X soon. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228445 - in head: share/man/man4 sys/dev/fb sys/modules/splash sys/modules/splash/txt
Author: eadler (ports committer) Date: Mon Dec 12 21:12:07 2011 New Revision: 228445 URL: http://svn.freebsd.org/changeset/base/228445 Log: - Add support for ASCII art splash screens in TheDraw format PR: kern/143370 Submitted by: Antony Mawer ant...@mawer.org Reviewed by: gjb (doc) Reviewed by: des (style) Approved by: ed MFC after:1 month Added: head/sys/dev/fb/splash_txt.c (contents, props changed) head/sys/modules/splash/txt/ head/sys/modules/splash/txt/Makefile (contents, props changed) Modified: head/share/man/man4/splash.4 head/sys/modules/splash/Makefile Modified: head/share/man/man4/splash.4 == --- head/share/man/man4/splash.4Mon Dec 12 18:44:17 2011 (r228444) +++ head/share/man/man4/splash.4Mon Dec 12 21:12:07 2011 (r228445) @@ -74,6 +74,14 @@ Bitmaps of other color depths will not b ZSoft PCX decoder. This decoder currently only supports version 5 8-bpp single-plane images. +.It Pa splash_txt.ko +TheDraw binary ASCII drawing file decoder. +Displays a text-mode 80x25 ASCII drawing, such as that produced by +the Binary save format in TheDraw. +This format consists of a sequence +of two byte pairs representing the 80x25 display, where the first byte +is the ASCII character to draw and the second byte indicates the +colors/attributes to use when drawing the character. .El .Pp The @@ -223,6 +231,16 @@ If the VESA support is statically linked necessary to load the VESA module. Just load the bitmap file and the splash decoder module as in the first example above. +.Pp +To load a binary ASCII drawing and display this while booting, include the +following into your +.Pa /boot/loader.conf +: +.Bd -literal -offset indent +splash_txt_load=YES +bitmap_load=YES +bitmap_name=/boot/splash.bin +.Ed .\.Sh DIAGNOSTICS .Sh SEE ALSO .Xr vidcontrol 1 , @@ -256,6 +274,15 @@ module was written by based on the .Pa splash_bmp code. +The +.Pa splash_txt +module was written by +.An Antony Mawer Aq ant...@mawer.org +based on the +.Pa splash_bmp +code, with some additional inspiration from the +.Pa daemon_saver +code. .Sh CAVEATS Both the splash screen and the screen saver work with .Xr syscons 4 Added: head/sys/dev/fb/splash_txt.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/fb/splash_txt.cMon Dec 12 21:12:07 2011 (r228445) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 1999 Michael Smith msm...@freebsd.org + * Copyright (c) 1999 Kazutaka YOKOTA yok...@freebsd.org + * Copyright (c) 2005 Antony Mawer ant...@mawer.org + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include sys/param.h +#include sys/systm.h +#include sys/module.h +#include sys/kernel.h +#include sys/consio.h +#include sys/fbio.h + +#include machine/pc/display.h + +#include dev/fb/fbreg.h +#include dev/fb/splashreg.h +#include dev/syscons/syscons.h + +static int splash_on = FALSE; + +static int txt_init(video_adapter_t *adp); +static int txt_end(video_adapter_t *adp); +static int txt_splash(video_adapter_t * adp, const int on); + +/* These are rows by columns of the text-mode display device. */ +#define BIN_IMAGE_WIDTH80 +#define BIN_IMAGE_HEIGHT 25 + +static splash_decoder_t txt_decoder = { + .name = splash_txt, + .init = txt_init, + .term = txt_end, + .splash = txt_splash, + .data_type = SPLASH_IMAGE, +}; + +SPLASH_DECODER(splash_txt, txt_decoder); + +static void +draw_text_splash(sc_softc_t *sc) +{ + u_int x,
svn commit: r228446 - head/usr.bin/procstat
Author: trociny Date: Mon Dec 12 21:41:05 2011 New Revision: 228446 URL: http://svn.freebsd.org/changeset/base/228446 Log: Make procstat -l output similar to the output of limits(1). Suggested by: jhb MFC after:1 week Modified: head/usr.bin/procstat/procstat_rlimit.c Modified: head/usr.bin/procstat/procstat_rlimit.c == --- head/usr.bin/procstat/procstat_rlimit.c Mon Dec 12 21:12:07 2011 (r228445) +++ head/usr.bin/procstat/procstat_rlimit.c Mon Dec 12 21:41:05 2011 (r228446) @@ -28,7 +28,6 @@ #include sys/param.h #include sys/time.h -#define _RLIMIT_IDENT #include sys/resourcevar.h #include sys/sysctl.h #include sys/user.h @@ -36,6 +35,7 @@ #include err.h #include errno.h #include libprocstat.h +#include libutil.h #include limits.h #include stdio.h #include stdlib.h @@ -43,17 +43,60 @@ #include procstat.h +static struct { + const char *name; + const char *suffix; +} rlimit_param[13] = { + {cputime, sec}, + {filesize, B }, + {datasize, B }, + {stacksize,B }, + {coredumpsize, B }, + {memoryuse,B }, + {memorylocked, B }, + {maxprocesses,}, + {openfiles, }, + {sbsize, B }, + {vmemoryuse, B }, + {pseudo-terminals,}, + {swapuse, B }, +}; + +#if RLIM_NLIMITS 13 +#error Resource limits have grown. Add new entries to rlimit_param[]. +#endif + static struct rlimit rlimit[RLIM_NLIMITS]; +static +const char *humanize_rlimit(int indx, rlim_t limit) +{ + static char buf[14]; + int scale; + + if (limit == RLIM_INFINITY) + return (infinity ); + + scale = humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE | HN_GETSCALE, HN_DECIMAL); + (void)humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE, HN_DECIMAL); + /* Pad with one space if there is no suffix prefix. */ + if (scale == 0) + sprintf(buf + strlen(buf), ); + return (buf); +} + void procstat_rlimit(struct kinfo_proc *kipp) { int error, i, name[4]; size_t len; - if (!hflag) - printf(%5s %-16s %-10s %12s %12s\n, PID, COMM, RLIMIT, - CURRENT, MAX); + if (!hflag) { + printf(%5s %-16s %-16s %16s %16s\n, + PID, COMM, RLIMIT, SOFT , HARD ); + } name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_RLIMIT; @@ -68,11 +111,9 @@ procstat_rlimit(struct kinfo_proc *kipp) return; for (i = 0; i RLIM_NLIMITS; i++) { - printf(%5d %-16s %-10s %12jd %12jd\n, kipp-ki_pid, - kipp-ki_comm, rlimit_ident[i], - rlimit[i].rlim_cur == RLIM_INFINITY ? - -1 : rlimit[i].rlim_cur, - rlimit[i].rlim_max == RLIM_INFINITY ? - -1 : rlimit[i].rlim_max); + printf(%5d %-16s %-16s , kipp-ki_pid, kipp-ki_comm, + rlimit_param[i].name); + printf(%16s , humanize_rlimit(i, rlimit[i].rlim_cur)); + printf(%16s\n, humanize_rlimit(i, rlimit[i].rlim_max)); } } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r227956 - head/usr.bin/procstat
On Mon, 12 Dec 2011 14:07:56 -0500 John Baldwin wrote: JB On Saturday, December 10, 2011 3:26:46 am Mikolaj Golub wrote: Output example: PID COMM RLIMIT SOFT HARD 11949 zsh cputime1 sec infinity 11949 zsh filesizeinfinity infinity 11949 zsh datasize 524288 kB524288 kB 11949 zsh stacksize 65536 kB 65536 kB 11949 zsh coredumpsize 190734 MB190734 MB 11949 zsh memoryuse infinity infinity 11949 zsh memorylockedinfinity infinity 11949 zsh maxprocesses5547 5547 11949 zsh openfiles 1109511095 11949 zsh sbsize infinity infinity 11949 zsh vmemoryuse infinity infinity 11949 zsh pseudo-terminalsinfinity infinity 11949 zsh swapuse infinity infinity JB This looks great to me, thanks! Thanks, committed. -- Mikolaj Golub ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r228433 - in head/sys: kern security/mac
2011/12/12 Andriy Gapon a...@freebsd.org: on 12/12/2011 19:05 Attilio Rao said the following: More precisely, what do you think about the patch below? I just didn't revert the moving of systm.h under param.h because Bruce seems to prefer that. I'm starting test-compile right now, let me know your preference. The patch looks good to me. Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c === --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (revision 228438) +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (working copy) @@ -5877,6 +5877,9 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintp volatile uint16_t *flags; hrtime_t now; + if (SCHEDULER_STOPPED()) + return; + I think that this could even be panicstr != NULL, there is probably no use for DTrace at panic time. I agree, I will go with panicstr. #if defined(sun) /* * Kick out immediately if this CPU is still being born (in which case Index: sys/security/mac/mac_priv.c === --- sys/security/mac/mac_priv.c (revision 228438) +++ sys/security/mac/mac_priv.c (working copy) @@ -42,7 +42,6 @@ __FBSDID($FreeBSD$); #include opt_mac.h #include sys/param.h -#include sys/systm.h #include sys/kernel.h #include sys/priv.h #include sys/sdt.h I would even keep this inclusion, just for the why not reason. If it passes testing I will remove it as it is unneeded. Attilio -- Peace can only be achieved by understanding - A. Einstein ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228447 - head/usr.bin/procstat
Author: trociny Date: Mon Dec 12 22:01:33 2011 New Revision: 228447 URL: http://svn.freebsd.org/changeset/base/228447 Log: Make 64-bit procstat output ELF auxiliary vectors for 32-bit processes. Reviewed by: kib MFC after:1 week Modified: head/usr.bin/procstat/procstat_auxv.c Modified: head/usr.bin/procstat/procstat_auxv.c == --- head/usr.bin/procstat/procstat_auxv.c Mon Dec 12 21:41:05 2011 (r228446) +++ head/usr.bin/procstat/procstat_auxv.c Mon Dec 12 22:01:33 2011 (r228447) @@ -43,39 +43,110 @@ #include procstat.h -static Elf_Auxinfo auxv[256]; +#define PROC_AUXV_MAX 256 + +static Elf_Auxinfo auxv[PROC_AUXV_MAX]; static char prefix[256]; +#if __ELF_WORD_SIZE == 64 +static Elf32_Auxinfo auxv32[PROC_AUXV_MAX]; + +static const char *elf32_sv_names[] = { + Linux ELF32, + FreeBSD ELF32, +}; + +static int +is_elf32(pid_t pid) +{ + int error, name[4]; + size_t len, i; + static char sv_name[256]; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_SV_NAME; + name[3] = pid; + len = sizeof(sv_name); + error = sysctl(name, 4, sv_name, len, NULL, 0); + if (error != 0 || len == 0) + return (0); + for (i = 0; i sizeof(elf32_sv_names) / sizeof(*elf32_sv_names); i++) { + if (strncmp(sv_name, elf32_sv_names[i], sizeof(sv_name)) == 0) + return (1); + } + return (0); +} + +static size_t +retrieve_auxv32(pid_t pid) +{ + int error, name[4]; + size_t len, i; + void *ptr; + + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_AUXV; + name[3] = pid; + len = sizeof(auxv32); + error = sysctl(name, 4, auxv32, len, NULL, 0); + if (error 0 errno != ESRCH errno != EPERM) { + warn(sysctl: kern.proc.auxv: %d: %d, pid, errno); + return (0); + } + for (i = 0; i len; i++) { + /* +* XXX: We expect that values for a_type on a 32-bit platform +* are directly mapped to those on 64-bit one, which is not +* necessarily true. +*/ + auxv[i].a_type = auxv32[i].a_type; + ptr = auxv32[i].a_un; + auxv[i].a_un.a_val = *((uint32_t *)ptr); + } + return (len); +} +#endif /* __ELF_WORD_SIZE == 64 */ + #definePRINT(name, spec, val) \ printf(%s %-16s #spec \n, prefix, #name, (val)) #definePRINT_UNKNOWN(type, val)\ printf(%s %16ld %#lx\n, prefix, (long)type, (u_long)(val)) -void -procstat_auxv(struct kinfo_proc *kipp) +static size_t +retrieve_auxv(pid_t pid) { int error, name[4]; - size_t len, i; - - if (!hflag) - printf(%5s %-16s %-16s %-16s\n, PID, COMM, AUXV, VALUE); + size_t len; +#if __ELF_WORD_SIZE == 64 + if (is_elf32(pid)) + return (retrieve_auxv32(pid)); +#endif name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_AUXV; - name[3] = kipp-ki_pid; - len = sizeof(auxv) * sizeof(*auxv); + name[3] = pid; + len = sizeof(auxv); error = sysctl(name, 4, auxv, len, NULL, 0); if (error 0 errno != ESRCH errno != EPERM) { - warn(sysctl: kern.proc.auxv: %d: %d, kipp-ki_pid, errno); - return; + warn(sysctl: kern.proc.auxv: %d: %d, pid, errno); + return (0); } - if (error 0 || len == 0) - return; - if (len == 0) { - printf( -\n); + return (len); +} + +void +procstat_auxv(struct kinfo_proc *kipp) +{ + size_t len, i; + + if (!hflag) + printf(%5s %-16s %-16s %-16s\n, PID, COMM, AUXV, VALUE); + len = retrieve_auxv(kipp-ki_pid); + if (len == 0) return; - } snprintf(prefix, sizeof(prefix), %5d %-16s, kipp-ki_pid, kipp-ki_comm); for (i = 0; i len; i++) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228448 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace security/mac sys
Author: attilio Date: Mon Dec 12 23:29:32 2011 New Revision: 228448 URL: http://svn.freebsd.org/changeset/base/228448 Log: Revert the approach for skipping lockstat_probe_func call when doing lock_success/lock_failure, introduced in r228424, by directly skipping in dtrace_probe. This mainly helps in avoiding namespace pollution and thus lockstat.h dependency by systm.h. As an added bonus, this also helps in MFC case. Reviewed by: avg MFC after:3 months (or never) X-MFC:r228424 Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/security/mac/mac_priv.c head/sys/sys/lockstat.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c == --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cMon Dec 12 22:01:33 2011(r228447) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cMon Dec 12 23:29:32 2011(r228448) @@ -5877,6 +5877,9 @@ dtrace_probe(dtrace_id_t id, uintptr_t a volatile uint16_t *flags; hrtime_t now; + if (panicstr != NULL) + return; + #if defined(sun) /* * Kick out immediately if this CPU is still being born (in which case Modified: head/sys/security/mac/mac_priv.c == --- head/sys/security/mac/mac_priv.cMon Dec 12 22:01:33 2011 (r228447) +++ head/sys/security/mac/mac_priv.cMon Dec 12 23:29:32 2011 (r228448) @@ -42,7 +42,6 @@ __FBSDID($FreeBSD$); #include opt_mac.h #include sys/param.h -#include sys/systm.h #include sys/kernel.h #include sys/priv.h #include sys/sdt.h Modified: head/sys/sys/lockstat.h == --- head/sys/sys/lockstat.h Mon Dec 12 22:01:33 2011(r228447) +++ head/sys/sys/lockstat.h Mon Dec 12 23:29:32 2011(r228448) @@ -185,24 +185,17 @@ extern uint64_t lockstat_nsecs(void); #defineLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l) do { \ uint32_t id; \ \ - if (!SCHEDULER_STOPPED()) { \ - lock_profile_obtain_lock_success((lp)-lock_object, c, wt, \ - f, l); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0,\ - 0, 0); \ - }\ + lock_profile_obtain_lock_success((lp)-lock_object, c, wt, f, l); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ } while (0) #defineLOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp) do { \ uint32_t id; \ \ - if (!SCHEDULER_STOPPED()) { \ - lock_profile_release_lock((lp)-lock_object); \ - if ((id = lockstat_probemap[(probe)])) \ - (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0,\ - 0, 0); \ - }\ + lock_profile_release_lock((lp)-lock_object); \ + if ((id = lockstat_probemap[(probe)])) \ + (*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0); \ } while (0) #else /* !KDTRACE_HOOKS */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228449 - in head/sys: dev/md kern vm
Author: eadler (ports committer) Date: Tue Dec 13 00:38:50 2011 New Revision: 228449 URL: http://svn.freebsd.org/changeset/base/228449 Log: Document a large number of currently undocumented sysctls. While here fix some style(9) issues and reduce redundancy. PR: kern/155491 PR: kern/155490 PR: kern/155489 Submitted by: Galimov Albert wtfc...@mail.ru Approved by: bde Reviewed by: jhb MFC after:1 week Modified: head/sys/dev/md/md.c head/sys/kern/kern_ntptime.c head/sys/kern/kern_shutdown.c head/sys/kern/kern_thr.c head/sys/kern/uipc_sockbuf.c head/sys/kern/vfs_syscalls.c head/sys/vm/vm_meter.c Modified: head/sys/dev/md/md.c == --- head/sys/dev/md/md.cMon Dec 12 23:29:32 2011(r228448) +++ head/sys/dev/md/md.cTue Dec 13 00:38:50 2011(r228449) @@ -105,9 +105,11 @@ static MALLOC_DEFINE(M_MD, md_disk, M static MALLOC_DEFINE(M_MDSECT, md_sectors, Memory Disk Sectors); static int md_debug; -SYSCTL_INT(_debug, OID_AUTO, mddebug, CTLFLAG_RW, md_debug, 0, ); +SYSCTL_INT(_debug, OID_AUTO, mddebug, CTLFLAG_RW, md_debug, 0, +Enable md(4) debug messages); static int md_malloc_wait; -SYSCTL_INT(_vm, OID_AUTO, md_malloc_wait, CTLFLAG_RW, md_malloc_wait, 0, ); +SYSCTL_INT(_vm, OID_AUTO, md_malloc_wait, CTLFLAG_RW, md_malloc_wait, 0, +Allow malloc to wait for memory allocations); #if defined(MD_ROOT) defined(MD_ROOT_SIZE) /* Modified: head/sys/kern/kern_ntptime.c == --- head/sys/kern/kern_ntptime.cMon Dec 12 23:29:32 2011 (r228448) +++ head/sys/kern/kern_ntptime.cTue Dec 13 00:38:50 2011 (r228449) @@ -301,13 +301,17 @@ SYSCTL_PROC(_kern_ntp_pll, OID_AUTO, get 0, sizeof(struct ntptimeval) , ntp_sysctl, S,ntptimeval, ); #ifdef PPS_SYNC -SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shiftmax, CTLFLAG_RW, pps_shiftmax, 0, ); -SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shift, CTLFLAG_RW, pps_shift, 0, ); +SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shiftmax, CTLFLAG_RW, +pps_shiftmax, 0, Max interval duration (sec) (shift)); +SYSCTL_INT(_kern_ntp_pll, OID_AUTO, pps_shift, CTLFLAG_RW, +pps_shift, 0, Interval duration (sec) (shift)); SYSCTL_LONG(_kern_ntp_pll, OID_AUTO, time_monitor, CTLFLAG_RD, -time_monitor, 0, ); +time_monitor, 0, Last time offset scaled (ns)); -SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, pps_freq, CTLFLAG_RD, pps_freq, sizeof(pps_freq), I, ); -SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, time_freq, CTLFLAG_RD, time_freq, sizeof(time_freq), I, ); +SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, pps_freq, CTLFLAG_RD, +pps_freq, sizeof(pps_freq), I, Scaled frequency offset (ns/sec)); +SYSCTL_OPAQUE(_kern_ntp_pll, OID_AUTO, time_freq, CTLFLAG_RD, +time_freq, sizeof(time_freq), I, Frequency offset (ns/sec)); #endif /* Modified: head/sys/kern/kern_shutdown.c == --- head/sys/kern/kern_shutdown.c Mon Dec 12 23:29:32 2011 (r228448) +++ head/sys/kern/kern_shutdown.c Tue Dec 13 00:38:50 2011 (r228449) @@ -651,7 +651,7 @@ panic(const char *fmt, ...) static int poweroff_delay = POWEROFF_DELAY; SYSCTL_INT(_kern_shutdown, OID_AUTO, poweroff_delay, CTLFLAG_RW, - poweroff_delay, 0, ); +poweroff_delay, 0, Delay before poweroff to write disk caches (msec)); static void poweroff_wait(void *junk, int howto) @@ -671,7 +671,7 @@ poweroff_wait(void *junk, int howto) */ static int kproc_shutdown_wait = 60; SYSCTL_INT(_kern_shutdown, OID_AUTO, kproc_shutdown_wait, CTLFLAG_RW, -kproc_shutdown_wait, 0, ); +kproc_shutdown_wait, 0, Max wait time (sec) to stop for each process); void kproc_shutdown(void *arg, int howto) Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.cMon Dec 12 23:29:32 2011(r228448) +++ head/sys/kern/kern_thr.cTue Dec 13 00:38:50 2011(r228449) @@ -63,11 +63,11 @@ static SYSCTL_NODE(_kern, OID_AUTO, thre static int max_threads_per_proc = 1500; SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_per_proc, CTLFLAG_RW, - max_threads_per_proc, 0, Limit on threads per proc); +max_threads_per_proc, 0, Limit on threads per proc); static int max_threads_hits; SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_hits, CTLFLAG_RD, - max_threads_hits, 0, ); +max_threads_hits, 0, kern.threads.max_threads_per_proc hit count); #ifdef COMPAT_FREEBSD32 Modified: head/sys/kern/uipc_sockbuf.c == --- head/sys/kern/uipc_sockbuf.cMon Dec 12 23:29:32 2011 (r228448) +++ head/sys/kern/uipc_sockbuf.cTue Dec 13 00:38:50 2011 (r228449) @@ -1048,4 +1048,4
svn commit: r228450 - head/sys/mips/atheros
Author: adrian Date: Tue Dec 13 05:13:51 2011 New Revision: 228450 URL: http://svn.freebsd.org/changeset/base/228450 Log: Style(9) changes. Modified: head/sys/mips/atheros/ar71xx_chip.c head/sys/mips/atheros/ar724x_chip.c head/sys/mips/atheros/ar91xx_chip.c Modified: head/sys/mips/atheros/ar71xx_chip.c == --- head/sys/mips/atheros/ar71xx_chip.c Tue Dec 13 00:38:50 2011 (r228449) +++ head/sys/mips/atheros/ar71xx_chip.c Tue Dec 13 05:13:51 2011 (r228450) @@ -37,12 +37,12 @@ __FBSDID($FreeBSD$); #include sys/cons.h #include sys/kdb.h #include sys/reboot.h - + #include vm/vm.h #include vm/vm_page.h - + #include net/ethernet.h - + #include machine/clock.h #include machine/cpu.h #include machine/cpuregs.h @@ -50,11 +50,9 @@ __FBSDID($FreeBSD$); #include machine/md_var.h #include machine/trap.h #include machine/vmparam.h - -#include mips/atheros/ar71xxreg.h +#include mips/atheros/ar71xxreg.h #include mips/atheros/ar71xx_chip.h - #include mips/atheros/ar71xx_cpudef.h #include mips/sentry5/s5reg.h @@ -135,7 +133,7 @@ ar71xx_chip_device_stopped(uint32_t mask uint32_t reg; reg = ATH_READ_REG(AR71XX_RST_RESET); -return ((reg mask) == mask); + return ((reg mask) == mask); } /* Speed is either 10, 100 or 1000 */ @@ -144,20 +142,20 @@ ar71xx_chip_set_pll_ge(int unit, int spe { uint32_t pll; - switch(speed) { - case 10: - pll = PLL_ETH_INT_CLK_10; - break; - case 100: - pll = PLL_ETH_INT_CLK_100; - break; - case 1000: - pll = PLL_ETH_INT_CLK_1000; - break; - default: - printf(%s%d: invalid speed %d\n, - __func__, unit, speed); - return; + switch (speed) { + case 10: + pll = PLL_ETH_INT_CLK_10; + break; + case 100: + pll = PLL_ETH_INT_CLK_100; + break; + case 1000: + pll = PLL_ETH_INT_CLK_1000; + break; + default: + printf(%s%d: invalid speed %d\n, + __func__, unit, speed); + return; } switch (unit) { case 0: @@ -180,6 +178,7 @@ ar71xx_chip_set_pll_ge(int unit, int spe static void ar71xx_chip_ddr_flush_ge(int unit) { + switch (unit) { case 0: ar71xx_ddr_flush(AR71XX_WB_FLUSH_GE0); @@ -209,18 +208,24 @@ ar71xx_chip_get_eth_pll(unsigned int mac static void ar71xx_chip_init_usb_peripheral(void) { - ar71xx_device_stop(RST_RESET_USB_OHCI_DLL | RST_RESET_USB_HOST | RST_RESET_USB_PHY); + + ar71xx_device_stop(RST_RESET_USB_OHCI_DLL | + RST_RESET_USB_HOST | RST_RESET_USB_PHY); DELAY(1000); - ar71xx_device_start(RST_RESET_USB_OHCI_DLL | RST_RESET_USB_HOST | RST_RESET_USB_PHY); + ar71xx_device_start(RST_RESET_USB_OHCI_DLL | + RST_RESET_USB_HOST | RST_RESET_USB_PHY); DELAY(1000); ATH_WRITE_REG(AR71XX_USB_CTRL_CONFIG, - USB_CTRL_CONFIG_OHCI_DES_SWAP | USB_CTRL_CONFIG_OHCI_BUF_SWAP | - USB_CTRL_CONFIG_EHCI_DES_SWAP | USB_CTRL_CONFIG_EHCI_BUF_SWAP); + USB_CTRL_CONFIG_OHCI_DES_SWAP | + USB_CTRL_CONFIG_OHCI_BUF_SWAP | + USB_CTRL_CONFIG_EHCI_DES_SWAP | + USB_CTRL_CONFIG_EHCI_BUF_SWAP); ATH_WRITE_REG(AR71XX_USB_CTRL_FLADJ, - (32 USB_CTRL_FLADJ_HOST_SHIFT) | (3 USB_CTRL_FLADJ_A5_SHIFT)); + (32 USB_CTRL_FLADJ_HOST_SHIFT) | + (3 USB_CTRL_FLADJ_A5_SHIFT)); DELAY(1000); } Modified: head/sys/mips/atheros/ar724x_chip.c == --- head/sys/mips/atheros/ar724x_chip.c Tue Dec 13 00:38:50 2011 (r228449) +++ head/sys/mips/atheros/ar724x_chip.c Tue Dec 13 05:13:51 2011 (r228450) @@ -37,12 +37,12 @@ __FBSDID($FreeBSD$); #include sys/cons.h #include sys/kdb.h #include sys/reboot.h - + #include vm/vm.h #include vm/vm_page.h - + #include net/ethernet.h - + #include machine/clock.h #include machine/cpu.h #include machine/cpuregs.h @@ -50,7 +50,7 @@ __FBSDID($FreeBSD$); #include machine/md_var.h #include machine/trap.h #include machine/vmparam.h - + #include mips/atheros/ar71xxreg.h #include mips/atheros/ar724xreg.h @@ -71,20 +71,20 @@ ar724x_chip_detect_sys_frequency(void) uint32_t pll; uint32_t freq; uint32_t div; - + pll = ATH_READ_REG(AR724X_PLL_REG_CPU_CONFIG); - + div = ((pll AR724X_PLL_DIV_SHIFT) AR724X_PLL_DIV_MASK); freq = div * AR724X_BASE_FREQ; div = ((pll AR724X_PLL_REF_DIV_SHIFT) AR724X_PLL_REF_DIV_MASK); freq *= div; -
svn commit: r228454 - head/sys/netinet
Author: glebius Date: Tue Dec 13 06:56:43 2011 New Revision: 228454 URL: http://svn.freebsd.org/changeset/base/228454 Log: Belatedly catch up with r151555. in_scrubprefix() also needs this fix. We should compare not only addresses, but their masks, too, when searching for matching prefix. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Tue Dec 13 06:53:03 2011(r228453) +++ head/sys/netinet/in.c Tue Dec 13 06:56:43 2011(r228454) @@ -1072,7 +1072,7 @@ static int in_scrubprefix(struct in_ifaddr *target, u_int flags) { struct in_ifaddr *ia; - struct in_addr prefix, mask, p; + struct in_addr prefix, mask, p, m; int error = 0; struct sockaddr_in prefix0, mask0; @@ -1118,9 +1118,10 @@ in_scrubprefix(struct in_ifaddr *target, arp_ifscrub(target-ia_ifp, IA_SIN(target)-sin_addr.s_addr); } - if (rtinitflags(target)) + if (rtinitflags(target)) { prefix = target-ia_dstaddr.sin_addr; - else { + mask.s_addr = 0; + } else { prefix = target-ia_addr.sin_addr; mask = target-ia_sockmask.sin_addr; prefix.s_addr = mask.s_addr; @@ -1133,15 +1134,22 @@ in_scrubprefix(struct in_ifaddr *target, IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, V_in_ifaddrhead, ia_link) { - if (rtinitflags(ia)) + if (rtinitflags(ia)) { p = ia-ia_dstaddr.sin_addr; - else { + + if (prefix.s_addr != p.s_addr) + continue; + } else { p = ia-ia_addr.sin_addr; - p.s_addr = ia-ia_sockmask.sin_addr.s_addr; + m = ia-ia_sockmask.sin_addr; + p.s_addr = m.s_addr; + + if (prefix.s_addr != p.s_addr || + mask.s_addr != m.s_addr) + continue; } - if ((prefix.s_addr != p.s_addr) || - !(ia-ia_ifp-if_flags IFF_UP)) + if ((ia-ia_ifp-if_flags IFF_UP) == 0) continue; /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r228455 - head/sys/nfs
Author: glebius Date: Tue Dec 13 07:02:48 2011 New Revision: 228455 URL: http://svn.freebsd.org/changeset/base/228455 Log: Some cleanup of BOOTP code. Initially I wanted to just change the ifioctl() usage, but end up with more changes. - Use SIOCAIFADDR instead of old rusty SIOCSIFADDR, SIOCSIFBRDADDR and SIOCSIFNETMASK. - Use queue(9) instead of hand made stailq. - Use one socket for all ifioctl() and send/receive operations. - Use __func__ instead of cut-n-paste in logging and panics. - Axe some dead or strange code. Tested by:gonzo, Stefan Bethke stb lassitu.de Modified: head/sys/nfs/bootp_subr.c Modified: head/sys/nfs/bootp_subr.c == --- head/sys/nfs/bootp_subr.c Tue Dec 13 06:56:43 2011(r228454) +++ head/sys/nfs/bootp_subr.c Tue Dec 13 07:02:48 2011(r228455) @@ -64,6 +64,7 @@ __FBSDID($FreeBSD$); #include net/route.h #include netinet/in.h +#include netinet/in_var.h #include net/if_types.h #include net/if_dl.h #include net/vnet.h @@ -109,19 +110,22 @@ struct bootp_packet { }; struct bootpc_ifcontext { - struct bootpc_ifcontext *next; + STAILQ_ENTRY(bootpc_ifcontext) next; struct bootp_packet call; struct bootp_packet reply; int replylen; int overload; - struct socket *so; - struct ifreq ireq; + union { + struct ifreq _ifreq; + struct in_aliasreq _in_alias_req; + } _req; +#defineireq_req._ifreq +#defineiareq _req._in_alias_req struct ifnet *ifp; struct sockaddr_dl *sdl; struct sockaddr_in myaddr; struct sockaddr_in netmask; struct sockaddr_in gw; - struct sockaddr_in broadcast; /* Different for each interface */ int gotgw; int gotnetmask; int gotrootpath; @@ -153,8 +157,7 @@ struct bootpc_tagcontext { }; struct bootpc_globalcontext { - struct bootpc_ifcontext *interfaces; - struct bootpc_ifcontext *lastinterface; + STAILQ_HEAD(, bootpc_ifcontext) interfaces; u_int32_t xid; int gotrootpath; int gotgw; @@ -215,6 +218,7 @@ struct bootpc_globalcontext { #endif static char bootp_cookie[128]; +static struct socket *bootp_so; SYSCTL_STRING(_kern, OID_AUTO, bootp_cookie, CTLFLAG_RD, bootp_cookie, 0, Cookie (T134) supplied by bootp server); @@ -233,7 +237,7 @@ static void print_sin_addr(struct sockad static voidclear_sinaddr(struct sockaddr_in *sin); static voidallocifctx(struct bootpc_globalcontext *gctx); static voidbootpc_compose_query(struct bootpc_ifcontext *ifctx, - struct bootpc_globalcontext *gctx, struct thread *td); + struct thread *td); static unsigned char *bootpc_tag(struct bootpc_tagcontext *tctx, struct bootp_packet *bp, int len, int tag); static void bootpc_tag_helper(struct bootpc_tagcontext *tctx, @@ -251,8 +255,8 @@ void bootpboot_p_iflist(void); static int bootpc_call(struct bootpc_globalcontext *gctx, struct thread *td); -static int bootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, - struct bootpc_globalcontext *gctx, struct thread *td); +static voidbootpc_fakeup_interface(struct bootpc_ifcontext *ifctx, + struct thread *td); static int bootpc_adjust_interface(struct bootpc_ifcontext *ifctx, struct bootpc_globalcontext *gctx, struct thread *td); @@ -270,14 +274,9 @@ static __inline int bootpc_ifctx_isfaile /* * In order to have multiple active interfaces with address 0.0.0.0 - * and be able to send data to a selected interface, we perform - * some tricks: - * - * - The 'broadcast' address is different for each interface. - * - * - We temporarily add routing pointing 255.255.255.255 to the - *selected interface broadcast address, thus the packet sent - *goes to that interface. + * and be able to send data to a selected interface, we first set + * mask to /8 on all interfaces, and temporarily set it to /0 when + * doing sosend(). */ #ifdef BOOTP_DEBUG @@ -419,11 +418,8 @@ static void allocifctx(struct bootpc_globalcontext *gctx) { struct bootpc_ifcontext *ifctx; - ifctx = (struct bootpc_ifcontext *) malloc(sizeof(*ifctx), - M_TEMP, M_WAITOK | M_ZERO); - if (ifctx == NULL) - panic(Failed to allocate bootp interface context structure); + ifctx = malloc(sizeof(*ifctx), M_TEMP, M_WAITOK | M_ZERO); ifctx-xid = gctx-xid; #ifdef BOOTP_NO_DHCP ifctx-state = IF_BOOTP_UNRESOLVED; @@ -431,11 +427,7 @@ allocifctx(struct bootpc_globalcontext * ifctx-state = IF_DHCP_UNRESOLVED; #endif gctx-xid += 0x100; - if (gctx-interfaces != NULL) - gctx-lastinterface-next = ifctx; - else -