svn commit: r218965 - in head: sbin/growfs share/doc/papers/devfs share/doc/psd/23.rpc sys/fs/nullfs sys/libkern sys/net80211 sys/x86/isa usr.bin/tip/tip
Author: brucec Date: Wed Feb 23 09:22:33 2011 New Revision: 218965 URL: http://svn.freebsd.org/changeset/base/218965 Log: Fix typos - remove duplicate is. PR: docs/154934 Submitted by: Eitan Adler lists at eitanadler.com MFC after:3 days Modified: head/sbin/growfs/growfs.c head/share/doc/papers/devfs/paper.me head/share/doc/psd/23.rpc/rpc.prog.ms head/sys/fs/nullfs/null_vnops.c head/sys/libkern/jenkins.h head/sys/net80211/ieee80211_ageq.c head/sys/x86/isa/clock.c head/usr.bin/tip/tip/tip.h Modified: head/sbin/growfs/growfs.c == --- head/sbin/growfs/growfs.c Wed Feb 23 02:40:31 2011(r218964) +++ head/sbin/growfs/growfs.c Wed Feb 23 09:22:33 2011(r218965) @@ -646,7 +646,7 @@ cond_bl_upd(ufs2_daddr_t *block, struct /* * Copy the block back immediately. * -* XXX If src is is from an indirect block we have +* XXX If src is from an indirect block we have * to implement copy on write here in case of * active snapshots. */ Modified: head/share/doc/papers/devfs/paper.me == --- head/share/doc/papers/devfs/paper.meWed Feb 23 02:40:31 2011 (r218964) +++ head/share/doc/papers/devfs/paper.meWed Feb 23 09:22:33 2011 (r218965) @@ -779,7 +779,7 @@ The entry points to the device driver ar structure, removing the need for the devsw[] array and allowing device drivers to use separate entrypoints for various minor numbers. .lp -This is is very convenient for devices which have a ``control'' +This is very convenient for devices which have a ``control'' device for management and tuning. The control device, almost always have entirely separate open/close/ioctl implementations [MD.C]. .lp Modified: head/share/doc/psd/23.rpc/rpc.prog.ms == --- head/share/doc/psd/23.rpc/rpc.prog.ms Wed Feb 23 02:40:31 2011 (r218964) +++ head/share/doc/psd/23.rpc/rpc.prog.ms Wed Feb 23 09:22:33 2011 (r218965) @@ -71,7 +71,7 @@ manual page. .I The Highest Layer: .IX RPC The Highest Layer The highest layer is totally transparent to the operating system, -machine and network upon which is is run. It's probably best to +machine and network upon which is run. It's probably best to think of this level as a way of .I using RPC, rather than as Modified: head/sys/fs/nullfs/null_vnops.c == --- head/sys/fs/nullfs/null_vnops.c Wed Feb 23 02:40:31 2011 (r218964) +++ head/sys/fs/nullfs/null_vnops.c Wed Feb 23 09:22:33 2011 (r218965) @@ -672,7 +672,7 @@ null_unlock(struct vop_unlock_args *ap) * as soon as possible. * * Note, we can't release any resources nor remove vnode from hash before - * appropriate VXLOCK stuff is is done because other process can find this + * appropriate VXLOCK stuff is done because other process can find this * vnode in hash during inactivation and may be sitting in vget() and waiting * for null_inactive to unlock vnode. Thus we will do all those in VOP_RECLAIM. */ Modified: head/sys/libkern/jenkins.h == --- head/sys/libkern/jenkins.h Wed Feb 23 02:40:31 2011(r218964) +++ head/sys/libkern/jenkins.h Wed Feb 23 09:22:33 2011(r218965) @@ -16,7 +16,7 @@ the public domain. It has no warranty. You probably want to use hashlittle(). hashlittle() and hashbig() - hash byte arrays. hashlittle() is is faster than hashbig() on + hash byte arrays. hashlittle() is faster than hashbig() on little-endian machines. Intel and AMD are little-endian machines. On second thought, you probably want hashlittle2(), which is identical to hashlittle() except it returns two 32-bit hashes for the price of one. Modified: head/sys/net80211/ieee80211_ageq.c == --- head/sys/net80211/ieee80211_ageq.c Wed Feb 23 02:40:31 2011 (r218964) +++ head/sys/net80211/ieee80211_ageq.c Wed Feb 23 09:22:33 2011 (r218965) @@ -154,7 +154,7 @@ ieee80211_ageq_drain_node(struct ieee802 * deltas (in seconds) relative to the head so we can check * and/or adjust only the head of the list. If a frame's age * exceeds the time quanta then remove it. The list of removed - * frames is is returned to the caller joined by m_nextpkt. + * frames is returned to the caller joined by m_nextpkt. */ struct mbuf * ieee80211_ageq_age(struct ieee80211_ageq *aq, int quanta) Modified: head/sys/x86/isa/clock.c
svn commit: r218966 - head/sys/vm
Author: brucec Date: Wed Feb 23 10:28:37 2011 New Revision: 218966 URL: http://svn.freebsd.org/changeset/base/218966 Log: Calculate and return the count in vmspace_swap_count as a vm_offset_t instead of an int to avoid overflow. While here, clean up some style(9) issues. PR: kern/152200 Reviewed by: kib MFC after:2 weeks Modified: head/sys/vm/swap_pager.c head/sys/vm/vm_map.h Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cWed Feb 23 09:22:33 2011(r218965) +++ head/sys/vm/swap_pager.cWed Feb 23 10:28:37 2011(r218966) @@ -2420,23 +2420,24 @@ SYSCTL_NODE(_vm, OID_AUTO, swap_info, CT * if the VM object has any swap use at all the associated map entries * count for at least 1 swap page. */ -int +vm_offset_t vmspace_swap_count(struct vmspace *vmspace) { - vm_map_t map = vmspace-vm_map; + vm_map_t map; vm_map_entry_t cur; - int count = 0; + vm_object_t object; + vm_offset_t count, n; - for (cur = map-header.next; cur != map-header; cur = cur-next) { - vm_object_t object; + map = vmspace-vm_map; + count = 0; + for (cur = map-header.next; cur != map-header; cur = cur-next) { if ((cur-eflags MAP_ENTRY_IS_SUB_MAP) == 0 (object = cur-object.vm_object) != NULL) { VM_OBJECT_LOCK(object); if (object-type == OBJT_SWAP object-un_pager.swp.swp_bcount != 0) { - int n = (cur-end - cur-start) / PAGE_SIZE; - + n = (cur-end - cur-start) / PAGE_SIZE; count += object-un_pager.swp.swp_bcount * SWAP_META_PAGES * n / object-size + 1; } Modified: head/sys/vm/vm_map.h == --- head/sys/vm/vm_map.hWed Feb 23 09:22:33 2011(r218965) +++ head/sys/vm/vm_map.hWed Feb 23 10:28:37 2011(r218966) @@ -380,6 +380,6 @@ int vm_map_unwire(vm_map_t map, vm_offse int flags); int vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags); -int vmspace_swap_count (struct vmspace *vmspace); +vm_offset_t vmspace_swap_count(struct vmspace *vmspace); #endif /* _KERNEL */ #endif /* _VM_MAP_ */ ___ 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: r218967 - head/sys/kern
Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after:1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.cWed Feb 23 10:28:37 2011(r218966) +++ head/sys/kern/kern_thr.cWed Feb 23 12:56:25 2011(r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } ___ 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: r218967 - head/sys/kern
On Wed Feb 23 11, John Baldwin wrote: Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. thanks a lot. :) Submitted by: arundel MFC after: 1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.c Wed Feb 23 10:28:37 2011(r218966) +++ head/sys/kern/kern_thr.c Wed Feb 23 12:56:25 2011(r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } -- a13x ___ 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: r218968 - head/sys/dev/pci
Author: jhb Date: Wed Feb 23 12:58:50 2011 New Revision: 218968 URL: http://svn.freebsd.org/changeset/base/218968 Log: Properly handle BARs bigger than 4G. The '1' was treated as an int causing the size calculation to be truncated to the size of an int (32-bits on all current architectures). Submitted by: Anish akgupt3 of gmail MFC after:1 week Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c == --- head/sys/dev/pci/pci.c Wed Feb 23 12:56:25 2011(r218967) +++ head/sys/dev/pci/pci.c Wed Feb 23 12:58:50 2011(r218968) @@ -2549,13 +2549,13 @@ pci_add_map(device_t bus, device_t dev, return (barlen); } - count = 1 mapsize; + count = (pci_addr_t)1 mapsize; if (basezero || base == pci_mapbase(testval)) { start = 0; /* Let the parent decide. */ end = ~0ULL; } else { start = base; - end = base + (1 mapsize) - 1; + end = base + count - 1; } resource_list_add(rl, type, reg, start, end, count); @@ -3764,7 +3764,7 @@ pci_reserve_map(device_t dev, device_t c * situation where we might allocate the excess to * another driver, which won't work. */ - count = 1UL mapsize; + count = (pci_addr_t)1 mapsize; if (RF_ALIGNMENT(flags) mapsize) flags = (flags ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize); if (PCI_BAR_MEM(testval) (testval PCIM_BAR_MEM_PREFETCH)) ___ 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: r218967 - head/sys/kern
On Wed, Feb 23, 2011 at 12:56:25PM +, John Baldwin wrote: Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after: 1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.c Wed Feb 23 10:28:37 2011(r218966) +++ head/sys/kern/kern_thr.c Wed Feb 23 12:56:25 2011(r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } I do not think there was off by one error. The create_thread() function is called to create new thread, and before the process thread counter is incremented in thread_link(). The old test tried to not allow more then max_threads_per_proc threads in a process, now it allows to create max_threads_per_proc. My guess is that the reference to mentioned pthread_vfork_test failed because reporter set kern.threads.max_threads_per_proc to 100. The test actually tries to create 101 threads, 1 main + 100 new. pgpMfsCXy4MVO.pgp Description: PGP signature
svn commit: r218969 - in head/sys: kern sys
Author: jhb Date: Wed Feb 23 13:19:14 2011 New Revision: 218969 URL: http://svn.freebsd.org/changeset/base/218969 Log: Expose the umtx_key structure and API to the rest of the kernel. MFC after:3 days Modified: head/sys/kern/kern_umtx.c head/sys/sys/umtx.h Modified: head/sys/kern/kern_umtx.c == --- head/sys/kern/kern_umtx.c Wed Feb 23 12:58:50 2011(r218968) +++ head/sys/kern/kern_umtx.c Wed Feb 23 13:19:14 2011(r218969) @@ -59,41 +59,9 @@ __FBSDID($FreeBSD$); #include compat/freebsd32/freebsd32_proto.h #endif -enum { - TYPE_SIMPLE_WAIT, - TYPE_CV, - TYPE_SEM, - TYPE_SIMPLE_LOCK, - TYPE_NORMAL_UMUTEX, - TYPE_PI_UMUTEX, - TYPE_PP_UMUTEX, - TYPE_RWLOCK -}; - #define _UMUTEX_TRY1 #define _UMUTEX_WAIT 2 -/* Key to represent a unique userland synchronous object */ -struct umtx_key { - int hash; - int type; - int shared; - union { - struct { - vm_object_t object; - uintptr_t offset; - } shared; - struct { - struct vmspace *vs; - uintptr_t addr; - } private; - struct { - void*a; - uintptr_t b; - } both; - } info; -}; - /* Priority inheritance mutex info. */ struct umtx_pi { /* Owner thread */ @@ -208,10 +176,6 @@ struct umtxq_chain { #defineUMTX_CHAINS 512 #defineUMTX_SHIFTS (__WORD_BIT - 9) -#define THREAD_SHARE 0 -#define PROCESS_SHARE 1 -#define AUTO_SHARE 2 - #defineGET_SHARE(flags)\ (((flags) USYNC_PROCESS_SHARED) == 0 ? THREAD_SHARE : PROCESS_SHARE) @@ -237,10 +201,6 @@ static void umtxq_insert_queue(struct um static void umtxq_remove_queue(struct umtx_q *uq, int q); static int umtxq_sleep(struct umtx_q *uq, const char *wmesg, int timo); static int umtxq_count(struct umtx_key *key); -static int umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2); -static int umtx_key_get(void *addr, int type, int share, - struct umtx_key *key); -static void umtx_key_release(struct umtx_key *key); static struct umtx_pi *umtx_pi_alloc(int); static void umtx_pi_free(struct umtx_pi *pi); static int do_unlock_pp(struct thread *td, struct umutex *m, uint32_t flags); @@ -307,14 +267,6 @@ umtxq_hash(struct umtx_key *key) key-hash = ((n * GOLDEN_RATIO_PRIME) UMTX_SHIFTS) % UMTX_CHAINS; } -static inline int -umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2) -{ - return (k1-type == k2-type - k1-info.both.a == k2-info.both.a - k1-info.both.b == k2-info.both.b); -} - static inline struct umtxq_chain * umtxq_getchain(struct umtx_key *key) { @@ -567,7 +519,7 @@ umtxq_sleep(struct umtx_q *uq, const cha /* * Convert userspace address into unique logical address. */ -static int +int umtx_key_get(void *addr, int type, int share, struct umtx_key *key) { struct thread *td = curthread; @@ -613,7 +565,7 @@ umtx_key_get(void *addr, int type, int s /* * Release key. */ -static inline void +void umtx_key_release(struct umtx_key *key) { if (key-shared) Modified: head/sys/sys/umtx.h == --- head/sys/sys/umtx.h Wed Feb 23 12:58:50 2011(r218968) +++ head/sys/sys/umtx.h Wed Feb 23 13:19:14 2011(r218969) @@ -171,8 +171,59 @@ umtx_wake(u_long *p, int nr_wakeup) #else +/* + * The umtx_key structure is used by both the Linux futex code and the + * umtx implementation to map userland addresses to unique keys. + */ + +enum { + TYPE_SIMPLE_WAIT, + TYPE_CV, + TYPE_SEM, + TYPE_SIMPLE_LOCK, + TYPE_NORMAL_UMUTEX, + TYPE_PI_UMUTEX, + TYPE_PP_UMUTEX, + TYPE_RWLOCK, +}; + +/* Key to represent a unique userland synchronous object */ +struct umtx_key { + int hash; + int type; + int shared; + union { + struct { + struct vm_object *object; + uintptr_t offset; + } shared; + struct { + struct vmspace *vs; + uintptr_t addr; + } private; + struct { + void*a; + uintptr_t b; + } both; + } info; +}; + +#define THREAD_SHARE 0 +#define PROCESS_SHARE 1 +#define AUTO_SHARE 2 + struct thread; +static inline int +umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2) +{ + return (k1-type ==
svn commit: r218970 - in head/sys: compat/linux sys
Author: jhb Date: Wed Feb 23 13:23:28 2011 New Revision: 218970 URL: http://svn.freebsd.org/changeset/base/218970 Log: Use umtx_key objects to uniquely identify futexes. Private futexes in different processes that happen to use the same user address in the separate processes will now be treated as distinct futexes rather than the same futex. We can now honor shared futexes properly by mapping them to a PROCESS_SHARED umtx_key. Private futexes use THREAD_SHARED umtx_key objects. In conjunction with: dchagin Reviewed by: kib MFC after:1 week Modified: head/sys/compat/linux/linux_futex.c head/sys/sys/umtx.h Modified: head/sys/compat/linux/linux_futex.c == --- head/sys/compat/linux/linux_futex.c Wed Feb 23 13:19:14 2011 (r218969) +++ head/sys/compat/linux/linux_futex.c Wed Feb 23 13:23:28 2011 (r218970) @@ -52,6 +52,7 @@ __KERNEL_RCSID(1, $NetBSD: linux_futex. #include sys/queue.h #include sys/sched.h #include sys/sx.h +#include sys/umtx.h #ifdef COMPAT_LINUX32 #include machine/../linux32/linux.h @@ -77,7 +78,8 @@ struct waiting_proc { struct futex { struct sx f_lck; - uint32_t*f_uaddr; + uint32_t*f_uaddr; /* user-supplied value, for debug */ + struct umtx_key f_key; uint32_tf_refcount; uint32_tf_bitset; LIST_ENTRY(futex) f_list; @@ -100,6 +102,7 @@ struct mtx futex_mtx; /* protects the #define FUTEX_CREATE_WP0x1 /* create waiting_proc */ #define FUTEX_DONTCREATE 0x2 /* don't create futex if not exists */ #define FUTEX_DONTEXISTS 0x4 /* return EINVAL if futex exists */ +#defineFUTEX_SHARED0x8 /* shared futex */ /* wp_flags */ #define FUTEX_WP_REQUEUED 0x1 /* wp requeued - wp moved from wp_list @@ -136,6 +139,7 @@ futex_put(struct futex *f, struct waitin LINUX_CTR2(sys_futex, futex_put destroy uaddr %p ref %d, f-f_uaddr, f-f_refcount); + umtx_key_release(f-f_key); FUTEX_DESTROY(f); free(f, M_FUTEX); return; @@ -151,13 +155,19 @@ static int futex_get0(uint32_t *uaddr, struct futex **newf, uint32_t flags) { struct futex *f, *tmpf; + struct umtx_key key; + int error; *newf = tmpf = NULL; + error = umtx_key_get(uaddr, TYPE_FUTEX, (flags FUTEX_SHARED) ? + PROCESS_SHARE : THREAD_SHARE, key); + if (error) + return (error); retry: FUTEXES_LOCK; LIST_FOREACH(f, futex_list, f_list) { - if (f-f_uaddr == uaddr) { + if (umtx_key_match(f-f_key, key)) { if (tmpf != NULL) { FUTEX_UNLOCK(tmpf); FUTEX_DESTROY(tmpf); @@ -165,6 +175,7 @@ retry: } if (flags FUTEX_DONTEXISTS) { FUTEXES_UNLOCK; + umtx_key_release(key); return (EINVAL); } @@ -174,6 +185,7 @@ retry: */ ++f-f_refcount; FUTEXES_UNLOCK; + umtx_key_release(key); FUTEX_LOCK(f); *newf = f; @@ -185,6 +197,7 @@ retry: if (flags FUTEX_DONTCREATE) { FUTEXES_UNLOCK; + umtx_key_release(key); LINUX_CTR1(sys_futex, futex_get uaddr %p null, uaddr); return (0); } @@ -193,6 +206,7 @@ retry: FUTEXES_UNLOCK; tmpf = malloc(sizeof(*tmpf), M_FUTEX, M_WAITOK | M_ZERO); tmpf-f_uaddr = uaddr; + tmpf-f_key = key; tmpf-f_refcount = 1; tmpf-f_bitset = FUTEX_BITSET_MATCH_ANY; FUTEX_INIT(tmpf); @@ -438,15 +452,13 @@ linux_sys_futex(struct thread *td, struc struct waiting_proc *wp; struct futex *f, *f2; int error; + uint32_t flags; - /* -* Our implementation provides only privates futexes. Most of the apps -* should use private futexes but don't claim so. Therefore we treat -* all futexes as private by clearing the FUTEX_PRIVATE_FLAG. It works -* in most cases (ie. when futexes are not shared on file descriptor -* or between different processes.). -*/ - args-op = args-op ~LINUX_FUTEX_PRIVATE_FLAG; + if (args-op LINUX_FUTEX_PRIVATE_FLAG) { + flags = 0; + args-op = ~LINUX_FUTEX_PRIVATE_FLAG; + } else + flags = FUTEX_SHARED; /* * Currently support for switching between CLOCK_MONOTONIC and @@ -478,7 +490,8 @@
svn commit: r218971 - head/sys/kern
Author: jhb Date: Wed Feb 23 13:25:42 2011 New Revision: 218971 URL: http://svn.freebsd.org/changeset/base/218971 Log: Revert previous change, the existing check was correct. Pointy hat to:jhb Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.cWed Feb 23 13:23:28 2011(r218970) +++ head/sys/kern/kern_thr.cWed Feb 23 13:25:42 2011(r218971) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads max_threads_per_proc) { + if (p-p_numthreads = max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } ___ 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: r218967 - head/sys/kern
On Wednesday, February 23, 2011 8:12:28 am Kostik Belousov wrote: On Wed, Feb 23, 2011 at 12:56:25PM +, John Baldwin wrote: Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after:1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.cWed Feb 23 10:28:37 2011 (r218966) +++ head/sys/kern/kern_thr.cWed Feb 23 12:56:25 2011 (r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } I do not think there was off by one error. The create_thread() function is called to create new thread, and before the process thread counter is incremented in thread_link(). The old test tried to not allow more then max_threads_per_proc threads in a process, now it allows to create max_threads_per_proc. My guess is that the reference to mentioned pthread_vfork_test failed because reporter set kern.threads.max_threads_per_proc to 100. The test actually tries to create 101 threads, 1 main + 100 new. Ugh, pointy hat to me for jumping on this too quickly. I will revert. -- John Baldwin ___ 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: r218972 - head/sys/kern
Author: kib Date: Wed Feb 23 13:50:24 2011 New Revision: 218972 URL: http://svn.freebsd.org/changeset/base/218972 Log: Move the max_threads_per_proc and max_threads_hits variables to the file where they are used. Declare the kern.threads sysctl node at the same location. Since no external use for the variables exists, make them static. Discussed with: dchagin MFC after:1 week Modified: head/sys/kern/kern_thr.c head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.cWed Feb 23 13:25:42 2011(r218971) +++ head/sys/kern/kern_thr.cWed Feb 23 13:50:24 2011(r218972) @@ -46,6 +46,7 @@ __FBSDID($FreeBSD$); #include sys/systm.h #include sys/sysproto.h #include sys/signalvar.h +#include sys/sysctl.h #include sys/ucontext.h #include sys/thr.h #include sys/rtprio.h @@ -56,6 +57,16 @@ __FBSDID($FreeBSD$); #include security/audit/audit.h +SYSCTL_NODE(_kern, OID_AUTO, threads, CTLFLAG_RW, 0, thread allocation); + +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); + +static int max_threads_hits; +SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_hits, CTLFLAG_RD, + max_threads_hits, 0, ); + #ifdef COMPAT_FREEBSD32 static inline int @@ -74,9 +85,6 @@ suword_lwpid(void *addr, lwpid_t lwpid) #define suword_lwpid suword #endif -extern int max_threads_per_proc; -extern int max_threads_hits; - static int create_thread(struct thread *td, mcontext_t *ctx, void (*start_func)(void *), void *arg, char *stack_base, size_t stack_size, Modified: head/sys/kern/kern_thread.c == --- head/sys/kern/kern_thread.c Wed Feb 23 13:25:42 2011(r218971) +++ head/sys/kern/kern_thread.c Wed Feb 23 13:50:24 2011(r218972) @@ -65,16 +65,6 @@ __FBSDID($FreeBSD$); */ static uma_zone_t thread_zone; -SYSCTL_NODE(_kern, OID_AUTO, threads, CTLFLAG_RW, 0, thread allocation); - -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); - -int max_threads_hits; -SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_hits, CTLFLAG_RD, - max_threads_hits, 0, ); - TAILQ_HEAD(, thread) zombie_threads = TAILQ_HEAD_INITIALIZER(zombie_threads); static struct mtx zombie_lock; MTX_SYSINIT(zombie_lock, zombie_lock, zombie lock, MTX_SPIN); ___ 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: r218973 - head/usr.sbin/bsdinstall/partedit
Author: nwhitehorn Date: Wed Feb 23 13:51:41 2011 New Revision: 218973 URL: http://svn.freebsd.org/changeset/base/218973 Log: Add a catch-all for miscellaneous RAID volumes while seeking a better solution here. It would really help if CAM devices were part of newbus. Modified: head/usr.sbin/bsdinstall/partedit/part_wizard.c Modified: head/usr.sbin/bsdinstall/partedit/part_wizard.c == --- head/usr.sbin/bsdinstall/partedit/part_wizard.c Wed Feb 23 13:50:24 2011(r218972) +++ head/usr.sbin/bsdinstall/partedit/part_wizard.c Wed Feb 23 13:51:41 2011(r218973) @@ -127,7 +127,8 @@ boot_disk(struct gmesh *mesh) else if (strncmp(pp-lg_name, cd, 2) == 0) { n--; continue; - } + } else + strcat(diskdesc, Hard Disk); disks[n-1].text = strdup(diskdesc); disks[n-1].help = NULL; disks[n-1].state = 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: r218967 - head/sys/kern
On Wed Feb 23 11, Kostik Belousov wrote: On Wed, Feb 23, 2011 at 12:56:25PM +, John Baldwin wrote: Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after:1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.cWed Feb 23 10:28:37 2011 (r218966) +++ head/sys/kern/kern_thr.cWed Feb 23 12:56:25 2011 (r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } I do not think there was off by one error. The create_thread() function is called to create new thread, and before the process thread counter is incremented in thread_link(). The old test tried to not allow more then max_threads_per_proc threads in a process, now it allows to create max_threads_per_proc. doesn't the semantics of the term maximum imply that it's own value is also valid? if a sign says maximum weight 2000kg, does that mean that a weight of 2000kg is invalid and the highest valid weight is 1999,999..kg? cheers. alex My guess is that the reference to mentioned pthread_vfork_test failed because reporter set kern.threads.max_threads_per_proc to 100. The test actually tries to create 101 threads, 1 main + 100 new. so the main process counts as 1 thread and for each pthread_create invokation the thread number gets bumped up? so with a process doing a single pthread_create() that would imply this process is having a thread count of 2? cheers. alex -- a13x ___ 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: r218967 - head/sys/kern
On Wed, Feb 23, 2011 at 01:57:34PM +, Alexander Best wrote: On Wed Feb 23 11, Kostik Belousov wrote: On Wed, Feb 23, 2011 at 12:56:25PM +, John Baldwin wrote: Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after: 1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.c Wed Feb 23 10:28:37 2011 (r218966) +++ head/sys/kern/kern_thr.c Wed Feb 23 12:56:25 2011 (r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } I do not think there was off by one error. The create_thread() function is called to create new thread, and before the process thread counter is incremented in thread_link(). The old test tried to not allow more then max_threads_per_proc threads in a process, now it allows to create max_threads_per_proc. doesn't the semantics of the term maximum imply that it's own value is also valid? if a sign says maximum weight 2000kg, does that mean that a weight of 2000kg is invalid and the highest valid weight is 1999,999..kg? cheers. alex My guess is that the reference to mentioned pthread_vfork_test failed because reporter set kern.threads.max_threads_per_proc to 100. The test actually tries to create 101 threads, 1 main + 100 new. so the main process counts as 1 thread and for each pthread_create invokation the thread number gets bumped up? so with a process doing a single pthread_create() that would imply this process is having a thread count of 2? Exactly. The main thread is the same as all others (almost). pgpd0g7JS90Om.pgp Description: PGP signature
Re: svn commit: r218967 - head/sys/kern
On Wednesday 23 February 2011 14:57:34 Alexander Best wrote: On Wed Feb 23 11, Kostik Belousov wrote: On Wed, Feb 23, 2011 at 12:56:25PM +, John Baldwin wrote: Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after: 1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c === === --- head/sys/kern/kern_thr.c Wed Feb 23 10:28:37 2011 (r218966) +++ head/sys/kern/kern_thr.c Wed Feb 23 12:56:25 2011 (r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } I do not think there was off by one error. The create_thread() function is called to create new thread, and before the process thread counter is incremented in thread_link(). The old test tried to not allow more then max_threads_per_proc threads in a process, now it allows to create max_threads_per_proc. doesn't the semantics of the term maximum imply that it's own value is also valid? if a sign says maximum weight 2000kg, does that mean that a weight of 2000kg is invalid and the highest valid weight is 1999,999..kg? Hi, The sign should have used terms like EQ and GTE and LTE and a granularity. Obviously not all people writing important numerical information are programmers ;-) --HPS ___ 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: r218967 - head/sys/kern
On Wed Feb 23 11, Kostik Belousov wrote: On Wed, Feb 23, 2011 at 01:57:34PM +, Alexander Best wrote: On Wed Feb 23 11, Kostik Belousov wrote: On Wed, Feb 23, 2011 at 12:56:25PM +, John Baldwin wrote: Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after:1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.cWed Feb 23 10:28:37 2011 (r218966) +++ head/sys/kern/kern_thr.cWed Feb 23 12:56:25 2011 (r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } I do not think there was off by one error. The create_thread() function is called to create new thread, and before the process thread counter is incremented in thread_link(). The old test tried to not allow more then max_threads_per_proc threads in a process, now it allows to create max_threads_per_proc. doesn't the semantics of the term maximum imply that it's own value is also valid? if a sign says maximum weight 2000kg, does that mean that a weight of 2000kg is invalid and the highest valid weight is 1999,999..kg? cheers. alex My guess is that the reference to mentioned pthread_vfork_test failed because reporter set kern.threads.max_threads_per_proc to 100. The test actually tries to create 101 threads, 1 main + 100 new. so the main process counts as 1 thread and for each pthread_create invokation the thread number gets bumped up? so with a process doing a single pthread_create() that would imply this process is having a thread count of 2? Exactly. The main thread is the same as all others (almost). thanks for the hint. i wasn't aware of that. however now proctsta -akk also displaying a thread id for a process with no additional threads makes a lot more sense. ;) so in theory: kern.threads.max_threads_per_proc=0 and kern.threads.max_threads_per_proc=1 both forbid a process to trigger any new threads. cheers. alex -- a13x ___ 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: r218967 - head/sys/kern
On Wed Feb 23 11, Hans Petter Selasky wrote: On Wednesday 23 February 2011 14:57:34 Alexander Best wrote: On Wed Feb 23 11, Kostik Belousov wrote: On Wed, Feb 23, 2011 at 12:56:25PM +, John Baldwin wrote: Author: jhb Date: Wed Feb 23 12:56:25 2011 New Revision: 218967 URL: http://svn.freebsd.org/changeset/base/218967 Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after:1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c === === --- head/sys/kern/kern_thr.cWed Feb 23 10:28:37 2011 (r218966) +++ head/sys/kern/kern_thr.cWed Feb 23 12:56:25 2011 (r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } I do not think there was off by one error. The create_thread() function is called to create new thread, and before the process thread counter is incremented in thread_link(). The old test tried to not allow more then max_threads_per_proc threads in a process, now it allows to create max_threads_per_proc. doesn't the semantics of the term maximum imply that it's own value is also valid? if a sign says maximum weight 2000kg, does that mean that a weight of 2000kg is invalid and the highest valid weight is 1999,999..kg? Hi, The sign should have used terms like EQ and GTE and LTE and a granularity. Obviously not all people writing important numerical information are programmers ;-) *hehehe* well they don't (at least in this country): http://upload.wikimedia.org/wikipedia/commons/9/94/Zeichen_262.svg this sign includes the maximum of 5500kg and thus implies GT. cheers. alex --HPS -- a13x ___ 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: r218974 - in head/sys/boot: common efi/libefi
Author: brucec Date: Wed Feb 23 17:17:05 2011 New Revision: 218974 URL: http://svn.freebsd.org/changeset/base/218974 Log: Handle memory allocation failures in include(). PR: i386/85652 Submitted by: Ben Thomas bthomas at virtualiron.com MFC after:3 days Modified: head/sys/boot/common/interp.c head/sys/boot/efi/libefi/efipart.c Modified: head/sys/boot/common/interp.c == --- head/sys/boot/common/interp.c Wed Feb 23 13:51:41 2011 (r218973) +++ head/sys/boot/common/interp.c Wed Feb 23 17:17:05 2011 (r218974) @@ -246,6 +246,17 @@ include(const char *filename) if (*cp == '\0') continue; /* ignore empty line, save memory */ sp = malloc(sizeof(struct includeline) + strlen(cp) + 1); + /* On malloc failure (it happens!), free as much as possible and exit */ + if (sp == NULL) { + while (script != NULL) { + se = script; + script = script-next; + free(se); + } + sprintf(command_errbuf, file '%s' line %d: memory allocation + failure - aborting\n, filename, line); + return (CMD_ERROR); + } strcpy(sp-text, cp); #ifndef BOOT_FORTH sp-flags = flags; Modified: head/sys/boot/efi/libefi/efipart.c == --- head/sys/boot/efi/libefi/efipart.c Wed Feb 23 13:51:41 2011 (r218973) +++ head/sys/boot/efi/libefi/efipart.c Wed Feb 23 17:17:05 2011 (r218974) @@ -204,7 +204,7 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, i } if (EFI_ERROR(status)) - printf(%s: rw=%d, status=%lu\n, __func__, rw, status); + printf(%s: rw=%d, status=%u\n, __func__, rw, status); return (efi_status_to_errno(status)); } ___ 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: r218974 - in head/sys/boot: common efi/libefi
On Wed, 2011-02-23 at 17:17 +, Bruce Cran wrote: Author: brucec Date: Wed Feb 23 17:17:05 2011 New Revision: 218974 URL: http://svn.freebsd.org/changeset/base/218974 Log: Handle memory allocation failures in include(). if (EFI_ERROR(status)) - printf(%s: rw=%d, status=%lu\n, __func__, rw, status); + printf(%s: rw=%d, status=%u\n, __func__, rw, status); return (efi_status_to_errno(status)); } I accidentally included this unrelated change too - 'status' is of type unsigned int, not unsigned long. -- Bruce Cran ___ 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: r218975 - head/usr.sbin/pc-sysinstall/backend-query
Author: jpaetzel Date: Wed Feb 23 17:52:26 2011 New Revision: 218975 URL: http://svn.freebsd.org/changeset/base/218975 Log: Alter comment to reflect change in code. Try atacontrol if camcontrol fails. Approved by: kib (mentor, implicit) Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh == --- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Wed Feb 23 17:17:05 2011(r218974) +++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh Wed Feb 23 17:52:26 2011(r218975) @@ -73,10 +73,15 @@ do esac fi - # Check the dmesg output for some more info about this device - NEWLINE=$(camcontrol identify $DEV | grep device model | tr -s ' ' | sed 's |device model ||g') + # Try and find some identification information with camcontrol or atacontrol + NEWLINE=$(camcontrol identify $DEV | sed -ne 's/^device model *//p') if [ -z $NEWLINE ]; then -NEWLINE= Unknown Device + # Now try atacontrol + NEWLINE=$(atacontrol list | sed -n s|^.*$DEV \(.*\).*|\1|p) + + if [ -z $NEWLINE ]; then + NEWLINE= Unknown Device + fi fi if [ -n ${FLAGS_MD} ] echo ${DEV} | grep -E '^md[0-9]+' /dev/null 2/dev/null ___ 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: r218976 - head/sys/kern
Author: pluknet Date: Wed Feb 23 18:22:40 2011 New Revision: 218976 URL: http://svn.freebsd.org/changeset/base/218976 Log: Clean up the now unused #include statement. Approved by: kib (mentor) MFC after:1 week X-MFC with: r218972 Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c == --- head/sys/kern/kern_thread.c Wed Feb 23 17:52:26 2011(r218975) +++ head/sys/kern/kern_thread.c Wed Feb 23 18:22:40 2011(r218976) @@ -40,7 +40,6 @@ __FBSDID($FreeBSD$); #include sys/proc.h #include sys/resourcevar.h #include sys/smp.h -#include sys/sysctl.h #include sys/sched.h #include sys/sleepqueue.h #include sys/selinfo.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: r218967 - head/sys/kern
On Wed, 23 Feb 2011, Alexander Best wrote: On Wed Feb 23 11, Kostik Belousov wrote: On Wed, Feb 23, 2011 at 12:56:25PM +, John Baldwin wrote: ... Log: Fix off-by-one error in check against max_threads_per_proc. Submitted by: arundel MFC after:1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c == --- head/sys/kern/kern_thr.cWed Feb 23 10:28:37 2011(r218966) +++ head/sys/kern/kern_thr.cWed Feb 23 12:56:25 2011(r218967) @@ -153,7 +153,7 @@ create_thread(struct thread *td, mcontex p = td-td_proc; /* Have race condition but it is cheap. */ - if (p-p_numthreads = max_threads_per_proc) { + if (p-p_numthreads max_threads_per_proc) { ++max_threads_hits; return (EPROCLIM); } I do not think there was off by one error. The create_thread() function is called to create new thread, and before the process thread counter is incremented in thread_link(). The old test tried to not allow more then max_threads_per_proc threads in a process, now it allows to create max_threads_per_proc. Actually, now it allows to create 1 more than max_threads_per_proc threads in a process. doesn't the semantics of the term maximum imply that it's own value is also valid? Yes. Not 1 more. if a sign says maximum weight 2000kg, does that mean that a weight of 2000kg is invalid and the highest valid weight is 1999,999..kg? No. This means that if weights are always in units of kg, and are represented by indexes starting at index 0, then the highest valid index is 1999. But if the index is a count of the number of kg's, then the highest valud index is 2000. p-p_numthreads presumably matches its name, so it is a count of a number of threads and not a thread number. Bruce ___ 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: r218984 - head/lib/librt
Author: dim Date: Wed Feb 23 21:17:38 2011 New Revision: 218984 URL: http://svn.freebsd.org/changeset/base/218984 Log: Fix the 32-bit build stage on amd64 when WITH_CTF is enabled. It seems ctfconvert will corrupt object files that are compiled with -g, if it is not run with -g itself. To fix it, remove -g from CFLAGS in lib/librt/Makefile. If you need to compile this library with debug info, use DEBUG_FLAGS=-g instead, which will work correctly, even when using WITH_CTF. Modified: head/lib/librt/Makefile Modified: head/lib/librt/Makefile == --- head/lib/librt/Makefile Wed Feb 23 20:50:42 2011(r218983) +++ head/lib/librt/Makefile Wed Feb 23 21:17:38 2011(r218984) @@ -6,7 +6,7 @@ CFLAGS+=-I${.CURDIR}/../libc/include -I$ .ifndef NO_THREAD_STACK_UNWIND CFLAGS+=-fexceptions .endif -CFLAGS+=-Winline -Wall -g +CFLAGS+=-Winline -Wall DPADD= ${LIBPTHREAD} LDADD= -lpthread ___ 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: r218984 - head/lib/librt
On Wednesday 23 February 2011 04:17 pm, Dimitry Andric wrote: Author: dim Date: Wed Feb 23 21:17:38 2011 New Revision: 218984 URL: http://svn.freebsd.org/changeset/base/218984 Log: Fix the 32-bit build stage on amd64 when WITH_CTF is enabled. It seems ctfconvert will corrupt object files that are compiled with -g, if it is not run with -g itself. To fix it, remove -g from CFLAGS in lib/librt/Makefile. If you need to compile this library with debug info, use DEBUG_FLAGS=-g instead, which will work correctly, even when using WITH_CTF. Modified: head/lib/librt/Makefile Modified: head/lib/librt/Makefile === === --- head/lib/librt/MakefileWed Feb 23 20:50:42 2011 (r218983) +++ head/lib/librt/Makefile Wed Feb 23 21:17:38 2011 (r218984) @@ -6,7 +6,7 @@ CFLAGS+=-I${.CURDIR}/../libc/include -I$ .ifndef NO_THREAD_STACK_UNWIND CFLAGS+=-fexceptions .endif -CFLAGS+=-Winline -Wall -g +CFLAGS+=-Winline -Wall DPADD= ${LIBPTHREAD} LDADD= -lpthread Thanks! Jung-uk Kim ___ 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: r218966 - head/sys/vm
On Wed, 23 Feb 2011, Bruce Cran wrote: Log: Calculate and return the count in vmspace_swap_count as a vm_offset_t instead of an int to avoid overflow. While here, clean up some style(9) issues. vm_offset_t should not be abused to hold a count. PR:kern/152200 Reviewed by: kib MFC after: 2 weeks Modified: head/sys/vm/swap_pager.c head/sys/vm/vm_map.h Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cWed Feb 23 09:22:33 2011(r218965) +++ head/sys/vm/swap_pager.cWed Feb 23 10:28:37 2011(r218966) @@ -2420,23 +2420,24 @@ SYSCTL_NODE(_vm, OID_AUTO, swap_info, CT * if the VM object has any swap use at all the associated map entries * count for at least 1 swap page. */ -int +vm_offset_t vmspace_swap_count(struct vmspace *vmspace) This is a count in pages according to its comment. Thus vm_offset_t is neither necessary not sufficient for it. I'm not sure if all the pages are mapped into vm at once, in which case vm_offset_t could count them PAGE_SIZE times over and even int can count them PAGE_SIZE/2 times over on i386, or if there can be as many pages as swap can hold, in which case, in theory, vm_offset_t is accidentally large enough on 64 bit arches and still too small on 32-bit arches. But int is large enough in practice on all arches, since 16-bit ints are not supported and 32-bit ints can count 2**31 pages = 8 TB with a minimal PAGE_SIZE of 2**12. I don't know if there is any multiple or sparse mapping involved, but it would take a lot of it to use 8 TB. vm still uses plain u_int for most of its most critical (physical) page counters, starting with cnt.v_page_count for the total number of pages in the system. Thus it doesn't already have a page counter type. { - vm_map_t map = vmspace-vm_map; + vm_map_t map; vm_map_entry_t cur; - int count = 0; + vm_object_t object; + vm_offset_t count, n; - for (cur = map-header.next; cur != map-header; cur = cur-next) { - vm_object_t object; + map = vmspace-vm_map; + count = 0; + for (cur = map-header.next; cur != map-header; cur = cur-next) { if ((cur-eflags MAP_ENTRY_IS_SUB_MAP) == 0 (object = cur-object.vm_object) != NULL) { VM_OBJECT_LOCK(object); if (object-type == OBJT_SWAP object-un_pager.swp.swp_bcount != 0) { - int n = (cur-end - cur-start) / PAGE_SIZE; - + n = (cur-end - cur-start) / PAGE_SIZE; count += object-un_pager.swp.swp_bcount * SWAP_META_PAGES * n / object-size + 1; The bug seems to have been overflow in this calculation. `start' and `end' have type vm_offset_t and large style bugs (missing prefixes in their names) so they are hard to grep for. When n is 32 bits int and PAGE_SIZE is 2**12, the assignment to n overflows at a difference of 8TB, but this probably can't happen (see above). swap_bcnt still has type int; SWAP_META_PAGES is 1, 2, 4, 8 or 16; thus swp_bcount * SWAP_META_PAGES may overflow at 2**31/16 = 128 M. If this doesn't overflow, but has its maximal value of about 128 M, then multiplying it by int n may overflow when n is just 32. Then, if nothing has overflowed, division by object-size reduces to a relatively small count in pages. object-size seems to have type vm_pindex_t which is 64 bits even on i386 (since it is associated with vm_ooffset_t and not vm_offset_t, and vm_ooffset_t must be 64 bits to support file of sizes = 2GB although vm_pindex_t only needs to be more than 32 bits to support files of sizes = 8 TB (with PAGE_SIZE = 2**12). object-size has even larger bugs than `start' and `end', since it is more global. Summary: all of (object-un_pager.swp.swp_bcount * SWAP_META_PAGES * n / object-size) was done in possibly-overflowing arithmetic using the inadequately large type int, except for the final division which is done using excessively large type vm_pindex_t. Changing one of the ints to vm_offset_t reduces the overflow possibilities a little. But the reduction is very little on i386, where the change is just from a 32 bit int to a 32 bit unsigned int. Modified: head/sys/vm/vm_map.h == --- head/sys/vm/vm_map.hWed Feb 23 09:22:33 2011(r218965) +++ head/sys/vm/vm_map.hWed Feb 23 10:28:37 2011(r218966) @@ -380,6 +380,6 @@ int vm_map_unwire(vm_map_t map, vm_offse int flags); int vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags); -int vmspace_swap_count (struct vmspace *vmspace); +vm_offset_t vmspace_swap_count(struct vmspace *vmspace); #endif /* _KERNEL */ Maybe the critical
svn commit: r218985 - head/sys/compat/ndis
Author: brucec Date: Wed Feb 23 21:45:28 2011 New Revision: 218985 URL: http://svn.freebsd.org/changeset/base/218985 Log: Use the cprd_mem field when setting the start and length for a memory resource - the layout of cprd_port is identical but using cprd_mem makes the code easier to understand. PR: kern/118493 Submitted by: Weongyo Jeong weongyo.jeong at gmail.com MFC after:3 days Modified: head/sys/compat/ndis/kern_ndis.c Modified: head/sys/compat/ndis/kern_ndis.c == --- head/sys/compat/ndis/kern_ndis.cWed Feb 23 21:17:38 2011 (r218984) +++ head/sys/compat/ndis/kern_ndis.cWed Feb 23 21:45:28 2011 (r218985) @@ -591,9 +591,9 @@ ndis_convert_res(arg) CM_RESOURCE_MEMORY_READ_WRITE; prd-cprd_sharedisp = CmResourceShareDeviceExclusive; - prd-u.cprd_port.cprd_start.np_quad = + prd-u.cprd_mem.cprd_start.np_quad = brle-start; - prd-u.cprd_port.cprd_len = brle-count; + prd-u.cprd_mem.cprd_len = brle-count; break; case SYS_RES_IRQ: prd-cprd_type = CmResourceTypeInterrupt; ___ 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: r218984 - head/lib/librt
On Wed, 23 Feb 2011, Dimitry Andric wrote: Log: Fix the 32-bit build stage on amd64 when WITH_CTF is enabled. It seems ctfconvert will corrupt object files that are compiled with -g, if it is not run with -g itself. To fix it, remove -g from CFLAGS in lib/librt/Makefile. If you need to compile this library with debug info, use DEBUG_FLAGS=-g instead, which will work correctly, even when using WITH_CTF. Hard-coded -g is a style bug, but I wonder if this works even with -g in DEBUG_FLAGS. This may be related to the bug that -g is broken if the compilation is via an intermediate asm file: cc -g -o foo foo.c != cc -g -S foo.c; cc -g -o foo foo.s The former works, but the latter gives: % Script started on Wed Feb 23 21:47:19 2011 % % pts/0:bde@ref9-i386:~/r gdb foo % GNU gdb 6.1.1 [FreeBSD] % Copyright 2004 Free Software Foundation, Inc. % GDB is free software, covered by the GNU General Public License, and you are % welcome to change it and/or distribute copies of it under certain conditions. % Type show copying to see the conditions. % There is absolutely no warranty for GDB. Type show warranty for details. % This GDB was configured as i386-marcel-freebsd...Dwarf Error: Could not find abbrev number 47 [in module /dumpster/home/bde/r/foo] % % (gdb) q % pts/0:bde@ref9-i386:~/r exit % % Script done on Wed Feb 23 21:47:24 2011 gdb also cannot find `main'. But if everything is compiled without -g, gdb can find `main'. Similarly with multiple files, some compiled via asm and some via (implicit) .o's. I haven't found an incantantion that works. The asm file contains lots of debugging info, but the info is apparently incomplete or invalid. The object file produced from the asm file differs from the one produced directly from the C file. Perhaps you already fixed this by importing newer binutils. Bruce ___ 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: r218966 - head/sys/vm
On Thu, 2011-02-24 at 08:23 +1100, Bruce Evans wrote: The bug seems to have been overflow in this calculation. `start' and `end' have type vm_offset_t and large style bugs (missing prefixes in their names) so they are hard to grep for. When n is 32 bits int and PAGE_SIZE is 2**12, the assignment to n overflows at a difference of 8TB, but this probably can't happen (see above). swap_bcnt still has type int; SWAP_META_PAGES is 1, 2, 4, 8 or 16; thus swp_bcount * SWAP_META_PAGES may overflow at 2**31/16 = 128 M. If this doesn't overflow, but has its maximal value of about 128 M, then multiplying it by int n may overflow when n is just 32. Then, if nothing has overflowed, division by object-size reduces to a relatively small count in pages. object-size seems to have type vm_pindex_t which is 64 bits even on i386 (since it is associated with vm_ooffset_t and not vm_offset_t, and vm_ooffset_t must be 64 bits to support file of sizes = 2GB although vm_pindex_t only needs to be more than 32 bits to support files of sizes = 8 TB (with PAGE_SIZE = 2**12). object-size has even larger bugs than `start' and `end', since it is more global. I've attached a patch which changes 'n' to be of type vm_ooffset_t. I think this should fix the overflow bug? -- Bruce Cran Index: swap_pager.c === --- swap_pager.c (revision 218966) +++ swap_pager.c (working copy) @@ -2426,7 +2426,8 @@ vm_map_t map; vm_map_entry_t cur; vm_object_t object; - vm_offset_t count, n; + vm_ooffset_t n; + vm_offset_t count; map = vmspace-vm_map; count = 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: r218984 - head/lib/librt
PS: On Thu, 24 Feb 2011, Bruce Evans wrote: This may be related to the bug that -g is broken if the compilation is via an intermediate asm file: cc -g -o foo foo.c != cc -g -S foo.c; cc -g -o foo foo.s The former works, but the latter gives: % Script started on Wed Feb 23 21:47:19 2011 % % pts/0:bde@ref9-i386:~/r gdb foo % GNU gdb 6.1.1 [FreeBSD] % Copyright 2004 Free Software Foundation, Inc. % GDB is free software, covered by the GNU General Public License, and you are % welcome to change it and/or distribute copies of it under certain conditions. % Type show copying to see the conditions. % There is absolutely no warranty for GDB. Type show warranty for details. % This GDB was configured as i386-marcel-freebsd...Dwarf Error: Could not find abbrev number 47 [in module /dumpster/home/bde/r/foo] % % (gdb) q % pts/0:bde@ref9-i386:~/r exit % % Script done on Wed Feb 23 21:47:24 2011 I haven't found an incantantion that works. The asm file contains lots of debugging info, but the info is apparently incomplete or invalid. The object file produced from the asm file differs from the one produced directly from the C file. Now found it easly using gcc -v. gcc -c -v foo.c produces ... /usr/bin/as -o foo.o /var/tmp/whatever.s, but gcc -c -v foo.s produces ... /usr/bin/as -gdwarf2 -o foo.o foo.s. gcc's generation of -gdwarf2 is inconsistent with itself. Do we use a nonstandard not-gdwarf2 option for the usual case but forget to change this for asm files? Bruce ___ 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: r218984 - head/lib/librt
On 2011-02-23 23:04, Bruce Evans wrote: Hard-coded -g is a style bug, but I wonder if this works even with -g in DEBUG_FLAGS. Yes, it works, I tested it. The issue is that bsd.lib.mk contains this fragment: .if defined(WITH_CTF) .undef NO_CTF .endif .if defined(DEBUG_FLAGS) CFLAGS+= ${DEBUG_FLAGS} .if !defined(NO_CTF) (${DEBUG_FLAGS:M-g} != ) CTFFLAGS+= -g .endif .endif E.g. if you put '-g' in CFLAGS, this fragment will fail to add the required '-g to CTFFLAGS. On the other hand, if you add '-g' to DEBUG_FLAGS, '-g' will be added to both CFLAGS and CTFFLAGS. This may be related to the bug that -g is broken if the compilation is via an intermediate asm file: cc -g -o foo foo.c != cc -g -S foo.c; cc -g -o foo foo.s The former works, but the latter gives: % Script started on Wed Feb 23 21:47:19 2011 % % pts/0:bde@ref9-i386:~/r gdb foo % GNU gdb 6.1.1 [FreeBSD] % Copyright 2004 Free Software Foundation, Inc. % GDB is free software, covered by the GNU General Public License, and you are % welcome to change it and/or distribute copies of it under certain conditions. % Type show copying to see the conditions. % There is absolutely no warranty for GDB. Type show warranty for details. % This GDB was configured as i386-marcel-freebsd...Dwarf Error: Could not find abbrev number 47 [in module /dumpster/home/bde/r/foo] % % (gdb) q % pts/0:bde@ref9-i386:~/r exit Seems to work fine here (tree as of r218915, so with binutils 2.17.50): $ cc -g -S hello.c $ cc -g hello.s -o hello $ file hello hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.0 (900033), not stripped $ gdb ./hello GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as i386-marcel-freebsd... (gdb) list 1 #include stdio.h 2 3 int main(void) 4 { 5 puts(Hello World!); 6 7 return 0; 8 } (gdb) Perhaps you already fixed this by importing newer binutils. Apparently, yes. Maybe ref9-i386 should be updated again. :) ___ 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: r218984 - head/lib/librt
On 2011-02-23 23:13, Bruce Evans wrote: Now found it easly using gcc -v. gcc -c -v foo.c produces ... /usr/bin/as -o foo.o /var/tmp/whatever.s, but gcc -c -v foo.s produces ... /usr/bin/as -gdwarf2 -o foo.o foo.s. gcc's generation of -gdwarf2 is inconsistent with itself. Do we use a nonstandard not-gdwarf2 option for the usual case but forget to change this for asm files? I don't think so, but there is simply no need to pass '-g' in the gcc invocation that assembles and links the .s file, since the debug info is already embedded in the .s file itself. E.g. the following works just fine: $ cc -g -S hello.c $ cc -o hello hello.s $ file hello hello: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), for FreeBSD 9.0 (900033), not stripped $ gdb ./hello GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as i386-marcel-freebsd... (gdb) list 1 #include stdio.h 2 3 int main(void) 4 { 5 puts(Hello World!); 6 7 return 0; 8 } Apparently, if you use --gdwarf2 with GNU as 2.15, it messes up the already existing debug info. It looks like 2.17.50 has no such problem, though. ___ 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: r218966 - head/sys/vm
On Wed, 23 Feb 2011, Bruce Cran wrote: On Thu, 2011-02-24 at 08:23 +1100, Bruce Evans wrote: The bug seems to have been overflow in this calculation. [swap_bcount * SWAP_META_PAGES * n / non-overflowing division] I've attached a patch which changes 'n' to be of type vm_ooffset_t. I think this should fix the overflow bug? I don't like using vm_ooffset_t either. There are no offsets here, and it's bad technique to depend on having a large type to avoid overflows in expressions when the result type is different. I would cast operand(s) in the expression as necessary to prevent overflow of subexpressions. vm_pindex_t would work, but I prefer to use a type related to the subexpressions. Not sure what that is. Maybe just uintmax_t for safety (even that is not safe if the subexpressions have large values). So: (uintmax_t)swap_bcount * SWAP_META_PAGES * n / mumble. I like to cast only the leftmost term if possible, and depend on the larger type propagating to all subexpressions via left-to-right evaluation. This saves a lot of casts. Here this may be sub-optimal and we could probably delay the cast to the final multiplication, which reduces to the same safeness as using uintmax_t for n. Next, there is the return type to consider. I don't see why it needs to be changed from int. The patch in the PR actually changed it to long, while changing n to vm_offset_t. But on 32-bit machines, long is essentially the same as int, and vm_offset_t is not much larger. Even 32-bit machine might actually need a type larger than 32 bits to prevent overflow in expressions like the above. Bruce ___ 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: r218984 - head/lib/librt
On Wed, 23 Feb 2011, Dimitry Andric wrote: On 2011-02-23 23:13, Bruce Evans wrote: Now found it easly using gcc -v. gcc -c -v foo.c produces ... /usr/bin/as -o foo.o /var/tmp/whatever.s, but gcc -c -v foo.s produces ... /usr/bin/as -gdwarf2 -o foo.o foo.s. gcc's generation of -gdwarf2 is inconsistent with itself. Do we use a nonstandard not-gdwarf2 option for the usual case but forget to change this for asm files? I don't think so, but there is simply no need to pass '-g' in the gcc invocation that assembles and links the .s file, since the debug info is already embedded in the .s file itself. Except I want to write cc ${CFLAGS} -o foo *.s *.c [*.o] and not have variant ${CFLAGS} for *.s and *.c. It is a nice feature of cc that you can use the same ${CFLAGS} for *.[cos...] in most contexts, and FreeBSD .mk files depend on this. Apparently, if you use --gdwarf2 with GNU as 2.15, it messes up the already existing debug info. It looks like 2.17.50 has no such problem, though. So we won't worry much about this. Does new binutils/as completely ignore --gdwarf2 iff the asm file already has suitable debugging info? I would have expected at least an error message if the debugging info says --gother and you try to add or change to --gdwarf2. Normal debugging info doesn't seem to have any id to distinguish its type. Bruce ___ 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: r218986 - head/etc/rc.d
Author: dougb Date: Thu Feb 24 06:28:48 2011 New Revision: 218986 URL: http://svn.freebsd.org/changeset/base/218986 Log: The new accounting file needs to be 644 so that unprivileged users can use lastcomm(1) Modified: head/etc/rc.d/accounting Modified: head/etc/rc.d/accounting == --- head/etc/rc.d/accountingWed Feb 23 21:45:28 2011(r218985) +++ head/etc/rc.d/accountingThu Feb 24 06:28:48 2011(r218986) @@ -58,6 +58,7 @@ accounting_rotate_log() if checkyesno accounting_enable; then _file=`mktemp newacct-X` + chmod 644 $_file ${accounting_command} ${_dir}/${_file} fi ___ 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