From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 01:13:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9B9CD1065670; Sun, 10 Jun 2012 01:13:05 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 843018FC0C; Sun, 10 Jun 2012 01:13:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A1D55Z064322; Sun, 10 Jun 2012 01:13:05 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A1D5Ua064309; Sun, 10 Jun 2012 01:13:05 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201206100113.q5A1D5Ua064309@svn.freebsd.org> From: Andrew Turner Date: Sun, 10 Jun 2012 01:13:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236828 - in head/sys/arm: arm at91 econa include mv s3c2xx0 sa11x0 xscale/i80321 xscale/i8134x xscale/ixp425 xscale/pxa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 01:13:05 -0000 Author: andrew Date: Sun Jun 10 01:13:04 2012 New Revision: 236828 URL: http://svn.freebsd.org/changeset/base/236828 Log: Pull out the common code to initialise proc0 & thread0 from initarm to a common function. Reviewed by: imp Modified: head/sys/arm/arm/machdep.c head/sys/arm/at91/at91_machdep.c head/sys/arm/econa/econa_machdep.c head/sys/arm/include/machdep.h head/sys/arm/mv/mv_machdep.c head/sys/arm/s3c2xx0/s3c24x0_machdep.c head/sys/arm/sa11x0/assabet_machdep.c head/sys/arm/xscale/i80321/ep80219_machdep.c head/sys/arm/xscale/i80321/iq31244_machdep.c head/sys/arm/xscale/i8134x/crb_machdep.c head/sys/arm/xscale/ixp425/avila_machdep.c head/sys/arm/xscale/pxa/pxa_machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/arm/machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -92,6 +92,8 @@ __FBSDID("$FreeBSD$"); #include #include +static struct trapframe proc0_tf; + uint32_t cpu_reset_address = 0; int cold = 1; vm_offset_t vector_page; @@ -709,3 +711,19 @@ fake_preload_metadata(void) return (lastaddr); } + +/* + * Initialize proc0 + */ +void +init_proc0(vm_offset_t kstack) +{ + proc_linkup0(&proc0, &thread0); + thread0.td_kstack = kstack; + thread0.td_pcb = (struct pcb *) + (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; + thread0.td_pcb->pcb_flags = 0; + thread0.td_frame = &proc0_tf; + pcpup->pc_curpcb = thread0.td_pcb; +} + Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/at91/at91_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -132,8 +132,6 @@ struct pv_addr undstack; struct pv_addr abtstack; struct pv_addr kernelstack; -static struct trapframe proc0_tf; - /* Static device mappings. */ const struct pmap_devmap at91_devmap[] = { /* @@ -550,13 +548,7 @@ initarm(struct arm_boot_params *abp) undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + init_proc0(kernelstack.pv_va); arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); Modified: head/sys/arm/econa/econa_machdep.c ============================================================================== --- head/sys/arm/econa/econa_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/econa/econa_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -123,8 +123,6 @@ struct pv_addr undstack; struct pv_addr abtstack; struct pv_addr kernelstack; -static struct trapframe proc0_tf; - /* Static device mappings. */ static const struct pmap_devmap econa_devmap[] = { { @@ -341,13 +339,7 @@ initarm(struct arm_boot_params *abp) undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + init_proc0(kernelstack.pv_va); arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/include/machdep.h Sun Jun 10 01:13:04 2012 (r236828) @@ -7,6 +7,7 @@ /* misc prototypes used by the many arm machdeps */ void arm_lock_cache_line(vm_offset_t); vm_offset_t fake_preload_metadata(void); +void init_proc0(vm_offset_t kstack); void halt(void); void data_abort_handler(trapframe_t *); void prefetch_abort_handler(trapframe_t *); Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/mv/mv_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -145,8 +145,6 @@ struct pv_addr undstack; struct pv_addr abtstack; struct pv_addr kernelstack; -static struct trapframe proc0_tf; - static struct mem_region availmem_regions[FDT_MEM_REGIONS]; static int availmem_regions_sz; @@ -576,14 +574,7 @@ initarm(struct arm_boot_params *abp) undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_kstack_pages = KSTACK_PAGES; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + init_proc0(kernelstack.pv_va); arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c ============================================================================== --- head/sys/arm/s3c2xx0/s3c24x0_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -138,8 +138,6 @@ struct pv_addr undstack; struct pv_addr abtstack; struct pv_addr kernelstack; -static struct trapframe proc0_tf; - #define _A(a) ((a) & ~L1_S_OFFSET) #define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1)) @@ -406,14 +404,8 @@ initarm(struct arm_boot_params *abp) prefetch_abort_handler_address = (u_int)prefetch_abort_handler; undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - - proc_linkup(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + + init_proc0(kernelstack.pv_va); arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); Modified: head/sys/arm/sa11x0/assabet_machdep.c ============================================================================== --- head/sys/arm/sa11x0/assabet_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/sa11x0/assabet_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -147,7 +147,6 @@ struct pv_addr irqstack; struct pv_addr undstack; struct pv_addr abtstack; struct pv_addr kernelstack; -static struct trapframe proc0_tf; /* Static device mappings. */ static const struct pmap_devmap assabet_devmap[] = { @@ -387,12 +386,7 @@ initarm(struct arm_boot_params *abp) /* Set stack for exception handlers */ - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; + init_proc0(kernelstack.pv_va); /* Enable MMU, I-cache, D-cache, write buffer. */ Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/ep80219_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/xscale/i80321/ep80219_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -136,8 +136,6 @@ struct pv_addr abtstack; struct pv_addr kernelstack; struct pv_addr minidataclean; -static struct trapframe proc0_tf; - /* #define IQ80321_OBIO_BASE 0xfe800000UL */ /* #define IQ80321_OBIO_SIZE 0x00100000UL */ @@ -379,13 +377,7 @@ initarm(struct arm_boot_params *abp) undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + init_proc0(kernelstack.pv_va); /* Enable MMU, I-cache, D-cache, write buffer. */ Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/iq31244_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/xscale/i80321/iq31244_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -136,8 +136,6 @@ struct pv_addr abtstack; struct pv_addr kernelstack; struct pv_addr minidataclean; -static struct trapframe proc0_tf; - #define IQ80321_OBIO_BASE 0xfe800000UL #define IQ80321_OBIO_SIZE 0x00100000UL /* Static device mappings. */ @@ -377,13 +375,7 @@ initarm(struct arm_boot_params *abp) undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + init_proc0(kernelstack.pv_va); /* Enable MMU, I-cache, D-cache, write buffer. */ Modified: head/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- head/sys/arm/xscale/i8134x/crb_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/xscale/i8134x/crb_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -135,8 +135,6 @@ struct pv_addr undstack; struct pv_addr abtstack; struct pv_addr kernelstack; -static struct trapframe proc0_tf; - /* Static device mappings. */ static const struct pmap_devmap iq81342_devmap[] = { { @@ -353,13 +351,7 @@ initarm(struct arm_boot_params *abp) undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + init_proc0(kernelstack.pv_va); arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -140,8 +140,6 @@ struct pv_addr abtstack; struct pv_addr kernelstack; struct pv_addr minidataclean; -static struct trapframe proc0_tf; - /* Static device mappings. */ static const struct pmap_devmap ixp425_devmap[] = { /* Physical/Virtual address for I/O space */ @@ -443,13 +441,7 @@ initarm(struct arm_boot_params *abp) undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - proc_linkup0(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + init_proc0(kernelstack.pv_va); arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); Modified: head/sys/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- head/sys/arm/xscale/pxa/pxa_machdep.c Sat Jun 9 22:44:49 2012 (r236827) +++ head/sys/arm/xscale/pxa/pxa_machdep.c Sun Jun 10 01:13:04 2012 (r236828) @@ -136,8 +136,6 @@ struct pv_addr abtstack; struct pv_addr kernelstack; struct pv_addr minidataclean; -static struct trapframe proc0_tf; - static void pxa_probe_sdram(bus_space_tag_t, bus_space_handle_t, uint32_t *, uint32_t *); @@ -367,13 +365,7 @@ initarm(struct arm_boot_params *abp) undefined_handler_address = (u_int)undefinedinstruction_bounce; undefined_init(); - proc_linkup(&proc0, &thread0); - thread0.td_kstack = kernelstack.pv_va; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - thread0.td_pcb->pcb_flags = 0; - thread0.td_frame = &proc0_tf; - pcpup->pc_curpcb = thread0.td_pcb; + init_proc0(kernelstack.pv_va); /* Enable MMU, I-cache, D-cache, write buffer. */ arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 02:04:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA09D1065672; Sun, 10 Jun 2012 02:04:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA6168FC1D; Sun, 10 Jun 2012 02:04:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A24B3I066399; Sun, 10 Jun 2012 02:04:11 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A24BwA066388; Sun, 10 Jun 2012 02:04:11 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206100204.q5A24BwA066388@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 10 Jun 2012 02:04:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236829 - head/contrib/libstdc++/include/bits X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 02:04:11 -0000 Author: pfg Date: Sun Jun 10 02:04:11 2012 New Revision: 236829 URL: http://svn.freebsd.org/changeset/base/236829 Log: Bring a couple of libstdc++ patches from Apple's llvm-gcc project. Modified Fri Jul 10 07:44:34 2009 CDT by rafael backport part of http://gcc.gnu.org/ml/gcc-cvs/2007-10/msg00118.html The patch is for libstdc++ and it was GPL2 at the time. Modified Tue Apr 29 01:20:19 2008 CDT by asl Backport from mainline (pre-GPLv3). Fix for sizeof(const void*) > sizeof(unsigned long). Approved by: jhb (mentor) MFC after: 2 weeks Modified: head/contrib/libstdc++/include/bits/locale_facets.tcc head/contrib/libstdc++/include/bits/stl_bvector.h head/contrib/libstdc++/include/bits/stl_deque.h head/contrib/libstdc++/include/bits/stl_list.h head/contrib/libstdc++/include/bits/stl_map.h head/contrib/libstdc++/include/bits/stl_multimap.h head/contrib/libstdc++/include/bits/stl_multiset.h head/contrib/libstdc++/include/bits/stl_set.h head/contrib/libstdc++/include/bits/stl_tree.h head/contrib/libstdc++/include/bits/stl_vector.h Modified: head/contrib/libstdc++/include/bits/locale_facets.tcc ============================================================================== --- head/contrib/libstdc++/include/bits/locale_facets.tcc Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/locale_facets.tcc Sun Jun 10 02:04:11 2012 (r236829) @@ -887,7 +887,11 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE const fmtflags __fmt = __io.flags(); __io.flags(__fmt & ~ios_base::basefield | ios_base::hex); - unsigned long __ul; + typedef __gnu_cxx::__conditional_type<(sizeof(void*) + <= sizeof(unsigned long)), + unsigned long, unsigned long long>::__type _UIntPtrType; + + _UIntPtrType __ul; __beg = _M_extract_int(__beg, __end, __io, __err, __ul); // Reset from hex formatted input. @@ -1309,8 +1313,12 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE | ios_base::internal); __io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase)); + typedef __gnu_cxx::__conditional_type<(sizeof(const void*) + <= sizeof(unsigned long)), + unsigned long, unsigned long long>::__type _UIntPtrType; + __s = _M_insert_int(__s, __io, __fill, - reinterpret_cast(__v)); + reinterpret_cast<_UIntPtrType>(__v)); __io.flags(__flags); return __s; } Modified: head/contrib/libstdc++/include/bits/stl_bvector.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_bvector.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_bvector.h Sun Jun 10 02:04:11 2012 (r236829) @@ -385,6 +385,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL _Bit_iterator _M_start; _Bit_iterator _M_finish; _Bit_type* _M_end_of_storage; + + _Bvector_impl() + : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage(0) + { } + _Bvector_impl(const _Bit_alloc_type& __a) : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0) { } @@ -405,7 +410,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Bit_allocator()); } - _Bvector_base(const allocator_type& __a) : _M_impl(__a) { } + _Bvector_base() + : _M_impl() { } + + _Bvector_base(const allocator_type& __a) + : _M_impl(__a) { } ~_Bvector_base() { this->_M_deallocate(); } @@ -480,8 +489,11 @@ template using _Base::_M_get_Bit_allocator; public: + vector() + : _Base() { } + explicit - vector(const allocator_type& __a = allocator_type()) + vector(const allocator_type& __a) : _Base(__a) { } explicit @@ -678,7 +690,7 @@ template } void - swap(vector& __x) + swap(vector& __x) { std::swap(this->_M_impl._M_start, __x._M_impl._M_start); std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); Modified: head/contrib/libstdc++/include/bits/stl_deque.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_deque.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_deque.h Sun Jun 10 02:04:11 2012 (r236829) @@ -380,6 +380,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; + _Deque_base() + : _M_impl() + { _M_initialize_map(0); } + _Deque_base(const allocator_type& __a, size_t __num_elements) : _M_impl(__a) { _M_initialize_map(__num_elements); } @@ -406,6 +410,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL iterator _M_start; iterator _M_finish; + _Deque_impl() + : _Tp_alloc_type(), _M_map(0), _M_map_size(0), + _M_start(), _M_finish() + { } + _Deque_impl(const _Tp_alloc_type& __a) : _Tp_alloc_type(__a), _M_map(0), _M_map_size(0), _M_start(), _M_finish() @@ -679,8 +688,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + deque() + : _Base() { } + explicit - deque(const allocator_type& __a = allocator_type()) + deque(const allocator_type& __a) : _Base(__a, 0) {} /** Modified: head/contrib/libstdc++/include/bits/stl_list.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_list.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_list.h Sun Jun 10 02:04:11 2012 (r236829) @@ -305,6 +305,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL { _List_node_base _M_node; + _List_impl() + : _Node_alloc_type(), _M_node() + { } + _List_impl(const _Node_alloc_type& __a) : _Node_alloc_type(__a), _M_node() { } @@ -339,6 +343,10 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Node_allocator()); } + _List_base() + : _M_impl() + { _M_init(); } + _List_base(const allocator_type& __a) : _M_impl(__a) { _M_init(); } @@ -468,8 +476,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + list() + : _Base() { } + explicit - list(const allocator_type& __a = allocator_type()) + list(const allocator_type& __a) : _Base(__a) { } /** Modified: head/contrib/libstdc++/include/bits/stl_map.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_map.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_map.h Sun Jun 10 02:04:11 2012 (r236829) @@ -155,7 +155,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ map() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } // for some reason this was made a separate function /** @@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template map(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_unique(__first, __last); } /** Modified: head/contrib/libstdc++/include/bits/stl_multimap.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_multimap.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_multimap.h Sun Jun 10 02:04:11 2012 (r236829) @@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ multimap() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } // for some reason this was made a separate function /** @@ -184,8 +184,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template multimap(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) - { _M_t._M_insert_equal(__first, __last); } + : _M_t() + { _M_t._M_insert_unique(__first, __last); } /** * @brief Builds a %multimap from a range. Modified: head/contrib/libstdc++/include/bits/stl_multiset.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_multiset.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_multiset.h Sun Jun 10 02:04:11 2012 (r236829) @@ -134,7 +134,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * @brief Default constructor creates no elements. */ multiset() - : _M_t(_Compare(), allocator_type()) { } + : _M_t() { } explicit multiset(const _Compare& __comp, @@ -152,7 +152,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template multiset(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_equal(__first, __last); } /** @@ -180,7 +180,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * The newly-created %multiset uses a copy of the allocation object used * by @a x. */ - multiset(const multiset<_Key,_Compare,_Alloc>& __x) + multiset(const multiset& __x) : _M_t(__x._M_t) { } /** @@ -190,8 +190,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * All the elements of @a x are copied, but unlike the copy constructor, * the allocator object is not copied. */ - multiset<_Key,_Compare,_Alloc>& - operator=(const multiset<_Key,_Compare,_Alloc>& __x) + multiset& + operator=(const multiset& __x) { _M_t = __x._M_t; return *this; @@ -275,7 +275,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * std::swap(s1,s2) will feed to this function. */ void - swap(multiset<_Key, _Compare, _Alloc>& __x) + swap(multiset& __x) { _M_t.swap(__x._M_t); } // insert/erase Modified: head/contrib/libstdc++/include/bits/stl_set.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_set.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_set.h Sun Jun 10 02:04:11 2012 (r236829) @@ -138,7 +138,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL // allocation/deallocation /// Default constructor creates no elements. set() - : _M_t(_Compare(), allocator_type()) {} + : _M_t() { } /** * @brief Default constructor creates no elements. @@ -162,7 +162,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL */ template set(_InputIterator __first, _InputIterator __last) - : _M_t(_Compare(), allocator_type()) + : _M_t() { _M_t._M_insert_unique(__first, __last); } /** @@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * The newly-created %set uses a copy of the allocation object used * by @a x. */ - set(const set<_Key,_Compare,_Alloc>& __x) + set(const set& __x) : _M_t(__x._M_t) { } /** @@ -200,8 +200,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * All the elements of @a x are copied, but unlike the copy constructor, * the allocator object is not copied. */ - set<_Key,_Compare,_Alloc>& - operator=(const set<_Key, _Compare, _Alloc>& __x) + set& + operator=(const set& __x) { _M_t = __x._M_t; return *this; @@ -283,7 +283,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL * std::swap(s1,s2) will feed to this function. */ void - swap(set<_Key,_Compare,_Alloc>& __x) + swap(set& __x) { _M_t.swap(__x._M_t); } // insert/erase Modified: head/contrib/libstdc++/include/bits/stl_tree.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_tree.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_tree.h Sun Jun 10 02:04:11 2012 (r236829) @@ -410,10 +410,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree_node_base _M_header; size_type _M_node_count; // Keeps track of size of tree. - _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(), - const _Key_compare& __comp = _Key_compare()) - : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), + _Rb_tree_impl() + : _Node_allocator(), _M_key_compare(), _M_header(), _M_node_count(0) + { _M_initialize(); } + + _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) + : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), + _M_node_count(0) + { _M_initialize(); } + + private: + void + _M_initialize() { this->_M_header._M_color = _S_red; this->_M_header._M_parent = 0; @@ -431,11 +440,20 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree_node_base _M_header; size_type _M_node_count; // Keeps track of size of tree. - _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(), - const _Key_compare& __comp = _Key_compare()) + _Rb_tree_impl() + : _Node_allocator(), _M_key_compare(), _M_header(), + _M_node_count(0) + { _M_initialize(); } + + _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), _M_node_count(0) - { + { _M_initialize(); } + + private: + void + _M_initialize() + { this->_M_header._M_color = _S_red; this->_M_header._M_parent = 0; this->_M_header._M_left = &this->_M_header; @@ -568,16 +586,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _Rb_tree() { } - _Rb_tree(const _Compare& __comp) - : _M_impl(allocator_type(), __comp) - { } - - _Rb_tree(const _Compare& __comp, const allocator_type& __a) - : _M_impl(__a, __comp) + _Rb_tree(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_impl(__comp, __a) { } - _Rb_tree(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x) - : _M_impl(__x._M_get_Node_allocator(), __x._M_impl._M_key_compare) + _Rb_tree(const _Rb_tree& __x) + : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator()) { if (__x._M_root() != 0) { @@ -591,8 +606,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ~_Rb_tree() { _M_erase(_M_begin()); } - _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& - operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x); + _Rb_tree& + operator=(const _Rb_tree& __x); // Accessors. _Compare @@ -653,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { return get_allocator().max_size(); } void - swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t); + swap(_Rb_tree& __t); // Insert/erase. pair Modified: head/contrib/libstdc++/include/bits/stl_vector.h ============================================================================== --- head/contrib/libstdc++/include/bits/stl_vector.h Sun Jun 10 01:13:04 2012 (r236828) +++ head/contrib/libstdc++/include/bits/stl_vector.h Sun Jun 10 02:04:11 2012 (r236829) @@ -84,6 +84,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL _Tp* _M_start; _Tp* _M_finish; _Tp* _M_end_of_storage; + + _Vector_impl() + : _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0) + { } + _Vector_impl(_Tp_alloc_type const& __a) : _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0) { } @@ -104,6 +109,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL get_allocator() const { return allocator_type(_M_get_Tp_allocator()); } + _Vector_base() + : _M_impl() { } + _Vector_base(const allocator_type& __a) : _M_impl(__a) { } @@ -194,8 +202,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GL /** * @brief Default constructor creates no elements. */ + vector() + : _Base() { } + explicit - vector(const allocator_type& __a = allocator_type()) + vector(const allocator_type& __a) : _Base(__a) { } From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 02:38:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 677BA106564A; Sun, 10 Jun 2012 02:38:52 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 519288FC0C; Sun, 10 Jun 2012 02:38:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A2cqB9067793; Sun, 10 Jun 2012 02:38:52 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A2cq4D067788; Sun, 10 Jun 2012 02:38:52 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206100238.q5A2cq4D067788@svn.freebsd.org> From: Mitsuru IWASAKI Date: Sun, 10 Jun 2012 02:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236830 - in head/sys: amd64/amd64 conf i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 02:38:52 -0000 Author: iwasaki Date: Sun Jun 10 02:38:51 2012 New Revision: 236830 URL: http://svn.freebsd.org/changeset/base/236830 Log: Some fixes for r236772. - Remove cpuset stopped_cpus which is no longer used. - Add a short comment for cpuset suspended_cpus clearing. - Fix the un-ordered x86/acpica/acpi_wakeup.c in conf/files.amd64 and i386. Pointed-out by: attilio@ Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/i386/i386/mp_machdep.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sun Jun 10 02:04:11 2012 (r236829) +++ head/sys/amd64/amd64/mp_machdep.c Sun Jun 10 02:38:51 2012 (r236830) @@ -1416,7 +1416,6 @@ cpususpend_handler(void) if (savectx(susppcbs[cpu])) { ctx_fpusave(susppcbs[cpu]->pcb_fpususpend); wbinvd(); - CPU_SET_ATOMIC(cpu, &stopped_cpus); CPU_SET_ATOMIC(cpu, &suspended_cpus); } else { pmap_init_pat(); @@ -1426,6 +1425,8 @@ cpususpend_handler(void) initializecpu(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); + + /* Indicate that we are resumed */ CPU_CLR_ATOMIC(cpu, &suspended_cpus); } @@ -1434,7 +1435,6 @@ cpususpend_handler(void) ia32_pause(); CPU_CLR_ATOMIC(cpu, &started_cpus); - CPU_CLR_ATOMIC(cpu, &stopped_cpus); /* Resume MCA and local APIC */ mca_resume(); Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sun Jun 10 02:04:11 2012 (r236829) +++ head/sys/conf/files.amd64 Sun Jun 10 02:38:51 2012 (r236830) @@ -93,7 +93,6 @@ acpi_wakedata.h optional acpi \ no-obj no-implicit-rule before-depend \ clean "acpi_wakedata.h" # -x86/acpica/acpi_wakeup.c optional acpi amd64/amd64/amd64_mem.c optional mem #amd64/amd64/apic_vector.S standard amd64/amd64/atomic.c standard @@ -453,6 +452,7 @@ contrib/x86emu/x86emu.c optional x86bio # x86/acpica/OsdEnvironment.c optional acpi x86/acpica/acpi_apm.c optional acpi +x86/acpica/acpi_wakeup.c optional acpi x86/acpica/madt.c optional acpi x86/acpica/srat.c optional acpi x86/bios/smbios.c optional smbios Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Sun Jun 10 02:04:11 2012 (r236829) +++ head/sys/conf/files.i386 Sun Jun 10 02:38:51 2012 (r236830) @@ -381,7 +381,6 @@ acpi_wakedata.h optional acpi \ no-obj no-implicit-rule before-depend \ clean "acpi_wakedata.h" # -x86/acpica/acpi_wakeup.c optional acpi i386/bios/apm.c optional apm i386/bios/mca_machdep.c optional mca i386/bios/smapi.c optional smapi @@ -505,6 +504,7 @@ compat/x86bios/x86bios.c optional x86bio # x86/acpica/OsdEnvironment.c optional acpi x86/acpica/acpi_apm.c optional acpi +x86/acpica/acpi_wakeup.c optional acpi x86/acpica/madt.c optional acpi apic x86/acpica/srat.c optional acpi x86/bios/smbios.c optional smbios Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Sun Jun 10 02:04:11 2012 (r236829) +++ head/sys/i386/i386/mp_machdep.c Sun Jun 10 02:38:51 2012 (r236830) @@ -1514,12 +1514,13 @@ cpususpend_handler(void) if (savectx(susppcbs[cpu])) { wbinvd(); - CPU_SET_ATOMIC(cpu, &stopped_cpus); CPU_SET_ATOMIC(cpu, &suspended_cpus); } else { pmap_init_pat(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); + + /* Indicate that we are resumed */ CPU_CLR_ATOMIC(cpu, &suspended_cpus); } @@ -1528,7 +1529,6 @@ cpususpend_handler(void) ia32_pause(); CPU_CLR_ATOMIC(cpu, &started_cpus); - CPU_CLR_ATOMIC(cpu, &stopped_cpus); /* Resume MCA and local APIC */ mca_resume(); From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 06:31:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA94B1065676; Sun, 10 Jun 2012 06:31:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C63408FC15; Sun, 10 Jun 2012 06:31:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A6VsUH077724; Sun, 10 Jun 2012 06:31:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A6Vs2F077722; Sun, 10 Jun 2012 06:31:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206100631.q5A6Vs2F077722@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 10 Jun 2012 06:31:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236832 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 06:31:54 -0000 Author: pjd Date: Sun Jun 10 06:31:54 2012 New Revision: 236832 URL: http://svn.freebsd.org/changeset/base/236832 Log: Simplify fdtofp(). MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Jun 10 05:24:24 2012 (r236831) +++ head/sys/kern/kern_descrip.c Sun Jun 10 06:31:54 2012 (r236832) @@ -430,13 +430,13 @@ sys_fcntl(struct thread *td, struct fcnt static inline struct file * fdtofp(int fd, struct filedesc *fdp) { - struct file *fp; FILEDESC_LOCK_ASSERT(fdp); - if ((unsigned)fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[fd]) == NULL) + + if ((unsigned)fd >= fdp->fd_nfiles) return (NULL); - return (fp); + + return (fdp->fd_ofiles[fd]); } static inline int From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 06:42:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BAF3E106564A; Sun, 10 Jun 2012 06:42:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5FEA8FC0A; Sun, 10 Jun 2012 06:42:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A6gIVu078190; Sun, 10 Jun 2012 06:42:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A6gI45078187; Sun, 10 Jun 2012 06:42:18 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206100642.q5A6gI45078187@svn.freebsd.org> From: Adrian Chadd Date: Sun, 10 Jun 2012 06:42:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236833 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 06:42:18 -0000 Author: adrian Date: Sun Jun 10 06:42:18 2012 New Revision: 236833 URL: http://svn.freebsd.org/changeset/base/236833 Log: Add a new ioctl for ath(4) which returns the aggregate statistics. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sun Jun 10 06:31:54 2012 (r236832) +++ head/sys/dev/ath/if_ath.c Sun Jun 10 06:42:18 2012 (r236833) @@ -4848,6 +4848,9 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, sc->sc_stats.ast_tx_rate |= IEEE80211_RATE_MCS; return copyout(&sc->sc_stats, ifr->ifr_data, sizeof (sc->sc_stats)); + case SIOCGATHAGSTATS: + return copyout(&sc->sc_aggr_stats, + ifr->ifr_data, sizeof (sc->sc_aggr_stats)); case SIOCZATHSTATS: error = priv_check(curthread, PRIV_DRIVER); if (error == 0) { Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Sun Jun 10 06:31:54 2012 (r236832) +++ head/sys/dev/ath/if_athioctl.h Sun Jun 10 06:42:18 2012 (r236833) @@ -166,6 +166,7 @@ struct ath_stats { #define SIOCGATHSTATS _IOWR('i', 137, struct ifreq) #define SIOCZATHSTATS _IOWR('i', 139, struct ifreq) +#define SIOCGATHAGSTATS _IOWR('i', 141, struct ifreq) struct ath_diag { char ad_name[IFNAMSIZ]; /* if name, e.g. "ath0" */ From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 06:44:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E24F51065670; Sun, 10 Jun 2012 06:44:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAFF48FC16; Sun, 10 Jun 2012 06:44:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A6i4Yk078324; Sun, 10 Jun 2012 06:44:04 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A6i4JX078317; Sun, 10 Jun 2012 06:44:04 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206100644.q5A6i4JX078317@svn.freebsd.org> From: Adrian Chadd Date: Sun, 10 Jun 2012 06:44:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236834 - head/tools/tools/ath/athaggrstats X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 06:44:05 -0000 Author: adrian Date: Sun Jun 10 06:44:04 2012 New Revision: 236834 URL: http://svn.freebsd.org/changeset/base/236834 Log: Flesh out 'athaggrstats', a utility which will display the aggregation specific statistics for ath(4). Added: head/tools/tools/ath/athaggrstats/ head/tools/tools/ath/athaggrstats/Makefile (contents, props changed) head/tools/tools/ath/athaggrstats/athaggrstats.c (contents, props changed) head/tools/tools/ath/athaggrstats/athaggrstats.h (contents, props changed) head/tools/tools/ath/athaggrstats/main.c (contents, props changed) head/tools/tools/ath/athaggrstats/statfoo.c (contents, props changed) head/tools/tools/ath/athaggrstats/statfoo.h (contents, props changed) Added: head/tools/tools/ath/athaggrstats/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athaggrstats/Makefile Sun Jun 10 06:44:04 2012 (r236834) @@ -0,0 +1,26 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../../sys/dev/ath/ath_hal + +PROG= athaggrstats + +SRCS= main.c statfoo.c athaggrstats.c opt_ah.h ah_osdep.h + +CLEANFILES+= opt_ah.h + +.include <../Makefile.inc> + +CFLAGS+=-DATH_SUPPORT_ANI +CFLAGS+=-DATH_SUPPORT_TDMA + +opt_ah.h: + echo "#define AH_DEBUG 1" > opt_ah.h + echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h + echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h + +ah_osdep.h: + echo 'typedef void *HAL_SOFTC;' >ah_osdep.h + echo 'typedef int HAL_BUS_TAG;' >>ah_osdep.h + echo 'typedef void *HAL_BUS_HANDLE;' >>ah_osdep.h + +.include Added: head/tools/tools/ath/athaggrstats/athaggrstats.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athaggrstats/athaggrstats.c Sun Jun 10 06:44:04 2012 (r236834) @@ -0,0 +1,404 @@ +/*- + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +#include "opt_ah.h" + +/* + * ath statistics class. + */ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "ah.h" +#include "ah_desc.h" +#include "net80211/ieee80211_ioctl.h" +#include "net80211/ieee80211_radiotap.h" +#include "if_athioctl.h" + +#include "athaggrstats.h" + +#define NOTPRESENT { 0, "", "" } + +#define AFTER(prev) ((prev)+1) + +static const struct fmt athaggrstats[] = { + +#define S_SINGLE_PKT 0 + { 4, "singlepkt", "spkt", "single frames scheduled" }, +#define S_NONBAW_PKT AFTER(S_SINGLE_PKT) + { 5, "nonbawpkt", "nbpkt", "frames outside of the BAW" }, +#define S_AGGR_PKT AFTER(S_NONBAW_PKT) + { 6, "aggrpkt", "aggpkt", "aggregate frames scheduled" }, +#define S_BAW_CLOSED_SINGLE_PKT AFTER(S_AGGR_PKT) + { 8, "bawclosedpkt", "bawclpkt", "single frames due to closed BAW" }, +#define S_LOW_HWQ_SINGLE_PKT AFTER(S_BAW_CLOSED_SINGLE_PKT) + { 6, "lhsinglepkt", "lhspkt", "single frames scheduled due to low HWQ depth" }, +#define S_SCHED_NOPKT AFTER(S_LOW_HWQ_SINGLE_PKT) + { 6, "schednopkt", "snopkt", "sched called with no frames" }, +#define S_RTS_AGGR_LIMITED AFTER(S_SCHED_NOPKT) + { 8, "rtsaggrlimit", "rtslimit", "RTS limited aggregates" }, +#define S_PKT0 AFTER(S_RTS_AGGR_LIMITED) + { 2, "p0", "p0", "" }, +#define S_PKT1 AFTER(S_PKT0) + { 2, "p1", "p1", "" }, +#define S_PKT2 AFTER(S_PKT1) + { 2, "p2", "p2", "" }, +#define S_PKT3 AFTER(S_PKT2) + { 2, "p3", "p3", "" }, +#define S_PKT4 AFTER(S_PKT3) + { 2, "p4", "p4", "" }, +#define S_PKT5 AFTER(S_PKT4) + { 2, "p5", "p5", "" }, +#define S_PKT6 AFTER(S_PKT5) + { 2, "p6", "p6", "" }, +#define S_PKT7 AFTER(S_PKT6) + { 2, "p7", "p7", "" }, +#define S_PKT8 AFTER(S_PKT7) + { 2, "p8", "p8", "" }, +#define S_PKT9 AFTER(S_PKT8) + { 2, "p9", "p9", "" }, +#define S_PKT10 AFTER(S_PKT9) + { 3, "p10", "p10", "" }, +#define S_PKT11 AFTER(S_PKT10) + { 3, "p11", "p11", "" }, +#define S_PKT12 AFTER(S_PKT11) + { 3, "p12", "p12", "" }, +#define S_PKT13 AFTER(S_PKT12) + { 3, "p13", "p13", "" }, +#define S_PKT14 AFTER(S_PKT13) + { 3, "p14", "p14", "" }, +#define S_PKT15 AFTER(S_PKT14) + { 3, "p15", "p15", "" }, +#define S_PKT16 AFTER(S_PKT15) + { 3, "p16", "p16", "" }, +#define S_PKT17 AFTER(S_PKT16) + { 3, "p17", "p17", "" }, +#define S_PKT18 AFTER(S_PKT17) + { 3, "p18", "p18", "" }, +#define S_PKT19 AFTER(S_PKT18) + { 3, "p19", "p19", "" }, +#define S_PKT20 AFTER(S_PKT19) + { 3, "p20", "p20", "" }, +#define S_PKT21 AFTER(S_PKT20) + { 3, "p21", "p21", "" }, +#define S_PKT22 AFTER(S_PKT21) + { 3, "p22", "p22", "" }, +#define S_PKT23 AFTER(S_PKT22) + { 3, "p23", "p23", "" }, +#define S_PKT24 AFTER(S_PKT23) + { 3, "p24", "p24", "" }, +#define S_PKT25 AFTER(S_PKT24) + { 3, "p25", "p25", "" }, +#define S_PKT26 AFTER(S_PKT25) + { 3, "p26", "p26", "" }, +#define S_PKT27 AFTER(S_PKT26) + { 3, "p27", "p27", "" }, +#define S_PKT28 AFTER(S_PKT27) + { 3, "p28", "p28", "" }, +#define S_PKT29 AFTER(S_PKT28) + { 3, "p29", "p29", "" }, +#define S_PKT30 AFTER(S_PKT29) + { 3, "p30", "p30", "" }, +#define S_PKT31 AFTER(S_PKT30) + { 3, "p31", "p31", "" }, +}; + +#define S_LAST S_RTS_AGGR_LIMITED +#define S_MAX (S_PKT31 + 1) + +struct athaggrstatfoo_p { + struct athaggrstatfoo base; + int s; + int optstats; + struct ifreq ifr; + struct ath_diag atd; + struct ath_tx_aggr_stats cur; + struct ath_tx_aggr_stats total; +}; + +static void +ath_setifname(struct athaggrstatfoo *wf0, const char *ifname) +{ + struct athaggrstatfoo_p *wf = (struct athaggrstatfoo_p *) wf0; + + strncpy(wf->ifr.ifr_name, ifname, sizeof (wf->ifr.ifr_name)); +} + +static void +ath_zerostats(struct athaggrstatfoo *wf0) +{ +#if 0 + struct athaggrstatfoo_p *wf = (struct athaggrstatfoo_p *) wf0; + + if (ioctl(wf->s, SIOCZATHSTATS, &wf->ifr) < 0) + err(-1, wf->ifr.ifr_name); +#endif +} + +static void +ath_collect(struct athaggrstatfoo_p *wf, struct ath_tx_aggr_stats *stats) +{ + wf->ifr.ifr_data = (caddr_t) stats; + if (ioctl(wf->s, SIOCGATHAGSTATS, &wf->ifr) < 0) + err(1, wf->ifr.ifr_name); +} + +static void +ath_collect_cur(struct statfoo *sf) +{ + struct athaggrstatfoo_p *wf = (struct athaggrstatfoo_p *) sf; + + ath_collect(wf, &wf->cur); +} + +static void +ath_collect_tot(struct statfoo *sf) +{ + struct athaggrstatfoo_p *wf = (struct athaggrstatfoo_p *) sf; + + ath_collect(wf, &wf->total); +} + +static void +ath_update_tot(struct statfoo *sf) +{ + struct athaggrstatfoo_p *wf = (struct athaggrstatfoo_p *) sf; + + wf->total = wf->cur; +} + +static void +snprintrate(char b[], size_t bs, int rate) +{ + if (rate & IEEE80211_RATE_MCS) + snprintf(b, bs, "MCS%u", rate &~ IEEE80211_RATE_MCS); + else if (rate & 1) + snprintf(b, bs, "%u.5M", rate / 2); + else + snprintf(b, bs, "%uM", rate / 2); +} + +static int +ath_get_curstat(struct statfoo *sf, int s, char b[], size_t bs) +{ + struct athaggrstatfoo_p *wf = (struct athaggrstatfoo_p *) sf; +#define STAT(x) \ + snprintf(b, bs, "%u", wf->cur.aggr_##x - wf->total.aggr_##x); return 1 +#define PKT(x) \ + snprintf(b, bs, "%u", wf->cur.aggr_pkts[x] - wf->total.aggr_pkts[x]); return 1 + + switch (s) { + case S_SINGLE_PKT: STAT(single_pkt); + case S_NONBAW_PKT: STAT(nonbaw_pkt); + case S_AGGR_PKT: STAT(aggr_pkt); + case S_BAW_CLOSED_SINGLE_PKT: STAT(baw_closed_single_pkt); + case S_LOW_HWQ_SINGLE_PKT: STAT(low_hwq_single_pkt); + case S_SCHED_NOPKT: STAT(sched_nopkt); + case S_RTS_AGGR_LIMITED: STAT(rts_aggr_limited); + case S_PKT0: PKT(0); + case S_PKT1: PKT(1); + case S_PKT2: PKT(2); + case S_PKT3: PKT(3); + case S_PKT4: PKT(4); + case S_PKT5: PKT(5); + case S_PKT6: PKT(6); + case S_PKT7: PKT(7); + case S_PKT8: PKT(8); + case S_PKT9: PKT(9); + case S_PKT10: PKT(10); + case S_PKT11: PKT(11); + case S_PKT12: PKT(12); + case S_PKT13: PKT(13); + case S_PKT14: PKT(14); + case S_PKT15: PKT(15); + case S_PKT16: PKT(16); + case S_PKT17: PKT(17); + case S_PKT18: PKT(18); + case S_PKT19: PKT(19); + case S_PKT20: PKT(20); + case S_PKT21: PKT(21); + case S_PKT22: PKT(22); + case S_PKT23: PKT(23); + case S_PKT24: PKT(24); + case S_PKT25: PKT(25); + case S_PKT26: PKT(26); + case S_PKT27: PKT(27); + case S_PKT28: PKT(28); + case S_PKT29: PKT(29); + case S_PKT30: PKT(30); + case S_PKT31: PKT(31); + } + b[0] = '\0'; + return 0; +#undef PKT +#undef STAT +} + +static int +ath_get_totstat(struct statfoo *sf, int s, char b[], size_t bs) +{ + struct athaggrstatfoo_p *wf = (struct athaggrstatfoo_p *) sf; +#define STAT(x) \ + snprintf(b, bs, "%u", wf->total.aggr_##x); return 1 +#define PKT(x) \ + snprintf(b, bs, "%u", wf->total.aggr_pkts[x]); return 1 + + switch (s) { + case S_SINGLE_PKT: STAT(single_pkt); + case S_NONBAW_PKT: STAT(nonbaw_pkt); + case S_AGGR_PKT: STAT(aggr_pkt); + case S_BAW_CLOSED_SINGLE_PKT: STAT(baw_closed_single_pkt); + case S_LOW_HWQ_SINGLE_PKT: STAT(low_hwq_single_pkt); + case S_SCHED_NOPKT: STAT(sched_nopkt); + case S_RTS_AGGR_LIMITED: STAT(rts_aggr_limited); + case S_PKT0: PKT(0); + case S_PKT1: PKT(1); + case S_PKT2: PKT(2); + case S_PKT3: PKT(3); + case S_PKT4: PKT(4); + case S_PKT5: PKT(5); + case S_PKT6: PKT(6); + case S_PKT7: PKT(7); + case S_PKT8: PKT(8); + case S_PKT9: PKT(9); + case S_PKT10: PKT(10); + case S_PKT11: PKT(11); + case S_PKT12: PKT(12); + case S_PKT13: PKT(13); + case S_PKT14: PKT(14); + case S_PKT15: PKT(15); + case S_PKT16: PKT(16); + case S_PKT17: PKT(17); + case S_PKT18: PKT(18); + case S_PKT19: PKT(19); + case S_PKT20: PKT(20); + case S_PKT21: PKT(21); + case S_PKT22: PKT(22); + case S_PKT23: PKT(23); + case S_PKT24: PKT(24); + case S_PKT25: PKT(25); + case S_PKT26: PKT(26); + case S_PKT27: PKT(27); + case S_PKT28: PKT(28); + case S_PKT29: PKT(29); + case S_PKT30: PKT(30); + case S_PKT31: PKT(31); + } + b[0] = '\0'; + return 0; +#undef PKT +#undef STAT +} + +static void +ath_print_verbose(struct statfoo *sf, FILE *fd) +{ + struct athaggrstatfoo_p *wf = (struct athaggrstatfoo_p *) sf; + const struct fmt *f; + char s[32]; + const char *indent; + int i, width; + + width = 0; + for (i = 0; i < S_LAST; i++) { + f = &sf->stats[i]; + if (f->width > width) + width = f->width; + } + for (i = 0; i < S_LAST; i++) { + if (ath_get_totstat(sf, i, s, sizeof(s)) && strcmp(s, "0")) { + indent = ""; + fprintf(fd, "%s%-*s %s\n", indent, width, s, + athaggrstats[i].desc); + } + } + + fprintf(fd, "\nAggregate size profile:\n\n"); + for (i = 0; i < 64; i++) { + fprintf(fd, "%2d: %12u%s", + i, + wf->total.aggr_pkts[i], + (i % 4 == 3) ? "\n" : " "); + } + fprintf(fd, "\n"); +} + +STATFOO_DEFINE_BOUNCE(athaggrstatfoo) + +struct athaggrstatfoo * +athaggrstats_new(const char *ifname, const char *fmtstring) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + struct athaggrstatfoo_p *wf; + + wf = calloc(1, sizeof(struct athaggrstatfoo_p)); + if (wf != NULL) { + statfoo_init(&wf->base.base, "athaggrstats", + athaggrstats, N(athaggrstats)); + /* override base methods */ + wf->base.base.collect_cur = ath_collect_cur; + wf->base.base.collect_tot = ath_collect_tot; + wf->base.base.get_curstat = ath_get_curstat; + wf->base.base.get_totstat = ath_get_totstat; + wf->base.base.update_tot = ath_update_tot; + wf->base.base.print_verbose = ath_print_verbose; + + /* setup bounce functions for public methods */ + STATFOO_BOUNCE(wf, athaggrstatfoo); + + /* setup our public methods */ + wf->base.setifname = ath_setifname; +#if 0 + wf->base.setstamac = wlan_setstamac; +#endif + wf->base.zerostats = ath_zerostats; + wf->s = socket(AF_INET, SOCK_DGRAM, 0); + if (wf->s < 0) + err(1, "socket"); + + ath_setifname(&wf->base, ifname); + wf->base.setfmt(&wf->base, fmtstring); + } + return &wf->base; +#undef N +} Added: head/tools/tools/ath/athaggrstats/athaggrstats.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athaggrstats/athaggrstats.h Sun Jun 10 06:44:04 2012 (r236834) @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +#ifndef _ATHAGGRSTATS_H_ +#define _ATHAGGRSTATS_H_ + +#include "statfoo.h" + +/* + * ath statistics class. + */ +struct athaggrstatfoo { + struct statfoo base; + + STATFOO_DECL_METHODS(struct athaggrstatfoo *); + + /* set the network interface name for collection */ + void (*setifname)(struct athaggrstatfoo *, const char *ifname); + /* set the mac address of the associated station/ap */ + void (*setstamac)(struct athaggrstatfoo *, const uint8_t mac[]); + /* zero in-kernel statistics */ + void (*zerostats)(struct athaggrstatfoo *); +}; + +struct athaggrstatfoo *athaggrstats_new(const char *ifname, + const char *fmtstring); + +#endif /* _ATHAGGRSTATS_H_ */ Added: head/tools/tools/ath/athaggrstats/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athaggrstats/main.c Sun Jun 10 06:44:04 2012 (r236834) @@ -0,0 +1,159 @@ +/*- + * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting + * 2012, Adrian Chadd + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +/* + * Simple Atheros-specific tool to inspect and monitor software queue + * and aggregate statistics. + * + * athaggrstats [-i interface] [-bz] [-l] [-o fmtstring] [interval] + * + * (default interface is ath0). If interval is specified a rolling output + * a la netstat -i is displayed every interval seconds. The format of + * the rolling display can be controlled a la ps. The -l option will + * print a list of all possible statistics for use with the -o option. + */ + +#include +#include +#include +#include +#include +#include + +#include "athaggrstats.h" + +static struct { + const char *tag; + const char *fmt; +} tags[] = { + { "default", + "singlepkt,nonbawpkt,aggrpkt,bawclosedpkt,lhsinglepkt,schednopkt,rtsaggrlimit" + }, +}; + +static const char * +getfmt(const char *tag) +{ +#define N(a) (sizeof(a)/sizeof(a[0])) + int i; + for (i = 0; i < N(tags); i++) + if (strcasecmp(tags[i].tag, tag) == 0) + return tags[i].fmt; + return tag; +#undef N +} + +static int signalled; + +static void +catchalarm(int signo __unused) +{ + signalled = 1; +} + +int +main(int argc, char *argv[]) +{ + struct athaggrstatfoo *wf; + const char *ifname; + int c, banner = 1; + + ifname = getenv("ATH"); + if (ifname == NULL) + ifname = "ath0"; + wf = athaggrstats_new(ifname, getfmt("default")); + while ((c = getopt(argc, argv, "bi:lo:z")) != -1) { + switch (c) { + case 'b': + banner = 0; + break; + case 'i': + wf->setifname(wf, optarg); + break; + case 'l': + wf->print_fields(wf, stdout); + return 0; + case 'o': + wf->setfmt(wf, getfmt(optarg)); + break; + case 'z': + wf->zerostats(wf); + break; + default: + errx(-1, "usage: %s [-a] [-i ifname] [-l] [-o fmt] [-z] [interval]\n", argv[0]); + /*NOTREACHED*/ + } + } + argc -= optind; + argv += optind; + + if (argc > 0) { + u_long interval = strtoul(argv[0], NULL, 0); + int line, omask; + + if (interval < 1) + interval = 1; + signal(SIGALRM, catchalarm); + signalled = 0; + alarm(interval); + banner: + if (banner) + wf->print_header(wf, stdout); + line = 0; + loop: + if (line != 0) { + wf->collect_cur(wf); + wf->print_current(wf, stdout); + wf->update_tot(wf); + } else { + wf->collect_tot(wf); + wf->print_total(wf, stdout); + } + fflush(stdout); + omask = sigblock(sigmask(SIGALRM)); + if (!signalled) + sigpause(0); + sigsetmask(omask); + signalled = 0; + alarm(interval); + line++; + if (line == 21) /* XXX tty line count */ + goto banner; + else + goto loop; + /*NOTREACHED*/ + } else { + wf->collect_tot(wf); + wf->print_verbose(wf, stdout); + } + return 0; +} Added: head/tools/tools/ath/athaggrstats/statfoo.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athaggrstats/statfoo.c Sun Jun 10 06:44:04 2012 (r236834) @@ -0,0 +1,206 @@ +/*- + * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +#include +#include + +#include "statfoo.h" + +static void +statfoo_setfmt(struct statfoo *sf, const char *fmt0) +{ +#define N(a) (sizeof(a)/sizeof(a[0])) + char fmt[4096]; + char *fp, *tok; + int i, j; + + j = 0; + strlcpy(fmt, fmt0, sizeof(fmt)); + for (fp = fmt; (tok = strsep(&fp, ", ")) != NULL;) { + for (i = 0; i < sf->nstats; i++) + if (strcasecmp(tok, sf->stats[i].name) == 0) + break; + if (i >= sf->nstats) { + fprintf(stderr, "%s: unknown statistic name \"%s\" " + "skipped\n", sf->name, tok); + continue; + } + if (j+3 > sizeof(sf->fmts)) { + fprintf(stderr, "%s: not enough room for all stats; " + "stopped at %s\n", sf->name, tok); + break; + } + if (j != 0) + sf->fmts[j++] = ' '; + sf->fmts[j++] = FMTS_IS_STAT; + sf->fmts[j++] = i & 0xff; + sf->fmts[j++] = (i >> 8) & 0xff; + } + sf->fmts[j] = '\0'; +#undef N +} + +static void +statfoo_collect(struct statfoo *sf) +{ + fprintf(stderr, "%s: don't know how to collect data\n", sf->name); +} + +static void +statfoo_update_tot(struct statfoo *sf) +{ + fprintf(stderr, "%s: don't know how to update total data\n", sf->name); +} + +static int +statfoo_get(struct statfoo *sf, int s, char b[], size_t bs) +{ + fprintf(stderr, "%s: don't know how to get stat #%u\n", sf->name, s); + return 0; +} + +static void +statfoo_print_header(struct statfoo *sf, FILE *fd) +{ + const unsigned char *cp; + int i; + const struct fmt *f; + + for (cp = sf->fmts; *cp != '\0'; cp++) { + if (*cp == FMTS_IS_STAT) { + i = *(++cp); + i |= ((int) *(++cp)) << 8; + f = &sf->stats[i]; + fprintf(fd, "%*s", f->width, f->label); + } else + putc(*cp, fd); + } + putc('\n', fd); +} + +static void +statfoo_print_current(struct statfoo *sf, FILE *fd) +{ + char buf[32]; + const unsigned char *cp; + int i; + const struct fmt *f; + + for (cp = sf->fmts; *cp != '\0'; cp++) { + if (*cp == FMTS_IS_STAT) { + i = *(++cp); + i |= ((int) *(++cp)) << 8; + f = &sf->stats[i]; + if (sf->get_curstat(sf, i, buf, sizeof(buf))) + fprintf(fd, "%*s", f->width, buf); + } else + putc(*cp, fd); + } + putc('\n', fd); +} + +static void +statfoo_print_total(struct statfoo *sf, FILE *fd) +{ + char buf[32]; + const unsigned char *cp; + const struct fmt *f; + int i; + + for (cp = sf->fmts; *cp != '\0'; cp++) { + if (*cp == FMTS_IS_STAT) { + i = *(++cp); + i |= ((int) *(++cp)) << 8; + f = &sf->stats[i]; + if (sf->get_totstat(sf, i, buf, sizeof(buf))) + fprintf(fd, "%*s", f->width, buf); + } else + putc(*cp, fd); + } + putc('\n', fd); +} + +static void +statfoo_print_verbose(struct statfoo *sf, FILE *fd) +{ + const struct fmt *f; + char s[32]; + int i, width; + + width = 0; + for (i = 0; i < sf->nstats; i++) { + f = &sf->stats[i]; + if (f->width > width) + width = f->width; + } + for (i = 0; i < sf->nstats; i++) { + f = &sf->stats[i]; + if (sf->get_totstat(sf, i, s, sizeof(s)) && strcmp(s, "0")) + fprintf(fd, "%-*s %s\n", width, s, f->desc); + } +} + +static void +statfoo_print_fields(struct statfoo *sf, FILE *fd) +{ + int i, w, width; + + width = 0; + for (i = 0; i < sf->nstats; i++) { + w = strlen(sf->stats[i].name); + if (w > width) + width = w; + } + for (i = 0; i < sf->nstats; i++) { + const struct fmt *f = &sf->stats[i]; + if (f->width != 0) + fprintf(fd, "%-*s %s\n", width, f->name, f->desc); + } +} + +void +statfoo_init(struct statfoo *sf, const char *name, const struct fmt *stats, int nstats) +{ + sf->name = name; + sf->stats = stats; + sf->nstats = nstats; + sf->setfmt = statfoo_setfmt; + sf->collect_cur = statfoo_collect; + sf->collect_tot = statfoo_collect; + sf->update_tot = statfoo_update_tot; + sf->get_curstat = statfoo_get; + sf->get_totstat = statfoo_get; + sf->print_header = statfoo_print_header; + sf->print_current = statfoo_print_current; + sf->print_total = statfoo_print_total; + sf->print_verbose = statfoo_print_verbose; + sf->print_fields = statfoo_print_fields; +} Added: head/tools/tools/ath/athaggrstats/statfoo.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/tools/ath/athaggrstats/statfoo.h Sun Jun 10 06:44:04 2012 (r236834) @@ -0,0 +1,128 @@ +/*- + * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ + +#ifndef _STATFOO_H_ +#define _STATFOO_H_ +/* + * Base class for managing+displaying periodically collected statistics. + */ + +/* + * Statistic definition/description. The are defined + * for stats that correspond 1-1 w/ a collected stat + * and for stats that are calculated indirectly. + */ +struct fmt { + int width; /* printed field width */ + const char* name; /* stat field name referenced by user */ + const char* label; /* printed header label */ + const char* desc; /* verbose description */ +}; + +#define STATFOO_DECL_METHODS(_p) \ + /* set the format of the statistics to display */ \ + void (*setfmt)(_p, const char *); \ + /* collect+store ``current statistics'' */ \ + void (*collect_cur)(_p); \ + /* collect+store ``total statistics'' */ \ + void (*collect_tot)(_p); \ + /* update ``total statistics'' if necessary from current */ \ + void (*update_tot)(_p); \ + /* format a statistic from the current stats */ \ + int (*get_curstat)(_p, int, char [], size_t); \ + /* format a statistic from the total stats */ \ + int (*get_totstat)(_p, int, char [], size_t); \ + /* print field headers terminated by a \n */ \ + void (*print_header)(_p, FILE *); \ + /* print current statistics terminated by a \n */ \ + void (*print_current)(_p, FILE *); \ + /* print total statistics terminated by a \n */ \ + void (*print_total)(_p, FILE *); \ + /* print total statistics in a verbose (1 stat/line) format */ \ + void (*print_verbose)(_p, FILE *); \ + /* print available statistics */ \ + void (*print_fields)(_p, FILE *) + +/* + * Statistics base class. This class is not usable; only + * classes derived from it are useful. + */ +struct statfoo { + const char *name; /* statistics name, e.g. wlanstats */ + const struct fmt *stats; /* statistics in class */ + int nstats; /* number of stats */ +#define FMTS_IS_STAT 0x80 /* the following two bytes are the stat id */ + unsigned char fmts[4096]; /* private: compiled stats to display */ + + STATFOO_DECL_METHODS(struct statfoo *); +}; + +void statfoo_init(struct statfoo *, const char *name, + const struct fmt *stats, int nstats); + +#define STATFOO_DEFINE_BOUNCE(_t) \ +static void _t##_setfmt(struct _t *wf, const char *fmt0) \ + { wf->base.setfmt(&wf->base, fmt0); } \ +static void _t##_collect_cur(struct _t *wf) \ + { wf->base.collect_cur(&wf->base); } \ +static void _t##_collect_tot(struct _t *wf) \ + { wf->base.collect_tot(&wf->base); } \ +static void _t##_update_tot(struct _t *wf) \ + { wf->base.update_tot(&wf->base); } \ +static int _t##_get_curstat(struct _t *wf, int s, char b[], size_t bs) \ + { return wf->base.get_curstat(&wf->base, s, b, bs); } \ +static int _t##_get_totstat(struct _t *wf, int s, char b[], size_t bs) \ + { return wf->base.get_totstat(&wf->base, s, b, bs); } \ +static void _t##_print_header(struct _t *wf, FILE *fd) \ + { wf->base.print_header(&wf->base, fd); } \ +static void _t##_print_current(struct _t *wf, FILE *fd) \ + { wf->base.print_current(&wf->base, fd); } \ +static void _t##_print_total(struct _t *wf, FILE *fd) \ + { wf->base.print_total(&wf->base, fd); } \ +static void _t##_print_verbose(struct _t *wf, FILE *fd) \ + { wf->base.print_verbose(&wf->base, fd); } \ +static void _t##_print_fields(struct _t *wf, FILE *fd) \ + { wf->base.print_fields(&wf->base, fd); } + +#define STATFOO_BOUNCE(_p, _t) do { \ + _p->base.setfmt = _t##_setfmt; \ + _p->base.collect_cur = _t##_collect_cur; \ + _p->base.collect_tot = _t##_collect_tot; \ + _p->base.update_tot = _t##_update_tot; \ + _p->base.get_curstat = _t##_get_curstat; \ + _p->base.get_totstat = _t##_get_totstat; \ + _p->base.print_header = _t##_print_header; \ + _p->base.print_current = _t##_print_current; \ + _p->base.print_total = _t##_print_total; \ + _p->base.print_verbose = _t##_print_verbose; \ + _p->base.print_fields = _t##_print_fields; \ +} while (0) +#endif /* _STATFOO_H_ */ From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 06:44:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 511201065686; Sun, 10 Jun 2012 06:44:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C4D68FC12; Sun, 10 Jun 2012 06:44:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A6iKfb078371; Sun, 10 Jun 2012 06:44:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A6iKOp078369; Sun, 10 Jun 2012 06:44:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206100644.q5A6iKOp078369@svn.freebsd.org> From: Adrian Chadd Date: Sun, 10 Jun 2012 06:44:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236835 - head/tools/tools/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 06:44:20 -0000 Author: adrian Date: Sun Jun 10 06:44:19 2012 New Revision: 236835 URL: http://svn.freebsd.org/changeset/base/236835 Log: Add athaggrstats to the ath(4) tools build. Modified: head/tools/tools/ath/Makefile Modified: head/tools/tools/ath/Makefile ============================================================================== --- head/tools/tools/ath/Makefile Sun Jun 10 06:44:04 2012 (r236834) +++ head/tools/tools/ath/Makefile Sun Jun 10 06:44:19 2012 (r236835) @@ -1,7 +1,7 @@ # $FreeBSD$ SUBDIR= arcode athdebug athdecode athkey athpoke athprom athrd athregs -SUBDIR+= athstats ath_prom_read athradar +SUBDIR+= athstats ath_prom_read athradar athaggrstats SUBDIR+= ath_ee_v14_print ath_ee_v4k_print ath_ee_9287_print SUBDIR+= athsurvey From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 07:23:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77378106566B; Sun, 10 Jun 2012 07:23:45 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 604858FC08; Sun, 10 Jun 2012 07:23:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A7Njww080133; Sun, 10 Jun 2012 07:23:45 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A7NjaC080129; Sun, 10 Jun 2012 07:23:45 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206100723.q5A7NjaC080129@svn.freebsd.org> From: Martin Matuska Date: Sun, 10 Jun 2012 07:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236837 - in stable/9/cddl/contrib/opensolaris: cmd/ztest lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 07:23:45 -0000 Author: mm Date: Sun Jun 10 07:23:45 2012 New Revision: 236837 URL: http://svn.freebsd.org/changeset/base/236837 Log: MFC r236143, r236705: MFC r236143 [1]: Import illumos changeset 13571:a5771a96228c 1950 ztest backwards compatibility testing option MFC r236705 [2]: Import Illumos revision 13715:351036203e4b 2803 zfs get guid pretty-prints the output References: https://www.illumos.org/issues/1950 [1] https://www.illumos.org/issues/2803 [2] Obtained from: illumos (issue #1950 [1], #2803 [2]) Modified: stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Jun 10 07:15:13 2012 (r236836) +++ stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Jun 10 07:23:45 2012 (r236837) @@ -20,8 +20,9 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012 Martin Matuska . All rights reserved. */ /* @@ -51,7 +52,9 @@ * At random times, the child self-immolates with a SIGKILL. * This is the software equivalent of pulling the power cord. * The parent then runs the test again, using the existing - * storage pool, as many times as desired. + * storage pool, as many times as desired. If backwards compatability + * testing is enabled ztest will sometimes run the "older" version + * of ztest after a SIGKILL. * * (6) To verify that we don't have future leaks or temporal incursions, * many of the functional tests record the transaction group number @@ -68,9 +71,15 @@ * You can ask more more vdevs [-v], datasets [-d], or threads [-t] * to increase the pool capacity, fanout, and overall stress level. * - * The -N(okill) option will suppress kills, so each child runs to completion. - * This can be useful when you're trying to distinguish temporal incursions - * from plain old race conditions. + * Use the -k option to set the desired frequency of kills. + * + * When ztest invokes itself it passes all relevant information through a + * temporary file which is mmap-ed in the child process. This allows shared + * memory to survive the exec syscall. The ztest_shared_hdr_t struct is always + * stored at offset 0 of this file and contains information on the size and + * number of shared structures in the file. The information stored in this file + * must remain backwards compatible with older versions of ztest so that + * ztest can invoke them during backwards compatibility testing (-B). */ #include @@ -111,29 +120,82 @@ #include #include -static char cmdname[] = "ztest"; -static char *zopt_pool = cmdname; -static char *progname; - -static uint64_t zopt_vdevs = 5; -static uint64_t zopt_vdevtime; -static int zopt_ashift = SPA_MINBLOCKSHIFT; -static int zopt_mirrors = 2; -static int zopt_raidz = 4; -static int zopt_raidz_parity = 1; -static size_t zopt_vdev_size = SPA_MINDEVSIZE; -static int zopt_datasets = 7; -static int zopt_threads = 23; -static uint64_t zopt_passtime = 60; /* 60 seconds */ -static uint64_t zopt_killrate = 70; /* 70% kill rate */ -static int zopt_verbose = 0; -static int zopt_init = 1; -static char *zopt_dir = "/tmp"; -static uint64_t zopt_time = 300; /* 5 minutes */ -static uint64_t zopt_maxloops = 50; /* max loops during spa_freeze() */ +#define ZTEST_FD_DATA 3 +#define ZTEST_FD_RAND 4 + +typedef struct ztest_shared_hdr { + uint64_t zh_hdr_size; + uint64_t zh_opts_size; + uint64_t zh_size; + uint64_t zh_stats_size; + uint64_t zh_stats_count; + uint64_t zh_ds_size; + uint64_t zh_ds_count; +} ztest_shared_hdr_t; + +static ztest_shared_hdr_t *ztest_shared_hdr; + +typedef struct ztest_shared_opts { + char zo_pool[MAXNAMELEN]; + char zo_dir[MAXNAMELEN]; + char zo_alt_ztest[MAXNAMELEN]; + char zo_alt_libpath[MAXNAMELEN]; + uint64_t zo_vdevs; + uint64_t zo_vdevtime; + size_t zo_vdev_size; + int zo_ashift; + int zo_mirrors; + int zo_raidz; + int zo_raidz_parity; + int zo_datasets; + int zo_threads; + uint64_t zo_passtime; + uint64_t zo_killrate; + int zo_verbose; + int zo_init; + uint64_t zo_time; + uint64_t zo_maxloops; + uint64_t zo_metaslab_gang_bang; +} ztest_shared_opts_t; + +static const ztest_shared_opts_t ztest_opts_defaults = { + .zo_pool = { 'z', 't', 'e', 's', 't', '\0' }, + .zo_dir = { '/', 't', 'm', 'p', '\0' }, + .zo_alt_ztest = { '\0' }, + .zo_alt_libpath = { '\0' }, + .zo_vdevs = 5, + .zo_ashift = SPA_MINBLOCKSHIFT, + .zo_mirrors = 2, + .zo_raidz = 4, + .zo_raidz_parity = 1, + .zo_vdev_size = SPA_MINDEVSIZE, + .zo_datasets = 7, + .zo_threads = 23, + .zo_passtime = 60, /* 60 seconds */ + .zo_killrate = 70, /* 70% kill rate */ + .zo_verbose = 0, + .zo_init = 1, + .zo_time = 300, /* 5 minutes */ + .zo_maxloops = 50, /* max loops during spa_freeze() */ + .zo_metaslab_gang_bang = 32 << 10 +}; + +extern uint64_t metaslab_gang_bang; +extern uint64_t metaslab_df_alloc_threshold; + +static ztest_shared_opts_t *ztest_shared_opts; +static ztest_shared_opts_t ztest_opts; + +typedef struct ztest_shared_ds { + uint64_t zd_seq; +} ztest_shared_ds_t; + +static ztest_shared_ds_t *ztest_shared_ds; +#define ZTEST_GET_SHARED_DS(d) (&ztest_shared_ds[d]) #define BT_MAGIC 0x123456789abcdefULL -#define MAXFAULTS() (MAX(zs->zs_mirrors, 1) * (zopt_raidz_parity + 1) - 1) +#define MAXFAULTS() \ + (MAX(zs->zs_mirrors, 1) * (ztest_opts.zo_raidz_parity + 1) - 1) enum ztest_io_type { ZTEST_IO_WRITE_TAG, @@ -205,10 +267,10 @@ typedef struct ztest_od { * Per-dataset state. */ typedef struct ztest_ds { + ztest_shared_ds_t *zd_shared; objset_t *zd_os; rwlock_t zd_zilog_lock; zilog_t *zd_zilog; - uint64_t zd_seq; ztest_od_t *zd_od; /* debugging aid */ char zd_name[MAXNAMELEN]; mutex_t zd_dirobj_lock; @@ -225,11 +287,17 @@ typedef struct ztest_info { ztest_func_t *zi_func; /* test function */ uint64_t zi_iters; /* iterations per execution */ uint64_t *zi_interval; /* execute every seconds */ - uint64_t zi_call_count; /* per-pass count */ - uint64_t zi_call_time; /* per-pass time */ - uint64_t zi_call_next; /* next time to call this function */ } ztest_info_t; +typedef struct ztest_shared_callstate { + uint64_t zc_count; /* per-pass count */ + uint64_t zc_time; /* per-pass time */ + uint64_t zc_next; /* next time to call this function */ +} ztest_shared_callstate_t; + +static ztest_shared_callstate_t *ztest_shared_callstate; +#define ZTEST_GET_SHARED_CALLSTATE(c) (&ztest_shared_callstate[c]) + /* * Note: these aren't static because we want dladdr() to work. */ @@ -297,8 +365,10 @@ ztest_info_t ztest_info[] = { { ztest_dsl_dataset_promote_busy, 1, &zopt_rarely }, { ztest_vdev_attach_detach, 1, &zopt_rarely }, { ztest_vdev_LUN_growth, 1, &zopt_rarely }, - { ztest_vdev_add_remove, 1, &zopt_vdevtime }, - { ztest_vdev_aux_add_remove, 1, &zopt_vdevtime }, + { ztest_vdev_add_remove, 1, + &ztest_opts.zo_vdevtime }, + { ztest_vdev_aux_add_remove, 1, + &ztest_opts.zo_vdevtime }, }; #define ZTEST_FUNCS (sizeof (ztest_info) / sizeof (ztest_info_t)) @@ -316,8 +386,7 @@ typedef struct ztest_cb_list { * Stuff we need to share writably between parent and child. */ typedef struct ztest_shared { - char *zs_pool; - spa_t *zs_spa; + boolean_t zs_do_init; hrtime_t zs_proc_start; hrtime_t zs_proc_stop; hrtime_t zs_thread_start; @@ -328,13 +397,11 @@ typedef struct ztest_shared { uint64_t zs_vdev_aux; uint64_t zs_alloc; uint64_t zs_space; - uint64_t zs_guid; - mutex_t zs_vdev_lock; - rwlock_t zs_name_lock; - ztest_info_t zs_info[ZTEST_FUNCS]; uint64_t zs_splits; uint64_t zs_mirrors; - ztest_ds_t zs_zd[]; + uint64_t zs_metaslab_sz; + uint64_t zs_metaslab_df_alloc_threshold; + uint64_t zs_guid; } ztest_shared_t; #define ID_PARALLEL -1ULL @@ -342,20 +409,19 @@ typedef struct ztest_shared { static char ztest_dev_template[] = "%s/%s.%llua"; static char ztest_aux_template[] = "%s/%s.%s.%llu"; ztest_shared_t *ztest_shared; -uint64_t *ztest_seq; -static int ztest_random_fd; -static int ztest_dump_core = 1; +static spa_t *ztest_spa = NULL; +static ztest_ds_t *ztest_ds; +static mutex_t ztest_vdev_lock; +static rwlock_t ztest_name_lock; + +static boolean_t ztest_dump_core = B_TRUE; static boolean_t ztest_exiting; /* Global commit callback list */ static ztest_cb_list_t zcl; -extern uint64_t metaslab_gang_bang; -extern uint64_t metaslab_df_alloc_threshold; -static uint64_t metaslab_sz; - enum ztest_object { ZTEST_META_DNODE = 0, ZTEST_DIROBJ, @@ -468,12 +534,14 @@ nicenumtoull(const char *buf) static void usage(boolean_t requested) { + const ztest_shared_opts_t *zo = &ztest_opts_defaults; + char nice_vdev_size[10]; char nice_gang_bang[10]; FILE *fp = requested ? stdout : stderr; - nicenum(zopt_vdev_size, nice_vdev_size); - nicenum(metaslab_gang_bang, nice_gang_bang); + nicenum(zo->zo_vdev_size, nice_vdev_size); + nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang); (void) fprintf(fp, "Usage: %s\n" "\t[-v vdevs (default: %llu)]\n" @@ -494,42 +562,43 @@ usage(boolean_t requested) "\t[-T time (default: %llu sec)] total run time\n" "\t[-F freezeloops (default: %llu)] max loops in spa_freeze()\n" "\t[-P passtime (default: %llu sec)] time per pass\n" + "\t[-B alt_ztest (default: )] alternate ztest path\n" "\t[-h] (print help)\n" "", - cmdname, - (u_longlong_t)zopt_vdevs, /* -v */ + zo->zo_pool, + (u_longlong_t)zo->zo_vdevs, /* -v */ nice_vdev_size, /* -s */ - zopt_ashift, /* -a */ - zopt_mirrors, /* -m */ - zopt_raidz, /* -r */ - zopt_raidz_parity, /* -R */ - zopt_datasets, /* -d */ - zopt_threads, /* -t */ + zo->zo_ashift, /* -a */ + zo->zo_mirrors, /* -m */ + zo->zo_raidz, /* -r */ + zo->zo_raidz_parity, /* -R */ + zo->zo_datasets, /* -d */ + zo->zo_threads, /* -t */ nice_gang_bang, /* -g */ - zopt_init, /* -i */ - (u_longlong_t)zopt_killrate, /* -k */ - zopt_pool, /* -p */ - zopt_dir, /* -f */ - (u_longlong_t)zopt_time, /* -T */ - (u_longlong_t)zopt_maxloops, /* -F */ - (u_longlong_t)zopt_passtime); /* -P */ + zo->zo_init, /* -i */ + (u_longlong_t)zo->zo_killrate, /* -k */ + zo->zo_pool, /* -p */ + zo->zo_dir, /* -f */ + (u_longlong_t)zo->zo_time, /* -T */ + (u_longlong_t)zo->zo_maxloops, /* -F */ + (u_longlong_t)zo->zo_passtime); exit(requested ? 0 : 1); } static void process_options(int argc, char **argv) { + char *path; + ztest_shared_opts_t *zo = &ztest_opts; + int opt; uint64_t value; + char altdir[MAXNAMELEN] = { 0 }; - /* Remember program name. */ - progname = argv[0]; - - /* By default, test gang blocks for blocks 32K and greater */ - metaslab_gang_bang = 32 << 10; + bcopy(&ztest_opts_defaults, zo, sizeof (*zo)); while ((opt = getopt(argc, argv, - "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:")) != EOF) { + "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:B:")) != EOF) { value = 0; switch (opt) { case 'v': @@ -550,58 +619,71 @@ process_options(int argc, char **argv) } switch (opt) { case 'v': - zopt_vdevs = value; + zo->zo_vdevs = value; break; case 's': - zopt_vdev_size = MAX(SPA_MINDEVSIZE, value); + zo->zo_vdev_size = MAX(SPA_MINDEVSIZE, value); break; case 'a': - zopt_ashift = value; + zo->zo_ashift = value; break; case 'm': - zopt_mirrors = value; + zo->zo_mirrors = value; break; case 'r': - zopt_raidz = MAX(1, value); + zo->zo_raidz = MAX(1, value); break; case 'R': - zopt_raidz_parity = MIN(MAX(value, 1), 3); + zo->zo_raidz_parity = MIN(MAX(value, 1), 3); break; case 'd': - zopt_datasets = MAX(1, value); + zo->zo_datasets = MAX(1, value); break; case 't': - zopt_threads = MAX(1, value); + zo->zo_threads = MAX(1, value); break; case 'g': - metaslab_gang_bang = MAX(SPA_MINBLOCKSIZE << 1, value); + zo->zo_metaslab_gang_bang = MAX(SPA_MINBLOCKSIZE << 1, + value); break; case 'i': - zopt_init = value; + zo->zo_init = value; break; case 'k': - zopt_killrate = value; + zo->zo_killrate = value; break; case 'p': - zopt_pool = strdup(optarg); + (void) strlcpy(zo->zo_pool, optarg, + sizeof (zo->zo_pool)); break; case 'f': - zopt_dir = strdup(optarg); + path = realpath(optarg, NULL); + if (path == NULL) { + (void) fprintf(stderr, "error: %s: %s\n", + optarg, strerror(errno)); + usage(B_FALSE); + } else { + (void) strlcpy(zo->zo_dir, path, + sizeof (zo->zo_dir)); + } break; case 'V': - zopt_verbose++; + zo->zo_verbose++; break; case 'E': - zopt_init = 0; + zo->zo_init = 0; break; case 'T': - zopt_time = value; + zo->zo_time = value; break; case 'P': - zopt_passtime = MAX(1, value); + zo->zo_passtime = MAX(1, value); break; case 'F': - zopt_maxloops = MAX(1, value); + zo->zo_maxloops = MAX(1, value); + break; + case 'B': + (void) strlcpy(altdir, optarg, sizeof (altdir)); break; case 'h': usage(B_TRUE); @@ -613,17 +695,59 @@ process_options(int argc, char **argv) } } - zopt_raidz_parity = MIN(zopt_raidz_parity, zopt_raidz - 1); + zo->zo_raidz_parity = MIN(zo->zo_raidz_parity, zo->zo_raidz - 1); - zopt_vdevtime = (zopt_vdevs > 0 ? zopt_time * NANOSEC / zopt_vdevs : + zo->zo_vdevtime = + (zo->zo_vdevs > 0 ? zo->zo_time * NANOSEC / zo->zo_vdevs : UINT64_MAX >> 2); + + if (strlen(altdir) > 0) { + char cmd[MAXNAMELEN]; + char realaltdir[MAXNAMELEN]; + char *bin; + char *ztest; + char *isa; + int isalen; + + (void) realpath(getexecname(), cmd); + if (0 != access(altdir, F_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate ztest path: %s", + altdir); + } + VERIFY(NULL != realpath(altdir, realaltdir)); + + /* + * 'cmd' should be of the form "/usr/bin//ztest". + * We want to extract to determine if we should use + * 32 or 64 bit binaries. + */ + bin = strstr(cmd, "/usr/bin/"); + ztest = strstr(bin, "/ztest"); + isa = bin + 9; + isalen = ztest - isa; + (void) snprintf(zo->zo_alt_ztest, sizeof (zo->zo_alt_ztest), + "%s/usr/bin/%.*s/ztest", realaltdir, isalen, isa); + (void) snprintf(zo->zo_alt_libpath, sizeof (zo->zo_alt_libpath), + "%s/usr/lib/%.*s", realaltdir, isalen, isa); + + if (0 != access(zo->zo_alt_ztest, X_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate ztest: %s", + zo->zo_alt_ztest); + } else if (0 != access(zo->zo_alt_libpath, X_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate lib directory %s", + zo->zo_alt_libpath); + } + } } static void ztest_kill(ztest_shared_t *zs) { - zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(zs->zs_spa)); - zs->zs_space = metaslab_class_get_space(spa_normal_class(zs->zs_spa)); + zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(ztest_spa)); + zs->zs_space = metaslab_class_get_space(spa_normal_class(ztest_spa)); (void) kill(getpid(), SIGKILL); } @@ -635,7 +759,7 @@ ztest_random(uint64_t range) if (range == 0) return (0); - if (read(ztest_random_fd, &r, sizeof (r)) != sizeof (r)) + if (read(ZTEST_FD_RAND, &r, sizeof (r)) != sizeof (r)) fatal(1, "short read from /dev/urandom"); return (r % range); @@ -651,9 +775,9 @@ ztest_record_enospc(const char *s) static uint64_t ztest_get_ashift(void) { - if (zopt_ashift == 0) + if (ztest_opts.zo_ashift == 0) return (SPA_MINBLOCKSHIFT + ztest_random(3)); - return (zopt_ashift); + return (ztest_opts.zo_ashift); } static nvlist_t * @@ -671,12 +795,14 @@ make_vdev_file(char *path, char *aux, si if (aux != NULL) { vdev = ztest_shared->zs_vdev_aux; - (void) sprintf(path, ztest_aux_template, - zopt_dir, zopt_pool, aux, vdev); + (void) snprintf(path, sizeof (pathbuf), + ztest_aux_template, ztest_opts.zo_dir, + ztest_opts.zo_pool, aux, vdev); } else { vdev = ztest_shared->zs_vdev_next_leaf++; - (void) sprintf(path, ztest_dev_template, - zopt_dir, zopt_pool, vdev); + (void) snprintf(path, sizeof (pathbuf), + ztest_dev_template, ztest_opts.zo_dir, + ztest_opts.zo_pool, vdev); } } @@ -714,7 +840,7 @@ make_vdev_raidz(char *path, char *aux, s VERIFY(nvlist_add_string(raidz, ZPOOL_CONFIG_TYPE, VDEV_TYPE_RAIDZ) == 0); VERIFY(nvlist_add_uint64(raidz, ZPOOL_CONFIG_NPARITY, - zopt_raidz_parity) == 0); + ztest_opts.zo_raidz_parity) == 0); VERIFY(nvlist_add_nvlist_array(raidz, ZPOOL_CONFIG_CHILDREN, child, r) == 0); @@ -852,7 +978,7 @@ ztest_dsl_prop_set_uint64(char *osname, VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval), 1, &curval, setpoint), ==, 0); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { VERIFY(zfs_prop_index_to_string(prop, curval, &valname) == 0); (void) printf("%s %s = %s at '%s'\n", osname, propname, valname, setpoint); @@ -862,9 +988,9 @@ ztest_dsl_prop_set_uint64(char *osname, } static int -ztest_spa_prop_set_uint64(ztest_shared_t *zs, zpool_prop_t prop, uint64_t value) +ztest_spa_prop_set_uint64(zpool_prop_t prop, uint64_t value) { - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; nvlist_t *props = NULL; int error; @@ -986,13 +1112,16 @@ ztest_range_unlock(rl_t *rl) } static void -ztest_zd_init(ztest_ds_t *zd, objset_t *os) +ztest_zd_init(ztest_ds_t *zd, ztest_shared_ds_t *szd, objset_t *os) { zd->zd_os = os; zd->zd_zilog = dmu_objset_zil(os); - zd->zd_seq = 0; + zd->zd_shared = szd; dmu_objset_name(os, zd->zd_name); + if (zd->zd_shared != NULL) + zd->zd_shared->zd_seq = 0; + VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); @@ -2076,8 +2205,9 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ * will verify that the log really does contain this record. */ mutex_enter(&zilog->zl_lock); - ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); - zd->zd_seq = zilog->zl_commit_lr_seq; + ASSERT(zd->zd_shared != NULL); + ASSERT3U(zd->zd_shared->zd_seq, <=, zilog->zl_commit_lr_seq); + zd->zd_shared->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); (void) rw_unlock(&zd->zd_zilog_lock); @@ -2114,7 +2244,7 @@ ztest_zil_remount(ztest_ds_t *zd, uint64 void ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; + ztest_shared_opts_t *zo = &ztest_opts; spa_t *spa; nvlist_t *nvroot; @@ -2138,15 +2268,15 @@ ztest_spa_create_destroy(ztest_ds_t *zd, * Attempt to create an existing pool. It shouldn't matter * what's in the nvroot; we should fail with EEXIST. */ - (void) rw_rdlock(&zs->zs_name_lock); + (void) rw_rdlock(&ztest_name_lock); nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); - VERIFY3U(EEXIST, ==, spa_create(zs->zs_pool, nvroot, NULL, NULL, NULL)); + VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL)); nvlist_free(nvroot); - VERIFY3U(0, ==, spa_open(zs->zs_pool, &spa, FTAG)); - VERIFY3U(EBUSY, ==, spa_destroy(zs->zs_pool)); + VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG)); + VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool)); spa_close(spa, FTAG); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); } static vdev_t * @@ -2193,14 +2323,15 @@ void ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; uint64_t leaves; uint64_t guid; nvlist_t *nvroot; int error; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); - leaves = MAX(zs->zs_mirrors + zs->zs_splits, 1) * zopt_raidz; + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + leaves = + MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz; spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2225,9 +2356,9 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui * dmu_objset_destroy() to fail with EBUSY thus * leaving the dataset in an inconsistent state. */ - VERIFY(rw_wrlock(&ztest_shared->zs_name_lock) == 0); + VERIFY(rw_wrlock(&ztest_name_lock) == 0); error = spa_vdev_remove(spa, guid, B_FALSE); - VERIFY(rw_unlock(&ztest_shared->zs_name_lock) == 0); + VERIFY(rw_unlock(&ztest_name_lock) == 0); if (error && error != EEXIST) fatal(0, "spa_vdev_remove() = %d", error); @@ -2237,8 +2368,10 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui /* * Make 1/4 of the devices be log devices. */ - nvroot = make_vdev_root(NULL, NULL, zopt_vdev_size, 0, - ztest_random(4) == 0, zopt_raidz, zs->zs_mirrors, 1); + nvroot = make_vdev_root(NULL, NULL, + ztest_opts.zo_vdev_size, 0, + ztest_random(4) == 0, ztest_opts.zo_raidz, + zs->zs_mirrors, 1); error = spa_vdev_add(spa, nvroot); nvlist_free(nvroot); @@ -2249,7 +2382,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui fatal(0, "spa_vdev_add() = %d", error); } - VERIFY(mutex_unlock(&ztest_shared->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2260,7 +2393,7 @@ void ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *rvd = spa->spa_root_vdev; spa_aux_vdev_t *sav; char *aux; @@ -2275,7 +2408,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd aux = ZPOOL_CONFIG_L2CACHE; } - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2292,8 +2425,9 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd for (;;) { char path[MAXPATHLEN]; int c; - (void) sprintf(path, ztest_aux_template, zopt_dir, - zopt_pool, aux, zs->zs_vdev_aux); + (void) snprintf(path, sizeof (path), ztest_aux_template, + ztest_opts.zo_dir, ztest_opts.zo_pool, aux, + zs->zs_vdev_aux); for (c = 0; c < sav->sav_count; c++) if (strcmp(sav->sav_vdevs[c]->vdev_path, path) == 0) @@ -2312,7 +2446,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd * Add a new device. */ nvlist_t *nvroot = make_vdev_root(NULL, aux, - (zopt_vdev_size * 5) / 4, 0, 0, 0, 0, 1); + (ztest_opts.zo_vdev_size * 5) / 4, 0, 0, 0, 0, 1); error = spa_vdev_add(spa, nvroot); if (error != 0) fatal(0, "spa_vdev_add(%p) = %d", nvroot, error); @@ -2331,7 +2465,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd fatal(0, "spa_vdev_remove(%llu) = %d", guid, error); } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2342,17 +2476,17 @@ void ztest_split_pool(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *rvd = spa->spa_root_vdev; nvlist_t *tree, **child, *config, *split, **schild; uint_t c, children, schildren = 0, lastlogid = 0; int error = 0; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); /* ensure we have a useable config; mirrors of raidz aren't supported */ - if (zs->zs_mirrors < 3 || zopt_raidz > 1) { - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + if (zs->zs_mirrors < 3 || ztest_opts.zo_raidz > 1) { + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2411,9 +2545,9 @@ ztest_split_pool(ztest_ds_t *zd, uint64_ spa_config_exit(spa, SCL_VDEV, FTAG); - (void) rw_wrlock(&zs->zs_name_lock); + (void) rw_wrlock(&ztest_name_lock); error = spa_vdev_split_mirror(spa, "splitp", config, NULL, B_FALSE); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); nvlist_free(config); @@ -2426,7 +2560,7 @@ ztest_split_pool(ztest_ds_t *zd, uint64_ ++zs->zs_splits; --zs->zs_mirrors; } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } @@ -2438,7 +2572,7 @@ void ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; spa_aux_vdev_t *sav = &spa->spa_spares; vdev_t *rvd = spa->spa_root_vdev; vdev_t *oldvd, *newvd, *pvd; @@ -2455,8 +2589,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, int oldvd_is_log; int error, expected_error; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); - leaves = MAX(zs->zs_mirrors, 1) * zopt_raidz; + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz; spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2482,12 +2616,12 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, if (zs->zs_mirrors >= 1) { ASSERT(oldvd->vdev_ops == &vdev_mirror_ops); ASSERT(oldvd->vdev_children >= zs->zs_mirrors); - oldvd = oldvd->vdev_child[leaf / zopt_raidz]; + oldvd = oldvd->vdev_child[leaf / ztest_opts.zo_raidz]; } - if (zopt_raidz > 1) { + if (ztest_opts.zo_raidz > 1) { ASSERT(oldvd->vdev_ops == &vdev_raidz_ops); - ASSERT(oldvd->vdev_children == zopt_raidz); - oldvd = oldvd->vdev_child[leaf % zopt_raidz]; + ASSERT(oldvd->vdev_children == ztest_opts.zo_raidz); + oldvd = oldvd->vdev_child[leaf % ztest_opts.zo_raidz]; } /* @@ -2516,7 +2650,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, if (error != 0 && error != ENODEV && error != EBUSY && error != ENOTSUP) fatal(0, "detach (%s) returned %d", oldpath, error); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2530,7 +2664,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, (void) strcpy(newpath, newvd->vdev_path); } else { (void) snprintf(newpath, sizeof (newpath), ztest_dev_template, - zopt_dir, zopt_pool, top * leaves + leaf); + ztest_opts.zo_dir, ztest_opts.zo_pool, + top * leaves + leaf); if (ztest_random(2) == 0) newpath[strlen(newpath) - 1] = 'b'; newvd = vdev_lookup_by_path(rvd, newpath); @@ -2609,7 +2744,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, (longlong_t)newsize, replacing, error, expected_error); } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2632,7 +2767,7 @@ grow_vdev(vdev_t *vd, void *arg) fsize = lseek(fd, 0, SEEK_END); (void) ftruncate(fd, *newsize); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { (void) printf("%s grew from %lu to %lu bytes\n", vd->vdev_path, (ulong_t)fsize, (ulong_t)*newsize); } @@ -2668,7 +2803,7 @@ online_vdev(vdev_t *vd, void *arg) * vdev_open fails is by checking the returned newstate. */ if (error || newstate != VDEV_STATE_HEALTHY) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Unable to expand vdev, state %llu, " "error %d\n", (u_longlong_t)newstate, error); } @@ -2683,7 +2818,7 @@ online_vdev(vdev_t *vd, void *arg) * trying to online it. */ if (generation != spa->spa_config_generation) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("vdev configuration has changed, " "guid %llu, state %llu, expected gen %llu, " "got gen %llu\n", @@ -2729,8 +2864,7 @@ vdev_walk_tree(vdev_t *vd, vdev_t *(*fun void ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *vd, *tvd; metaslab_class_t *mc; metaslab_group_t *mg; @@ -2738,7 +2872,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui uint64_t top; uint64_t old_class_space, new_class_space, old_ms_count, new_ms_count; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); spa_config_enter(spa, SCL_STATE, spa, RW_READER); top = ztest_random_vdev_top(spa, B_TRUE); @@ -2764,16 +2898,16 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui * original size, and it has a valid psize. */ if (tvd->vdev_state != VDEV_STATE_HEALTHY || - psize == 0 || psize >= 4 * zopt_vdev_size) { + psize == 0 || psize >= 4 * ztest_opts.zo_vdev_size) { spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } ASSERT(psize > 0); newsize = psize + psize / 8; ASSERT3U(newsize, >, psize); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { (void) printf("Expanding LUN %s from %lu to %lu\n", vd->vdev_path, (ulong_t)psize, (ulong_t)newsize); } @@ -2786,12 +2920,12 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui if (vdev_walk_tree(tvd, grow_vdev, &newsize) != NULL || vdev_walk_tree(tvd, online_vdev, NULL) != NULL || tvd->vdev_state != VDEV_STATE_HEALTHY) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Could not expand LUN because " "the vdev configuration changed.\n"); } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2820,12 +2954,12 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui new_class_space = metaslab_class_get_space(mc); if (tvd->vdev_mg != mg || mg->mg_class != mc) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Could not verify LUN expansion due to " "intervening vdev offline or remove.\n"); } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2843,7 +2977,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui fatal(0, "LUN expansion failed: class_space %llu <= %llu\n", old_class_space, new_class_space); - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { char oldnumbuf[6], newnumbuf[6]; nicenum(old_class_space, oldnumbuf); @@ -2853,7 +2987,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2880,7 +3014,8 @@ ztest_dataset_create(char *dsname) if (err || zilset < 80) return (err); - (void) printf("Setting dataset %s to sync always\n", dsname); + if (ztest_opts.zo_verbose >= 6) + (void) printf("Setting dataset %s to sync always\n", dsname); return (ztest_dsl_prop_set_uint64(dsname, ZFS_PROP_SYNC, ZFS_SYNC_ALWAYS, B_FALSE)); } @@ -2952,7 +3087,6 @@ ztest_snapshot_destroy(char *osname, uin void ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; ztest_ds_t zdtmp; int iters; int error; @@ -2960,10 +3094,10 @@ ztest_dmu_objset_create_destroy(ztest_ds char name[MAXNAMELEN]; zilog_t *zilog; - (void) rw_rdlock(&zs->zs_name_lock); + (void) rw_rdlock(&ztest_name_lock); (void) snprintf(name, MAXNAMELEN, "%s/temp_%llu", - zs->zs_pool, (u_longlong_t)id); + ztest_opts.zo_pool, (u_longlong_t)id); /* * If this dataset exists from a previous run, process its replay log @@ -2972,7 +3106,7 @@ ztest_dmu_objset_create_destroy(ztest_ds */ if (ztest_random(2) == 0 && dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os) == 0) { - ztest_zd_init(&zdtmp, os); + ztest_zd_init(&zdtmp, NULL, os); zil_replay(os, &zdtmp, ztest_replay_vector); ztest_zd_fini(&zdtmp); dmu_objset_disown(os, FTAG); @@ -2998,7 +3132,7 @@ ztest_dmu_objset_create_destroy(ztest_ds if (error) { if (error == ENOSPC) { ztest_record_enospc(FTAG); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); return; } fatal(0, "dmu_objset_create(%s) = %d", name, error); @@ -3007,7 +3141,7 @@ ztest_dmu_objset_create_destroy(ztest_ds VERIFY3U(0, ==, dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os)); - ztest_zd_init(&zdtmp, os); + ztest_zd_init(&zdtmp, NULL, os); /* * Open the intent log for it. @@ -3047,7 +3181,7 @@ ztest_dmu_objset_create_destroy(ztest_ds dmu_objset_disown(os, FTAG); ztest_zd_fini(&zdtmp); - (void) rw_unlock(&zs->zs_name_lock); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 07:24:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 398EE106564A; Sun, 10 Jun 2012 07:24:05 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22AAF8FC15; Sun, 10 Jun 2012 07:24:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A7O5XT080186; Sun, 10 Jun 2012 07:24:05 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A7O5Tr080183; Sun, 10 Jun 2012 07:24:05 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206100724.q5A7O5Tr080183@svn.freebsd.org> From: Martin Matuska Date: Sun, 10 Jun 2012 07:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236838 - in stable/8/cddl/contrib/opensolaris: cmd/ztest lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 07:24:05 -0000 Author: mm Date: Sun Jun 10 07:24:04 2012 New Revision: 236838 URL: http://svn.freebsd.org/changeset/base/236838 Log: MFC r236143, r236705: MFC r236143 [1]: Import illumos changeset 13571:a5771a96228c 1950 ztest backwards compatibility testing option MFC r236705 [2]: Import Illumos revision 13715:351036203e4b 2803 zfs get guid pretty-prints the output References: https://www.illumos.org/issues/1950 [1] https://www.illumos.org/issues/2803 [2] Obtained from: illumos (issue #1950 [1], #2803 [2]) Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Jun 10 07:23:45 2012 (r236837) +++ stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Sun Jun 10 07:24:04 2012 (r236838) @@ -20,8 +20,9 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012 Martin Matuska . All rights reserved. */ /* @@ -51,7 +52,9 @@ * At random times, the child self-immolates with a SIGKILL. * This is the software equivalent of pulling the power cord. * The parent then runs the test again, using the existing - * storage pool, as many times as desired. + * storage pool, as many times as desired. If backwards compatability + * testing is enabled ztest will sometimes run the "older" version + * of ztest after a SIGKILL. * * (6) To verify that we don't have future leaks or temporal incursions, * many of the functional tests record the transaction group number @@ -68,9 +71,15 @@ * You can ask more more vdevs [-v], datasets [-d], or threads [-t] * to increase the pool capacity, fanout, and overall stress level. * - * The -N(okill) option will suppress kills, so each child runs to completion. - * This can be useful when you're trying to distinguish temporal incursions - * from plain old race conditions. + * Use the -k option to set the desired frequency of kills. + * + * When ztest invokes itself it passes all relevant information through a + * temporary file which is mmap-ed in the child process. This allows shared + * memory to survive the exec syscall. The ztest_shared_hdr_t struct is always + * stored at offset 0 of this file and contains information on the size and + * number of shared structures in the file. The information stored in this file + * must remain backwards compatible with older versions of ztest so that + * ztest can invoke them during backwards compatibility testing (-B). */ #include @@ -111,29 +120,82 @@ #include #include -static char cmdname[] = "ztest"; -static char *zopt_pool = cmdname; -static char *progname; - -static uint64_t zopt_vdevs = 5; -static uint64_t zopt_vdevtime; -static int zopt_ashift = SPA_MINBLOCKSHIFT; -static int zopt_mirrors = 2; -static int zopt_raidz = 4; -static int zopt_raidz_parity = 1; -static size_t zopt_vdev_size = SPA_MINDEVSIZE; -static int zopt_datasets = 7; -static int zopt_threads = 23; -static uint64_t zopt_passtime = 60; /* 60 seconds */ -static uint64_t zopt_killrate = 70; /* 70% kill rate */ -static int zopt_verbose = 0; -static int zopt_init = 1; -static char *zopt_dir = "/tmp"; -static uint64_t zopt_time = 300; /* 5 minutes */ -static uint64_t zopt_maxloops = 50; /* max loops during spa_freeze() */ +#define ZTEST_FD_DATA 3 +#define ZTEST_FD_RAND 4 + +typedef struct ztest_shared_hdr { + uint64_t zh_hdr_size; + uint64_t zh_opts_size; + uint64_t zh_size; + uint64_t zh_stats_size; + uint64_t zh_stats_count; + uint64_t zh_ds_size; + uint64_t zh_ds_count; +} ztest_shared_hdr_t; + +static ztest_shared_hdr_t *ztest_shared_hdr; + +typedef struct ztest_shared_opts { + char zo_pool[MAXNAMELEN]; + char zo_dir[MAXNAMELEN]; + char zo_alt_ztest[MAXNAMELEN]; + char zo_alt_libpath[MAXNAMELEN]; + uint64_t zo_vdevs; + uint64_t zo_vdevtime; + size_t zo_vdev_size; + int zo_ashift; + int zo_mirrors; + int zo_raidz; + int zo_raidz_parity; + int zo_datasets; + int zo_threads; + uint64_t zo_passtime; + uint64_t zo_killrate; + int zo_verbose; + int zo_init; + uint64_t zo_time; + uint64_t zo_maxloops; + uint64_t zo_metaslab_gang_bang; +} ztest_shared_opts_t; + +static const ztest_shared_opts_t ztest_opts_defaults = { + .zo_pool = { 'z', 't', 'e', 's', 't', '\0' }, + .zo_dir = { '/', 't', 'm', 'p', '\0' }, + .zo_alt_ztest = { '\0' }, + .zo_alt_libpath = { '\0' }, + .zo_vdevs = 5, + .zo_ashift = SPA_MINBLOCKSHIFT, + .zo_mirrors = 2, + .zo_raidz = 4, + .zo_raidz_parity = 1, + .zo_vdev_size = SPA_MINDEVSIZE, + .zo_datasets = 7, + .zo_threads = 23, + .zo_passtime = 60, /* 60 seconds */ + .zo_killrate = 70, /* 70% kill rate */ + .zo_verbose = 0, + .zo_init = 1, + .zo_time = 300, /* 5 minutes */ + .zo_maxloops = 50, /* max loops during spa_freeze() */ + .zo_metaslab_gang_bang = 32 << 10 +}; + +extern uint64_t metaslab_gang_bang; +extern uint64_t metaslab_df_alloc_threshold; + +static ztest_shared_opts_t *ztest_shared_opts; +static ztest_shared_opts_t ztest_opts; + +typedef struct ztest_shared_ds { + uint64_t zd_seq; +} ztest_shared_ds_t; + +static ztest_shared_ds_t *ztest_shared_ds; +#define ZTEST_GET_SHARED_DS(d) (&ztest_shared_ds[d]) #define BT_MAGIC 0x123456789abcdefULL -#define MAXFAULTS() (MAX(zs->zs_mirrors, 1) * (zopt_raidz_parity + 1) - 1) +#define MAXFAULTS() \ + (MAX(zs->zs_mirrors, 1) * (ztest_opts.zo_raidz_parity + 1) - 1) enum ztest_io_type { ZTEST_IO_WRITE_TAG, @@ -205,10 +267,10 @@ typedef struct ztest_od { * Per-dataset state. */ typedef struct ztest_ds { + ztest_shared_ds_t *zd_shared; objset_t *zd_os; rwlock_t zd_zilog_lock; zilog_t *zd_zilog; - uint64_t zd_seq; ztest_od_t *zd_od; /* debugging aid */ char zd_name[MAXNAMELEN]; mutex_t zd_dirobj_lock; @@ -225,11 +287,17 @@ typedef struct ztest_info { ztest_func_t *zi_func; /* test function */ uint64_t zi_iters; /* iterations per execution */ uint64_t *zi_interval; /* execute every seconds */ - uint64_t zi_call_count; /* per-pass count */ - uint64_t zi_call_time; /* per-pass time */ - uint64_t zi_call_next; /* next time to call this function */ } ztest_info_t; +typedef struct ztest_shared_callstate { + uint64_t zc_count; /* per-pass count */ + uint64_t zc_time; /* per-pass time */ + uint64_t zc_next; /* next time to call this function */ +} ztest_shared_callstate_t; + +static ztest_shared_callstate_t *ztest_shared_callstate; +#define ZTEST_GET_SHARED_CALLSTATE(c) (&ztest_shared_callstate[c]) + /* * Note: these aren't static because we want dladdr() to work. */ @@ -297,8 +365,10 @@ ztest_info_t ztest_info[] = { { ztest_dsl_dataset_promote_busy, 1, &zopt_rarely }, { ztest_vdev_attach_detach, 1, &zopt_rarely }, { ztest_vdev_LUN_growth, 1, &zopt_rarely }, - { ztest_vdev_add_remove, 1, &zopt_vdevtime }, - { ztest_vdev_aux_add_remove, 1, &zopt_vdevtime }, + { ztest_vdev_add_remove, 1, + &ztest_opts.zo_vdevtime }, + { ztest_vdev_aux_add_remove, 1, + &ztest_opts.zo_vdevtime }, }; #define ZTEST_FUNCS (sizeof (ztest_info) / sizeof (ztest_info_t)) @@ -316,8 +386,7 @@ typedef struct ztest_cb_list { * Stuff we need to share writably between parent and child. */ typedef struct ztest_shared { - char *zs_pool; - spa_t *zs_spa; + boolean_t zs_do_init; hrtime_t zs_proc_start; hrtime_t zs_proc_stop; hrtime_t zs_thread_start; @@ -328,13 +397,11 @@ typedef struct ztest_shared { uint64_t zs_vdev_aux; uint64_t zs_alloc; uint64_t zs_space; - uint64_t zs_guid; - mutex_t zs_vdev_lock; - rwlock_t zs_name_lock; - ztest_info_t zs_info[ZTEST_FUNCS]; uint64_t zs_splits; uint64_t zs_mirrors; - ztest_ds_t zs_zd[]; + uint64_t zs_metaslab_sz; + uint64_t zs_metaslab_df_alloc_threshold; + uint64_t zs_guid; } ztest_shared_t; #define ID_PARALLEL -1ULL @@ -342,20 +409,19 @@ typedef struct ztest_shared { static char ztest_dev_template[] = "%s/%s.%llua"; static char ztest_aux_template[] = "%s/%s.%s.%llu"; ztest_shared_t *ztest_shared; -uint64_t *ztest_seq; -static int ztest_random_fd; -static int ztest_dump_core = 1; +static spa_t *ztest_spa = NULL; +static ztest_ds_t *ztest_ds; +static mutex_t ztest_vdev_lock; +static rwlock_t ztest_name_lock; + +static boolean_t ztest_dump_core = B_TRUE; static boolean_t ztest_exiting; /* Global commit callback list */ static ztest_cb_list_t zcl; -extern uint64_t metaslab_gang_bang; -extern uint64_t metaslab_df_alloc_threshold; -static uint64_t metaslab_sz; - enum ztest_object { ZTEST_META_DNODE = 0, ZTEST_DIROBJ, @@ -468,12 +534,14 @@ nicenumtoull(const char *buf) static void usage(boolean_t requested) { + const ztest_shared_opts_t *zo = &ztest_opts_defaults; + char nice_vdev_size[10]; char nice_gang_bang[10]; FILE *fp = requested ? stdout : stderr; - nicenum(zopt_vdev_size, nice_vdev_size); - nicenum(metaslab_gang_bang, nice_gang_bang); + nicenum(zo->zo_vdev_size, nice_vdev_size); + nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang); (void) fprintf(fp, "Usage: %s\n" "\t[-v vdevs (default: %llu)]\n" @@ -494,42 +562,43 @@ usage(boolean_t requested) "\t[-T time (default: %llu sec)] total run time\n" "\t[-F freezeloops (default: %llu)] max loops in spa_freeze()\n" "\t[-P passtime (default: %llu sec)] time per pass\n" + "\t[-B alt_ztest (default: )] alternate ztest path\n" "\t[-h] (print help)\n" "", - cmdname, - (u_longlong_t)zopt_vdevs, /* -v */ + zo->zo_pool, + (u_longlong_t)zo->zo_vdevs, /* -v */ nice_vdev_size, /* -s */ - zopt_ashift, /* -a */ - zopt_mirrors, /* -m */ - zopt_raidz, /* -r */ - zopt_raidz_parity, /* -R */ - zopt_datasets, /* -d */ - zopt_threads, /* -t */ + zo->zo_ashift, /* -a */ + zo->zo_mirrors, /* -m */ + zo->zo_raidz, /* -r */ + zo->zo_raidz_parity, /* -R */ + zo->zo_datasets, /* -d */ + zo->zo_threads, /* -t */ nice_gang_bang, /* -g */ - zopt_init, /* -i */ - (u_longlong_t)zopt_killrate, /* -k */ - zopt_pool, /* -p */ - zopt_dir, /* -f */ - (u_longlong_t)zopt_time, /* -T */ - (u_longlong_t)zopt_maxloops, /* -F */ - (u_longlong_t)zopt_passtime); /* -P */ + zo->zo_init, /* -i */ + (u_longlong_t)zo->zo_killrate, /* -k */ + zo->zo_pool, /* -p */ + zo->zo_dir, /* -f */ + (u_longlong_t)zo->zo_time, /* -T */ + (u_longlong_t)zo->zo_maxloops, /* -F */ + (u_longlong_t)zo->zo_passtime); exit(requested ? 0 : 1); } static void process_options(int argc, char **argv) { + char *path; + ztest_shared_opts_t *zo = &ztest_opts; + int opt; uint64_t value; + char altdir[MAXNAMELEN] = { 0 }; - /* Remember program name. */ - progname = argv[0]; - - /* By default, test gang blocks for blocks 32K and greater */ - metaslab_gang_bang = 32 << 10; + bcopy(&ztest_opts_defaults, zo, sizeof (*zo)); while ((opt = getopt(argc, argv, - "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:")) != EOF) { + "v:s:a:m:r:R:d:t:g:i:k:p:f:VET:P:hF:B:")) != EOF) { value = 0; switch (opt) { case 'v': @@ -550,58 +619,71 @@ process_options(int argc, char **argv) } switch (opt) { case 'v': - zopt_vdevs = value; + zo->zo_vdevs = value; break; case 's': - zopt_vdev_size = MAX(SPA_MINDEVSIZE, value); + zo->zo_vdev_size = MAX(SPA_MINDEVSIZE, value); break; case 'a': - zopt_ashift = value; + zo->zo_ashift = value; break; case 'm': - zopt_mirrors = value; + zo->zo_mirrors = value; break; case 'r': - zopt_raidz = MAX(1, value); + zo->zo_raidz = MAX(1, value); break; case 'R': - zopt_raidz_parity = MIN(MAX(value, 1), 3); + zo->zo_raidz_parity = MIN(MAX(value, 1), 3); break; case 'd': - zopt_datasets = MAX(1, value); + zo->zo_datasets = MAX(1, value); break; case 't': - zopt_threads = MAX(1, value); + zo->zo_threads = MAX(1, value); break; case 'g': - metaslab_gang_bang = MAX(SPA_MINBLOCKSIZE << 1, value); + zo->zo_metaslab_gang_bang = MAX(SPA_MINBLOCKSIZE << 1, + value); break; case 'i': - zopt_init = value; + zo->zo_init = value; break; case 'k': - zopt_killrate = value; + zo->zo_killrate = value; break; case 'p': - zopt_pool = strdup(optarg); + (void) strlcpy(zo->zo_pool, optarg, + sizeof (zo->zo_pool)); break; case 'f': - zopt_dir = strdup(optarg); + path = realpath(optarg, NULL); + if (path == NULL) { + (void) fprintf(stderr, "error: %s: %s\n", + optarg, strerror(errno)); + usage(B_FALSE); + } else { + (void) strlcpy(zo->zo_dir, path, + sizeof (zo->zo_dir)); + } break; case 'V': - zopt_verbose++; + zo->zo_verbose++; break; case 'E': - zopt_init = 0; + zo->zo_init = 0; break; case 'T': - zopt_time = value; + zo->zo_time = value; break; case 'P': - zopt_passtime = MAX(1, value); + zo->zo_passtime = MAX(1, value); break; case 'F': - zopt_maxloops = MAX(1, value); + zo->zo_maxloops = MAX(1, value); + break; + case 'B': + (void) strlcpy(altdir, optarg, sizeof (altdir)); break; case 'h': usage(B_TRUE); @@ -613,17 +695,59 @@ process_options(int argc, char **argv) } } - zopt_raidz_parity = MIN(zopt_raidz_parity, zopt_raidz - 1); + zo->zo_raidz_parity = MIN(zo->zo_raidz_parity, zo->zo_raidz - 1); - zopt_vdevtime = (zopt_vdevs > 0 ? zopt_time * NANOSEC / zopt_vdevs : + zo->zo_vdevtime = + (zo->zo_vdevs > 0 ? zo->zo_time * NANOSEC / zo->zo_vdevs : UINT64_MAX >> 2); + + if (strlen(altdir) > 0) { + char cmd[MAXNAMELEN]; + char realaltdir[MAXNAMELEN]; + char *bin; + char *ztest; + char *isa; + int isalen; + + (void) realpath(getexecname(), cmd); + if (0 != access(altdir, F_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate ztest path: %s", + altdir); + } + VERIFY(NULL != realpath(altdir, realaltdir)); + + /* + * 'cmd' should be of the form "/usr/bin//ztest". + * We want to extract to determine if we should use + * 32 or 64 bit binaries. + */ + bin = strstr(cmd, "/usr/bin/"); + ztest = strstr(bin, "/ztest"); + isa = bin + 9; + isalen = ztest - isa; + (void) snprintf(zo->zo_alt_ztest, sizeof (zo->zo_alt_ztest), + "%s/usr/bin/%.*s/ztest", realaltdir, isalen, isa); + (void) snprintf(zo->zo_alt_libpath, sizeof (zo->zo_alt_libpath), + "%s/usr/lib/%.*s", realaltdir, isalen, isa); + + if (0 != access(zo->zo_alt_ztest, X_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate ztest: %s", + zo->zo_alt_ztest); + } else if (0 != access(zo->zo_alt_libpath, X_OK)) { + ztest_dump_core = B_FALSE; + fatal(B_TRUE, "invalid alternate lib directory %s", + zo->zo_alt_libpath); + } + } } static void ztest_kill(ztest_shared_t *zs) { - zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(zs->zs_spa)); - zs->zs_space = metaslab_class_get_space(spa_normal_class(zs->zs_spa)); + zs->zs_alloc = metaslab_class_get_alloc(spa_normal_class(ztest_spa)); + zs->zs_space = metaslab_class_get_space(spa_normal_class(ztest_spa)); (void) kill(getpid(), SIGKILL); } @@ -635,7 +759,7 @@ ztest_random(uint64_t range) if (range == 0) return (0); - if (read(ztest_random_fd, &r, sizeof (r)) != sizeof (r)) + if (read(ZTEST_FD_RAND, &r, sizeof (r)) != sizeof (r)) fatal(1, "short read from /dev/urandom"); return (r % range); @@ -651,9 +775,9 @@ ztest_record_enospc(const char *s) static uint64_t ztest_get_ashift(void) { - if (zopt_ashift == 0) + if (ztest_opts.zo_ashift == 0) return (SPA_MINBLOCKSHIFT + ztest_random(3)); - return (zopt_ashift); + return (ztest_opts.zo_ashift); } static nvlist_t * @@ -671,12 +795,14 @@ make_vdev_file(char *path, char *aux, si if (aux != NULL) { vdev = ztest_shared->zs_vdev_aux; - (void) sprintf(path, ztest_aux_template, - zopt_dir, zopt_pool, aux, vdev); + (void) snprintf(path, sizeof (pathbuf), + ztest_aux_template, ztest_opts.zo_dir, + ztest_opts.zo_pool, aux, vdev); } else { vdev = ztest_shared->zs_vdev_next_leaf++; - (void) sprintf(path, ztest_dev_template, - zopt_dir, zopt_pool, vdev); + (void) snprintf(path, sizeof (pathbuf), + ztest_dev_template, ztest_opts.zo_dir, + ztest_opts.zo_pool, vdev); } } @@ -714,7 +840,7 @@ make_vdev_raidz(char *path, char *aux, s VERIFY(nvlist_add_string(raidz, ZPOOL_CONFIG_TYPE, VDEV_TYPE_RAIDZ) == 0); VERIFY(nvlist_add_uint64(raidz, ZPOOL_CONFIG_NPARITY, - zopt_raidz_parity) == 0); + ztest_opts.zo_raidz_parity) == 0); VERIFY(nvlist_add_nvlist_array(raidz, ZPOOL_CONFIG_CHILDREN, child, r) == 0); @@ -852,7 +978,7 @@ ztest_dsl_prop_set_uint64(char *osname, VERIFY3U(dsl_prop_get(osname, propname, sizeof (curval), 1, &curval, setpoint), ==, 0); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { VERIFY(zfs_prop_index_to_string(prop, curval, &valname) == 0); (void) printf("%s %s = %s at '%s'\n", osname, propname, valname, setpoint); @@ -862,9 +988,9 @@ ztest_dsl_prop_set_uint64(char *osname, } static int -ztest_spa_prop_set_uint64(ztest_shared_t *zs, zpool_prop_t prop, uint64_t value) +ztest_spa_prop_set_uint64(zpool_prop_t prop, uint64_t value) { - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; nvlist_t *props = NULL; int error; @@ -986,13 +1112,16 @@ ztest_range_unlock(rl_t *rl) } static void -ztest_zd_init(ztest_ds_t *zd, objset_t *os) +ztest_zd_init(ztest_ds_t *zd, ztest_shared_ds_t *szd, objset_t *os) { zd->zd_os = os; zd->zd_zilog = dmu_objset_zil(os); - zd->zd_seq = 0; + zd->zd_shared = szd; dmu_objset_name(os, zd->zd_name); + if (zd->zd_shared != NULL) + zd->zd_shared->zd_seq = 0; + VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); @@ -2076,8 +2205,9 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ * will verify that the log really does contain this record. */ mutex_enter(&zilog->zl_lock); - ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); - zd->zd_seq = zilog->zl_commit_lr_seq; + ASSERT(zd->zd_shared != NULL); + ASSERT3U(zd->zd_shared->zd_seq, <=, zilog->zl_commit_lr_seq); + zd->zd_shared->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); (void) rw_unlock(&zd->zd_zilog_lock); @@ -2114,7 +2244,7 @@ ztest_zil_remount(ztest_ds_t *zd, uint64 void ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; + ztest_shared_opts_t *zo = &ztest_opts; spa_t *spa; nvlist_t *nvroot; @@ -2138,15 +2268,15 @@ ztest_spa_create_destroy(ztest_ds_t *zd, * Attempt to create an existing pool. It shouldn't matter * what's in the nvroot; we should fail with EEXIST. */ - (void) rw_rdlock(&zs->zs_name_lock); + (void) rw_rdlock(&ztest_name_lock); nvroot = make_vdev_root("/dev/bogus", NULL, 0, 0, 0, 0, 0, 1); - VERIFY3U(EEXIST, ==, spa_create(zs->zs_pool, nvroot, NULL, NULL, NULL)); + VERIFY3U(EEXIST, ==, spa_create(zo->zo_pool, nvroot, NULL, NULL, NULL)); nvlist_free(nvroot); - VERIFY3U(0, ==, spa_open(zs->zs_pool, &spa, FTAG)); - VERIFY3U(EBUSY, ==, spa_destroy(zs->zs_pool)); + VERIFY3U(0, ==, spa_open(zo->zo_pool, &spa, FTAG)); + VERIFY3U(EBUSY, ==, spa_destroy(zo->zo_pool)); spa_close(spa, FTAG); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); } static vdev_t * @@ -2193,14 +2323,15 @@ void ztest_vdev_add_remove(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; uint64_t leaves; uint64_t guid; nvlist_t *nvroot; int error; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); - leaves = MAX(zs->zs_mirrors + zs->zs_splits, 1) * zopt_raidz; + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + leaves = + MAX(zs->zs_mirrors + zs->zs_splits, 1) * ztest_opts.zo_raidz; spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2225,9 +2356,9 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui * dmu_objset_destroy() to fail with EBUSY thus * leaving the dataset in an inconsistent state. */ - VERIFY(rw_wrlock(&ztest_shared->zs_name_lock) == 0); + VERIFY(rw_wrlock(&ztest_name_lock) == 0); error = spa_vdev_remove(spa, guid, B_FALSE); - VERIFY(rw_unlock(&ztest_shared->zs_name_lock) == 0); + VERIFY(rw_unlock(&ztest_name_lock) == 0); if (error && error != EEXIST) fatal(0, "spa_vdev_remove() = %d", error); @@ -2237,8 +2368,10 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui /* * Make 1/4 of the devices be log devices. */ - nvroot = make_vdev_root(NULL, NULL, zopt_vdev_size, 0, - ztest_random(4) == 0, zopt_raidz, zs->zs_mirrors, 1); + nvroot = make_vdev_root(NULL, NULL, + ztest_opts.zo_vdev_size, 0, + ztest_random(4) == 0, ztest_opts.zo_raidz, + zs->zs_mirrors, 1); error = spa_vdev_add(spa, nvroot); nvlist_free(nvroot); @@ -2249,7 +2382,7 @@ ztest_vdev_add_remove(ztest_ds_t *zd, ui fatal(0, "spa_vdev_add() = %d", error); } - VERIFY(mutex_unlock(&ztest_shared->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2260,7 +2393,7 @@ void ztest_vdev_aux_add_remove(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *rvd = spa->spa_root_vdev; spa_aux_vdev_t *sav; char *aux; @@ -2275,7 +2408,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd aux = ZPOOL_CONFIG_L2CACHE; } - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2292,8 +2425,9 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd for (;;) { char path[MAXPATHLEN]; int c; - (void) sprintf(path, ztest_aux_template, zopt_dir, - zopt_pool, aux, zs->zs_vdev_aux); + (void) snprintf(path, sizeof (path), ztest_aux_template, + ztest_opts.zo_dir, ztest_opts.zo_pool, aux, + zs->zs_vdev_aux); for (c = 0; c < sav->sav_count; c++) if (strcmp(sav->sav_vdevs[c]->vdev_path, path) == 0) @@ -2312,7 +2446,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd * Add a new device. */ nvlist_t *nvroot = make_vdev_root(NULL, aux, - (zopt_vdev_size * 5) / 4, 0, 0, 0, 0, 1); + (ztest_opts.zo_vdev_size * 5) / 4, 0, 0, 0, 0, 1); error = spa_vdev_add(spa, nvroot); if (error != 0) fatal(0, "spa_vdev_add(%p) = %d", nvroot, error); @@ -2331,7 +2465,7 @@ ztest_vdev_aux_add_remove(ztest_ds_t *zd fatal(0, "spa_vdev_remove(%llu) = %d", guid, error); } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2342,17 +2476,17 @@ void ztest_split_pool(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *rvd = spa->spa_root_vdev; nvlist_t *tree, **child, *config, *split, **schild; uint_t c, children, schildren = 0, lastlogid = 0; int error = 0; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); /* ensure we have a useable config; mirrors of raidz aren't supported */ - if (zs->zs_mirrors < 3 || zopt_raidz > 1) { - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + if (zs->zs_mirrors < 3 || ztest_opts.zo_raidz > 1) { + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2411,9 +2545,9 @@ ztest_split_pool(ztest_ds_t *zd, uint64_ spa_config_exit(spa, SCL_VDEV, FTAG); - (void) rw_wrlock(&zs->zs_name_lock); + (void) rw_wrlock(&ztest_name_lock); error = spa_vdev_split_mirror(spa, "splitp", config, NULL, B_FALSE); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); nvlist_free(config); @@ -2426,7 +2560,7 @@ ztest_split_pool(ztest_ds_t *zd, uint64_ ++zs->zs_splits; --zs->zs_mirrors; } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } @@ -2438,7 +2572,7 @@ void ztest_vdev_attach_detach(ztest_ds_t *zd, uint64_t id) { ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; spa_aux_vdev_t *sav = &spa->spa_spares; vdev_t *rvd = spa->spa_root_vdev; vdev_t *oldvd, *newvd, *pvd; @@ -2455,8 +2589,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, int oldvd_is_log; int error, expected_error; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); - leaves = MAX(zs->zs_mirrors, 1) * zopt_raidz; + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); + leaves = MAX(zs->zs_mirrors, 1) * ztest_opts.zo_raidz; spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER); @@ -2482,12 +2616,12 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, if (zs->zs_mirrors >= 1) { ASSERT(oldvd->vdev_ops == &vdev_mirror_ops); ASSERT(oldvd->vdev_children >= zs->zs_mirrors); - oldvd = oldvd->vdev_child[leaf / zopt_raidz]; + oldvd = oldvd->vdev_child[leaf / ztest_opts.zo_raidz]; } - if (zopt_raidz > 1) { + if (ztest_opts.zo_raidz > 1) { ASSERT(oldvd->vdev_ops == &vdev_raidz_ops); - ASSERT(oldvd->vdev_children == zopt_raidz); - oldvd = oldvd->vdev_child[leaf % zopt_raidz]; + ASSERT(oldvd->vdev_children == ztest_opts.zo_raidz); + oldvd = oldvd->vdev_child[leaf % ztest_opts.zo_raidz]; } /* @@ -2516,7 +2650,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, if (error != 0 && error != ENODEV && error != EBUSY && error != ENOTSUP) fatal(0, "detach (%s) returned %d", oldpath, error); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2530,7 +2664,8 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, (void) strcpy(newpath, newvd->vdev_path); } else { (void) snprintf(newpath, sizeof (newpath), ztest_dev_template, - zopt_dir, zopt_pool, top * leaves + leaf); + ztest_opts.zo_dir, ztest_opts.zo_pool, + top * leaves + leaf); if (ztest_random(2) == 0) newpath[strlen(newpath) - 1] = 'b'; newvd = vdev_lookup_by_path(rvd, newpath); @@ -2609,7 +2744,7 @@ ztest_vdev_attach_detach(ztest_ds_t *zd, (longlong_t)newsize, replacing, error, expected_error); } - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2632,7 +2767,7 @@ grow_vdev(vdev_t *vd, void *arg) fsize = lseek(fd, 0, SEEK_END); (void) ftruncate(fd, *newsize); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { (void) printf("%s grew from %lu to %lu bytes\n", vd->vdev_path, (ulong_t)fsize, (ulong_t)*newsize); } @@ -2668,7 +2803,7 @@ online_vdev(vdev_t *vd, void *arg) * vdev_open fails is by checking the returned newstate. */ if (error || newstate != VDEV_STATE_HEALTHY) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Unable to expand vdev, state %llu, " "error %d\n", (u_longlong_t)newstate, error); } @@ -2683,7 +2818,7 @@ online_vdev(vdev_t *vd, void *arg) * trying to online it. */ if (generation != spa->spa_config_generation) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("vdev configuration has changed, " "guid %llu, state %llu, expected gen %llu, " "got gen %llu\n", @@ -2729,8 +2864,7 @@ vdev_walk_tree(vdev_t *vd, vdev_t *(*fun void ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; - spa_t *spa = zs->zs_spa; + spa_t *spa = ztest_spa; vdev_t *vd, *tvd; metaslab_class_t *mc; metaslab_group_t *mg; @@ -2738,7 +2872,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui uint64_t top; uint64_t old_class_space, new_class_space, old_ms_count, new_ms_count; - VERIFY(mutex_lock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_lock(&ztest_vdev_lock) == 0); spa_config_enter(spa, SCL_STATE, spa, RW_READER); top = ztest_random_vdev_top(spa, B_TRUE); @@ -2764,16 +2898,16 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui * original size, and it has a valid psize. */ if (tvd->vdev_state != VDEV_STATE_HEALTHY || - psize == 0 || psize >= 4 * zopt_vdev_size) { + psize == 0 || psize >= 4 * ztest_opts.zo_vdev_size) { spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } ASSERT(psize > 0); newsize = psize + psize / 8; ASSERT3U(newsize, >, psize); - if (zopt_verbose >= 6) { + if (ztest_opts.zo_verbose >= 6) { (void) printf("Expanding LUN %s from %lu to %lu\n", vd->vdev_path, (ulong_t)psize, (ulong_t)newsize); } @@ -2786,12 +2920,12 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui if (vdev_walk_tree(tvd, grow_vdev, &newsize) != NULL || vdev_walk_tree(tvd, online_vdev, NULL) != NULL || tvd->vdev_state != VDEV_STATE_HEALTHY) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Could not expand LUN because " "the vdev configuration changed.\n"); } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2820,12 +2954,12 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui new_class_space = metaslab_class_get_space(mc); if (tvd->vdev_mg != mg || mg->mg_class != mc) { - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { (void) printf("Could not verify LUN expansion due to " "intervening vdev offline or remove.\n"); } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); return; } @@ -2843,7 +2977,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui fatal(0, "LUN expansion failed: class_space %llu <= %llu\n", old_class_space, new_class_space); - if (zopt_verbose >= 5) { + if (ztest_opts.zo_verbose >= 5) { char oldnumbuf[6], newnumbuf[6]; nicenum(old_class_space, oldnumbuf); @@ -2853,7 +2987,7 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, ui } spa_config_exit(spa, SCL_STATE, spa); - VERIFY(mutex_unlock(&zs->zs_vdev_lock) == 0); + VERIFY(mutex_unlock(&ztest_vdev_lock) == 0); } /* @@ -2880,7 +3014,8 @@ ztest_dataset_create(char *dsname) if (err || zilset < 80) return (err); - (void) printf("Setting dataset %s to sync always\n", dsname); + if (ztest_opts.zo_verbose >= 6) + (void) printf("Setting dataset %s to sync always\n", dsname); return (ztest_dsl_prop_set_uint64(dsname, ZFS_PROP_SYNC, ZFS_SYNC_ALWAYS, B_FALSE)); } @@ -2952,7 +3087,6 @@ ztest_snapshot_destroy(char *osname, uin void ztest_dmu_objset_create_destroy(ztest_ds_t *zd, uint64_t id) { - ztest_shared_t *zs = ztest_shared; ztest_ds_t zdtmp; int iters; int error; @@ -2960,10 +3094,10 @@ ztest_dmu_objset_create_destroy(ztest_ds char name[MAXNAMELEN]; zilog_t *zilog; - (void) rw_rdlock(&zs->zs_name_lock); + (void) rw_rdlock(&ztest_name_lock); (void) snprintf(name, MAXNAMELEN, "%s/temp_%llu", - zs->zs_pool, (u_longlong_t)id); + ztest_opts.zo_pool, (u_longlong_t)id); /* * If this dataset exists from a previous run, process its replay log @@ -2972,7 +3106,7 @@ ztest_dmu_objset_create_destroy(ztest_ds */ if (ztest_random(2) == 0 && dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os) == 0) { - ztest_zd_init(&zdtmp, os); + ztest_zd_init(&zdtmp, NULL, os); zil_replay(os, &zdtmp, ztest_replay_vector); ztest_zd_fini(&zdtmp); dmu_objset_disown(os, FTAG); @@ -2998,7 +3132,7 @@ ztest_dmu_objset_create_destroy(ztest_ds if (error) { if (error == ENOSPC) { ztest_record_enospc(FTAG); - (void) rw_unlock(&zs->zs_name_lock); + (void) rw_unlock(&ztest_name_lock); return; } fatal(0, "dmu_objset_create(%s) = %d", name, error); @@ -3007,7 +3141,7 @@ ztest_dmu_objset_create_destroy(ztest_ds VERIFY3U(0, ==, dmu_objset_own(name, DMU_OST_OTHER, B_FALSE, FTAG, &os)); - ztest_zd_init(&zdtmp, os); + ztest_zd_init(&zdtmp, NULL, os); /* * Open the intent log for it. @@ -3047,7 +3181,7 @@ ztest_dmu_objset_create_destroy(ztest_ds dmu_objset_disown(os, FTAG); ztest_zd_fini(&zdtmp); - (void) rw_unlock(&zs->zs_name_lock); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 07:40:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2E49106566B; Sun, 10 Jun 2012 07:40:26 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C93E28FC21; Sun, 10 Jun 2012 07:40:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A7eQHp080975; Sun, 10 Jun 2012 07:40:26 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A7eQO1080957; Sun, 10 Jun 2012 07:40:26 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206100740.q5A7eQO1080957@svn.freebsd.org> From: Martin Matuska Date: Sun, 10 Jun 2012 07:40:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236839 - in stable/9: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/z... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 07:40:27 -0000 Author: mm Date: Sun Jun 10 07:40:26 2012 New Revision: 236839 URL: http://svn.freebsd.org/changeset/base/236839 Log: MFC r236155: Import illumos changeset 13570:3411fd5f1589 1948 zpool list should show more detailed pool information Display per-vdev information with "zpool list -v". The added expandsize property has currently no value on FreeBSD. This changeset allows adding expansion support to individual vdevs in the future. References: https://www.illumos.org/issues/1948 Obtained from: illumos (issue #1948) Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/9/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 10 07:40:26 2012 (r236839) @@ -537,6 +537,8 @@ value of 1.76 indicates that 1.76 units for a description of the deduplication feature. .It Sy free Number of blocks within the pool that are not allocated. +.It Sy expandsize +This property has currently no value on FreeBSD. .It Sy guid A unique identifier for the pool. .It Sy health @@ -1275,7 +1277,7 @@ Treat exported or foreign devices as ina .It Xo .Nm .Cm list -.Op Fl H +.Op Fl Hv .Op Fl o Ar property Ns Op , Ns Ar ... .Op Fl T Cm d Ns | Ns Cm u .Op Ar pool Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 10 07:40:26 2012 (r236839) @@ -22,9 +22,9 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. - * Copyright (c) 2011 Martin Matuska . All rights reserved. + * Copyright (c) 2012 Martin Matuska . All rights reserved. */ #include @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,7 @@ static int zpool_do_status(int, char **) static int zpool_do_online(int, char **); static int zpool_do_offline(int, char **); static int zpool_do_clear(int, char **); +static int zpool_do_reopen(int, char **); static int zpool_do_reguid(int, char **); @@ -132,7 +134,8 @@ typedef enum { HELP_GET, HELP_SET, HELP_SPLIT, - HELP_REGUID + HELP_REGUID, + HELP_REOPEN } zpool_help_t; @@ -167,6 +170,7 @@ static zpool_command_t command_table[] = { "online", zpool_do_online, HELP_ONLINE }, { "offline", zpool_do_offline, HELP_OFFLINE }, { "clear", zpool_do_clear, HELP_CLEAR }, + { "reopen", zpool_do_reopen, HELP_REOPEN }, { NULL }, { "attach", zpool_do_attach, HELP_ATTACH }, { "detach", zpool_do_detach, HELP_DETACH }, @@ -241,6 +245,8 @@ get_usage(zpool_help_t idx) { "[new-device]\n")); case HELP_REMOVE: return (gettext("\tremove ...\n")); + case HELP_REOPEN: + return (""); /* Undocumented command */ case HELP_SCRUB: return (gettext("\tscrub [-s] ...\n")); case HELP_STATUS: @@ -2109,10 +2115,10 @@ error: } typedef struct iostat_cbdata { - zpool_list_t *cb_list; - int cb_verbose; - int cb_iteration; + boolean_t cb_verbose; int cb_namewidth; + int cb_iteration; + zpool_list_t *cb_list; } iostat_cbdata_t; static void @@ -2582,8 +2588,9 @@ zpool_do_iostat(int argc, char **argv) } typedef struct list_cbdata { + boolean_t cb_verbose; + int cb_namewidth; boolean_t cb_scripted; - boolean_t cb_first; zprop_list_t *cb_proplist; } list_cbdata_t; @@ -2591,16 +2598,27 @@ typedef struct list_cbdata { * Given a list of columns to display, output appropriate headers for each one. */ static void -print_header(zprop_list_t *pl) +print_header(list_cbdata_t *cb) { + zprop_list_t *pl = cb->cb_proplist; const char *header; boolean_t first = B_TRUE; boolean_t right_justify; + size_t width = 0; for (; pl != NULL; pl = pl->pl_next) { if (pl->pl_prop == ZPROP_INVAL) continue; + width = pl->pl_width; + if (first && cb->cb_verbose) { + /* + * Reset the width to accommodate the verbose listing + * of devices. + */ + width = cb->cb_namewidth; + } + if (!first) (void) printf(" "); else @@ -2612,9 +2630,10 @@ print_header(zprop_list_t *pl) if (pl->pl_next == NULL && !right_justify) (void) printf("%s", header); else if (right_justify) - (void) printf("%*s", pl->pl_width, header); + (void) printf("%*s", width, header); else - (void) printf("%-*s", pl->pl_width, header); + (void) printf("%-*s", width, header); + } (void) printf("\n"); @@ -2625,17 +2644,28 @@ print_header(zprop_list_t *pl) * to the described layout. */ static void -print_pool(zpool_handle_t *zhp, zprop_list_t *pl, int scripted) +print_pool(zpool_handle_t *zhp, list_cbdata_t *cb) { + zprop_list_t *pl = cb->cb_proplist; boolean_t first = B_TRUE; char property[ZPOOL_MAXPROPLEN]; char *propstr; boolean_t right_justify; - int width; + size_t width; for (; pl != NULL; pl = pl->pl_next) { + + width = pl->pl_width; + if (first && cb->cb_verbose) { + /* + * Reset the width to accommodate the verbose listing + * of devices. + */ + width = cb->cb_namewidth; + } + if (!first) { - if (scripted) + if (cb->cb_scripted) (void) printf("\t"); else (void) printf(" "); @@ -2645,7 +2675,10 @@ print_pool(zpool_handle_t *zhp, zprop_li right_justify = B_FALSE; if (pl->pl_prop != ZPROP_INVAL) { - if (zpool_get_prop(zhp, pl->pl_prop, property, + if (pl->pl_prop == ZPOOL_PROP_EXPANDSZ && + zpool_get_prop_int(zhp, pl->pl_prop, NULL) == 0) + propstr = "-"; + else if (zpool_get_prop(zhp, pl->pl_prop, property, sizeof (property), NULL) != 0) propstr = "-"; else @@ -2656,14 +2689,13 @@ print_pool(zpool_handle_t *zhp, zprop_li propstr = "-"; } - width = pl->pl_width; /* * If this is being called in scripted mode, or if this is the * last column and it is left-justified, don't include a width * format specifier. */ - if (scripted || (pl->pl_next == NULL && !right_justify)) + if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify)) (void) printf("%s", propstr); else if (right_justify) (void) printf("%*s", width, propstr); @@ -2674,6 +2706,101 @@ print_pool(zpool_handle_t *zhp, zprop_li (void) printf("\n"); } +static void +print_one_column(zpool_prop_t prop, uint64_t value, boolean_t scripted) +{ + char propval[64]; + boolean_t fixed; + size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL); + + zfs_nicenum(value, propval, sizeof (propval)); + + if (prop == ZPOOL_PROP_EXPANDSZ && value == 0) + (void) strlcpy(propval, "-", sizeof (propval)); + + if (scripted) + (void) printf("\t%s", propval); + else + (void) printf(" %*s", width, propval); +} + +void +print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, + list_cbdata_t *cb, int depth) +{ + nvlist_t **child; + vdev_stat_t *vs; + uint_t c, children; + char *vname; + boolean_t scripted = cb->cb_scripted; + + verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, + (uint64_t **)&vs, &c) == 0); + + if (name != NULL) { + if (scripted) + (void) printf("\t%s", name); + else if (strlen(name) + depth > cb->cb_namewidth) + (void) printf("%*s%s", depth, "", name); + else + (void) printf("%*s%s%*s", depth, "", name, + (int)(cb->cb_namewidth - strlen(name) - depth), ""); + + /* only toplevel vdevs have capacity stats */ + if (vs->vs_space == 0) { + if (scripted) + (void) printf("\t-\t-\t-"); + else + (void) printf(" - - -"); + } else { + print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, + scripted); + print_one_column(ZPOOL_PROP_CAPACITY, vs->vs_alloc, + scripted); + print_one_column(ZPOOL_PROP_FREE, + vs->vs_space - vs->vs_alloc, scripted); + } + print_one_column(ZPOOL_PROP_EXPANDSZ, vs->vs_esize, + scripted); + (void) printf("\n"); + } + + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, + &child, &children) != 0) + return; + + for (c = 0; c < children; c++) { + uint64_t ishole = B_FALSE; + + if (nvlist_lookup_uint64(child[c], + ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole) + continue; + + vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE); + print_list_stats(zhp, vname, child[c], cb, depth + 2); + free(vname); + } + + /* + * Include level 2 ARC devices in iostat output + */ + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, + &child, &children) != 0) + return; + + if (children > 0) { + (void) printf("%-*s - - - - - " + "-\n", cb->cb_namewidth, "cache"); + for (c = 0; c < children; c++) { + vname = zpool_vdev_name(g_zfs, zhp, child[c], + B_FALSE); + print_list_stats(zhp, vname, child[c], cb, depth + 2); + free(vname); + } + } +} + + /* * Generic callback function to list a pool. */ @@ -2681,14 +2808,18 @@ int list_callback(zpool_handle_t *zhp, void *data) { list_cbdata_t *cbp = data; + nvlist_t *config; + nvlist_t *nvroot; - if (cbp->cb_first) { - if (!cbp->cb_scripted) - print_header(cbp->cb_proplist); - cbp->cb_first = B_FALSE; - } + config = zpool_get_config(zhp, NULL); - print_pool(zhp, cbp->cb_proplist, cbp->cb_scripted); + print_pool(zhp, cbp); + if (!cbp->cb_verbose) + return (0); + + verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, + &nvroot) == 0); + print_list_stats(zhp, NULL, nvroot, cbp, 0); return (0); } @@ -2712,12 +2843,15 @@ zpool_do_list(int argc, char **argv) int ret; list_cbdata_t cb = { 0 }; static char default_props[] = - "name,size,allocated,free,capacity,dedupratio,health,altroot"; + "name,size,allocated,free,capacity,dedupratio," + "health,altroot"; char *props = default_props; unsigned long interval = 0, count = 0; + zpool_list_t *list; + boolean_t first = B_TRUE; /* check options */ - while ((c = getopt(argc, argv, ":Ho:T:")) != -1) { + while ((c = getopt(argc, argv, ":Ho:T:v")) != -1) { switch (c) { case 'H': cb.cb_scripted = B_TRUE; @@ -2728,6 +2862,9 @@ zpool_do_list(int argc, char **argv) case 'T': get_timestamp_arg(*optarg); break; + case 'v': + cb.cb_verbose = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -2748,21 +2885,32 @@ zpool_do_list(int argc, char **argv) if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) != 0) usage(B_FALSE); - cb.cb_first = B_TRUE; + if ((list = pool_list_get(argc, argv, &cb.cb_proplist, &ret)) == NULL) + return (1); + + if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) { + (void) printf(gettext("no pools available\n")); + zprop_free_list(cb.cb_proplist); + return (0); + } for (;;) { + pool_list_update(list); + + if (pool_list_count(list) == 0) + break; + + cb.cb_namewidth = 0; + (void) pool_list_iter(list, B_FALSE, get_namewidth, &cb); if (timestamp_fmt != NODATE) print_timestamp(timestamp_fmt); - ret = for_each_pool(argc, argv, B_TRUE, &cb.cb_proplist, - list_callback, &cb); - - if (argc == 0 && cb.cb_first && !cb.cb_scripted) { - (void) printf(gettext("no pools available\n")); - zprop_free_list(cb.cb_proplist); - return (0); + if (!cb.cb_scripted && (first || cb.cb_verbose)) { + print_header(&cb); + first = B_FALSE; } + ret = pool_list_iter(list, B_TRUE, list_callback, &cb); if (interval == 0) break; @@ -3382,6 +3530,36 @@ zpool_do_reguid(int argc, char **argv) } +/* + * zpool reopen + * + * Reopen the pool so that the kernel can update the sizes of all vdevs. + * + * NOTE: This command is currently undocumented. If the command is ever + * exposed then the appropriate usage() messages will need to be made. + */ +int +zpool_do_reopen(int argc, char **argv) +{ + int ret = 0; + zpool_handle_t *zhp; + char *pool; + + argc--; + argv++; + + if (argc != 1) + return (2); + + pool = argv[0]; + if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) + return (1); + + ret = zpool_reopen(zhp); + zpool_close(zhp); + return (ret); +} + typedef struct scrub_cbdata { int cb_type; int cb_argc; Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Jun 10 07:40:26 2012 (r236839) @@ -24,7 +24,7 @@ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. */ @@ -237,6 +237,7 @@ typedef struct splitflags { extern int zpool_scan(zpool_handle_t *, pool_scan_func_t); extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *); extern int zpool_reguid(zpool_handle_t *); +extern int zpool_reopen(zpool_handle_t *); extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Jun 10 07:40:26 2012 (r236839) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -301,6 +301,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpoo case ZPOOL_PROP_SIZE: case ZPOOL_PROP_ALLOCATED: case ZPOOL_PROP_FREE: + case ZPOOL_PROP_EXPANDSZ: (void) zfs_nicenum(intval, buf, len); break; @@ -390,8 +391,8 @@ pool_uses_efi(nvlist_t *config) return (B_FALSE); } -static boolean_t -pool_is_bootable(zpool_handle_t *zhp) +boolean_t +zpool_is_bootable(zpool_handle_t *zhp) { char bootfs[ZPOOL_MAXNAMELEN]; @@ -1126,7 +1127,7 @@ zpool_add(zpool_handle_t *zhp, nvlist_t return (zfs_error(hdl, EZFS_BADVERSION, msg)); } - if (pool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot, + if (zpool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES, &spares, &nspares) == 0) { uint64_t s; @@ -2412,7 +2413,7 @@ zpool_vdev_attach(zpool_handle_t *zhp, uint_t children; nvlist_t *config_root; libzfs_handle_t *hdl = zhp->zpool_hdl; - boolean_t rootpool = pool_is_bootable(zhp); + boolean_t rootpool = zpool_is_bootable(zhp); if (replacing) (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, @@ -3054,6 +3055,26 @@ zpool_reguid(zpool_handle_t *zhp) } /* + * Reopen the pool. + */ +int +zpool_reopen(zpool_handle_t *zhp) +{ + zfs_cmd_t zc = { 0 }; + char msg[1024]; + libzfs_handle_t *hdl = zhp->zpool_hdl; + + (void) snprintf(msg, sizeof (msg), + dgettext(TEXT_DOMAIN, "cannot reopen '%s'"), + zhp->zpool_name); + + (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); + if (zfs_ioctl(hdl, ZFS_IOC_POOL_REOPEN, &zc) == 0) + return (0); + return (zpool_standard_error(hdl, errno, msg)); +} + +/* * Convert from a devid string to a path. */ static char * @@ -3703,7 +3724,7 @@ zpool_label_disk(libzfs_handle_t *hdl, z if (zhp) { nvlist_t *nvroot; - if (pool_is_bootable(zhp)) { + if (zpool_is_bootable(zhp)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "EFI labeled devices are not supported on root " "pools.")); Modified: stable/9/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Sun Jun 10 07:40:26 2012 (r236839) @@ -21,7 +21,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -81,6 +81,8 @@ zpool_prop_init(void) ZFS_TYPE_POOL, "", "FREE"); zprop_register_number(ZPOOL_PROP_ALLOCATED, "allocated", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "ALLOC"); + zprop_register_number(ZPOOL_PROP_EXPANDSZ, "expandsize", 0, + PROP_READONLY, ZFS_TYPE_POOL, "", "EXPANDSZ"); zprop_register_number(ZPOOL_PROP_CAPACITY, "capacity", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "CAP"); zprop_register_number(ZPOOL_PROP_GUID, "guid", 0, PROP_READONLY, Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 10 07:40:26 2012 (r236839) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* @@ -175,15 +175,17 @@ spa_prop_add_list(nvlist_t *nvl, zpool_p static void spa_prop_get_config(spa_t *spa, nvlist_t **nvp) { + vdev_t *rvd = spa->spa_root_vdev; uint64_t size; uint64_t alloc; + uint64_t space; uint64_t cap, version; zprop_source_t src = ZPROP_SRC_NONE; spa_config_dirent_t *dp; ASSERT(MUTEX_HELD(&spa->spa_props_lock)); - if (spa->spa_root_vdev != NULL) { + if (rvd != NULL) { alloc = metaslab_class_get_alloc(spa_normal_class(spa)); size = metaslab_class_get_space(spa_normal_class(spa)); spa_prop_add_list(*nvp, ZPOOL_PROP_NAME, spa_name(spa), 0, src); @@ -191,6 +193,15 @@ spa_prop_get_config(spa_t *spa, nvlist_t spa_prop_add_list(*nvp, ZPOOL_PROP_ALLOCATED, NULL, alloc, src); spa_prop_add_list(*nvp, ZPOOL_PROP_FREE, NULL, size - alloc, src); + + space = 0; + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + space += tvd->vdev_max_asize - tvd->vdev_asize; + } + spa_prop_add_list(*nvp, ZPOOL_PROP_EXPANDSZ, NULL, space, + src); + spa_prop_add_list(*nvp, ZPOOL_PROP_READONLY, NULL, (spa_mode(spa) == FREAD), src); @@ -201,7 +212,7 @@ spa_prop_get_config(spa_t *spa, nvlist_t ddt_get_pool_dedup_ratio(spa), src); spa_prop_add_list(*nvp, ZPOOL_PROP_HEALTH, NULL, - spa->spa_root_vdev->vdev_state, src); + rvd->vdev_state, src); version = spa_version(spa); if (version == zpool_prop_default_numeric(ZPOOL_PROP_VERSION)) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sun Jun 10 07:40:26 2012 (r236839) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_VDEV_IMPL_H @@ -55,7 +56,8 @@ typedef struct vdev_cache_entry vdev_cac /* * Virtual device operations */ -typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *ashift); +typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size, + uint64_t *ashift); typedef void vdev_close_func_t(vdev_t *vd); typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize); typedef int vdev_io_start_func_t(zio_t *zio); @@ -118,6 +120,7 @@ struct vdev { uint64_t vdev_orig_guid; /* orig. guid prior to remove */ uint64_t vdev_asize; /* allocatable device capacity */ uint64_t vdev_min_asize; /* min acceptable asize */ + uint64_t vdev_max_asize; /* max acceptable asize */ uint64_t vdev_ashift; /* block alignment shift */ uint64_t vdev_state; /* see VDEV_STATE_* #defines */ uint64_t vdev_prevstate; /* used when reopening a vdev */ Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sun Jun 10 07:40:26 2012 (r236839) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -119,7 +119,7 @@ vdev_get_min_asize(vdev_t *vd) vdev_t *pvd = vd->vdev_parent; /* - * The our parent is NULL (inactive spare or cache) or is the root, + * If our parent is NULL (inactive spare or cache) or is the root, * just return our own asize. */ if (pvd == NULL) @@ -748,6 +748,7 @@ vdev_add_parent(vdev_t *cvd, vdev_ops_t mvd->vdev_asize = cvd->vdev_asize; mvd->vdev_min_asize = cvd->vdev_min_asize; + mvd->vdev_max_asize = cvd->vdev_max_asize; mvd->vdev_ashift = cvd->vdev_ashift; mvd->vdev_state = cvd->vdev_state; mvd->vdev_crtxg = cvd->vdev_crtxg; @@ -1119,7 +1120,8 @@ vdev_open(vdev_t *vd) spa_t *spa = vd->vdev_spa; int error; uint64_t osize = 0; - uint64_t asize, psize; + uint64_t max_osize = 0; + uint64_t asize, max_asize, psize; uint64_t ashift = 0; ASSERT(vd->vdev_open_thread == curthread || @@ -1150,7 +1152,7 @@ vdev_open(vdev_t *vd) return (ENXIO); } - error = vd->vdev_ops->vdev_op_open(vd, &osize, &ashift); + error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, &ashift); /* * Reset the vdev_reopening flag so that we actually close @@ -1208,6 +1210,7 @@ vdev_open(vdev_t *vd) } osize = P2ALIGN(osize, (uint64_t)sizeof (vdev_label_t)); + max_osize = P2ALIGN(max_osize, (uint64_t)sizeof (vdev_label_t)); if (vd->vdev_children == 0) { if (osize < SPA_MINDEVSIZE) { @@ -1217,6 +1220,8 @@ vdev_open(vdev_t *vd) } psize = osize; asize = osize - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE); + max_asize = max_osize - (VDEV_LABEL_START_SIZE + + VDEV_LABEL_END_SIZE); } else { if (vd->vdev_parent != NULL && osize < SPA_MINDEVSIZE - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE)) { @@ -1226,6 +1231,7 @@ vdev_open(vdev_t *vd) } psize = 0; asize = osize; + max_asize = max_osize; } vd->vdev_psize = psize; @@ -1245,6 +1251,7 @@ vdev_open(vdev_t *vd) * For testing purposes, a higher ashift can be requested. */ vd->vdev_asize = asize; + vd->vdev_max_asize = max_asize; vd->vdev_ashift = MAX(ashift, vd->vdev_ashift); } else { /* @@ -1255,6 +1262,7 @@ vdev_open(vdev_t *vd) VDEV_AUX_BAD_LABEL); return (EINVAL); } + vd->vdev_max_asize = max_asize; } /* @@ -2478,6 +2486,7 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t * vs->vs_rsize = vdev_get_min_asize(vd); if (vd->vdev_ops->vdev_op_leaf) vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; + vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize; mutex_exit(&vd->vdev_stat_lock); /* Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Sun Jun 10 07:40:26 2012 (r236839) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -30,6 +31,7 @@ #include #include #include +#include #include /* @@ -102,8 +104,39 @@ vdev_disk_rele(vdev_t *vd) } } +static uint64_t +vdev_disk_get_space(vdev_t *vd, uint64_t capacity, uint_t blksz) +{ + ASSERT(vd->vdev_wholedisk); + + vdev_disk_t *dvd = vd->vdev_tsd; + dk_efi_t dk_ioc; + efi_gpt_t *efi; + uint64_t avail_space = 0; + int efisize = EFI_LABEL_SIZE * 2; + + dk_ioc.dki_data = kmem_alloc(efisize, KM_SLEEP); + dk_ioc.dki_lba = 1; + dk_ioc.dki_length = efisize; + dk_ioc.dki_data_64 = (uint64_t)(uintptr_t)dk_ioc.dki_data; + efi = dk_ioc.dki_data; + + if (ldi_ioctl(dvd->vd_lh, DKIOCGETEFI, (intptr_t)&dk_ioc, + FKIOCTL, kcred, NULL) == 0) { + uint64_t efi_altern_lba = LE_64(efi->efi_gpt_AlternateLBA); + + zfs_dbgmsg("vdev %s, capacity %llu, altern lba %llu", + vd->vdev_path, capacity, efi_altern_lba); + if (capacity > efi_altern_lba) + avail_space = (capacity - efi_altern_lba) * blksz; + } + kmem_free(dk_ioc.dki_data, efisize); + return (avail_space); +} + static int -vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { spa_t *spa = vd->vdev_spa; vdev_disk_t *dvd; @@ -274,16 +307,6 @@ skip_open: } /* - * If we own the whole disk, try to enable disk write caching. - * We ignore errors because it's OK if we can't do it. - */ - if (vd->vdev_wholedisk == 1) { - int wce = 1; - (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce, - FKIOCTL, kcred, NULL); - } - - /* * Determine the device's minimum transfer size. * If the ioctl isn't supported, assume DEV_BSIZE. */ @@ -293,6 +316,25 @@ skip_open: *ashift = highbit(MAX(dkmext.dki_pbsize, SPA_MINBLOCKSIZE)) - 1; + if (vd->vdev_wholedisk == 1) { + uint64_t capacity = dkmext.dki_capacity - 1; + uint64_t blksz = dkmext.dki_lbsize; + int wce = 1; + + /* + * If we own the whole disk, try to enable disk write caching. + * We ignore errors because it's OK if we can't do it. + */ + (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce, + FKIOCTL, kcred, NULL); + + *max_psize = *psize + vdev_disk_get_space(vd, capacity, blksz); + zfs_dbgmsg("capacity change: vdev %s, psize %llu, " + "max_psize %llu", vd->vdev_path, *psize, *max_psize); + } else { + *max_psize = *psize; + } + /* * Clear the nowritecache bit, so that on a vdev_reopen() we will * try again. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Sun Jun 10 07:40:26 2012 (r236839) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -47,7 +48,8 @@ vdev_file_rele(vdev_t *vd) } static int -vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { vdev_file_t *vf; vnode_t *vp; @@ -125,7 +127,7 @@ skip_open: return (error); } - *psize = vattr.va_size; + *max_psize = *psize = vattr.va_size; *ashift = SPA_MINBLOCKSHIFT; return (0); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Jun 10 07:40:26 2012 (r236839) @@ -21,6 +21,8 @@ /* * Copyright (c) 2006 Pawel Jakub Dawidek * All rights reserved. + * + * Portions Copyright (c) 2012 Martin Matuska */ #include @@ -405,7 +407,8 @@ vdev_geom_open_by_path(vdev_t *vd, int c } static int -vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { struct g_provider *pp; struct g_consumer *cp; @@ -488,7 +491,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi /* * Determine the actual size of the device. */ - *psize = pp->mediasize; + *max_psize = *psize = pp->mediasize; /* * Determine the device's minimum transfer size. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jun 10 07:40:26 2012 (r236839) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #include #include #include @@ -127,7 +131,8 @@ vdev_mirror_map_alloc(zio_t *zio) } static int -vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { int numerrors = 0; int lasterror = 0; @@ -149,6 +154,7 @@ vdev_mirror_open(vdev_t *vd, uint64_t *a } *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; + *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; *ashift = MAX(*ashift, cvd->vdev_ashift); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Sun Jun 10 07:40:26 2012 (r236839) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* * The 'missing' vdev is a special vdev type used only during import. It * signifies a placeholder in the root vdev for some vdev that we know is * missing. We pass it down to the kernel to allow the rest of the @@ -40,7 +44,8 @@ /* ARGSUSED */ static int -vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { /* * Really this should just fail. But then the root vdev will be in the @@ -49,6 +54,7 @@ vdev_missing_open(vdev_t *vd, uint64_t * * will fail the GUID sum check before ever trying to open the pool. */ *psize = 0; + *max_psize = 0; *ashift = 0; return (0); } Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Sun Jun 10 07:40:26 2012 (r236839) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -1441,7 +1442,8 @@ vdev_raidz_reconstruct(raidz_map_t *rm, } static int -vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { vdev_t *cvd; uint64_t nparity = vd->vdev_nparity; @@ -1469,10 +1471,12 @@ vdev_raidz_open(vdev_t *vd, uint64_t *as } *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; + *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; *ashift = MAX(*ashift, cvd->vdev_ashift); } *asize *= vd->vdev_children; + *max_asize *= vd->vdev_children; if (numerrors > nparity) { vd->vdev_stat.vs_aux = VDEV_AUX_NO_REPLICAS; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c Sun Jun 10 07:24:04 2012 (r236838) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c Sun Jun 10 07:40:26 2012 (r236839) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 07:40:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE67E1065674; Sun, 10 Jun 2012 07:40:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A416D8FC19; Sun, 10 Jun 2012 07:40:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A7ehat081035; Sun, 10 Jun 2012 07:40:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A7ehXs081018; Sun, 10 Jun 2012 07:40:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206100740.q5A7ehXs081018@svn.freebsd.org> From: Martin Matuska Date: Sun, 10 Jun 2012 07:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236840 - in stable/8: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/z... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 07:40:43 -0000 Author: mm Date: Sun Jun 10 07:40:43 2012 New Revision: 236840 URL: http://svn.freebsd.org/changeset/base/236840 Log: MFC r236155: Import illumos changeset 13570:3411fd5f1589 1948 zpool list should show more detailed pool information Display per-vdev information with "zpool list -v". The added expandsize property has currently no value on FreeBSD. This changeset allows adding expansion support to individual vdevs in the future. References: https://www.illumos.org/issues/1948 Obtained from: illumos (issue #1948) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Sun Jun 10 07:40:43 2012 (r236840) @@ -537,6 +537,8 @@ value of 1.76 indicates that 1.76 units for a description of the deduplication feature. .It Sy free Number of blocks within the pool that are not allocated. +.It Sy expandsize +This property has currently no value on FreeBSD. .It Sy guid A unique identifier for the pool. .It Sy health @@ -1275,7 +1277,7 @@ Treat exported or foreign devices as ina .It Xo .Nm .Cm list -.Op Fl H +.Op Fl Hv .Op Fl o Ar property Ns Op , Ns Ar ... .Op Fl T Cm d Ns | Ns Cm u .Op Ar pool Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Sun Jun 10 07:40:43 2012 (r236840) @@ -22,9 +22,9 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. - * Copyright (c) 2011 Martin Matuska . All rights reserved. + * Copyright (c) 2012 Martin Matuska . All rights reserved. */ #include @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,7 @@ static int zpool_do_status(int, char **) static int zpool_do_online(int, char **); static int zpool_do_offline(int, char **); static int zpool_do_clear(int, char **); +static int zpool_do_reopen(int, char **); static int zpool_do_reguid(int, char **); @@ -132,7 +134,8 @@ typedef enum { HELP_GET, HELP_SET, HELP_SPLIT, - HELP_REGUID + HELP_REGUID, + HELP_REOPEN } zpool_help_t; @@ -167,6 +170,7 @@ static zpool_command_t command_table[] = { "online", zpool_do_online, HELP_ONLINE }, { "offline", zpool_do_offline, HELP_OFFLINE }, { "clear", zpool_do_clear, HELP_CLEAR }, + { "reopen", zpool_do_reopen, HELP_REOPEN }, { NULL }, { "attach", zpool_do_attach, HELP_ATTACH }, { "detach", zpool_do_detach, HELP_DETACH }, @@ -241,6 +245,8 @@ get_usage(zpool_help_t idx) { "[new-device]\n")); case HELP_REMOVE: return (gettext("\tremove ...\n")); + case HELP_REOPEN: + return (""); /* Undocumented command */ case HELP_SCRUB: return (gettext("\tscrub [-s] ...\n")); case HELP_STATUS: @@ -2109,10 +2115,10 @@ error: } typedef struct iostat_cbdata { - zpool_list_t *cb_list; - int cb_verbose; - int cb_iteration; + boolean_t cb_verbose; int cb_namewidth; + int cb_iteration; + zpool_list_t *cb_list; } iostat_cbdata_t; static void @@ -2582,8 +2588,9 @@ zpool_do_iostat(int argc, char **argv) } typedef struct list_cbdata { + boolean_t cb_verbose; + int cb_namewidth; boolean_t cb_scripted; - boolean_t cb_first; zprop_list_t *cb_proplist; } list_cbdata_t; @@ -2591,16 +2598,27 @@ typedef struct list_cbdata { * Given a list of columns to display, output appropriate headers for each one. */ static void -print_header(zprop_list_t *pl) +print_header(list_cbdata_t *cb) { + zprop_list_t *pl = cb->cb_proplist; const char *header; boolean_t first = B_TRUE; boolean_t right_justify; + size_t width = 0; for (; pl != NULL; pl = pl->pl_next) { if (pl->pl_prop == ZPROP_INVAL) continue; + width = pl->pl_width; + if (first && cb->cb_verbose) { + /* + * Reset the width to accommodate the verbose listing + * of devices. + */ + width = cb->cb_namewidth; + } + if (!first) (void) printf(" "); else @@ -2612,9 +2630,10 @@ print_header(zprop_list_t *pl) if (pl->pl_next == NULL && !right_justify) (void) printf("%s", header); else if (right_justify) - (void) printf("%*s", pl->pl_width, header); + (void) printf("%*s", width, header); else - (void) printf("%-*s", pl->pl_width, header); + (void) printf("%-*s", width, header); + } (void) printf("\n"); @@ -2625,17 +2644,28 @@ print_header(zprop_list_t *pl) * to the described layout. */ static void -print_pool(zpool_handle_t *zhp, zprop_list_t *pl, int scripted) +print_pool(zpool_handle_t *zhp, list_cbdata_t *cb) { + zprop_list_t *pl = cb->cb_proplist; boolean_t first = B_TRUE; char property[ZPOOL_MAXPROPLEN]; char *propstr; boolean_t right_justify; - int width; + size_t width; for (; pl != NULL; pl = pl->pl_next) { + + width = pl->pl_width; + if (first && cb->cb_verbose) { + /* + * Reset the width to accommodate the verbose listing + * of devices. + */ + width = cb->cb_namewidth; + } + if (!first) { - if (scripted) + if (cb->cb_scripted) (void) printf("\t"); else (void) printf(" "); @@ -2645,7 +2675,10 @@ print_pool(zpool_handle_t *zhp, zprop_li right_justify = B_FALSE; if (pl->pl_prop != ZPROP_INVAL) { - if (zpool_get_prop(zhp, pl->pl_prop, property, + if (pl->pl_prop == ZPOOL_PROP_EXPANDSZ && + zpool_get_prop_int(zhp, pl->pl_prop, NULL) == 0) + propstr = "-"; + else if (zpool_get_prop(zhp, pl->pl_prop, property, sizeof (property), NULL) != 0) propstr = "-"; else @@ -2656,14 +2689,13 @@ print_pool(zpool_handle_t *zhp, zprop_li propstr = "-"; } - width = pl->pl_width; /* * If this is being called in scripted mode, or if this is the * last column and it is left-justified, don't include a width * format specifier. */ - if (scripted || (pl->pl_next == NULL && !right_justify)) + if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify)) (void) printf("%s", propstr); else if (right_justify) (void) printf("%*s", width, propstr); @@ -2674,6 +2706,101 @@ print_pool(zpool_handle_t *zhp, zprop_li (void) printf("\n"); } +static void +print_one_column(zpool_prop_t prop, uint64_t value, boolean_t scripted) +{ + char propval[64]; + boolean_t fixed; + size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL); + + zfs_nicenum(value, propval, sizeof (propval)); + + if (prop == ZPOOL_PROP_EXPANDSZ && value == 0) + (void) strlcpy(propval, "-", sizeof (propval)); + + if (scripted) + (void) printf("\t%s", propval); + else + (void) printf(" %*s", width, propval); +} + +void +print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, + list_cbdata_t *cb, int depth) +{ + nvlist_t **child; + vdev_stat_t *vs; + uint_t c, children; + char *vname; + boolean_t scripted = cb->cb_scripted; + + verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, + (uint64_t **)&vs, &c) == 0); + + if (name != NULL) { + if (scripted) + (void) printf("\t%s", name); + else if (strlen(name) + depth > cb->cb_namewidth) + (void) printf("%*s%s", depth, "", name); + else + (void) printf("%*s%s%*s", depth, "", name, + (int)(cb->cb_namewidth - strlen(name) - depth), ""); + + /* only toplevel vdevs have capacity stats */ + if (vs->vs_space == 0) { + if (scripted) + (void) printf("\t-\t-\t-"); + else + (void) printf(" - - -"); + } else { + print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, + scripted); + print_one_column(ZPOOL_PROP_CAPACITY, vs->vs_alloc, + scripted); + print_one_column(ZPOOL_PROP_FREE, + vs->vs_space - vs->vs_alloc, scripted); + } + print_one_column(ZPOOL_PROP_EXPANDSZ, vs->vs_esize, + scripted); + (void) printf("\n"); + } + + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, + &child, &children) != 0) + return; + + for (c = 0; c < children; c++) { + uint64_t ishole = B_FALSE; + + if (nvlist_lookup_uint64(child[c], + ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole) + continue; + + vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE); + print_list_stats(zhp, vname, child[c], cb, depth + 2); + free(vname); + } + + /* + * Include level 2 ARC devices in iostat output + */ + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, + &child, &children) != 0) + return; + + if (children > 0) { + (void) printf("%-*s - - - - - " + "-\n", cb->cb_namewidth, "cache"); + for (c = 0; c < children; c++) { + vname = zpool_vdev_name(g_zfs, zhp, child[c], + B_FALSE); + print_list_stats(zhp, vname, child[c], cb, depth + 2); + free(vname); + } + } +} + + /* * Generic callback function to list a pool. */ @@ -2681,14 +2808,18 @@ int list_callback(zpool_handle_t *zhp, void *data) { list_cbdata_t *cbp = data; + nvlist_t *config; + nvlist_t *nvroot; - if (cbp->cb_first) { - if (!cbp->cb_scripted) - print_header(cbp->cb_proplist); - cbp->cb_first = B_FALSE; - } + config = zpool_get_config(zhp, NULL); - print_pool(zhp, cbp->cb_proplist, cbp->cb_scripted); + print_pool(zhp, cbp); + if (!cbp->cb_verbose) + return (0); + + verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, + &nvroot) == 0); + print_list_stats(zhp, NULL, nvroot, cbp, 0); return (0); } @@ -2712,12 +2843,15 @@ zpool_do_list(int argc, char **argv) int ret; list_cbdata_t cb = { 0 }; static char default_props[] = - "name,size,allocated,free,capacity,dedupratio,health,altroot"; + "name,size,allocated,free,capacity,dedupratio," + "health,altroot"; char *props = default_props; unsigned long interval = 0, count = 0; + zpool_list_t *list; + boolean_t first = B_TRUE; /* check options */ - while ((c = getopt(argc, argv, ":Ho:T:")) != -1) { + while ((c = getopt(argc, argv, ":Ho:T:v")) != -1) { switch (c) { case 'H': cb.cb_scripted = B_TRUE; @@ -2728,6 +2862,9 @@ zpool_do_list(int argc, char **argv) case 'T': get_timestamp_arg(*optarg); break; + case 'v': + cb.cb_verbose = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -2748,21 +2885,32 @@ zpool_do_list(int argc, char **argv) if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) != 0) usage(B_FALSE); - cb.cb_first = B_TRUE; + if ((list = pool_list_get(argc, argv, &cb.cb_proplist, &ret)) == NULL) + return (1); + + if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) { + (void) printf(gettext("no pools available\n")); + zprop_free_list(cb.cb_proplist); + return (0); + } for (;;) { + pool_list_update(list); + + if (pool_list_count(list) == 0) + break; + + cb.cb_namewidth = 0; + (void) pool_list_iter(list, B_FALSE, get_namewidth, &cb); if (timestamp_fmt != NODATE) print_timestamp(timestamp_fmt); - ret = for_each_pool(argc, argv, B_TRUE, &cb.cb_proplist, - list_callback, &cb); - - if (argc == 0 && cb.cb_first && !cb.cb_scripted) { - (void) printf(gettext("no pools available\n")); - zprop_free_list(cb.cb_proplist); - return (0); + if (!cb.cb_scripted && (first || cb.cb_verbose)) { + print_header(&cb); + first = B_FALSE; } + ret = pool_list_iter(list, B_TRUE, list_callback, &cb); if (interval == 0) break; @@ -3382,6 +3530,36 @@ zpool_do_reguid(int argc, char **argv) } +/* + * zpool reopen + * + * Reopen the pool so that the kernel can update the sizes of all vdevs. + * + * NOTE: This command is currently undocumented. If the command is ever + * exposed then the appropriate usage() messages will need to be made. + */ +int +zpool_do_reopen(int argc, char **argv) +{ + int ret = 0; + zpool_handle_t *zhp; + char *pool; + + argc--; + argv++; + + if (argc != 1) + return (2); + + pool = argv[0]; + if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) + return (1); + + ret = zpool_reopen(zhp); + zpool_close(zhp); + return (ret); +} + typedef struct scrub_cbdata { int cb_type; int cb_argc; Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Jun 10 07:40:43 2012 (r236840) @@ -24,7 +24,7 @@ * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . * All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. */ @@ -237,6 +237,7 @@ typedef struct splitflags { extern int zpool_scan(zpool_handle_t *, pool_scan_func_t); extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *); extern int zpool_reguid(zpool_handle_t *); +extern int zpool_reopen(zpool_handle_t *); extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Sun Jun 10 07:40:43 2012 (r236840) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -301,6 +301,7 @@ zpool_get_prop(zpool_handle_t *zhp, zpoo case ZPOOL_PROP_SIZE: case ZPOOL_PROP_ALLOCATED: case ZPOOL_PROP_FREE: + case ZPOOL_PROP_EXPANDSZ: (void) zfs_nicenum(intval, buf, len); break; @@ -390,8 +391,8 @@ pool_uses_efi(nvlist_t *config) return (B_FALSE); } -static boolean_t -pool_is_bootable(zpool_handle_t *zhp) +boolean_t +zpool_is_bootable(zpool_handle_t *zhp) { char bootfs[ZPOOL_MAXNAMELEN]; @@ -1126,7 +1127,7 @@ zpool_add(zpool_handle_t *zhp, nvlist_t return (zfs_error(hdl, EZFS_BADVERSION, msg)); } - if (pool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot, + if (zpool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES, &spares, &nspares) == 0) { uint64_t s; @@ -2412,7 +2413,7 @@ zpool_vdev_attach(zpool_handle_t *zhp, uint_t children; nvlist_t *config_root; libzfs_handle_t *hdl = zhp->zpool_hdl; - boolean_t rootpool = pool_is_bootable(zhp); + boolean_t rootpool = zpool_is_bootable(zhp); if (replacing) (void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN, @@ -3054,6 +3055,26 @@ zpool_reguid(zpool_handle_t *zhp) } /* + * Reopen the pool. + */ +int +zpool_reopen(zpool_handle_t *zhp) +{ + zfs_cmd_t zc = { 0 }; + char msg[1024]; + libzfs_handle_t *hdl = zhp->zpool_hdl; + + (void) snprintf(msg, sizeof (msg), + dgettext(TEXT_DOMAIN, "cannot reopen '%s'"), + zhp->zpool_name); + + (void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name)); + if (zfs_ioctl(hdl, ZFS_IOC_POOL_REOPEN, &zc) == 0) + return (0); + return (zpool_standard_error(hdl, errno, msg)); +} + +/* * Convert from a devid string to a path. */ static char * @@ -3703,7 +3724,7 @@ zpool_label_disk(libzfs_handle_t *hdl, z if (zhp) { nvlist_t *nvroot; - if (pool_is_bootable(zhp)) { + if (zpool_is_bootable(zhp)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "EFI labeled devices are not supported on root " "pools.")); Modified: stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Sun Jun 10 07:40:43 2012 (r236840) @@ -21,7 +21,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -81,6 +81,8 @@ zpool_prop_init(void) ZFS_TYPE_POOL, "", "FREE"); zprop_register_number(ZPOOL_PROP_ALLOCATED, "allocated", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "ALLOC"); + zprop_register_number(ZPOOL_PROP_EXPANDSZ, "expandsize", 0, + PROP_READONLY, ZFS_TYPE_POOL, "", "EXPANDSZ"); zprop_register_number(ZPOOL_PROP_CAPACITY, "capacity", 0, PROP_READONLY, ZFS_TYPE_POOL, "", "CAP"); zprop_register_number(ZPOOL_PROP_GUID, "guid", 0, PROP_READONLY, Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sun Jun 10 07:40:43 2012 (r236840) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ /* @@ -175,15 +175,17 @@ spa_prop_add_list(nvlist_t *nvl, zpool_p static void spa_prop_get_config(spa_t *spa, nvlist_t **nvp) { + vdev_t *rvd = spa->spa_root_vdev; uint64_t size; uint64_t alloc; + uint64_t space; uint64_t cap, version; zprop_source_t src = ZPROP_SRC_NONE; spa_config_dirent_t *dp; ASSERT(MUTEX_HELD(&spa->spa_props_lock)); - if (spa->spa_root_vdev != NULL) { + if (rvd != NULL) { alloc = metaslab_class_get_alloc(spa_normal_class(spa)); size = metaslab_class_get_space(spa_normal_class(spa)); spa_prop_add_list(*nvp, ZPOOL_PROP_NAME, spa_name(spa), 0, src); @@ -191,6 +193,15 @@ spa_prop_get_config(spa_t *spa, nvlist_t spa_prop_add_list(*nvp, ZPOOL_PROP_ALLOCATED, NULL, alloc, src); spa_prop_add_list(*nvp, ZPOOL_PROP_FREE, NULL, size - alloc, src); + + space = 0; + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *tvd = rvd->vdev_child[c]; + space += tvd->vdev_max_asize - tvd->vdev_asize; + } + spa_prop_add_list(*nvp, ZPOOL_PROP_EXPANDSZ, NULL, space, + src); + spa_prop_add_list(*nvp, ZPOOL_PROP_READONLY, NULL, (spa_mode(spa) == FREAD), src); @@ -201,7 +212,7 @@ spa_prop_get_config(spa_t *spa, nvlist_t ddt_get_pool_dedup_ratio(spa), src); spa_prop_add_list(*nvp, ZPOOL_PROP_HEALTH, NULL, - spa->spa_root_vdev->vdev_state, src); + rvd->vdev_state, src); version = spa_version(spa); if (version == zpool_prop_default_numeric(ZPOOL_PROP_VERSION)) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Sun Jun 10 07:40:43 2012 (r236840) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #ifndef _SYS_VDEV_IMPL_H @@ -55,7 +56,8 @@ typedef struct vdev_cache_entry vdev_cac /* * Virtual device operations */ -typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *ashift); +typedef int vdev_open_func_t(vdev_t *vd, uint64_t *size, uint64_t *max_size, + uint64_t *ashift); typedef void vdev_close_func_t(vdev_t *vd); typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize); typedef int vdev_io_start_func_t(zio_t *zio); @@ -118,6 +120,7 @@ struct vdev { uint64_t vdev_orig_guid; /* orig. guid prior to remove */ uint64_t vdev_asize; /* allocatable device capacity */ uint64_t vdev_min_asize; /* min acceptable asize */ + uint64_t vdev_max_asize; /* max acceptable asize */ uint64_t vdev_ashift; /* block alignment shift */ uint64_t vdev_state; /* see VDEV_STATE_* #defines */ uint64_t vdev_prevstate; /* used when reopening a vdev */ Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sun Jun 10 07:40:43 2012 (r236840) @@ -22,7 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -119,7 +119,7 @@ vdev_get_min_asize(vdev_t *vd) vdev_t *pvd = vd->vdev_parent; /* - * The our parent is NULL (inactive spare or cache) or is the root, + * If our parent is NULL (inactive spare or cache) or is the root, * just return our own asize. */ if (pvd == NULL) @@ -748,6 +748,7 @@ vdev_add_parent(vdev_t *cvd, vdev_ops_t mvd->vdev_asize = cvd->vdev_asize; mvd->vdev_min_asize = cvd->vdev_min_asize; + mvd->vdev_max_asize = cvd->vdev_max_asize; mvd->vdev_ashift = cvd->vdev_ashift; mvd->vdev_state = cvd->vdev_state; mvd->vdev_crtxg = cvd->vdev_crtxg; @@ -1119,7 +1120,8 @@ vdev_open(vdev_t *vd) spa_t *spa = vd->vdev_spa; int error; uint64_t osize = 0; - uint64_t asize, psize; + uint64_t max_osize = 0; + uint64_t asize, max_asize, psize; uint64_t ashift = 0; ASSERT(vd->vdev_open_thread == curthread || @@ -1150,7 +1152,7 @@ vdev_open(vdev_t *vd) return (ENXIO); } - error = vd->vdev_ops->vdev_op_open(vd, &osize, &ashift); + error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, &ashift); /* * Reset the vdev_reopening flag so that we actually close @@ -1208,6 +1210,7 @@ vdev_open(vdev_t *vd) } osize = P2ALIGN(osize, (uint64_t)sizeof (vdev_label_t)); + max_osize = P2ALIGN(max_osize, (uint64_t)sizeof (vdev_label_t)); if (vd->vdev_children == 0) { if (osize < SPA_MINDEVSIZE) { @@ -1217,6 +1220,8 @@ vdev_open(vdev_t *vd) } psize = osize; asize = osize - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE); + max_asize = max_osize - (VDEV_LABEL_START_SIZE + + VDEV_LABEL_END_SIZE); } else { if (vd->vdev_parent != NULL && osize < SPA_MINDEVSIZE - (VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE)) { @@ -1226,6 +1231,7 @@ vdev_open(vdev_t *vd) } psize = 0; asize = osize; + max_asize = max_osize; } vd->vdev_psize = psize; @@ -1245,6 +1251,7 @@ vdev_open(vdev_t *vd) * For testing purposes, a higher ashift can be requested. */ vd->vdev_asize = asize; + vd->vdev_max_asize = max_asize; vd->vdev_ashift = MAX(ashift, vd->vdev_ashift); } else { /* @@ -1255,6 +1262,7 @@ vdev_open(vdev_t *vd) VDEV_AUX_BAD_LABEL); return (EINVAL); } + vd->vdev_max_asize = max_asize; } /* @@ -2478,6 +2486,7 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t * vs->vs_rsize = vdev_get_min_asize(vd); if (vd->vdev_ops->vdev_op_leaf) vs->vs_rsize += VDEV_LABEL_START_SIZE + VDEV_LABEL_END_SIZE; + vs->vs_esize = vd->vdev_max_asize - vd->vdev_asize; mutex_exit(&vd->vdev_stat_lock); /* Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Sun Jun 10 07:40:43 2012 (r236840) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -30,6 +31,7 @@ #include #include #include +#include #include /* @@ -102,8 +104,39 @@ vdev_disk_rele(vdev_t *vd) } } +static uint64_t +vdev_disk_get_space(vdev_t *vd, uint64_t capacity, uint_t blksz) +{ + ASSERT(vd->vdev_wholedisk); + + vdev_disk_t *dvd = vd->vdev_tsd; + dk_efi_t dk_ioc; + efi_gpt_t *efi; + uint64_t avail_space = 0; + int efisize = EFI_LABEL_SIZE * 2; + + dk_ioc.dki_data = kmem_alloc(efisize, KM_SLEEP); + dk_ioc.dki_lba = 1; + dk_ioc.dki_length = efisize; + dk_ioc.dki_data_64 = (uint64_t)(uintptr_t)dk_ioc.dki_data; + efi = dk_ioc.dki_data; + + if (ldi_ioctl(dvd->vd_lh, DKIOCGETEFI, (intptr_t)&dk_ioc, + FKIOCTL, kcred, NULL) == 0) { + uint64_t efi_altern_lba = LE_64(efi->efi_gpt_AlternateLBA); + + zfs_dbgmsg("vdev %s, capacity %llu, altern lba %llu", + vd->vdev_path, capacity, efi_altern_lba); + if (capacity > efi_altern_lba) + avail_space = (capacity - efi_altern_lba) * blksz; + } + kmem_free(dk_ioc.dki_data, efisize); + return (avail_space); +} + static int -vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { spa_t *spa = vd->vdev_spa; vdev_disk_t *dvd; @@ -274,16 +307,6 @@ skip_open: } /* - * If we own the whole disk, try to enable disk write caching. - * We ignore errors because it's OK if we can't do it. - */ - if (vd->vdev_wholedisk == 1) { - int wce = 1; - (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce, - FKIOCTL, kcred, NULL); - } - - /* * Determine the device's minimum transfer size. * If the ioctl isn't supported, assume DEV_BSIZE. */ @@ -293,6 +316,25 @@ skip_open: *ashift = highbit(MAX(dkmext.dki_pbsize, SPA_MINBLOCKSIZE)) - 1; + if (vd->vdev_wholedisk == 1) { + uint64_t capacity = dkmext.dki_capacity - 1; + uint64_t blksz = dkmext.dki_lbsize; + int wce = 1; + + /* + * If we own the whole disk, try to enable disk write caching. + * We ignore errors because it's OK if we can't do it. + */ + (void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce, + FKIOCTL, kcred, NULL); + + *max_psize = *psize + vdev_disk_get_space(vd, capacity, blksz); + zfs_dbgmsg("capacity change: vdev %s, psize %llu, " + "max_psize %llu", vd->vdev_path, *psize, *max_psize); + } else { + *max_psize = *psize; + } + /* * Clear the nowritecache bit, so that on a vdev_reopen() we will * try again. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Sun Jun 10 07:40:43 2012 (r236840) @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -47,7 +48,8 @@ vdev_file_rele(vdev_t *vd) } static int -vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { vdev_file_t *vf; vnode_t *vp; @@ -125,7 +127,7 @@ skip_open: return (error); } - *psize = vattr.va_size; + *max_psize = *psize = vattr.va_size; *ashift = SPA_MINBLOCKSHIFT; return (0); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Jun 10 07:40:43 2012 (r236840) @@ -21,6 +21,8 @@ /* * Copyright (c) 2006 Pawel Jakub Dawidek * All rights reserved. + * + * Portions Copyright (c) 2012 Martin Matuska */ #include @@ -405,7 +407,8 @@ vdev_geom_open_by_path(vdev_t *vd, int c } static int -vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { struct g_provider *pp; struct g_consumer *cp; @@ -488,7 +491,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi /* * Determine the actual size of the device. */ - *psize = pp->mediasize; + *max_psize = *psize = pp->mediasize; /* * Determine the device's minimum transfer size. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Sun Jun 10 07:40:43 2012 (r236840) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + #include #include #include @@ -127,7 +131,8 @@ vdev_mirror_map_alloc(zio_t *zio) } static int -vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_mirror_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { int numerrors = 0; int lasterror = 0; @@ -149,6 +154,7 @@ vdev_mirror_open(vdev_t *vd, uint64_t *a } *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; + *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; *ashift = MAX(*ashift, cvd->vdev_ashift); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Sun Jun 10 07:40:43 2012 (r236840) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* * The 'missing' vdev is a special vdev type used only during import. It * signifies a placeholder in the root vdev for some vdev that we know is * missing. We pass it down to the kernel to allow the rest of the @@ -40,7 +44,8 @@ /* ARGSUSED */ static int -vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift) +vdev_missing_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize, + uint64_t *ashift) { /* * Really this should just fail. But then the root vdev will be in the @@ -49,6 +54,7 @@ vdev_missing_open(vdev_t *vd, uint64_t * * will fail the GUID sum check before ever trying to open the pool. */ *psize = 0; + *max_psize = 0; *ashift = 0; return (0); } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Sun Jun 10 07:40:43 2012 (r236840) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -1441,7 +1442,8 @@ vdev_raidz_reconstruct(raidz_map_t *rm, } static int -vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *ashift) +vdev_raidz_open(vdev_t *vd, uint64_t *asize, uint64_t *max_asize, + uint64_t *ashift) { vdev_t *cvd; uint64_t nparity = vd->vdev_nparity; @@ -1469,10 +1471,12 @@ vdev_raidz_open(vdev_t *vd, uint64_t *as } *asize = MIN(*asize - 1, cvd->vdev_asize - 1) + 1; + *max_asize = MIN(*max_asize - 1, cvd->vdev_max_asize - 1) + 1; *ashift = MAX(*ashift, cvd->vdev_ashift); } *asize *= vd->vdev_children; + *max_asize *= vd->vdev_children; if (numerrors > nparity) { vd->vdev_stat.vs_aux = VDEV_AUX_NO_REPLICAS; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c Sun Jun 10 07:40:26 2012 (r236839) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c Sun Jun 10 07:40:43 2012 (r236840) @@ -23,6 +23,10 @@ * Use is subject to license terms. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 10:37:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D738D1065673; Sun, 10 Jun 2012 10:37:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B78F48FC0C; Sun, 10 Jun 2012 10:37:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AAbLGQ091787; Sun, 10 Jun 2012 10:37:21 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AAbLic091785; Sun, 10 Jun 2012 10:37:21 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201206101037.q5AAbLic091785@svn.freebsd.org> From: Andrew Turner Date: Sun, 10 Jun 2012 10:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236845 - head/sys/arm/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 10:37:22 -0000 Author: andrew Date: Sun Jun 10 10:37:21 2012 New Revision: 236845 URL: http://svn.freebsd.org/changeset/base/236845 Log: The GUMSTIX-QEMU config file is almost identical to the GUMSTIX config, include the latter file from the former rather than duplicating it. Modified: head/sys/arm/conf/GUMSTIX-QEMU Modified: head/sys/arm/conf/GUMSTIX-QEMU ============================================================================== --- head/sys/arm/conf/GUMSTIX-QEMU Sun Jun 10 08:34:04 2012 (r236844) +++ head/sys/arm/conf/GUMSTIX-QEMU Sun Jun 10 10:37:21 2012 (r236845) @@ -17,76 +17,9 @@ # # $FreeBSD$ -ident GUMSTIX-QEMU -cpu CPU_XSCALE_PXA2X0 - -# This probably wants to move somewhere else. Maybe we can create a basic -# PXA2X0 config, then make a GUMSTIX config that includes the basic one, -# adds the smc and smcphy devices and pulls in this hints file. -hints "GUMSTIX.hints" - -options PHYSADDR=0xa0000000 -options KERNPHYSADDR=0xa0200000 -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm - -options STARTUP_PAGETABLE_ADDR=0xa0000000 -include "../xscale/pxa/std.pxa" -makeoptions MODULES_OVERRIDE="" +include GUMSTIX -makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -options HZ=100 -#options DEVICE_POLLING +ident GUMSTIX-QEMU options QEMU_WORKAROUNDS nooptions ARM_CACHE_LOCK_ENABLE # QEMU does not implement this - -options SCHED_4BSD #4BSD scheduler -options INET #InterNETworking -#options INET6 #IPv6 communications protocols -options FFS #Berkeley Fast Filesystem -options SOFTUPDATES #Enable FFS soft updates support -options UFS_ACL #Support for access control lists -options UFS_DIRHASH #Improve performance on big directories -options NFSCL #New Network Filesystem Client -#options NFSD #New Network Filesystem Server -options NFS_ROOT #NFS usable as /, requires NFSCL -#options MSDOSFS #MSDOS Filesystem -#options CD9660 #ISO 9660 Filesystem -#options PROCFS #Process filesystem (requires PSEUDOFS) -options PSEUDOFS #Pseudo-filesystem framework -options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] -options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI -options KTRACE #ktrace(1) support -options SYSVSHM #SYSV-style shared memory -options SYSVMSG #SYSV-style message queues -options SYSVSEM #SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions -options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options BOOTP -options BOOTP_NFSROOT -options BOOTP_WIRED_TO=smc0 -options BOOTP_COMPAT -options BOOTP_NFSV3 -options BOOTP_BLOCKSIZE=4096 -options PREEMPTION -device loop -device ether -device mii -device mii_bitbang -device smc -device smcphy -device uart -device uart_ns8250 - -# Debugging for use in -current -options KDB -options DDB #Enable the kernel debugger -#options DEADLKRES #Enable the deadlock resolver -#options INVARIANTS #Enable calls of extra sanity checking -#options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS -#options WITNESS #Enable checks to detect deadlocks and cycles -#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options DIAGNOSTIC - -device md -device random # Entropy device From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 10:40:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89AFD106564A; Sun, 10 Jun 2012 10:40:23 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E0B48FC21; Sun, 10 Jun 2012 10:40:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AAeN5x091947; Sun, 10 Jun 2012 10:40:23 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AAeNQG091941; Sun, 10 Jun 2012 10:40:23 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201206101040.q5AAeNQG091941@svn.freebsd.org> From: Andrew Turner Date: Sun, 10 Jun 2012 10:40:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236846 - in head/sys/arm: at91 econa xscale/i80321 xscale/pxa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 10:40:23 -0000 Author: andrew Date: Sun Jun 10 10:40:22 2012 New Revision: 236846 URL: http://svn.freebsd.org/changeset/base/236846 Log: Remove an unneeded increment from initarm. The variable is uninitialised, is not used in this part of the function and correctly initialised later when it is used. Modified: head/sys/arm/at91/at91_machdep.c head/sys/arm/econa/econa_machdep.c head/sys/arm/xscale/i80321/ep80219_machdep.c head/sys/arm/xscale/pxa/pxa_machdep.c Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Sun Jun 10 10:37:21 2012 (r236845) +++ head/sys/arm/at91/at91_machdep.c Sun Jun 10 10:40:22 2012 (r236846) @@ -426,7 +426,6 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_va - KERNVIRTADDR + KERNPHYSADDR; } - i++; } /* * Allocate a page for the system page mapped to V0x00000000 Modified: head/sys/arm/econa/econa_machdep.c ============================================================================== --- head/sys/arm/econa/econa_machdep.c Sun Jun 10 10:37:21 2012 (r236845) +++ head/sys/arm/econa/econa_machdep.c Sun Jun 10 10:40:22 2012 (r236846) @@ -230,7 +230,6 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_va - KERNVIRTADDR + KERNPHYSADDR; } - i++; } /* * Allocate a page for the system page mapped to V0x00000000 Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/ep80219_machdep.c Sun Jun 10 10:37:21 2012 (r236845) +++ head/sys/arm/xscale/i80321/ep80219_machdep.c Sun Jun 10 10:40:22 2012 (r236846) @@ -225,7 +225,6 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa + 0x20000000; } - i++; } freemem_pt = freemempos; freemempos = 0xa0100000; Modified: head/sys/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- head/sys/arm/xscale/pxa/pxa_machdep.c Sun Jun 10 10:37:21 2012 (r236845) +++ head/sys/arm/xscale/pxa/pxa_machdep.c Sun Jun 10 10:40:22 2012 (r236846) @@ -208,7 +208,6 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa + 0x20000000; } - i++; } freemem_pt = freemempos; freemempos = 0xa0100000; From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 11:17:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5B2C1106564A; Sun, 10 Jun 2012 11:17:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3BCFE8FC1A; Sun, 10 Jun 2012 11:17:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ABHFwj093681; Sun, 10 Jun 2012 11:17:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ABHEQX093676; Sun, 10 Jun 2012 11:17:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206101117.q5ABHEQX093676@svn.freebsd.org> From: Alexander Motin Date: Sun, 10 Jun 2012 11:17:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236847 - in head/sys/dev: ahci ata mvs siis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 11:17:15 -0000 Author: mav Date: Sun Jun 10 11:17:14 2012 New Revision: 236847 URL: http://svn.freebsd.org/changeset/base/236847 Log: Partially revert r236666: Return PROTO_ATA protocol in response to XPT_PATH_INQ. smartmontools uses it to identify ATA devices and I don't know any other place now where it is important. It could probably use XPT_GDEV_TYPE instead for more accurate protocol information, but let it live for now. Reported by: matthew MFC after: 3 days Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ata/ata-all.c head/sys/dev/mvs/mvs.c head/sys/dev/siis/siis.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sun Jun 10 10:40:22 2012 (r236846) +++ head/sys/dev/ahci/ahci.c Sun Jun 10 11:17:14 2012 (r236847) @@ -2970,7 +2970,7 @@ ahciaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Sun Jun 10 10:40:22 2012 (r236846) +++ head/sys/dev/ata/ata-all.c Sun Jun 10 11:17:14 2012 (r236847) @@ -1875,7 +1875,7 @@ ataaction(struct cam_sim *sim, union ccb else cpi->transport = XPORT_ATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; if (device_get_devclass(device_get_parent(parent)) == Modified: head/sys/dev/mvs/mvs.c ============================================================================== --- head/sys/dev/mvs/mvs.c Sun Jun 10 10:40:22 2012 (r236846) +++ head/sys/dev/mvs/mvs.c Sun Jun 10 11:17:14 2012 (r236847) @@ -2385,7 +2385,7 @@ mvsaction(struct cam_sim *sim, union ccb cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; if ((ch->quirks & MVS_Q_SOC) == 0) { Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Sun Jun 10 10:40:22 2012 (r236846) +++ head/sys/dev/siis/siis.c Sun Jun 10 11:17:14 2012 (r236847) @@ -1960,7 +1960,7 @@ siisaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; cpi->hba_vendor = pci_get_vendor(parent); From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 11:31:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 898DA106567D; Sun, 10 Jun 2012 11:31:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 758BF8FC1A; Sun, 10 Jun 2012 11:31:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ABVpVq094358; Sun, 10 Jun 2012 11:31:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ABVpwo094356; Sun, 10 Jun 2012 11:31:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206101131.q5ABVpwo094356@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 10 Jun 2012 11:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236848 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 11:31:51 -0000 Author: kib Date: Sun Jun 10 11:31:50 2012 New Revision: 236848 URL: http://svn.freebsd.org/changeset/base/236848 Log: Use the previous stack entry protection and max protection to correctly propagate the stack execution permissions when stack is grown down. First, curproc->p_sysent->sv_stackprot specifies maximum allowed stack protection for current ABI, so the new stack entry was typically marked executable always. Second, for non-main stack MAP_STACK mapping, the PROT_ flags should be used which were specified at the mmap(2) call time, and not sv_stackprot. MFC after: 1 week Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Jun 10 11:17:14 2012 (r236847) +++ head/sys/vm/vm_map.c Sun Jun 10 11:31:50 2012 (r236848) @@ -3528,7 +3528,7 @@ Retry: } rv = vm_map_insert(map, NULL, 0, addr, stack_entry->start, - p->p_sysent->sv_stackprot, VM_PROT_ALL, 0); + next_entry->protection, next_entry->max_protection, 0); /* Adjust the available stack space by the amount we grew. */ if (rv == KERN_SUCCESS) { From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 13:10:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D07F1065670; Sun, 10 Jun 2012 13:10:22 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0878E8FC15; Sun, 10 Jun 2012 13:10:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ADAL3a098727; Sun, 10 Jun 2012 13:10:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ADAL2p098725; Sun, 10 Jun 2012 13:10:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206101310.q5ADAL2p098725@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 10 Jun 2012 13:10:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236849 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 13:10:22 -0000 Author: pjd Date: Sun Jun 10 13:10:21 2012 New Revision: 236849 URL: http://svn.freebsd.org/changeset/base/236849 Log: Merge two ifs into one. Other minor style fixes. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Jun 10 11:31:50 2012 (r236848) +++ head/sys/kern/kern_descrip.c Sun Jun 10 13:10:21 2012 (r236849) @@ -884,8 +884,7 @@ do_dup(struct thread *td, int flags, int fdrop(fp, td); return (EBADF); } - KASSERT(old != new, - ("new fd is same as old")); + KASSERT(old != new, ("new fd is same as old")); /* * Save info on the descriptor being overwritten. We cannot close @@ -896,19 +895,17 @@ do_dup(struct thread *td, int flags, int */ delfp = fdp->fd_ofiles[new]; holdleaders = 0; - if (delfp != NULL) { - if (td->td_proc->p_fdtol != NULL) { - /* - * Ask fdfree() to sleep to ensure that all relevant - * process leaders can be traversed in closef(). - */ - fdp->fd_holdleaderscount++; - holdleaders = 1; - } + if (delfp != NULL && td->td_proc->p_fdtol != NULL) { + /* + * Ask fdfree() to sleep to ensure that all relevant + * process leaders can be traversed in closef(). + */ + fdp->fd_holdleaderscount++; + holdleaders = 1; } /* - * Duplicate the source descriptor + * Duplicate the source descriptor. */ fdp->fd_ofiles[new] = fp; fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE; From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 13:28:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E97291065676; Sun, 10 Jun 2012 13:28:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D35F08FC14; Sun, 10 Jun 2012 13:28:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ADSE0O099609; Sun, 10 Jun 2012 13:28:14 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ADSEO7099606; Sun, 10 Jun 2012 13:28:14 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206101328.q5ADSEO7099606@svn.freebsd.org> From: Dimitry Andric Date: Sun, 10 Jun 2012 13:28:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236851 - in stable/9: . share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 13:28:15 -0000 Author: dim Date: Sun Jun 10 13:28:14 2012 New Revision: 236851 URL: http://svn.freebsd.org/changeset/base/236851 Log: MFC r236528: During buildworld and buildkernel, define EARLY_BUILD in the earlier stages (build-tools, cross-tools, etc) of the build, so we can detect in bsd.*.mk whether to pass compiler-specific flags to ${CC}. In particular, this commit will allow using WITH_CLANG_IS_CC when the base compiler is still gcc, and when ${CC}, ${CXX} and ${CPP} are left at their defaults. The early stages will then be built using gcc, and no clang-specific flags will be passed to it. The later stages will be built as usual. The EARLY_BUILD define can also serve other uses, such as building the world stage C++ executables with libc++ instead of libstdc++: during the early build stages, we cannot assume libc++ is already available, so we must still build with libstdc++ at that time. Modified: stable/9/Makefile.inc1 (contents, props changed) stable/9/share/mk/bsd.sys.mk (contents, props changed) Directory Properties: stable/9/share/mk/ (props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Sun Jun 10 13:15:13 2012 (r236850) +++ stable/9/Makefile.inc1 Sun Jun 10 13:28:14 2012 (r236851) @@ -240,7 +240,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ SSP_CFLAGS= \ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ @@ -250,7 +250,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ -DNO_LINT \ - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ @@ -492,7 +492,8 @@ build32: .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic cd ${.CURDIR}/${_dir}; \ MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ - DIRPRFX=${_dir}/ build-tools + DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \ + -DEARLY_BUILD build-tools .endfor cd ${.CURDIR}; \ ${LIB32WMAKE} -f Makefile.inc1 libraries @@ -834,7 +835,7 @@ buildkernel: cd ${KRNLOBJDIR}/${_kernel}; \ PATH=${BPATH}:${PATH} \ MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ - ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \ + ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \ -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) @@ -842,7 +843,7 @@ buildkernel: cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ PATH=${BPATH}:${PATH} \ MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ - ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target} + ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target} .endfor .endif .if !defined(NO_KERNELDEPEND) Modified: stable/9/share/mk/bsd.sys.mk ============================================================================== --- stable/9/share/mk/bsd.sys.mk Sun Jun 10 13:15:13 2012 (r236850) +++ stable/9/share/mk/bsd.sys.mk Sun Jun 10 13:28:14 2012 (r236851) @@ -61,7 +61,8 @@ CWARNFLAGS+= -Wno-uninitialized CWARNFLAGS+= -Wno-pointer-sign # Clang has more warnings enabled by default, and when using -Wall, so if WARNS # is set to low values, these have to be disabled explicitly. -.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" +.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && \ + !defined(EARLY_BUILD) .if ${WARNS} <= 6 CWARNFLAGS+= -Wno-empty-body -Wno-string-plus-int .endif # WARNS <= 6 @@ -88,7 +89,8 @@ WFORMAT= 1 .if ${WFORMAT} > 0 #CWARNFLAGS+= -Wformat-nonliteral -Wformat-security -Wno-format-extra-args CWARNFLAGS+= -Wformat=2 -Wno-format-extra-args -.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" +.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && \ + !defined(EARLY_BUILD) .if ${WARNS} <= 3 CWARNFLAGS+= -Wno-format-nonliteral .endif # WARNS <= 3 @@ -109,7 +111,8 @@ CWARNFLAGS+= -Wno-format CWARNFLAGS+= -Wno-unknown-pragmas .endif # IGNORE_PRAGMA -.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" +.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && \ + !defined(EARLY_BUILD) CLANG_NO_IAS= -no-integrated-as CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\ -mllvm -enable-load-pre=false -mllvm -simplifycfg-dup-ret From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 14:26:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A679C106564A; Sun, 10 Jun 2012 14:26:52 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8625E8FC0C; Sun, 10 Jun 2012 14:26:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AEQq4a002350; Sun, 10 Jun 2012 14:26:52 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AEQqE7002347; Sun, 10 Jun 2012 14:26:52 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201206101426.q5AEQqE7002347@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 10 Jun 2012 14:26:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236852 - head/usr.bin/touch X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 14:26:52 -0000 Author: jilles Date: Sun Jun 10 14:26:51 2012 New Revision: 236852 URL: http://svn.freebsd.org/changeset/base/236852 Log: touch: Add the -d option from POSIX.1-2008. This is much like -t but with a different format which is ISO8601-like and allows fractions of a second. The precision is limited to microseconds because of utimes() and friends, even though stat() returns nanoseconds. MFC after: 10 days Modified: head/usr.bin/touch/touch.1 head/usr.bin/touch/touch.c Modified: head/usr.bin/touch/touch.1 ============================================================================== --- head/usr.bin/touch/touch.1 Sun Jun 10 13:28:14 2012 (r236851) +++ head/usr.bin/touch/touch.1 Sun Jun 10 14:26:51 2012 (r236852) @@ -31,7 +31,7 @@ .\" @(#)touch.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd February 4, 2012 +.Dd June 10, 2012 .Dt TOUCH 1 .Os .Sh NAME @@ -43,6 +43,7 @@ .Op Fl achm .Op Fl r Ar file .Op Fl t Ar [[CC]YY]MMDDhhmm[.SS] +.Op Fl d Ar YYYY-MM-DDThh:mm:SS[.frac][tz] .Ar .Sh DESCRIPTION The @@ -61,8 +62,10 @@ individually. Selecting both is equivalent to the default. By default, the timestamps are set to the current time. The +.Fl d +and .Fl t -flag explicitly specifies a different time, and the +flags explicitly specify a different time, and the .Fl r flag specifies to set the times those of the specified file. The @@ -109,6 +112,41 @@ The .Nm utility does not treat this as an error. No error messages are displayed and the exit value is not affected. +.It Fl d +Change the access and modification times to the specified time instead +of the current time of day. +The argument is of the form +.Dq YYYY-MM-DDThh:mm:SS[.frac][tz] +where the letters represent the following: +.Bl -tag -width Ds -compact -offset indent +.It Ar YYYY +The year. +.It Ar MM +The month of the year, from 01 to 12. +.It Ar DD +The day of the month, from 01 to 31. +.It Ar T +The letter +.Li T +or a space. +.It Ar hh +The hour of the day, from 00 to 23. +.It Ar mm +The minute of the hour, from 00 to 59. +.It Ar SS +The second of the minute, from 00 to 61. +.It Ar .frac +An optional fraction, +consisting of a period or a comma followed by one or more digits. +The number of significant digits depends on the kernel configuration and +the filesystem, and may be zero. +.It Ar tz +An optional letter +.Li Z +indicating the time is in +.Tn UTC . +Otherwise, the time is assumed to be in local time. +.El .It Fl h If the file is a symbolic link, change the times of the link itself rather than the file that the link points to. Modified: head/usr.bin/touch/touch.c ============================================================================== --- head/usr.bin/touch/touch.c Sun Jun 10 13:28:14 2012 (r236851) +++ head/usr.bin/touch/touch.c Sun Jun 10 14:26:51 2012 (r236852) @@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)touch. #include #include +#include #include #include #include @@ -57,6 +58,7 @@ static const char sccsid[] = "@(#)touch. void stime_arg1(char *, struct timeval *); void stime_arg2(char *, int, struct timeval *); +void stime_darg(char *, struct timeval *); void stime_file(char *, struct timeval *); int timeoffset(char *); void usage(char *); @@ -79,7 +81,7 @@ main(int argc, char *argv[]) if (gettimeofday(&tv[0], NULL)) err(1, "gettimeofday"); - while ((ch = getopt(argc, argv, "A:acfhmr:t:")) != -1) + while ((ch = getopt(argc, argv, "A:acd:fhmr:t:")) != -1) switch(ch) { case 'A': Aflag = timeoffset(optarg); @@ -90,6 +92,10 @@ main(int argc, char *argv[]) case 'c': cflag = 1; break; + case 'd': + timeset = 1; + stime_darg(optarg, tv); + break; case 'f': /* No-op for compatibility. */ break; @@ -320,6 +326,50 @@ stime_arg2(char *arg, int year, struct t tvp[0].tv_usec = tvp[1].tv_usec = 0; } +void +stime_darg(char *arg, struct timeval *tvp) +{ + struct tm t = { .tm_sec = 0 }; + const char *fmt, *colon; + char *p; + int val, isutc = 0; + + tvp[0].tv_usec = 0; + t.tm_isdst = -1; + colon = strchr(arg, ':'); + if (colon == NULL || strchr(colon + 1, ':') == NULL) + goto bad; + fmt = strchr(arg, 'T') != NULL ? "%Y-%m-%dT%H:%M:%S" : + "%Y-%m-%d %H:%M:%S"; + p = strptime(arg, fmt, &t); + if (p == NULL) + goto bad; + /* POSIX: must have at least one digit after dot */ + if ((*p == '.' || *p == ',') && isdigit((unsigned char)p[1])) { + p++; + val = 100000; + while (isdigit((unsigned char)*p)) { + tvp[0].tv_usec += val * (*p - '0'); + p++; + val /= 10; + } + } + if (*p == 'Z') { + isutc = 1; + p++; + } + if (*p != '\0') + goto bad; + + tvp[0].tv_sec = isutc ? timegm(&t) : mktime(&t); + + tvp[1] = tvp[0]; + return; + +bad: + errx(1, "out of range or illegal time specification: YYYY-MM-DDThh:mm:SS[.frac][tz]"); +} + /* Calculate a time offset in seconds, given an arg of the format [-]HHMMSS. */ int timeoffset(char *arg) @@ -364,7 +414,9 @@ stime_file(char *fname, struct timeval * void usage(char *myname) { - fprintf(stderr, "usage:\n" "%s [-A [-][[hh]mm]SS] [-achm] [-r file] " - "[-t [[CC]YY]MMDDhhmm[.SS]] file ...\n", myname); + fprintf(stderr, "usage: %s [-A [-][[hh]mm]SS] [-achm] [-r file] " + "[-t [[CC]YY]MMDDhhmm[.SS]]\n" + " [-d YYYY-MM-DDThh:mm:SS[.frac][tz]] " + "file ...\n", myname); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 14:57:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97F48106564A; Sun, 10 Jun 2012 14:57:19 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8306C8FC1A; Sun, 10 Jun 2012 14:57:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AEvJjt003765; Sun, 10 Jun 2012 14:57:19 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AEvJ9S003763; Sun, 10 Jun 2012 14:57:19 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206101457.q5AEvJ9S003763@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 10 Jun 2012 14:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236853 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 14:57:19 -0000 Author: pjd Date: Sun Jun 10 14:57:18 2012 New Revision: 236853 URL: http://svn.freebsd.org/changeset/base/236853 Log: When we are closing capability during dup2(), we want to call mq_fdclose() on the underlying object and not on the capability itself. Discussed with: rwatson Sponsored by: FreeBSD Foundation MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Jun 10 14:26:51 2012 (r236852) +++ head/sys/kern/kern_descrip.c Sun Jun 10 14:57:18 2012 (r236853) @@ -922,8 +922,13 @@ do_dup(struct thread *td, int flags, int */ if (delfp != NULL) { knote_fdclose(td, new); - if (delfp->f_type == DTYPE_MQUEUE) - mq_fdclose(td, new, delfp); + /* + * When we're closing an fd with a capability, we need to + * notify mqueue if the underlying object is of type mqueue. + */ + (void)cap_funwrap(delfp, 0, &fp); + if (fp->f_type == DTYPE_MQUEUE) + mq_fdclose(td, new, fp); FILEDESC_XUNLOCK(fdp); (void) closef(delfp, td); if (holdleaders) { From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 15:56:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D944D106566B; Sun, 10 Jun 2012 15:56:49 +0000 (UTC) (envelope-from trhodes@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C44088FC08; Sun, 10 Jun 2012 15:56:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AFunAC006497; Sun, 10 Jun 2012 15:56:49 GMT (envelope-from trhodes@svn.freebsd.org) Received: (from trhodes@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AFunqW006495; Sun, 10 Jun 2012 15:56:49 GMT (envelope-from trhodes@svn.freebsd.org) Message-Id: <201206101556.q5AFunqW006495@svn.freebsd.org> From: Tom Rhodes Date: Sun, 10 Jun 2012 15:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236854 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 15:56:49 -0000 Author: trhodes Date: Sun Jun 10 15:56:49 2012 New Revision: 236854 URL: http://svn.freebsd.org/changeset/base/236854 Log: "on the their types." -> "on their types." Modified: head/share/man/man4/mac_lomac.4 Modified: head/share/man/man4/mac_lomac.4 ============================================================================== --- head/share/man/man4/mac_lomac.4 Sun Jun 10 14:57:18 2012 (r236853) +++ head/share/man/man4/mac_lomac.4 Sun Jun 10 15:56:49 2012 (r236854) @@ -63,7 +63,7 @@ which protects the integrity of system o an information flow policy coupled with the subject demotion via floating labels. In LOMAC, all system subjects and objects are assigned integrity labels, made -up of one or more hierarchical grades, depending on the their types. +up of one or more hierarchical grades, depending on their types. Together, these label elements permit all labels to be placed in a partial order, with information flow protections and demotion decisions based on a dominance operator From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 19:43:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1509106566C; Sun, 10 Jun 2012 19:43:32 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBBD58FC16; Sun, 10 Jun 2012 19:43:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AJhWEh017306; Sun, 10 Jun 2012 19:43:32 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AJhW6n017304; Sun, 10 Jun 2012 19:43:32 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206101943.q5AJhW6n017304@svn.freebsd.org> From: Warren Block Date: Sun, 10 Jun 2012 19:43:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236856 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 19:43:32 -0000 Author: wblock (doc committer) Date: Sun Jun 10 19:43:32 2012 New Revision: 236856 URL: http://svn.freebsd.org/changeset/base/236856 Log: MFC r236716: Add specific supported revision of ASUS USB-N13 ver. A1. http://lists.freebsd.org/pipermail/freebsd-doc/2012-June/019960.html Submitted by: PseudoCylon (AK) Approved by: gjb (mentor) Modified: stable/8/share/man/man4/run.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/run.4 ============================================================================== --- stable/8/share/man/man4/run.4 Sun Jun 10 16:46:57 2012 (r236855) +++ stable/8/share/man/man4/run.4 Sun Jun 10 19:43:32 2012 (r236856) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2011 +.Dd June 7, 2012 .Os .Dt RUN 4 .Sh NAME @@ -112,7 +112,7 @@ driver supports the following wireless a .Bl -tag -width Ds -offset indent -compact .It Airlink101 AWLL6090 .It ASUS USB-N11 -.It ASUS USB-N13 +.It ASUS USB-N13 ver. A1 .It ASUS WL-160N .It Belkin F5D8051 ver 3000 .It Belkin F5D8053 From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 19:44:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0DA30106564A; Sun, 10 Jun 2012 19:44:09 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC7428FC12; Sun, 10 Jun 2012 19:44:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AJi8lL017388; Sun, 10 Jun 2012 19:44:08 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AJi8di017386; Sun, 10 Jun 2012 19:44:08 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201206101944.q5AJi8di017386@svn.freebsd.org> From: Warren Block Date: Sun, 10 Jun 2012 19:44:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236857 - stable/9/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 19:44:09 -0000 Author: wblock (doc committer) Date: Sun Jun 10 19:44:08 2012 New Revision: 236857 URL: http://svn.freebsd.org/changeset/base/236857 Log: MFC r236716: Add specific supported revision of ASUS USB-N13 ver. A1. http://lists.freebsd.org/pipermail/freebsd-doc/2012-June/019960.html Submitted by: PseudoCylon (AK) Approved by: gjb (mentor) Modified: stable/9/share/man/man4/run.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/run.4 ============================================================================== --- stable/9/share/man/man4/run.4 Sun Jun 10 19:43:32 2012 (r236856) +++ stable/9/share/man/man4/run.4 Sun Jun 10 19:44:08 2012 (r236857) @@ -16,7 +16,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2011 +.Dd June 7, 2012 .Dt RUN 4 .Os .Sh NAME @@ -112,7 +112,7 @@ driver supports the following wireless a .Bl -tag -width Ds -offset indent -compact .It Airlink101 AWLL6090 .It ASUS USB-N11 -.It ASUS USB-N13 +.It ASUS USB-N13 ver. A1 .It ASUS WL-160N .It Belkin F5D8051 ver 3000 .It Belkin F5D8053 From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 20:01:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0246106566C; Sun, 10 Jun 2012 20:01:32 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8F6AA8FC1B; Sun, 10 Jun 2012 20:01:32 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id D364F46B0C; Sun, 10 Jun 2012 16:01:31 -0400 (EDT) Date: Sun, 10 Jun 2012 21:01:31 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Ed Schouten In-Reply-To: <201206021050.q52AoQBQ084298@svn.freebsd.org> Message-ID: References: <201206021050.q52AoQBQ084298@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236441 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 20:01:32 -0000 On Sat, 2 Jun 2012, Ed Schouten wrote: > Log: > Remove invalid remark about pipes. > > The stat structures returned on pipes seems to contain all the > information required by POSIX. Especially the wording "and thus to a > pipe" makes little sense, because it seems to imply a certain > relationship between sockets and pipes that simply isn't there. No objection to the change; however, some historical commentary: the relationship used to be there, as pipes were contructed from pairs of UNIX domain sockets, as remained the case with fifos until quite recently. Robert From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 20:22:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DCAD41065673; Sun, 10 Jun 2012 20:22:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8B238FC1B; Sun, 10 Jun 2012 20:22:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AKMA8J019088; Sun, 10 Jun 2012 20:22:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AKMAvf019085; Sun, 10 Jun 2012 20:22:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206102022.q5AKMAvf019085@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 10 Jun 2012 20:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236858 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 20:22:11 -0000 Author: pjd Date: Sun Jun 10 20:22:10 2012 New Revision: 236858 URL: http://svn.freebsd.org/changeset/base/236858 Log: Style: move opt_*.h includes in the proper place. MFC after: 1 month Modified: head/sys/kern/sys_capability.c Modified: head/sys/kern/sys_capability.c ============================================================================== --- head/sys/kern/sys_capability.c Sun Jun 10 19:44:08 2012 (r236857) +++ head/sys/kern/sys_capability.c Sun Jun 10 20:22:10 2012 (r236858) @@ -51,12 +51,12 @@ * anonymous, rather than named, POSIX shared memory objects. */ -#include "opt_capsicum.h" -#include "opt_ktrace.h" - #include __FBSDID("$FreeBSD$"); +#include "opt_capsicum.h" +#include "opt_ktrace.h" + #include #include #include From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 20:24:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15C1B1065672; Sun, 10 Jun 2012 20:24:02 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCF128FC0A; Sun, 10 Jun 2012 20:24:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AKO1ZL019198; Sun, 10 Jun 2012 20:24:01 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AKO1C8019196; Sun, 10 Jun 2012 20:24:01 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206102024.q5AKO1C8019196@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 10 Jun 2012 20:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236859 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 20:24:02 -0000 Author: pjd Date: Sun Jun 10 20:24:01 2012 New Revision: 236859 URL: http://svn.freebsd.org/changeset/base/236859 Log: Remove redundant include. MFC after: 1 month Modified: head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Sun Jun 10 20:22:10 2012 (r236858) +++ head/sys/kern/subr_trap.c Sun Jun 10 20:24:01 2012 (r236859) @@ -44,7 +44,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_capsicum.h" #include "opt_hwpmc_hooks.h" #include "opt_ktrace.h" #include "opt_kdtrace.h" From owner-svn-src-all@FreeBSD.ORG Sun Jun 10 22:14:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 51E9F106566C; Sun, 10 Jun 2012 22:14:53 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D5648FC16; Sun, 10 Jun 2012 22:14:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5AMEr4u024483; Sun, 10 Jun 2012 22:14:53 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5AMErBQ024480; Sun, 10 Jun 2012 22:14:53 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201206102214.q5AMErBQ024480@svn.freebsd.org> From: Isabell Long Date: Sun, 10 Jun 2012 22:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236860 - head/usr.bin/find X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jun 2012 22:14:53 -0000 Author: issyl0 (doc committer) Date: Sun Jun 10 22:14:52 2012 New Revision: 236860 URL: http://svn.freebsd.org/changeset/base/236860 Log: Add more description and clarification about the -depth and -d options in both places where they are mentioned in find(1). Discussed with: dougb PR: docs/168885 Reported by: Ronald F. Guilmette (rfg at tristatelogic dot com) Approved by: gabor (mentor) MFC after: 3 days Modified: head/usr.bin/find/find.1 Modified: head/usr.bin/find/find.1 ============================================================================== --- head/usr.bin/find/find.1 Sun Jun 10 20:24:01 2012 (r236859) +++ head/usr.bin/find/find.1 Sun Jun 10 22:14:52 2012 (r236860) @@ -136,7 +136,7 @@ Note, the default is .Em not a breadth-first traversal. .Pp -This option is equivalent to the +This option is the BSD-specific equivalent of the .Ic -depth primary of .St -p1003.1-2001 . @@ -301,7 +301,7 @@ Please refer to the .Ic -atime primary description for information on supported time units. .It Ic -d -Same as +Non-portable, BSD-specific version of .Ic depth . GNU find implements this as a primary in mistaken emulation of .Fx @@ -325,9 +325,10 @@ primary will fail to delete a directory Following symlinks is incompatible with this option. .It Ic -depth Always true; -same as the +same as the non-portable .Fl d -option. +option. Refer to the primary description of +.Ic -depth for full information. .It Ic -depth Ar n True if the depth of the file relative to the starting point of the traversal is From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 01:38:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F3A951065673; Mon, 11 Jun 2012 01:38:34 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE0FF8FC16; Mon, 11 Jun 2012 01:38:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B1cYv7033720; Mon, 11 Jun 2012 01:38:34 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B1cYhR033718; Mon, 11 Jun 2012 01:38:34 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201206110138.q5B1cYhR033718@svn.freebsd.org> From: Kevin Lo Date: Mon, 11 Jun 2012 01:38:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236864 - stable/9/sys/dev/jme X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 01:38:35 -0000 Author: kevlo Date: Mon Jun 11 01:38:34 2012 New Revision: 236864 URL: http://svn.freebsd.org/changeset/base/236864 Log: MFC r236700: Fix a logic error when use PCIY_PMG capability Reviewed by: yongari Modified: stable/9/sys/dev/jme/if_jme.c Directory Properties: stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/jme/if_jme.c ============================================================================== --- stable/9/sys/dev/jme/if_jme.c Mon Jun 11 00:16:05 2012 (r236863) +++ stable/9/sys/dev/jme/if_jme.c Mon Jun 11 01:38:34 2012 (r236864) @@ -1661,7 +1661,7 @@ jme_resume(device_t dev) sc = device_get_softc(dev); JME_LOCK(sc); - if (pci_find_cap(sc->jme_dev, PCIY_PMG, &pmc) != 0) { + if (pci_find_cap(sc->jme_dev, PCIY_PMG, &pmc) == 0) { pmstat = pci_read_config(sc->jme_dev, pmc + PCIR_POWER_STATUS, 2); /* Disable PME clear PME status. */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 01:44:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9D4B31065672; Mon, 11 Jun 2012 01:44:17 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 879548FC08; Mon, 11 Jun 2012 01:44:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B1iHqs034042; Mon, 11 Jun 2012 01:44:17 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B1iH1m034040; Mon, 11 Jun 2012 01:44:17 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201206110144.q5B1iH1m034040@svn.freebsd.org> From: Kevin Lo Date: Mon, 11 Jun 2012 01:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236865 - stable/9/sys/dev/ae X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 01:44:17 -0000 Author: kevlo Date: Mon Jun 11 01:44:17 2012 New Revision: 236865 URL: http://svn.freebsd.org/changeset/base/236865 Log: MFC r236649,236670: Check the return value of pci_find_cap() Modified: stable/9/sys/dev/ae/if_ae.c Directory Properties: stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ae/if_ae.c ============================================================================== --- stable/9/sys/dev/ae/if_ae.c Mon Jun 11 01:38:34 2012 (r236864) +++ stable/9/sys/dev/ae/if_ae.c Mon Jun 11 01:44:17 2012 (r236865) @@ -1381,12 +1381,13 @@ ae_pm_init(ae_softc_t *sc) /* * Configure PME. */ - pci_find_cap(sc->dev, PCIY_PMG, &pmc); - pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); - pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); - if ((ifp->if_capenable & IFCAP_WOL) != 0) - pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0) { + pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); + pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if ((ifp->if_capenable & IFCAP_WOL) != 0) + pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + } } static int From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 03:02:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 490BA1065670; Mon, 11 Jun 2012 03:02:41 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A3C28FC08; Mon, 11 Jun 2012 03:02:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B32e49037661; Mon, 11 Jun 2012 03:02:40 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B32eT6037658; Mon, 11 Jun 2012 03:02:40 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201206110302.q5B32eT6037658@svn.freebsd.org> From: Kevin Lo Date: Mon, 11 Jun 2012 03:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236866 - head/usr.bin/cut X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 03:02:41 -0000 Author: kevlo Date: Mon Jun 11 03:02:40 2012 New Revision: 236866 URL: http://svn.freebsd.org/changeset/base/236866 Log: - Consistenly mention columns and fields - Add -b to short error messages Obtained from: NetBSD Modified: head/usr.bin/cut/cut.1 head/usr.bin/cut/cut.c Modified: head/usr.bin/cut/cut.1 ============================================================================== --- head/usr.bin/cut/cut.1 Mon Jun 11 01:44:17 2012 (r236865) +++ head/usr.bin/cut/cut.1 Mon Jun 11 03:02:40 2012 (r236866) @@ -68,7 +68,7 @@ The items specified by .Ar list can be in terms of column position or in terms of fields delimited by a special character. -Column numbering starts from 1. +Column and field numbering starts from 1. .Pp The .Ar list @@ -78,14 +78,14 @@ number ranges. Number ranges consist of a number, a dash .Pq Sq \- , and a second number -and select the fields or columns from the first number to the second, +and select the columns or fields from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all -fields or columns from 1 to the last number. +columns or fields from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all -fields or columns from the last number to the end of the line. +columns or fields from the last number to the end of the line. Numbers and number ranges may be repeated, overlapping, and in any order. -It is not an error to select fields or columns not present in the +It is not an error to select columns or fields not present in the input line. .Pp The options are as follows: Modified: head/usr.bin/cut/cut.c ============================================================================== --- head/usr.bin/cut/cut.c Mon Jun 11 01:44:17 2012 (r236865) +++ head/usr.bin/cut/cut.c Mon Jun 11 03:02:40 2012 (r236866) @@ -164,7 +164,7 @@ get_list(char *list) * set a byte in the positions array to indicate if a field or * column is to be selected; use +1, it's 1-based, not 0-based. * Numbers and number ranges may be overlapping, repeated, and in - * any order. We handle "-3-5" although there's no real reason too. + * any order. We handle "-3-5" although there's no real reason to. */ for (; (p = strsep(&list, ", \t")) != NULL;) { setautostart = start = stop = 0; @@ -187,9 +187,9 @@ get_list(char *list) } } if (*p) - errx(1, "[-cf] list: illegal list value"); + errx(1, "[-bcf] list: illegal list value"); if (!stop || !start) - errx(1, "[-cf] list: values may not include zero"); + errx(1, "[-bcf] list: values may not include zero"); if (maxval < stop) { maxval = stop; needpos(maxval + 1); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 03:10:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C8B91065679; Mon, 11 Jun 2012 03:10:16 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47F4A8FC17; Mon, 11 Jun 2012 03:10:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B3AGeB038144; Mon, 11 Jun 2012 03:10:16 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B3AFCH038142; Mon, 11 Jun 2012 03:10:15 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201206110310.q5B3AFCH038142@svn.freebsd.org> From: Kevin Lo Date: Mon, 11 Jun 2012 03:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236867 - head/usr.bin/cut X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 03:10:16 -0000 Author: kevlo Date: Mon Jun 11 03:10:15 2012 New Revision: 236867 URL: http://svn.freebsd.org/changeset/base/236867 Log: Fix typo Modified: head/usr.bin/cut/cut.1 Modified: head/usr.bin/cut/cut.1 ============================================================================== --- head/usr.bin/cut/cut.1 Mon Jun 11 03:02:40 2012 (r236866) +++ head/usr.bin/cut/cut.1 Mon Jun 11 03:10:15 2012 (r236867) @@ -68,7 +68,7 @@ The items specified by .Ar list can be in terms of column position or in terms of fields delimited by a special character. -Column and field numbering starts from 1. +Column and field numbering start from 1. .Pp The .Ar list From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 04:39:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9893C106566C; Mon, 11 Jun 2012 04:39:50 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 58FCA8FC0A; Mon, 11 Jun 2012 04:39:50 +0000 (UTC) Received: by pbbro2 with SMTP id ro2so5238199pbb.13 for ; Sun, 10 Jun 2012 21:39:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qw6PI3gt4lzqB2iBDPme6CQFG3T6CkYrCRCfYDzNiIQ=; b=z5wMOE3P+/JNYn/9gy2QlEbg6MkO6RDgcNqWX2aXDtnDZujWKXQ3qjy6qnULmSvd1l K1lNv1gg/qwefusFay3vOy7tMsepsNLbrHxnpTyU3g8r91yIef0h8PaPjM54TZAPS7ht 8nhNPRP5NM9BLQsMIAONc1hsY2/6hRtQ/CUpqw7MoiC9Kny/rks0/r0Kk8abVhqHkTlO oJx6wHVN4MZZLqMOzv6WbKoJ1FY1I3YxQ+o398vBWRd3bfc0DmSm7RHQTYueJwXij8X1 EwCiOntXjVCd4gh3R1K0FJ3S7wTDy7cUaZURFF9Mw3G5YejQUtImnVetTYwLeRCXEh3Y Badg== MIME-Version: 1.0 Received: by 10.68.116.203 with SMTP id jy11mr21904524pbb.129.1339389589889; Sun, 10 Jun 2012 21:39:49 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.143.91.18 with HTTP; Sun, 10 Jun 2012 21:39:49 -0700 (PDT) In-Reply-To: <201206020910.q529Aptt077716@svn.freebsd.org> References: <201206020910.q529Aptt077716@svn.freebsd.org> Date: Sun, 10 Jun 2012 21:39:49 -0700 X-Google-Sender-Auth: Z6Wz-_Xfbf0dVPUB_60IEoTiiBg Message-ID: From: Adrian Chadd To: Hans Petter Selasky Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236439 - head/sys/dev/usb/wlan X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 04:39:50 -0000 On 2 June 2012 02:10, Hans Petter Selasky wrote: > Author: hselasky > Date: Sat Jun =A02 09:10:51 2012 > New Revision: 236439 > URL: http://svn.freebsd.org/changeset/base/236439 > > Log: > =A0Add appropriate checks for ic_bsschan being set to IEEE80211_CHAN_ANYC= in > =A0some of the USB WLAN drivers. This fixes a panic when using monitor mo= de. Hi, Was there a PR for this? I'd just like to make sure that wireless related bugs get PRs and they get assigned to freebsd-wireless. :-) Thanks! Adrian From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 06:59:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08BC21065674; Mon, 11 Jun 2012 06:59:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E62558FC0A; Mon, 11 Jun 2012 06:59:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B6xS6v048776; Mon, 11 Jun 2012 06:59:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B6xSDW048770; Mon, 11 Jun 2012 06:59:28 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206110659.q5B6xSDW048770@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 06:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236872 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 06:59:29 -0000 Author: adrian Date: Mon Jun 11 06:59:28 2012 New Revision: 236872 URL: http://svn.freebsd.org/changeset/base/236872 Log: Revert r233227 and followup commits as it breaks CCMP PN replay detection. This showed up when doing heavy UDP throughput on SMP machines. The problem with this is because the 802.11 sequence number is being allocated separately to the CCMP PN replay number (which is assigned during ieee80211_crypto_encap()). Under significant throughput (200+ MBps) the TX path would be stressed enough that frame TX/retry would force sequence number and PN allocation to be out of order. So once the frames were reordered via 802.11 seqnos, the CCMP PN would be far out of order, causing most frames to be discarded by the receiver. I've fixed this in some local work by being forced to: (a) deal with the issues that lead to the parallel TX causing out of order sequence numbers in the first place; (b) fix all the packet queuing issues which lead to strange (but mostly valid) TX. I'll begin fixing these in a subsequent commit or five. PR: kern/166190 Modified: head/sys/dev/ath/if_ath_debug.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_ath_tx.h head/sys/dev/ath/if_ath_tx_ht.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_debug.c ============================================================================== --- head/sys/dev/ath/if_ath_debug.c Mon Jun 11 05:25:26 2012 (r236871) +++ head/sys/dev/ath/if_ath_debug.c Mon Jun 11 06:59:28 2012 (r236872) @@ -144,9 +144,6 @@ ath_printtxbuf(struct ath_softc *sc, con bf->bf_state.bfs_retries, bf->bf_state.bfs_addedbaw, bf->bf_state.bfs_dobaw); - printf(" SEQNO_ASSIGNED: %d, NEED_SEQNO: %d\n", - bf->bf_state.bfs_seqno_assigned, - bf->bf_state.bfs_need_seqno); printf(" %08x %08x %08x %08x %08x %08x\n", ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1], Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 05:25:26 2012 (r236871) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 06:59:28 2012 (r236872) @@ -109,10 +109,10 @@ static int ath_tx_ampdu_pending(struct a int tid); static int ath_tx_ampdu_running(struct ath_softc *sc, struct ath_node *an, int tid); +static ieee80211_seq ath_tx_tid_seqno_assign(struct ath_softc *sc, + struct ieee80211_node *ni, struct ath_buf *bf, struct mbuf *m0); static int ath_tx_action_frame_override_queue(struct ath_softc *sc, struct ieee80211_node *ni, struct mbuf *m0, int *tid); -static int ath_tx_seqno_required(struct ath_softc *sc, - struct ieee80211_node *ni, struct ath_buf *bf, struct mbuf *m0); /* * Whether to use the 11n rate scenario functions or not @@ -1436,7 +1436,7 @@ ath_tx_start(struct ath_softc *sc, struc int ismcast; const struct ieee80211_frame *wh; int is_ampdu, is_ampdu_tx, is_ampdu_pending; - //ieee80211_seq seqno; + ieee80211_seq seqno; uint8_t type, subtype; /* @@ -1488,9 +1488,8 @@ ath_tx_start(struct ath_softc *sc, struc is_ampdu_pending = ath_tx_ampdu_pending(sc, ATH_NODE(ni), tid); is_ampdu = is_ampdu_tx | is_ampdu_pending; - DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: bf=%p, tid=%d, ac=%d, is_ampdu=%d\n", - __func__, bf, tid, pri, is_ampdu); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, ac=%d, is_ampdu=%d\n", + __func__, tid, pri, is_ampdu); /* * When servicing one or more stations in power-save mode @@ -1506,9 +1505,6 @@ ath_tx_start(struct ath_softc *sc, struc /* Do the generic frame setup */ /* XXX should just bzero the bf_state? */ bf->bf_state.bfs_dobaw = 0; - bf->bf_state.bfs_seqno_assigned = 0; - bf->bf_state.bfs_need_seqno = 0; - bf->bf_state.bfs_seqno = -1; /* XXX debugging */ /* A-MPDU TX? Manually set sequence number */ /* Don't do it whilst pending; the net80211 layer still assigns them */ @@ -1521,16 +1517,15 @@ ath_tx_start(struct ath_softc *sc, struc * don't get a sequence number from the current * TID and thus mess with the BAW. */ - //seqno = ath_tx_tid_seqno_assign(sc, ni, bf, m0); - if (ath_tx_seqno_required(sc, ni, bf, m0)) { + seqno = ath_tx_tid_seqno_assign(sc, ni, bf, m0); + if (IEEE80211_QOS_HAS_SEQ(wh) && + subtype != IEEE80211_FC0_SUBTYPE_QOS_NULL) { bf->bf_state.bfs_dobaw = 1; - bf->bf_state.bfs_need_seqno = 1; } ATH_TXQ_UNLOCK(txq); } else { /* No AMPDU TX, we've been assigned a sequence number. */ if (IEEE80211_QOS_HAS_SEQ(wh)) { - bf->bf_state.bfs_seqno_assigned = 1; /* XXX we should store the frag+seqno in bfs_seqno */ bf->bf_state.bfs_seqno = M_SEQNO_GET(m0) << IEEE80211_SEQ_SEQ_SHIFT; @@ -1541,7 +1536,7 @@ ath_tx_start(struct ath_softc *sc, struc * If needed, the sequence number has been assigned. * Squirrel it away somewhere easy to get to. */ - //bf->bf_state.bfs_seqno = M_SEQNO_GET(m0) << IEEE80211_SEQ_SEQ_SHIFT; + bf->bf_state.bfs_seqno = M_SEQNO_GET(m0) << IEEE80211_SEQ_SEQ_SHIFT; /* Is ampdu pending? fetch the seqno and print it out */ if (is_ampdu_pending) @@ -1558,10 +1553,6 @@ ath_tx_start(struct ath_softc *sc, struc /* At this point m0 could have changed! */ m0 = bf->bf_m; - DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: DONE: bf=%p, tid=%d, ac=%d, is_ampdu=%d, dobaw=%d, seqno=%d\n", - __func__, bf, tid, pri, is_ampdu, bf->bf_state.bfs_dobaw, M_SEQNO_GET(m0)); - #if 1 /* * If it's a multicast frame, do a direct-dispatch to the @@ -2043,41 +2034,16 @@ ath_tx_addto_baw(struct ath_softc *sc, s if (bf->bf_state.bfs_isretried) return; - /* - * If this occurs we're in a lot of trouble. We should try to - * recover from this without the session hanging? - */ - if (! bf->bf_state.bfs_seqno_assigned) { - device_printf(sc->sc_dev, - "%s: bf=%p, seqno_assigned is 0?!\n", __func__, bf); - return; - } - tap = ath_tx_get_tx_tid(an, tid->tid); if (bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, - "%s: re-added? bf=%p, tid=%d, seqno %d; window %d:%d; " - "baw head=%d tail=%d\n", - __func__, bf, tid->tid, SEQNO(bf->bf_state.bfs_seqno), - tap->txa_start, tap->txa_wnd, tid->baw_head, - tid->baw_tail); - - /* - * Verify that the given sequence number is not outside of the - * BAW. Complain loudly if that's the case. - */ - if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, - SEQNO(bf->bf_state.bfs_seqno))) { - device_printf(sc->sc_dev, - "%s: bf=%p: outside of BAW?? tid=%d, seqno %d; window %d:%d; " + "%s: re-added? tid=%d, seqno %d; window %d:%d; " "baw head=%d tail=%d\n", - __func__, bf, tid->tid, SEQNO(bf->bf_state.bfs_seqno), + __func__, tid->tid, SEQNO(bf->bf_state.bfs_seqno), tap->txa_start, tap->txa_wnd, tid->baw_head, tid->baw_tail); - } - /* * ni->ni_txseqs[] is the currently allocated seqno. * the txa state contains the current baw start. @@ -2085,9 +2051,9 @@ ath_tx_addto_baw(struct ath_softc *sc, s index = ATH_BA_INDEX(tap->txa_start, SEQNO(bf->bf_state.bfs_seqno)); cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, - "%s: bf=%p, tid=%d, seqno %d; window %d:%d; index=%d cindex=%d " + "%s: tid=%d, seqno %d; window %d:%d; index=%d cindex=%d " "baw head=%d tail=%d\n", - __func__, bf, tid->tid, SEQNO(bf->bf_state.bfs_seqno), + __func__, tid->tid, SEQNO(bf->bf_state.bfs_seqno), tap->txa_start, tap->txa_wnd, index, cindex, tid->baw_head, tid->baw_tail); @@ -2190,9 +2156,9 @@ ath_tx_update_baw(struct ath_softc *sc, cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1); DPRINTF(sc, ATH_DEBUG_SW_TX_BAW, - "%s: bf=%p: tid=%d, baw=%d:%d, seqno=%d, index=%d, cindex=%d, " + "%s: tid=%d, baw=%d:%d, seqno=%d, index=%d, cindex=%d, " "baw head=%d, tail=%d\n", - __func__, bf, tid->tid, tap->txa_start, tap->txa_wnd, seqno, index, + __func__, tid->tid, tap->txa_start, tap->txa_wnd, seqno, index, cindex, tid->baw_head, tid->baw_tail); /* @@ -2273,51 +2239,11 @@ ath_tx_tid_unsched(struct ath_softc *sc, } /* - * Return whether a sequence number is actually required. - * - * A sequence number must only be allocated at the time that a frame - * is considered for addition to the BAW/aggregate and being TXed. - * The sequence number must not be allocated before the frame - * is added to the BAW (protected by the same lock instance) - * otherwise a the multi-entrant TX path may result in a later seqno - * being added to the BAW first. The subsequent addition of the - * earlier seqno would then not go into the BAW as it's now outside - * of said BAW. - * - * This routine is used by ath_tx_start() to mark whether the frame - * should get a sequence number before adding it to the BAW. - * - * Then the actual aggregate TX routines will check whether this - * flag is set and if the frame needs to go into the BAW, it'll - * have a sequence number allocated for it. - */ -static int -ath_tx_seqno_required(struct ath_softc *sc, struct ieee80211_node *ni, - struct ath_buf *bf, struct mbuf *m0) -{ - const struct ieee80211_frame *wh; - uint8_t subtype; - - wh = mtod(m0, const struct ieee80211_frame *); - subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; - - /* XXX assert txq lock */ - /* XXX assert ampdu is set */ - - return ((IEEE80211_QOS_HAS_SEQ(wh) && - subtype != IEEE80211_FC0_SUBTYPE_QOS_NULL)); -} - -/* * Assign a sequence number manually to the given frame. * * This should only be called for A-MPDU TX frames. - * - * If this is called after the initial frame setup, make sure you've flushed - * the DMA map or you'll risk sending stale data to the NIC. This routine - * updates the actual frame contents with the relevant seqno. */ -int +static ieee80211_seq ath_tx_tid_seqno_assign(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf, struct mbuf *m0) { @@ -2330,22 +2256,8 @@ ath_tx_tid_seqno_assign(struct ath_softc wh = mtod(m0, struct ieee80211_frame *); pri = M_WME_GETAC(m0); /* honor classification */ tid = WME_AC_TO_TID(pri); - DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: bf=%p, pri=%d, tid=%d, qos has seq=%d\n", - __func__, bf, pri, tid, IEEE80211_QOS_HAS_SEQ(wh)); - - if (! bf->bf_state.bfs_need_seqno) { - device_printf(sc->sc_dev, "%s: bf=%p: need_seqno not set?!\n", - __func__, bf); - return -1; - } - /* XXX check for bfs_need_seqno? */ - if (bf->bf_state.bfs_seqno_assigned) { - device_printf(sc->sc_dev, - "%s: bf=%p: seqno already assigned (%d)?!\n", - __func__, bf, SEQNO(bf->bf_state.bfs_seqno)); - return bf->bf_state.bfs_seqno >> IEEE80211_SEQ_SEQ_SHIFT; - } + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: pri=%d, tid=%d, qos has seq=%d\n", + __func__, pri, tid, IEEE80211_QOS_HAS_SEQ(wh)); /* XXX Is it a control frame? Ignore */ @@ -2373,14 +2285,9 @@ ath_tx_tid_seqno_assign(struct ath_softc } *(uint16_t *)&wh->i_seq[0] = htole16(seqno << IEEE80211_SEQ_SEQ_SHIFT); M_SEQNO_SET(m0, seqno); - bf->bf_state.bfs_seqno = seqno << IEEE80211_SEQ_SEQ_SHIFT; - bf->bf_state.bfs_seqno_assigned = 1; /* Return so caller can do something with it if needed */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: -> seqno=%d\n", - __func__, - bf, - seqno); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: -> seqno=%d\n", __func__, seqno); return seqno; } @@ -2392,7 +2299,6 @@ ath_tx_tid_seqno_assign(struct ath_softc static void ath_tx_xmit_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_buf *bf) { - struct ieee80211_node *ni = &an->an_node; struct ath_tid *tid = &an->an_tid[bf->bf_state.bfs_tid]; struct ath_txq *txq = bf->bf_state.bfs_txq; struct ieee80211_tx_ampdu *tap; @@ -2408,81 +2314,10 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s return; } - /* - * TODO: If it's _before_ the BAW left edge, complain very loudly. - * This means something (else) has slid the left edge along - * before we got a chance to be TXed. - */ - - /* - * Is there space in this BAW for another frame? - * If not, don't bother trying to schedule it; just - * throw it back on the queue. - * - * If we allocate the sequence number before we add - * it to the BAW, we risk racing with another TX - * thread that gets in a frame into the BAW with - * seqno greater than ours. We'd then fail the - * below check and throw the frame on the tail of - * the queue. The sender would then have a hole. - * - * XXX again, we're protecting ni->ni_txseqs[tid] - * behind this hardware TXQ lock, like the rest of - * the TIDs that map to it. Ugh. - */ - if (bf->bf_state.bfs_dobaw) { - ieee80211_seq seqno; - - /* - * If the sequence number is allocated, use it. - * Otherwise, use the sequence number we WOULD - * allocate. - */ - if (bf->bf_state.bfs_seqno_assigned) - seqno = SEQNO(bf->bf_state.bfs_seqno); - else - seqno = ni->ni_txseqs[bf->bf_state.bfs_tid]; - - /* - * Check whether either the currently allocated - * sequence number _OR_ the to-be allocated - * sequence number is inside the BAW. - */ - if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, seqno)) { - ATH_TXQ_INSERT_TAIL(tid, bf, bf_list); - ath_tx_tid_sched(sc, tid); - return; - } - if (! bf->bf_state.bfs_seqno_assigned) { - int seqno; - - seqno = ath_tx_tid_seqno_assign(sc, ni, bf, bf->bf_m); - if (seqno < 0) { - device_printf(sc->sc_dev, - "%s: bf=%p, huh, seqno=-1?\n", - __func__, - bf); - /* XXX what can we even do here? */ - } - /* Flush seqno update to RAM */ - /* - * XXX This is required because the dmasetup - * XXX is done early rather than at dispatch - * XXX time. Ew, we should fix this! - */ - bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, - BUS_DMASYNC_PREWRITE); - } - } - /* outside baw? queue */ if (bf->bf_state.bfs_dobaw && (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, SEQNO(bf->bf_state.bfs_seqno)))) { - device_printf(sc->sc_dev, - "%s: bf=%p, shouldn't be outside BAW now?!\n", - __func__, - bf); ATH_TXQ_INSERT_TAIL(tid, bf, bf_list); ath_tx_tid_sched(sc, tid); return; @@ -2539,8 +2374,8 @@ ath_tx_swq(struct ath_softc *sc, struct tid = ath_tx_gettid(sc, m0); atid = &an->an_tid[tid]; - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p, pri=%d, tid=%d, qos=%d, seqno=%d\n", - __func__, bf, pri, tid, IEEE80211_QOS_HAS_SEQ(wh), SEQNO(bf->bf_state.bfs_seqno)); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p, pri=%d, tid=%d, qos=%d\n", + __func__, bf, pri, tid, IEEE80211_QOS_HAS_SEQ(wh)); /* Set local packet state, used to queue packets to hardware */ bf->bf_state.bfs_tid = tid; @@ -2556,34 +2391,34 @@ ath_tx_swq(struct ath_softc *sc, struct ATH_TXQ_LOCK(txq); if (atid->paused) { /* TID is paused, queue */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: paused\n", __func__, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: paused\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); } else if (ath_tx_ampdu_pending(sc, an, tid)) { /* AMPDU pending; queue */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: pending\n", __func__, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: pending\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); /* XXX sched? */ } else if (ath_tx_ampdu_running(sc, an, tid)) { /* AMPDU running, attempt direct dispatch if possible */ if (txq->axq_depth < sc->sc_hwq_limit) { - DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: bf=%p: xmit_aggr\n", - __func__, bf); ath_tx_xmit_aggr(sc, an, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, + "%s: xmit_aggr\n", + __func__); } else { DPRINTF(sc, ATH_DEBUG_SW_TX, - "%s: bf=%p: ampdu; swq'ing\n", - __func__, bf); + "%s: ampdu; swq'ing\n", + __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } } else if (txq->axq_depth < sc->sc_hwq_limit) { /* AMPDU not running, attempt direct dispatch */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: xmit_normal\n", __func__, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_normal\n", __func__); ath_tx_xmit_normal(sc, txq, bf); } else { /* Busy; queue */ - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: swq'ing\n", __func__, bf); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: swq'ing\n", __func__); ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } @@ -2873,12 +2708,10 @@ ath_tx_tid_drain(struct ath_softc *sc, s if (t == 0) { device_printf(sc->sc_dev, "%s: node %p: bf=%p: addbaw=%d, dobaw=%d, " - "seqno_assign=%d, seqno_required=%d, seqno=%d, retry=%d\n", + "seqno=%d, retry=%d\n", __func__, ni, bf, bf->bf_state.bfs_addedbaw, bf->bf_state.bfs_dobaw, - bf->bf_state.bfs_need_seqno, - bf->bf_state.bfs_seqno_assigned, SEQNO(bf->bf_state.bfs_seqno), bf->bf_state.bfs_retries); device_printf(sc->sc_dev, @@ -2888,11 +2721,11 @@ ath_tx_tid_drain(struct ath_softc *sc, s tid->hwq_depth, tid->bar_wait); device_printf(sc->sc_dev, - "%s: node %p: bf=%p: tid %d: txq_depth=%d, " + "%s: node %p: tid %d: txq_depth=%d, " "txq_aggr_depth=%d, sched=%d, paused=%d, " "hwq_depth=%d, incomp=%d, baw_head=%d, " "baw_tail=%d txa_start=%d, ni_txseqs=%d\n", - __func__, ni, bf, tid->tid, txq->axq_depth, + __func__, ni, tid->tid, txq->axq_depth, txq->axq_aggr_depth, tid->sched, tid->paused, tid->hwq_depth, tid->incomp, tid->baw_head, tid->baw_tail, tap == NULL ? -1 : tap->txa_start, Modified: head/sys/dev/ath/if_ath_tx.h ============================================================================== --- head/sys/dev/ath/if_ath_tx.h Mon Jun 11 05:25:26 2012 (r236871) +++ head/sys/dev/ath/if_ath_tx.h Mon Jun 11 06:59:28 2012 (r236872) @@ -109,8 +109,6 @@ extern void ath_tx_addto_baw(struct ath_ struct ath_tid *tid, struct ath_buf *bf); extern struct ieee80211_tx_ampdu * ath_tx_get_tx_tid(struct ath_node *an, int tid); -extern int ath_tx_tid_seqno_assign(struct ath_softc *sc, - struct ieee80211_node *ni, struct ath_buf *bf, struct mbuf *m0); /* TX addba handling */ extern int ath_addba_request(struct ieee80211_node *ni, Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Mon Jun 11 05:25:26 2012 (r236871) +++ head/sys/dev/ath/if_ath_tx_ht.c Mon Jun 11 06:59:28 2012 (r236872) @@ -644,7 +644,7 @@ ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid, ath_bufhead *bf_q) { - struct ieee80211_node *ni = &an->an_node; + //struct ieee80211_node *ni = &an->an_node; struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL; int nframes = 0; uint16_t aggr_limit = 0, al = 0, bpad = 0, al_delta, h_baw; @@ -751,74 +751,11 @@ ath_tx_form_aggr(struct ath_softc *sc, s (HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA); /* - * TODO: If it's _before_ the BAW left edge, complain very - * loudly. - * - * This means something (else) has slid the left edge along - * before we got a chance to be TXed. - */ - - /* - * Check if we have space in the BAW for this frame before - * we add it. - * - * see ath_tx_xmit_aggr() for more info. - */ - if (bf->bf_state.bfs_dobaw) { - ieee80211_seq seqno; - - /* - * If the sequence number is allocated, use it. - * Otherwise, use the sequence number we WOULD - * allocate. - */ - if (bf->bf_state.bfs_seqno_assigned) - seqno = SEQNO(bf->bf_state.bfs_seqno); - else - seqno = ni->ni_txseqs[bf->bf_state.bfs_tid]; - - /* - * Check whether either the currently allocated - * sequence number _OR_ the to-be allocated - * sequence number is inside the BAW. - */ - if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, - seqno)) { - status = ATH_AGGR_BAW_CLOSED; - break; - } - - /* XXX check for bfs_need_seqno? */ - if (! bf->bf_state.bfs_seqno_assigned) { - int seqno; - seqno = ath_tx_tid_seqno_assign(sc, ni, bf, bf->bf_m); - if (seqno < 0) { - device_printf(sc->sc_dev, - "%s: bf=%p, huh, seqno=-1?\n", - __func__, - bf); - /* XXX what can we even do here? */ - } - /* Flush seqno update to RAM */ - /* - * XXX This is required because the dmasetup - * XXX is done early rather than at dispatch - * XXX time. Ew, we should fix this! - */ - bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, - BUS_DMASYNC_PREWRITE); - } - } - - /* * If the packet has a sequence number, do not * step outside of the block-ack window. */ if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, SEQNO(bf->bf_state.bfs_seqno))) { - device_printf(sc->sc_dev, - "%s: bf=%p, seqno=%d, outside?!\n", - __func__, bf, SEQNO(bf->bf_state.bfs_seqno)); status = ATH_AGGR_BAW_CLOSED; break; } Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Jun 11 05:25:26 2012 (r236871) +++ head/sys/dev/ath/if_athvar.h Mon Jun 11 06:59:28 2012 (r236872) @@ -216,9 +216,7 @@ struct ath_buf { bfs_istxfrag:1, /* is fragmented */ bfs_ismrr:1, /* do multi-rate TX retry */ bfs_doprot:1, /* do RTS/CTS based protection */ - bfs_doratelookup:1, /* do rate lookup before each TX */ - bfs_need_seqno:1, /* need to assign a seqno for aggr */ - bfs_seqno_assigned:1; /* seqno has been assigned */ + bfs_doratelookup:1; /* do rate lookup before each TX */ int bfs_nfl; /* next fragment length */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:06:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 74C44106566B; Mon, 11 Jun 2012 07:06:50 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46CC68FC08; Mon, 11 Jun 2012 07:06:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B76oEk049167; Mon, 11 Jun 2012 07:06:50 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B76oem049164; Mon, 11 Jun 2012 07:06:50 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206110706.q5B76oem049164@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 07:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236873 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:06:50 -0000 Author: adrian Date: Mon Jun 11 07:06:49 2012 New Revision: 236873 URL: http://svn.freebsd.org/changeset/base/236873 Log: Introduce a new lock debug which is specifically for making sure the _TID_ lock is held. For now the TID lock is also the TXQ lock. This is just to make sure that the right TXQ lock is held for the given TID. Modified: head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 06:59:28 2012 (r236872) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:06:49 2012 (r236873) @@ -2030,6 +2030,7 @@ ath_tx_addto_baw(struct ath_softc *sc, s struct ieee80211_tx_ampdu *tap; ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[tid->ac]); + ATH_TID_LOCK_ASSERT(sc, tid); if (bf->bf_state.bfs_isretried) return; @@ -2102,6 +2103,7 @@ ath_tx_switch_baw_buf(struct ath_softc * int seqno = SEQNO(old_bf->bf_state.bfs_seqno); ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[tid->ac]); + ATH_TID_LOCK_ASSERT(sc, tid); tap = ath_tx_get_tx_tid(an, tid->tid); index = ATH_BA_INDEX(tap->txa_start, seqno); @@ -2304,6 +2306,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s struct ieee80211_tx_ampdu *tap; ATH_TXQ_LOCK_ASSERT(txq); + ATH_TID_LOCK_ASSERT(sc, tid); tap = ath_tx_get_tx_tid(an, tid->tid); @@ -2374,6 +2377,8 @@ ath_tx_swq(struct ath_softc *sc, struct tid = ath_tx_gettid(sc, m0); atid = &an->an_tid[tid]; + ATH_TID_LOCK_ASSERT(sc, atid); + DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p, pri=%d, tid=%d, qos=%d\n", __func__, bf, pri, tid, IEEE80211_QOS_HAS_SEQ(wh)); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Mon Jun 11 06:59:28 2012 (r236872) +++ head/sys/dev/ath/if_athvar.h Mon Jun 11 07:06:49 2012 (r236873) @@ -302,6 +302,9 @@ struct ath_txq { #define ATH_TXQ_LOCK_ASSERT(_tq) mtx_assert(&(_tq)->axq_lock, MA_OWNED) #define ATH_TXQ_IS_LOCKED(_tq) mtx_owned(&(_tq)->axq_lock) +#define ATH_TID_LOCK_ASSERT(_sc, _tid) \ + ATH_TXQ_LOCK_ASSERT((_sc)->sc_ac2q[(_tid)->ac]) + #define ATH_TXQ_INSERT_HEAD(_tq, _elm, _field) do { \ TAILQ_INSERT_HEAD(&(_tq)->axq_q, (_elm), _field); \ (_tq)->axq_depth++; \ From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:08:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C7025106566C; Mon, 11 Jun 2012 07:08:40 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B32FA8FC0A; Mon, 11 Jun 2012 07:08:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B78ei1049281; Mon, 11 Jun 2012 07:08:40 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B78eKh049279; Mon, 11 Jun 2012 07:08:40 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206110708.q5B78eKh049279@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 07:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236874 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:08:40 -0000 Author: adrian Date: Mon Jun 11 07:08:40 2012 New Revision: 236874 URL: http://svn.freebsd.org/changeset/base/236874 Log: Finish undoing the previous commit - this part of the code is no longer required. PR: kern/166190 Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:06:49 2012 (r236873) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:08:40 2012 (r236874) @@ -1518,18 +1518,15 @@ ath_tx_start(struct ath_softc *sc, struc * TID and thus mess with the BAW. */ seqno = ath_tx_tid_seqno_assign(sc, ni, bf, m0); + + /* + * Don't add QoS NULL frames to the BAW. + */ if (IEEE80211_QOS_HAS_SEQ(wh) && subtype != IEEE80211_FC0_SUBTYPE_QOS_NULL) { bf->bf_state.bfs_dobaw = 1; } ATH_TXQ_UNLOCK(txq); - } else { - /* No AMPDU TX, we've been assigned a sequence number. */ - if (IEEE80211_QOS_HAS_SEQ(wh)) { - /* XXX we should store the frag+seqno in bfs_seqno */ - bf->bf_state.bfs_seqno = - M_SEQNO_GET(m0) << IEEE80211_SEQ_SEQ_SHIFT; - } } /* From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:11:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CA7F106566B; Mon, 11 Jun 2012 07:11:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CB498FC08; Mon, 11 Jun 2012 07:11:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7BYSl049452; Mon, 11 Jun 2012 07:11:34 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7BYWn049449; Mon, 11 Jun 2012 07:11:34 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206110711.q5B7BYWn049449@svn.freebsd.org> From: Xin LI Date: Mon, 11 Jun 2012 07:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236875 - in stable: 7/usr.sbin/inetd 8/usr.sbin/inetd 9/usr.sbin/inetd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:11:35 -0000 Author: delphij Date: Mon Jun 11 07:11:34 2012 New Revision: 236875 URL: http://svn.freebsd.org/changeset/base/236875 Log: MFC r236572: Replace the use of wall clock time with monotonically increasing clock. In general, gettimeofday() is not appropriate interface when accounting for elasped time because it can go backward, in which case the policy code could errornously consider the limit as exceeded. Reported by: Mahesh Arumugam Submitted by: Dorr H. Clark via gnn Sponsored by: Citrix / NetScaler Modified: stable/9/usr.sbin/inetd/inetd.c stable/9/usr.sbin/inetd/inetd.h Directory Properties: stable/9/usr.sbin/inetd/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.sbin/inetd/inetd.c stable/7/usr.sbin/inetd/inetd.h stable/8/usr.sbin/inetd/inetd.c stable/8/usr.sbin/inetd/inetd.h Directory Properties: stable/7/usr.sbin/inetd/ (props changed) stable/8/usr.sbin/inetd/ (props changed) Modified: stable/9/usr.sbin/inetd/inetd.c ============================================================================== --- stable/9/usr.sbin/inetd/inetd.c Mon Jun 11 07:08:40 2012 (r236874) +++ stable/9/usr.sbin/inetd/inetd.c Mon Jun 11 07:11:34 2012 (r236875) @@ -688,11 +688,11 @@ main(int argc, char **argv) */ if (dofork) { if (sep->se_count++ == 0) - (void)gettimeofday(&sep->se_time, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &sep->se_time); else if (toomany > 0 && sep->se_count >= toomany) { - struct timeval now; + struct timespec now; - (void)gettimeofday(&now, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &now); if (now.tv_sec - sep->se_time.tv_sec > CNT_INTVL) { sep->se_time = now; Modified: stable/9/usr.sbin/inetd/inetd.h ============================================================================== --- stable/9/usr.sbin/inetd/inetd.h Mon Jun 11 07:08:40 2012 (r236874) +++ stable/9/usr.sbin/inetd/inetd.h Mon Jun 11 07:11:34 2012 (r236875) @@ -109,7 +109,7 @@ struct servtab { u_int se_rpc_lowvers; /* RPC low version */ u_int se_rpc_highvers; /* RPC high version */ int se_count; /* number started since se_time */ - struct timeval se_time; /* start of se_count */ + struct timespec se_time; /* start of se_count */ struct servtab *se_next; struct se_flags { u_int se_nomapped : 1; From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:11:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83CCC1065670; Mon, 11 Jun 2012 07:11:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5479D8FC0A; Mon, 11 Jun 2012 07:11:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7BZkY049459; Mon, 11 Jun 2012 07:11:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7BZwm049456; Mon, 11 Jun 2012 07:11:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206110711.q5B7BZwm049456@svn.freebsd.org> From: Xin LI Date: Mon, 11 Jun 2012 07:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236875 - in stable: 7/usr.sbin/inetd 8/usr.sbin/inetd 9/usr.sbin/inetd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:11:35 -0000 Author: delphij Date: Mon Jun 11 07:11:34 2012 New Revision: 236875 URL: http://svn.freebsd.org/changeset/base/236875 Log: MFC r236572: Replace the use of wall clock time with monotonically increasing clock. In general, gettimeofday() is not appropriate interface when accounting for elasped time because it can go backward, in which case the policy code could errornously consider the limit as exceeded. Reported by: Mahesh Arumugam Submitted by: Dorr H. Clark via gnn Sponsored by: Citrix / NetScaler Modified: stable/8/usr.sbin/inetd/inetd.c stable/8/usr.sbin/inetd/inetd.h Directory Properties: stable/8/usr.sbin/inetd/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.sbin/inetd/inetd.c stable/7/usr.sbin/inetd/inetd.h stable/9/usr.sbin/inetd/inetd.c stable/9/usr.sbin/inetd/inetd.h Directory Properties: stable/7/usr.sbin/inetd/ (props changed) stable/9/usr.sbin/inetd/ (props changed) Modified: stable/8/usr.sbin/inetd/inetd.c ============================================================================== --- stable/8/usr.sbin/inetd/inetd.c Mon Jun 11 07:08:40 2012 (r236874) +++ stable/8/usr.sbin/inetd/inetd.c Mon Jun 11 07:11:34 2012 (r236875) @@ -688,11 +688,11 @@ main(int argc, char **argv) */ if (dofork) { if (sep->se_count++ == 0) - (void)gettimeofday(&sep->se_time, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &sep->se_time); else if (toomany > 0 && sep->se_count >= toomany) { - struct timeval now; + struct timespec now; - (void)gettimeofday(&now, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &now); if (now.tv_sec - sep->se_time.tv_sec > CNT_INTVL) { sep->se_time = now; Modified: stable/8/usr.sbin/inetd/inetd.h ============================================================================== --- stable/8/usr.sbin/inetd/inetd.h Mon Jun 11 07:08:40 2012 (r236874) +++ stable/8/usr.sbin/inetd/inetd.h Mon Jun 11 07:11:34 2012 (r236875) @@ -109,7 +109,7 @@ struct servtab { u_int se_rpc_lowvers; /* RPC low version */ u_int se_rpc_highvers; /* RPC high version */ int se_count; /* number started since se_time */ - struct timeval se_time; /* start of se_count */ + struct timespec se_time; /* start of se_count */ struct servtab *se_next; struct se_flags { u_int se_nomapped : 1; From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:11:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB9B7106566C; Mon, 11 Jun 2012 07:11:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BE458FC12; Mon, 11 Jun 2012 07:11:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7BZS6049466; Mon, 11 Jun 2012 07:11:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7BZOs049463; Mon, 11 Jun 2012 07:11:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206110711.q5B7BZOs049463@svn.freebsd.org> From: Xin LI Date: Mon, 11 Jun 2012 07:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236875 - in stable: 7/usr.sbin/inetd 8/usr.sbin/inetd 9/usr.sbin/inetd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:11:35 -0000 Author: delphij Date: Mon Jun 11 07:11:34 2012 New Revision: 236875 URL: http://svn.freebsd.org/changeset/base/236875 Log: MFC r236572: Replace the use of wall clock time with monotonically increasing clock. In general, gettimeofday() is not appropriate interface when accounting for elasped time because it can go backward, in which case the policy code could errornously consider the limit as exceeded. Reported by: Mahesh Arumugam Submitted by: Dorr H. Clark via gnn Sponsored by: Citrix / NetScaler Modified: stable/7/usr.sbin/inetd/inetd.c stable/7/usr.sbin/inetd/inetd.h Directory Properties: stable/7/usr.sbin/inetd/ (props changed) Changes in other areas also in this revision: Modified: stable/8/usr.sbin/inetd/inetd.c stable/8/usr.sbin/inetd/inetd.h stable/9/usr.sbin/inetd/inetd.c stable/9/usr.sbin/inetd/inetd.h Directory Properties: stable/8/usr.sbin/inetd/ (props changed) stable/9/usr.sbin/inetd/ (props changed) Modified: stable/7/usr.sbin/inetd/inetd.c ============================================================================== --- stable/7/usr.sbin/inetd/inetd.c Mon Jun 11 07:08:40 2012 (r236874) +++ stable/7/usr.sbin/inetd/inetd.c Mon Jun 11 07:11:34 2012 (r236875) @@ -684,11 +684,11 @@ main(int argc, char **argv) */ if (dofork) { if (sep->se_count++ == 0) - (void)gettimeofday(&sep->se_time, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &sep->se_time); else if (toomany > 0 && sep->se_count >= toomany) { - struct timeval now; + struct timespec now; - (void)gettimeofday(&now, (struct timezone *)NULL); + (void)clock_gettime(CLOCK_MONOTONIC_FAST, &now); if (now.tv_sec - sep->se_time.tv_sec > CNT_INTVL) { sep->se_time = now; Modified: stable/7/usr.sbin/inetd/inetd.h ============================================================================== --- stable/7/usr.sbin/inetd/inetd.h Mon Jun 11 07:08:40 2012 (r236874) +++ stable/7/usr.sbin/inetd/inetd.h Mon Jun 11 07:11:34 2012 (r236875) @@ -109,7 +109,7 @@ struct servtab { u_int se_rpc_lowvers; /* RPC low version */ u_int se_rpc_highvers; /* RPC high version */ int se_count; /* number started since se_time */ - struct timeval se_time; /* start of se_count */ + struct timespec se_time; /* start of se_count */ struct servtab *se_next; struct se_flags { u_int se_nomapped : 1; From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:15:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 94E09106564A; Mon, 11 Jun 2012 07:15:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8086D8FC17; Mon, 11 Jun 2012 07:15:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7FnOp049684; Mon, 11 Jun 2012 07:15:49 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7Fn8h049682; Mon, 11 Jun 2012 07:15:49 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206110715.q5B7Fn8h049682@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 07:15:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236876 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:15:49 -0000 Author: adrian Date: Mon Jun 11 07:15:48 2012 New Revision: 236876 URL: http://svn.freebsd.org/changeset/base/236876 Log: Retried frames need to be inserted in the head of the list, not the tail. This is an unfortunate byproduct of how the routine is used - it's called with the head frame on the queue, but if the frame is failed, it's inserted into the tail of the queue. Because of this, the sequence numbers would get all shuffled around and the BAW would be bumped past this sequence number, that's now at the end of the software queue. Then, whenever it's time for that frame to be transmitted, it'll be immediately outside of the BAW and TX will stall until the BAW catches up. It can also result in all kinds of weird duplicate BAW frames, leading to hilarious panics. PR: kern/166190 Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:11:34 2012 (r236875) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:15:48 2012 (r236876) @@ -2309,7 +2309,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s /* paused? queue */ if (tid->paused) { - ATH_TXQ_INSERT_TAIL(tid, bf, bf_list); + ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); /* XXX don't sched - we're paused! */ return; } From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:29:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A18C41065672; Mon, 11 Jun 2012 07:29:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72E448FC19; Mon, 11 Jun 2012 07:29:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7TQ7W050287; Mon, 11 Jun 2012 07:29:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7TQbm050285; Mon, 11 Jun 2012 07:29:26 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206110729.q5B7TQbm050285@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 07:29:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236877 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:29:26 -0000 Author: adrian Date: Mon Jun 11 07:29:25 2012 New Revision: 236877 URL: http://svn.freebsd.org/changeset/base/236877 Log: When scheduling frames in an aggregate session, the frames should be scheduled from the head of the software queue rather than trying to queue the newly given frame. This leads to some rather unfortunate out of order (but still valid as it's inside the BAW) frame TX. This now: * Always queues the frame at the end of the software queue; * Tries to direct dispatch the frame at the head of the software queue, to try and fill up the hardware queue. TODO: * I should likely try to queue as many frames to the hardware as I can at this point, rather than doing one at a time; * ath_tx_xmit_aggr() may fail and this code assumes that it'll schedule the TID. Otherwise TX may stall. PR: kern/166190 Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:15:48 2012 (r236876) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:29:25 2012 (r236877) @@ -2402,7 +2402,22 @@ ath_tx_swq(struct ath_softc *sc, struct /* XXX sched? */ } else if (ath_tx_ampdu_running(sc, an, tid)) { /* AMPDU running, attempt direct dispatch if possible */ + + /* + * Always queue the frame to the tail of the list. + */ + ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); + + /* + * If the hardware queue isn't busy, direct dispatch + * the head frame in the list. Don't schedule the + * TID - let it build some more frames first? + * + * Otherwise, schedule the TID. + */ if (txq->axq_depth < sc->sc_hwq_limit) { + bf = TAILQ_FIRST(&atid->axq_q); + ATH_TXQ_REMOVE(atid, bf, bf_list); ath_tx_xmit_aggr(sc, an, bf); DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: xmit_aggr\n", @@ -2411,7 +2426,6 @@ ath_tx_swq(struct ath_softc *sc, struct DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: ampdu; swq'ing\n", __func__); - ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } } else if (txq->axq_depth < sc->sc_hwq_limit) { From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:31:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CB90A1065675; Mon, 11 Jun 2012 07:31:51 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D5C18FC1C; Mon, 11 Jun 2012 07:31:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7VpNK050432; Mon, 11 Jun 2012 07:31:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7VpOc050430; Mon, 11 Jun 2012 07:31:51 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206110731.q5B7VpOc050430@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 07:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236878 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:31:51 -0000 Author: adrian Date: Mon Jun 11 07:31:50 2012 New Revision: 236878 URL: http://svn.freebsd.org/changeset/base/236878 Log: Make sure the frames are queued to the head of the list, not the tail. See previous commit. PR: kern/166190 Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:29:25 2012 (r236877) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:31:50 2012 (r236878) @@ -2318,7 +2318,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s if (bf->bf_state.bfs_dobaw && (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, SEQNO(bf->bf_state.bfs_seqno)))) { - ATH_TXQ_INSERT_TAIL(tid, bf, bf_list); + ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); ath_tx_tid_sched(sc, tid); return; } From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:35:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A99B2106564A; Mon, 11 Jun 2012 07:35:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94F3F8FC17; Mon, 11 Jun 2012 07:35:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7ZOfs050635; Mon, 11 Jun 2012 07:35:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7ZO4t050633; Mon, 11 Jun 2012 07:35:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206110735.q5B7ZO4t050633@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 07:35:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236879 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:35:24 -0000 Author: adrian Date: Mon Jun 11 07:35:24 2012 New Revision: 236879 URL: http://svn.freebsd.org/changeset/base/236879 Log: Add another TID lock. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:31:50 2012 (r236878) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:35:24 2012 (r236879) @@ -2149,6 +2149,7 @@ ath_tx_update_baw(struct ath_softc *sc, int seqno = SEQNO(bf->bf_state.bfs_seqno); ATH_TXQ_LOCK_ASSERT(sc->sc_ac2q[tid->ac]); + ATH_TID_LOCK_ASSERT(sc, tid); tap = ath_tx_get_tx_tid(an, tid->tid); index = ATH_BA_INDEX(tap->txa_start, seqno); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 07:44:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA7311065670; Mon, 11 Jun 2012 07:44:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B47018FC08; Mon, 11 Jun 2012 07:44:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5B7iHhs051037; Mon, 11 Jun 2012 07:44:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5B7iHsS051035; Mon, 11 Jun 2012 07:44:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206110744.q5B7iHsS051035@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 07:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236880 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 07:44:17 -0000 Author: adrian Date: Mon Jun 11 07:44:16 2012 New Revision: 236880 URL: http://svn.freebsd.org/changeset/base/236880 Log: Wrap the whole (software) TX path from ifnet dequeue to software queue (or direct dispatch) behind the TXQ lock (which, remember, is doubling as the TID lock too for now.) This ensures that: (a) the sequence number and the CCMP PN allocation is done together; (b) overlapping transmit paths don't interleave frames, so we don't end up with the original issue that triggered kern/166190. Ie, that we don't end up with seqno A, B in thread 1, C, D in thread 2, and they being queued to the software queue as "A C D B" or similar, leading to the BAW stalls. This has been tested: * both STA and AP modes with INVARIANTS and WITNESS; * TCP and UDP TX; * both STA->AP and AP->STA. STA is a Routerstation Pro (single CPU MIPS) and the AP is a dual-core Centrino. PR: kern/166190 Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:35:24 2012 (r236879) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 07:44:16 2012 (r236880) @@ -1171,6 +1171,15 @@ ath_tx_normal_setup(struct ath_softc *sc struct ath_node *an; u_int pri; + /* + * To ensure that both sequence numbers and the CCMP PN handling + * is "correct", make sure that the relevant TID queue is locked. + * Otherwise the CCMP PN and seqno may appear out of order, causing + * re-ordered frames to have out of order CCMP PN's, resulting + * in many, many frame drops. + */ + ATH_TXQ_LOCK_ASSERT(txq); + wh = mtod(m0, struct ieee80211_frame *); iswep = wh->i_fc[1] & IEEE80211_FC1_WEP; ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1); @@ -1506,11 +1515,18 @@ ath_tx_start(struct ath_softc *sc, struc /* XXX should just bzero the bf_state? */ bf->bf_state.bfs_dobaw = 0; + /* + * Acquire the TXQ lock early, so both the encap and seqno + * are allocated together. + */ + ATH_TXQ_LOCK(txq); + /* A-MPDU TX? Manually set sequence number */ - /* Don't do it whilst pending; the net80211 layer still assigns them */ - /* XXX do we need locking here? */ + /* + * Don't do it whilst pending; the net80211 layer still + * assigns them. + */ if (is_ampdu_tx) { - ATH_TXQ_LOCK(txq); /* * Always call; this function will * handle making sure that null data frames @@ -1526,7 +1542,6 @@ ath_tx_start(struct ath_softc *sc, struc subtype != IEEE80211_FC0_SUBTYPE_QOS_NULL) { bf->bf_state.bfs_dobaw = 1; } - ATH_TXQ_UNLOCK(txq); } /* @@ -1545,7 +1560,7 @@ ath_tx_start(struct ath_softc *sc, struc r = ath_tx_normal_setup(sc, ni, bf, m0, txq); if (r != 0) - return r; + goto done; /* At this point m0 could have changed! */ m0 = bf->bf_m; @@ -1570,16 +1585,12 @@ ath_tx_start(struct ath_softc *sc, struc if (txq == &avp->av_mcastq) { DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: mcastq: TX'ing\n", __func__, bf); - ATH_TXQ_LOCK(txq); ath_tx_xmit_normal(sc, txq, bf); - ATH_TXQ_UNLOCK(txq); } else if (type == IEEE80211_FC0_TYPE_CTL && subtype == IEEE80211_FC0_SUBTYPE_BAR) { DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: BAR: TX'ing direct\n", __func__); - ATH_TXQ_LOCK(txq); ath_tx_xmit_normal(sc, txq, bf); - ATH_TXQ_UNLOCK(txq); } else { /* add to software queue */ DPRINTF(sc, ATH_DEBUG_SW_TX, @@ -1591,10 +1602,10 @@ ath_tx_start(struct ath_softc *sc, struc * For now, since there's no software queue, * direct-dispatch to the hardware. */ - ATH_TXQ_LOCK(txq); ath_tx_xmit_normal(sc, txq, bf); - ATH_TXQ_UNLOCK(txq); #endif +done: + ATH_TXQ_UNLOCK(txq); return 0; } @@ -1630,10 +1641,29 @@ ath_tx_raw_start(struct ath_softc *sc, s /* XXX honor IEEE80211_BPF_DATAPAD */ pktlen = m0->m_pkthdr.len - (hdrlen & 3) + IEEE80211_CRC_LEN; - DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: ismcast=%d\n", __func__, ismcast); + pri = params->ibp_pri & 3; + /* Override pri if the frame isn't a QoS one */ + if (! IEEE80211_QOS_HAS_SEQ(wh)) + pri = ath_tx_getac(sc, m0); + + /* XXX If it's an ADDBA, override the correct queue */ + do_override = ath_tx_action_frame_override_queue(sc, ni, m0, &o_tid); + + /* Map ADDBA to the correct priority */ + if (do_override) { +#if 0 + device_printf(sc->sc_dev, + "%s: overriding tid %d pri %d -> %d\n", + __func__, o_tid, pri, TID_TO_WME_AC(o_tid)); +#endif + pri = TID_TO_WME_AC(o_tid); + } + + ATH_TXQ_LOCK(sc->sc_ac2q[pri]); + /* Handle encryption twiddling if needed */ if (! ath_tx_tag_crypto(sc, ni, m0, params->ibp_flags & IEEE80211_BPF_CRYPTO, 0, @@ -1688,11 +1718,6 @@ ath_tx_raw_start(struct ath_softc *sc, s if (flags & (HAL_TXDESC_RTSENA|HAL_TXDESC_CTSENA)) bf->bf_state.bfs_ctsrate0 = params->ibp_ctsrate; - pri = params->ibp_pri & 3; - /* Override pri if the frame isn't a QoS one */ - if (! IEEE80211_QOS_HAS_SEQ(wh)) - pri = ath_tx_getac(sc, m0); - /* * NB: we mark all packets as type PSPOLL so the h/w won't * set the sequence number, duration, etc. @@ -1774,19 +1799,6 @@ ath_tx_raw_start(struct ath_softc *sc, s /* NB: no buffered multicast in power save support */ - /* XXX If it's an ADDBA, override the correct queue */ - do_override = ath_tx_action_frame_override_queue(sc, ni, m0, &o_tid); - - /* Map ADDBA to the correct priority */ - if (do_override) { -#if 0 - device_printf(sc->sc_dev, - "%s: overriding tid %d pri %d -> %d\n", - __func__, o_tid, pri, TID_TO_WME_AC(o_tid)); -#endif - pri = TID_TO_WME_AC(o_tid); - } - /* * If we're overiding the ADDBA destination, dump directly * into the hardware queue, right after any pending @@ -1796,13 +1808,12 @@ ath_tx_raw_start(struct ath_softc *sc, s __func__, do_override); if (do_override) { - ATH_TXQ_LOCK(sc->sc_ac2q[pri]); ath_tx_xmit_normal(sc, sc->sc_ac2q[pri], bf); - ATH_TXQ_UNLOCK(sc->sc_ac2q[pri]); } else { /* Queue to software queue */ ath_tx_swq(sc, ni, sc->sc_ac2q[pri], bf); } + ATH_TXQ_UNLOCK(sc->sc_ac2q[pri]); return 0; } @@ -2032,6 +2043,15 @@ ath_tx_addto_baw(struct ath_softc *sc, s if (bf->bf_state.bfs_isretried) return; + if (! bf->bf_state.bfs_dobaw) { + device_printf(sc->sc_dev, + "%s: dobaw=0, seqno=%d, window %d:%d\n", + __func__, + SEQNO(bf->bf_state.bfs_seqno), + tap->txa_start, + tap->txa_wnd); + } + tap = ath_tx_get_tx_tid(an, tid->tid); if (bf->bf_state.bfs_addedbaw) @@ -2043,6 +2063,20 @@ ath_tx_addto_baw(struct ath_softc *sc, s tid->baw_tail); /* + * Verify that the given sequence number is not outside of the + * BAW. Complain loudly if that's the case. + */ + if (! BAW_WITHIN(tap->txa_start, tap->txa_wnd, + SEQNO(bf->bf_state.bfs_seqno))) { + device_printf(sc->sc_dev, + "%s: bf=%p: outside of BAW?? tid=%d, seqno %d; window %d:%d; " + "baw head=%d tail=%d\n", + __func__, bf, tid->tid, SEQNO(bf->bf_state.bfs_seqno), + tap->txa_start, tap->txa_wnd, tid->baw_head, + tid->baw_tail); + } + + /* * ni->ni_txseqs[] is the currently allocated seqno. * the txa state contains the current baw start. */ @@ -2265,6 +2299,8 @@ ath_tx_tid_seqno_assign(struct ath_softc if (! IEEE80211_QOS_HAS_SEQ(wh)) return -1; + ATH_TID_LOCK_ASSERT(sc, &(ATH_NODE(ni)->an_tid[tid])); + /* * Is it a QOS NULL Data frame? Give it a sequence number from * the default TID (IEEE80211_NONQOS_TID.) @@ -2276,6 +2312,7 @@ ath_tx_tid_seqno_assign(struct ath_softc */ subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; if (subtype == IEEE80211_FC0_SUBTYPE_QOS_NULL) { + /* XXX no locking for this TID? This is a bit of a problem. */ seqno = ni->ni_txseqs[IEEE80211_NONQOS_TID]; INCR(ni->ni_txseqs[IEEE80211_NONQOS_TID], IEEE80211_SEQ_RANGE); } else { @@ -2369,6 +2406,8 @@ ath_tx_swq(struct ath_softc *sc, struct int pri, tid; struct mbuf *m0 = bf->bf_m; + ATH_TXQ_LOCK_ASSERT(txq); + /* Fetch the TID - non-QoS frames get assigned to TID 16 */ wh = mtod(m0, struct ieee80211_frame *); pri = ath_tx_getac(sc, m0); @@ -2391,7 +2430,6 @@ ath_tx_swq(struct ath_softc *sc, struct * If the TID is paused or the traffic it outside BAW, software * queue it. */ - ATH_TXQ_LOCK(txq); if (atid->paused) { /* TID is paused, queue */ DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: paused\n", __func__); @@ -2439,7 +2477,6 @@ ath_tx_swq(struct ath_softc *sc, struct ATH_TXQ_INSERT_TAIL(atid, bf, bf_list); ath_tx_tid_sched(sc, atid); } - ATH_TXQ_UNLOCK(txq); } /* From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 11:35:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E15A106564A; Mon, 11 Jun 2012 11:35:23 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 146E28FC08; Mon, 11 Jun 2012 11:35:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BBZNJS081989; Mon, 11 Jun 2012 11:35:23 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BBZMva081982; Mon, 11 Jun 2012 11:35:22 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206111135.q5BBZMva081982@svn.freebsd.org> From: Martin Matuska Date: Mon, 11 Jun 2012 11:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236884 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/l... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 11:35:23 -0000 Author: mm Date: Mon Jun 11 11:35:22 2012 New Revision: 236884 URL: http://svn.freebsd.org/changeset/base/236884 Log: Introduce "feature flags" for ZFS pools (bump SPA version to 5000). Add first feature "com.delphix:async_destroy" (asynchronous destroy of ZFS datasets). Implement features support in ZFS boot code. Illumos revisions merged: 13700:2889e2596bd6 13701:1949b688d5fb 2619 asynchronous destruction of ZFS file systems 2747 SPA versioning with zfs feature flags References: https://www.illumos.org/issues/2619 https://www.illumos.org/issues/2747 Obtained from: illumos (issue #2619, #2747) MFC after: 1 month Added: head/cddl/contrib/opensolaris/cmd/zhack/ head/cddl/contrib/opensolaris/cmd/zhack/zhack.c (contents, props changed) head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.5 (contents, props changed) head/cddl/usr.sbin/zhack/ head/cddl/usr.sbin/zhack/Makefile (contents, props changed) head/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bptree.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c (contents, props changed) Modified: head/UPDATING head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/lib/libnvpair/Makefile head/cddl/lib/libzfs/Makefile head/cddl/sbin/zpool/Makefile head/cddl/usr.bin/ztest/Makefile head/cddl/usr.sbin/Makefile head/sys/boot/zfs/zfsimpl.c head/sys/cddl/boot/zfs/zfsimpl.h head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h head/sys/modules/zfs/Makefile Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Jun 11 08:52:21 2012 (r236883) +++ head/UPDATING Mon Jun 11 11:35:22 2012 (r236884) @@ -24,6 +24,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20120611: + A new version of ZFS (pool version 5000) has been merged to -HEAD. + Starting with this version the old system of ZFS pool versioning + is superseded by "feature flags". This concept enables forward + compatibility against certain future changes in functionality of ZFS + pools. The first read-only compatible "feature flag" for ZFS pools + is named "com.delphix:async_destroy". For more information + read the new zpool-features(5) manual page. + Please refer to the "ZFS notes" section of this file for information + on upgrading boot ZFS pools. + 20120417: The malloc(3) implementation embedded in libc now uses sources imported as contrib/jemalloc. The most disruptive API change is to Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Jun 11 08:52:21 2012 (r236883) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Jun 11 11:35:22 2012 (r236884) @@ -18,8 +18,10 @@ * * CDDL HEADER END */ + /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012 by Delphix. All rights reserved. */ #include @@ -54,6 +56,7 @@ #include #include #include +#include #undef ZFS_MAXNAMELEN #undef verify #include @@ -63,7 +66,8 @@ #define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ zio_checksum_table[(idx)].ci_name : "UNKNOWN") #define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \ - dmu_ot[(idx)].ot_name : "UNKNOWN") + dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \ + dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN") #define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : DMU_OT_NUMTYPES) #ifndef lint @@ -1088,7 +1092,7 @@ dump_dsl_dataset(objset_t *os, uint64_t ASSERT(size == sizeof (*ds)); crtime = ds->ds_creation_time; - zdb_nicenum(ds->ds_used_bytes, used); + zdb_nicenum(ds->ds_referenced_bytes, used); zdb_nicenum(ds->ds_compressed_bytes, compressed); zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed); zdb_nicenum(ds->ds_unique_bytes, unique); @@ -1132,6 +1136,44 @@ dump_dsl_dataset(objset_t *os, uint64_t /* ARGSUSED */ static int +dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) +{ + char blkbuf[BP_SPRINTF_LEN]; + + if (bp->blk_birth != 0) { + sprintf_blkptr(blkbuf, bp); + (void) printf("\t%s\n", blkbuf); + } + return (0); +} + +static void +dump_bptree(objset_t *os, uint64_t obj, char *name) +{ + char bytes[32]; + bptree_phys_t *bt; + dmu_buf_t *db; + + if (dump_opt['d'] < 3) + return; + + VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db)); + bt = db->db_data; + zdb_nicenum(bt->bt_bytes, bytes); + (void) printf("\n %s: %llu datasets, %s\n", + name, (unsigned long long)(bt->bt_end - bt->bt_begin), bytes); + dmu_buf_rele(db, FTAG); + + if (dump_opt['d'] < 5) + return; + + (void) printf("\n"); + + (void) bptree_iterate(os, obj, B_FALSE, dump_bptree_cb, NULL, NULL); +} + +/* ARGSUSED */ +static int dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) { char blkbuf[BP_SPRINTF_LEN]; @@ -1883,11 +1925,13 @@ typedef struct zdb_blkstats { */ #define ZDB_OT_DEFERRED (DMU_OT_NUMTYPES + 0) #define ZDB_OT_DITTO (DMU_OT_NUMTYPES + 1) -#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 2) +#define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2) +#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3) static char *zdb_ot_extname[] = { "deferred free", "dedup ditto", + "other", "Total", }; @@ -1968,9 +2012,10 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog type = BP_GET_TYPE(bp); - zdb_count_block(zcb, zilog, bp, type); + zdb_count_block(zcb, zilog, bp, + (type & DMU_OT_NEWTYPE) ? ZDB_OT_OTHER : type); - is_metadata = (BP_GET_LEVEL(bp) != 0 || dmu_ot[type].ot_metadata); + is_metadata = (BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type)); if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) { int ioerr; @@ -2197,6 +2242,12 @@ dump_block_stats(spa_t *spa) (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, count_block_cb, &zcb, NULL); } + if (spa_feature_is_active(spa, + &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { + VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset, + spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb, + &zcb, NULL)); + } if (dump_opt['c'] > 1) flags |= TRAVERSE_PREFETCH_DATA; @@ -2373,7 +2424,7 @@ zdb_ddt_add_cb(spa_t *spa, zilog_t *zilo } if (BP_IS_HOLE(bp) || BP_GET_CHECKSUM(bp) == ZIO_CHECKSUM_OFF || - BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) + BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp))) return (0); ddt_key_fill(&zdde_search.zdde_key, bp); @@ -2478,7 +2529,14 @@ dump_zpool(spa_t *spa) dump_bpobj(&spa->spa_deferred_bpobj, "Deferred frees"); if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj, - "Pool frees"); + "Pool snapshot frees"); + } + + if (spa_feature_is_active(spa, + &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { + dump_bptree(spa->spa_meta_objset, + spa->spa_dsl_pool->dp_bptree_obj, + "Pool dataset frees"); } dump_dtl(spa->spa_root_vdev, 0); } Added: head/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Mon Jun 11 11:35:22 2012 (r236884) @@ -0,0 +1,533 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +/* + * zhack is a debugging tool that can write changes to ZFS pool using libzpool + * for testing purposes. Altering pools with zhack is unsupported and may + * result in corrupted pools. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#undef ZFS_MAXNAMELEN +#undef verify +#include + +extern boolean_t zfeature_checks_disable; + +const char cmdname[] = "zhack"; +libzfs_handle_t *g_zfs; +static importargs_t g_importargs; +static char *g_pool; +static boolean_t g_readonly; + +static void +usage(void) +{ + (void) fprintf(stderr, + "Usage: %s [-c cachefile] [-d dir] ...\n" + "where is one of the following:\n" + "\n", cmdname); + + (void) fprintf(stderr, + " feature stat \n" + " print information about enabled features\n" + " feature enable [-d desc] \n" + " add a new enabled feature to the pool\n" + " -d sets the feature's description\n" + " feature ref [-md] \n" + " change the refcount on the given feature\n" + " -d decrease instead of increase the refcount\n" + " -m add the feature to the label if increasing refcount\n" + "\n" + " : should be a feature guid\n"); + exit(1); +} + + +static void +fatal(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + (void) fprintf(stderr, "%s: ", cmdname); + (void) vfprintf(stderr, fmt, ap); + va_end(ap); + (void) fprintf(stderr, "\n"); + + exit(1); +} + +/* ARGSUSED */ +static int +space_delta_cb(dmu_object_type_t bonustype, void *data, + uint64_t *userp, uint64_t *groupp) +{ + /* + * Is it a valid type of object to track? + */ + if (bonustype != DMU_OT_ZNODE && bonustype != DMU_OT_SA) + return (ENOENT); + (void) fprintf(stderr, "modifying object that needs user accounting"); + abort(); + /* NOTREACHED */ +} + +/* + * Target is the dataset whose pool we want to open. + */ +static void +import_pool(const char *target, boolean_t readonly) +{ + nvlist_t *config; + nvlist_t *pools; + int error; + char *sepp; + spa_t *spa; + nvpair_t *elem; + nvlist_t *props; + const char *name; + + kernel_init(readonly ? FREAD : (FREAD | FWRITE)); + g_zfs = libzfs_init(); + ASSERT(g_zfs != NULL); + + dmu_objset_register_type(DMU_OST_ZFS, space_delta_cb); + + g_readonly = readonly; + + /* + * If we only want readonly access, it's OK if we find + * a potentially-active (ie, imported into the kernel) pool from the + * default cachefile. + */ + if (readonly && spa_open(target, &spa, FTAG) == 0) { + spa_close(spa, FTAG); + return; + } + + g_importargs.unique = B_TRUE; + g_importargs.can_be_active = readonly; + g_pool = strdup(target); + if ((sepp = strpbrk(g_pool, "/@")) != NULL) + *sepp = '\0'; + g_importargs.poolname = g_pool; + pools = zpool_search_import(g_zfs, &g_importargs); + + if (pools == NULL || nvlist_next_nvpair(pools, NULL) == NULL) { + if (!g_importargs.can_be_active) { + g_importargs.can_be_active = B_TRUE; + if (zpool_search_import(g_zfs, &g_importargs) != NULL || + spa_open(target, &spa, FTAG) == 0) { + fatal("cannot import '%s': pool is active; run " + "\"zpool export %s\" first\n", + g_pool, g_pool); + } + } + + fatal("cannot import '%s': no such pool available\n", g_pool); + } + + elem = nvlist_next_nvpair(pools, NULL); + name = nvpair_name(elem); + verify(nvpair_value_nvlist(elem, &config) == 0); + + props = NULL; + if (readonly) { + verify(nvlist_alloc(&props, NV_UNIQUE_NAME, 0) == 0); + verify(nvlist_add_uint64(props, + zpool_prop_to_name(ZPOOL_PROP_READONLY), 1) == 0); + } + + zfeature_checks_disable = B_TRUE; + error = spa_import(name, config, props, ZFS_IMPORT_NORMAL); + zfeature_checks_disable = B_FALSE; + if (error == EEXIST) + error = 0; + + if (error) + fatal("can't import '%s': %s", name, strerror(error)); +} + +static void +zhack_spa_open(const char *target, boolean_t readonly, void *tag, spa_t **spa) +{ + int err; + + import_pool(target, readonly); + + zfeature_checks_disable = B_TRUE; + err = spa_open(target, spa, tag); + zfeature_checks_disable = B_FALSE; + + if (err != 0) + fatal("cannot open '%s': %s", target, strerror(err)); + if (spa_version(*spa) < SPA_VERSION_FEATURES) { + fatal("'%s' has version %d, features not enabled", target, + (int)spa_version(*spa)); + } +} + +static void +dump_obj(objset_t *os, uint64_t obj, const char *name) +{ + zap_cursor_t zc; + zap_attribute_t za; + + (void) printf("%s_obj:\n", name); + + for (zap_cursor_init(&zc, os, obj); + zap_cursor_retrieve(&zc, &za) == 0; + zap_cursor_advance(&zc)) { + if (za.za_integer_length == 8) { + ASSERT(za.za_num_integers == 1); + (void) printf("\t%s = %llu\n", + za.za_name, (u_longlong_t)za.za_first_integer); + } else { + ASSERT(za.za_integer_length == 1); + char val[1024]; + VERIFY(zap_lookup(os, obj, za.za_name, + 1, sizeof (val), val) == 0); + (void) printf("\t%s = %s\n", za.za_name, val); + } + } + zap_cursor_fini(&zc); +} + +static void +dump_mos(spa_t *spa) +{ + nvlist_t *nv = spa->spa_label_features; + + (void) printf("label config:\n"); + for (nvpair_t *pair = nvlist_next_nvpair(nv, NULL); + pair != NULL; + pair = nvlist_next_nvpair(nv, pair)) { + (void) printf("\t%s\n", nvpair_name(pair)); + } +} + +static void +zhack_do_feature_stat(int argc, char **argv) +{ + spa_t *spa; + objset_t *os; + char *target; + + argc--; + argv++; + + if (argc < 1) { + (void) fprintf(stderr, "error: missing pool name\n"); + usage(); + } + target = argv[0]; + + zhack_spa_open(target, B_TRUE, FTAG, &spa); + os = spa->spa_meta_objset; + + dump_obj(os, spa->spa_feat_for_read_obj, "for_read"); + dump_obj(os, spa->spa_feat_for_write_obj, "for_write"); + dump_obj(os, spa->spa_feat_desc_obj, "descriptions"); + dump_mos(spa); + + spa_close(spa, FTAG); +} + +static void +feature_enable_sync(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + spa_feature_enable(spa, feature, tx); +} + +static void +zhack_do_feature_enable(int argc, char **argv) +{ + char c; + char *desc, *target; + spa_t *spa; + objset_t *mos; + zfeature_info_t feature; + zfeature_info_t *nodeps[] = { NULL }; + + /* + * Features are not added to the pool's label until their refcounts + * are incremented, so fi_mos can just be left as false for now. + */ + desc = NULL; + feature.fi_uname = "zhack"; + feature.fi_mos = B_FALSE; + feature.fi_can_readonly = B_FALSE; + feature.fi_depends = nodeps; + + optind = 1; + while ((c = getopt(argc, argv, "rmd:")) != -1) { + switch (c) { + case 'r': + feature.fi_can_readonly = B_TRUE; + break; + case 'd': + desc = strdup(optarg); + break; + default: + usage(); + break; + } + } + + if (desc == NULL) + desc = strdup("zhack injected"); + feature.fi_desc = desc; + + argc -= optind; + argv += optind; + + if (argc < 2) { + (void) fprintf(stderr, "error: missing feature or pool name\n"); + usage(); + } + target = argv[0]; + feature.fi_guid = argv[1]; + + if (!zfeature_is_valid_guid(feature.fi_guid)) + fatal("invalid feature guid: %s", feature.fi_guid); + + zhack_spa_open(target, B_FALSE, FTAG, &spa); + mos = spa->spa_meta_objset; + + if (0 == zfeature_lookup_guid(feature.fi_guid, NULL)) + fatal("'%s' is a real feature, will not enable"); + if (0 == zap_contains(mos, spa->spa_feat_desc_obj, feature.fi_guid)) + fatal("feature already enabled: %s", feature.fi_guid); + + VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL, + feature_enable_sync, spa, &feature, 5)); + + spa_close(spa, FTAG); + + free(desc); +} + +static void +feature_incr_sync(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + spa_feature_incr(spa, feature, tx); +} + +static void +feature_decr_sync(void *arg1, void *arg2, dmu_tx_t *tx) +{ + spa_t *spa = arg1; + zfeature_info_t *feature = arg2; + + spa_feature_decr(spa, feature, tx); +} + +static void +zhack_do_feature_ref(int argc, char **argv) +{ + char c; + char *target; + boolean_t decr = B_FALSE; + spa_t *spa; + objset_t *mos; + zfeature_info_t feature; + zfeature_info_t *nodeps[] = { NULL }; + + /* + * fi_desc does not matter here because it was written to disk + * when the feature was enabled, but we need to properly set the + * feature for read or write based on the information we read off + * disk later. + */ + feature.fi_uname = "zhack"; + feature.fi_mos = B_FALSE; + feature.fi_desc = NULL; + feature.fi_depends = nodeps; + + optind = 1; + while ((c = getopt(argc, argv, "md")) != -1) { + switch (c) { + case 'm': + feature.fi_mos = B_TRUE; + break; + case 'd': + decr = B_TRUE; + break; + default: + usage(); + break; + } + } + argc -= optind; + argv += optind; + + if (argc < 2) { + (void) fprintf(stderr, "error: missing feature or pool name\n"); + usage(); + } + target = argv[0]; + feature.fi_guid = argv[1]; + + if (!zfeature_is_valid_guid(feature.fi_guid)) + fatal("invalid feature guid: %s", feature.fi_guid); + + zhack_spa_open(target, B_FALSE, FTAG, &spa); + mos = spa->spa_meta_objset; + + if (0 == zfeature_lookup_guid(feature.fi_guid, NULL)) + fatal("'%s' is a real feature, will not change refcount"); + + if (0 == zap_contains(mos, spa->spa_feat_for_read_obj, + feature.fi_guid)) { + feature.fi_can_readonly = B_FALSE; + } else if (0 == zap_contains(mos, spa->spa_feat_for_write_obj, + feature.fi_guid)) { + feature.fi_can_readonly = B_TRUE; + } else { + fatal("feature is not enabled: %s", feature.fi_guid); + } + + if (decr && !spa_feature_is_active(spa, &feature)) + fatal("feature refcount already 0: %s", feature.fi_guid); + + VERIFY3U(0, ==, dsl_sync_task_do(spa->spa_dsl_pool, NULL, + decr ? feature_decr_sync : feature_incr_sync, spa, &feature, 5)); + + spa_close(spa, FTAG); +} + +static int +zhack_do_feature(int argc, char **argv) +{ + char *subcommand; + + argc--; + argv++; + if (argc == 0) { + (void) fprintf(stderr, + "error: no feature operation specified\n"); + usage(); + } + + subcommand = argv[0]; + if (strcmp(subcommand, "stat") == 0) { + zhack_do_feature_stat(argc, argv); + } else if (strcmp(subcommand, "enable") == 0) { + zhack_do_feature_enable(argc, argv); + } else if (strcmp(subcommand, "ref") == 0) { + zhack_do_feature_ref(argc, argv); + } else { + (void) fprintf(stderr, "error: unknown subcommand: %s\n", + subcommand); + usage(); + } + + return (0); +} + +#define MAX_NUM_PATHS 1024 + +int +main(int argc, char **argv) +{ + extern void zfs_prop_init(void); + + char *path[MAX_NUM_PATHS]; + const char *subcommand; + int rv = 0; + char c; + + g_importargs.path = path; + + dprintf_setup(&argc, argv); + zfs_prop_init(); + + while ((c = getopt(argc, argv, "c:d:")) != -1) { + switch (c) { + case 'c': + g_importargs.cachefile = optarg; + break; + case 'd': + assert(g_importargs.paths < MAX_NUM_PATHS); + g_importargs.path[g_importargs.paths++] = optarg; + break; + default: + usage(); + break; + } + } + + argc -= optind; + argv += optind; + optind = 1; + + if (argc == 0) { + (void) fprintf(stderr, "error: no command specified\n"); + usage(); + } + + subcommand = argv[0]; + + if (strcmp(subcommand, "feature") == 0) { + rv = zhack_do_feature(argc, argv); + } else { + (void) fprintf(stderr, "error: unknown subcommand: %s\n", + subcommand); + usage(); + } + + if (!g_readonly && spa_export(g_pool, NULL, B_TRUE, B_TRUE) != 0) { + fatal("pool export failed; " + "changes may not be committed to disk\n"); + } + + libzfs_fini(g_zfs); + kernel_fini(); + + return (rv); +} Added: head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.5 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool-features.5 Mon Jun 11 11:35:22 2012 (r236884) @@ -0,0 +1,174 @@ +'\" te +.\" Copyright (c) 2012, Martin Matuska . +.\" All Rights Reserved. +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" Copyright (c) 2012 by Delphix. All rights reserved. +.\" +.\" $FreeBSD$ +.\" +.Dd May 28, 2012 +.Dt ZPOOL-FEATURES 8 +.Os +.Sh NAME +.Nm zpool-features +.Nd ZFS pool feature descriptions +.Sh DESCRIPTION +ZFS pool on\-disk format versions are specified via "features" which replace +the old on\-disk format numbers (the last supported on\-disk format number is +28). +To enable a feature on a pool use the +.Xr zpool 8 +command to set the +.Sy feature@feature_name +property to +.Ar enabled . +.Pp +The pool format does not affect file system version compatibility or the ability +to send file systems between pools. +.Pp +Since most features can be enabled independently of each other the on\-disk +format of the pool is specified by the set of all features marked as +.Sy active +on the pool. If the pool was created by another software version this set may +include unsupported features. +.Ss Identifying features +Every feature has a guid of the form +.Sy com.example:feature_name . +The reverse DNS name ensures that the feature's guid is unique across all ZFS +implementations. When unsupported features are encountered on a pool they will +be identified by their guids. +Refer to the documentation for the ZFS implementation that created the pool +for information about those features. +.Pp +Each supported feature also has a short name. +By convention a feature's short name is the portion of its guid which follows +the ':' (e.g. +.Sy com.example:feature_name +would have the short name +.Sy feature_name ), +however a feature's short name may differ across ZFS implementations if +following the convention would result in name conflicts. +.Ss Feature states +Features can be in one of three states: +.Bl -tag +.It Sy active +This feature's on\-disk format changes are in effect on the pool. +Support for this feature is required to import the pool in read\-write mode. +If this feature is not read-only compatible, support is also required to +import the pool in read\-only mode (see "Read\-only compatibility"). +.It Sy enabled +An administrator has marked this feature as enabled on the pool, but the +feature's on\-disk format changes have not been made yet. +The pool can still be imported by software that does not support this feature, +but changes may be made to the on\-disk format at any time which will move +the feature to the +.Sy active +state. +Some features may support returning to the +.Sy enabled +state after becoming +.Sy active . +See feature\-specific documentation for details. +.It Sy disabled +This feature's on\-disk format changes have not been made and will not be made +unless an administrator moves the feature to the +.Sy enabled +state. +Features cannot be disabled once they have been enabled. +.El +The state of supported features is exposed through pool properties of the form +.Sy feature@short_name . +.Ss Read\-only compatibility +Some features may make on\-disk format changes that do not interfere with other +software's ability to read from the pool. +These features are referred to as "read\-only compatible". +If all unsupported features on a pool are read\-only compatible, the pool can +be imported in read\-only mode by setting the +.Sy readonly +property during import (see +.Xr zpool 8 +for details on importing pools). +.Ss Unsupported features +For each unsupported feature enabled on an imported pool a pool property +named +.Sy unsupported@feature_guid +will indicate why the import was allowed despite the unsupported feature. +Possible values for this property are: +.Bl -tag +.It Sy inactive +The feature is in the +.Sy enabled +state and therefore the pool's on\-disk format is still compatible with +software that does not support this feature. +.It Sy readonly +The feature is read\-only compatible and the pool has been imported in +read\-only mode. +.El +.Ss Feature dependencies +Some features depend on other features being enabled in order to function +properly. +Enabling a feature will automatically enable any features it depends on. +.Sh FEATURES +The following features are supported on this system: +.Bl -tag +.It Sy async_destroy +.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:async_destroy" +.It GUID Ta com.delphix:async_destroy +.It READ\-ONLY COMPATIBLE Ta yes +.It DEPENDENCIES Ta none +.El +.Pp +Destroying a file system requires traversing all of its data in order to +return its used space to the pool. +Without +.Sy async_destroy +the file system is not fully removed until all space has been reclaimed. +If the destroy operation is interrupted by a reboot or power outage the next +attempt to open the pool will need to complete the destroy operation +synchronously. +.Pp +When +.Sy async_destroy +is enabled the file system's data will be reclaimed by a background process, +allowing the destroy operation to complete without traversing the entire file +system. +The background process is able to resume interrupted destroys after the pool +has been opened, eliminating the need to finish interrupted destroys as part +of the open operation. +The amount of space remaining to be reclaimed by the background process is +available through the +.Sy freeing +property. +.Sh SEE ALSO +.Xr zpool 8 +.Sh AUTHORS +This manual page is a +.Xr mdoc 7 +reimplementation of the +.Tn illumos +manual page +.Em zpool-features(5) , +modified and customized for +.Fx +and licensed under the Common Development and Distribution License +.Pq Tn CDDL . +.Pp +The +.Xr mdoc 7 +implementation of this manual page was initially written by +.An Martin Matuska Aq mm@FreeBSD.org . Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Jun 11 08:52:21 2012 (r236883) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Jun 11 11:35:22 2012 (r236884) @@ -1,5 +1,5 @@ '\" te -.\" Copyright (c) 2011, Martin Matuska . +.\" Copyright (c) 2012, Martin Matuska . .\" All Rights Reserved. .\" .\" The contents of this file are subject to the terms of the @@ -20,6 +20,7 @@ .\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2011, Justin T. Gibbs +.\" Copyright (c) 2012 by Delphix. All Rights Reserved. .\" .\" $FreeBSD$ .\" @@ -47,7 +48,7 @@ .Op Ar device .Nm .Cm create -.Op Fl fn +.Op Fl fnd .Op Fl o Ar property Ns = Ns Ar value .Ar ... .Op Fl O Ar file-system-property Ns = Ns Ar value @@ -537,6 +538,16 @@ value of 1.76 indicates that 1.76 units for a description of the deduplication feature. .It Sy free Number of blocks within the pool that are not allocated. +.It Sy freeing +After a file system or snapshot is destroyed, the space it was using is +returned to the pool asynchronously. +.Sy freeing +is the amount of space remaining to be reclaimed. +Over time +.Sy freeing +will decrease while +.Sy free +increases. .It Sy expandsize This property has currently no value on FreeBSD. .It Sy guid @@ -552,11 +563,16 @@ or .Qq Sy UNAVAIL . .It Sy size Total size of the storage pool. +.It Sy unsupported@ Ns Ar feature_guid +Information about unsupported features that are enabled on the pool. +See +.Xr zpool-features 5 +for details. .It Sy used Amount of storage space used within the pool. .El .Pp -These space usage properties report actual physical space available to the +The space usage properties report actual physical space available to the storage pool. The physical space can be different from the total amount of space that any contained datasets can actually use. The amount of space used in a @@ -653,6 +669,11 @@ Setting it to the special value creates a temporary pool that is never cached, and the special value .Cm '' (empty string) uses the default location. +.It Sy comment Ns = Ns Ar text +A text string consisting of printable ASCII characters that will be stored +such that it is available even if the pool becomes faulted. +An administrator can provide additional information about a pool using this +property. .It Sy dedupditto Ns = Ns Ar number Threshold for the number of block ditto copies. If the reference count for a deduplicated block increases above this number, a new ditto copy of this block @@ -686,6 +707,17 @@ requests that have yet to be committed t .It Sy panic Prints out a message to the console and generates a system crash dump. .El +.It Sy feature@ Ns Ar feature_name Ns = Ns Sy enabled +The value of this property is the current state of +.Ar feature_name . +The only valid value when setting this property is +.Sy enabled +which moves +.Ar feature_name +to the enabled state. +See +.Xr zpool-features 5 +for details on feature states. .It Sy listsnaps Ns = Ns Cm on No | Cm off Controls whether information about snapshots associated with this pool is output when @@ -699,9 +731,9 @@ The current on-disk version of the pool. decreased. The preferred method of updating pools is with the .Qq Nm Cm upgrade command, though this property can be used when a specific version is needed -for backwards compatibility. This property can be any number between 1 and the -current version reported by -.Qo Ic zpool upgrade -v Qc . +for backwards compatibility. +Once feature flags is enabled on a pool this property will no longer have a +value. .El .Sh SUBCOMMANDS All subcommands that modify state are logged persistently to the pool in their @@ -810,7 +842,7 @@ do not actually discard any transactions .It Xo .Nm .Cm create -.Op Fl fn +.Op Fl fnd .Op Fl o Ar property Ns = Ns Ar value .Ar ... .Op Fl O Ar file-system-property Ns = Ns Ar value @@ -859,6 +891,10 @@ The mount point must not exist or must b root dataset cannot be mounted. This can be overridden with the .Fl m *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 11:59:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E5011065673; Mon, 11 Jun 2012 11:59:30 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4837F8FC18; Mon, 11 Jun 2012 11:59:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BBxUo1083028; Mon, 11 Jun 2012 11:59:30 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BBxUw2083026; Mon, 11 Jun 2012 11:59:30 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201206111159.q5BBxUw2083026@svn.freebsd.org> From: "Andrey A. Chernov" Date: Mon, 11 Jun 2012 11:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236885 - stable/9/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 11:59:30 -0000 Author: ache Date: Mon Jun 11 11:59:29 2012 New Revision: 236885 URL: http://svn.freebsd.org/changeset/base/236885 Log: MFC 236582,236618 - remove unused serrno variable Modified: stable/9/lib/libc/stdlib/realpath.c (contents, props changed) Modified: stable/9/lib/libc/stdlib/realpath.c ============================================================================== --- stable/9/lib/libc/stdlib/realpath.c Mon Jun 11 11:35:22 2012 (r236884) +++ stable/9/lib/libc/stdlib/realpath.c Mon Jun 11 11:59:29 2012 (r236885) @@ -54,7 +54,7 @@ realpath(const char * __restrict path, c char *p, *q, *s; size_t left_len, resolved_len; unsigned symlinks; - int m, serrno, slen; + int m, slen; char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX]; if (path == NULL) { @@ -65,7 +65,6 @@ realpath(const char * __restrict path, c errno = ENOENT; return (NULL); } - serrno = errno; if (resolved == NULL) { resolved = malloc(PATH_MAX); if (resolved == NULL) From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 12:26:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A6BED1065674; Mon, 11 Jun 2012 12:26:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 917218FC1A; Mon, 11 Jun 2012 12:26:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BCQNpe084222; Mon, 11 Jun 2012 12:26:23 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BCQNNt084220; Mon, 11 Jun 2012 12:26:23 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206111226.q5BCQNNt084220@svn.freebsd.org> From: Adrian Chadd Date: Mon, 11 Jun 2012 12:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236886 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 12:26:23 -0000 Author: adrian Date: Mon Jun 11 12:26:23 2012 New Revision: 236886 URL: http://svn.freebsd.org/changeset/base/236886 Log: Fix uninitialised reference. Noticed by: John Hay Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Jun 11 11:59:29 2012 (r236885) +++ head/sys/dev/ath/if_ath_tx.c Mon Jun 11 12:26:23 2012 (r236886) @@ -2043,6 +2043,8 @@ ath_tx_addto_baw(struct ath_softc *sc, s if (bf->bf_state.bfs_isretried) return; + tap = ath_tx_get_tx_tid(an, tid->tid); + if (! bf->bf_state.bfs_dobaw) { device_printf(sc->sc_dev, "%s: dobaw=0, seqno=%d, window %d:%d\n", @@ -2052,8 +2054,6 @@ ath_tx_addto_baw(struct ath_softc *sc, s tap->txa_wnd); } - tap = ath_tx_get_tx_tid(an, tid->tid); - if (bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, "%s: re-added? tid=%d, seqno %d; window %d:%d; " From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 12:34:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5938B1065748; Mon, 11 Jun 2012 12:34:15 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A8EA8FC17; Mon, 11 Jun 2012 12:34:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BCYFGZ084580; Mon, 11 Jun 2012 12:34:15 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BCYFGj084578; Mon, 11 Jun 2012 12:34:15 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201206111234.q5BCYFGj084578@svn.freebsd.org> From: Rick Macklem Date: Mon, 11 Jun 2012 12:34:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236887 - stable/9/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 12:34:15 -0000 Author: rmacklem Date: Mon Jun 11 12:34:14 2012 New Revision: 236887 URL: http://svn.freebsd.org/changeset/base/236887 Log: MFC: r235381 Fix two cases in the new NFS server where a tsleep() is used, when the code should actually protect the tested variable with a mutex. Since the tsleep()s had a 10sec timeout, the race would have only delayed the allocation of a new clientid for a client. The sleeps will also rarely occur, since having a callback in progress when a client acquires a new clientid, is unlikely. in practice, since having a callback in progress when a fresh clientid is being acquired by a client is unlikely. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Mon Jun 11 12:26:23 2012 (r236886) +++ stable/9/sys/fs/nfsserver/nfs_nfsdstate.c Mon Jun 11 12:34:14 2012 (r236887) @@ -331,11 +331,13 @@ nfsrv_setclient(struct nfsrv_descript *n * Must wait until any outstanding callback on the old clp * completes. */ + NFSLOCKSTATE(); while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void) tsleep((caddr_t)clp, PZERO - 1, + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, "nfsd clp", 10 * hz); } + NFSUNLOCKSTATE(); nfsrv_zapclient(clp, p); *new_clpp = NULL; goto out; @@ -385,10 +387,13 @@ nfsrv_setclient(struct nfsrv_descript *n * Must wait until any outstanding callback on the old clp * completes. */ + NFSLOCKSTATE(); while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void) tsleep((caddr_t)clp, PZERO - 1, "nfsd clp", 10 * hz); + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, "nfsd clp", + 10 * hz); } + NFSUNLOCKSTATE(); nfsrv_zapclient(clp, p); *new_clpp = NULL; @@ -3816,11 +3821,9 @@ nfsrv_docallback(struct nfsclient *clp, clp->lc_cbref--; if ((clp->lc_flags & LCL_WAKEUPWANTED) && clp->lc_cbref == 0) { clp->lc_flags &= ~LCL_WAKEUPWANTED; - NFSUNLOCKSTATE(); - wakeup((caddr_t)clp); - } else { - NFSUNLOCKSTATE(); + wakeup(clp); } + NFSUNLOCKSTATE(); NFSEXITCODE(error); return (error); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 13:17:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFCAB106566C; Mon, 11 Jun 2012 13:17:45 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FEF28FC14; Mon, 11 Jun 2012 13:17:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BDHjSl086439; Mon, 11 Jun 2012 13:17:45 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BDHjdN086437; Mon, 11 Jun 2012 13:17:45 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201206111317.q5BDHjdN086437@svn.freebsd.org> From: Rick Macklem Date: Mon, 11 Jun 2012 13:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236888 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 13:17:45 -0000 Author: rmacklem Date: Mon Jun 11 13:17:45 2012 New Revision: 236888 URL: http://svn.freebsd.org/changeset/base/236888 Log: MFC: r235381 Fix two cases in the new NFS server where a tsleep() is used, when the code should actually protect the tested variable with a mutex. Since the tsleep()s had a 10sec timeout, the race would have only delayed the allocation of a new clientid for a client. The sleeps will also rarely occur, since having a callback in progress when a client acquires a new clientid, is unlikely. in practice, since having a callback in progress when a fresh clientid is being acquired by a client is unlikely. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Mon Jun 11 12:34:14 2012 (r236887) +++ stable/8/sys/fs/nfsserver/nfs_nfsdstate.c Mon Jun 11 13:17:45 2012 (r236888) @@ -331,11 +331,13 @@ nfsrv_setclient(struct nfsrv_descript *n * Must wait until any outstanding callback on the old clp * completes. */ + NFSLOCKSTATE(); while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void) tsleep((caddr_t)clp, PZERO - 1, + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, "nfsd clp", 10 * hz); } + NFSUNLOCKSTATE(); nfsrv_zapclient(clp, p); *new_clpp = NULL; goto out; @@ -385,10 +387,13 @@ nfsrv_setclient(struct nfsrv_descript *n * Must wait until any outstanding callback on the old clp * completes. */ + NFSLOCKSTATE(); while (clp->lc_cbref) { clp->lc_flags |= LCL_WAKEUPWANTED; - (void) tsleep((caddr_t)clp, PZERO - 1, "nfsd clp", 10 * hz); + (void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1, "nfsd clp", + 10 * hz); } + NFSUNLOCKSTATE(); nfsrv_zapclient(clp, p); *new_clpp = NULL; @@ -3816,11 +3821,9 @@ nfsrv_docallback(struct nfsclient *clp, clp->lc_cbref--; if ((clp->lc_flags & LCL_WAKEUPWANTED) && clp->lc_cbref == 0) { clp->lc_flags &= ~LCL_WAKEUPWANTED; - NFSUNLOCKSTATE(); - wakeup((caddr_t)clp); - } else { - NFSUNLOCKSTATE(); + wakeup(clp); } + NFSUNLOCKSTATE(); NFSEXITCODE(error); return (error); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 14:02:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8E6A01065675; Mon, 11 Jun 2012 14:02:03 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 749528FC1F; Mon, 11 Jun 2012 14:02:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BE23fg088351; Mon, 11 Jun 2012 14:02:03 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BE23SX088349; Mon, 11 Jun 2012 14:02:03 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201206111402.q5BE23SX088349@svn.freebsd.org> From: David Chisnall Date: Mon, 11 Jun 2012 14:02:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236889 - head/lib/libc/locale X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 14:02:03 -0000 Author: theraven Date: Mon Jun 11 14:02:02 2012 New Revision: 236889 URL: http://svn.freebsd.org/changeset/base/236889 Log: Fix a leak when setting the global character locale to "C" from something else. Reported by: mm Modified: head/lib/libc/locale/setrunelocale.c Modified: head/lib/libc/locale/setrunelocale.c ============================================================================== --- head/lib/libc/locale/setrunelocale.c Mon Jun 11 13:17:45 2012 (r236888) +++ head/lib/libc/locale/setrunelocale.c Mon Jun 11 14:02:02 2012 (r236889) @@ -89,6 +89,17 @@ const _RuneLocale *__getCurrentRuneLocal return XLOCALE_CTYPE(__get_locale())->runes; } +static void free_runes(_RuneLocale *rl) +{ + /* FIXME: The "EUC" check here is a hideous abstraction violation. */ + if ((rl != &_DefaultRuneLocale) && (rl)) { + if (strcmp(rl->__encoding, "EUC") == 0) { + free(rl->__variable); + } + free(rl); + } +} + static int __setrunelocale(struct xlocale_ctype *l, const char *encoding) { @@ -102,6 +113,7 @@ __setrunelocale(struct xlocale_ctype *l, * The "C" and "POSIX" locale are always here. */ if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) { + free_runes(saved.runes); (void) _none_init(l, (_RuneLocale*)&_DefaultRuneLocale); return (0); } @@ -153,13 +165,7 @@ __setrunelocale(struct xlocale_ctype *l, if (ret == 0) { /* Free the old runes if it exists. */ - /* FIXME: The "EUC" check here is a hideous abstraction violation. */ - if ((saved.runes != &_DefaultRuneLocale) && (saved.runes)) { - if (strcmp(saved.runes->__encoding, "EUC") == 0) { - free(saved.runes->__variable); - } - free(saved.runes); - } + free_runes(saved.runes); } else { /* Restore the saved version if this failed. */ memcpy(l, &saved, sizeof(struct xlocale_ctype)); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 15:40:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28B061065673; Mon, 11 Jun 2012 15:40:58 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EDA538FC08; Mon, 11 Jun 2012 15:40:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BFevQ8092572; Mon, 11 Jun 2012 15:40:57 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BFevq4092569; Mon, 11 Jun 2012 15:40:57 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201206111540.q5BFevq4092569@svn.freebsd.org> From: David Chisnall Date: Mon, 11 Jun 2012 15:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236890 - in head: gnu/lib/libsupc++ lib/libcxxrt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 15:40:58 -0000 Author: theraven Date: Mon Jun 11 15:40:57 2012 New Revision: 236890 URL: http://svn.freebsd.org/changeset/base/236890 Log: Clean up some symbol versions for libsupc++ / libcxxrt. MFC after: 1 week Reviewed by: kan Modified: head/gnu/lib/libsupc++/Version.map head/lib/libcxxrt/Version.map Modified: head/gnu/lib/libsupc++/Version.map ============================================================================== --- head/gnu/lib/libsupc++/Version.map Mon Jun 11 14:02:02 2012 (r236889) +++ head/gnu/lib/libsupc++/Version.map Mon Jun 11 15:40:57 2012 (r236890) @@ -126,26 +126,22 @@ CXXABI_1.3 { # __gnu_cxx::_verbose_terminate_handler() _ZN9__gnu_cxx27__verbose_terminate_handlerEv; - # operator new and new[], 32-bit size_t - _Znaj; - _ZnajRKSt9nothrow_t; - _Znwj; - _ZnwjRKSt9nothrow_t; - - # operator new and new[], 64-bit size_t - _Znam; - _ZnamRKSt9nothrow_t; - _Znwm; - _ZnwmRKSt9nothrow_t; + local: + *; +}; + +GLIBCXX_3.4 { + # operator new and new[] + _Znai[jm]; + _Zna[jm]RKSt9nothrow_t; + _Znw[jm]; + _Znw[jm]RKSt9nothrow_t; # operator delete and delete[] _ZdaPv; _ZdaPvRKSt9nothrow_t; _ZdlPv; _ZdlPvRKSt9nothrow_t; - - local: - *; }; CXXABI_1.3.1 { Modified: head/lib/libcxxrt/Version.map ============================================================================== --- head/lib/libcxxrt/Version.map Mon Jun 11 14:02:02 2012 (r236889) +++ head/lib/libcxxrt/Version.map Mon Jun 11 15:40:57 2012 (r236890) @@ -306,11 +306,6 @@ CXXRT_1.0 { "std::type_info::__is_pointer_p() const"; - "operator delete[](void*)"; - "operator delete(void*)"; - "operator new[](unsigned long)"; - "operator new(unsigned long)"; - "operator new(unsigned long, std::nothrow_t const&)"; }; __cxa_allocate_dependent_exception; @@ -321,3 +316,16 @@ CXXRT_1.0 { __cxa_rethrow_primary_exception; } CXXABI_1.3.1; + +GLIBCXX_3.4 { + extern "C++" { + "operator delete[](void*)"; + "operator delete(void*)"; + "operator new[](unsigned int)"; + "operator new(unsigned int)"; + "operator new(unsigned int, std::nothrow_t const&)"; + "operator new[](unsigned long)"; + "operator new(unsigned long)"; + "operator new(unsigned long, std::nothrow_t const&)"; + }; +}; From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 16:08:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 95A6C106564A; Mon, 11 Jun 2012 16:08:04 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FE948FC1B; Mon, 11 Jun 2012 16:08:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BG84Zq094969; Mon, 11 Jun 2012 16:08:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BG84Ac094963; Mon, 11 Jun 2012 16:08:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206111608.q5BG84Ac094963@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 16:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236891 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 16:08:04 -0000 Author: pjd Date: Mon Jun 11 16:08:03 2012 New Revision: 236891 URL: http://svn.freebsd.org/changeset/base/236891 Log: Style fixes and simplifications. MFC after: 1 month Modified: head/sys/kern/uipc_syscalls.c head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Mon Jun 11 15:40:57 2012 (r236890) +++ head/sys/kern/uipc_syscalls.c Mon Jun 11 16:08:03 2012 (r236891) @@ -134,8 +134,7 @@ getsock_cap(struct filedesc *fdp, int fd int error; #endif - fp = NULL; - if ((fdp == NULL) || ((fp = fget_unlocked(fdp, fd)) == NULL)) + if (fdp == NULL || (fp = fget_unlocked(fdp, fd)) == NULL) return (EBADF); #ifdef CAPABILITIES /* @@ -179,7 +178,6 @@ sys_socket(td, uap) int protocol; } */ *uap; { - struct filedesc *fdp; struct socket *so; struct file *fp; int fd, error; @@ -191,7 +189,6 @@ sys_socket(td, uap) if (error) return (error); #endif - fdp = td->td_proc->p_fd; error = falloc(td, &fp, &fd, 0); if (error) return (error); @@ -199,7 +196,7 @@ sys_socket(td, uap) error = socreate(uap->domain, &so, uap->type, uap->protocol, td->td_ucred, td); if (error) { - fdclose(fdp, fp, fd, td); + fdclose(td->td_proc->p_fd, fp, fd, td); } else { finit(fp, FREAD | FWRITE, DTYPE_SOCKET, so, &socketops); td->td_retval[0] = fd; @@ -2313,14 +2310,12 @@ sys_sctp_peeloff(td, uap) } */ *uap; { #if (defined(INET) || defined(INET6)) && defined(SCTP) - struct filedesc *fdp; struct file *nfp = NULL; int error; struct socket *head, *so; int fd; u_int fflag; - fdp = td->td_proc->p_fd; AUDIT_ARG_FD(uap->sd); error = fgetsock(td, uap->sd, CAP_PEELOFF, &head, &fflag); if (error) @@ -2378,7 +2373,7 @@ noconnection: * out from under us. */ if (error) - fdclose(fdp, nfp, fd, td); + fdclose(td->td_proc->p_fd, nfp, fd, td); /* * Release explicitly held references before returning. Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Mon Jun 11 15:40:57 2012 (r236890) +++ head/sys/kern/vfs_syscalls.c Mon Jun 11 16:08:03 2012 (r236891) @@ -4337,12 +4337,10 @@ getvnode(struct filedesc *fdp, int fd, c struct file *fp; #ifdef CAPABILITIES struct file *fp_fromcap; -#endif int error; +#endif - error = 0; - fp = NULL; - if ((fdp == NULL) || (fp = fget_unlocked(fdp, fd)) == NULL) + if (fdp == NULL || (fp = fget_unlocked(fdp, fd)) == NULL) return (EBADF); #ifdef CAPABILITIES /* From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 16:18:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CBC951065670; Mon, 11 Jun 2012 16:18:40 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B50C78FC17; Mon, 11 Jun 2012 16:18:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BGIeP8095631; Mon, 11 Jun 2012 16:18:40 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BGIeNg095624; Mon, 11 Jun 2012 16:18:40 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206111618.q5BGIeNg095624@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 11 Jun 2012 16:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236892 - in head: bin/rcp libexec/rshd usr.bin/login usr.bin/passwd usr.bin/rlogin usr.bin/rsh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 16:18:41 -0000 Author: des Date: Mon Jun 11 16:18:39 2012 New Revision: 236892 URL: http://svn.freebsd.org/changeset/base/236892 Log: None of these programs actually use auth.conf. MFC after: 1 week Modified: head/bin/rcp/rcp.1 head/libexec/rshd/rshd.8 head/usr.bin/login/login.1 head/usr.bin/passwd/passwd.1 head/usr.bin/rlogin/rlogin.1 head/usr.bin/rsh/rsh.1 Modified: head/bin/rcp/rcp.1 ============================================================================== --- head/bin/rcp/rcp.1 Mon Jun 11 16:08:03 2012 (r236891) +++ head/bin/rcp/rcp.1 Mon Jun 11 16:18:39 2012 (r236892) @@ -116,17 +116,11 @@ The .Nm utility handles third party copies, where neither source nor target files are on the current machine. -.Sh FILES -.Bl -tag -width ".Pa /etc/auth.conf" -compact -.It Pa /etc/auth.conf -configure authentication services -.El .Sh SEE ALSO .Xr cp 1 , .Xr ftp 1 , .Xr rlogin 1 , .Xr rsh 1 , -.Xr auth.conf 5 , .Xr hosts.equiv 5 .Sh HISTORY The Modified: head/libexec/rshd/rshd.8 ============================================================================== --- head/libexec/rshd/rshd.8 Mon Jun 11 16:08:03 2012 (r236891) +++ head/libexec/rshd/rshd.8 Mon Jun 11 16:18:39 2012 (r236892) @@ -237,7 +237,6 @@ and is not preceded by a flag byte. .Xr gethostbyaddr 3 , .Xr rcmd 3 , .Xr ruserok 3 , -.Xr auth.conf 5 , .Xr hosts 5 , .Xr hosts.equiv 5 , .Xr login.conf 5 , Modified: head/usr.bin/login/login.1 ============================================================================== --- head/usr.bin/login/login.1 Mon Jun 11 16:08:03 2012 (r236891) +++ head/usr.bin/login/login.1 Mon Jun 11 16:18:39 2012 (r236892) @@ -137,8 +137,6 @@ message-of-the-day system mailboxes .It Pa \&.hushlogin makes login quieter -.It Pa /etc/auth.conf -configure authentication services .It Pa /etc/pam.d/login .Xr pam 8 configuration file Modified: head/usr.bin/passwd/passwd.1 ============================================================================== --- head/usr.bin/passwd/passwd.1 Mon Jun 11 16:08:03 2012 (r236891) +++ head/usr.bin/passwd/passwd.1 Mon Jun 11 16:18:39 2012 (r236892) @@ -221,8 +221,6 @@ a Version 7 format password file temporary copy of the password file .It Pa /etc/login.conf login class capabilities database -.It Pa /etc/auth.conf -configure authentication services .El .Sh SEE ALSO .Xr chpass 1 , Modified: head/usr.bin/rlogin/rlogin.1 ============================================================================== --- head/usr.bin/rlogin/rlogin.1 Mon Jun 11 16:08:03 2012 (r236891) +++ head/usr.bin/rlogin/rlogin.1 Mon Jun 11 16:18:39 2012 (r236892) @@ -128,7 +128,6 @@ Determines the user's terminal type. .Bl -tag -width /etc/hosts -compact .It Pa /etc/hosts .It Pa /etc/hosts.equiv -.It Pa /etc/auth.conf .It Ev $HOME Ns Pa /.rhosts .El .Sh SEE ALSO @@ -138,7 +137,6 @@ Determines the user's terminal type. .Xr setsockopt 2 , .Xr ruserok 3 , .Xr tty 4 , -.Xr auth.conf 5 , .Xr hosts 5 , .Xr hosts.equiv 5 , .Xr rlogind 8 , Modified: head/usr.bin/rsh/rsh.1 ============================================================================== --- head/usr.bin/rsh/rsh.1 Mon Jun 11 16:08:03 2012 (r236891) +++ head/usr.bin/rsh/rsh.1 Mon Jun 11 16:18:39 2012 (r236892) @@ -125,14 +125,12 @@ to .Sh FILES .Bl -tag -width /etc/hosts -compact .It Pa /etc/hosts -.It Pa /etc/auth.conf .El .Sh SEE ALSO .Xr rlogin 1 , .Xr setsockopt 2 , .Xr rcmd 3 , .Xr ruserok 3 , -.Xr auth.conf 5 , .Xr hosts 5 , .Xr hosts.equiv 5 , .Xr rlogind 8 , From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 16:38:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 305E1106566B; Mon, 11 Jun 2012 16:38:15 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id 08E8F8FC1E; Mon, 11 Jun 2012 16:38:13 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 284814486; Mon, 11 Jun 2012 18:38:04 +0200 From: Hans Petter Selasky To: Adrian Chadd Date: Mon, 11 Jun 2012 18:37:33 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <201206020910.q529Aptt077716@svn.freebsd.org> In-Reply-To: X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@ =?iso-8859-1?q?d2+AyewRX=7DmAm=3BYp=0A=09=7CU=5B?=@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y> =?iso-8859-1?q?Y=7Dk1C4TfysrsUI=0A=09-=25GU9V5=5DiUZF=26nRn9mJ=27=3F=26?=>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201206111837.33138.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r236439 - head/sys/dev/usb/wlan X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 16:38:15 -0000 On Monday 11 June 2012 06:39:49 Adrian Chadd wrote: > On 2 June 2012 02:10, Hans Petter Selasky wrote: > > Author: hselasky > > Date: Sat Jun 2 09:10:51 2012 > > New Revision: 236439 > > URL: http://svn.freebsd.org/changeset/base/236439 > > > > Log: > > Add appropriate checks for ic_bsschan being set to IEEE80211_CHAN_ANYC > > in some of the USB WLAN drivers. This fixes a panic when using monitor > > mode. > > Hi, > > Was there a PR for this? http://forums.freebsd.org/showthread.php?t=32043 > > I'd just like to make sure that wireless related bugs get PRs and they > get assigned to freebsd-wireless. :-) > > Thanks! --HPS From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 17:18:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5A771065670; Mon, 11 Jun 2012 17:18:31 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5F098FC1B; Mon, 11 Jun 2012 17:18:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BHIV8B098288; Mon, 11 Jun 2012 17:18:31 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BHIVev098285; Mon, 11 Jun 2012 17:18:31 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206111718.q5BHIVev098285@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 11 Jun 2012 17:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236895 - stable/9/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 17:18:32 -0000 Author: hselasky Date: Mon Jun 11 17:18:31 2012 New Revision: 236895 URL: http://svn.freebsd.org/changeset/base/236895 Log: MFC r236407: Improve support for detaching kernel drivers on a per interface basis. Modified: stable/9/sys/dev/usb/usb_device.c stable/9/sys/dev/usb/usb_generic.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usb_device.c ============================================================================== --- stable/9/sys/dev/usb/usb_device.c Mon Jun 11 17:17:28 2012 (r236894) +++ stable/9/sys/dev/usb/usb_device.c Mon Jun 11 17:18:31 2012 (r236895) @@ -750,10 +750,13 @@ usb_config_parse(struct usb_device *udev if (do_init) { /* setup the USB interface structure */ iface->idesc = id; - /* default setting */ - iface->parent_iface_index = USB_IFACE_INDEX_ANY; /* set alternate index */ iface->alt_index = alt_index; + /* set default interface parent */ + if (iface_index == USB_IFACE_INDEX_ANY) { + iface->parent_iface_index = + USB_IFACE_INDEX_ANY; + } } DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints); @@ -1229,10 +1232,13 @@ usbd_set_parent_iface(struct usb_device { struct usb_interface *iface; + if (udev == NULL) { + /* nothing to do */ + return; + } iface = usbd_get_iface(udev, iface_index); - if (iface) { + if (iface != NULL) iface->parent_iface_index = parent_index; - } } static void Modified: stable/9/sys/dev/usb/usb_generic.c ============================================================================== --- stable/9/sys/dev/usb/usb_generic.c Mon Jun 11 17:17:28 2012 (r236894) +++ stable/9/sys/dev/usb/usb_generic.c Mon Jun 11 17:18:31 2012 (r236895) @@ -2166,7 +2166,16 @@ ugen_ioctl_post(struct usb_fifo *f, u_lo break; } + /* + * Detach the currently attached driver. + */ usb_detach_device(f->udev, n, 0); + + /* + * Set parent to self, this should keep attach away + * until the next set configuration event. + */ + usbd_set_parent_iface(f->udev, n, n); break; case USB_SET_POWER_MODE: From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 17:22:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C885310656B1; Mon, 11 Jun 2012 17:22:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98E048FC21; Mon, 11 Jun 2012 17:22:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BHMROf098527; Mon, 11 Jun 2012 17:22:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BHMRO1098524; Mon, 11 Jun 2012 17:22:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206111722.q5BHMRO1098524@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 11 Jun 2012 17:22:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236896 - stable/8/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 17:22:27 -0000 Author: hselasky Date: Mon Jun 11 17:22:27 2012 New Revision: 236896 URL: http://svn.freebsd.org/changeset/base/236896 Log: MFC r236407: Improve support for detaching kernel drivers on a per interface basis. Modified: stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_generic.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Mon Jun 11 17:18:31 2012 (r236895) +++ stable/8/sys/dev/usb/usb_device.c Mon Jun 11 17:22:27 2012 (r236896) @@ -750,10 +750,13 @@ usb_config_parse(struct usb_device *udev if (do_init) { /* setup the USB interface structure */ iface->idesc = id; - /* default setting */ - iface->parent_iface_index = USB_IFACE_INDEX_ANY; /* set alternate index */ iface->alt_index = alt_index; + /* set default interface parent */ + if (iface_index == USB_IFACE_INDEX_ANY) { + iface->parent_iface_index = + USB_IFACE_INDEX_ANY; + } } DPRINTFN(5, "found idesc nendpt=%d\n", id->bNumEndpoints); @@ -1229,10 +1232,13 @@ usbd_set_parent_iface(struct usb_device { struct usb_interface *iface; + if (udev == NULL) { + /* nothing to do */ + return; + } iface = usbd_get_iface(udev, iface_index); - if (iface) { + if (iface != NULL) iface->parent_iface_index = parent_index; - } } static void Modified: stable/8/sys/dev/usb/usb_generic.c ============================================================================== --- stable/8/sys/dev/usb/usb_generic.c Mon Jun 11 17:18:31 2012 (r236895) +++ stable/8/sys/dev/usb/usb_generic.c Mon Jun 11 17:22:27 2012 (r236896) @@ -2166,7 +2166,16 @@ ugen_ioctl_post(struct usb_fifo *f, u_lo break; } + /* + * Detach the currently attached driver. + */ usb_detach_device(f->udev, n, 0); + + /* + * Set parent to self, this should keep attach away + * until the next set configuration event. + */ + usbd_set_parent_iface(f->udev, n, n); break; case USB_SET_POWER_MODE: From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 17:23:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 81AC41065672; Mon, 11 Jun 2012 17:23:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B9048FC17; Mon, 11 Jun 2012 17:23:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BHNPsG098601; Mon, 11 Jun 2012 17:23:25 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BHNPf3098597; Mon, 11 Jun 2012 17:23:25 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206111723.q5BHNPf3098597@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 11 Jun 2012 17:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236897 - stable/9/sys/dev/usb/wlan X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 17:23:25 -0000 Author: hselasky Date: Mon Jun 11 17:23:24 2012 New Revision: 236897 URL: http://svn.freebsd.org/changeset/base/236897 Log: MFC r236439: Add appropriate checks for ic_bsschan being set to IEEE80211_CHAN_ANYC in some of the USB WLAN drivers. This fixes a panic when using monitor mode. Modified: stable/9/sys/dev/usb/wlan/if_rum.c stable/9/sys/dev/usb/wlan/if_run.c stable/9/sys/dev/usb/wlan/if_ural.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/wlan/if_rum.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_rum.c Mon Jun 11 17:22:27 2012 (r236896) +++ stable/9/sys/dev/usb/wlan/if_rum.c Mon Jun 11 17:23:24 2012 (r236897) @@ -726,6 +726,12 @@ rum_newstate(struct ieee80211vap *vap, e ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + RUM_UNLOCK(sc); + IEEE80211_LOCK(ic); + ieee80211_free_node(ni); + return (-1); + } rum_update_slot(ic->ic_ifp); rum_enable_mrr(sc); rum_set_txpreamble(sc); @@ -2135,11 +2141,12 @@ rum_prepare_beacon(struct rum_softc *sc, if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) return; + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) + return; m0 = ieee80211_beacon_alloc(vap->iv_bss, &RUM_VAP(vap)->bo); - if (m0 == NULL) { + if (m0 == NULL) return; - } tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_bsschan)]; rum_setup_tx_desc(sc, &desc, RT2573_TX_TIMESTAMP, RT2573_TX_HWSEQ, Modified: stable/9/sys/dev/usb/wlan/if_run.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_run.c Mon Jun 11 17:22:27 2012 (r236896) +++ stable/9/sys/dev/usb/wlan/if_run.c Mon Jun 11 17:23:24 2012 (r236897) @@ -1830,6 +1830,11 @@ run_newstate(struct ieee80211vap *vap, e if (vap->iv_opmode != IEEE80211_M_MONITOR) { struct ieee80211_node *ni; + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + RUN_UNLOCK(sc); + IEEE80211_LOCK(ic); + return (-1); + } run_updateslot(ic->ic_ifp); run_enable_mrr(sc); run_set_txpreamble(sc); @@ -2523,8 +2528,8 @@ run_rx_frame(struct run_softc *sc, struc struct run_rx_radiotap_header *tap = &sc->sc_rxtap; tap->wr_flags = 0; - tap->wr_chan_freq = htole16(ic->ic_bsschan->ic_freq); - tap->wr_chan_flags = htole16(ic->ic_bsschan->ic_flags); + tap->wr_chan_freq = htole16(ic->ic_curchan->ic_freq); + tap->wr_chan_flags = htole16(ic->ic_curchan->ic_flags); tap->wr_antsignal = rssi; tap->wr_antenna = ant; tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant); @@ -2778,8 +2783,8 @@ tr_setup: tap->wt_flags = 0; tap->wt_rate = rt2860_rates[data->ridx].rate; - tap->wt_chan_freq = htole16(vap->iv_bss->ni_chan->ic_freq); - tap->wt_chan_flags = htole16(vap->iv_bss->ni_chan->ic_flags); + tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); + tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); tap->wt_hwqueue = index; if (le16toh(txwi->phy) & RT2860_PHY_SHPRE) tap->wt_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; @@ -3967,6 +3972,8 @@ run_update_beacon_cb(void *arg) if (vap->iv_bss->ni_chan == IEEE80211_CHAN_ANYC) return; + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) + return; /* * No need to call ieee80211_beacon_update(), run_update_beacon() Modified: stable/9/sys/dev/usb/wlan/if_ural.c ============================================================================== --- stable/9/sys/dev/usb/wlan/if_ural.c Mon Jun 11 17:22:27 2012 (r236896) +++ stable/9/sys/dev/usb/wlan/if_ural.c Mon Jun 11 17:23:24 2012 (r236897) @@ -713,6 +713,12 @@ ural_newstate(struct ieee80211vap *vap, ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + RAL_UNLOCK(sc); + IEEE80211_LOCK(ic); + ieee80211_free_node(ni); + return (-1); + } ural_update_slot(ic->ic_ifp); ural_set_txpreamble(sc); ural_set_basicrates(sc, ic->ic_bsschan); @@ -1054,7 +1060,12 @@ ural_tx_bcn(struct ural_softc *sc, struc ifp->if_drv_flags |= IFF_DRV_OACTIVE; m_freem(m0); ieee80211_free_node(ni); - return EIO; + return (EIO); + } + if (ic->ic_bsschan == IEEE80211_CHAN_ANYC) { + m_freem(m0); + ieee80211_free_node(ni); + return (ENXIO); } data = STAILQ_FIRST(&sc->tx_free); STAILQ_REMOVE_HEAD(&sc->tx_free, next); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 17:27:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9426D106566C; Mon, 11 Jun 2012 17:27:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7583D8FC17; Mon, 11 Jun 2012 17:27:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BHRsqC098845; Mon, 11 Jun 2012 17:27:54 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BHRsSc098841; Mon, 11 Jun 2012 17:27:54 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206111727.q5BHRsSc098841@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 11 Jun 2012 17:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236898 - stable/9/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 17:27:54 -0000 Author: hselasky Date: Mon Jun 11 17:27:53 2012 New Revision: 236898 URL: http://svn.freebsd.org/changeset/base/236898 Log: MFC r233771: Add definitions and structures for USB 2.0 Link Power Management, LPM. Modified: stable/9/sys/dev/usb/usb.h stable/9/sys/dev/usb/usb_request.c stable/9/sys/dev/usb/usb_request.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/usb/usb.h ============================================================================== --- stable/9/sys/dev/usb/usb.h Mon Jun 11 17:23:24 2012 (r236897) +++ stable/9/sys/dev/usb/usb.h Mon Jun 11 17:27:53 2012 (r236898) @@ -225,7 +225,8 @@ typedef struct usb_device_request usb_de #define UR_RESET_TT 0x09 #define UR_GET_TT_STATE 0x0a #define UR_STOP_TT 0x0b -#define UR_SET_HUB_DEPTH 0x0c +#define UR_SET_AND_TEST 0x0c /* USB 2.0 only */ +#define UR_SET_HUB_DEPTH 0x0c /* USB 3.0 only */ #define USB_SS_HUB_DEPTH_MAX 5 #define UR_GET_PORT_ERR_COUNT 0x0d @@ -248,6 +249,7 @@ typedef struct usb_device_request usb_de #define UHF_PORT_LINK_STATE 5 #define UHF_PORT_POWER 8 #define UHF_PORT_LOW_SPEED 9 +#define UHF_PORT_L1 10 #define UHF_C_PORT_CONNECTION 16 #define UHF_C_PORT_ENABLE 17 #define UHF_C_PORT_SUSPEND 18 @@ -255,6 +257,7 @@ typedef struct usb_device_request usb_de #define UHF_C_PORT_RESET 20 #define UHF_PORT_TEST 21 #define UHF_PORT_INDICATOR 22 +#define UHF_C_PORT_L1 23 /* SuperSpeed HUB specific features */ #define UHF_PORT_U1_TIMEOUT 23 @@ -324,7 +327,12 @@ struct usb_devcap_usb2ext_descriptor { uByte bDescriptorType; uByte bDevCapabilityType; uDWord bmAttributes; -#define USB_V2EXT_LPM 0x02 +#define USB_V2EXT_LPM (1U << 1) +#define USB_V2EXT_BESL_SUPPORTED (1U << 2) +#define USB_V2EXT_BESL_BASELINE_VALID (1U << 3) +#define USB_V2EXT_BESL_DEEP_VALID (1U << 4) +#define USB_V2EXT_BESL_BASELINE_GET(x) (((x) >> 8) & 0xF) +#define USB_V2EXT_BESL_DEEP_GET(x) (((x) >> 12) & 0xF) } __packed; typedef struct usb_devcap_usb2ext_descriptor usb_devcap_usb2ext_descriptor_t; @@ -671,6 +679,7 @@ struct usb_port_status { #define UPS_SUSPEND 0x0004 #define UPS_OVERCURRENT_INDICATOR 0x0008 #define UPS_RESET 0x0010 +#define UPS_PORT_L1 0x0020 /* USB 2.0 only */ /* The link-state bits are valid for Super-Speed USB HUBs */ #define UPS_PORT_LINK_STATE_GET(x) (((x) >> 5) & 0xF) #define UPS_PORT_LINK_STATE_SET(x) (((x) & 0xF) << 5) @@ -701,7 +710,8 @@ struct usb_port_status { #define UPS_C_SUSPEND 0x0004 #define UPS_C_OVERCURRENT_INDICATOR 0x0008 #define UPS_C_PORT_RESET 0x0010 -#define UPS_C_BH_PORT_RESET 0x0020 +#define UPS_C_PORT_L1 0x0020 /* USB 2.0 only */ +#define UPS_C_BH_PORT_RESET 0x0020 /* USB 3.0 only */ #define UPS_C_PORT_LINK_STATE 0x0040 #define UPS_C_PORT_CONFIG_ERROR 0x0080 } __packed; Modified: stable/9/sys/dev/usb/usb_request.c ============================================================================== --- stable/9/sys/dev/usb/usb_request.c Mon Jun 11 17:23:24 2012 (r236897) +++ stable/9/sys/dev/usb/usb_request.c Mon Jun 11 17:27:53 2012 (r236898) @@ -2226,3 +2226,57 @@ usbd_req_set_port_link_state(struct usb_ USETW(req.wLength, 0); return (usbd_do_request(udev, mtx, &req, 0)); } + +/*------------------------------------------------------------------------* + * usbd_req_set_lpm_info + * + * USB 2.0 specific request for Link Power Management. + * + * Returns: + * 0: Success + * USB_ERR_PENDING_REQUESTS: NYET + * USB_ERR_TIMEOUT: TIMEOUT + * USB_ERR_STALL: STALL + * Else: Failure + *------------------------------------------------------------------------*/ +usb_error_t +usbd_req_set_lpm_info(struct usb_device *udev, struct mtx *mtx, + uint8_t port, uint8_t besl, uint8_t addr, uint8_t rwe) +{ + struct usb_device_request req; + usb_error_t err; + uint8_t buf[1]; + + req.bmRequestType = UT_WRITE_CLASS_OTHER; + req.bRequest = UR_SET_AND_TEST; + USETW(req.wValue, UHF_PORT_L1); + req.wIndex[0] = (port & 0xF) | ((besl & 0xF) << 4); + req.wIndex[1] = (addr & 0x7F) | (rwe ? 0x80 : 0x00); + USETW(req.wLength, sizeof(buf)); + + /* set default value in case of short transfer */ + buf[0] = 0x00; + + err = usbd_do_request(udev, mtx, &req, buf); + if (err) + return (err); + + switch (buf[0]) { + case 0x00: /* SUCCESS */ + break; + case 0x10: /* NYET */ + err = USB_ERR_PENDING_REQUESTS; + break; + case 0x11: /* TIMEOUT */ + err = USB_ERR_TIMEOUT; + break; + case 0x30: /* STALL */ + err = USB_ERR_STALLED; + break; + default: /* reserved */ + err = USB_ERR_IOERROR; + break; + } + return (err); +} + Modified: stable/9/sys/dev/usb/usb_request.h ============================================================================== --- stable/9/sys/dev/usb/usb_request.h Mon Jun 11 17:23:24 2012 (r236897) +++ stable/9/sys/dev/usb/usb_request.h Mon Jun 11 17:27:53 2012 (r236898) @@ -91,5 +91,7 @@ usb_error_t usbd_req_clear_tt_buffer(str uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint); usb_error_t usbd_req_set_port_link_state(struct usb_device *udev, struct mtx *mtx, uint8_t port, uint8_t link_state); +usb_error_t usbd_req_set_lpm_info(struct usb_device *udev, struct mtx *mtx, + uint8_t port, uint8_t besl, uint8_t addr, uint8_t rwe); #endif /* _USB_REQUEST_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 17:42:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F9D61065670; Mon, 11 Jun 2012 17:42:40 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AB588FC1B; Mon, 11 Jun 2012 17:42:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BHgerS000403; Mon, 11 Jun 2012 17:42:40 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BHgedW000401; Mon, 11 Jun 2012 17:42:40 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201206111742.q5BHgedW000401@svn.freebsd.org> From: Mateusz Guzik Date: Mon, 11 Jun 2012 17:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236899 - head/sys/libkern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 17:42:40 -0000 Author: mjg Date: Mon Jun 11 17:42:39 2012 New Revision: 236899 URL: http://svn.freebsd.org/changeset/base/236899 Log: Fix unloading of libiconv module. Previously it would either loop infinitely or exit with error leaking a lock. Reported by: Will DeVries Approved by: trasz (mentor) MFC after: 1 week Modified: head/sys/libkern/iconv.c Modified: head/sys/libkern/iconv.c ============================================================================== --- head/sys/libkern/iconv.c Mon Jun 11 17:27:53 2012 (r236898) +++ head/sys/libkern/iconv.c Mon Jun 11 17:42:39 2012 (r236899) @@ -84,9 +84,11 @@ iconv_mod_unload(void) struct iconv_cspair *csp; sx_xlock(&iconv_lock); - while ((csp = TAILQ_FIRST(&iconv_cslist)) != NULL) { - if (csp->cp_refcount) + TAILQ_FOREACH(csp, &iconv_cslist, cp_link) { + if (csp->cp_refcount) { + sx_xunlock(&iconv_lock); return EBUSY; + } } while ((csp = TAILQ_FIRST(&iconv_cslist)) != NULL) From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 17:54:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 359801065687; Mon, 11 Jun 2012 17:54:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FD4A8FC0A; Mon, 11 Jun 2012 17:54:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BHseKI000983; Mon, 11 Jun 2012 17:54:40 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BHseTd000979; Mon, 11 Jun 2012 17:54:40 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201206111754.q5BHseTd000979@svn.freebsd.org> From: Mateusz Guzik Date: Mon, 11 Jun 2012 17:54:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236900 - stable/9/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 17:54:41 -0000 Author: mjg Date: Mon Jun 11 17:54:40 2012 New Revision: 236900 URL: http://svn.freebsd.org/changeset/base/236900 Log: MFC r236738: Plug socket refcount leak on error in sys_sctp_peeloff. Modified: stable/9/sys/kern/uipc_syscalls.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/uipc_syscalls.c ============================================================================== --- stable/9/sys/kern/uipc_syscalls.c Mon Jun 11 17:42:39 2012 (r236899) +++ stable/9/sys/kern/uipc_syscalls.c Mon Jun 11 17:54:40 2012 (r236900) @@ -2323,11 +2323,11 @@ sys_sctp_peeloff(td, uap) goto done2; if (head->so_proto->pr_protocol != IPPROTO_SCTP) { error = EOPNOTSUPP; - goto done2; + goto done; } error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); if (error) - goto done2; + goto done; /* * At this point we know we do have a assoc to pull * we proceed to get the fd setup. This may block From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 18:02:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B911A1065672; Mon, 11 Jun 2012 18:02:30 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2D6A8FC0A; Mon, 11 Jun 2012 18:02:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BI2UYE001430; Mon, 11 Jun 2012 18:02:30 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BI2UOE001428; Mon, 11 Jun 2012 18:02:30 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201206111802.q5BI2UOE001428@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 11 Jun 2012 18:02:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236901 - stable/8/sbin/mount X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 18:02:30 -0000 Author: jh Date: Mon Jun 11 18:02:30 2012 New Revision: 236901 URL: http://svn.freebsd.org/changeset/base/236901 Log: MFC r230373: Change mount_fs() to not exit on error. The "failok" mount option requires that errors are passed to the caller. PR: 163668 Modified: stable/8/sbin/mount/mount_fs.c Directory Properties: stable/8/sbin/mount/ (props changed) Modified: stable/8/sbin/mount/mount_fs.c ============================================================================== --- stable/8/sbin/mount/mount_fs.c Mon Jun 11 17:54:40 2012 (r236900) +++ stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:02:30 2012 (r236901) @@ -86,7 +86,6 @@ mount_fs(const char *vfstype, int argc, char fstype[32]; char errmsg[255]; char *p, *val; - int ret; strlcpy(fstype, vfstype, sizeof(fstype)); memset(errmsg, 0, sizeof(errmsg)); @@ -129,10 +128,10 @@ mount_fs(const char *vfstype, int argc, build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "from", dev, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - - ret = nmount(iov, iovlen, mntflags); - if (ret < 0) - err(1, "%s %s", dev, errmsg); - return (ret); + if (nmount(iov, iovlen, mntflags) == -1) { + warn("%s: %s", dev, errmsg); + return (1); + } + return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 18:10:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FD92106567F; Mon, 11 Jun 2012 18:10:13 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BF928FC1D; Mon, 11 Jun 2012 18:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BIADk6001807; Mon, 11 Jun 2012 18:10:13 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BIAD6a001805; Mon, 11 Jun 2012 18:10:13 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201206111810.q5BIAD6a001805@svn.freebsd.org> From: Mateusz Guzik Date: Mon, 11 Jun 2012 18:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236903 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 18:10:13 -0000 Author: mjg Date: Mon Jun 11 18:10:12 2012 New Revision: 236903 URL: http://svn.freebsd.org/changeset/base/236903 Log: MFC r236738: Plug socket refcount leak on error in sys_sctp_peeloff. Modified: stable/8/sys/kern/uipc_syscalls.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/uipc_syscalls.c ============================================================================== --- stable/8/sys/kern/uipc_syscalls.c Mon Jun 11 18:09:04 2012 (r236902) +++ stable/8/sys/kern/uipc_syscalls.c Mon Jun 11 18:10:12 2012 (r236903) @@ -2302,11 +2302,11 @@ sctp_peeloff(td, uap) goto done2; if (head->so_proto->pr_protocol != IPPROTO_SCTP) { error = EOPNOTSUPP; - goto done2; + goto done; } error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); if (error) - goto done2; + goto done; /* * At this point we know we do have a assoc to pull * we proceed to get the fd setup. This may block From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 18:22:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CF1AD106566B; Mon, 11 Jun 2012 18:22:04 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA9218FC0A; Mon, 11 Jun 2012 18:22:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BIM441002333; Mon, 11 Jun 2012 18:22:04 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BIM45F002331; Mon, 11 Jun 2012 18:22:04 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201206111822.q5BIM45F002331@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 11 Jun 2012 18:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236904 - stable/8/sbin/mount X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 18:22:04 -0000 Author: jh Date: Mon Jun 11 18:22:04 2012 New Revision: 236904 URL: http://svn.freebsd.org/changeset/base/236904 Log: MFC r230377: Don't print the nmount(2) provided error message if it is empty. Modified: stable/8/sbin/mount/mount_fs.c Directory Properties: stable/8/sbin/mount/ (props changed) Modified: stable/8/sbin/mount/mount_fs.c ============================================================================== --- stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:10:12 2012 (r236903) +++ stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:22:04 2012 (r236904) @@ -130,7 +130,10 @@ mount_fs(const char *vfstype, int argc, build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if (nmount(iov, iovlen, mntflags) == -1) { - warn("%s: %s", dev, errmsg); + if (*errmsg != '\0') + warn("%s: %s", dev, errmsg); + else + warn("%s", dev); return (1); } return (0); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 18:47:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CBE3106568A; Mon, 11 Jun 2012 18:47:27 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 281538FC19; Mon, 11 Jun 2012 18:47:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BIlRl5003563; Mon, 11 Jun 2012 18:47:27 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BIlQGC003561; Mon, 11 Jun 2012 18:47:26 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206111847.q5BIlQGC003561@svn.freebsd.org> From: Mitsuru IWASAKI Date: Mon, 11 Jun 2012 18:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236906 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 18:47:27 -0000 Author: iwasaki Date: Mon Jun 11 18:47:26 2012 New Revision: 236906 URL: http://svn.freebsd.org/changeset/base/236906 Log: Another fixe for r236772. - Adjust correct cpuset (stopped_cpus/suspended_cpus) for cpu_spinwait() in generic_stop_cpus(). Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Mon Jun 11 18:26:18 2012 (r236905) +++ head/sys/kern/subr_smp.c Mon Jun 11 18:47:26 2012 (r236906) @@ -208,6 +208,7 @@ generic_stop_cpus(cpuset_t map, u_int ty #endif static volatile u_int stopping_cpu = NOCPU; int i; + volatile cpuset_t *cpus; KASSERT( #if defined(__amd64__) || defined(__i386__) @@ -232,8 +233,15 @@ generic_stop_cpus(cpuset_t map, u_int ty /* send the stop IPI to all CPUs in map */ ipi_selected(map, type); +#if defined(__amd64__) || defined(__i386__) + if (type == IPI_SUSPEND) + cpus = &suspended_cpus; + else +#endif + cpus = &stopped_cpus; + i = 0; - while (!CPU_SUBSET(&stopped_cpus, &map)) { + while (!CPU_SUBSET(cpus, &map)) { /* spin */ cpu_spinwait(); i++; From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:05:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6B0DB1065670; Mon, 11 Jun 2012 19:05:11 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54E1E8FC12; Mon, 11 Jun 2012 19:05:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJ5Bg6004322; Mon, 11 Jun 2012 19:05:11 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJ5BTs004320; Mon, 11 Jun 2012 19:05:11 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201206111905.q5BJ5BTs004320@svn.freebsd.org> From: Isabell Long Date: Mon, 11 Jun 2012 19:05:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236907 - stable/7/gnu/usr.bin/man/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:05:11 -0000 Author: issyl0 (doc committer) Date: Mon Jun 11 19:05:10 2012 New Revision: 236907 URL: http://svn.freebsd.org/changeset/base/236907 Log: Partial merge of r213507 from head: In r178993, the ability to view a man page by giving a path to the man page itself was added, but never documented. Subsequently, the GNU-licensed man(1) and its man page were replaced by BSD licensed implementations, and later on this undocumented functionality was also added to the new BSD-licensed man(1), together with documentation. This is a merge of the documentation part of that commit (r213507) into the GNU-licensed man(1) man page in stable/7, in order to document the available functionality. PR: docs/158973 Merge help: bz Approved by: gabor (mentor) Modified: stable/7/gnu/usr.bin/man/man/man.man Directory Properties: stable/7/gnu/usr.bin/man/ (props changed) Modified: stable/7/gnu/usr.bin/man/man/man.man ============================================================================== --- stable/7/gnu/usr.bin/man/man/man.man Mon Jun 11 18:47:26 2012 (r236906) +++ stable/7/gnu/usr.bin/man/man/man.man Mon Jun 11 19:05:10 2012 (r236907) @@ -14,7 +14,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 3, 2005 +.Dd October 7, 2010 .Dt MAN 1 .Os .Sh NAME @@ -233,6 +233,13 @@ printed. Do not actually display the man pages, but do print the location(s) of the files that would be formatted or displayed. .El +.Ss Displaying Specific Manual Files +The +.Nm +utility also supports displaying a specific manual page if passed a path +to the file as long as it contains a +.Sq / +character. .Sh ENVIRONMENT .Bl -tag -width ".Ev MACHINE_ARCH" .It Ev LC_ALL , LC_CTYPE , LANG From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:09:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8C8DE106564A; Mon, 11 Jun 2012 19:09:55 +0000 (UTC) (envelope-from issyl0@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 770188FC18; Mon, 11 Jun 2012 19:09:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJ9tcY004551; Mon, 11 Jun 2012 19:09:55 GMT (envelope-from issyl0@svn.freebsd.org) Received: (from issyl0@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJ9tO8004549; Mon, 11 Jun 2012 19:09:55 GMT (envelope-from issyl0@svn.freebsd.org) Message-Id: <201206111909.q5BJ9tO8004549@svn.freebsd.org> From: Isabell Long Date: Mon, 11 Jun 2012 19:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236908 - stable/8/gnu/usr.bin/man/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:09:55 -0000 Author: issyl0 (doc committer) Date: Mon Jun 11 19:09:55 2012 New Revision: 236908 URL: http://svn.freebsd.org/changeset/base/236908 Log: Partial merge of r213507 from head: In r178993, the ability to view a man page by giving a path to the man page itself was added, but never documented. Subsequently, the GNU-licensed man(1) and its man page were replaced by BSD licensed implementations, and later on this undocumented functionality was also added to the new BSD-licensed man(1), together with documentation. This is a merge of the documentation part of that commit (r213507) into the GNU-licensed man(1) man page in stable/8, in order to document the available functionality. PR: docs/158973 Merge help: bz Approved by: gabor (mentor) Modified: stable/8/gnu/usr.bin/man/man/man.man Directory Properties: stable/8/gnu/usr.bin/man/ (props changed) Modified: stable/8/gnu/usr.bin/man/man/man.man ============================================================================== --- stable/8/gnu/usr.bin/man/man/man.man Mon Jun 11 19:05:10 2012 (r236907) +++ stable/8/gnu/usr.bin/man/man/man.man Mon Jun 11 19:09:55 2012 (r236908) @@ -14,7 +14,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 3, 2005 +.Dd October 7, 2010 .Dt MAN 1 .Os .Sh NAME @@ -233,6 +233,13 @@ printed. Do not actually display the man pages, but do print the location(s) of the files that would be formatted or displayed. .El +.Ss Displaying Specific Manual Files +The +.Nm +utility also supports displaying a specific manual page if passed a path +to the file as long as it contains a +.Sq / +character. .Sh ENVIRONMENT .Bl -tag -width ".Ev MACHINE_ARCH" .It Ev LC_ALL , LC_CTYPE , LANG From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:14:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BCCA51065672 for ; Mon, 11 Jun 2012 19:14:22 +0000 (UTC) (envelope-from isabell@issyl0.co.uk) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7CF498FC0C for ; Mon, 11 Jun 2012 19:14:22 +0000 (UTC) Received: by obcni5 with SMTP id ni5so9198727obc.13 for ; Mon, 11 Jun 2012 12:14:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:x-originating-ip:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding:x-gm-message-state; bh=YhVBomREpiaHUgWcTZuz8oPsuja3NB3x4+77FRWZ6a4=; b=a6jX1y58RjCn1BHWcEll9OBMUzUw0qEAUac066+53BqyOsbGac7TZJzfaDs+yur6Di L4Hbl0FfzrNAF0dptmQz+GoW7y2Z9w2Yzg3RnbZ6XijdArLzepRVQm4TfrGK+pChsIre KpEzYLg3jP1qMaekqrqguYG9yK2HRbc8TNpPtw+w1D176K9G6nccUtG9NJrSkrWlfZtu 7J5H9E52xiCklhC5wOHI6qzDi+CSXmq2W78p8apxJ13Yczc5jNufSK+8E3jW/XxuBMTn Wy+UYMs6uiYmrGAzC+4/PD7eNZDu/5IGEFER989PtHHSWHSKWRz5BbjrYWZjtu6JvOyO vo2w== MIME-Version: 1.0 Received: by 10.182.11.69 with SMTP id o5mr17394068obb.33.1339442061898; Mon, 11 Jun 2012 12:14:21 -0700 (PDT) Sender: isabell@issyl0.co.uk Received: by 10.76.79.37 with HTTP; Mon, 11 Jun 2012 12:14:21 -0700 (PDT) X-Originating-IP: [95.147.81.192] In-Reply-To: <201206111909.q5BJ9tO8004549@svn.freebsd.org> References: <201206111909.q5BJ9tO8004549@svn.freebsd.org> Date: Mon, 11 Jun 2012 20:14:21 +0100 X-Google-Sender-Auth: hJYCOA3ay8LkDcy8VfZ3Gkarddw Message-ID: From: Isabell Long To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQmDYEAMqKVhUG1EjGRRvtzul8L4WpBNJME2EvgKEUsuqvO1nUYVCczTuqUveJQdJqmaSSkq Cc: Subject: Re: svn commit: r236908 - stable/8/gnu/usr.bin/man/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:14:22 -0000 On Mon, Jun 11, 2012 at 8:09 PM, Isabell Long wrote: > =A0PR: =A0 =A0 =A0 =A0 =A0 docs/158973 > =A0Merge help: =A0 bz > =A0Approved by: =A0gabor (mentor) Sorry, in this and my previous commit messages, I can never seem to get the indentation right! This time, I explicitly set vi's tab length to 8 characters, and it still didn't like it, despite displaying fine in my editor before I sent the commit. Must try harder... From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:21:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 522C91065672; Mon, 11 Jun 2012 19:21:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 383B48FC22; Mon, 11 Jun 2012 19:21:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJL02t005129; Mon, 11 Jun 2012 19:21:00 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJL0jP005127; Mon, 11 Jun 2012 19:21:00 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206111921.q5BJL0jP005127@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 11 Jun 2012 19:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236909 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:21:00 -0000 Author: hselasky Date: Mon Jun 11 19:20:59 2012 New Revision: 236909 URL: http://svn.freebsd.org/changeset/base/236909 Log: Use the correct clock source when computing timeouts. MFC after: 1 week Modified: head/sbin/hastd/synch.h Modified: head/sbin/hastd/synch.h ============================================================================== --- head/sbin/hastd/synch.h Mon Jun 11 19:09:55 2012 (r236908) +++ head/sbin/hastd/synch.h Mon Jun 11 19:20:59 2012 (r236909) @@ -168,7 +168,7 @@ cv_timedwait(pthread_cond_t *cv, pthread return (false); } - error = clock_gettime(CLOCK_MONOTONIC, &ts); + error = clock_gettime(CLOCK_REALTIME, &ts); PJDLOG_ASSERT(error == 0); ts.tv_sec += timeout; error = pthread_cond_timedwait(cv, lock, &ts); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:48:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BBE5B106564A; Mon, 11 Jun 2012 19:48:49 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 255AC8FC18; Mon, 11 Jun 2012 19:48:49 +0000 (UTC) Received: by yhgm50 with SMTP id m50so3263101yhg.13 for ; Mon, 11 Jun 2012 12:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=FHCJweQw7uolitt5EICciULp/8otDBSsFsgp2eguQhI=; b=Ou6w8VShoHo8LNvQNzG9HqJABqw1iUUxSgDgnoPe+Ciy80I95CAyon7/9CAaxdl9SD /rLOvLDkRTIqo+kHirFQ5Ams8lJwJaDTZrQP1QqG26PEeXKuGc0/Jce0jatqXlKuusWQ qlX1cj5xdvj/zLLMFnlcUv2ejV70wga4jJUBzmtEXUktr2sPLD7okgO1VMsimbENfeAt HoFY8s945Mv1SZ+RsTixCVyM14slIthnAptHOryNo7ihhdES7whwNyCj3gvOpQKJpI7v LUbqhLDRQuRjf6NYT6WxFeeORSScNCchVdJV3a84au2sqVSmqp5gACTIokVrzbMUVkcK TAAQ== MIME-Version: 1.0 Received: by 10.50.195.234 with SMTP id ih10mr7170783igc.0.1339444128325; Mon, 11 Jun 2012 12:48:48 -0700 (PDT) Received: by 10.64.8.170 with HTTP; Mon, 11 Jun 2012 12:48:48 -0700 (PDT) In-Reply-To: References: <201206111909.q5BJ9tO8004549@svn.freebsd.org> Date: Mon, 11 Jun 2012 23:48:48 +0400 Message-ID: From: Sergey Kandaurov To: Isabell Long Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r236908 - stable/8/gnu/usr.bin/man/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:48:49 -0000 On 11 June 2012 23:14, Isabell Long wrote: > On Mon, Jun 11, 2012 at 8:09 PM, Isabell Long wrote: >> =A0PR: =A0 =A0 =A0 =A0 =A0 docs/158973 >> =A0Merge help: =A0 bz >> =A0Approved by: =A0gabor (mentor) > > Sorry, in this and my previous commit messages, I can never seem to > get the indentation right! =A0This time, I explicitly set vi's tab > length to 8 characters, and it still didn't like it, despite > displaying fine in my editor before I sent the commit. =A0Must try > harder... No, it looks pretty good, at lest in both message source (tab symbols), and there http://svnweb.freebsd.org/base?view=3Drevision&revision=3D236908. It probably doesn't look well in various email and web clients which do not respect fixed width (until it is managed to display it so). --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:48:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 395061065783; Mon, 11 Jun 2012 19:48:55 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAD518FC16; Mon, 11 Jun 2012 19:48:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJmtB0006302; Mon, 11 Jun 2012 19:48:55 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJmtpV006300; Mon, 11 Jun 2012 19:48:55 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206111948.q5BJmtpV006300@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 19:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236910 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:48:56 -0000 Author: pjd Date: Mon Jun 11 19:48:55 2012 New Revision: 236910 URL: http://svn.freebsd.org/changeset/base/236910 Log: Now that fdgrowtable() doesn't drop the filedesc lock we don't need to check if descriptor changed from under us. Replace the check with an assert. Discussed with: kib Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Jun 11 19:20:59 2012 (r236909) +++ head/sys/kern/kern_descrip.c Mon Jun 11 19:48:55 2012 (r236910) @@ -871,19 +871,7 @@ do_dup(struct thread *td, int flags, int } } - /* - * If the old file changed out from under us then treat it as a - * bad file descriptor. Userland should do its own locking to - * avoid this case. - */ - if (fdp->fd_ofiles[old] != fp) { - /* we've allocated a descriptor which we won't use */ - if (fdp->fd_ofiles[new] == NULL) - fdunused(fdp, new); - FILEDESC_XUNLOCK(fdp); - fdrop(fp, td); - return (EBADF); - } + KASSERT(fp == fdp->fd_ofiles[old], ("old fd has been modified")); KASSERT(old != new, ("new fd is same as old")); /* From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:51:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 046A8106566B; Mon, 11 Jun 2012 19:51:28 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E41E58FC1E; Mon, 11 Jun 2012 19:51:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJpRw2006441; Mon, 11 Jun 2012 19:51:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJpRDP006439; Mon, 11 Jun 2012 19:51:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206111951.q5BJpRDP006439@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 19:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236911 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:51:28 -0000 Author: pjd Date: Mon Jun 11 19:51:27 2012 New Revision: 236911 URL: http://svn.freebsd.org/changeset/base/236911 Log: Move the code around a bit to move two parts of code duplicated from kern_close() close together. Discussed with: kib Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Jun 11 19:48:55 2012 (r236910) +++ head/sys/kern/kern_descrip.c Mon Jun 11 19:51:27 2012 (r236911) @@ -874,6 +874,17 @@ do_dup(struct thread *td, int flags, int KASSERT(fp == fdp->fd_ofiles[old], ("old fd has been modified")); KASSERT(old != new, ("new fd is same as old")); + delfp = fdp->fd_ofiles[new]; + + /* + * Duplicate the source descriptor. + */ + fdp->fd_ofiles[new] = fp; + fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE; + if (new > fdp->fd_lastfile) + fdp->fd_lastfile = new; + *retval = new; + /* * Save info on the descriptor being overwritten. We cannot close * it without introducing an ownership race for the slot, since we @@ -881,7 +892,6 @@ do_dup(struct thread *td, int flags, int * * XXX this duplicates parts of close(). */ - delfp = fdp->fd_ofiles[new]; holdleaders = 0; if (delfp != NULL && td->td_proc->p_fdtol != NULL) { /* @@ -893,15 +903,6 @@ do_dup(struct thread *td, int flags, int } /* - * Duplicate the source descriptor. - */ - fdp->fd_ofiles[new] = fp; - fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE; - if (new > fdp->fd_lastfile) - fdp->fd_lastfile = new; - *retval = new; - - /* * If we dup'd over a valid file, we now own the reference to it * and must dispose of it using closef() semantics (as if a * close() were performed on it). From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:53:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89A5F1065686; Mon, 11 Jun 2012 19:53:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7551A8FC15; Mon, 11 Jun 2012 19:53:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJrgqu006564; Mon, 11 Jun 2012 19:53:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJrgXd006562; Mon, 11 Jun 2012 19:53:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206111953.q5BJrgXd006562@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 19:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236912 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:53:42 -0000 Author: pjd Date: Mon Jun 11 19:53:41 2012 New Revision: 236912 URL: http://svn.freebsd.org/changeset/base/236912 Log: Merge two ifs into one to make the code almost identical to the code in kern_close(). Discussed with: kib Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Jun 11 19:51:27 2012 (r236911) +++ head/sys/kern/kern_descrip.c Mon Jun 11 19:53:41 2012 (r236912) @@ -892,24 +892,25 @@ do_dup(struct thread *td, int flags, int * * XXX this duplicates parts of close(). */ - holdleaders = 0; - if (delfp != NULL && td->td_proc->p_fdtol != NULL) { + if (delfp != NULL) { + if (td->td_proc->p_fdtol != NULL) { + /* + * Ask fdfree() to sleep to ensure that all relevant + * process leaders can be traversed in closef(). + */ + fdp->fd_holdleaderscount++; + holdleaders = 1; + } else { + holdleaders = 0; + } + /* - * Ask fdfree() to sleep to ensure that all relevant - * process leaders can be traversed in closef(). + * If we dup'd over a valid file, we now own the reference to it + * and must dispose of it using closef() semantics (as if a + * close() were performed on it). + * + * XXX this duplicates parts of close(). */ - fdp->fd_holdleaderscount++; - holdleaders = 1; - } - - /* - * If we dup'd over a valid file, we now own the reference to it - * and must dispose of it using closef() semantics (as if a - * close() were performed on it). - * - * XXX this duplicates parts of close(). - */ - if (delfp != NULL) { knote_fdclose(td, new); /* * When we're closing an fd with a capability, we need to From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:57:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9705A1065672; Mon, 11 Jun 2012 19:57:32 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 693968FC1E; Mon, 11 Jun 2012 19:57:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJvWmW006772; Mon, 11 Jun 2012 19:57:32 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJvWP3006770; Mon, 11 Jun 2012 19:57:32 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206111957.q5BJvWP3006770@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 19:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236913 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:57:32 -0000 Author: pjd Date: Mon Jun 11 19:57:31 2012 New Revision: 236913 URL: http://svn.freebsd.org/changeset/base/236913 Log: Introduce closefp() function that we will be able to use to eliminate code duplication in kern_close() and do_dup(). This is committed separately from the actual removal of the duplicated code, as the combined diff was very hard to read. Discussed with: kib Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Jun 11 19:53:41 2012 (r236912) +++ head/sys/kern/kern_descrip.c Mon Jun 11 19:57:31 2012 (r236913) @@ -114,6 +114,8 @@ static uma_zone_t file_zone; #define DUP_FIXED 0x1 /* Force fixed allocation */ #define DUP_FCNTL 0x2 /* fcntl()-style errors */ +static int closefp(struct filedesc *fdp, int fd, struct file *fp, + struct thread *td); static int do_dup(struct thread *td, int flags, int old, int new, register_t *retval); static int fd_first_free(struct filedesc *, int, int); @@ -1157,6 +1159,59 @@ fgetown(sigiop) } /* + * Function drops the filedesc lock on return. + */ +static int +closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td) +{ + struct file *fp_object; + int error, holdleaders; + + FILEDESC_XLOCK_ASSERT(fdp); + + if (td->td_proc->p_fdtol != NULL) { + /* + * Ask fdfree() to sleep to ensure that all relevant + * process leaders can be traversed in closef(). + */ + fdp->fd_holdleaderscount++; + holdleaders = 1; + } else { + holdleaders = 0; + } + + /* + * We now hold the fp reference that used to be owned by the + * descriptor array. We have to unlock the FILEDESC *AFTER* + * knote_fdclose to prevent a race of the fd getting opened, a knote + * added, and deleteing a knote for the new fd. + */ + knote_fdclose(td, fd); + + /* + * When we're closing an fd with a capability, we need to notify + * mqueue if the underlying object is of type mqueue. + */ + (void)cap_funwrap(fp, 0, &fp_object); + if (fp_object->f_type == DTYPE_MQUEUE) + mq_fdclose(td, fd, fp_object); + FILEDESC_XUNLOCK(fdp); + + error = closef(fp, td); + if (holdleaders) { + FILEDESC_XLOCK(fdp); + fdp->fd_holdleaderscount--; + if (fdp->fd_holdleaderscount == 0 && + fdp->fd_holdleaderswakeup != 0) { + fdp->fd_holdleaderswakeup = 0; + wakeup(&fdp->fd_holdleaderscount); + } + FILEDESC_XUNLOCK(fdp); + } + return (error); +} + +/* * Close a file descriptor. */ #ifndef _SYS_SYSPROTO_H_ From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:00:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B558B1065679; Mon, 11 Jun 2012 20:00:44 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A003D8FC19; Mon, 11 Jun 2012 20:00:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BK0i0U006950; Mon, 11 Jun 2012 20:00:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BK0iqi006948; Mon, 11 Jun 2012 20:00:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206112000.q5BK0iqi006948@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 20:00:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236914 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:00:44 -0000 Author: pjd Date: Mon Jun 11 20:00:44 2012 New Revision: 236914 URL: http://svn.freebsd.org/changeset/base/236914 Log: Remove code duplicated in kern_close() and do_dup() and use closefp() function introduced a minute ago. This code duplication was responsible for the bug fixed in r236853. Discussed with: kib Tested by: pho MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Jun 11 19:57:31 2012 (r236913) +++ head/sys/kern/kern_descrip.c Mon Jun 11 20:00:44 2012 (r236914) @@ -801,7 +801,7 @@ do_dup(struct thread *td, int flags, int struct proc *p; struct file *fp; struct file *delfp; - int error, holdleaders, maxfd; + int error, maxfd; p = td->td_proc; fdp = p->p_fd; @@ -877,7 +877,6 @@ do_dup(struct thread *td, int flags, int KASSERT(old != new, ("new fd is same as old")); delfp = fdp->fd_ofiles[new]; - /* * Duplicate the source descriptor. */ @@ -887,55 +886,13 @@ do_dup(struct thread *td, int flags, int fdp->fd_lastfile = new; *retval = new; - /* - * Save info on the descriptor being overwritten. We cannot close - * it without introducing an ownership race for the slot, since we - * need to drop the filedesc lock to call closef(). - * - * XXX this duplicates parts of close(). - */ if (delfp != NULL) { - if (td->td_proc->p_fdtol != NULL) { - /* - * Ask fdfree() to sleep to ensure that all relevant - * process leaders can be traversed in closef(). - */ - fdp->fd_holdleaderscount++; - holdleaders = 1; - } else { - holdleaders = 0; - } - - /* - * If we dup'd over a valid file, we now own the reference to it - * and must dispose of it using closef() semantics (as if a - * close() were performed on it). - * - * XXX this duplicates parts of close(). - */ - knote_fdclose(td, new); - /* - * When we're closing an fd with a capability, we need to - * notify mqueue if the underlying object is of type mqueue. - */ - (void)cap_funwrap(delfp, 0, &fp); - if (fp->f_type == DTYPE_MQUEUE) - mq_fdclose(td, new, fp); - FILEDESC_XUNLOCK(fdp); - (void) closef(delfp, td); - if (holdleaders) { - FILEDESC_XLOCK(fdp); - fdp->fd_holdleaderscount--; - if (fdp->fd_holdleaderscount == 0 && - fdp->fd_holdleaderswakeup != 0) { - fdp->fd_holdleaderswakeup = 0; - wakeup(&fdp->fd_holdleaderscount); - } - FILEDESC_XUNLOCK(fdp); - } + (void) closefp(fdp, new, delfp, td); + /* closefp() drops the FILEDESC lock for us. */ } else { FILEDESC_XUNLOCK(fdp); } + return (0); } @@ -1235,12 +1192,8 @@ kern_close(td, fd) int fd; { struct filedesc *fdp; - struct file *fp, *fp_object; - int error; - int holdleaders; + struct file *fp; - error = 0; - holdleaders = 0; fdp = td->td_proc->p_fd; AUDIT_SYSCLOSE(td, fd); @@ -1254,44 +1207,9 @@ kern_close(td, fd) fdp->fd_ofiles[fd] = NULL; fdp->fd_ofileflags[fd] = 0; fdunused(fdp, fd); - if (td->td_proc->p_fdtol != NULL) { - /* - * Ask fdfree() to sleep to ensure that all relevant - * process leaders can be traversed in closef(). - */ - fdp->fd_holdleaderscount++; - holdleaders = 1; - } - - /* - * We now hold the fp reference that used to be owned by the - * descriptor array. We have to unlock the FILEDESC *AFTER* - * knote_fdclose to prevent a race of the fd getting opened, a knote - * added, and deleteing a knote for the new fd. - */ - knote_fdclose(td, fd); - - /* - * When we're closing an fd with a capability, we need to notify - * mqueue if the underlying object is of type mqueue. - */ - (void)cap_funwrap(fp, 0, &fp_object); - if (fp_object->f_type == DTYPE_MQUEUE) - mq_fdclose(td, fd, fp_object); - FILEDESC_XUNLOCK(fdp); - error = closef(fp, td); - if (holdleaders) { - FILEDESC_XLOCK(fdp); - fdp->fd_holdleaderscount--; - if (fdp->fd_holdleaderscount == 0 && - fdp->fd_holdleaderswakeup != 0) { - fdp->fd_holdleaderswakeup = 0; - wakeup(&fdp->fd_holdleaderscount); - } - FILEDESC_XUNLOCK(fdp); - } - return (error); + /* closefp() drops the FILEDESC lock for us. */ + return (closefp(fdp, fd, fp, td)); } /* From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:01:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A50A1106566C; Mon, 11 Jun 2012 20:01:50 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90CC28FC0A; Mon, 11 Jun 2012 20:01:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BK1oLh007032; Mon, 11 Jun 2012 20:01:50 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BK1oiU007030; Mon, 11 Jun 2012 20:01:50 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206112001.q5BK1oiU007030@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 20:01:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236915 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:01:50 -0000 Author: pjd Date: Mon Jun 11 20:01:50 2012 New Revision: 236915 URL: http://svn.freebsd.org/changeset/base/236915 Log: Be consistent with white spaces. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Jun 11 20:00:44 2012 (r236914) +++ head/sys/kern/kern_descrip.c Mon Jun 11 20:01:50 2012 (r236915) @@ -116,7 +116,7 @@ static uma_zone_t file_zone; static int closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td); -static int do_dup(struct thread *td, int flags, int old, int new, +static int do_dup(struct thread *td, int flags, int old, int new, register_t *retval); static int fd_first_free(struct filedesc *, int, int); static int fd_last_used(struct filedesc *, int, int); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:07:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43D70106566C; Mon, 11 Jun 2012 20:07:03 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id E4F468FC0C; Mon, 11 Jun 2012 20:07:02 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id DC256E6B; Mon, 11 Jun 2012 22:07:01 +0200 (CEST) Date: Mon, 11 Jun 2012 22:05:07 +0200 From: Pawel Jakub Dawidek To: Hans Petter Selasky Message-ID: <20120611200507.GG1399@garage.freebsd.pl> References: <201206111921.q5BJL0jP005127@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WkfBGePaEyrk4zXB" Content-Disposition: inline In-Reply-To: <201206111921.q5BJL0jP005127@svn.freebsd.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236909 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:07:03 -0000 --WkfBGePaEyrk4zXB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 11, 2012 at 07:21:00PM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon Jun 11 19:20:59 2012 > New Revision: 236909 > URL: http://svn.freebsd.org/changeset/base/236909 >=20 > Log: > Use the correct clock source when computing timeouts. Could you please explain why? As you can see some lines above in cv_init(), we initialize condition variable with CLOCK_MONOTONIC too: error =3D pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); > MFC after: 1 week >=20 > Modified: > head/sbin/hastd/synch.h >=20 > Modified: head/sbin/hastd/synch.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sbin/hastd/synch.h Mon Jun 11 19:09:55 2012 (r236908) > +++ head/sbin/hastd/synch.h Mon Jun 11 19:20:59 2012 (r236909) > @@ -168,7 +168,7 @@ cv_timedwait(pthread_cond_t *cv, pthread > return (false); > } > =20 > - error =3D clock_gettime(CLOCK_MONOTONIC, &ts); > + error =3D clock_gettime(CLOCK_REALTIME, &ts); > PJDLOG_ASSERT(error =3D=3D 0); > ts.tv_sec +=3D timeout; > error =3D pthread_cond_timedwait(cv, lock, &ts); --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --WkfBGePaEyrk4zXB Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEUEARECAAYFAk/WT3MACgkQForvXbEpPzQiHwCVHtg/PAnt03afKbDGvSt2NpPk xwCg0TWw3YuC6HXqA2dkiz6qDIsCe6A= =S3JO -----END PGP SIGNATURE----- --WkfBGePaEyrk4zXB-- From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:12:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 868D5106566B; Mon, 11 Jun 2012 20:12:14 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 679C58FC0A; Mon, 11 Jun 2012 20:12:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BKCEUE007480; Mon, 11 Jun 2012 20:12:14 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BKCE0c007478; Mon, 11 Jun 2012 20:12:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201206112012.q5BKCE0c007478@svn.freebsd.org> From: Andrew Thompson Date: Mon, 11 Jun 2012 20:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236916 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:12:14 -0000 Author: thompsa Date: Mon Jun 11 20:12:13 2012 New Revision: 236916 URL: http://svn.freebsd.org/changeset/base/236916 Log: Fix a panic I introduced in r234487, the bridge softc pointer is set to null early in the detach so rearrange things not to explode. Reported by: David Roffiaen, Gustau Perez Querol Tested by: David Roffiaen MFC after: 3 days Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Mon Jun 11 20:01:50 2012 (r236915) +++ head/sys/net/if_bridge.c Mon Jun 11 20:12:13 2012 (r236916) @@ -334,6 +334,7 @@ static int bridge_ip6_checkbasic(struct static int bridge_fragment(struct ifnet *, struct mbuf *, struct ether_header *, int, struct llc *); static void bridge_linkstate(struct ifnet *ifp); +static void bridge_linkcheck(struct bridge_softc *sc); extern void (*bridge_linkstate_p)(struct ifnet *ifp); @@ -964,6 +965,7 @@ bridge_delete_member(struct bridge_softc EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); } + bridge_linkcheck(sc); bridge_mutecaps(sc); /* recalcuate now this interface is removed */ bridge_rtdelete(sc, ifs, IFBF_FLUSHALL); KASSERT(bif->bif_addrcnt == 0, @@ -993,7 +995,6 @@ bridge_delete_member(struct bridge_softc bridge_set_ifcap(sc, bif, bif->bif_savedcaps); } bstp_destroy(&bif->bif_stp); /* prepare to free */ - bridge_linkstate(ifs); BRIDGE_LOCK(sc); free(bif, M_DEVBUF); } @@ -1092,18 +1093,17 @@ bridge_ioctl_add(struct bridge_softc *sc /* Set interface capabilities to the intersection set of all members */ bridge_mutecaps(sc); + bridge_linkcheck(sc); - BRIDGE_UNLOCK(sc); - /* Update the linkstate for the bridge */ - bridge_linkstate(ifs); /* Place the interface into promiscuous mode */ switch (ifs->if_type) { case IFT_ETHER: case IFT_L2VLAN: + BRIDGE_UNLOCK(sc); error = ifpromisc(ifs, 1); + BRIDGE_LOCK(sc); break; } - BRIDGE_LOCK(sc); if (error) bridge_delete_member(sc, bif, 0); out: @@ -3486,8 +3486,7 @@ static void bridge_linkstate(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_bridge; - struct bridge_iflist *bif, *bif2; - int new_link, hasls; + struct bridge_iflist *bif; BRIDGE_LOCK(sc); bif = bridge_lookup_member_if(sc, ifp); @@ -3495,13 +3494,26 @@ bridge_linkstate(struct ifnet *ifp) BRIDGE_UNLOCK(sc); return; } + bridge_linkcheck(sc); + BRIDGE_UNLOCK(sc); + + bstp_linkstate(&bif->bif_stp); +} + +static void +bridge_linkcheck(struct bridge_softc *sc) +{ + struct bridge_iflist *bif; + int new_link, hasls; + + BRIDGE_LOCK_ASSERT(sc); new_link = LINK_STATE_DOWN; hasls = 0; /* Our link is considered up if at least one of our ports is active */ - LIST_FOREACH(bif2, &sc->sc_iflist, bif_next) { - if (bif2->bif_ifp->if_capabilities & IFCAP_LINKSTATE) + LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + if (bif->bif_ifp->if_capabilities & IFCAP_LINKSTATE) hasls++; - if (bif2->bif_ifp->if_link_state == LINK_STATE_UP) { + if (bif->bif_ifp->if_link_state == LINK_STATE_UP) { new_link = LINK_STATE_UP; break; } @@ -3511,8 +3523,4 @@ bridge_linkstate(struct ifnet *ifp) new_link = LINK_STATE_UP; } if_link_state_change(sc->sc_ifp, new_link); - BRIDGE_UNLOCK(sc); - - bstp_linkstate(&bif->bif_stp); } - From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:17:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 141221065673; Mon, 11 Jun 2012 20:17:21 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F37078FC08; Mon, 11 Jun 2012 20:17:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BKHKh8007724; Mon, 11 Jun 2012 20:17:20 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BKHKsW007722; Mon, 11 Jun 2012 20:17:20 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206112017.q5BKHKsW007722@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 20:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236917 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:17:21 -0000 Author: pjd Date: Mon Jun 11 20:17:20 2012 New Revision: 236917 URL: http://svn.freebsd.org/changeset/base/236917 Log: Use consistent way of checking if descriptor number is valid. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Jun 11 20:12:13 2012 (r236916) +++ head/sys/kern/kern_descrip.c Mon Jun 11 20:17:20 2012 (r236917) @@ -245,7 +245,7 @@ fd_last_used(struct filedesc *fdp, int l static int fdisused(struct filedesc *fdp, int fd) { - KASSERT(fd >= 0 && fd < fdp->fd_nfiles, + KASSERT((unsigned int)fd < fdp->fd_nfiles, ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); } @@ -2212,7 +2212,7 @@ fget_unlocked(struct filedesc *fdp, int struct file *fp; u_int count; - if (fd < 0 || fd >= fdp->fd_nfiles) + if ((unsigned int)fd >= fdp->fd_nfiles) return (NULL); /* * Fetch the descriptor locklessly. We avoid fdrop() races by @@ -2598,7 +2598,7 @@ dupfdopen(struct thread *td, struct file * closed, then reject. */ FILEDESC_XLOCK(fdp); - if (dfd < 0 || dfd >= fdp->fd_nfiles || + if ((unsigned int)dfd >= fdp->fd_nfiles || (wfp = fdp->fd_ofiles[dfd]) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:19:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 77555106564A; Mon, 11 Jun 2012 20:19:25 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62AA08FC2A; Mon, 11 Jun 2012 20:19:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BKJPXh007835; Mon, 11 Jun 2012 20:19:25 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BKJPaM007833; Mon, 11 Jun 2012 20:19:25 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206112019.q5BKJPaM007833@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 20:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236918 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:19:25 -0000 Author: pjd Date: Mon Jun 11 20:19:24 2012 New Revision: 236918 URL: http://svn.freebsd.org/changeset/base/236918 Log: Use consistent way of checking if descriptor number is valid. MFC after: 1 month Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Mon Jun 11 20:17:20 2012 (r236917) +++ head/sys/sys/filedesc.h Mon Jun 11 20:19:24 2012 (r236918) @@ -141,7 +141,7 @@ static __inline struct file * fget_locked(struct filedesc *fdp, int fd) { - return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]); + return ((unsigned int)fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]); } #endif /* _KERNEL */ From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:22:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EFB87106566C; Mon, 11 Jun 2012 20:22:26 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id D224F8FC15; Mon, 11 Jun 2012 20:22:25 +0000 (UTC) X-T2-Spam-Status: No, hits=-1.0 required=5.0 tests=ALL_TRUSTED Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 284870614; Mon, 11 Jun 2012 22:22:24 +0200 From: Hans Petter Selasky To: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 22:21:51 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <201206111921.q5BJL0jP005127@svn.freebsd.org> <20120611200507.GG1399@garage.freebsd.pl> In-Reply-To: <20120611200507.GG1399@garage.freebsd.pl> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@ =?iso-8859-15?q?d2+AyewRX=7DmAm=3BYp=0A=09=7CU=5B?=@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y> =?iso-8859-15?q?Y=7Dk1C4TfysrsUI=0A=09-=25GU9V5=5DiUZF=26nRn9mJ=27=3F=26?=>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201206112221.51793.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r236909 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:22:27 -0000 On Monday 11 June 2012 22:05:07 Pawel Jakub Dawidek wrote: > On Mon, Jun 11, 2012 at 07:21:00PM +0000, Hans Petter Selasky wrote: > > Author: hselasky > > Date: Mon Jun 11 19:20:59 2012 > > New Revision: 236909 > > URL: http://svn.freebsd.org/changeset/base/236909 > > > > Log: > > Use the correct clock source when computing timeouts. > > Could you please explain why? As you can see some lines above in > cv_init(), we initialize condition variable with CLOCK_MONOTONIC too: > Sorry, this was a mistake clearly. I will revert ASAP. Pointyhat to me. My test program didn't take the setattr into account. However, while at it, what is the default clock used by pthread_cond_timedwait(). In libusb we don't set any clock, and can we depend on that CLOCK_REALTIME is the default clock used? Else I should probably make a patch there. man pthread_cond_timedwait() is silent! --HPS From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:27:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 87BB11065675; Mon, 11 Jun 2012 20:27:53 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72CA18FC12; Mon, 11 Jun 2012 20:27:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BKRrpw008211; Mon, 11 Jun 2012 20:27:53 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BKRrP6008209; Mon, 11 Jun 2012 20:27:53 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206112027.q5BKRrP6008209@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 11 Jun 2012 20:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236919 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:27:53 -0000 Author: hselasky Date: Mon Jun 11 20:27:52 2012 New Revision: 236919 URL: http://svn.freebsd.org/changeset/base/236919 Log: Revert: r236909 Pointyhat: me Modified: head/sbin/hastd/synch.h Modified: head/sbin/hastd/synch.h ============================================================================== --- head/sbin/hastd/synch.h Mon Jun 11 20:19:24 2012 (r236918) +++ head/sbin/hastd/synch.h Mon Jun 11 20:27:52 2012 (r236919) @@ -168,7 +168,7 @@ cv_timedwait(pthread_cond_t *cv, pthread return (false); } - error = clock_gettime(CLOCK_REALTIME, &ts); + error = clock_gettime(CLOCK_MONOTONIC, &ts); PJDLOG_ASSERT(error == 0); ts.tv_sec += timeout; error = pthread_cond_timedwait(cv, lock, &ts); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 20:58:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 74E22106564A; Mon, 11 Jun 2012 20:58:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F3868FC12; Mon, 11 Jun 2012 20:58:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BKwO8G009583; Mon, 11 Jun 2012 20:58:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BKwO5R009580; Mon, 11 Jun 2012 20:58:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112058.q5BKwO5R009580@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 20:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236920 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 20:58:24 -0000 Author: kib Date: Mon Jun 11 20:58:23 2012 New Revision: 236920 URL: http://svn.freebsd.org/changeset/base/236920 Log: MFC r235356: Make the vm_page_array_size long. Remove redundand zero initialization for vm_page_array_size and nearby variables. MFC r235359: Commit the change forgotten in r235356. Modified: stable/9/sys/vm/vm_page.c stable/9/sys/vm/vm_page.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_page.c ============================================================================== --- stable/9/sys/vm/vm_page.c Mon Jun 11 20:27:52 2012 (r236919) +++ stable/9/sys/vm/vm_page.c Mon Jun 11 20:58:23 2012 (r236920) @@ -121,10 +121,10 @@ struct vpglocks vm_page_queue_free_lock; struct vpglocks pa_lock[PA_LOCK_COUNT]; -vm_page_t vm_page_array = 0; -int vm_page_array_size = 0; -long first_page = 0; -int vm_page_zero_count = 0; +vm_page_t vm_page_array; +long vm_page_array_size; +long first_page; +int vm_page_zero_count; static int boot_pages = UMA_BOOT_PAGES; TUNABLE_INT("vm.boot_pages", &boot_pages); Modified: stable/9/sys/vm/vm_page.h ============================================================================== --- stable/9/sys/vm/vm_page.h Mon Jun 11 20:27:52 2012 (r236919) +++ stable/9/sys/vm/vm_page.h Mon Jun 11 20:58:23 2012 (r236920) @@ -312,7 +312,7 @@ struct vnode; extern int vm_page_zero_count; extern vm_page_t vm_page_array; /* First resident page in table */ -extern int vm_page_array_size; /* number of vm_page_t's */ +extern long vm_page_array_size; /* number of vm_page_t's */ extern long first_page; /* first physical page number */ #define VM_PAGE_IS_FREE(m) (((m)->flags & PG_FREE) != 0) From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:06:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14C9A1065670; Mon, 11 Jun 2012 21:06:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F38168FC1F; Mon, 11 Jun 2012 21:06:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BL6An5009989; Mon, 11 Jun 2012 21:06:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BL6ApP009987; Mon, 11 Jun 2012 21:06:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112106.q5BL6ApP009987@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236921 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:06:11 -0000 Author: kib Date: Mon Jun 11 21:06:10 2012 New Revision: 236921 URL: http://svn.freebsd.org/changeset/base/236921 Log: MFC r235362: Assert that fictitious or unmanaged pages do not appear on active/inactive lists. Modified: stable/9/sys/vm/vm_pageout.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_pageout.c ============================================================================== --- stable/9/sys/vm/vm_pageout.c Mon Jun 11 20:58:23 2012 (r236920) +++ stable/9/sys/vm/vm_pageout.c Mon Jun 11 21:06:10 2012 (r236921) @@ -805,6 +805,11 @@ rescan0: if (m->flags & PG_MARKER) continue; + KASSERT((m->flags & PG_FICTITIOUS) == 0, + ("Fictitious page %p cannot be in inactive queue", m)); + KASSERT((m->oflags & VPO_UNMANAGED) == 0, + ("Unmanaged page %p cannot be in inactive queue", m)); + /* * Lock the page. */ @@ -1143,6 +1148,10 @@ unlock_and_continue: m = next; continue; } + KASSERT((m->flags & PG_FICTITIOUS) == 0, + ("Fictitious page %p cannot be in active queue", m)); + KASSERT((m->oflags & VPO_UNMANAGED) == 0, + ("Unmanaged page %p cannot be in active queue", m)); if (!vm_pageout_page_lock(m, &next)) { vm_page_unlock(m); m = next; From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:08:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 750DD1065670; Mon, 11 Jun 2012 21:08:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FE318FC08; Mon, 11 Jun 2012 21:08:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BL8rqT010147; Mon, 11 Jun 2012 21:08:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BL8ruU010145; Mon, 11 Jun 2012 21:08:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112108.q5BL8ruU010145@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:08:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236922 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:08:53 -0000 Author: kib Date: Mon Jun 11 21:08:52 2012 New Revision: 236922 URL: http://svn.freebsd.org/changeset/base/236922 Log: MFC r235365: Assert that the page passed to vm_page_putfake() is unmanaged. Modified: stable/9/sys/vm/vm_page.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_page.c ============================================================================== --- stable/9/sys/vm/vm_page.c Mon Jun 11 21:06:10 2012 (r236921) +++ stable/9/sys/vm/vm_page.c Mon Jun 11 21:08:52 2012 (r236922) @@ -665,6 +665,7 @@ void vm_page_putfake(vm_page_t m) { + KASSERT((m->oflags & VPO_UNMANAGED) != 0, ("managed %p", m)); KASSERT((m->flags & PG_FICTITIOUS) != 0, ("vm_page_putfake: bad page %p", m)); uma_zfree(fakepg_zone, m); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:12:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07F6A1065670; Mon, 11 Jun 2012 21:12:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB2428FC22; Mon, 11 Jun 2012 21:12:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLCqlk010379; Mon, 11 Jun 2012 21:12:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLCqWu010376; Mon, 11 Jun 2012 21:12:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112112.q5BLCqWu010376@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236923 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:12:53 -0000 Author: kib Date: Mon Jun 11 21:12:52 2012 New Revision: 236923 URL: http://svn.freebsd.org/changeset/base/236923 Log: MFC r235366: Split the code from vm_page_getfake() to initialize the fake page struct vm_page into new interface vm_page_initfake(). Handle the case of fake page re-initialization with changed memattr. Modified: stable/9/sys/vm/vm_page.c stable/9/sys/vm/vm_page.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_page.c ============================================================================== --- stable/9/sys/vm/vm_page.c Mon Jun 11 21:08:52 2012 (r236922) +++ stable/9/sys/vm/vm_page.c Mon Jun 11 21:12:52 2012 (r236923) @@ -645,6 +645,22 @@ vm_page_getfake(vm_paddr_t paddr, vm_mem vm_page_t m; m = uma_zalloc(fakepg_zone, M_WAITOK | M_ZERO); + vm_page_initfake(m, paddr, memattr); + return (m); +} + +void +vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr) +{ + + if ((m->flags & PG_FICTITIOUS) != 0) { + /* + * The page's memattr might have changed since the + * previous initialization. Update the pmap to the + * new memattr. + */ + goto memattr; + } m->phys_addr = paddr; m->queue = PQ_NONE; /* Fictitious pages don't use "segind". */ @@ -652,8 +668,8 @@ vm_page_getfake(vm_paddr_t paddr, vm_mem /* Fictitious pages don't use "order" or "pool". */ m->oflags = VPO_BUSY | VPO_UNMANAGED; m->wire_count = 1; +memattr: pmap_page_set_memattr(m, memattr); - return (m); } /* Modified: stable/9/sys/vm/vm_page.h ============================================================================== --- stable/9/sys/vm/vm_page.h Mon Jun 11 21:08:52 2012 (r236922) +++ stable/9/sys/vm/vm_page.h Mon Jun 11 21:12:52 2012 (r236923) @@ -390,6 +390,7 @@ void vm_page_dontneed(vm_page_t); void vm_page_deactivate (vm_page_t); vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); +void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); void vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); boolean_t vm_page_is_cached(vm_object_t object, vm_pindex_t pindex); vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:20:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C1472106564A; Mon, 11 Jun 2012 21:20:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A58018FC17; Mon, 11 Jun 2012 21:20:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLK0vG010736; Mon, 11 Jun 2012 21:20:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLK0SD010731; Mon, 11 Jun 2012 21:20:00 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112120.q5BLK0SD010731@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:20:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236924 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:20:01 -0000 Author: kib Date: Mon Jun 11 21:19:59 2012 New Revision: 236924 URL: http://svn.freebsd.org/changeset/base/236924 Log: MFC r235372: Add a facility to register a range of physical addresses to be used for allocation of fictitious pages, for which PHYS_TO_VM_PAGE() returns proper fictitious vm_page_t. The range should be de-registered after consumer stopped using it. De-inline the PHYS_TO_VM_PAGE() since it now carries code to iterate over registered ranges. MFC r235776 (by andrew): In PHYS_TO_VM_PAGE() when VM_PHYSSEG_DENSE is set the check if we are past the end of vm_page_array was incorrect causing it to return NULL. This value is then used in vm_phys_add_page causing a data abort. Modified: stable/9/sys/vm/vm_page.c stable/9/sys/vm/vm_page.h stable/9/sys/vm/vm_phys.c stable/9/sys/vm/vm_phys.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_page.c ============================================================================== --- stable/9/sys/vm/vm_page.c Mon Jun 11 21:12:52 2012 (r236923) +++ stable/9/sys/vm/vm_page.c Mon Jun 11 21:19:59 2012 (r236924) @@ -632,6 +632,30 @@ vm_page_unhold_pages(vm_page_t *ma, int mtx_unlock(mtx); } +vm_page_t +PHYS_TO_VM_PAGE(vm_paddr_t pa) +{ + vm_page_t m; + +#ifdef VM_PHYSSEG_SPARSE + m = vm_phys_paddr_to_vm_page(pa); + if (m == NULL) + m = vm_phys_fictitious_to_vm_page(pa); + return (m); +#elif defined(VM_PHYSSEG_DENSE) + long pi; + + pi = atop(pa); + if (pi >= first_page && (pi - first_page) < vm_page_array_size) { + m = &vm_page_array[pi - first_page]; + return (m); + } + return (vm_phys_fictitious_to_vm_page(pa)); +#else +#error "Either VM_PHYSSEG_DENSE or VM_PHYSSEG_SPARSE must be defined." +#endif +} + /* * vm_page_getfake: * Modified: stable/9/sys/vm/vm_page.h ============================================================================== --- stable/9/sys/vm/vm_page.h Mon Jun 11 21:12:52 2012 (r236923) +++ stable/9/sys/vm/vm_page.h Mon Jun 11 21:19:59 2012 (r236924) @@ -321,19 +321,7 @@ extern long first_page; /* first physi vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa); -static __inline vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); - -static __inline vm_page_t -PHYS_TO_VM_PAGE(vm_paddr_t pa) -{ -#ifdef VM_PHYSSEG_SPARSE - return (vm_phys_paddr_to_vm_page(pa)); -#elif defined(VM_PHYSSEG_DENSE) - return (&vm_page_array[atop(pa) - first_page]); -#else -#error "Either VM_PHYSSEG_DENSE or VM_PHYSSEG_SPARSE must be defined." -#endif -} +vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); extern struct vpglocks vm_page_queue_lock; Modified: stable/9/sys/vm/vm_phys.c ============================================================================== --- stable/9/sys/vm/vm_phys.c Mon Jun 11 21:12:52 2012 (r236923) +++ stable/9/sys/vm/vm_phys.c Mon Jun 11 21:19:59 2012 (r236924) @@ -83,6 +83,15 @@ static struct vm_phys_seg vm_phys_segs[V static int vm_phys_nsegs; +#define VM_PHYS_FICTITIOUS_NSEGS 8 +static struct vm_phys_fictitious_seg { + vm_paddr_t start; + vm_paddr_t end; + vm_page_t first_page; +} vm_phys_fictitious_segs[VM_PHYS_FICTITIOUS_NSEGS]; +static struct mtx vm_phys_fictitious_reg_mtx; +MALLOC_DEFINE(M_FICT_PAGES, "", ""); + static struct vm_freelist vm_phys_free_queues[VM_RAW_NFREELIST][VM_NFREEPOOL][VM_NFREEORDER]; static struct vm_freelist @@ -362,6 +371,8 @@ vm_phys_init(void) for (flind = 0; flind < vm_nfreelists; flind++) vm_phys_lookup_lists[0][flind] = &vm_phys_free_queues[flind]; #endif + + mtx_init(&vm_phys_fictitious_reg_mtx, "vmfctr", NULL, MTX_DEF); } /* @@ -526,6 +537,112 @@ vm_phys_paddr_to_vm_page(vm_paddr_t pa) return (NULL); } +vm_page_t +vm_phys_fictitious_to_vm_page(vm_paddr_t pa) +{ + struct vm_phys_fictitious_seg *seg; + vm_page_t m; + int segind; + + m = NULL; + for (segind = 0; segind < VM_PHYS_FICTITIOUS_NSEGS; segind++) { + seg = &vm_phys_fictitious_segs[segind]; + if (pa >= seg->start && pa < seg->end) { + m = &seg->first_page[atop(pa - seg->start)]; + KASSERT((m->flags & PG_FICTITIOUS) != 0, + ("%p not fictitious", m)); + break; + } + } + return (m); +} + +int +vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end, + vm_memattr_t memattr) +{ + struct vm_phys_fictitious_seg *seg; + vm_page_t fp; + long i, page_count; + int segind; +#ifdef VM_PHYSSEG_DENSE + long pi; + boolean_t malloced; +#endif + + page_count = (end - start) / PAGE_SIZE; + +#ifdef VM_PHYSSEG_DENSE + pi = atop(start); + if (pi >= first_page && atop(end) < vm_page_array_size) { + fp = &vm_page_array[pi - first_page]; + malloced = FALSE; + } else +#endif + { + fp = malloc(page_count * sizeof(struct vm_page), M_FICT_PAGES, + M_WAITOK | M_ZERO); +#ifdef VM_PHYSSEG_DENSE + malloced = TRUE; +#endif + } + for (i = 0; i < page_count; i++) { + vm_page_initfake(&fp[i], start + PAGE_SIZE * i, memattr); + pmap_page_init(&fp[i]); + fp[i].oflags &= ~(VPO_BUSY | VPO_UNMANAGED); + } + mtx_lock(&vm_phys_fictitious_reg_mtx); + for (segind = 0; segind < VM_PHYS_FICTITIOUS_NSEGS; segind++) { + seg = &vm_phys_fictitious_segs[segind]; + if (seg->start == 0 && seg->end == 0) { + seg->start = start; + seg->end = end; + seg->first_page = fp; + mtx_unlock(&vm_phys_fictitious_reg_mtx); + return (0); + } + } + mtx_unlock(&vm_phys_fictitious_reg_mtx); +#ifdef VM_PHYSSEG_DENSE + if (malloced) +#endif + free(fp, M_FICT_PAGES); + return (EBUSY); +} + +void +vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end) +{ + struct vm_phys_fictitious_seg *seg; + vm_page_t fp; + int segind; +#ifdef VM_PHYSSEG_DENSE + long pi; +#endif + +#ifdef VM_PHYSSEG_DENSE + pi = atop(start); +#endif + + mtx_lock(&vm_phys_fictitious_reg_mtx); + for (segind = 0; segind < VM_PHYS_FICTITIOUS_NSEGS; segind++) { + seg = &vm_phys_fictitious_segs[segind]; + if (seg->start == start && seg->end == end) { + seg->start = seg->end = 0; + fp = seg->first_page; + seg->first_page = NULL; + mtx_unlock(&vm_phys_fictitious_reg_mtx); +#ifdef VM_PHYSSEG_DENSE + if (pi < first_page || atop(end) >= vm_page_array_size) +#endif + free(fp, M_FICT_PAGES); + return; + } + } + mtx_unlock(&vm_phys_fictitious_reg_mtx); + KASSERT(0, ("Unregistering not registered fictitious range")); +} + /* * Find the segment containing the given physical address. */ Modified: stable/9/sys/vm/vm_phys.h ============================================================================== --- stable/9/sys/vm/vm_phys.h Mon Jun 11 21:12:52 2012 (r236923) +++ stable/9/sys/vm/vm_phys.h Mon Jun 11 21:19:59 2012 (r236924) @@ -56,6 +56,10 @@ vm_page_t vm_phys_alloc_contig(unsigned vm_page_t vm_phys_alloc_freelist_pages(int flind, int pool, int order); vm_page_t vm_phys_alloc_pages(int pool, int order); vm_paddr_t vm_phys_bootstrap_alloc(vm_size_t size, unsigned long alignment); +int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end, + vm_memattr_t memattr); +void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end); +vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa); void vm_phys_free_pages(vm_page_t m, int order); void vm_phys_init(void); void vm_phys_set_pool(int pool, vm_page_t m, int order); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:25:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 63736106567D; Mon, 11 Jun 2012 21:25:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45A848FC0C; Mon, 11 Jun 2012 21:25:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLPLRt011056; Mon, 11 Jun 2012 21:25:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLPLxS011051; Mon, 11 Jun 2012 21:25:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112125.q5BLPLxS011051@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:25:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236925 - stable/9/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:25:21 -0000 Author: kib Date: Mon Jun 11 21:25:20 2012 New Revision: 236925 URL: http://svn.freebsd.org/changeset/base/236925 Log: MFC r235375: Add new pager type, OBJT_MGTDEVICE. It provides the device pager which carries fictitous managed pges. In particular, the consumers of the new object type can remove all mappings of the device page with pmap_remove_all(). The range of physical addresses used for fake page allocation shall be registered with vm_phys_fictitious_reg_range() interface to allow the PHYS_TO_VM_PAGE() to work in pmap. Modified: stable/9/sys/vm/device_pager.c stable/9/sys/vm/vm.h stable/9/sys/vm/vm_pager.c stable/9/sys/vm/vm_pager.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/device_pager.c ============================================================================== --- stable/9/sys/vm/device_pager.c Mon Jun 11 21:19:59 2012 (r236924) +++ stable/9/sys/vm/device_pager.c Mon Jun 11 21:25:20 2012 (r236925) @@ -61,6 +61,7 @@ static void dev_pager_putpages(vm_object boolean_t, int *); static boolean_t dev_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); +static void dev_pager_free_page(vm_object_t object, vm_page_t m); /* list of device pager objects */ static struct pagerlst dev_pager_object_list; @@ -76,6 +77,14 @@ struct pagerops devicepagerops = { .pgo_haspage = dev_pager_haspage, }; +struct pagerops mgtdevicepagerops = { + .pgo_alloc = dev_pager_alloc, + .pgo_dealloc = dev_pager_dealloc, + .pgo_getpages = dev_pager_getpages, + .pgo_putpages = dev_pager_putpages, + .pgo_haspage = dev_pager_haspage, +}; + static int old_dev_pager_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred, u_short *color); static void old_dev_pager_dtor(void *handle); @@ -114,7 +123,7 @@ cdev_pager_allocate(void *handle, enum o vm_pindex_t pindex; u_short color; - if (tp != OBJT_DEVICE) + if (tp != OBJT_DEVICE && tp != OBJT_MGTDEVICE) return (NULL); /* @@ -195,6 +204,24 @@ cdev_pager_free_page(vm_object_t object, { VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + if (object->type == OBJT_MGTDEVICE) { + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("unmanaged %p", m)); + pmap_remove_all(m); + vm_page_lock(m); + vm_page_remove(m); + vm_page_unlock(m); + } else if (object->type == OBJT_DEVICE) + dev_pager_free_page(object, m); +} + +static void +dev_pager_free_page(vm_object_t object, vm_page_t m) +{ + + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + KASSERT((object->type == OBJT_DEVICE && + (m->oflags & VPO_UNMANAGED) != 0), + ("Managed device or page obj %p m %p", object, m)); TAILQ_REMOVE(&object->un_pager.devp.devp_pglist, m, pageq); vm_page_putfake(m); } @@ -212,11 +239,15 @@ dev_pager_dealloc(object) TAILQ_REMOVE(&dev_pager_object_list, object, pager_object_list); mtx_unlock(&dev_pager_mtx); VM_OBJECT_LOCK(object); - /* - * Free up our fake pages. - */ - while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) != NULL) - cdev_pager_free_page(object, m); + + if (object->type == OBJT_DEVICE) { + /* + * Free up our fake pages. + */ + while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) + != NULL) + dev_pager_free_page(object, m); + } } static int @@ -239,8 +270,15 @@ dev_pager_getpages(vm_object_t object, v } if (error == VM_PAGER_OK) { - TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, - ma[reqpage], pageq); + KASSERT((object->type == OBJT_DEVICE && + (ma[reqpage]->oflags & VPO_UNMANAGED) != 0) || + (object->type == OBJT_MGTDEVICE && + (ma[reqpage]->oflags & VPO_UNMANAGED) == 0), + ("Wrong page type %p %p", ma[reqpage], object)); + if (object->type == OBJT_DEVICE) { + TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, + ma[reqpage], pageq); + } } return (error); Modified: stable/9/sys/vm/vm.h ============================================================================== --- stable/9/sys/vm/vm.h Mon Jun 11 21:19:59 2012 (r236924) +++ stable/9/sys/vm/vm.h Mon Jun 11 21:25:20 2012 (r236925) @@ -83,7 +83,7 @@ typedef u_char vm_prot_t; /* protection #define VM_PROT_DEFAULT VM_PROT_ALL enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_PHYS, - OBJT_DEAD, OBJT_SG }; + OBJT_DEAD, OBJT_SG, OBJT_MGTDEVICE }; typedef u_char objtype_t; union vm_map_object; Modified: stable/9/sys/vm/vm_pager.c ============================================================================== --- stable/9/sys/vm/vm_pager.c Mon Jun 11 21:19:59 2012 (r236924) +++ stable/9/sys/vm/vm_pager.c Mon Jun 11 21:25:20 2012 (r236925) @@ -159,7 +159,8 @@ struct pagerops *pagertab[] = { &devicepagerops, /* OBJT_DEVICE */ &physpagerops, /* OBJT_PHYS */ &deadpagerops, /* OBJT_DEAD */ - &sgpagerops /* OBJT_SG */ + &sgpagerops, /* OBJT_SG */ + &mgtdevicepagerops, /* OBJT_MGTDEVICE */ }; static const int npagers = sizeof(pagertab) / sizeof(pagertab[0]); Modified: stable/9/sys/vm/vm_pager.h ============================================================================== --- stable/9/sys/vm/vm_pager.h Mon Jun 11 21:19:59 2012 (r236924) +++ stable/9/sys/vm/vm_pager.h Mon Jun 11 21:25:20 2012 (r236925) @@ -71,6 +71,7 @@ extern struct pagerops vnodepagerops; extern struct pagerops devicepagerops; extern struct pagerops physpagerops; extern struct pagerops sgpagerops; +extern struct pagerops mgtdevicepagerops; /* * get/put return values From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:33:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33373106564A; Mon, 11 Jun 2012 21:33:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D0578FC0A; Mon, 11 Jun 2012 21:33:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLX3nS011432; Mon, 11 Jun 2012 21:33:03 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLX29S011428; Mon, 11 Jun 2012 21:33:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112133.q5BLX29S011428@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236926 - in stable/9/sys: dev/agp modules/agp sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:33:03 -0000 Author: kib Date: Mon Jun 11 21:33:02 2012 New Revision: 236926 URL: http://svn.freebsd.org/changeset/base/236926 Log: MFC r235782: A rewrite of the i810 bits of the agp(4) driver. New driver supports operations required by GEMified i915.ko. It also attaches to SandyBridge and IvyBridge CPU northbridges now. Added: stable/9/sys/dev/agp/agp_i810.h - copied unchanged from r235782, head/sys/dev/agp/agp_i810.h Modified: stable/9/sys/dev/agp/agp.c stable/9/sys/dev/agp/agp_i810.c stable/9/sys/dev/agp/agp_if.m stable/9/sys/dev/agp/agppriv.h stable/9/sys/dev/agp/agpreg.h stable/9/sys/dev/agp/agpvar.h stable/9/sys/modules/agp/Makefile stable/9/sys/sys/agpio.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/dev/agp/agp.c ============================================================================== --- stable/9/sys/dev/agp/agp.c Mon Jun 11 21:25:20 2012 (r236925) +++ stable/9/sys/dev/agp/agp.c Mon Jun 11 21:33:02 2012 (r236926) @@ -239,7 +239,8 @@ agp_generic_attach(device_t dev) if (memsize <= agp_max[i][0]) break; } - if (i == agp_max_size) i = agp_max_size - 1; + if (i == agp_max_size) + i = agp_max_size - 1; sc->as_maxmem = agp_max[i][1] << 20U; /* @@ -803,6 +804,13 @@ agp_unbind_user(device_t dev, agp_unbind } static int +agp_chipset_flush(device_t dev) +{ + + return (AGP_CHIPSET_FLUSH(dev)); +} + +static int agp_open(struct cdev *kdev, int oflags, int devtype, struct thread *td) { device_t dev = kdev->si_drv1; @@ -869,6 +877,8 @@ agp_ioctl(struct cdev *kdev, u_long cmd, case AGPIOC_UNBIND: return agp_unbind_user(dev, (agp_unbind *)data); + case AGPIOC_CHIPSET_FLUSH: + return agp_chipset_flush(dev); } return EINVAL; Modified: stable/9/sys/dev/agp/agp_i810.c ============================================================================== --- stable/9/sys/dev/agp/agp_i810.c Mon Jun 11 21:25:20 2012 (r236925) +++ stable/9/sys/dev/agp/agp_i810.c Mon Jun 11 21:33:02 2012 (r236926) @@ -1,8 +1,12 @@ /*- * Copyright (c) 2000 Doug Rabson * Copyright (c) 2000 Ruslan Ermilov + * Copyright (c) 2011 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -28,6 +32,9 @@ /* * Fixes for 830/845G support: David Dawes * 852GM/855GM/865G support added by David Dawes + * + * This is generic Intel GTT handling code, morphed from the AGP + * bridge code. */ #include @@ -35,10 +42,17 @@ __FBSDID("$FreeBSD$"); #include "opt_bus.h" +#if 0 +#define KTR_AGP_I810 KTR_DEV +#else +#define KTR_AGP_I810 0 +#endif + #include #include #include #include +#include #include #include #include @@ -47,8 +61,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include +#include #include #include @@ -63,6 +79,88 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_AGP); +struct agp_i810_match; + +static int agp_i810_check_active(device_t bridge_dev); +static int agp_i830_check_active(device_t bridge_dev); +static int agp_i915_check_active(device_t bridge_dev); +static int agp_sb_check_active(device_t bridge_dev); + +static void agp_82852_set_desc(device_t dev, + const struct agp_i810_match *match); +static void agp_i810_set_desc(device_t dev, const struct agp_i810_match *match); + +static void agp_i810_dump_regs(device_t dev); +static void agp_i830_dump_regs(device_t dev); +static void agp_i855_dump_regs(device_t dev); +static void agp_i915_dump_regs(device_t dev); +static void agp_i965_dump_regs(device_t dev); +static void agp_sb_dump_regs(device_t dev); + +static int agp_i810_get_stolen_size(device_t dev); +static int agp_i830_get_stolen_size(device_t dev); +static int agp_i915_get_stolen_size(device_t dev); +static int agp_sb_get_stolen_size(device_t dev); + +static int agp_i810_get_gtt_mappable_entries(device_t dev); +static int agp_i830_get_gtt_mappable_entries(device_t dev); +static int agp_i915_get_gtt_mappable_entries(device_t dev); + +static int agp_i810_get_gtt_total_entries(device_t dev); +static int agp_i965_get_gtt_total_entries(device_t dev); +static int agp_gen5_get_gtt_total_entries(device_t dev); +static int agp_sb_get_gtt_total_entries(device_t dev); + +static int agp_i810_install_gatt(device_t dev); +static int agp_i830_install_gatt(device_t dev); + +static void agp_i810_deinstall_gatt(device_t dev); +static void agp_i830_deinstall_gatt(device_t dev); + +static void agp_i810_install_gtt_pte(device_t dev, u_int index, + vm_offset_t physical, int flags); +static void agp_i830_install_gtt_pte(device_t dev, u_int index, + vm_offset_t physical, int flags); +static void agp_i915_install_gtt_pte(device_t dev, u_int index, + vm_offset_t physical, int flags); +static void agp_i965_install_gtt_pte(device_t dev, u_int index, + vm_offset_t physical, int flags); +static void agp_g4x_install_gtt_pte(device_t dev, u_int index, + vm_offset_t physical, int flags); +static void agp_sb_install_gtt_pte(device_t dev, u_int index, + vm_offset_t physical, int flags); + +static void agp_i810_write_gtt(device_t dev, u_int index, uint32_t pte); +static void agp_i915_write_gtt(device_t dev, u_int index, uint32_t pte); +static void agp_i965_write_gtt(device_t dev, u_int index, uint32_t pte); +static void agp_g4x_write_gtt(device_t dev, u_int index, uint32_t pte); +static void agp_sb_write_gtt(device_t dev, u_int index, uint32_t pte); + +static u_int32_t agp_i810_read_gtt_pte(device_t dev, u_int index); +static u_int32_t agp_i915_read_gtt_pte(device_t dev, u_int index); +static u_int32_t agp_i965_read_gtt_pte(device_t dev, u_int index); +static u_int32_t agp_g4x_read_gtt_pte(device_t dev, u_int index); + +static vm_paddr_t agp_i810_read_gtt_pte_paddr(device_t dev, u_int index); +static vm_paddr_t agp_i915_read_gtt_pte_paddr(device_t dev, u_int index); +static vm_paddr_t agp_sb_read_gtt_pte_paddr(device_t dev, u_int index); + +static int agp_i810_set_aperture(device_t dev, u_int32_t aperture); +static int agp_i830_set_aperture(device_t dev, u_int32_t aperture); +static int agp_i915_set_aperture(device_t dev, u_int32_t aperture); + +static int agp_i810_chipset_flush_setup(device_t dev); +static int agp_i915_chipset_flush_setup(device_t dev); +static int agp_i965_chipset_flush_setup(device_t dev); + +static void agp_i810_chipset_flush_teardown(device_t dev); +static void agp_i915_chipset_flush_teardown(device_t dev); +static void agp_i965_chipset_flush_teardown(device_t dev); + +static void agp_i810_chipset_flush(device_t dev); +static void agp_i830_chipset_flush(device_t dev); +static void agp_i915_chipset_flush(device_t dev); + enum { CHIP_I810, /* i810/i815 */ CHIP_I830, /* 830M/845G */ @@ -72,6 +170,7 @@ enum { CHIP_G33, /* G33/Q33/Q35 */ CHIP_IGD, /* Pineview */ CHIP_G4X, /* G45/Q45 */ + CHIP_SB, /* SandyBridge */ }; /* The i810 through i855 have the registers at BAR 1, and the GATT gets @@ -96,19 +195,308 @@ static struct resource_spec agp_i965_res { -1, 0 } }; +static struct resource_spec agp_g4x_res_spec[] = { + { SYS_RES_MEMORY, AGP_G4X_MMADR, RF_ACTIVE | RF_SHAREABLE }, + { SYS_RES_MEMORY, AGP_G4X_GTTADR, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + struct agp_i810_softc { struct agp_softc agp; u_int32_t initial_aperture; /* aperture size at startup */ struct agp_gatt *gatt; - int chiptype; /* i810-like or i830 */ u_int32_t dcache_size; /* i810 only */ - u_int32_t stolen; /* number of i830/845 gtt entries for stolen memory */ + u_int32_t stolen; /* number of i830/845 gtt + entries for stolen memory */ + u_int stolen_size; /* BIOS-reserved graphics memory */ + u_int gtt_total_entries; /* Total number of gtt ptes */ + u_int gtt_mappable_entries; /* Number of gtt ptes mappable by CPU */ device_t bdev; /* bridge device */ - void *argb_cursor; /* contigmalloc area for ARGB cursor */ - - struct resource_spec * sc_res_spec; struct resource *sc_res[2]; + const struct agp_i810_match *match; + int sc_flush_page_rid; + struct resource *sc_flush_page_res; + void *sc_flush_page_vaddr; + int sc_bios_allocated_flush_page; +}; + +static device_t intel_agp; + +struct agp_i810_driver { + int chiptype; + int gen; + int busdma_addr_mask_sz; + struct resource_spec *res_spec; + int (*check_active)(device_t); + void (*set_desc)(device_t, const struct agp_i810_match *); + void (*dump_regs)(device_t); + int (*get_stolen_size)(device_t); + int (*get_gtt_total_entries)(device_t); + int (*get_gtt_mappable_entries)(device_t); + int (*install_gatt)(device_t); + void (*deinstall_gatt)(device_t); + void (*write_gtt)(device_t, u_int, uint32_t); + void (*install_gtt_pte)(device_t, u_int, vm_offset_t, int); + u_int32_t (*read_gtt_pte)(device_t, u_int); + vm_paddr_t (*read_gtt_pte_paddr)(device_t , u_int); + int (*set_aperture)(device_t, u_int32_t); + int (*chipset_flush_setup)(device_t); + void (*chipset_flush_teardown)(device_t); + void (*chipset_flush)(device_t); +}; + +static const struct agp_i810_driver agp_i810_i810_driver = { + .chiptype = CHIP_I810, + .gen = 1, + .busdma_addr_mask_sz = 32, + .res_spec = agp_i810_res_spec, + .check_active = agp_i810_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i810_dump_regs, + .get_stolen_size = agp_i810_get_stolen_size, + .get_gtt_mappable_entries = agp_i810_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i810_get_gtt_total_entries, + .install_gatt = agp_i810_install_gatt, + .deinstall_gatt = agp_i810_deinstall_gatt, + .write_gtt = agp_i810_write_gtt, + .install_gtt_pte = agp_i810_install_gtt_pte, + .read_gtt_pte = agp_i810_read_gtt_pte, + .read_gtt_pte_paddr = agp_i810_read_gtt_pte_paddr, + .set_aperture = agp_i810_set_aperture, + .chipset_flush_setup = agp_i810_chipset_flush_setup, + .chipset_flush_teardown = agp_i810_chipset_flush_teardown, + .chipset_flush = agp_i810_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_i815_driver = { + .chiptype = CHIP_I810, + .gen = 2, + .busdma_addr_mask_sz = 32, + .res_spec = agp_i810_res_spec, + .check_active = agp_i810_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i810_dump_regs, + .get_stolen_size = agp_i810_get_stolen_size, + .get_gtt_mappable_entries = agp_i830_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i810_get_gtt_total_entries, + .install_gatt = agp_i810_install_gatt, + .deinstall_gatt = agp_i810_deinstall_gatt, + .write_gtt = agp_i810_write_gtt, + .install_gtt_pte = agp_i810_install_gtt_pte, + .read_gtt_pte = agp_i810_read_gtt_pte, + .read_gtt_pte_paddr = agp_i810_read_gtt_pte_paddr, + .set_aperture = agp_i810_set_aperture, + .chipset_flush_setup = agp_i810_chipset_flush_setup, + .chipset_flush_teardown = agp_i810_chipset_flush_teardown, + .chipset_flush = agp_i830_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_i830_driver = { + .chiptype = CHIP_I830, + .gen = 2, + .busdma_addr_mask_sz = 32, + .res_spec = agp_i810_res_spec, + .check_active = agp_i830_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i830_dump_regs, + .get_stolen_size = agp_i830_get_stolen_size, + .get_gtt_mappable_entries = agp_i830_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i810_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_i810_write_gtt, + .install_gtt_pte = agp_i830_install_gtt_pte, + .read_gtt_pte = agp_i810_read_gtt_pte, + .read_gtt_pte_paddr = agp_i810_read_gtt_pte_paddr, + .set_aperture = agp_i830_set_aperture, + .chipset_flush_setup = agp_i810_chipset_flush_setup, + .chipset_flush_teardown = agp_i810_chipset_flush_teardown, + .chipset_flush = agp_i830_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_i855_driver = { + .chiptype = CHIP_I855, + .gen = 2, + .busdma_addr_mask_sz = 32, + .res_spec = agp_i810_res_spec, + .check_active = agp_i830_check_active, + .set_desc = agp_82852_set_desc, + .dump_regs = agp_i855_dump_regs, + .get_stolen_size = agp_i915_get_stolen_size, + .get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i810_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_i810_write_gtt, + .install_gtt_pte = agp_i830_install_gtt_pte, + .read_gtt_pte = agp_i810_read_gtt_pte, + .read_gtt_pte_paddr = agp_i810_read_gtt_pte_paddr, + .set_aperture = agp_i830_set_aperture, + .chipset_flush_setup = agp_i810_chipset_flush_setup, + .chipset_flush_teardown = agp_i810_chipset_flush_teardown, + .chipset_flush = agp_i830_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_i865_driver = { + .chiptype = CHIP_I855, + .gen = 2, + .busdma_addr_mask_sz = 32, + .res_spec = agp_i810_res_spec, + .check_active = agp_i830_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i855_dump_regs, + .get_stolen_size = agp_i915_get_stolen_size, + .get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i810_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_i810_write_gtt, + .install_gtt_pte = agp_i830_install_gtt_pte, + .read_gtt_pte = agp_i810_read_gtt_pte, + .read_gtt_pte_paddr = agp_i810_read_gtt_pte_paddr, + .set_aperture = agp_i915_set_aperture, + .chipset_flush_setup = agp_i810_chipset_flush_setup, + .chipset_flush_teardown = agp_i810_chipset_flush_teardown, + .chipset_flush = agp_i830_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_i915_driver = { + .chiptype = CHIP_I915, + .gen = 3, + .busdma_addr_mask_sz = 32, + .res_spec = agp_i915_res_spec, + .check_active = agp_i915_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i915_dump_regs, + .get_stolen_size = agp_i915_get_stolen_size, + .get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i810_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_i915_write_gtt, + .install_gtt_pte = agp_i915_install_gtt_pte, + .read_gtt_pte = agp_i915_read_gtt_pte, + .read_gtt_pte_paddr = agp_i915_read_gtt_pte_paddr, + .set_aperture = agp_i915_set_aperture, + .chipset_flush_setup = agp_i915_chipset_flush_setup, + .chipset_flush_teardown = agp_i915_chipset_flush_teardown, + .chipset_flush = agp_i915_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_g965_driver = { + .chiptype = CHIP_I965, + .gen = 4, + .busdma_addr_mask_sz = 36, + .res_spec = agp_i965_res_spec, + .check_active = agp_i915_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i965_dump_regs, + .get_stolen_size = agp_i915_get_stolen_size, + .get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i965_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_i965_write_gtt, + .install_gtt_pte = agp_i965_install_gtt_pte, + .read_gtt_pte = agp_i965_read_gtt_pte, + .read_gtt_pte_paddr = agp_i915_read_gtt_pte_paddr, + .set_aperture = agp_i915_set_aperture, + .chipset_flush_setup = agp_i965_chipset_flush_setup, + .chipset_flush_teardown = agp_i965_chipset_flush_teardown, + .chipset_flush = agp_i915_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_g33_driver = { + .chiptype = CHIP_G33, + .gen = 3, + .busdma_addr_mask_sz = 36, + .res_spec = agp_i915_res_spec, + .check_active = agp_i915_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i965_dump_regs, + .get_stolen_size = agp_i915_get_stolen_size, + .get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i965_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_i915_write_gtt, + .install_gtt_pte = agp_i915_install_gtt_pte, + .read_gtt_pte = agp_i915_read_gtt_pte, + .read_gtt_pte_paddr = agp_i915_read_gtt_pte_paddr, + .set_aperture = agp_i915_set_aperture, + .chipset_flush_setup = agp_i965_chipset_flush_setup, + .chipset_flush_teardown = agp_i965_chipset_flush_teardown, + .chipset_flush = agp_i915_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_igd_driver = { + .chiptype = CHIP_IGD, + .gen = 3, + .busdma_addr_mask_sz = 36, + .res_spec = agp_i915_res_spec, + .check_active = agp_i915_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i915_dump_regs, + .get_stolen_size = agp_i915_get_stolen_size, + .get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_i965_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_i915_write_gtt, + .install_gtt_pte = agp_i915_install_gtt_pte, + .read_gtt_pte = agp_i915_read_gtt_pte, + .read_gtt_pte_paddr = agp_i915_read_gtt_pte_paddr, + .set_aperture = agp_i915_set_aperture, + .chipset_flush_setup = agp_i965_chipset_flush_setup, + .chipset_flush_teardown = agp_i965_chipset_flush_teardown, + .chipset_flush = agp_i915_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_g4x_driver = { + .chiptype = CHIP_G4X, + .gen = 5, + .busdma_addr_mask_sz = 36, + .res_spec = agp_i965_res_spec, + .check_active = agp_i915_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_i965_dump_regs, + .get_stolen_size = agp_i915_get_stolen_size, + .get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_gen5_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_g4x_write_gtt, + .install_gtt_pte = agp_g4x_install_gtt_pte, + .read_gtt_pte = agp_g4x_read_gtt_pte, + .read_gtt_pte_paddr = agp_i915_read_gtt_pte_paddr, + .set_aperture = agp_i915_set_aperture, + .chipset_flush_setup = agp_i965_chipset_flush_setup, + .chipset_flush_teardown = agp_i965_chipset_flush_teardown, + .chipset_flush = agp_i915_chipset_flush, +}; + +static const struct agp_i810_driver agp_i810_sb_driver = { + .chiptype = CHIP_SB, + .gen = 6, + .busdma_addr_mask_sz = 40, + .res_spec = agp_g4x_res_spec, + .check_active = agp_sb_check_active, + .set_desc = agp_i810_set_desc, + .dump_regs = agp_sb_dump_regs, + .get_stolen_size = agp_sb_get_stolen_size, + .get_gtt_mappable_entries = agp_i915_get_gtt_mappable_entries, + .get_gtt_total_entries = agp_sb_get_gtt_total_entries, + .install_gatt = agp_i830_install_gatt, + .deinstall_gatt = agp_i830_deinstall_gatt, + .write_gtt = agp_sb_write_gtt, + .install_gtt_pte = agp_sb_install_gtt_pte, + .read_gtt_pte = agp_g4x_read_gtt_pte, + .read_gtt_pte_paddr = agp_sb_read_gtt_pte_paddr, + .set_aperture = agp_i915_set_aperture, + .chipset_flush_setup = agp_i810_chipset_flush_setup, + .chipset_flush_teardown = agp_i810_chipset_flush_teardown, + .chipset_flush = agp_i810_chipset_flush, }; /* For adding new devices, devid is the id of the graphics controller @@ -118,75 +506,232 @@ struct agp_i810_softc { */ static const struct agp_i810_match { int devid; - int chiptype; - int bridge_offset; char *name; + const struct agp_i810_driver *driver; } agp_i810_matches[] = { - {0x71218086, CHIP_I810, 0x00010000, - "Intel 82810 (i810 GMCH) SVGA controller"}, - {0x71238086, CHIP_I810, 0x00010000, - "Intel 82810-DC100 (i810-DC100 GMCH) SVGA controller"}, - {0x71258086, CHIP_I810, 0x00010000, - "Intel 82810E (i810E GMCH) SVGA controller"}, - {0x11328086, CHIP_I810, 0x00020000, - "Intel 82815 (i815 GMCH) SVGA controller"}, - {0x35778086, CHIP_I830, 0x00020000, - "Intel 82830M (830M GMCH) SVGA controller"}, - {0x25628086, CHIP_I830, 0x00020000, - "Intel 82845M (845M GMCH) SVGA controller"}, - {0x35828086, CHIP_I855, 0x00020000, - "Intel 82852/855GM SVGA controller"}, - {0x25728086, CHIP_I855, 0x00020000, - "Intel 82865G (865G GMCH) SVGA controller"}, - {0x25828086, CHIP_I915, 0x00020000, - "Intel 82915G (915G GMCH) SVGA controller"}, - {0x258A8086, CHIP_I915, 0x00020000, - "Intel E7221 SVGA controller"}, - {0x25928086, CHIP_I915, 0x00020000, - "Intel 82915GM (915GM GMCH) SVGA controller"}, - {0x27728086, CHIP_I915, 0x00020000, - "Intel 82945G (945G GMCH) SVGA controller"}, - {0x27A28086, CHIP_I915, 0x00020000, - "Intel 82945GM (945GM GMCH) SVGA controller"}, - {0x27AE8086, CHIP_I915, 0x00020000, - "Intel 945GME SVGA controller"}, - {0x29728086, CHIP_I965, 0x00020000, - "Intel 946GZ SVGA controller"}, - {0x29828086, CHIP_I965, 0x00020000, - "Intel G965 SVGA controller"}, - {0x29928086, CHIP_I965, 0x00020000, - "Intel Q965 SVGA controller"}, - {0x29A28086, CHIP_I965, 0x00020000, - "Intel G965 SVGA controller"}, - {0x29B28086, CHIP_G33, 0x00020000, - "Intel Q35 SVGA controller"}, - {0x29C28086, CHIP_G33, 0x00020000, - "Intel G33 SVGA controller"}, - {0x29D28086, CHIP_G33, 0x00020000, - "Intel Q33 SVGA controller"}, - {0xA0018086, CHIP_IGD, 0x00010000, - "Intel Pineview SVGA controller"}, - {0xA0118086, CHIP_IGD, 0x00010000, - "Intel Pineview (M) SVGA controller"}, - {0x2A028086, CHIP_I965, 0x00020000, - "Intel GM965 SVGA controller"}, - {0x2A128086, CHIP_I965, 0x00020000, - "Intel GME965 SVGA controller"}, - {0x2A428086, CHIP_G4X, 0x00020000, - "Intel GM45 SVGA controller"}, - {0x2E028086, CHIP_G4X, 0x00020000, - "Intel Eaglelake SVGA controller"}, - {0x2E128086, CHIP_G4X, 0x00020000, - "Intel Q45 SVGA controller"}, - {0x2E228086, CHIP_G4X, 0x00020000, - "Intel G45 SVGA controller"}, - {0x2E328086, CHIP_G4X, 0x00020000, - "Intel G41 SVGA controller"}, - {0x00428086, CHIP_G4X, 0x00020000, - "Intel Ironlake (D) SVGA controller"}, - {0x00468086, CHIP_G4X, 0x00020000, - "Intel Ironlake (M) SVGA controller"}, - {0, 0, 0, NULL} + { + .devid = 0x71218086, + .name = "Intel 82810 (i810 GMCH) SVGA controller", + .driver = &agp_i810_i810_driver + }, + { + .devid = 0x71238086, + .name = "Intel 82810-DC100 (i810-DC100 GMCH) SVGA controller", + .driver = &agp_i810_i810_driver + }, + { + .devid = 0x71258086, + .name = "Intel 82810E (i810E GMCH) SVGA controller", + .driver = &agp_i810_i810_driver + }, + { + .devid = 0x11328086, + .name = "Intel 82815 (i815 GMCH) SVGA controller", + .driver = &agp_i810_i815_driver + }, + { + .devid = 0x35778086, + .name = "Intel 82830M (830M GMCH) SVGA controller", + .driver = &agp_i810_i830_driver + }, + { + .devid = 0x25628086, + .name = "Intel 82845M (845M GMCH) SVGA controller", + .driver = &agp_i810_i830_driver + }, + { + .devid = 0x35828086, + .name = "Intel 82852/855GM SVGA controller", + .driver = &agp_i810_i855_driver + }, + { + .devid = 0x25728086, + .name = "Intel 82865G (865G GMCH) SVGA controller", + .driver = &agp_i810_i865_driver + }, + { + .devid = 0x25828086, + .name = "Intel 82915G (915G GMCH) SVGA controller", + .driver = &agp_i810_i915_driver + }, + { + .devid = 0x258A8086, + .name = "Intel E7221 SVGA controller", + .driver = &agp_i810_i915_driver + }, + { + .devid = 0x25928086, + .name = "Intel 82915GM (915GM GMCH) SVGA controller", + .driver = &agp_i810_i915_driver + }, + { + .devid = 0x27728086, + .name = "Intel 82945G (945G GMCH) SVGA controller", + .driver = &agp_i810_i915_driver + }, + { + .devid = 0x27A28086, + .name = "Intel 82945GM (945GM GMCH) SVGA controller", + .driver = &agp_i810_i915_driver + }, + { + .devid = 0x27AE8086, + .name = "Intel 945GME SVGA controller", + .driver = &agp_i810_i915_driver + }, + { + .devid = 0x29728086, + .name = "Intel 946GZ SVGA controller", + .driver = &agp_i810_g965_driver + }, + { + .devid = 0x29828086, + .name = "Intel G965 SVGA controller", + .driver = &agp_i810_g965_driver + }, + { + .devid = 0x29928086, + .name = "Intel Q965 SVGA controller", + .driver = &agp_i810_g965_driver + }, + { + .devid = 0x29A28086, + .name = "Intel G965 SVGA controller", + .driver = &agp_i810_g965_driver + }, + { + .devid = 0x29B28086, + .name = "Intel Q35 SVGA controller", + .driver = &agp_i810_g33_driver + }, + { + .devid = 0x29C28086, + .name = "Intel G33 SVGA controller", + .driver = &agp_i810_g33_driver + }, + { + .devid = 0x29D28086, + .name = "Intel Q33 SVGA controller", + .driver = &agp_i810_g33_driver + }, + { + .devid = 0xA0018086, + .name = "Intel Pineview SVGA controller", + .driver = &agp_i810_igd_driver + }, + { + .devid = 0xA0118086, + .name = "Intel Pineview (M) SVGA controller", + .driver = &agp_i810_igd_driver + }, + { + .devid = 0x2A028086, + .name = "Intel GM965 SVGA controller", + .driver = &agp_i810_g965_driver + }, + { + .devid = 0x2A128086, + .name = "Intel GME965 SVGA controller", + .driver = &agp_i810_g965_driver + }, + { + .devid = 0x2A428086, + .name = "Intel GM45 SVGA controller", + .driver = &agp_i810_g4x_driver + }, + { + .devid = 0x2E028086, + .name = "Intel Eaglelake SVGA controller", + .driver = &agp_i810_g4x_driver + }, + { + .devid = 0x2E128086, + .name = "Intel Q45 SVGA controller", + .driver = &agp_i810_g4x_driver + }, + { + .devid = 0x2E228086, + .name = "Intel G45 SVGA controller", + .driver = &agp_i810_g4x_driver + }, + { + .devid = 0x2E328086, + .name = "Intel G41 SVGA controller", + .driver = &agp_i810_g4x_driver + }, + { + .devid = 0x00428086, + .name = "Intel Ironlake (D) SVGA controller", + .driver = &agp_i810_g4x_driver + }, + { + .devid = 0x00468086, + .name = "Intel Ironlake (M) SVGA controller", + .driver = &agp_i810_g4x_driver + }, + { + .devid = 0x01028086, + .name = "SandyBridge desktop GT1 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01128086, + .name = "SandyBridge desktop GT2 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01228086, + .name = "SandyBridge desktop GT2+ IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01068086, + .name = "SandyBridge mobile GT1 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01168086, + .name = "SandyBridge mobile GT2 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01268086, + .name = "SandyBridge mobile GT2+ IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01088086, + .name = "SandyBridge server IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01528086, + .name = "IvyBridge desktop GT1 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01628086, + .name = "IvyBridge desktop GT2 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01568086, + .name = "IvyBridge mobile GT1 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x01668086, + .name = "IvyBridge mobile GT2 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0x015a8086, + .name = "IvyBridge server GT1 IG", + .driver = &agp_i810_sb_driver + }, + { + .devid = 0, + } }; static const struct agp_i810_match* @@ -196,17 +741,17 @@ agp_i810_match(device_t dev) if (pci_get_class(dev) != PCIC_DISPLAY || pci_get_subclass(dev) != PCIS_DISPLAY_VGA) - return NULL; + return (NULL); devid = pci_get_devid(dev); for (i = 0; agp_i810_matches[i].devid != 0; i++) { if (agp_i810_matches[i].devid == devid) - break; + break; } if (agp_i810_matches[i].devid == 0) - return NULL; + return (NULL); else - return &agp_i810_matches[i]; + return (&agp_i810_matches[i]); } /* @@ -215,28 +760,8 @@ agp_i810_match(device_t dev) static device_t agp_i810_find_bridge(device_t dev) { - device_t *children, child; - int nchildren, i; - u_int32_t devid; - const struct agp_i810_match *match; - - match = agp_i810_match(dev); - devid = match->devid - match->bridge_offset; - if (device_get_children(device_get_parent(device_get_parent(dev)), - &children, &nchildren)) - return 0; - - for (i = 0; i < nchildren; i++) { - child = children[i]; - - if (pci_get_devid(child) == devid) { - free(children, M_TEMP); - return child; - } - } - free(children, M_TEMP); - return 0; + return (pci_find_dbsf(0, 0, 0, 0)); } static void @@ -249,92 +774,116 @@ agp_i810_identify(driver_t *driver, devi } static int +agp_i810_check_active(device_t bridge_dev) +{ + u_int8_t smram; + + smram = pci_read_config(bridge_dev, AGP_I810_SMRAM, 1); + if ((smram & AGP_I810_SMRAM_GMS) == AGP_I810_SMRAM_GMS_DISABLED) + return (ENXIO); + return (0); +} + +static int +agp_i830_check_active(device_t bridge_dev) +{ + int gcc1; + + gcc1 = pci_read_config(bridge_dev, AGP_I830_GCC1, 1); + if ((gcc1 & AGP_I830_GCC1_DEV2) == AGP_I830_GCC1_DEV2_DISABLED) + return (ENXIO); + return (0); +} + +static int +agp_i915_check_active(device_t bridge_dev) +{ + int deven; + + deven = pci_read_config(bridge_dev, AGP_I915_DEVEN, 4); + if ((deven & AGP_I915_DEVEN_D2F0) == AGP_I915_DEVEN_D2F0_DISABLED) + return (ENXIO); + return (0); +} + +static int +agp_sb_check_active(device_t bridge_dev) +{ + int deven; + + deven = pci_read_config(bridge_dev, AGP_I915_DEVEN, 4); + if ((deven & AGP_SB_DEVEN_D2EN) == AGP_SB_DEVEN_D2EN_DISABLED) + return (ENXIO); + return (0); +} + +static void +agp_82852_set_desc(device_t dev, const struct agp_i810_match *match) +{ + + switch (pci_read_config(dev, AGP_I85X_CAPID, 1)) { + case AGP_I855_GME: + device_set_desc(dev, + "Intel 82855GME (855GME GMCH) SVGA controller"); + break; + case AGP_I855_GM: + device_set_desc(dev, + "Intel 82855GM (855GM GMCH) SVGA controller"); + break; + case AGP_I852_GME: + device_set_desc(dev, + "Intel 82852GME (852GME GMCH) SVGA controller"); + break; + case AGP_I852_GM: + device_set_desc(dev, + "Intel 82852GM (852GM GMCH) SVGA controller"); + break; + default: + device_set_desc(dev, + "Intel 8285xM (85xGM GMCH) SVGA controller"); + break; + } +} + +static void +agp_i810_set_desc(device_t dev, const struct agp_i810_match *match) +{ + + device_set_desc(dev, match->name); +} + +static int agp_i810_probe(device_t dev) { device_t bdev; const struct agp_i810_match *match; - u_int8_t smram; - int gcc1, deven; + int err; if (resource_disabled("agp", device_get_unit(dev))) return (ENXIO); match = agp_i810_match(dev); if (match == NULL) - return ENXIO; + return (ENXIO); bdev = agp_i810_find_bridge(dev); - if (!bdev) { + if (bdev == NULL) { if (bootverbose) printf("I810: can't find bridge device\n"); - return ENXIO; + return (ENXIO); } /* * checking whether internal graphics device has been activated. */ - switch (match->chiptype) { - case CHIP_I810: - smram = pci_read_config(bdev, AGP_I810_SMRAM, 1); - if ((smram & AGP_I810_SMRAM_GMS) == - AGP_I810_SMRAM_GMS_DISABLED) { - if (bootverbose) - printf("I810: disabled, not probing\n"); - return ENXIO; - } - break; - case CHIP_I830: - case CHIP_I855: - gcc1 = pci_read_config(bdev, AGP_I830_GCC1, 1); - if ((gcc1 & AGP_I830_GCC1_DEV2) == - AGP_I830_GCC1_DEV2_DISABLED) { - if (bootverbose) - printf("I830: disabled, not probing\n"); - return ENXIO; - } - break; - case CHIP_I915: - case CHIP_I965: - case CHIP_G33: - case CHIP_IGD: - case CHIP_G4X: - deven = pci_read_config(bdev, AGP_I915_DEVEN, 4); - if ((deven & AGP_I915_DEVEN_D2F0) == - AGP_I915_DEVEN_D2F0_DISABLED) { - if (bootverbose) - printf("I915: disabled, not probing\n"); - return ENXIO; - } - break; - } - - if (match->devid == 0x35828086) { - switch (pci_read_config(dev, AGP_I85X_CAPID, 1)) { - case AGP_I855_GME: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:35:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88EA2106564A; Mon, 11 Jun 2012 21:35:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A4678FC17; Mon, 11 Jun 2012 21:35:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLZSuV011582; Mon, 11 Jun 2012 21:35:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLZS8d011581; Mon, 11 Jun 2012 21:35:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112135.q5BLZS8d011581@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236927 - stable/9/sys/dev/drm2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:35:28 -0000 Author: kib Date: Mon Jun 11 21:35:27 2012 New Revision: 236927 URL: http://svn.freebsd.org/changeset/base/236927 Log: MFC r235783: Add the code for new Intel GPU driver, which supports GEM, KMS and works with new generations of GPUs (IronLake, SandyBridge and supposedly IvyBridge). The driver is not connected to the build yet. Added: stable/9/sys/dev/drm2/ - copied from r235783, head/sys/dev/drm2/ Modified: Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:38:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 10F98106564A; Mon, 11 Jun 2012 21:38:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F03928FC14; Mon, 11 Jun 2012 21:38:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLcasb011758; Mon, 11 Jun 2012 21:38:36 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLcaTd011756; Mon, 11 Jun 2012 21:38:36 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112138.q5BLcaTd011756@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236928 - stable/9/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:38:37 -0000 Author: kib Date: Mon Jun 11 21:38:36 2012 New Revision: 236928 URL: http://svn.freebsd.org/changeset/base/236928 Log: MFC r235846: Add 'drmn' device as another drm child, to allow drm2 drivers to live in parallel with drm1. Modified: stable/9/sys/dev/pci/vga_pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/pci/vga_pci.c ============================================================================== --- stable/9/sys/dev/pci/vga_pci.c Mon Jun 11 21:35:27 2012 (r236927) +++ stable/9/sys/dev/pci/vga_pci.c Mon Jun 11 21:38:36 2012 (r236928) @@ -105,6 +105,7 @@ vga_pci_attach(device_t dev) /* Always create a drm child for now to make it easier on drm. */ device_add_child(dev, "drm", -1); + device_add_child(dev, "drmn", -1); bus_generic_attach(dev); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:40:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13505106564A; Mon, 11 Jun 2012 21:40:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D31B28FC23; Mon, 11 Jun 2012 21:40:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLe29l011871; Mon, 11 Jun 2012 21:40:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLe2tG011870; Mon, 11 Jun 2012 21:40:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112140.q5BLe2tG011870@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:40:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236929 - stable/9/sys/modules/drm2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:40:03 -0000 Author: kib Date: Mon Jun 11 21:40:02 2012 New Revision: 236929 URL: http://svn.freebsd.org/changeset/base/236929 Log: MFC r235847: The drm2 modules makefiles commit. Added: stable/9/sys/modules/drm2/ - copied from r235847, head/sys/modules/drm2/ Modified: Directory Properties: stable/9/sys/ (props changed) stable/9/sys/modules/ (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:41:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6087C106564A; Mon, 11 Jun 2012 21:41:17 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BE368FC25; Mon, 11 Jun 2012 21:41:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLfH0h011971; Mon, 11 Jun 2012 21:41:17 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLfHao011969; Mon, 11 Jun 2012 21:41:17 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206112141.q5BLfHao011969@svn.freebsd.org> From: Alan Cox Date: Mon, 11 Jun 2012 21:41:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236930 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:41:17 -0000 Author: alc Date: Mon Jun 11 21:41:16 2012 New Revision: 236930 URL: http://svn.freebsd.org/changeset/base/236930 Log: Avoid unnecessary atomic operations for clearing PGA_WRITEABLE in pmap_remove_pages(). This reduces pmap_remove_pages()'s running time by 4 to 11% in my tests. MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Jun 11 21:40:02 2012 (r236929) +++ head/sys/amd64/amd64/pmap.c Mon Jun 11 21:41:16 2012 (r236930) @@ -4197,7 +4197,8 @@ pmap_remove_pages(pmap_t pmap) TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) - if (TAILQ_EMPTY(&mt->md.pv_list)) + if ((mt->aflags & PGA_WRITEABLE) != 0 && + TAILQ_EMPTY(&mt->md.pv_list)) vm_page_aflag_clear(mt, PGA_WRITEABLE); } mpte = pmap_lookup_pt_page(pmap, pv->pv_va); @@ -4213,7 +4214,8 @@ pmap_remove_pages(pmap_t pmap) } else { pmap_resident_count_dec(pmap, 1); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list) && + if ((m->aflags & PGA_WRITEABLE) != 0 && + TAILQ_EMPTY(&m->md.pv_list) && (m->flags & PG_FICTITIOUS) == 0) { pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); if (TAILQ_EMPTY(&pvh->pv_list)) From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:41:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 74A7E1065674; Mon, 11 Jun 2012 21:41:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FB0B8FC32; Mon, 11 Jun 2012 21:41:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLfjSq012026; Mon, 11 Jun 2012 21:41:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLfj5G012024; Mon, 11 Jun 2012 21:41:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112141.q5BLfj5G012024@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:41:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236931 - stable/9/sys/dev/drm2/i915 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:41:46 -0000 Author: kib Date: Mon Jun 11 21:41:45 2012 New Revision: 236931 URL: http://svn.freebsd.org/changeset/base/236931 Log: MFC r235925 (by dim): Fix a clang warning in drm2. Modified: stable/9/sys/dev/drm2/i915/intel_display.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/drm2/i915/intel_display.c ============================================================================== --- stable/9/sys/dev/drm2/i915/intel_display.c Mon Jun 11 21:41:16 2012 (r236930) +++ stable/9/sys/dev/drm2/i915/intel_display.c Mon Jun 11 21:41:45 2012 (r236931) @@ -8858,7 +8858,7 @@ static void ironlake_disable_rc6(struct if (I915_READ(PWRCTXA)) { /* Wake the GPU, prevent RC6, then restore RSTDBYCTL */ I915_WRITE(RSTDBYCTL, I915_READ(RSTDBYCTL) | RCX_SW_EXIT); - _intel_wait_for(dev, + (void)_intel_wait_for(dev, ((I915_READ(RSTDBYCTL) & RSX_STATUS_MASK) == RSX_STATUS_ON), 50, 1, "915pro"); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:43:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8FDD8106564A; Mon, 11 Jun 2012 21:43:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AABB8FC1B; Mon, 11 Jun 2012 21:43:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLhHdH012148; Mon, 11 Jun 2012 21:43:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLhHYL012146; Mon, 11 Jun 2012 21:43:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112143.q5BLhHYL012146@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236932 - stable/9/sys/dev/drm2/i915 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:43:17 -0000 Author: kib Date: Mon Jun 11 21:43:17 2012 New Revision: 236932 URL: http://svn.freebsd.org/changeset/base/236932 Log: MFC r236182: Fix calculation of the execution buffer end in the mapped pages when it is spilled into the next page. Modified: stable/9/sys/dev/drm2/i915/i915_gem_execbuffer.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/drm2/i915/i915_gem_execbuffer.c ============================================================================== --- stable/9/sys/dev/drm2/i915/i915_gem_execbuffer.c Mon Jun 11 21:41:45 2012 (r236931) +++ stable/9/sys/dev/drm2/i915/i915_gem_execbuffer.c Mon Jun 11 21:43:17 2012 (r236932) @@ -1069,7 +1069,8 @@ i915_gem_fix_mi_batchbuffer_end(struct d po_r -= 4; mkva = pmap_mapdev_attr(trunc_page(po_r), 2 * PAGE_SIZE, PAT_WRITE_COMBINING); - cmd = *(uint32_t *)(mkva + (po_r & PAGE_MASK)); + po_r &= PAGE_MASK; + cmd = *(uint32_t *)(mkva + po_r); if (cmd != MI_BATCH_BUFFER_END) { /* @@ -1083,8 +1084,7 @@ i915_gem_fix_mi_batchbuffer_end(struct d po_w = po_r; DRM_DEBUG("batchbuffer does not end by MI_BATCH_BUFFER_END, overwriting last bo cmd !\n"); } - - *(uint32_t *)(mkva + (po_w & PAGE_MASK)) = MI_BATCH_BUFFER_END; + *(uint32_t *)(mkva + po_w) = MI_BATCH_BUFFER_END; } pmap_unmapdev((vm_offset_t)mkva, 2 * PAGE_SIZE); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 21:44:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54D4E106566B; Mon, 11 Jun 2012 21:44:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FF4F8FC1B; Mon, 11 Jun 2012 21:44:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BLiPWf012260; Mon, 11 Jun 2012 21:44:25 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BLiP3a012258; Mon, 11 Jun 2012 21:44:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206112144.q5BLiP3a012258@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Jun 2012 21:44:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236933 - stable/9/sys/dev/drm2/i915 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 21:44:25 -0000 Author: kib Date: Mon Jun 11 21:44:24 2012 New Revision: 236933 URL: http://svn.freebsd.org/changeset/base/236933 Log: MFC r236183: Disable end of buffer fixup by default. Modified: stable/9/sys/dev/drm2/i915/i915_gem_execbuffer.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/drm2/i915/i915_gem_execbuffer.c ============================================================================== --- stable/9/sys/dev/drm2/i915/i915_gem_execbuffer.c Mon Jun 11 21:43:17 2012 (r236932) +++ stable/9/sys/dev/drm2/i915/i915_gem_execbuffer.c Mon Jun 11 21:44:24 2012 (r236933) @@ -1090,7 +1090,7 @@ DRM_DEBUG("batchbuffer does not end by M pmap_unmapdev((vm_offset_t)mkva, 2 * PAGE_SIZE); } -int i915_fix_mi_batchbuffer_end = 1; +int i915_fix_mi_batchbuffer_end = 0; static int i915_reset_gen7_sol_offsets(struct drm_device *dev, From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 22:00:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 62218106566B; Mon, 11 Jun 2012 22:00:17 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 46B2F8FC1A; Mon, 11 Jun 2012 22:00:16 +0000 (UTC) X-T2-Spam-Status: No, hits=-1.0 required=5.0 tests=ALL_TRUSTED Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 285860163; Tue, 12 Jun 2012 00:00:14 +0200 From: Hans Petter Selasky To: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 23:59:41 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <20120611200507.GG1399@garage.freebsd.pl> <201206112221.51793.hselasky@c2i.net> In-Reply-To: <201206112221.51793.hselasky@c2i.net> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201206112359.41892.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r236909 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 22:00:19 -0000 On Monday 11 June 2012 22:21:51 Hans Petter Selasky wrote: > On Monday 11 June 2012 22:05:07 Pawel Jakub Dawidek wrote: > > On Mon, Jun 11, 2012 at 07:21:00PM +0000, Hans Petter Selasky wrote: > > > Author: hselasky > > > Date: Mon Jun 11 19:20:59 2012 > > > New Revision: 236909 > > > URL: http://svn.freebsd.org/changeset/base/236909 > > > > > > Log: > > > Use the correct clock source when computing timeouts. > > > > Could you please explain why? As you can see some lines above in > > > cv_init(), we initialize condition variable with CLOCK_MONOTONIC too: > Sorry, this was a mistake clearly. I will revert ASAP. Pointyhat to me. > > My test program didn't take the setattr into account. > > However, while at it, what is the default clock used by > pthread_cond_timedwait(). In libusb we don't set any clock, and can we > depend on that CLOCK_REALTIME is the default clock used? Else I should > probably make a patch there. > > man pthread_cond_timedwait() is silent! > Hi, Some more questions: While doing my test, I traced pthread_cond_timedwait() into "./kern/kern_umtx.c" where the time is subtracted again, so the actual time value is not that important, but there are some other problems: If the time structure argument passed to pthread_cond_timedwait() in 9-stable is negative, for example the seconds field, the above mentioned function will just return! See ./libkse/thread/thr_cond.c int _pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, const struct timespec * abstime) { struct pthread *curthread = _get_curthread(); int rval = 0; int done = 0; int mutex_locked = 1; int seqno; THR_ASSERT(curthread->locklevel == 0, "cv_timedwait: locklevel is not zero!"); if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) return (EINVAL); CLOCK_MONOTONIC: 18077 (seconds) CLOCK_REALTIME: 1339451481 (seconds) CLOCK_REALTIME will at some point become negative. Will libusb's timeout functionality stop working then, because pthread_cond_timedwait() has a check for negative time? Or is hastd wrong, that it can compute a timeout offset which is outside the valid range, because it uses a simple: tv_sec += timeout? tv_sec %= 1000000000; /* Is this perhaps missing in hastd and other drivers ???? */ What is the modulus which should be used for tv_sec? --HPS From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 22:05:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E6CD11065679; Mon, 11 Jun 2012 22:05:26 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9AAE8FC12; Mon, 11 Jun 2012 22:05:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BM5QIZ013268; Mon, 11 Jun 2012 22:05:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BM5QIv013266; Mon, 11 Jun 2012 22:05:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206112205.q5BM5QIv013266@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 22:05:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 22:05:27 -0000 Author: pjd Date: Mon Jun 11 22:05:26 2012 New Revision: 236935 URL: http://svn.freebsd.org/changeset/base/236935 Log: fdgrowtable() no longer drops the filedesc lock so it is enough to retry finding free file descriptor only once after fdgrowtable(). Spotted by: pluknet MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Jun 11 21:56:37 2012 (r236934) +++ head/sys/kern/kern_descrip.c Mon Jun 11 22:05:26 2012 (r236935) @@ -1478,29 +1478,33 @@ fdalloc(struct thread *td, int minfd, in /* * Search the bitmap for a free descriptor. If none is found, try * to grow the file table. Keep at it until we either get a file - * descriptor or run into process or system limits; fdgrowtable() - * may drop the filedesc lock, so we're in a race. + * descriptor or run into process or system limits. */ - for (;;) { - fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); - if (fd >= maxfd) - return (EMFILE); - if (fd < fdp->fd_nfiles) - break; + fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); + if (fd >= maxfd) + return (EMFILE); + if (fd >= fdp->fd_nfiles) { #ifdef RACCT PROC_LOCK(p); - error = racct_set(p, RACCT_NOFILE, min(fdp->fd_nfiles * 2, maxfd)); + error = racct_set(p, RACCT_NOFILE, + min(fdp->fd_nfiles * 2, maxfd)); PROC_UNLOCK(p); if (error != 0) return (EMFILE); #endif fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd)); + /* Retry... */ + fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); + if (fd >= maxfd) + return (EMFILE); } /* * Perform some sanity checks, then mark the file descriptor as * used and return it to the caller. */ + KASSERT((unsigned int)fd < min(maxfd, fdp->fd_nfiles), + ("invalid descriptor %d", fd)); KASSERT(!fdisused(fdp, fd), ("fd_first_free() returned non-free descriptor")); KASSERT(fdp->fd_ofiles[fd] == NULL, ("file descriptor isn't free")); From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 22:25:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2518106566C; Mon, 11 Jun 2012 22:25:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E6188FC0A; Mon, 11 Jun 2012 22:25:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BMPKJk014245; Mon, 11 Jun 2012 22:25:20 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BMPKjP014243; Mon, 11 Jun 2012 22:25:20 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201206112225.q5BMPKjP014243@svn.freebsd.org> From: Xin LI Date: Mon, 11 Jun 2012 22:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236936 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 22:25:20 -0000 Author: delphij Date: Mon Jun 11 22:25:20 2012 New Revision: 236936 URL: http://svn.freebsd.org/changeset/base/236936 Log: Switch from 4-clause to 2-clause BSD license. (OpenBSD r1.22) No functional change. Obtained from: NetBSD via OpenBSD Modified: head/lib/libc/stdlib/getopt_long.c Modified: head/lib/libc/stdlib/getopt_long.c ============================================================================== --- head/lib/libc/stdlib/getopt_long.c Mon Jun 11 22:05:26 2012 (r236935) +++ head/lib/libc/stdlib/getopt_long.c Mon Jun 11 22:25:20 2012 (r236936) @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt_long.c,v 1.21 2006/09/22 17:22:05 millert Exp $ */ +/* $OpenBSD: getopt_long.c,v 1.22 2006/10/04 21:29:04 jmc Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* @@ -35,13 +35,6 @@ * 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. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 23:07:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 391AE106566B; Mon, 11 Jun 2012 23:07:22 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 233438FC0A; Mon, 11 Jun 2012 23:07:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BN7L0p016014; Mon, 11 Jun 2012 23:07:21 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BN7LDl016012; Mon, 11 Jun 2012 23:07:21 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201206112307.q5BN7LDl016012@svn.freebsd.org> From: Kirk McKusick Date: Mon, 11 Jun 2012 23:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236937 - head/sys/ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 23:07:22 -0000 Author: mckusick Date: Mon Jun 11 23:07:21 2012 New Revision: 236937 URL: http://svn.freebsd.org/changeset/base/236937 Log: In softdep_setup_inomapdep() we may have to allocate both inodedep and bmsafemap dependency structures in inodedep_lookup() and bmsafemap_lookup() respectively. The setup of these structures must be done while holding the soft-dependency mutex. If the inodedep is allocated first, it may be freed in the I/O completion callback when the mutex is released to allocate the bmsafemap. If the bmsafemap is allocated first, it may be freed in the I/O completion callback when the mutex is released to allocate the inodedep. To resolve this problem, bmsafemap_lookup has had a parameter added that allows a pre-malloc'ed bmsafemap to be passed in so that it does not need to release the mutex to create a new bmsafemap. The softdep_setup_inomapdep() routine pre-malloc's a bmsafemap dependency before acquiring the mutex and starting to build the inodedep with a call to inodedep_lookup(). The subsequent call to bmsafemap_lookup() is passed this pre-allocated bmsafemap entry so that it need not release the mutex if it needs to create a new one. Reported by: Peter Holm Tested by: Peter Holm MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Mon Jun 11 22:25:20 2012 (r236936) +++ head/sys/ufs/ffs/ffs_softdep.c Mon Jun 11 23:07:21 2012 (r236937) @@ -920,7 +920,7 @@ static struct freefrag *allocindir_merge static int bmsafemap_find(struct bmsafemap_hashhead *, struct mount *, int, struct bmsafemap **); static struct bmsafemap *bmsafemap_lookup(struct mount *, struct buf *, - int cg); + int cg, struct bmsafemap *); static int newblk_find(struct newblk_hashhead *, struct mount *, ufs2_daddr_t, int, struct newblk **); static int newblk_lookup(struct mount *, ufs2_daddr_t, int, struct newblk **); @@ -4707,12 +4707,26 @@ softdep_setup_inomapdep(bp, ip, newinum, * Panic if it already exists as something is seriously wrong. * Otherwise add it to the dependency list for the buffer holding * the cylinder group map from which it was allocated. + * + * We have to preallocate a bmsafemap entry in case it is needed + * in bmsafemap_lookup since once we allocate the inodedep, we + * have to finish initializing it before we can FREE_LOCK(). + * By preallocating, we avoid FREE_LOCK() while doing a malloc + * in bmsafemap_lookup. We cannot call bmsafemap_lookup before + * creating the inodedep as it can be freed during the time + * that we FREE_LOCK() while allocating the inodedep. We must + * call workitem_alloc() before entering the locked section as + * it also acquires the lock and we must avoid trying doing so + * recursively. */ + bmsafemap = malloc(sizeof(struct bmsafemap), + M_BMSAFEMAP, M_SOFTDEP_FLAGS); + workitem_alloc(&bmsafemap->sm_list, D_BMSAFEMAP, mp); ACQUIRE_LOCK(&lk); if ((inodedep_lookup(mp, newinum, DEPALLOC | NODELAY, &inodedep))) panic("softdep_setup_inomapdep: dependency %p for new" "inode already exists", inodedep); - bmsafemap = bmsafemap_lookup(mp, bp, ino_to_cg(fs, newinum)); + bmsafemap = bmsafemap_lookup(mp, bp, ino_to_cg(fs, newinum), bmsafemap); if (jaddref) { LIST_INSERT_HEAD(&bmsafemap->sm_jaddrefhd, jaddref, ja_bmdeps); TAILQ_INSERT_TAIL(&inodedep->id_inoreflst, &jaddref->ja_ref, @@ -4786,7 +4800,7 @@ softdep_setup_blkmapdep(bp, mp, newblkno if (newblk_lookup(mp, newblkno, DEPALLOC, &newblk) != 0) panic("softdep_setup_blkmapdep: found block"); newblk->nb_bmsafemap = bmsafemap = bmsafemap_lookup(mp, bp, - dtog(fs, newblkno)); + dtog(fs, newblkno), NULL); if (jnewblk) { jnewblk->jn_dep = (struct worklist *)newblk; LIST_INSERT_HEAD(&bmsafemap->sm_jnewblkhd, jnewblk, jn_deps); @@ -4827,13 +4841,16 @@ bmsafemap_find(bmsafemaphd, mp, cg, bmsa * Find the bmsafemap associated with a cylinder group buffer. * If none exists, create one. The buffer must be locked when * this routine is called and this routine must be called with - * splbio interrupts blocked. + * the softdep lock held. To avoid giving up the lock while + * allocating a new bmsafemap, a preallocated bmsafemap may be + * provided. If it is provided but not needed, it is freed. */ static struct bmsafemap * -bmsafemap_lookup(mp, bp, cg) +bmsafemap_lookup(mp, bp, cg, newbmsafemap) struct mount *mp; struct buf *bp; int cg; + struct bmsafemap *newbmsafemap; { struct bmsafemap_hashhead *bmsafemaphd; struct bmsafemap *bmsafemap, *collision; @@ -4843,16 +4860,27 @@ bmsafemap_lookup(mp, bp, cg) mtx_assert(&lk, MA_OWNED); if (bp) LIST_FOREACH(wk, &bp->b_dep, wk_list) - if (wk->wk_type == D_BMSAFEMAP) + if (wk->wk_type == D_BMSAFEMAP) { + if (newbmsafemap) + WORKITEM_FREE(newbmsafemap,D_BMSAFEMAP); return (WK_BMSAFEMAP(wk)); + } fs = VFSTOUFS(mp)->um_fs; bmsafemaphd = BMSAFEMAP_HASH(fs, cg); - if (bmsafemap_find(bmsafemaphd, mp, cg, &bmsafemap) == 1) + if (bmsafemap_find(bmsafemaphd, mp, cg, &bmsafemap) == 1) { + if (newbmsafemap) + WORKITEM_FREE(newbmsafemap, D_BMSAFEMAP); return (bmsafemap); - FREE_LOCK(&lk); - bmsafemap = malloc(sizeof(struct bmsafemap), - M_BMSAFEMAP, M_SOFTDEP_FLAGS); - workitem_alloc(&bmsafemap->sm_list, D_BMSAFEMAP, mp); + } + if (newbmsafemap) { + bmsafemap = newbmsafemap; + } else { + FREE_LOCK(&lk); + bmsafemap = malloc(sizeof(struct bmsafemap), + M_BMSAFEMAP, M_SOFTDEP_FLAGS); + workitem_alloc(&bmsafemap->sm_list, D_BMSAFEMAP, mp); + ACQUIRE_LOCK(&lk); + } bmsafemap->sm_buf = bp; LIST_INIT(&bmsafemap->sm_inodedephd); LIST_INIT(&bmsafemap->sm_inodedepwr); @@ -4862,7 +4890,6 @@ bmsafemap_lookup(mp, bp, cg) LIST_INIT(&bmsafemap->sm_jnewblkhd); LIST_INIT(&bmsafemap->sm_freehd); LIST_INIT(&bmsafemap->sm_freewr); - ACQUIRE_LOCK(&lk); if (bmsafemap_find(bmsafemaphd, mp, cg, &collision) == 1) { WORKITEM_FREE(bmsafemap, D_BMSAFEMAP); return (collision); @@ -10221,7 +10248,7 @@ softdep_setup_blkfree(mp, bp, blkno, fra ACQUIRE_LOCK(&lk); /* Lookup the bmsafemap so we track when it is dirty. */ fs = VFSTOUFS(mp)->um_fs; - bmsafemap = bmsafemap_lookup(mp, bp, dtog(fs, blkno)); + bmsafemap = bmsafemap_lookup(mp, bp, dtog(fs, blkno), NULL); /* * Detach any jnewblks which have been canceled. They must linger * until the bitmap is cleared again by ffs_blkfree() to prevent @@ -10267,7 +10294,7 @@ softdep_setup_blkfree(mp, bp, blkno, fra * allocation dependency. */ fs = VFSTOUFS(mp)->um_fs; - bmsafemap = bmsafemap_lookup(mp, bp, dtog(fs, blkno)); + bmsafemap = bmsafemap_lookup(mp, bp, dtog(fs, blkno), NULL); end = blkno + frags; LIST_FOREACH(jnewblk, &bmsafemap->sm_jnewblkhd, jn_deps) { /* From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 00:14:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 498F5106566C; Tue, 12 Jun 2012 00:14:55 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32AB48FC0C; Tue, 12 Jun 2012 00:14:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C0EtMf018859; Tue, 12 Jun 2012 00:14:55 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C0EsqK018853; Tue, 12 Jun 2012 00:14:54 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206120014.q5C0EsqK018853@svn.freebsd.org> From: Mitsuru IWASAKI Date: Tue, 12 Jun 2012 00:14:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236938 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include x86/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 00:14:55 -0000 Author: iwasaki Date: Tue Jun 12 00:14:54 2012 New Revision: 236938 URL: http://svn.freebsd.org/changeset/base/236938 Log: Share IPI init and startup code of mp_machdep.c with acpi_wakeup.c as ipi_startup(). Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/smp.h head/sys/i386/i386/mp_machdep.c head/sys/i386/include/smp.h head/sys/x86/acpica/acpi_wakeup.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Mon Jun 11 23:07:21 2012 (r236937) +++ head/sys/amd64/amd64/mp_machdep.c Tue Jun 12 00:14:54 2012 (r236938) @@ -981,6 +981,60 @@ start_ap(int apic_id) /* used as a watchpoint to signal AP startup */ cpus = mp_naps; + ipi_startup(apic_id, vector); + + /* Wait up to 5 seconds for it to start. */ + for (ms = 0; ms < 5000; ms++) { + if (mp_naps > cpus) + return 1; /* return SUCCESS */ + DELAY(1000); + } + return 0; /* return FAILURE */ +} + +#ifdef COUNT_XINVLTLB_HITS +u_int xhits_gbl[MAXCPU]; +u_int xhits_pg[MAXCPU]; +u_int xhits_rng[MAXCPU]; +static SYSCTL_NODE(_debug, OID_AUTO, xhits, CTLFLAG_RW, 0, ""); +SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, global, CTLFLAG_RW, &xhits_gbl, + sizeof(xhits_gbl), "IU", ""); +SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, page, CTLFLAG_RW, &xhits_pg, + sizeof(xhits_pg), "IU", ""); +SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, range, CTLFLAG_RW, &xhits_rng, + sizeof(xhits_rng), "IU", ""); + +u_int ipi_global; +u_int ipi_page; +u_int ipi_range; +u_int ipi_range_size; +SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_global, CTLFLAG_RW, &ipi_global, 0, ""); +SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_page, CTLFLAG_RW, &ipi_page, 0, ""); +SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_range, CTLFLAG_RW, &ipi_range, 0, ""); +SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_range_size, CTLFLAG_RW, + &ipi_range_size, 0, ""); + +u_int ipi_masked_global; +u_int ipi_masked_page; +u_int ipi_masked_range; +u_int ipi_masked_range_size; +SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_masked_global, CTLFLAG_RW, + &ipi_masked_global, 0, ""); +SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_masked_page, CTLFLAG_RW, + &ipi_masked_page, 0, ""); +SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_masked_range, CTLFLAG_RW, + &ipi_masked_range, 0, ""); +SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_masked_range_size, CTLFLAG_RW, + &ipi_masked_range_size, 0, ""); +#endif /* COUNT_XINVLTLB_HITS */ + +/* + * Init and startup IPI. + */ +void +ipi_startup(int apic_id, int vector) +{ + /* * first we do an INIT/RESET IPI this INIT IPI might be run, reseting * and running the target CPU. OR this INIT IPI might be latched (P5 @@ -1031,52 +1085,8 @@ start_ap(int apic_id) vector, apic_id); lapic_ipi_wait(-1); DELAY(200); /* wait ~200uS */ - - /* Wait up to 5 seconds for it to start. */ - for (ms = 0; ms < 5000; ms++) { - if (mp_naps > cpus) - return 1; /* return SUCCESS */ - DELAY(1000); - } - return 0; /* return FAILURE */ } -#ifdef COUNT_XINVLTLB_HITS -u_int xhits_gbl[MAXCPU]; -u_int xhits_pg[MAXCPU]; -u_int xhits_rng[MAXCPU]; -static SYSCTL_NODE(_debug, OID_AUTO, xhits, CTLFLAG_RW, 0, ""); -SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, global, CTLFLAG_RW, &xhits_gbl, - sizeof(xhits_gbl), "IU", ""); -SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, page, CTLFLAG_RW, &xhits_pg, - sizeof(xhits_pg), "IU", ""); -SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, range, CTLFLAG_RW, &xhits_rng, - sizeof(xhits_rng), "IU", ""); - -u_int ipi_global; -u_int ipi_page; -u_int ipi_range; -u_int ipi_range_size; -SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_global, CTLFLAG_RW, &ipi_global, 0, ""); -SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_page, CTLFLAG_RW, &ipi_page, 0, ""); -SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_range, CTLFLAG_RW, &ipi_range, 0, ""); -SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_range_size, CTLFLAG_RW, - &ipi_range_size, 0, ""); - -u_int ipi_masked_global; -u_int ipi_masked_page; -u_int ipi_masked_range; -u_int ipi_masked_range_size; -SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_masked_global, CTLFLAG_RW, - &ipi_masked_global, 0, ""); -SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_masked_page, CTLFLAG_RW, - &ipi_masked_page, 0, ""); -SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_masked_range, CTLFLAG_RW, - &ipi_masked_range, 0, ""); -SYSCTL_UINT(_debug_xhits, OID_AUTO, ipi_masked_range_size, CTLFLAG_RW, - &ipi_masked_range_size, 0, ""); -#endif /* COUNT_XINVLTLB_HITS */ - /* * Send an IPI to specified CPU handling the bitmap logic. */ Modified: head/sys/amd64/include/smp.h ============================================================================== --- head/sys/amd64/include/smp.h Mon Jun 11 23:07:21 2012 (r236937) +++ head/sys/amd64/include/smp.h Tue Jun 12 00:14:54 2012 (r236938) @@ -59,6 +59,7 @@ void cpu_add(u_int apic_id, char boot_cp void cpustop_handler(void); void cpususpend_handler(void); void init_secondary(void); +void ipi_startup(int apic_id, int vector); void ipi_all_but_self(u_int ipi); void ipi_bitmap_handler(struct trapframe frame); void ipi_cpu(int cpu, u_int ipi); Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Mon Jun 11 23:07:21 2012 (r236937) +++ head/sys/i386/i386/mp_machdep.c Tue Jun 12 00:14:54 2012 (r236938) @@ -1081,6 +1081,60 @@ start_ap(int apic_id) /* used as a watchpoint to signal AP startup */ cpus = mp_naps; + ipi_startup(apic_id, vector); + + /* Wait up to 5 seconds for it to start. */ + for (ms = 0; ms < 5000; ms++) { + if (mp_naps > cpus) + return 1; /* return SUCCESS */ + DELAY(1000); + } + return 0; /* return FAILURE */ +} + +#ifdef COUNT_XINVLTLB_HITS +u_int xhits_gbl[MAXCPU]; +u_int xhits_pg[MAXCPU]; +u_int xhits_rng[MAXCPU]; +static SYSCTL_NODE(_debug, OID_AUTO, xhits, CTLFLAG_RW, 0, ""); +SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, global, CTLFLAG_RW, &xhits_gbl, + sizeof(xhits_gbl), "IU", ""); +SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, page, CTLFLAG_RW, &xhits_pg, + sizeof(xhits_pg), "IU", ""); +SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, range, CTLFLAG_RW, &xhits_rng, + sizeof(xhits_rng), "IU", ""); + +u_int ipi_global; +u_int ipi_page; +u_int ipi_range; +u_int ipi_range_size; +SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_global, CTLFLAG_RW, &ipi_global, 0, ""); +SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_page, CTLFLAG_RW, &ipi_page, 0, ""); +SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_range, CTLFLAG_RW, &ipi_range, 0, ""); +SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_range_size, CTLFLAG_RW, &ipi_range_size, + 0, ""); + +u_int ipi_masked_global; +u_int ipi_masked_page; +u_int ipi_masked_range; +u_int ipi_masked_range_size; +SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_global, CTLFLAG_RW, + &ipi_masked_global, 0, ""); +SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_page, CTLFLAG_RW, + &ipi_masked_page, 0, ""); +SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_range, CTLFLAG_RW, + &ipi_masked_range, 0, ""); +SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_range_size, CTLFLAG_RW, + &ipi_masked_range_size, 0, ""); +#endif /* COUNT_XINVLTLB_HITS */ + +/* + * Init and startup IPI. + */ +void +ipi_startup(int apic_id, int vector) +{ + /* * first we do an INIT/RESET IPI this INIT IPI might be run, reseting * and running the target CPU. OR this INIT IPI might be latched (P5 @@ -1131,52 +1185,8 @@ start_ap(int apic_id) vector, apic_id); lapic_ipi_wait(-1); DELAY(200); /* wait ~200uS */ - - /* Wait up to 5 seconds for it to start. */ - for (ms = 0; ms < 5000; ms++) { - if (mp_naps > cpus) - return 1; /* return SUCCESS */ - DELAY(1000); - } - return 0; /* return FAILURE */ } -#ifdef COUNT_XINVLTLB_HITS -u_int xhits_gbl[MAXCPU]; -u_int xhits_pg[MAXCPU]; -u_int xhits_rng[MAXCPU]; -static SYSCTL_NODE(_debug, OID_AUTO, xhits, CTLFLAG_RW, 0, ""); -SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, global, CTLFLAG_RW, &xhits_gbl, - sizeof(xhits_gbl), "IU", ""); -SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, page, CTLFLAG_RW, &xhits_pg, - sizeof(xhits_pg), "IU", ""); -SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, range, CTLFLAG_RW, &xhits_rng, - sizeof(xhits_rng), "IU", ""); - -u_int ipi_global; -u_int ipi_page; -u_int ipi_range; -u_int ipi_range_size; -SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_global, CTLFLAG_RW, &ipi_global, 0, ""); -SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_page, CTLFLAG_RW, &ipi_page, 0, ""); -SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_range, CTLFLAG_RW, &ipi_range, 0, ""); -SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_range_size, CTLFLAG_RW, &ipi_range_size, - 0, ""); - -u_int ipi_masked_global; -u_int ipi_masked_page; -u_int ipi_masked_range; -u_int ipi_masked_range_size; -SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_global, CTLFLAG_RW, - &ipi_masked_global, 0, ""); -SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_page, CTLFLAG_RW, - &ipi_masked_page, 0, ""); -SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_range, CTLFLAG_RW, - &ipi_masked_range, 0, ""); -SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_range_size, CTLFLAG_RW, - &ipi_masked_range_size, 0, ""); -#endif /* COUNT_XINVLTLB_HITS */ - /* * Send an IPI to specified CPU handling the bitmap logic. */ Modified: head/sys/i386/include/smp.h ============================================================================== --- head/sys/i386/include/smp.h Mon Jun 11 23:07:21 2012 (r236937) +++ head/sys/i386/include/smp.h Tue Jun 12 00:14:54 2012 (r236938) @@ -64,6 +64,7 @@ void cpustop_handler(void); void cpususpend_handler(void); #endif void init_secondary(void); +void ipi_startup(int apic_id, int vector); void ipi_all_but_self(u_int ipi); #ifndef XEN void ipi_bitmap_handler(struct trapframe frame); Modified: head/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- head/sys/x86/acpica/acpi_wakeup.c Mon Jun 11 23:07:21 2012 (r236937) +++ head/sys/x86/acpica/acpi_wakeup.c Tue Jun 12 00:14:54 2012 (r236938) @@ -118,49 +118,7 @@ acpi_wakeup_ap(struct acpi_softc *sc, in WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, susppcbs[cpu]->pcb_gdt.rd_base); - /* do an INIT IPI: assert RESET */ - lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE | - APIC_LEVEL_ASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, apic_id); - - /* wait for pending status end */ - lapic_ipi_wait(-1); - - /* do an INIT IPI: deassert RESET */ - lapic_ipi_raw(APIC_DEST_ALLESELF | APIC_TRIGMOD_LEVEL | - APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, 0); - - /* wait for pending status end */ - DELAY(10000); /* wait ~10mS */ - lapic_ipi_wait(-1); - - /* - * next we do a STARTUP IPI: the previous INIT IPI might still be - * latched, (P5 bug) this 1st STARTUP would then terminate - * immediately, and the previously started INIT IPI would continue. OR - * the previous INIT IPI has already run. and this STARTUP IPI will - * run. OR the previous INIT IPI was ignored. and this STARTUP IPI - * will run. - */ - - /* do a STARTUP IPI */ - lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE | - APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_STARTUP | - vector, apic_id); - lapic_ipi_wait(-1); - DELAY(200); /* wait ~200uS */ - - /* - * finally we do a 2nd STARTUP IPI: this 2nd STARTUP IPI should run IF - * the previous STARTUP IPI was cancelled by a latched INIT IPI. OR - * this STARTUP IPI will be ignored, as only ONE STARTUP IPI is - * recognized after hardware RESET or INIT IPI. - */ - - lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE | - APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_STARTUP | - vector, apic_id); - lapic_ipi_wait(-1); - DELAY(200); /* wait ~200uS */ + ipi_startup(apic_id, vector); /* Wait up to 5 seconds for it to resume. */ for (ms = 0; ms < 5000; ms++) { From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 00:47:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DDFEB106564A; Tue, 12 Jun 2012 00:47:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 6E2168FC17; Tue, 12 Jun 2012 00:47:37 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5C0lO44025873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Jun 2012 10:47:26 +1000 Date: Tue, 12 Jun 2012 10:47:24 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hans Petter Selasky In-Reply-To: <201206112221.51793.hselasky@c2i.net> Message-ID: <20120612100540.M1359@besplex.bde.org> References: <201206111921.q5BJL0jP005127@svn.freebsd.org> <20120611200507.GG1399@garage.freebsd.pl> <201206112221.51793.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Pawel Jakub Dawidek Subject: Re: svn commit: r236909 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 00:47:38 -0000 On Mon, 11 Jun 2012, Hans Petter Selasky wrote: > On Monday 11 June 2012 22:05:07 Pawel Jakub Dawidek wrote: >> On Mon, Jun 11, 2012 at 07:21:00PM +0000, Hans Petter Selasky wrote: >>> Log: >>> Use the correct clock source when computing timeouts. >> >> Could you please explain why? As you can see some lines above in >> cv_init(), we initialize condition variable with CLOCK_MONOTONIC too: > > Sorry, this was a mistake clearly. I will revert ASAP. Pointyhat to me. It does seem wrong. Perhaps CLOCK_REALTIME is correct, but the kernel mostly uses CLOCK_MONOTONIC for timeouts. The kernel is mostly wrong here too. > My test program didn't take the setattr into account. > > However, while at it, what is the default clock used by > pthread_cond_timedwait(). In libusb we don't set any clock, and can we depend > on that CLOCK_REALTIME is the default clock used? Else I should probably make > a patch there. Mostly you can depend on CLOCK_MONONTONIC beiing used, even when POSIX explicitly says otherwise. E.g., for nanosleep(). > man pthread_cond_timedwait() is silent! POSIX (draft 2001 version at least) is not silent, but is fuzzy. It has hints that CLOCK_REALTIME is used, and notes the problem with someone stepping the clock: % 32854 Timed Wait Semantics % 32855 An absolute time measure was chosen for specifying the timeout parameter for two reasons. This is about pthread_cond_timedwait()'s parameter. It is an _absolute_ time. % 32856 First, a relative time measure can be easily implemented on top of a function that specifies s/easily/with great difficulty/ if stepping the clock is allowed. s/easily/with difficulty/ if the time interval might contain leap seconds. % 32857 absolute time, but there is a race condition associated with specifying an absolute timeout on top % 32858 of a function that specifies relative timeouts. For example, assume that clock_gettime( ) returns % 32859 the current time and cond_relative_timed_wait( ) uses relative timeouts: % 32860 clock_gettime(CLOCK_REALTIME, &now) % 32861 reltime = sleep_til_this_absolute_time -now; % 32862 cond_relative_timed_wait(c, m, &reltime); % 32863 If the thread is preempted between the first statement and the last statement, the thread blocks % 32864 for too long. Blocking, however, is irrelevant if an absolute timeout is used. An absolute timeout % 32865 also need not be recomputed if it is used multiple times in a loop, such as that enclosing a % 32866 condition wait. Elsewhere, POSIX specifies clock_nanosleep() to have a clock id arg and a TIMER_ABSTIME flag, so that you can control and know which clock you are getting and whether the timer is absolute. This fixes related API problems with nanosleep(). But FreeBSD doesn't implement clock_nanosleep(), and for pthread_cond_timedwait(), there seems to be no choice, and CLOCK_REALTIME makes most sense if only 1 clock id is supported. % 32867 For cases when the system clock is advanced discontinuously by an operator, it is expected that % 32868 implementations process any timed wait expiring at an intervening time as if that time had % 32869 actually occurred. Since an operator is not permitted to advance CLOCK_MONOTONIC, at least via any POSIX API, this is apparently talking about CLOCK_REALTIME. It doesn't say what happens if the operator retarded the system clock discontinuously. I think the following should happen: the timer expires as soon as possible after `abstime' is first reached. (This will just be later than if the system clock was not retarded.) If the system clock was stepped forth and back, then the same rule applies (if any advance went past `abstime', then the timer expires, even if the clock is immediately stepped back. The worst cases of this shouldn't happen). Also, if the system or its clock was stopped when `abstime' would have been reached if they were not stopped, then the system is not required to start so as to deliver the timeout sooner than would be possible if it didn't restart, unless this is a magic timer for reastating systems. Absolute times make most sense with CLOCK_REALTIME, but they would mostly work OK or better with CLOCK_MONOTONIC, if that worked correctly. It doesn't, since it is relative to a variable time in the past although POSIX requires it to be relative to a fixed time in the past. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 02:53:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 402F3106566B; Tue, 12 Jun 2012 02:53:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id B64258FC1B; Tue, 12 Jun 2012 02:53:53 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5C2rmUN026543 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Jun 2012 12:53:51 +1000 Date: Tue, 12 Jun 2012 12:53:47 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <201206112017.q5BKHKsW007722@svn.freebsd.org> Message-ID: <20120612114254.V1572@besplex.bde.org> References: <201206112017.q5BKHKsW007722@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236917 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 02:53:54 -0000 On Mon, 11 Jun 2012, Pawel Jakub Dawidek wrote: > Log: > Use consistent way of checking if descriptor number is valid. > > MFC after: 1 month > > Modified: > head/sys/kern/kern_descrip.c > > Modified: head/sys/kern/kern_descrip.c > ============================================================================== > --- head/sys/kern/kern_descrip.c Mon Jun 11 20:12:13 2012 (r236916) > +++ head/sys/kern/kern_descrip.c Mon Jun 11 20:17:20 2012 (r236917) > @@ -245,7 +245,7 @@ fd_last_used(struct filedesc *fdp, int l > static int > fdisused(struct filedesc *fdp, int fd) > { > - KASSERT(fd >= 0 && fd < fdp->fd_nfiles, > + KASSERT((unsigned int)fd < fdp->fd_nfiles, > ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); > return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); > } This is backwards. Apart from using the worst possible (most verbose) spelling of `unsigned', it uses a type hack manually optimize away the test for fd being < 0. The compiler will do this "optimization" automatically if it is any good (or undo it if it is not), so all the hack does is obfuscate the test. With the verbose spelling of u_int, it even takes more space. > @@ -2212,7 +2212,7 @@ fget_unlocked(struct filedesc *fdp, int > struct file *fp; > u_int count; > > - if (fd < 0 || fd >= fdp->fd_nfiles) > + if ((unsigned int)fd >= fdp->fd_nfiles) > return (NULL); > /* > * Fetch the descriptor locklessly. We avoid fdrop() races by > @@ -2598,7 +2598,7 @@ dupfdopen(struct thread *td, struct file > * closed, then reject. > */ > FILEDESC_XLOCK(fdp); > - if (dfd < 0 || dfd >= fdp->fd_nfiles || > + if ((unsigned int)dfd >= fdp->fd_nfiles || > (wfp = fdp->fd_ofiles[dfd]) == NULL) { > FILEDESC_XUNLOCK(fdp); > return (EBADF); > Similarly. Old code from 4.4BSD uses the hack quite often, but this was mostly fixed: 4.4BSD-Lite2 kern_descrip.c: 12 instances of u_int 7 of the 12 for this type hack 0 instances where `unsigned' is misspelled as itself 0 instances where `unsigned' is misspelled as `unsigned int' FreeBSD-3 kern_descrip.c: 7 instances of u_int 1 of the 7 for this type hack 8 instances where `unsigned' is misspelled as itself 8 of the 8 for this type hack 0 instances where `unsigned' is misspelled as `unsigned int' The apparent regression from u_int to unsigned was actually a fix in Lite2: - Lite1 misspelled `unsigned' as itself, except in 1 of the type hacks - FreeBSD-3 was essentially the Lite1 version - Lite2 changed everything to use the correct spelling. FreeBSD-4 kern_descrip.c: Same as FreeBSD-4 (it hadn't caught up with Lite2). FreeBSD-5 kern_descrip.c: 5 instances of u_int 0 of the 5 for this type hack 3 instances where `unsigned' is misspelled as itself 3 of the 3 for this type hack 1 of the 3 misformatted with a space after the cast 0 instances where `unsigned' is misspelled as `unsigned int' Very few instances where an fd is compared with '< 0'. Just some where the upper limit is not checked nearby, so the type hack doesn't even apply. Some instances moved to filedesc.h. There seems to be only 1 there now. You regressed this too, back to worse than it was in Lite1 (it now uses `unsigned int', but regression to Lite1 would have made it use `unsigned'). It used to be correct, but it took several rounds of churning to fix it there: - when fget_locked() was first moved there in 2002, it had a bogus cast to u_int on 1 of the fd's, but still had the correct check for < 0, and no bogus case on the fd for that. The other bogus cast has no effect. - I asked someone to fix this, but the result was a larger mess, with the type hack in the code (but with the correct spelling of u_int), and a verbose comment describing the hack. - I eventually fixed this in 2004. The log message says doesn't have as much detail as this mail. It only says "Don't manually optimize for 20 year old compilers ...". Now it uses the type hack again. The 20 year old compilers are 28 years old now. FreeBSD-current-April-10-2012 kern_descrip.c: 7 instances of u_int 0 of the 7 for this type hack 3 instances where `unsigned' is misspelled as itself 3 of the 3 for this type hack 1 of the 3 misformatted with a space after the cast 2 instances where `unsigned' is misspelled as `unsigned int' 0 of the 2 for this type hack The above 3 instances where an fd is compared with '< 0' instead of using the type hack. FreeBSD-current kern_descrip.c: 7 instances of u_int 0 of the 7 for this type hack 3 instances where `unsigned' is misspelled as itself 3 of the 3 for this type hack 1 of the 3 misformatted with a space after the cast 6 instances where `unsigned' is misspelled as `unsigned int' 4 of the 6 for this type hack (in one of these, the cast is redundant since the rvalue already has type u_int) No instances where an fd is compared with '< 0' in preference to using the type hack. In some places, the hack is done in a much worse way, by type punning the syscall arg. E.g., in Lite2 and FreeBSD-3, at least dup() and dup2() are misdeclared as taking u_int filedescriptor args instead of the actual int args. The code could depend on this, but actually duplicates the type pun by copying the args to local variables with the bogus u_int type. Then it depends on the type hack (but written without the cast) for checking the lower limit. select() was similarly obfuscated. In Lite2, its nd arg is misdeclared as u_int in syscalls.master, and was copied to a u_int variable which was explicitly compared only against the upper limit. This is fixed in FreeBSD-3. The type hack doesn't even work for the relaxed check on the upper limit in FreeBSD-3. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 03:49:54 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6503C1065673; Tue, 12 Jun 2012 03:49:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id DCDF58FC14; Tue, 12 Jun 2012 03:49:53 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5C3nYPJ014984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Jun 2012 13:49:35 +1000 Date: Tue, 12 Jun 2012 13:49:33 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hans Petter Selasky In-Reply-To: <201206112359.41892.hselasky@c2i.net> Message-ID: <20120612130912.O1895@besplex.bde.org> References: <20120611200507.GG1399@garage.freebsd.pl> <201206112221.51793.hselasky@c2i.net> <201206112359.41892.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Pawel Jakub Dawidek Subject: Re: svn commit: r236909 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 03:49:54 -0000 On Mon, 11 Jun 2012, Hans Petter Selasky wrote: > On Monday 11 June 2012 22:21:51 Hans Petter Selasky wrote: >> On Monday 11 June 2012 22:05:07 Pawel Jakub Dawidek wrote: >>> On Mon, Jun 11, 2012 at 07:21:00PM +0000, Hans Petter Selasky wrote: >>>> Author: hselasky >>>> Date: Mon Jun 11 19:20:59 2012 >>>> New Revision: 236909 >>>> URL: http://svn.freebsd.org/changeset/base/236909 >>>> >>>> Log: >>>> Use the correct clock source when computing timeouts. >>> >>> Could you please explain why? As you can see some lines above in >> >>> cv_init(), we initialize condition variable with CLOCK_MONOTONIC too: >> Sorry, this was a mistake clearly. I will revert ASAP. Pointyhat to me. >> >> My test program didn't take the setattr into account. >> >> However, while at it, what is the default clock used by >> pthread_cond_timedwait(). In libusb we don't set any clock, and can we >> depend on that CLOCK_REALTIME is the default clock used? Else I should >> probably make a patch there. >> >> man pthread_cond_timedwait() is silent! > Some more questions: > > While doing my test, I traced pthread_cond_timedwait() into > "./kern/kern_umtx.c" where the time is subtracted again, so the actual time > value is not that important, but there are some other problems: > > If the time structure argument passed to pthread_cond_timedwait() in 9-stable > is negative, for example the seconds field, the above mentioned function will > just return! See ./libkse/thread/thr_cond.c Inconsistent clock ids might do that. > int > _pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, > const struct timespec * abstime) > { > struct pthread *curthread = _get_curthread(); > int rval = 0; > int done = 0; > int mutex_locked = 1; > int seqno; > > THR_ASSERT(curthread->locklevel == 0, > "cv_timedwait: locklevel is not zero!"); > > if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 || > abstime->tv_nsec >= 1000000000) > return (EINVAL); I don't really understand this code, but just looked at it a bit. There is a clock id in it somewhere, though not part of the pthread_cond_timedwait() API. Apparently you need to set its clock id separarely. According to hastd code, the other separate function is pthread_condattr_setclock(), which hastd::cv_int() uses to set CLOCK_MONOTONIC. I said in another reply that the clock id must be CLOCK_MONONTONIC because that is the only one supported, but this code apparently supports multiple clock ids, and kernel "realtime" timer code tries to support CLOCK_MONOTONIC and CLOCK_REALTIME and TIMER_ABSTIME, although clock_nanosleep() is missing. The problems with CLOCK_REALTIME come later, because the lowest levels of timeout code only support buggy monotonic time. > CLOCK_MONOTONIC: 18077 (seconds) > CLOCK_REALTIME: 1339451481 (seconds) > > CLOCK_REALTIME will at some point become negative. Will libusb's timeout The point is in 2038, on systems with 32-bit signed time_t's. None should exist then. Even if time_t is 32 bits, it can be unsigned, and never become negative, and work until 2106. Changing time_t from signed to unsigned would break mainly times before the Epoch, which are invalid for current times anyway, and expose broken code which assumes that time_t is signed. > functionality stop working then, because pthread_cond_timedwait() has a check > for negative time? This check is just to prevent invalid times. It does prevents hacks like the kernel treating negative times as large unsigned ones so that the result is much the same as changing time_t to unsigned, without actually changing time_t. > Or is hastd wrong, that it can compute a timeout offset which is outside the > valid range, because it uses a simple: > > tv_sec += timeout? > tv_sec %= 1000000000; /* Is this perhaps missing in hastd and other drivers > ???? */ > > What is the modulus which should be used for tv_sec? `tv_sec %= ANY' makes no sense. With CLOCK_MONOTONIC, signed 32-bit time_t's work for 86 years after the unspecified point in the past that CLOCK_MONOTONIC is relative to. This should be enough for anyone, provided the unspecified point is the boot time. hastd also uses mostly-relative, mostly-monotonic, often 32-bit signed in timeouts internally. E.g., in the function that seems to be causing problems: % static __inline bool % cv_timedwait(pthread_cond_t *cv, pthread_mutex_t *lock, int timeout) % { % struct timespec ts; % int error; % % if (timeout == 0) { % cv_wait(cv, lock); % return (false); % } % % error = clock_gettime(CLOCK_MONOTONIC, &ts); Style bug (corrupt tab in Oct 22 2011 version). % PJDLOG_ASSERT(error == 0); % ts.tv_sec += timeout; This converts to absolute monotonic time. Even a 16-bit signed int is probably enough for `timeout'. % error = pthread_cond_timedwait(cv, lock, &ts); % PJDLOG_ASSERT(error == 0 || error == ETIMEDOUT); % return (error == ETIMEDOUT); % } I don't see any bugs here. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 06:16:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 004401065676; Tue, 12 Jun 2012 06:16:15 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id B2EDB8FC19; Tue, 12 Jun 2012 06:16:15 +0000 (UTC) Received: by dadv36 with SMTP id v36so6737686dad.13 for ; Mon, 11 Jun 2012 23:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=p1FiJ/tXQw7MX0XdfFjSnY3HsTKUH/AJ2/qFSjq0HBA=; b=ywsEc80HcJ2jbC4W/4ThLNYbGG1TuBnUE2YUC39Aslu+YhVLUpaIaeJPUfR0M+anTo wVhSL2lm62LZI1d74SVzQEsGslg7pQ3VEKVBN+GBOk91qDLY0ybGYgnS+CDkpW8QrWm5 aQbKJ+AgcIDKeFlQ5NbgcuhkG7WwgDw1fG9IrzlCPeEMya8YfgOLvGbFzf1BqIGO7PGi gxEoqCDqiUzvbf2fB3NNp2BR7Eq60wgpk/9/CKPud/f1s8OYzLsTPgVVQ4iJ6AxR11o2 wlazDI5Bg4rRG0HbJtUeCoK49FNTe3XMvhXRxDNj8oa0dcn15tMXRuRsRdH+puybvsnV RnXA== MIME-Version: 1.0 Received: by 10.68.138.169 with SMTP id qr9mr6051694pbb.27.1339481775469; Mon, 11 Jun 2012 23:16:15 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.143.91.18 with HTTP; Mon, 11 Jun 2012 23:16:15 -0700 (PDT) In-Reply-To: <201206022000.q52K0qRY010979@svn.freebsd.org> References: <201206022000.q52K0qRY010979@svn.freebsd.org> Date: Mon, 11 Jun 2012 23:16:15 -0700 X-Google-Sender-Auth: YKwJvYom7OEpCOPNZ1T9HhCrgkA Message-ID: From: Adrian Chadd To: Marius Strobl Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236489 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 06:16:16 -0000 Hi, The reason I hadn't (yet) looked at updating this for wireless devices is because I do most of my testing of -HEAD drivers on -9. nitems() isn't there. I was kind of hoping I wouldn't need to introduce a compat-wireless style layer.. :) Adrian From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 06:41:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92855106564A; Tue, 12 Jun 2012 06:41:37 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 26C758FC0A; Tue, 12 Jun 2012 06:41:36 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5C6fT2Q056307; Tue, 12 Jun 2012 08:41:29 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5C6fTb7056306; Tue, 12 Jun 2012 08:41:29 +0200 (CEST) (envelope-from marius) Date: Tue, 12 Jun 2012 08:41:29 +0200 From: Marius Strobl To: Adrian Chadd Message-ID: <20120612064129.GE46065@alchemy.franken.de> References: <201206022000.q52K0qRY010979@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Marius Strobl , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r236489 - head/sys/dev/iwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 06:41:37 -0000 On Mon, Jun 11, 2012 at 11:16:15PM -0700, Adrian Chadd wrote: > Hi, > > The reason I hadn't (yet) looked at updating this for wireless devices > is because I do most of my testing of -HEAD drivers on -9. > > nitems() isn't there. > > I was kind of hoping I wouldn't need to introduce a compat-wireless > style layer.. :) > Sorry, I don't get what you are trying to say, nitems() is in stable/9. Marius From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 07:28:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1629C106564A; Tue, 12 Jun 2012 07:28:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB5108FC16; Tue, 12 Jun 2012 07:28:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C7SPAY036993; Tue, 12 Jun 2012 07:28:25 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C7SPZ7036989; Tue, 12 Jun 2012 07:28:25 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206120728.q5C7SPZ7036989@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 12 Jun 2012 07:28:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236944 - head/lib/libusb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 07:28:26 -0000 Author: hselasky Date: Tue Jun 12 07:28:25 2012 New Revision: 236944 URL: http://svn.freebsd.org/changeset/base/236944 Log: LibUSB v1.0 API compiliance and bugfixes. - Use CLOCK_MONOTONIC instead of CLOCK_REALTIME, because CLOCK_MONOTONIC does not wrap into negative in near future. This fixes any potential problems using "pthread_cond_timedwait()". - Fix a bug where the "libusb_wait_for_event()" function computes an absolute timeout instead of a relative timeout. USB transfers do not depend on this timeout value. - Add dependency towards LibPthread to Makefile, because LibUSB v1.0 needs this library to function correctly. MFC after: 1 week Modified: head/lib/libusb/Makefile head/lib/libusb/libusb10.c head/lib/libusb/libusb10_io.c Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Tue Jun 12 04:58:52 2012 (r236943) +++ head/lib/libusb/Makefile Tue Jun 12 07:28:25 2012 (r236944) @@ -18,6 +18,9 @@ NOGCCERROR= WARNS?= 2 +DPADD= ${LIBPTHREAD} +LDADD= -lpthread + MLINKS+= libusb.3 usb.3 # libusb 0.1 compat Modified: head/lib/libusb/libusb10.c ============================================================================== --- head/lib/libusb/libusb10.c Tue Jun 12 04:58:52 2012 (r236943) +++ head/lib/libusb/libusb10.c Tue Jun 12 07:28:25 2012 (r236944) @@ -92,6 +92,7 @@ int libusb_init(libusb_context **context) { struct libusb_context *ctx; + pthread_condattr_t attr; char *debug; int ret; @@ -110,8 +111,28 @@ libusb_init(libusb_context **context) TAILQ_INIT(&ctx->pollfds); TAILQ_INIT(&ctx->tr_done); - pthread_mutex_init(&ctx->ctx_lock, NULL); - pthread_cond_init(&ctx->ctx_cond, NULL); + if (pthread_mutex_init(&ctx->ctx_lock, NULL) != 0) { + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + if (pthread_condattr_init(&attr) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + if (pthread_condattr_setclock(&attr, CLOCK_MONOTONIC) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + pthread_condattr_destroy(&attr); + free(ctx); + return (LIBUSB_ERROR_OTHER); + } + if (pthread_cond_init(&ctx->ctx_cond, &attr) != 0) { + pthread_mutex_destroy(&ctx->ctx_lock); + pthread_condattr_destroy(&attr); + free(ctx); + return (LIBUSB_ERROR_NO_MEM); + } + pthread_condattr_destroy(&attr); ctx->ctx_handler = NO_THREAD; Modified: head/lib/libusb/libusb10_io.c ============================================================================== --- head/lib/libusb/libusb10_io.c Tue Jun 12 04:58:52 2012 (r236943) +++ head/lib/libusb/libusb10_io.c Tue Jun 12 07:28:25 2012 (r236944) @@ -307,12 +307,16 @@ libusb_wait_for_event(libusb_context *ct &ctx->ctx_lock); return (0); } - err = clock_gettime(CLOCK_REALTIME, &ts); + err = clock_gettime(CLOCK_MONOTONIC, &ts); if (err < 0) return (LIBUSB_ERROR_OTHER); - ts.tv_sec = tv->tv_sec; - ts.tv_nsec = tv->tv_usec * 1000; + /* + * The "tv" arguments points to a relative time structure and + * not an absolute time structure. + */ + ts.tv_sec += tv->tv_sec; + ts.tv_nsec += tv->tv_usec * 1000; if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec++; From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 07:43:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CAEE106564A; Tue, 12 Jun 2012 07:43:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F420F8FC0C; Tue, 12 Jun 2012 07:43:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C7h1uu037621; Tue, 12 Jun 2012 07:43:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C7h1rm037619; Tue, 12 Jun 2012 07:43:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201206120743.q5C7h1rm037619@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 12 Jun 2012 07:43:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236945 - stable/8/sys/dev/jme X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 07:43:02 -0000 Author: yongari Date: Tue Jun 12 07:43:01 2012 New Revision: 236945 URL: http://svn.freebsd.org/changeset/base/236945 Log: MFC r236700: Fix a logic error when use PCIY_PMG capability Modified: stable/8/sys/dev/jme/if_jme.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/jme/if_jme.c ============================================================================== --- stable/8/sys/dev/jme/if_jme.c Tue Jun 12 07:28:25 2012 (r236944) +++ stable/8/sys/dev/jme/if_jme.c Tue Jun 12 07:43:01 2012 (r236945) @@ -1669,7 +1669,7 @@ jme_resume(device_t dev) sc = device_get_softc(dev); JME_LOCK(sc); - if (pci_find_extcap(sc->jme_dev, PCIY_PMG, &pmc) != 0) { + if (pci_find_extcap(sc->jme_dev, PCIY_PMG, &pmc) == 0) { pmstat = pci_read_config(sc->jme_dev, pmc + PCIR_POWER_STATUS, 2); /* Disable PME clear PME status. */ From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 07:52:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7FD11065672; Tue, 12 Jun 2012 07:52:12 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id BF6DE8FC0C; Tue, 12 Jun 2012 07:52:11 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 285995802; Tue, 12 Jun 2012 09:52:09 +0200 From: Hans Petter Selasky To: Bruce Evans Date: Tue, 12 Jun 2012 09:51:38 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <201206112359.41892.hselasky@c2i.net> <20120612130912.O1895@besplex.bde.org> In-Reply-To: <20120612130912.O1895@besplex.bde.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201206120951.38492.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Pawel Jakub Dawidek Subject: Re: svn commit: r236909 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 07:52:13 -0000 On Tuesday 12 June 2012 05:49:33 Bruce Evans wrote: > On Mon, 11 Jun 2012, Hans Petter Selasky wrote: > > On Monday 11 June 2012 22:21:51 Hans Petter Selasky wrote: > >> On Monday 11 June 2012 22:05:07 Pawel Jakub Dawidek wrote: > >>> On Mon, Jun 11, 2012 at 07:21:00PM +0000, Hans Petter Selasky wrote: > >>>> Author: hselasky > >>>> Date: Mon Jun 11 19:20:59 2012 > >>>> New Revision: 236909 > >>>> URL: http://svn.freebsd.org/changeset/base/236909 > >>>> > Hi, > The point is in 2038, on systems with 32-bit signed time_t's. None > should exist then. Even if time_t is 32 bits, it can be unsigned, and > never become negative, and work until 2106. Changing time_t from > signed to unsigned would break mainly times before the Epoch, which > are invalid for current times anyway, and expose broken code which > assumes that time_t is signed. Lets assume you need to reboot the system at some point and that solves the problem. > > > functionality stop working then, because pthread_cond_timedwait() has a > > check for negative time? > > This check is just to prevent invalid times. It does prevents hacks like > the kernel treating negative times as large unsigned ones so that the > result is much the same as changing time_t to unsigned, without actually > changing time_t. > > > Or is hastd wrong, that it can compute a timeout offset which is outside > > the valid range, because it uses a simple: > > > > tv_sec += timeout? > > tv_sec %= 1000000000; /* Is this perhaps missing in hastd and other > > drivers ???? */ > > > > What is the modulus which should be used for tv_sec? > > `tv_sec %= ANY' makes no sense. > > With CLOCK_MONOTONIC, signed 32-bit time_t's work for 86 years after the > unspecified point in the past that CLOCK_MONOTONIC is relative to. This > should be enough for anyone, provided the unspecified point is the boot > time. hastd also uses mostly-relative, mostly-monotonic, often 32-bit > signed in timeouts internally. E.g., in the function that seems to be > causing problems: > When CLOCK_REALTIME finally goes negative, then pthread_cond_timedwait() will simply return an error code, due to the negative tv_sec check in there! I see other clients like sendmail, using even simpler formats like: tv_nsec = 0; tv_sec = time(NULL); If this piece of code stops working at a given data, regardless of uptime, shouldn't that be fixed now? > % static __inline bool > % cv_timedwait(pthread_cond_t *cv, pthread_mutex_t *lock, int timeout) > % { > % struct timespec ts; > % int error; > % > % if (timeout == 0) { > % cv_wait(cv, lock); > % return (false); > % } > % > % error = clock_gettime(CLOCK_MONOTONIC, &ts); > > Style bug (corrupt tab in Oct 22 2011 version). I think I fixed this style bug when reverting. > > % PJDLOG_ASSERT(error == 0); > % ts.tv_sec += timeout; > > This converts to absolute monotonic time. Even a 16-bit signed int is > probably enough for `timeout'. > > % error = pthread_cond_timedwait(cv, lock, &ts); > % PJDLOG_ASSERT(error == 0 || error == ETIMEDOUT); > % return (error == ETIMEDOUT); > % } > > I don't see any bugs here. Thanks for feedback Bruce. A final question on the matter: I tried to use CLOCK_MONOTONIC_FAST when setting up the condition variable. That did not appear to be support in 9-stable. Is there a list of supported clocks anywhere? --HPS From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 07:53:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8F96106564A; Tue, 12 Jun 2012 07:53:39 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 937DD8FC08; Tue, 12 Jun 2012 07:53:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C7rdQ5038110; Tue, 12 Jun 2012 07:53:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C7rdHs038108; Tue, 12 Jun 2012 07:53:39 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201206120753.q5C7rdHs038108@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 12 Jun 2012 07:53:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236946 - stable/8/sys/dev/ae X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 07:53:39 -0000 Author: yongari Date: Tue Jun 12 07:53:39 2012 New Revision: 236946 URL: http://svn.freebsd.org/changeset/base/236946 Log: MFC 236649,236670: Check the return value of pci_find_extcap() Modified: stable/8/sys/dev/ae/if_ae.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/dev/ae/if_ae.c ============================================================================== --- stable/8/sys/dev/ae/if_ae.c Tue Jun 12 07:43:01 2012 (r236945) +++ stable/8/sys/dev/ae/if_ae.c Tue Jun 12 07:53:39 2012 (r236946) @@ -1382,12 +1382,13 @@ ae_pm_init(ae_softc_t *sc) /* * Configure PME. */ - pci_find_extcap(sc->dev, PCIY_PMG, &pmc); - pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); - pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); - if ((ifp->if_capenable & IFCAP_WOL) != 0) - pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; - pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + if (pci_find_extcap(sc->dev, PCIY_PMG, &pmc) == 0) { + pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2); + pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if ((ifp->if_capenable & IFCAP_WOL) != 0) + pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + } } static int From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 08:08:34 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25BA2106564A; Tue, 12 Jun 2012 08:08:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 073278FC18; Tue, 12 Jun 2012 08:08:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C88X4g038797; Tue, 12 Jun 2012 08:08:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C88XWK038792; Tue, 12 Jun 2012 08:08:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206120808.q5C88XWK038792@svn.freebsd.org> From: Alexander Motin Date: Tue, 12 Jun 2012 08:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236947 - in stable/9/sys/dev: ahci ata mvs siis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 08:08:34 -0000 Author: mav Date: Tue Jun 12 08:08:33 2012 New Revision: 236947 URL: http://svn.freebsd.org/changeset/base/236947 Log: MFC r236847: Partially revert r236666: Return PROTO_ATA protocol in response to XPT_PATH_INQ. smartmontools uses it to identify ATA devices and I don't know any other place now where it is important. It could probably use XPT_GDEV_TYPE instead for more accurate protocol information, but let it live for now. Modified: stable/9/sys/dev/ahci/ahci.c stable/9/sys/dev/ata/ata-all.c stable/9/sys/dev/mvs/mvs.c stable/9/sys/dev/siis/siis.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Tue Jun 12 07:53:39 2012 (r236946) +++ stable/9/sys/dev/ahci/ahci.c Tue Jun 12 08:08:33 2012 (r236947) @@ -2967,7 +2967,7 @@ ahciaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ Modified: stable/9/sys/dev/ata/ata-all.c ============================================================================== --- stable/9/sys/dev/ata/ata-all.c Tue Jun 12 07:53:39 2012 (r236946) +++ stable/9/sys/dev/ata/ata-all.c Tue Jun 12 08:08:33 2012 (r236947) @@ -1875,7 +1875,7 @@ ataaction(struct cam_sim *sim, union ccb else cpi->transport = XPORT_ATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; if (device_get_devclass(device_get_parent(parent)) == Modified: stable/9/sys/dev/mvs/mvs.c ============================================================================== --- stable/9/sys/dev/mvs/mvs.c Tue Jun 12 07:53:39 2012 (r236946) +++ stable/9/sys/dev/mvs/mvs.c Tue Jun 12 08:08:33 2012 (r236947) @@ -2385,7 +2385,7 @@ mvsaction(struct cam_sim *sim, union ccb cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; if ((ch->quirks & MVS_Q_SOC) == 0) { Modified: stable/9/sys/dev/siis/siis.c ============================================================================== --- stable/9/sys/dev/siis/siis.c Tue Jun 12 07:53:39 2012 (r236946) +++ stable/9/sys/dev/siis/siis.c Tue Jun 12 08:08:33 2012 (r236947) @@ -1960,7 +1960,7 @@ siisaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; cpi->hba_vendor = pci_get_vendor(parent); From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 08:10:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 668851065670; Tue, 12 Jun 2012 08:10:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 474308FC18; Tue, 12 Jun 2012 08:10:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C8AFk1038924; Tue, 12 Jun 2012 08:10:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C8AFgn038919; Tue, 12 Jun 2012 08:10:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206120810.q5C8AFgn038919@svn.freebsd.org> From: Alexander Motin Date: Tue, 12 Jun 2012 08:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236948 - in stable/8/sys/dev: ahci ata mvs siis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 08:10:15 -0000 Author: mav Date: Tue Jun 12 08:10:14 2012 New Revision: 236948 URL: http://svn.freebsd.org/changeset/base/236948 Log: MFC r236847: Partially revert r236666: Return PROTO_ATA protocol in response to XPT_PATH_INQ. smartmontools uses it to identify ATA devices and I don't know any other place now where it is important. It could probably use XPT_GDEV_TYPE instead for more accurate protocol information, but let it live for now. Modified: stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/ata-all.c stable/8/sys/dev/mvs/mvs.c stable/8/sys/dev/siis/siis.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Tue Jun 12 08:08:33 2012 (r236947) +++ stable/8/sys/dev/ahci/ahci.c Tue Jun 12 08:10:14 2012 (r236948) @@ -2963,7 +2963,7 @@ ahciaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ Modified: stable/8/sys/dev/ata/ata-all.c ============================================================================== --- stable/8/sys/dev/ata/ata-all.c Tue Jun 12 08:08:33 2012 (r236947) +++ stable/8/sys/dev/ata/ata-all.c Tue Jun 12 08:10:14 2012 (r236948) @@ -1873,7 +1873,7 @@ ataaction(struct cam_sim *sim, union ccb else cpi->transport = XPORT_ATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS; cpi->ccb_h.status = CAM_REQ_CMP; Modified: stable/8/sys/dev/mvs/mvs.c ============================================================================== --- stable/8/sys/dev/mvs/mvs.c Tue Jun 12 08:08:33 2012 (r236947) +++ stable/8/sys/dev/mvs/mvs.c Tue Jun 12 08:10:14 2012 (r236948) @@ -2383,7 +2383,7 @@ mvsaction(struct cam_sim *sim, union ccb cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->maxio = MAXPHYS; cpi->ccb_h.status = CAM_REQ_CMP; Modified: stable/8/sys/dev/siis/siis.c ============================================================================== --- stable/8/sys/dev/siis/siis.c Tue Jun 12 08:08:33 2012 (r236947) +++ stable/8/sys/dev/siis/siis.c Tue Jun 12 08:10:14 2012 (r236948) @@ -1964,7 +1964,7 @@ siisaction(struct cam_sim *sim, union cc cpi->unit_number = cam_sim_unit(sim); cpi->transport = XPORT_SATA; cpi->transport_version = XPORT_VERSION_UNSPECIFIED; - cpi->protocol = PROTO_UNSPECIFIED; + cpi->protocol = PROTO_ATA; cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; cpi->ccb_h.status = CAM_REQ_CMP; cpi->maxio = MAXPHYS; From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 08:26:35 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B4F0C1065673; Tue, 12 Jun 2012 08:26:35 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 855EF8FC08; Tue, 12 Jun 2012 08:26:35 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5C8QXUn088231; Tue, 12 Jun 2012 08:26:34 GMT (envelope-from listlog2011@gmail.com) Message-ID: <4FD6FD39.5090800@gmail.com> Date: Tue, 12 Jun 2012 16:26:33 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201206112205.q5BM5QIv013266@svn.freebsd.org> In-Reply-To: <201206112205.q5BM5QIv013266@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@FreeBSD.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 08:26:35 -0000 On 2012/6/12 6:05, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Jun 11 22:05:26 2012 > New Revision: 236935 > URL: http://svn.freebsd.org/changeset/base/236935 > > Log: > fdgrowtable() no longer drops the filedesc lock so it is enough to > retry finding free file descriptor only once after fdgrowtable(). > > Spotted by: pluknet > MFC after: 1 month > > Modified: > head/sys/kern/kern_descrip.c > > Modified: head/sys/kern/kern_descrip.c > ============================================================================== > --- head/sys/kern/kern_descrip.c Mon Jun 11 21:56:37 2012 (r236934) > +++ head/sys/kern/kern_descrip.c Mon Jun 11 22:05:26 2012 (r236935) > @@ -1478,29 +1478,33 @@ fdalloc(struct thread *td, int minfd, in > /* > * Search the bitmap for a free descriptor. If none is found, try > * to grow the file table. Keep at it until we either get a file > - * descriptor or run into process or system limits; fdgrowtable() > - * may drop the filedesc lock, so we're in a race. > + * descriptor or run into process or system limits. > */ > - for (;;) { > - fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); > - if (fd>= maxfd) > - return (EMFILE); > - if (fd< fdp->fd_nfiles) > - break; > + fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); > + if (fd>= maxfd) > + return (EMFILE); > + if (fd>= fdp->fd_nfiles) { > #ifdef RACCT > PROC_LOCK(p); > - error = racct_set(p, RACCT_NOFILE, min(fdp->fd_nfiles * 2, maxfd)); > + error = racct_set(p, RACCT_NOFILE, > + min(fdp->fd_nfiles * 2, maxfd)); > PROC_UNLOCK(p); > if (error != 0) > return (EMFILE); > #endif > fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd)); > + /* Retry... */ > + fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); > + if (fd>= maxfd) > + return (EMFILE); > } > > /* > * Perform some sanity checks, then mark the file descriptor as > * used and return it to the caller. > */ > + KASSERT((unsigned int)fd< min(maxfd, fdp->fd_nfiles), > + ("invalid descriptor %d", fd)); > KASSERT(!fdisused(fdp, fd), > ("fd_first_free() returned non-free descriptor")); > KASSERT(fdp->fd_ofiles[fd] == NULL, ("file descriptor isn't free")); > My machine crashed with this change. http://people.freebsd.org/~davidxu/fdcrash.jpg Regards, From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 09:18:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE067106564A; Tue, 12 Jun 2012 09:18:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9AC68FC08; Tue, 12 Jun 2012 09:18:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5C9IScL041798; Tue, 12 Jun 2012 09:18:28 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5C9ISrd041796; Tue, 12 Jun 2012 09:18:28 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206120918.q5C9ISrd041796@svn.freebsd.org> From: Michael Tuexen Date: Tue, 12 Jun 2012 09:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236949 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 09:18:28 -0000 Author: tuexen Date: Tue Jun 12 09:18:28 2012 New Revision: 236949 URL: http://svn.freebsd.org/changeset/base/236949 Log: Small cleanup. MFC after: 3 days Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Tue Jun 12 08:10:14 2012 (r236948) +++ head/sys/netinet/sctputil.c Tue Jun 12 09:18:28 2012 (r236949) @@ -2573,15 +2573,13 @@ sctp_pad_lastmbuf(struct mbuf *m, int pa /* find the last mbuf in chain and pad it */ struct mbuf *m_at; - m_at = m; if (last_mbuf) { return (sctp_add_pad_tombuf(last_mbuf, padval)); } else { - while (m_at) { + for (m_at = m; m_at; m_at = SCTP_BUF_NEXT(m_at)) { if (SCTP_BUF_NEXT(m_at) == NULL) { return (sctp_add_pad_tombuf(m_at, padval)); } - m_at = SCTP_BUF_NEXT(m_at); } } SCTP_LTRACE_ERR_RET_PKT(m, NULL, NULL, NULL, SCTP_FROM_SCTPUTIL, EFAULT); From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 09:21:29 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95F84106566B; Tue, 12 Jun 2012 09:21:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 959B48FC14; Tue, 12 Jun 2012 09:21:28 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5C9L5QW012158 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Jun 2012 19:21:07 +1000 Date: Tue, 12 Jun 2012 19:21:05 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hans Petter Selasky In-Reply-To: <201206120951.38492.hselasky@c2i.net> Message-ID: <20120612183547.C2680@besplex.bde.org> References: <201206112359.41892.hselasky@c2i.net> <20120612130912.O1895@besplex.bde.org> <201206120951.38492.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Pawel Jakub Dawidek , Bruce Evans Subject: Re: svn commit: r236909 - head/sbin/hastd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 09:21:29 -0000 On Tue, 12 Jun 2012, Hans Petter Selasky wrote: > On Tuesday 12 June 2012 05:49:33 Bruce Evans wrote: >> On Mon, 11 Jun 2012, Hans Petter Selasky wrote: >>> On Monday 11 June 2012 22:21:51 Hans Petter Selasky wrote: >>>> On Monday 11 June 2012 22:05:07 Pawel Jakub Dawidek wrote: >>>>> On Mon, Jun 11, 2012 at 07:21:00PM +0000, Hans Petter Selasky wrote: >>>>>> Author: hselasky >>>>>> Date: Mon Jun 11 19:20:59 2012 >>>>>> New Revision: 236909 >>>>>> URL: http://svn.freebsd.org/changeset/base/236909 > >> The point is in 2038, on systems with 32-bit signed time_t's. None >> should exist then. Even if time_t is 32 bits, it can be unsigned, and >> never become negative, and work until 2106. Changing time_t from >> signed to unsigned would break mainly times before the Epoch, which >> are invalid for current times anyway, and expose broken code which >> assumes that time_t is signed. > > Lets assume you need to reboot the system at some point and that solves the > problem. Yes, that solves it for >= 86 years after rebooting, provided the clock id is CLOCK_MONOTONIC and the time that this clock is relative to is the boot time. >>> functionality stop working then, because pthread_cond_timedwait() has a >>> check for negative time? >> >> This check is just to prevent invalid times. It does prevents hacks like >> the kernel treating negative times as large unsigned ones so that the >> result is much the same as changing time_t to unsigned, without actually >> changing time_t. >> >>> Or is hastd wrong, that it can compute a timeout offset which is outside >>> the valid range, because it uses a simple: >>> >>> tv_sec += timeout? >>> tv_sec %= 1000000000; /* Is this perhaps missing in hastd and other >>> drivers ???? */ >>> >>> What is the modulus which should be used for tv_sec? >> >> `tv_sec %= ANY' makes no sense. >> >> With CLOCK_MONOTONIC, signed 32-bit time_t's work for 86 years after the >> unspecified point in the past that CLOCK_MONOTONIC is relative to. This >> should be enough for anyone, provided the unspecified point is the boot >> time. hastd also uses mostly-relative, mostly-monotonic, often 32-bit >> signed in timeouts internally. E.g., in the function that seems to be >> causing problems: > > When CLOCK_REALTIME finally goes negative, then pthread_cond_timedwait() will > simply return an error code, due to the negative tv_sec check in there! I see > other clients like sendmail, using even simpler formats like: Are you going to wait around for 86 years after rebooting for that? :-). > tv_nsec = 0; > tv_sec = time(NULL); > > If this piece of code stops working at a given data, regardless of uptime, > shouldn't that be fixed now? Only if you urgently need current systems 32-bit signed time_t, which are rebooted tomorrow with this fix, to not need another reboot for 86 years. Actually `tv_sec = time(NULL);' will overflow on only 26 years on such systems, but time() use not usable together with CLOCK_MONOTONIC. 32-bit signed time_t's are a more general problem. > ... > A final question on the matter: > > I tried to use CLOCK_MONOTONIC_FAST when setting up the condition variable. > That did not appear to be support in 9-stable. Is there a list of supported > clocks anywhere? Don't know, but the list in clock_gettime(2) for -current seems to have them all except CLOCK_THREAD_CPUTIME_ID. That one is also badly named: - verbosely named - has an _ID suffix, unlike all the others Since it is like CLOCK_PROF (the differences are that it is for threads instead of processes, and interrupt times are broken in a different way for it), it should be named more like CLOCK_PROF. Of course the kernel source code has the correct list. Most of these clock ids are only supported by clock_gettime() and clock_getres(). Most of them arent't writeable, so clock_settime() doesn't apply to them. clock_settime(2) is identical with clock_gettime(2), and doesn't say anything about which clocks are read-only -- you have to try to set them to see which, or you can read the POSIX spec to see that CLOCK_MONOTONIC must be read-only. clock_settime(2) also fails to document the (bad) errno for failure with CLOCK_MONOTONIC. It only says "the following error codes _may_ be set", with EINVAL meaning that the clock id was invalid. But in POSIX, EINVAL for just clock_settime() is grossly overloaded; it means any of: - clock_id for unknown clock (this applies to all the functions; the rest are for clock_settime()) - the tp arg (sic; should be the value pointed to be the tp arg) is out of bounds for the specified clock_id - the tp arg (sic) has an out of bounds nanosecond value - the clock_id arg is CLOCK_MONOTONIC. I don't like the explosion of clock ids in FreeBSD, and support for them outside of clock_gettime() and clock_getres() seems to be nonexistent. In man pages for POSIX realtime timers, only the standard CLOCK_REALTIME and CLOCK_MONOTONIC are documented, and the code seems to agree. FreeBSD aliases like CLOCK_REALTIME_PRECISE will work because they are just spelling errors. FreeBSD extensions like CLOCK_REALTIME_FAST won't work for timers, but timers are already "FAST" (really "!PRECISE"). Bruce From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 10:25:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E34C1065672; Tue, 12 Jun 2012 10:25:12 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7987D8FC16; Tue, 12 Jun 2012 10:25:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CAPCT9044656; Tue, 12 Jun 2012 10:25:12 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CAPCXE044654; Tue, 12 Jun 2012 10:25:12 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206121025.q5CAPCXE044654@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 12 Jun 2012 10:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236950 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 10:25:12 -0000 Author: pjd Date: Tue Jun 12 10:25:11 2012 New Revision: 236950 URL: http://svn.freebsd.org/changeset/base/236950 Log: Revert part of the r236935 for now, until I figure out why it doesn't work properly. Reported by: davidxu Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Tue Jun 12 09:18:28 2012 (r236949) +++ head/sys/kern/kern_descrip.c Tue Jun 12 10:25:11 2012 (r236950) @@ -1480,10 +1480,12 @@ fdalloc(struct thread *td, int minfd, in * to grow the file table. Keep at it until we either get a file * descriptor or run into process or system limits. */ - fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); - if (fd >= maxfd) - return (EMFILE); - if (fd >= fdp->fd_nfiles) { + for (;;) { + fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); + if (fd >= maxfd) + return (EMFILE); + if (fd < fdp->fd_nfiles) + break; #ifdef RACCT PROC_LOCK(p); error = racct_set(p, RACCT_NOFILE, @@ -1493,10 +1495,6 @@ fdalloc(struct thread *td, int minfd, in return (EMFILE); #endif fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd)); - /* Retry... */ - fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); - if (fd >= maxfd) - return (EMFILE); } /* From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 10:44:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 29DE9106566B; Tue, 12 Jun 2012 10:44:10 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AAC88FC15; Tue, 12 Jun 2012 10:44:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CAi96G048819; Tue, 12 Jun 2012 10:44:09 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CAi9vq048816; Tue, 12 Jun 2012 10:44:09 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201206121044.q5CAi9vq048816@svn.freebsd.org> From: Randall Stewart Date: Tue, 12 Jun 2012 10:44:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236951 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 10:44:10 -0000 Author: rrs Date: Tue Jun 12 10:44:09 2012 New Revision: 236951 URL: http://svn.freebsd.org/changeset/base/236951 Log: Allow a gif tunnel to be used with ALTq. Reviewed by: gnn Modified: head/sys/net/if_gif.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Tue Jun 12 10:25:11 2012 (r236950) +++ head/sys/net/if_gif.c Tue Jun 12 10:44:09 2012 (r236951) @@ -342,26 +342,98 @@ gif_encapcheck(m, off, proto, arg) return 0; } } +#ifdef INET +#define GIF_HDR_LEN (ETHER_HDR_LEN + sizeof (struct ip)) +#endif +#ifdef INET6 +#define GIF_HDR_LEN6 (ETHER_HDR_LEN + sizeof (struct ip6_hdr)) +#endif static void gif_start(struct ifnet *ifp) { struct gif_softc *sc; struct mbuf *m; + uint32_t af; + int error = 0; sc = ifp->if_softc; - + GIF_LOCK(sc); + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + /* Already active */ + ifp->if_drv_flags |= IFF_GIF_WANTED; + GIF_UNLOCK(sc); + return; + } ifp->if_drv_flags |= IFF_DRV_OACTIVE; - for (;;) { - IFQ_DEQUEUE(&ifp->if_snd, m); + GIF_UNLOCK(sc); +keep_going: + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == 0) break; - gif_output(ifp, m, sc->gif_pdst, NULL); +#ifdef ALTQ + /* Take out those altq bytes we add in gif_output */ +#ifdef INET + if (sc->gif_psrc->sa_family == AF_INET) + m->m_pkthdr.len -= GIF_HDR_LEN; +#endif +#ifdef INET6 + if (sc->gif_psrc->sa_family == AF_INET6) + m->m_pkthdr.len -= GIF_HDR_LEN6; +#endif +#endif + /* Now pull back the af in packet that + * was saved in the address location. + */ + bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af)); + if (ifp->if_bridge) + af = AF_LINK; + + BPF_MTAP2(ifp, &af, sizeof(af), m); + ifp->if_opackets++; + +/* Done by IFQ_HANDOFF */ +/* ifp->if_obytes += m->m_pkthdr.len;*/ + /* override to IPPROTO_ETHERIP for bridged traffic */ + + M_SETFIB(m, sc->gif_fibnum); + /* inner AF-specific encapsulation */ + /* XXX should we check if our outer source is legal? */ + /* dispatch to output logic based on outer AF */ + switch (sc->gif_psrc->sa_family) { +#ifdef INET + case AF_INET: + error = in_gif_output(ifp, af, m); + break; +#endif +#ifdef INET6 + case AF_INET6: + error = in6_gif_output(ifp, af, m); + break; +#endif + default: + m_freem(m); + error = ENETDOWN; + } + if (error) + ifp->if_oerrors++; } + GIF_LOCK(sc); + if (ifp->if_drv_flags & IFF_GIF_WANTED) { + /* Someone did a start while + * we were unlocked and processing + * lets clear the flag and try again. + */ + ifp->if_drv_flags &= ~IFF_GIF_WANTED; + GIF_UNLOCK(sc); + goto keep_going; + } ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - + GIF_UNLOCK(sc); return; } @@ -376,8 +448,7 @@ gif_output(ifp, m, dst, ro) struct m_tag *mtag; int error = 0; int gif_called; - u_int32_t af; - + uint32_t af; #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); if (error) { @@ -426,55 +497,40 @@ gif_output(ifp, m, dst, ro) m_tag_prepend(m, mtag); m->m_flags &= ~(M_BCAST|M_MCAST); - - GIF_LOCK(sc); - - if (!(ifp->if_flags & IFF_UP) || - sc->gif_psrc == NULL || sc->gif_pdst == NULL) { - GIF_UNLOCK(sc); - m_freem(m); - error = ENETDOWN; - goto end; - } - /* BPF writes need to be handled specially. */ if (dst->sa_family == AF_UNSPEC) { bcopy(dst->sa_data, &af, sizeof(af)); dst->sa_family = af; } - af = dst->sa_family; - BPF_MTAP2(ifp, &af, sizeof(af), m); - ifp->if_opackets++; - ifp->if_obytes += m->m_pkthdr.len; - - /* override to IPPROTO_ETHERIP for bridged traffic */ - if (ifp->if_bridge) - af = AF_LINK; - - M_SETFIB(m, sc->gif_fibnum); - /* inner AF-specific encapsulation */ - - /* XXX should we check if our outer source is legal? */ - - /* dispatch to output logic based on outer AF */ - switch (sc->gif_psrc->sa_family) { + /* Now save the af in the inbound pkt mac + * address location. + */ + bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af)); + if (!(ifp->if_flags & IFF_UP) || + sc->gif_psrc == NULL || sc->gif_pdst == NULL) { + m_freem(m); + error = ENETDOWN; + goto end; + } +#ifdef ALTQ + /* Make altq aware of the bytes we will add + * when we actually send it. + */ #ifdef INET - case AF_INET: - error = in_gif_output(ifp, af, m); - break; + if (sc->gif_psrc->sa_family == AF_INET) + m->m_pkthdr.len += GIF_HDR_LEN; #endif #ifdef INET6 - case AF_INET6: - error = in6_gif_output(ifp, af, m); - break; + if (sc->gif_psrc->sa_family == AF_INET6) + m->m_pkthdr.len += GIF_HDR_LEN6; #endif - default: - m_freem(m); - error = ENETDOWN; - } - - GIF_UNLOCK(sc); +#endif + /* + * Queue message on interface, update output statistics if + * successful, and start output if interface not yet active. + */ + IFQ_HANDOFF(ifp, m, error); end: if (error) ifp->if_oerrors++; From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 10:47:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78D82106564A; Tue, 12 Jun 2012 10:47:59 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id D68C08FC1A; Tue, 12 Jun 2012 10:47:58 +0000 (UTC) Received: by yenl8 with SMTP id l8so3715303yen.13 for ; Tue, 12 Jun 2012 03:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=RX9d/y3TyMBU602XhWcCQuyMwBvcewMlhz5raU2j1J8=; b=yUBhYcJz2m/AqwMBBododzsIlQhLfWuF3Ak4baC92HOESWDBrKpmNdqHS43kT1Pvog SEoL1LacS7OfkaH7uI+JHkjao5W0x2qupqClB/H4wq0SYF7Zi0qh5AiAVxjXjRIxN/Wj wSMBAaaxZrFpXidrtMDCM597lpGsghOS46DvISkCaMiKzS5G7F7UGe7YoKMXtqblNIm7 a1cFASJJw6APrIVQy8Rk+HkNJF/u07o4kwQz6Dle+wuof9GycOW+Lhrb7NQb9MTGyPKh vycoPjrPubquARq1ouLTplUmdHxxo1sZQioQGL1nlhd3ptGRk9PkIHRRDrysmM63ywR7 +OKw== Received: by 10.236.190.138 with SMTP id e10mr26118764yhn.131.1339498078437; Tue, 12 Jun 2012 03:47:58 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id p29sm66231577yhl.19.2012.06.12.03.47.56 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jun 2012 03:47:57 -0700 (PDT) Date: Tue, 12 Jun 2012 12:47:49 +0200 From: Mateusz Guzik To: davidxu@FreeBSD.org Message-ID: <20120612104749.GB20749@dft-labs.eu> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4FD6FD39.5090800@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 10:47:59 -0000 On Tue, Jun 12, 2012 at 04:26:33PM +0800, David Xu wrote: > On 2012/6/12 6:05, Pawel Jakub Dawidek wrote: > >Author: pjd > >Date: Mon Jun 11 22:05:26 2012 > >New Revision: 236935 > >URL: http://svn.freebsd.org/changeset/base/236935 > > > >Log: > > fdgrowtable() no longer drops the filedesc lock so it is enough to > > retry finding free file descriptor only once after fdgrowtable(). > > > > Spotted by: pluknet > > MFC after: 1 month > > > >Modified: > > head/sys/kern/kern_descrip.c > > > >Modified: head/sys/kern/kern_descrip.c > >============================================================================== > >--- head/sys/kern/kern_descrip.c Mon Jun 11 21:56:37 2012 (r236934) > >+++ head/sys/kern/kern_descrip.c Mon Jun 11 22:05:26 2012 (r236935) > >@@ -1478,29 +1478,33 @@ fdalloc(struct thread *td, int minfd, in > > /* > > * Search the bitmap for a free descriptor. If none is found, try > > * to grow the file table. Keep at it until we either get a file > >- * descriptor or run into process or system limits; fdgrowtable() > >- * may drop the filedesc lock, so we're in a race. > >+ * descriptor or run into process or system limits. > > */ > >- for (;;) { > >- fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); > >- if (fd>= maxfd) > >- return (EMFILE); > >- if (fd< fdp->fd_nfiles) > >- break; > >+ fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); > >+ if (fd>= maxfd) > >+ return (EMFILE); > >+ if (fd>= fdp->fd_nfiles) { > > #ifdef RACCT > > PROC_LOCK(p); > >- error = racct_set(p, RACCT_NOFILE, min(fdp->fd_nfiles * 2, maxfd)); > >+ error = racct_set(p, RACCT_NOFILE, > >+ min(fdp->fd_nfiles * 2, maxfd)); > > PROC_UNLOCK(p); > > if (error != 0) > > return (EMFILE); > > #endif > > fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd)); > >+ /* Retry... */ > >+ fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); > >+ if (fd>= maxfd) > >+ return (EMFILE); > > } > > > > /* > > * Perform some sanity checks, then mark the file descriptor as > > * used and return it to the caller. > > */ > >+ KASSERT((unsigned int)fd< min(maxfd, fdp->fd_nfiles), > >+ ("invalid descriptor %d", fd)); > > KASSERT(!fdisused(fdp, fd), > > ("fd_first_free() returned non-free descriptor")); > > KASSERT(fdp->fd_ofiles[fd] == NULL, ("file descriptor isn't free")); > > > My machine crashed with this change. > http://people.freebsd.org/~davidxu/fdcrash.jpg > > The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which still may not be enough to have place for new fd with high number. This fixed the problem for me, although I'm not sure whether it's ok to grow the table like this: http://people.freebsd.org/~mjg/patches/fdalloc.patch -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 11:08:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3350C106564A; Tue, 12 Jun 2012 11:08:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EC198FC19; Tue, 12 Jun 2012 11:08:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CB8p4T049844; Tue, 12 Jun 2012 11:08:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CB8pRL049840; Tue, 12 Jun 2012 11:08:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206121108.q5CB8pRL049840@svn.freebsd.org> From: Alexander Motin Date: Tue, 12 Jun 2012 11:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236952 - head/sys/dev/mvs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 11:08:52 -0000 Author: mav Date: Tue Jun 12 11:08:51 2012 New Revision: 236952 URL: http://svn.freebsd.org/changeset/base/236952 Log: - Limit r214102 workaround to only x86. On arm it causes more problems then solves because of cache coherency issues. This fixes periodic error messages on console and command timeouts. - Patch SATA PHY configuration for 65nm SoCs to improve SNR same as Linux does. MFC after: 2 weeks Modified: head/sys/dev/mvs/mvs.c head/sys/dev/mvs/mvs.h head/sys/dev/mvs/mvs_soc.c Modified: head/sys/dev/mvs/mvs.c ============================================================================== --- head/sys/dev/mvs/mvs.c Tue Jun 12 10:44:09 2012 (r236951) +++ head/sys/dev/mvs/mvs.c Tue Jun 12 11:08:51 2012 (r236952) @@ -1048,14 +1048,19 @@ mvs_crbq_intr(device_t dev) * Handle only successfull completions here. * Errors will be handled by main intr handler. */ +#if defined(__i386__) || defined(__amd64__) if (crpb->id == 0xffff && crpb->rspflg == 0xffff) { device_printf(dev, "Unfilled CRPB " "%d (%d->%d) tag %d flags %04x rs %08x\n", cin_idx, fin_idx, in_idx, slot, flags, ch->rslots); - } else if (ch->numtslots != 0 || + } else +#endif + if (ch->numtslots != 0 || (flags & EDMA_IE_EDEVERR) == 0) { +#if defined(__i386__) || defined(__amd64__) crpb->id = 0xffff; crpb->rspflg = 0xffff; +#endif if (ch->slot[slot].state >= MVS_SLOT_RUNNING) { ccb = ch->slot[slot].ccb; ccb->ataio.res.status = @@ -1999,6 +2004,39 @@ mvs_reset_to(void *arg) } static void +mvs_errata(device_t dev) +{ + struct mvs_channel *ch = device_get_softc(dev); + uint32_t val; + + if (ch->quirks & MVS_Q_SOC65) { + val = ATA_INL(ch->r_mem, SATA_PHYM3); + val &= ~(0x3 << 27); /* SELMUPF = 1 */ + val |= (0x1 << 27); + val &= ~(0x3 << 29); /* SELMUPI = 1 */ + val |= (0x1 << 29); + ATA_OUTL(ch->r_mem, SATA_PHYM3, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM4); + val &= ~0x1; /* SATU_OD8 = 0 */ + val |= (0x1 << 16); /* reserved bit 16 = 1 */ + ATA_OUTL(ch->r_mem, SATA_PHYM4, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM9_GEN2); + val &= ~0xf; /* TXAMP[3:0] = 8 */ + val |= 0x8; + val &= ~(0x1 << 14); /* TXAMP[4] = 0 */ + ATA_OUTL(ch->r_mem, SATA_PHYM9_GEN2, val); + + val = ATA_INL(ch->r_mem, SATA_PHYM9_GEN1); + val &= ~0xf; /* TXAMP[3:0] = 8 */ + val |= 0x8; + val &= ~(0x1 << 14); /* TXAMP[4] = 0 */ + ATA_OUTL(ch->r_mem, SATA_PHYM9_GEN1, val); + } +} + +static void mvs_reset(device_t dev) { struct mvs_channel *ch = device_get_softc(dev); @@ -2044,6 +2082,7 @@ mvs_reset(device_t dev) ATA_OUTL(ch->r_mem, EDMA_CMD, EDMA_CMD_EATARST); DELAY(25); ATA_OUTL(ch->r_mem, EDMA_CMD, 0); + mvs_errata(dev); /* Reset and reconnect PHY, */ if (!mvs_sata_phy_reset(dev)) { if (bootverbose) Modified: head/sys/dev/mvs/mvs.h ============================================================================== --- head/sys/dev/mvs/mvs.h Tue Jun 12 10:44:09 2012 (r236951) +++ head/sys/dev/mvs/mvs.h Tue Jun 12 11:08:51 2012 (r236952) @@ -382,6 +382,10 @@ #define SATA_FISDW5 0x384 /* FIS DW5 */ #define SATA_FISDW6 0x388 /* FIS DW6 */ +#define SATA_PHYM9_GEN2 0x398 +#define SATA_PHYM9_GEN1 0x39c +#define SATA_PHYCFG_OFS 0x3a0 /* 65nm SoCs only */ + #define MVS_MAX_PORTS 8 #define MVS_MAX_SLOTS 32 @@ -537,6 +541,7 @@ struct mvs_channel { #define MVS_Q_GENIIE 4 #define MVS_Q_SOC 8 #define MVS_Q_CT 16 +#define MVS_Q_SOC65 32 int pm_level; /* power management level */ struct mvs_slot slot[MVS_MAX_SLOTS]; Modified: head/sys/dev/mvs/mvs_soc.c ============================================================================== --- head/sys/dev/mvs/mvs_soc.c Tue Jun 12 10:44:09 2012 (r236951) +++ head/sys/dev/mvs/mvs_soc.c Tue Jun 12 11:08:51 2012 (r236952) @@ -135,6 +135,8 @@ mvs_attach(device_t dev) if (!(ctlr->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &ctlr->r_rid, RF_ACTIVE))) return ENXIO; + if (ATA_INL(ctlr->r_mem, PORT_BASE(0) + SATA_PHYCFG_OFS) != 0) + ctlr->quirks |= MVS_Q_SOC65; /* Setup our own memory management for channels. */ ctlr->sc_iomem.rm_start = rman_get_start(ctlr->r_mem); ctlr->sc_iomem.rm_end = rman_get_end(ctlr->r_mem); From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 11:45:32 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D0E42106566C; Tue, 12 Jun 2012 11:45:32 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 81D518FC12; Tue, 12 Jun 2012 11:45:32 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 211AB141; Tue, 12 Jun 2012 13:45:30 +0200 (CEST) Date: Tue, 12 Jun 2012 13:43:35 +0200 From: Pawel Jakub Dawidek To: Mateusz Guzik Message-ID: <20120612114335.GA1372@garage.freebsd.pl> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="YiEDa0DAkWCtVeE4" Content-Disposition: inline In-Reply-To: <20120612104749.GB20749@dft-labs.eu> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 11:45:32 -0000 --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote: > The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which > still may not be enough to have place for new fd with high number. I was under impression that fd_first_free() can return at most fdp->fd_nfiles, but indeed I missed this: if (low >=3D size) return (low); So fd_first_free() can return number biffer than size... > This fixed the problem for me, although I'm not sure whether it's ok to > grow the table like this: > http://people.freebsd.org/~mjg/patches/fdalloc.patch The patch looks good to me, could you please commit it, preferably after David's trying it and also update fd_first_free() comment, so it is clear that returned value can exceed 'size -1'? David, can you try Mateusz's patch? Thanks. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --YiEDa0DAkWCtVeE4 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/XK2cACgkQForvXbEpPzQJnACfYAr5hVTe0xnTCHdgrHSZXasD jQwAoMThIBwK4zYxTeO1IF3zmSTZ6ABN =MZJW -----END PGP SIGNATURE----- --YiEDa0DAkWCtVeE4-- From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 11:53:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 74B5D1065670; Tue, 12 Jun 2012 11:53:13 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id EAE648FC0A; Tue, 12 Jun 2012 11:53:12 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 6AFA1145; Tue, 12 Jun 2012 13:53:11 +0200 (CEST) Date: Tue, 12 Jun 2012 13:51:17 +0200 From: Pawel Jakub Dawidek To: Bruce Evans Message-ID: <20120612115117.GB1372@garage.freebsd.pl> References: <201206112017.q5BKHKsW007722@svn.freebsd.org> <20120612114254.V1572@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tjCHc7DPkfUGtrlw" Content-Disposition: inline In-Reply-To: <20120612114254.V1572@besplex.bde.org> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236917 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 11:53:13 -0000 --tjCHc7DPkfUGtrlw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 12, 2012 at 12:53:47PM +1000, Bruce Evans wrote: > On Mon, 11 Jun 2012, Pawel Jakub Dawidek wrote: > > - KASSERT(fd >=3D 0 && fd < fdp->fd_nfiles, > > + KASSERT((unsigned int)fd < fdp->fd_nfiles, > > ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfi= les)); > > return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) !=3D 0); > > } >=20 > This is backwards. Apart from using the worst possible (most verbose) > spelling of `unsigned', it uses a type hack manually optimize away the > test for fd being < 0. The compiler will do this "optimization" > automatically if it is any good (or undo it if it is not), so all the > hack does is obfuscate the test. With the verbose spelling of u_int, > it even takes more space. Well, to be honest I presonally would prefer explicit check for fd being less than 0, but my impression was that using cast is the most popular way and I wanted this check to be consistent across our source tree. Feel free to change it. BTW. I really dislike using 'unsigned' with omitted 'int'. u_int is fine. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --tjCHc7DPkfUGtrlw Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/XLTUACgkQForvXbEpPzQdtwCeL7L3KaM0pzUYkeBh5sQlMwLF 1R8AoNuKc1sL06wQmXFQ6BqoqKunbk7c =9mtg -----END PGP SIGNATURE----- --tjCHc7DPkfUGtrlw-- From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 12:10:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EF161106567A; Tue, 12 Jun 2012 12:10:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9DE98FC0A; Tue, 12 Jun 2012 12:10:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CCAB41052390; Tue, 12 Jun 2012 12:10:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CCABtB052386; Tue, 12 Jun 2012 12:10:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206121210.q5CCABtB052386@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 12 Jun 2012 12:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236953 - head/sys/amd64/amd64 releng/7.4 releng/7.4/contrib/bind9/lib/dns releng/7.4/sys/amd64/amd64 releng/7.4/sys/conf releng/8.1 releng/8.1/contrib/bind9/lib/dns releng/8.1/sys/amd6... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:10:12 -0000 Author: bz Date: Tue Jun 12 12:10:10 2012 New Revision: 236953 URL: http://svn.freebsd.org/changeset/base/236953 Log: Fix a problem where zero-length RDATA fields can cause named(8) to crash. [12:03] Correct a privilege escalation when returning from kernel if running FreeBSD/amd64 on non-AMD processors. [12:04] Fix reference count errors in IPv6 code. [EN-12:02] Security: CVE-2012-1667 Security: FreeBSD-SA-12:03.bind Security: CVE-2012-0217 Security: FreeBSD-SA-12:04.sysret Security: FreeBSD-EN-12:02.ipv6refcount Approved by: so (simon, bz) Modified: stable/7/contrib/bind9/lib/dns/rdata.c stable/7/contrib/bind9/lib/dns/rdataslab.c stable/7/sys/amd64/amd64/trap.c Changes in other areas also in this revision: Modified: head/sys/amd64/amd64/trap.c releng/7.4/UPDATING releng/7.4/contrib/bind9/lib/dns/rdata.c releng/7.4/contrib/bind9/lib/dns/rdataslab.c releng/7.4/sys/amd64/amd64/trap.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bind9/lib/dns/rdata.c releng/8.1/contrib/bind9/lib/dns/rdataslab.c releng/8.1/sys/amd64/amd64/trap.c releng/8.1/sys/conf/newvers.sh releng/8.1/sys/netinet/tcp_input.c releng/8.1/sys/netinet6/in6.c releng/8.1/sys/netinet6/ip6_input.c releng/8.2/UPDATING releng/8.2/contrib/bind9/lib/dns/rdata.c releng/8.2/contrib/bind9/lib/dns/rdataslab.c releng/8.2/sys/amd64/amd64/trap.c releng/8.2/sys/conf/newvers.sh releng/8.2/sys/netinet/tcp_input.c releng/8.2/sys/netinet6/in6.c releng/8.2/sys/netinet6/ip6_input.c releng/8.3/UPDATING releng/8.3/contrib/bind9/lib/dns/rdata.c releng/8.3/contrib/bind9/lib/dns/rdataslab.c releng/8.3/sys/amd64/amd64/trap.c releng/8.3/sys/conf/newvers.sh releng/8.3/sys/netinet/tcp_input.c releng/8.3/sys/netinet6/in6.c releng/8.3/sys/netinet6/ip6_input.c releng/9.0/UPDATING releng/9.0/contrib/bind9/lib/dns/rdata.c releng/9.0/contrib/bind9/lib/dns/rdataslab.c releng/9.0/sys/amd64/amd64/trap.c releng/9.0/sys/conf/newvers.sh releng/9.0/sys/netinet/tcp_input.c releng/9.0/sys/netinet6/in6.c releng/9.0/sys/netinet6/ip6_input.c stable/8/sys/amd64/amd64/trap.c stable/9/sys/amd64/amd64/trap.c Modified: stable/7/contrib/bind9/lib/dns/rdata.c ============================================================================== --- stable/7/contrib/bind9/lib/dns/rdata.c Tue Jun 12 11:08:51 2012 (r236952) +++ stable/7/contrib/bind9/lib/dns/rdata.c Tue Jun 12 12:10:10 2012 (r236953) @@ -334,8 +334,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: stable/7/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- stable/7/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 11:08:51 2012 (r236952) +++ stable/7/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 12:10:10 2012 (r236953) @@ -128,6 +128,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -166,6 +171,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -198,8 +204,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -275,7 +280,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: stable/7/sys/amd64/amd64/trap.c ============================================================================== --- stable/7/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ stable/7/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -972,6 +972,23 @@ syscall(struct trapframe *frame) /* * Traced syscall. */ + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } if (orig_tf_rflags & PSL_T) { frame->tf_rflags &= ~PSL_T; ksiginfo_init_trap(&ksi); From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 12:10:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 31784106567B; Tue, 12 Jun 2012 12:10:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 142E38FC14; Tue, 12 Jun 2012 12:10:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CCABkj052396; Tue, 12 Jun 2012 12:10:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CCABq0052394; Tue, 12 Jun 2012 12:10:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206121210.q5CCABq0052394@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 12 Jun 2012 12:10:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236953 - head/sys/amd64/amd64 releng/7.4 releng/7.4/contrib/bind9/lib/dns releng/7.4/sys/amd64/amd64 releng/7.4/sys/conf releng/8.1 releng/8.1/contrib/bind9/lib/dns releng/8.1/sys/amd6... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:10:12 -0000 Author: bz Date: Tue Jun 12 12:10:10 2012 New Revision: 236953 URL: http://svn.freebsd.org/changeset/base/236953 Log: Fix a problem where zero-length RDATA fields can cause named(8) to crash. [12:03] Correct a privilege escalation when returning from kernel if running FreeBSD/amd64 on non-AMD processors. [12:04] Fix reference count errors in IPv6 code. [EN-12:02] Security: CVE-2012-1667 Security: FreeBSD-SA-12:03.bind Security: CVE-2012-0217 Security: FreeBSD-SA-12:04.sysret Security: FreeBSD-EN-12:02.ipv6refcount Approved by: so (simon, bz) Modified: stable/8/sys/amd64/amd64/trap.c Changes in other areas also in this revision: Modified: head/sys/amd64/amd64/trap.c releng/7.4/UPDATING releng/7.4/contrib/bind9/lib/dns/rdata.c releng/7.4/contrib/bind9/lib/dns/rdataslab.c releng/7.4/sys/amd64/amd64/trap.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bind9/lib/dns/rdata.c releng/8.1/contrib/bind9/lib/dns/rdataslab.c releng/8.1/sys/amd64/amd64/trap.c releng/8.1/sys/conf/newvers.sh releng/8.1/sys/netinet/tcp_input.c releng/8.1/sys/netinet6/in6.c releng/8.1/sys/netinet6/ip6_input.c releng/8.2/UPDATING releng/8.2/contrib/bind9/lib/dns/rdata.c releng/8.2/contrib/bind9/lib/dns/rdataslab.c releng/8.2/sys/amd64/amd64/trap.c releng/8.2/sys/conf/newvers.sh releng/8.2/sys/netinet/tcp_input.c releng/8.2/sys/netinet6/in6.c releng/8.2/sys/netinet6/ip6_input.c releng/8.3/UPDATING releng/8.3/contrib/bind9/lib/dns/rdata.c releng/8.3/contrib/bind9/lib/dns/rdataslab.c releng/8.3/sys/amd64/amd64/trap.c releng/8.3/sys/conf/newvers.sh releng/8.3/sys/netinet/tcp_input.c releng/8.3/sys/netinet6/in6.c releng/8.3/sys/netinet6/ip6_input.c releng/9.0/UPDATING releng/9.0/contrib/bind9/lib/dns/rdata.c releng/9.0/contrib/bind9/lib/dns/rdataslab.c releng/9.0/sys/amd64/amd64/trap.c releng/9.0/sys/conf/newvers.sh releng/9.0/sys/netinet/tcp_input.c releng/9.0/sys/netinet6/in6.c releng/9.0/sys/netinet6/ip6_input.c stable/7/contrib/bind9/lib/dns/rdata.c stable/7/contrib/bind9/lib/dns/rdataslab.c stable/7/sys/amd64/amd64/trap.c stable/9/sys/amd64/amd64/trap.c Modified: stable/8/sys/amd64/amd64/trap.c ============================================================================== --- stable/8/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ stable/8/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -968,4 +968,21 @@ amd64_syscall(struct thread *td, int tra syscallname(td->td_proc, sa.code))); syscallret(td, error, &sa); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 12:10:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AE4071065672; Tue, 12 Jun 2012 12:10:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AE5D8FC15; Tue, 12 Jun 2012 12:10:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CCAC08052402; Tue, 12 Jun 2012 12:10:12 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CCACFm052400; Tue, 12 Jun 2012 12:10:12 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206121210.q5CCACFm052400@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 12 Jun 2012 12:10:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236953 - head/sys/amd64/amd64 releng/7.4 releng/7.4/contrib/bind9/lib/dns releng/7.4/sys/amd64/amd64 releng/7.4/sys/conf releng/8.1 releng/8.1/contrib/bind9/lib/dns releng/8.1/sys/amd6... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:10:12 -0000 Author: bz Date: Tue Jun 12 12:10:10 2012 New Revision: 236953 URL: http://svn.freebsd.org/changeset/base/236953 Log: Fix a problem where zero-length RDATA fields can cause named(8) to crash. [12:03] Correct a privilege escalation when returning from kernel if running FreeBSD/amd64 on non-AMD processors. [12:04] Fix reference count errors in IPv6 code. [EN-12:02] Security: CVE-2012-1667 Security: FreeBSD-SA-12:03.bind Security: CVE-2012-0217 Security: FreeBSD-SA-12:04.sysret Security: FreeBSD-EN-12:02.ipv6refcount Approved by: so (simon, bz) Modified: stable/9/sys/amd64/amd64/trap.c Changes in other areas also in this revision: Modified: head/sys/amd64/amd64/trap.c releng/7.4/UPDATING releng/7.4/contrib/bind9/lib/dns/rdata.c releng/7.4/contrib/bind9/lib/dns/rdataslab.c releng/7.4/sys/amd64/amd64/trap.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bind9/lib/dns/rdata.c releng/8.1/contrib/bind9/lib/dns/rdataslab.c releng/8.1/sys/amd64/amd64/trap.c releng/8.1/sys/conf/newvers.sh releng/8.1/sys/netinet/tcp_input.c releng/8.1/sys/netinet6/in6.c releng/8.1/sys/netinet6/ip6_input.c releng/8.2/UPDATING releng/8.2/contrib/bind9/lib/dns/rdata.c releng/8.2/contrib/bind9/lib/dns/rdataslab.c releng/8.2/sys/amd64/amd64/trap.c releng/8.2/sys/conf/newvers.sh releng/8.2/sys/netinet/tcp_input.c releng/8.2/sys/netinet6/in6.c releng/8.2/sys/netinet6/ip6_input.c releng/8.3/UPDATING releng/8.3/contrib/bind9/lib/dns/rdata.c releng/8.3/contrib/bind9/lib/dns/rdataslab.c releng/8.3/sys/amd64/amd64/trap.c releng/8.3/sys/conf/newvers.sh releng/8.3/sys/netinet/tcp_input.c releng/8.3/sys/netinet6/in6.c releng/8.3/sys/netinet6/ip6_input.c releng/9.0/UPDATING releng/9.0/contrib/bind9/lib/dns/rdata.c releng/9.0/contrib/bind9/lib/dns/rdataslab.c releng/9.0/sys/amd64/amd64/trap.c releng/9.0/sys/conf/newvers.sh releng/9.0/sys/netinet/tcp_input.c releng/9.0/sys/netinet6/in6.c releng/9.0/sys/netinet6/ip6_input.c stable/7/contrib/bind9/lib/dns/rdata.c stable/7/contrib/bind9/lib/dns/rdataslab.c stable/7/sys/amd64/amd64/trap.c stable/8/sys/amd64/amd64/trap.c Modified: stable/9/sys/amd64/amd64/trap.c ============================================================================== --- stable/9/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ stable/9/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -977,4 +977,21 @@ amd64_syscall(struct thread *td, int tra syscallname(td->td_proc, sa.code))); syscallret(td, error, &sa); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 12:10:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A2D9106566B; Tue, 12 Jun 2012 12:10:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7205E8FC17; Tue, 12 Jun 2012 12:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CCADoa052444; Tue, 12 Jun 2012 12:10:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CCACYB052406; Tue, 12 Jun 2012 12:10:12 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206121210.q5CCACYB052406@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 12 Jun 2012 12:10:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236953 - head/sys/amd64/amd64 releng/7.4 releng/7.4/contrib/bind9/lib/dns releng/7.4/sys/amd64/amd64 releng/7.4/sys/conf releng/8.1 releng/8.1/contrib/bind9/lib/dns releng/8.1/sys/amd6... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:10:13 -0000 Author: bz Date: Tue Jun 12 12:10:10 2012 New Revision: 236953 URL: http://svn.freebsd.org/changeset/base/236953 Log: Fix a problem where zero-length RDATA fields can cause named(8) to crash. [12:03] Correct a privilege escalation when returning from kernel if running FreeBSD/amd64 on non-AMD processors. [12:04] Fix reference count errors in IPv6 code. [EN-12:02] Security: CVE-2012-1667 Security: FreeBSD-SA-12:03.bind Security: CVE-2012-0217 Security: FreeBSD-SA-12:04.sysret Security: FreeBSD-EN-12:02.ipv6refcount Approved by: so (simon, bz) Modified: releng/7.4/UPDATING releng/7.4/contrib/bind9/lib/dns/rdata.c releng/7.4/contrib/bind9/lib/dns/rdataslab.c releng/7.4/sys/amd64/amd64/trap.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bind9/lib/dns/rdata.c releng/8.1/contrib/bind9/lib/dns/rdataslab.c releng/8.1/sys/amd64/amd64/trap.c releng/8.1/sys/conf/newvers.sh releng/8.1/sys/netinet/tcp_input.c releng/8.1/sys/netinet6/in6.c releng/8.1/sys/netinet6/ip6_input.c releng/8.2/UPDATING releng/8.2/contrib/bind9/lib/dns/rdata.c releng/8.2/contrib/bind9/lib/dns/rdataslab.c releng/8.2/sys/amd64/amd64/trap.c releng/8.2/sys/conf/newvers.sh releng/8.2/sys/netinet/tcp_input.c releng/8.2/sys/netinet6/in6.c releng/8.2/sys/netinet6/ip6_input.c releng/8.3/UPDATING releng/8.3/contrib/bind9/lib/dns/rdata.c releng/8.3/contrib/bind9/lib/dns/rdataslab.c releng/8.3/sys/amd64/amd64/trap.c releng/8.3/sys/conf/newvers.sh releng/8.3/sys/netinet/tcp_input.c releng/8.3/sys/netinet6/in6.c releng/8.3/sys/netinet6/ip6_input.c releng/9.0/UPDATING releng/9.0/contrib/bind9/lib/dns/rdata.c releng/9.0/contrib/bind9/lib/dns/rdataslab.c releng/9.0/sys/amd64/amd64/trap.c releng/9.0/sys/conf/newvers.sh releng/9.0/sys/netinet/tcp_input.c releng/9.0/sys/netinet6/in6.c releng/9.0/sys/netinet6/ip6_input.c Changes in other areas also in this revision: Modified: head/sys/amd64/amd64/trap.c stable/7/contrib/bind9/lib/dns/rdata.c stable/7/contrib/bind9/lib/dns/rdataslab.c stable/7/sys/amd64/amd64/trap.c stable/8/sys/amd64/amd64/trap.c stable/9/sys/amd64/amd64/trap.c Modified: releng/7.4/UPDATING ============================================================================== --- releng/7.4/UPDATING Tue Jun 12 11:08:51 2012 (r236952) +++ releng/7.4/UPDATING Tue Jun 12 12:10:10 2012 (r236953) @@ -8,6 +8,14 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20120612: p9 FreeBSD-SA-12:03.bind + FreeBSD-SA-12:04.sysret + Fix a problem where zero-length RDATA fields can cause named to crash. + [12:03] + + Correct a privilege escalation when returning from kernel if + running FreeBSD/amd64 on non-AMD processors. [12:04] + 20120530: p8 FreeBSD-SA-12:01.openssl (revised), FreeBSD-SA-12:02.crypt Update the previous openssl fix. [12:01] Modified: releng/7.4/contrib/bind9/lib/dns/rdata.c ============================================================================== --- releng/7.4/contrib/bind9/lib/dns/rdata.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/7.4/contrib/bind9/lib/dns/rdata.c Tue Jun 12 12:10:10 2012 (r236953) @@ -334,8 +334,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: releng/7.4/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- releng/7.4/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/7.4/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 12:10:10 2012 (r236953) @@ -128,6 +128,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -166,6 +171,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -198,8 +204,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -275,7 +280,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: releng/7.4/sys/amd64/amd64/trap.c ============================================================================== --- releng/7.4/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/7.4/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -972,6 +972,23 @@ syscall(struct trapframe *frame) /* * Traced syscall. */ + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } if (orig_tf_rflags & PSL_T) { frame->tf_rflags &= ~PSL_T; ksiginfo_init_trap(&ksi); Modified: releng/7.4/sys/conf/newvers.sh ============================================================================== --- releng/7.4/sys/conf/newvers.sh Tue Jun 12 11:08:51 2012 (r236952) +++ releng/7.4/sys/conf/newvers.sh Tue Jun 12 12:10:10 2012 (r236953) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.4" -BRANCH="RELEASE-p8" +BRANCH="RELEASE-p9" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.1/UPDATING ============================================================================== --- releng/8.1/UPDATING Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.1/UPDATING Tue Jun 12 12:10:10 2012 (r236953) @@ -15,6 +15,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20120612: p11 FreeBSD-SA-12:03.bind + FreeBSD-SA-12:04.sysret + FreeBSD-EN-12:02.ipv6refcount + Fix a problem where zero-length RDATA fields can cause named to crash. + [12:03] + + Correct a privilege escalation when returning from kernel if + running FreeBSD/amd64 on non-AMD processors. [12:04] + + Fix reference count errors in IPv6 code. [EN-12:02] + 20120530: p10 FreeBSD-SA-12:01.openssl (revised), FreeBSD-SA-12:02.crypt Update the previous openssl fix. [12:01] Modified: releng/8.1/contrib/bind9/lib/dns/rdata.c ============================================================================== --- releng/8.1/contrib/bind9/lib/dns/rdata.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.1/contrib/bind9/lib/dns/rdata.c Tue Jun 12 12:10:10 2012 (r236953) @@ -341,8 +341,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: releng/8.1/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- releng/8.1/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.1/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 12:10:10 2012 (r236953) @@ -125,6 +125,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -164,6 +169,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -196,8 +202,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -284,7 +289,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: releng/8.1/sys/amd64/amd64/trap.c ============================================================================== --- releng/8.1/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.1/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -972,6 +972,23 @@ syscall(struct trapframe *frame) ksi.ksi_code = TRAP_TRACE; ksi.ksi_addr = (void *)frame->tf_rip; trapsignal(td, &ksi); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } /* Modified: releng/8.1/sys/conf/newvers.sh ============================================================================== --- releng/8.1/sys/conf/newvers.sh Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.1/sys/conf/newvers.sh Tue Jun 12 12:10:10 2012 (r236953) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.1" -BRANCH="RELEASE-p10" +BRANCH="RELEASE-p11" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.1/sys/netinet/tcp_input.c ============================================================================== --- releng/8.1/sys/netinet/tcp_input.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.1/sys/netinet/tcp_input.c Tue Jun 12 12:10:10 2012 (r236953) @@ -293,6 +293,8 @@ tcp6_input(struct mbuf **mp, int *offp, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); return IPPROTO_DONE; } + if (ia6) + ifa_free(&ia6->ia_ifa); tcp_input(m, *offp); return IPPROTO_DONE; @@ -941,7 +943,8 @@ relocked: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } - ifa_free(&ia6->ia_ifa); + if (ia6) + ifa_free(&ia6->ia_ifa); } #endif /* Modified: releng/8.1/sys/netinet6/in6.c ============================================================================== --- releng/8.1/sys/netinet6/in6.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.1/sys/netinet6/in6.c Tue Jun 12 12:10:10 2012 (r236953) @@ -1370,6 +1370,8 @@ in6_purgeaddr(struct ifaddr *ifa) } cleanup: + if (ifa0 != NULL) + ifa_free(ifa0); plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ if ((ia->ia_flags & IFA_ROUTE) && plen == 128) { @@ -1394,8 +1396,6 @@ cleanup: return; ia->ia_flags &= ~IFA_ROUTE; } - if (ifa0 != NULL) - ifa_free(ifa0); in6_unlink_ifa(ia, ifp); } @@ -1549,14 +1549,19 @@ in6_lifaddr_ioctl(struct socket *so, u_l hostid = IFA_IN6(ifa); /* prefixlen must be <= 64. */ - if (64 < iflr->prefixlen) + if (64 < iflr->prefixlen) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; + } prefixlen = iflr->prefixlen; /* hostid part must be zero. */ sin6 = (struct sockaddr_in6 *)&iflr->addr; if (sin6->sin6_addr.s6_addr32[2] != 0 || sin6->sin6_addr.s6_addr32[3] != 0) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; } } else @@ -2144,14 +2149,20 @@ in6_ifawithifp(struct ifnet *ifp, struct IN6_IFADDR_RUNLOCK(); return (struct in6_ifaddr *)ifa; } - IN6_IFADDR_RUNLOCK(); /* use the last-resort values, that are, deprecated addresses */ - if (dep[0]) + if (dep[0]) { + ifa_ref((struct ifaddr *)dep[0]); + IN6_IFADDR_RUNLOCK(); return dep[0]; - if (dep[1]) + } + if (dep[1]) { + ifa_ref((struct ifaddr *)dep[1]); + IN6_IFADDR_RUNLOCK(); return dep[1]; + } + IN6_IFADDR_RUNLOCK(); return NULL; } Modified: releng/8.1/sys/netinet6/ip6_input.c ============================================================================== --- releng/8.1/sys/netinet6/ip6_input.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.1/sys/netinet6/ip6_input.c Tue Jun 12 12:10:10 2012 (r236953) @@ -632,19 +632,23 @@ passin: * as our interface address (e.g. multicast addresses, addresses * within FAITH prefixes and such). */ - if (deliverifp && !ip6_getdstifaddr(m)) { + if (deliverifp) { struct in6_ifaddr *ia6; - ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); - if (ia6) { - if (!ip6_setdstifaddr(m, ia6)) { - /* - * XXX maybe we should drop the packet here, - * as we could not provide enough information - * to the upper layers. - */ - } + if ((ia6 = ip6_getdstifaddr(m)) != NULL) { ifa_free(&ia6->ia_ifa); + } else { + ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); + if (ia6) { + if (!ip6_setdstifaddr(m, ia6)) { + /* + * XXX maybe we should drop the packet here, + * as we could not provide enough information + * to the upper layers. + */ + } + ifa_free(&ia6->ia_ifa); + } } } Modified: releng/8.2/UPDATING ============================================================================== --- releng/8.2/UPDATING Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.2/UPDATING Tue Jun 12 12:10:10 2012 (r236953) @@ -15,6 +15,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20120612: p9 FreeBSD-SA-12:03.bind + FreeBSD-SA-12:04.sysret + FreeBSD-EN-12:02.ipv6refcount + Fix a problem where zero-length RDATA fields can cause named to crash. + [12:03] + + Correct a privilege escalation when returning from kernel if + running FreeBSD/amd64 on non-AMD processors. [12:04] + + Fix reference count errors in IPv6 code. [EN-12:02] + 20120530: p8 FreeBSD-SA-12:01.openssl (revised), FreeBSD-SA-12:02.crypt Update the previous openssl fix. [12:01] Modified: releng/8.2/contrib/bind9/lib/dns/rdata.c ============================================================================== --- releng/8.2/contrib/bind9/lib/dns/rdata.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.2/contrib/bind9/lib/dns/rdata.c Tue Jun 12 12:10:10 2012 (r236953) @@ -341,8 +341,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: releng/8.2/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- releng/8.2/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.2/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 12:10:10 2012 (r236953) @@ -125,6 +125,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -164,6 +169,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -196,8 +202,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -284,7 +289,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: releng/8.2/sys/amd64/amd64/trap.c ============================================================================== --- releng/8.2/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.2/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -907,4 +907,21 @@ syscall(struct trapframe *frame) syscallname(td->td_proc, sa.code))); syscallret(td, error, &sa); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } Modified: releng/8.2/sys/conf/newvers.sh ============================================================================== --- releng/8.2/sys/conf/newvers.sh Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.2/sys/conf/newvers.sh Tue Jun 12 12:10:10 2012 (r236953) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.2" -BRANCH="RELEASE-p8" +BRANCH="RELEASE-p9" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.2/sys/netinet/tcp_input.c ============================================================================== --- releng/8.2/sys/netinet/tcp_input.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.2/sys/netinet/tcp_input.c Tue Jun 12 12:10:10 2012 (r236953) @@ -293,6 +293,8 @@ tcp6_input(struct mbuf **mp, int *offp, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); return IPPROTO_DONE; } + if (ia6) + ifa_free(&ia6->ia_ifa); tcp_input(m, *offp); return IPPROTO_DONE; @@ -941,7 +943,8 @@ relocked: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } - ifa_free(&ia6->ia_ifa); + if (ia6) + ifa_free(&ia6->ia_ifa); } #endif /* Modified: releng/8.2/sys/netinet6/in6.c ============================================================================== --- releng/8.2/sys/netinet6/in6.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.2/sys/netinet6/in6.c Tue Jun 12 12:10:10 2012 (r236953) @@ -1370,6 +1370,8 @@ in6_purgeaddr(struct ifaddr *ifa) } cleanup: + if (ifa0 != NULL) + ifa_free(ifa0); plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ if ((ia->ia_flags & IFA_ROUTE) && plen == 128) { @@ -1394,8 +1396,6 @@ cleanup: return; ia->ia_flags &= ~IFA_ROUTE; } - if (ifa0 != NULL) - ifa_free(ifa0); in6_unlink_ifa(ia, ifp); } @@ -1549,14 +1549,19 @@ in6_lifaddr_ioctl(struct socket *so, u_l hostid = IFA_IN6(ifa); /* prefixlen must be <= 64. */ - if (64 < iflr->prefixlen) + if (64 < iflr->prefixlen) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; + } prefixlen = iflr->prefixlen; /* hostid part must be zero. */ sin6 = (struct sockaddr_in6 *)&iflr->addr; if (sin6->sin6_addr.s6_addr32[2] != 0 || sin6->sin6_addr.s6_addr32[3] != 0) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; } } else @@ -2144,14 +2149,20 @@ in6_ifawithifp(struct ifnet *ifp, struct IN6_IFADDR_RUNLOCK(); return (struct in6_ifaddr *)ifa; } - IN6_IFADDR_RUNLOCK(); /* use the last-resort values, that are, deprecated addresses */ - if (dep[0]) + if (dep[0]) { + ifa_ref((struct ifaddr *)dep[0]); + IN6_IFADDR_RUNLOCK(); return dep[0]; - if (dep[1]) + } + if (dep[1]) { + ifa_ref((struct ifaddr *)dep[1]); + IN6_IFADDR_RUNLOCK(); return dep[1]; + } + IN6_IFADDR_RUNLOCK(); return NULL; } Modified: releng/8.2/sys/netinet6/ip6_input.c ============================================================================== --- releng/8.2/sys/netinet6/ip6_input.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.2/sys/netinet6/ip6_input.c Tue Jun 12 12:10:10 2012 (r236953) @@ -734,19 +734,23 @@ passin: * as our interface address (e.g. multicast addresses, addresses * within FAITH prefixes and such). */ - if (deliverifp && !ip6_getdstifaddr(m)) { + if (deliverifp) { struct in6_ifaddr *ia6; - ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); - if (ia6) { - if (!ip6_setdstifaddr(m, ia6)) { - /* - * XXX maybe we should drop the packet here, - * as we could not provide enough information - * to the upper layers. - */ - } + if ((ia6 = ip6_getdstifaddr(m)) != NULL) { ifa_free(&ia6->ia_ifa); + } else { + ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); + if (ia6) { + if (!ip6_setdstifaddr(m, ia6)) { + /* + * XXX maybe we should drop the packet here, + * as we could not provide enough information + * to the upper layers. + */ + } + ifa_free(&ia6->ia_ifa); + } } } Modified: releng/8.3/UPDATING ============================================================================== --- releng/8.3/UPDATING Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.3/UPDATING Tue Jun 12 12:10:10 2012 (r236953) @@ -15,6 +15,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20120612: p3 FreeBSD-SA-12:03.bind + FreeBSD-SA-12:04.sysret + FreeBSD-EN-12:02.ipv6refcount + Fix a problem where zero-length RDATA fields can cause named to crash. + [12:03] + + Correct a privilege escalation when returning from kernel if + running FreeBSD/amd64 on non-AMD processors. [12:04] + + Fix reference count errors in IPv6 code. [EN-12:02] + 20120530: p2 FreeBSD-SA-12:01.openssl (revised), FreeBSD-SA-12:02.crypt Update the previous openssl fix. [12:01] Modified: releng/8.3/contrib/bind9/lib/dns/rdata.c ============================================================================== --- releng/8.3/contrib/bind9/lib/dns/rdata.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.3/contrib/bind9/lib/dns/rdata.c Tue Jun 12 12:10:10 2012 (r236953) @@ -341,8 +341,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: releng/8.3/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- releng/8.3/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.3/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 12:10:10 2012 (r236953) @@ -125,6 +125,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -164,6 +169,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -196,8 +202,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -284,7 +289,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: releng/8.3/sys/amd64/amd64/trap.c ============================================================================== --- releng/8.3/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.3/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -945,4 +945,21 @@ amd64_syscall(struct thread *td, int tra syscallname(td->td_proc, sa.code))); syscallret(td, error, &sa); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } Modified: releng/8.3/sys/conf/newvers.sh ============================================================================== --- releng/8.3/sys/conf/newvers.sh Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.3/sys/conf/newvers.sh Tue Jun 12 12:10:10 2012 (r236953) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.3" -BRANCH="RELEASE-p2" +BRANCH="RELEASE-p3" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.3/sys/netinet/tcp_input.c ============================================================================== --- releng/8.3/sys/netinet/tcp_input.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.3/sys/netinet/tcp_input.c Tue Jun 12 12:10:10 2012 (r236953) @@ -538,6 +538,8 @@ tcp6_input(struct mbuf **mp, int *offp, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); return IPPROTO_DONE; } + if (ia6) + ifa_free(&ia6->ia_ifa); tcp_input(m, *offp); return IPPROTO_DONE; @@ -1206,7 +1208,8 @@ relocked: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } - ifa_free(&ia6->ia_ifa); + if (ia6) + ifa_free(&ia6->ia_ifa); } #endif /* Modified: releng/8.3/sys/netinet6/in6.c ============================================================================== --- releng/8.3/sys/netinet6/in6.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.3/sys/netinet6/in6.c Tue Jun 12 12:10:10 2012 (r236953) @@ -1548,14 +1548,19 @@ in6_lifaddr_ioctl(struct socket *so, u_l hostid = IFA_IN6(ifa); /* prefixlen must be <= 64. */ - if (64 < iflr->prefixlen) + if (64 < iflr->prefixlen) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; + } prefixlen = iflr->prefixlen; /* hostid part must be zero. */ sin6 = (struct sockaddr_in6 *)&iflr->addr; if (sin6->sin6_addr.s6_addr32[2] != 0 || sin6->sin6_addr.s6_addr32[3] != 0) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; } } else @@ -2148,14 +2153,20 @@ in6_ifawithifp(struct ifnet *ifp, struct IF_ADDR_UNLOCK(ifp); return (struct in6_ifaddr *)ifa; } - IF_ADDR_UNLOCK(ifp); /* use the last-resort values, that are, deprecated addresses */ - if (dep[0]) + if (dep[0]) { + ifa_ref((struct ifaddr *)dep[0]); + IF_ADDR_UNLOCK(ifp); return dep[0]; - if (dep[1]) + } + if (dep[1]) { + ifa_ref((struct ifaddr *)dep[1]); + IF_ADDR_UNLOCK(ifp); return dep[1]; + } + IF_ADDR_UNLOCK(ifp); return NULL; } Modified: releng/8.3/sys/netinet6/ip6_input.c ============================================================================== --- releng/8.3/sys/netinet6/ip6_input.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/8.3/sys/netinet6/ip6_input.c Tue Jun 12 12:10:10 2012 (r236953) @@ -734,19 +734,23 @@ passin: * as our interface address (e.g. multicast addresses, addresses * within FAITH prefixes and such). */ - if (deliverifp && !ip6_getdstifaddr(m)) { + if (deliverifp) { struct in6_ifaddr *ia6; - ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); - if (ia6) { - if (!ip6_setdstifaddr(m, ia6)) { - /* - * XXX maybe we should drop the packet here, - * as we could not provide enough information - * to the upper layers. - */ - } + if ((ia6 = ip6_getdstifaddr(m)) != NULL) { ifa_free(&ia6->ia_ifa); + } else { + ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); + if (ia6) { + if (!ip6_setdstifaddr(m, ia6)) { + /* + * XXX maybe we should drop the packet here, + * as we could not provide enough information + * to the upper layers. + */ + } + ifa_free(&ia6->ia_ifa); + } } } Modified: releng/9.0/UPDATING ============================================================================== --- releng/9.0/UPDATING Tue Jun 12 11:08:51 2012 (r236952) +++ releng/9.0/UPDATING Tue Jun 12 12:10:10 2012 (r236953) @@ -9,6 +9,17 @@ handbook. Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20120612: p3 FreeBSD-SA-12:03.bind + FreeBSD-SA-12:04.sysret + FreeBSD-EN-12:02.ipv6refcount + Fix a problem where zero-length RDATA fields can cause named to crash. + [12:03] + + Correct a privilege escalation when returning from kernel if + running FreeBSD/amd64 on non-AMD processors. [12:04] + + Fix reference count errors in IPv6 code. [EN-12:02] + 20120530: p2 FreeBSD-SA-12:01.openssl (revised), FreeBSD-SA-12:02.crypt Update the previous openssl fix. [12:01] Modified: releng/9.0/contrib/bind9/lib/dns/rdata.c ============================================================================== --- releng/9.0/contrib/bind9/lib/dns/rdata.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/9.0/contrib/bind9/lib/dns/rdata.c Tue Jun 12 12:10:10 2012 (r236953) @@ -325,8 +325,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); @@ -356,8 +356,8 @@ dns_rdata_casecompare(const dns_rdata_t REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: releng/9.0/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- releng/9.0/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/9.0/contrib/bind9/lib/dns/rdataslab.c Tue Jun 12 12:10:10 2012 (r236953) @@ -125,6 +125,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -168,6 +173,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -200,8 +206,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -291,7 +296,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: releng/9.0/sys/amd64/amd64/trap.c ============================================================================== --- releng/9.0/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/9.0/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -939,4 +939,21 @@ amd64_syscall(struct thread *td, int tra syscallname(td->td_proc, sa.code))); syscallret(td, error, &sa); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } Modified: releng/9.0/sys/conf/newvers.sh ============================================================================== --- releng/9.0/sys/conf/newvers.sh Tue Jun 12 11:08:51 2012 (r236952) +++ releng/9.0/sys/conf/newvers.sh Tue Jun 12 12:10:10 2012 (r236953) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.0" -BRANCH="RELEASE-p2" +BRANCH="RELEASE-p3" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/9.0/sys/netinet/tcp_input.c ============================================================================== --- releng/9.0/sys/netinet/tcp_input.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/9.0/sys/netinet/tcp_input.c Tue Jun 12 12:10:10 2012 (r236953) @@ -543,6 +543,8 @@ tcp6_input(struct mbuf **mp, int *offp, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); return IPPROTO_DONE; } + if (ia6) + ifa_free(&ia6->ia_ifa); tcp_input(m, *offp); return IPPROTO_DONE; @@ -1253,7 +1255,8 @@ relocked: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } - ifa_free(&ia6->ia_ifa); + if (ia6) + ifa_free(&ia6->ia_ifa); } #endif /* INET6 */ /* Modified: releng/9.0/sys/netinet6/in6.c ============================================================================== --- releng/9.0/sys/netinet6/in6.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/9.0/sys/netinet6/in6.c Tue Jun 12 12:10:10 2012 (r236953) @@ -1453,6 +1453,8 @@ in6_purgeaddr(struct ifaddr *ifa) } cleanup: + if (ifa0 != NULL) + ifa_free(ifa0); plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ if ((ia->ia_flags & IFA_ROUTE) && plen == 128) { @@ -1477,8 +1479,6 @@ cleanup: return; ia->ia_flags &= ~IFA_ROUTE; } - if (ifa0 != NULL) - ifa_free(ifa0); in6_unlink_ifa(ia, ifp); } @@ -1632,14 +1632,19 @@ in6_lifaddr_ioctl(struct socket *so, u_l hostid = IFA_IN6(ifa); /* prefixlen must be <= 64. */ - if (64 < iflr->prefixlen) + if (64 < iflr->prefixlen) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; + } prefixlen = iflr->prefixlen; /* hostid part must be zero. */ sin6 = (struct sockaddr_in6 *)&iflr->addr; if (sin6->sin6_addr.s6_addr32[2] != 0 || sin6->sin6_addr.s6_addr32[3] != 0) { + if (ifa != NULL) + ifa_free(ifa); return EINVAL; } } else @@ -2230,14 +2235,20 @@ in6_ifawithifp(struct ifnet *ifp, struct IN6_IFADDR_RUNLOCK(); return (struct in6_ifaddr *)ifa; } - IN6_IFADDR_RUNLOCK(); /* use the last-resort values, that are, deprecated addresses */ - if (dep[0]) + if (dep[0]) { + ifa_ref((struct ifaddr *)dep[0]); + IN6_IFADDR_RUNLOCK(); return dep[0]; - if (dep[1]) + } + if (dep[1]) { + ifa_ref((struct ifaddr *)dep[1]); + IN6_IFADDR_RUNLOCK(); return dep[1]; + } + IN6_IFADDR_RUNLOCK(); return NULL; } Modified: releng/9.0/sys/netinet6/ip6_input.c ============================================================================== --- releng/9.0/sys/netinet6/ip6_input.c Tue Jun 12 11:08:51 2012 (r236952) +++ releng/9.0/sys/netinet6/ip6_input.c Tue Jun 12 12:10:10 2012 (r236953) @@ -797,19 +797,23 @@ passin: * as our interface address (e.g. multicast addresses, addresses * within FAITH prefixes and such). */ - if (deliverifp && !ip6_getdstifaddr(m)) { + if (deliverifp) { struct in6_ifaddr *ia6; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 12:10:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D04411065676; Tue, 12 Jun 2012 12:10:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE9788FC18; Tue, 12 Jun 2012 12:10:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CCADFb052451; Tue, 12 Jun 2012 12:10:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CCADli052448; Tue, 12 Jun 2012 12:10:13 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201206121210.q5CCADli052448@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 12 Jun 2012 12:10:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236953 - head/sys/amd64/amd64 releng/7.4 releng/7.4/contrib/bind9/lib/dns releng/7.4/sys/amd64/amd64 releng/7.4/sys/conf releng/8.1 releng/8.1/contrib/bind9/lib/dns releng/8.1/sys/amd6... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:10:14 -0000 Author: bz Date: Tue Jun 12 12:10:10 2012 New Revision: 236953 URL: http://svn.freebsd.org/changeset/base/236953 Log: Fix a problem where zero-length RDATA fields can cause named(8) to crash. [12:03] Correct a privilege escalation when returning from kernel if running FreeBSD/amd64 on non-AMD processors. [12:04] Fix reference count errors in IPv6 code. [EN-12:02] Security: CVE-2012-1667 Security: FreeBSD-SA-12:03.bind Security: CVE-2012-0217 Security: FreeBSD-SA-12:04.sysret Security: FreeBSD-EN-12:02.ipv6refcount Approved by: so (simon, bz) Modified: head/sys/amd64/amd64/trap.c Changes in other areas also in this revision: Modified: releng/7.4/UPDATING releng/7.4/contrib/bind9/lib/dns/rdata.c releng/7.4/contrib/bind9/lib/dns/rdataslab.c releng/7.4/sys/amd64/amd64/trap.c releng/7.4/sys/conf/newvers.sh releng/8.1/UPDATING releng/8.1/contrib/bind9/lib/dns/rdata.c releng/8.1/contrib/bind9/lib/dns/rdataslab.c releng/8.1/sys/amd64/amd64/trap.c releng/8.1/sys/conf/newvers.sh releng/8.1/sys/netinet/tcp_input.c releng/8.1/sys/netinet6/in6.c releng/8.1/sys/netinet6/ip6_input.c releng/8.2/UPDATING releng/8.2/contrib/bind9/lib/dns/rdata.c releng/8.2/contrib/bind9/lib/dns/rdataslab.c releng/8.2/sys/amd64/amd64/trap.c releng/8.2/sys/conf/newvers.sh releng/8.2/sys/netinet/tcp_input.c releng/8.2/sys/netinet6/in6.c releng/8.2/sys/netinet6/ip6_input.c releng/8.3/UPDATING releng/8.3/contrib/bind9/lib/dns/rdata.c releng/8.3/contrib/bind9/lib/dns/rdataslab.c releng/8.3/sys/amd64/amd64/trap.c releng/8.3/sys/conf/newvers.sh releng/8.3/sys/netinet/tcp_input.c releng/8.3/sys/netinet6/in6.c releng/8.3/sys/netinet6/ip6_input.c releng/9.0/UPDATING releng/9.0/contrib/bind9/lib/dns/rdata.c releng/9.0/contrib/bind9/lib/dns/rdataslab.c releng/9.0/sys/amd64/amd64/trap.c releng/9.0/sys/conf/newvers.sh releng/9.0/sys/netinet/tcp_input.c releng/9.0/sys/netinet6/in6.c releng/9.0/sys/netinet6/ip6_input.c stable/7/contrib/bind9/lib/dns/rdata.c stable/7/contrib/bind9/lib/dns/rdataslab.c stable/7/sys/amd64/amd64/trap.c stable/8/sys/amd64/amd64/trap.c stable/9/sys/amd64/amd64/trap.c Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Tue Jun 12 11:08:51 2012 (r236952) +++ head/sys/amd64/amd64/trap.c Tue Jun 12 12:10:10 2012 (r236953) @@ -972,4 +972,21 @@ amd64_syscall(struct thread *td, int tra syscallname(td->td_proc, sa.code))); syscallret(td, error, &sa); + + /* + * If the user-supplied value of %rip is not a canonical + * address, then some CPUs will trigger a ring 0 #GP during + * the sysret instruction. However, the fault handler would + * execute with the user's %gs and %rsp in ring 0 which would + * not be safe. Instead, preemptively kill the thread with a + * SIGBUS. + */ + if (td->td_frame->tf_rip >= VM_MAXUSER_ADDRESS) { + ksiginfo_init_trap(&ksi); + ksi.ksi_signo = SIGBUS; + ksi.ksi_code = BUS_OBJERR; + ksi.ksi_trapno = T_PROTFLT; + ksi.ksi_addr = (void *)td->td_frame->tf_rip; + trapsignal(td, &ksi); + } } From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 12:40:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1DE0B106566C; Tue, 12 Jun 2012 12:40:16 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 081868FC17; Tue, 12 Jun 2012 12:40:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CCeFPI053741; Tue, 12 Jun 2012 12:40:15 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CCeFC8053739; Tue, 12 Jun 2012 12:40:15 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201206121240.q5CCeFC8053739@svn.freebsd.org> From: Randall Stewart Date: Tue, 12 Jun 2012 12:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236954 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:40:16 -0000 Author: rrs Date: Tue Jun 12 12:40:15 2012 New Revision: 236954 URL: http://svn.freebsd.org/changeset/base/236954 Log: Opps forgot to commit the flag. Modified: head/sys/net/if.h Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Tue Jun 12 12:10:10 2012 (r236953) +++ head/sys/net/if.h Tue Jun 12 12:40:15 2012 (r236954) @@ -153,7 +153,7 @@ struct if_data { #define IFF_STATICARP 0x80000 /* (n) static ARP */ #define IFF_DYING 0x200000 /* (n) interface is winding down */ #define IFF_RENAMING 0x400000 /* (n) interface is being renamed */ - +#define IFF_GIF_WANTED 0x1000000 /* (n) The gif tunnel is wanted */ /* * Old names for driver flags so that user space tools can continue to use * the old (portable) names. From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 12:44:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECCF1106564A; Tue, 12 Jun 2012 12:44:17 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8E748FC08; Tue, 12 Jun 2012 12:44:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CCiHNH053942; Tue, 12 Jun 2012 12:44:17 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CCiH4i053940; Tue, 12 Jun 2012 12:44:17 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201206121244.q5CCiH4i053940@svn.freebsd.org> From: Randall Stewart Date: Tue, 12 Jun 2012 12:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236955 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:44:18 -0000 Author: rrs Date: Tue Jun 12 12:44:17 2012 New Revision: 236955 URL: http://svn.freebsd.org/changeset/base/236955 Log: Note to self. Have morning coffee *before* committing things. There is no mac_addr in the mbuf for BSD.. cheat like we are supposed to and use the csum field since our friend the gif tunnel itself will never use offload. Modified: head/sys/net/if_gif.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Tue Jun 12 12:40:15 2012 (r236954) +++ head/sys/net/if_gif.c Tue Jun 12 12:44:17 2012 (r236955) @@ -388,7 +388,8 @@ keep_going: /* Now pull back the af in packet that * was saved in the address location. */ - bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af)); + af = m->m_pkthdr.csum_data; + if (ifp->if_bridge) af = AF_LINK; @@ -503,10 +504,11 @@ gif_output(ifp, m, dst, ro) dst->sa_family = af; } af = dst->sa_family; - /* Now save the af in the inbound pkt mac - * address location. + /* Now save the af in the inbound pkt csum + * data, this is a cheat since really + * gif tunnels don't do offload. */ - bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af)); + m->m_pkthdr.csum_data = af; if (!(ifp->if_flags & IFF_UP) || sc->gif_psrc == NULL || sc->gif_pdst == NULL) { m_freem(m); From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 12:53:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 418BD106564A; Tue, 12 Jun 2012 12:53:06 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) by mx1.freebsd.org (Postfix) with ESMTP id E1F8F8FC18; Tue, 12 Jun 2012 12:53:05 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 8176525D388E; Tue, 12 Jun 2012 12:53:04 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 6F01CBE7F37; Tue, 12 Jun 2012 12:53:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 6ZVljYhAYBPn; Tue, 12 Jun 2012 12:53:02 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id D49F8BE7F36; Tue, 12 Jun 2012 12:53:01 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201206121244.q5CCiH4i053940@svn.freebsd.org> Date: Tue, 12 Jun 2012 12:53:00 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <70EDDE72-B9FE-45AB-B3C5-248B95E1E960@lists.zabbadoz.net> References: <201206121244.q5CCiH4i053940@svn.freebsd.org> To: Randall Stewart X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236955 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 12:53:06 -0000 On 12. Jun 2012, at 12:44 , Randall Stewart wrote: > Author: rrs > Date: Tue Jun 12 12:44:17 2012 > New Revision: 236955 > URL: http://svn.freebsd.org/changeset/base/236955 >=20 > Log: > Note to self. Have morning coffee *before* committing things. > There is no mac_addr in the mbuf for BSD.. cheat like > we are supposed to and use the csum field since our friend > the gif tunnel itself will never use offload. There are cards that can do checksums for IPIP... with drivers in out = tree. >=20 > Modified: > head/sys/net/if_gif.c >=20 > Modified: head/sys/net/if_gif.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/net/if_gif.c Tue Jun 12 12:40:15 2012 = (r236954) > +++ head/sys/net/if_gif.c Tue Jun 12 12:44:17 2012 = (r236955) > @@ -388,7 +388,8 @@ keep_going: > /* Now pull back the af in packet that > * was saved in the address location. > */ > - bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af)); > + af =3D m->m_pkthdr.csum_data; > + =09 > if (ifp->if_bridge) > af =3D AF_LINK; >=20 > @@ -503,10 +504,11 @@ gif_output(ifp, m, dst, ro) > dst->sa_family =3D af; > } > af =3D dst->sa_family; > - /* Now save the af in the inbound pkt mac > - * address location. > + /* Now save the af in the inbound pkt csum > + * data, this is a cheat since really > + * gif tunnels don't do offload. > */ > - bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af)); > + m->m_pkthdr.csum_data =3D af; > if (!(ifp->if_flags & IFF_UP) || > sc->gif_psrc =3D=3D NULL || sc->gif_pdst =3D=3D NULL) { > m_freem(m); --=20 Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 13:15:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DF502106564A; Tue, 12 Jun 2012 13:15:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C95738FC08; Tue, 12 Jun 2012 13:15:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CDFRKE055254; Tue, 12 Jun 2012 13:15:27 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CDFRQs055250; Tue, 12 Jun 2012 13:15:27 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206121315.q5CDFRQs055250@svn.freebsd.org> From: Michael Tuexen Date: Tue, 12 Jun 2012 13:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236956 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 13:15:28 -0000 Author: tuexen Date: Tue Jun 12 13:15:27 2012 New Revision: 236956 URL: http://svn.freebsd.org/changeset/base/236956 Log: Unify the sending of ABORT, SHUTDOWN-COMPLETE and ERROR chunks. While there: Fix also some minor bugs and prepare for SCTP/DTLS. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Tue Jun 12 12:44:17 2012 (r236955) +++ head/sys/netinet/sctp_input.c Tue Jun 12 13:15:27 2012 (r236956) @@ -1442,7 +1442,7 @@ sctp_process_cookie_existing(struct mbuf ph = mtod(op_err, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_COOKIE_IN_SHUTDOWN); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - sctp_send_operr_to(m, iphlen, op_err, cookie->peers_vtag, + sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, vrf_id, net->port); if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 2; @@ -2570,7 +2570,7 @@ sctp_handle_cookie_echo(struct mbuf *m, if (tim == 0) tim = now.tv_usec - cookie->time_entered.tv_usec; scm->time_usec = htonl(tim); - sctp_send_operr_to(m, iphlen, op_err, cookie->peers_vtag, + sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, vrf_id, port); return (NULL); } Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Tue Jun 12 12:44:17 2012 (r236955) +++ head/sys/netinet/sctp_output.c Tue Jun 12 13:15:27 2012 (r236956) @@ -4478,7 +4478,7 @@ sctp_lowlevel_chunk_output(struct sctp_i #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - m->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; + m->m_pkthdr.csum_flags = CSUM_SCTP; m->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -10854,19 +10854,20 @@ sctp_send_shutdown_complete(struct sctp_ return; } -void -sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh, - uint32_t vrf_id, uint16_t port) +static void +sctp_send_resp_msg(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, + uint8_t type, struct mbuf *cause, uint32_t vrf_id, uint16_t port) { - /* formulate and SEND a SHUTDOWN-COMPLETE */ struct mbuf *o_pak; struct mbuf *mout; + struct sctphdr *shout; + struct sctp_chunkhdr *ch; struct ip *iph; - struct udphdr *udp = NULL; - int offset_out, len, mlen; - struct sctp_shutdown_complete_msg *comp_cp; + struct udphdr *udp; + int len, cause_len, padding_len, ret; #ifdef INET + sctp_route_t ro; struct ip *iph_out; #endif @@ -10875,31 +10876,59 @@ sctp_send_shutdown_complete2(struct mbuf #endif + /* Compute the length of the cause and add final padding. */ + cause_len = 0; + if (cause != NULL) { + struct mbuf *m_at, *m_last = NULL; + + for (m_at = cause; m_at; m_at = SCTP_BUF_NEXT(m_at)) { + if (SCTP_BUF_NEXT(m_at) == NULL) + m_last = m_at; + cause_len += SCTP_BUF_LEN(m_at); + } + padding_len = cause_len % 4; + if (padding_len != 0) { + padding_len = 4 - padding_len; + } + if (padding_len != 0) { + if (sctp_add_pad_tombuf(m_last, padding_len)) { + sctp_m_freem(cause); + return; + } + } + } else { + padding_len = 0; + } + /* Get an mbuf for the header. */ + len = sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); iph = mtod(m, struct ip *); switch (iph->ip_v) { #ifdef INET case IPVERSION: - len = (sizeof(struct ip) + sizeof(struct sctp_shutdown_complete_msg)); + len += sizeof(struct ip); break; #endif #ifdef INET6 case IPV6_VERSION >> 4: - len = (sizeof(struct ip6_hdr) + sizeof(struct sctp_shutdown_complete_msg)); + len += sizeof(struct ip6_hdr); break; #endif default: - return; + break; } if (port) { len += sizeof(struct udphdr); } mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_DONTWAIT, 1, MT_DATA); if (mout == NULL) { + if (cause) { + sctp_m_freem(cause); + } return; } SCTP_BUF_RESV_UF(mout, max_linkhdr); SCTP_BUF_LEN(mout) = len; - SCTP_BUF_NEXT(mout) = NULL; + SCTP_BUF_NEXT(mout) = cause; if (m->m_flags & M_FLOWID) { mout->m_pkthdr.flowid = m->m_pkthdr.flowid; mout->m_flags |= M_FLOWID; @@ -10910,18 +10939,14 @@ sctp_send_shutdown_complete2(struct mbuf #ifdef INET6 ip6_out = NULL; #endif - offset_out = 0; - switch (iph->ip_v) { #ifdef INET case IPVERSION: iph_out = mtod(mout, struct ip *); - - /* Fill in the IP header for the ABORT */ iph_out->ip_v = IPVERSION; - iph_out->ip_hl = (sizeof(struct ip) / 4); - iph_out->ip_tos = (u_char)0; - iph_out->ip_id = 0; + iph_out->ip_hl = (sizeof(struct ip) >> 2); + iph_out->ip_tos = 0; + iph_out->ip_id = ip_newid(); iph_out->ip_off = 0; iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); if (port) { @@ -10931,21 +10956,19 @@ sctp_send_shutdown_complete2(struct mbuf } iph_out->ip_src.s_addr = iph->ip_dst.s_addr; iph_out->ip_dst.s_addr = iph->ip_src.s_addr; - - /* let IP layer calculate this */ iph_out->ip_sum = 0; - offset_out += sizeof(*iph_out); - comp_cp = (struct sctp_shutdown_complete_msg *)( - (caddr_t)iph_out + offset_out); + len = sizeof(struct ip); + shout = (struct sctphdr *)((caddr_t)iph_out + len); break; #endif #ifdef INET6 case IPV6_VERSION >> 4: ip6 = (struct ip6_hdr *)iph; ip6_out = mtod(mout, struct ip6_hdr *); - - /* Fill in the IPv6 header for the ABORT */ - ip6_out->ip6_flow = ip6->ip6_flow; + ip6_out->ip6_flow = htonl(0x60000000); + if (V_ip6_auto_flowlabel) { + ip6_out->ip6_flow |= (htonl(ip6_randomflowlabel()) & IPV6_FLOWLABEL_MASK); + } ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); if (port) { ip6_out->ip6_nxt = IPPROTO_UDP; @@ -10954,78 +10977,84 @@ sctp_send_shutdown_complete2(struct mbuf } ip6_out->ip6_src = ip6->ip6_dst; ip6_out->ip6_dst = ip6->ip6_src; - /* - * ?? The old code had both the iph len + payload, I think - * this is wrong and would never have worked - */ - ip6_out->ip6_plen = sizeof(struct sctp_shutdown_complete_msg); - offset_out += sizeof(*ip6_out); - comp_cp = (struct sctp_shutdown_complete_msg *)( - (caddr_t)ip6_out + offset_out); + len = sizeof(struct ip6_hdr); + shout = (struct sctphdr *)((caddr_t)ip6_out + len); break; -#endif /* INET6 */ +#endif default: - /* Currently not supported. */ - sctp_m_freem(mout); - return; + len = 0; + shout = mtod(mout, struct sctphdr *); + break; } if (port) { if (htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) == 0) { sctp_m_freem(mout); return; } - udp = (struct udphdr *)comp_cp; + udp = (struct udphdr *)shout; udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); udp->uh_dport = port; - udp->uh_ulen = htons(sizeof(struct sctp_shutdown_complete_msg) + sizeof(struct udphdr)); -#ifdef INET - if (iph_out) { - if (V_udp_cksum) { - udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); - } else { - udp->uh_sum = 0; - } - } -#endif - offset_out += sizeof(struct udphdr); - comp_cp = (struct sctp_shutdown_complete_msg *)((caddr_t)comp_cp + sizeof(struct udphdr)); + udp->uh_sum = 0; + udp->uh_ulen = htons(sizeof(struct udphdr) + + sizeof(struct sctphdr) + + sizeof(struct sctp_chunkhdr) + + cause_len + padding_len); + len += sizeof(struct udphdr); + shout = (struct sctphdr *)((caddr_t)shout + sizeof(struct udphdr)); + } else { + udp = NULL; + } + shout->src_port = sh->dest_port; + shout->dest_port = sh->src_port; + shout->checksum = 0; + if (vtag) { + shout->v_tag = htonl(vtag); + } else { + shout->v_tag = sh->v_tag; } + len += sizeof(struct sctphdr); + ch = (struct sctp_chunkhdr *)((caddr_t)shout + sizeof(struct sctphdr)); + ch->chunk_type = type; + if (vtag) { + ch->chunk_flags = 0; + } else { + ch->chunk_flags = SCTP_HAD_NO_TCB; + } + ch->chunk_length = htons(sizeof(struct sctp_chunkhdr) + cause_len); + len += sizeof(struct sctp_chunkhdr); + len += cause_len + padding_len; + if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) { - /* no mbuf's */ sctp_m_freem(mout); return; } - /* Now copy in and fill in the ABORT tags etc. */ - comp_cp->sh.src_port = sh->dest_port; - comp_cp->sh.dest_port = sh->src_port; - comp_cp->sh.checksum = 0; - comp_cp->sh.v_tag = sh->v_tag; - comp_cp->shut_cmp.ch.chunk_flags = SCTP_HAD_NO_TCB; - comp_cp->shut_cmp.ch.chunk_type = SCTP_SHUTDOWN_COMPLETE; - comp_cp->shut_cmp.ch.chunk_length = htons(sizeof(struct sctp_shutdown_complete_chunk)); - + SCTP_ATTACH_CHAIN(o_pak, mout, len); #ifdef INET if (iph_out != NULL) { - sctp_route_t ro; - int ret; - - mlen = SCTP_BUF_LEN(mout); - bzero(&ro, sizeof ro); - /* set IPv4 length */ - iph_out->ip_len = mlen; -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, mlen); + /* zap the stack pointer to the route */ + bzero(&ro, sizeof(sctp_route_t)); + if (port) { + if (V_udp_cksum) { + udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); + } else { + udp->uh_sum = 0; + } + } + iph_out->ip_len = len; +#ifdef SCTP_PACKET_LOGGING + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { + sctp_packet_log(mout, len); + } #endif if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - comp_cp->sh.checksum = sctp_calculate_cksum(mout, offset_out); + shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip) + sizeof(struct udphdr)); SCTP_STAT_INCR(sctps_sendswcrc); #endif if (V_udp_cksum) { - SCTP_ENABLE_UDP_CSUM(mout); + SCTP_ENABLE_UDP_CSUM(o_pak); } } else { #if defined(SCTP_WITH_NO_CSUM) @@ -11036,40 +11065,36 @@ sctp_send_shutdown_complete2(struct mbuf SCTP_STAT_INCR(sctps_sendhwcrc); #endif } - SCTP_ATTACH_CHAIN(o_pak, mout, mlen); - /* out it goes */ SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); - /* Free the route if we got one back */ - if (ro.ro_rt) + if (ro.ro_rt) { RTFREE(ro.ro_rt); + } } #endif #ifdef INET6 if (ip6_out != NULL) { - int ret; - - mlen = SCTP_BUF_LEN(mout); + ip6_out->ip6_plen = len - sizeof(struct ip6_hdr); #ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, mlen); + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) { + sctp_packet_log(mout, len); + } #endif - SCTP_ATTACH_CHAIN(o_pak, mout, mlen); if (port) { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - comp_cp->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); + shout->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); SCTP_STAT_INCR(sctps_sendswcrc); #endif - if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), mlen - sizeof(struct ip6_hdr))) == 0) { + if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { #if defined(SCTP_WITH_NO_CSUM) SCTP_STAT_INCR(sctps_sendnocrc); #else - mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; + mout->m_pkthdr.csum_flags = CSUM_SCTP; mout->m_pkthdr.csum_data = 0; SCTP_STAT_INCR(sctps_sendhwcrc); #endif @@ -11081,7 +11106,13 @@ sctp_send_shutdown_complete2(struct mbuf SCTP_STAT_INCR_COUNTER64(sctps_outpackets); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); return; +} +void +sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh, + uint32_t vrf_id, uint16_t port) +{ + sctp_send_resp_msg(m, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL, vrf_id, port); } void @@ -11913,528 +11944,24 @@ skip_stuff: void sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag, - struct mbuf *err_cause, uint32_t vrf_id, uint16_t port) + struct mbuf *cause, uint32_t vrf_id, uint16_t port) { - /*- - * Formulate the abort message, and send it back down. - */ - struct mbuf *o_pak; - struct mbuf *mout; - struct sctp_abort_msg *abm; - struct ip *iph; - struct udphdr *udp; - int iphlen_out, len; - -#ifdef INET - struct ip *iph_out; - -#endif -#ifdef INET6 - struct ip6_hdr *ip6, *ip6_out; - -#endif - - /* don't respond to ABORT with ABORT */ + /* Don't respond to an ABORT with an ABORT. */ if (sctp_is_there_an_abort_here(m, iphlen, &vtag)) { - if (err_cause) - sctp_m_freem(err_cause); + if (cause) + sctp_m_freem(cause); return; } - iph = mtod(m, struct ip *); - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - len = (sizeof(struct ip) + sizeof(struct sctp_abort_msg)); - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - len = (sizeof(struct ip6_hdr) + sizeof(struct sctp_abort_msg)); - break; -#endif - default: - if (err_cause) { - sctp_m_freem(err_cause); - } - return; - } - if (port) { - len += sizeof(struct udphdr); - } - mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_DONTWAIT, 1, MT_DATA); - if (mout == NULL) { - if (err_cause) { - sctp_m_freem(err_cause); - } - return; - } - SCTP_BUF_RESV_UF(mout, max_linkhdr); - SCTP_BUF_LEN(mout) = len; - SCTP_BUF_NEXT(mout) = err_cause; - if (m->m_flags & M_FLOWID) { - mout->m_pkthdr.flowid = m->m_pkthdr.flowid; - mout->m_flags |= M_FLOWID; - } -#ifdef INET - iph_out = NULL; -#endif -#ifdef INET6 - ip6_out = NULL; -#endif - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - iph_out = mtod(mout, struct ip *); - - /* Fill in the IP header for the ABORT */ - iph_out->ip_v = IPVERSION; - iph_out->ip_hl = (sizeof(struct ip) / 4); - iph_out->ip_tos = (u_char)0; - iph_out->ip_id = 0; - iph_out->ip_off = 0; - iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); - if (port) { - iph_out->ip_p = IPPROTO_UDP; - } else { - iph_out->ip_p = IPPROTO_SCTP; - } - iph_out->ip_src.s_addr = iph->ip_dst.s_addr; - iph_out->ip_dst.s_addr = iph->ip_src.s_addr; - /* let IP layer calculate this */ - iph_out->ip_sum = 0; - - iphlen_out = sizeof(*iph_out); - abm = (struct sctp_abort_msg *)((caddr_t)iph_out + iphlen_out); - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - ip6 = (struct ip6_hdr *)iph; - ip6_out = mtod(mout, struct ip6_hdr *); - - /* Fill in the IP6 header for the ABORT */ - ip6_out->ip6_flow = ip6->ip6_flow; - ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); - if (port) { - ip6_out->ip6_nxt = IPPROTO_UDP; - } else { - ip6_out->ip6_nxt = IPPROTO_SCTP; - } - ip6_out->ip6_src = ip6->ip6_dst; - ip6_out->ip6_dst = ip6->ip6_src; - - iphlen_out = sizeof(*ip6_out); - abm = (struct sctp_abort_msg *)((caddr_t)ip6_out + iphlen_out); - break; -#endif /* INET6 */ - default: - /* Currently not supported */ - sctp_m_freem(mout); - return; - } - - udp = (struct udphdr *)abm; - if (port) { - if (htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) == 0) { - sctp_m_freem(mout); - return; - } - udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); - udp->uh_dport = port; - /* set udp->uh_ulen later */ - udp->uh_sum = 0; - iphlen_out += sizeof(struct udphdr); - abm = (struct sctp_abort_msg *)((caddr_t)abm + sizeof(struct udphdr)); - } - abm->sh.src_port = sh->dest_port; - abm->sh.dest_port = sh->src_port; - abm->sh.checksum = 0; - if (vtag == 0) { - abm->sh.v_tag = sh->v_tag; - abm->msg.ch.chunk_flags = SCTP_HAD_NO_TCB; - } else { - abm->sh.v_tag = htonl(vtag); - abm->msg.ch.chunk_flags = 0; - } - abm->msg.ch.chunk_type = SCTP_ABORT_ASSOCIATION; - - if (err_cause) { - struct mbuf *m_tmp = err_cause; - int err_len = 0; - - /* get length of the err_cause chain */ - while (m_tmp != NULL) { - err_len += SCTP_BUF_LEN(m_tmp); - m_tmp = SCTP_BUF_NEXT(m_tmp); - } - len = SCTP_BUF_LEN(mout) + err_len; - if (err_len % 4) { - /* need pad at end of chunk */ - uint32_t cpthis = 0; - int padlen; - - padlen = 4 - (len % 4); - m_copyback(mout, len, padlen, (caddr_t)&cpthis); - len += padlen; - } - abm->msg.ch.chunk_length = htons(sizeof(abm->msg.ch) + err_len); - } else { - len = SCTP_BUF_LEN(mout); - abm->msg.ch.chunk_length = htons(sizeof(abm->msg.ch)); - } - - if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) { - /* no mbuf's */ - sctp_m_freem(mout); - return; - } -#ifdef INET - if (iph_out != NULL) { - sctp_route_t ro; - int ret; - - /* zap the stack pointer to the route */ - bzero(&ro, sizeof ro); - if (port) { - udp->uh_ulen = htons(len - sizeof(struct ip)); - if (V_udp_cksum) { - udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); - } else { - udp->uh_sum = 0; - } - } - SCTPDBG(SCTP_DEBUG_OUTPUT2, "sctp_send_abort calling ip_output:\n"); - SCTPDBG_PKT(SCTP_DEBUG_OUTPUT2, iph_out, &abm->sh); - /* set IPv4 length */ - iph_out->ip_len = len; - /* out it goes */ -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, len); -#endif - SCTP_ATTACH_CHAIN(o_pak, mout, len); - if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - abm->sh.checksum = sctp_calculate_cksum(mout, iphlen_out); - SCTP_STAT_INCR(sctps_sendswcrc); -#endif - if (V_udp_cksum) { - SCTP_ENABLE_UDP_CSUM(o_pak); - } - } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); -#endif - } - SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); - } -#endif -#ifdef INET6 - if (ip6_out != NULL) { - int ret; - - if (port) { - udp->uh_ulen = htons(len - sizeof(struct ip6_hdr)); - } - SCTPDBG(SCTP_DEBUG_OUTPUT2, "sctp_send_abort calling ip6_output:\n"); - SCTPDBG_PKT(SCTP_DEBUG_OUTPUT2, (struct ip *)ip6_out, &abm->sh); - ip6_out->ip6_plen = len - sizeof(*ip6_out); -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, len); -#endif - SCTP_ATTACH_CHAIN(o_pak, mout, len); - if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - abm->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); -#endif - if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { - udp->uh_sum = 0xffff; - } - } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); -#endif - } - SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); - } -#endif - SCTP_STAT_INCR(sctps_sendpackets); - SCTP_STAT_INCR_COUNTER64(sctps_outpackets); - SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); + sctp_send_resp_msg(m, sh, vtag, SCTP_ABORT_ASSOCIATION, cause, vrf_id, port); + return; } void -sctp_send_operr_to(struct mbuf *m, int iphlen, struct mbuf *scm, uint32_t vtag, - uint32_t vrf_id, uint16_t port) +sctp_send_operr_to(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, + struct mbuf *cause, uint32_t vrf_id, uint16_t port) { - struct mbuf *o_pak; - struct sctphdr *sh, *sh_out; - struct sctp_chunkhdr *ch; - struct ip *iph; - struct udphdr *udp = NULL; - struct mbuf *mout; - int iphlen_out, len; - -#ifdef INET - struct ip *iph_out; - -#endif -#ifdef INET6 - struct ip6_hdr *ip6, *ip6_out; - -#endif - - iph = mtod(m, struct ip *); - sh = (struct sctphdr *)((caddr_t)iph + iphlen); - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - len = (sizeof(struct ip) + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr)); - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - len = (sizeof(struct ip6_hdr) + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr)); - break; -#endif - default: - if (scm) { - sctp_m_freem(scm); - } - return; - } - if (port) { - len += sizeof(struct udphdr); - } - mout = sctp_get_mbuf_for_msg(len + max_linkhdr, 1, M_DONTWAIT, 1, MT_DATA); - if (mout == NULL) { - if (scm) { - sctp_m_freem(scm); - } - return; - } - SCTP_BUF_RESV_UF(mout, max_linkhdr); - SCTP_BUF_LEN(mout) = len; - SCTP_BUF_NEXT(mout) = scm; - if (m->m_flags & M_FLOWID) { - mout->m_pkthdr.flowid = m->m_pkthdr.flowid; - mout->m_flags |= M_FLOWID; - } -#ifdef INET - iph_out = NULL; -#endif -#ifdef INET6 - ip6_out = NULL; -#endif - switch (iph->ip_v) { -#ifdef INET - case IPVERSION: - iph_out = mtod(mout, struct ip *); - - /* Fill in the IP header for the ABORT */ - iph_out->ip_v = IPVERSION; - iph_out->ip_hl = (sizeof(struct ip) / 4); - iph_out->ip_tos = (u_char)0; - iph_out->ip_id = 0; - iph_out->ip_off = 0; - iph_out->ip_ttl = MODULE_GLOBAL(ip_defttl); - if (port) { - iph_out->ip_p = IPPROTO_UDP; - } else { - iph_out->ip_p = IPPROTO_SCTP; - } - iph_out->ip_src.s_addr = iph->ip_dst.s_addr; - iph_out->ip_dst.s_addr = iph->ip_src.s_addr; - /* let IP layer calculate this */ - iph_out->ip_sum = 0; - - iphlen_out = sizeof(struct ip); - sh_out = (struct sctphdr *)((caddr_t)iph_out + iphlen_out); - break; -#endif -#ifdef INET6 - case IPV6_VERSION >> 4: - ip6 = (struct ip6_hdr *)iph; - ip6_out = mtod(mout, struct ip6_hdr *); - - /* Fill in the IP6 header for the ABORT */ - ip6_out->ip6_flow = ip6->ip6_flow; - ip6_out->ip6_hlim = MODULE_GLOBAL(ip6_defhlim); - if (port) { - ip6_out->ip6_nxt = IPPROTO_UDP; - } else { - ip6_out->ip6_nxt = IPPROTO_SCTP; - } - ip6_out->ip6_src = ip6->ip6_dst; - ip6_out->ip6_dst = ip6->ip6_src; - - iphlen_out = sizeof(struct ip6_hdr); - sh_out = (struct sctphdr *)((caddr_t)ip6_out + iphlen_out); - break; -#endif /* INET6 */ - default: - /* Currently not supported */ - sctp_m_freem(mout); - return; - } - - udp = (struct udphdr *)sh_out; - if (port) { - if (htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)) == 0) { - sctp_m_freem(mout); - return; - } - udp->uh_sport = htons(SCTP_BASE_SYSCTL(sctp_udp_tunneling_port)); - udp->uh_dport = port; - /* set udp->uh_ulen later */ - udp->uh_sum = 0; - iphlen_out += sizeof(struct udphdr); - sh_out = (struct sctphdr *)((caddr_t)udp + sizeof(struct udphdr)); - } - sh_out->src_port = sh->dest_port; - sh_out->dest_port = sh->src_port; - sh_out->v_tag = vtag; - sh_out->checksum = 0; - - ch = (struct sctp_chunkhdr *)((caddr_t)sh_out + sizeof(struct sctphdr)); - ch->chunk_type = SCTP_OPERATION_ERROR; - ch->chunk_flags = 0; - - if (scm) { - struct mbuf *m_tmp = scm; - int cause_len = 0; - - /* get length of the err_cause chain */ - while (m_tmp != NULL) { - cause_len += SCTP_BUF_LEN(m_tmp); - m_tmp = SCTP_BUF_NEXT(m_tmp); - } - len = SCTP_BUF_LEN(mout) + cause_len; - if (cause_len % 4) { - /* need pad at end of chunk */ - uint32_t cpthis = 0; - int padlen; - - padlen = 4 - (len % 4); - m_copyback(mout, len, padlen, (caddr_t)&cpthis); - len += padlen; - } - ch->chunk_length = htons(sizeof(struct sctp_chunkhdr) + cause_len); - } else { - len = SCTP_BUF_LEN(mout); - ch->chunk_length = htons(sizeof(struct sctp_chunkhdr)); - } - - if (SCTP_GET_HEADER_FOR_OUTPUT(o_pak)) { - /* no mbuf's */ - sctp_m_freem(mout); - return; - } -#ifdef INET - if (iph_out != NULL) { - sctp_route_t ro; - int ret; - - /* zap the stack pointer to the route */ - bzero(&ro, sizeof ro); - if (port) { - udp->uh_ulen = htons(len - sizeof(struct ip)); - if (V_udp_cksum) { - udp->uh_sum = in_pseudo(iph_out->ip_src.s_addr, iph_out->ip_dst.s_addr, udp->uh_ulen + htons(IPPROTO_UDP)); - } else { - udp->uh_sum = 0; - } - } - /* set IPv4 length */ - iph_out->ip_len = len; - /* out it goes */ -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, len); -#endif - SCTP_ATTACH_CHAIN(o_pak, mout, len); - if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - sh_out->checksum = sctp_calculate_cksum(mout, iphlen_out); - SCTP_STAT_INCR(sctps_sendswcrc); -#endif - if (V_udp_cksum) { - SCTP_ENABLE_UDP_CSUM(o_pak); - } - } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); -#endif - } - SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); - - /* Free the route if we got one back */ - if (ro.ro_rt) - RTFREE(ro.ro_rt); - } -#endif -#ifdef INET6 - if (ip6_out != NULL) { - int ret; - - if (port) { - udp->uh_ulen = htons(len - sizeof(struct ip6_hdr)); - } - ip6_out->ip6_plen = len - sizeof(*ip6_out); -#ifdef SCTP_PACKET_LOGGING - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) - sctp_packet_log(mout, len); -#endif - SCTP_ATTACH_CHAIN(o_pak, mout, len); - if (port) { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - sh_out->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); -#endif - if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), len - sizeof(struct ip6_hdr))) == 0) { - udp->uh_sum = 0xffff; - } - } else { -#if defined(SCTP_WITH_NO_CSUM) - SCTP_STAT_INCR(sctps_sendnocrc); -#else - mout->m_pkthdr.csum_flags = CSUM_SCTP_IPV6; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); -#endif - } - SCTP_IP6_OUTPUT(ret, o_pak, NULL, NULL, NULL, vrf_id); - } -#endif - SCTP_STAT_INCR(sctps_sendpackets); - SCTP_STAT_INCR_COUNTER64(sctps_outpackets); - SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); + sctp_send_resp_msg(m, sh, vtag, SCTP_OPERATION_ERROR, cause, vrf_id, port); + return; } static struct mbuf * Modified: head/sys/netinet/sctp_output.h ============================================================================== --- head/sys/netinet/sctp_output.h Tue Jun 12 12:44:17 2012 (r236955) +++ head/sys/netinet/sctp_output.h Tue Jun 12 13:15:27 2012 (r236956) @@ -204,7 +204,9 @@ void sctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t, struct mbuf *, uint32_t, uint16_t); -void sctp_send_operr_to(struct mbuf *, int, struct mbuf *, uint32_t, uint32_t, uint16_t); +void +sctp_send_operr_to(struct mbuf *, struct sctphdr *, uint32_t, + struct mbuf *, uint32_t, uint16_t); #endif /* _KERNEL || __Userspace__ */ From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 13:19:10 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36264106564A; Tue, 12 Jun 2012 13:19:10 +0000 (UTC) (envelope-from rrs@lakerest.net) Received: from lakerest.net (lakerest.net [70.155.160.98]) by mx1.freebsd.org (Postfix) with ESMTP id AB7968FC08; Tue, 12 Jun 2012 13:19:09 +0000 (UTC) Received: from [10.1.1.141] (bsd3.lakerest.net [70.155.160.101]) (authenticated bits=0) by lakerest.net (8.14.4/8.14.3) with ESMTP id q5CDHkLD003720 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Tue, 12 Jun 2012 09:17:47 -0400 (EDT) (envelope-from rrs@lakerest.net) Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=windows-1252 From: Randall Stewart In-Reply-To: <70EDDE72-B9FE-45AB-B3C5-248B95E1E960@lists.zabbadoz.net> Date: Tue, 12 Jun 2012 09:17:46 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <3F5E6768-BC5D-4405-A160-0D5CC172B45C@lakerest.net> References: <201206121244.q5CCiH4i053940@svn.freebsd.org> <70EDDE72-B9FE-45AB-B3C5-248B95E1E960@lists.zabbadoz.net> To: "Bjoern A. Zeeb" X-Mailer: Apple Mail (2.1278) Cc: svn-src-head@FreeBSD.org, Randall Stewart , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r236955 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 13:19:10 -0000 That actually will not effect things. Since the packet is on the way out. If the csum_data field gets set on the way in (not out)=85 so reusing it here I think is safe. R On Jun 12, 2012, at 8:53 AM, Bjoern A. Zeeb wrote: >=20 > On 12. Jun 2012, at 12:44 , Randall Stewart wrote: >=20 >> Author: rrs >> Date: Tue Jun 12 12:44:17 2012 >> New Revision: 236955 >> URL: http://svn.freebsd.org/changeset/base/236955 >>=20 >> Log: >> Note to self. Have morning coffee *before* committing things. >> There is no mac_addr in the mbuf for BSD.. cheat like >> we are supposed to and use the csum field since our friend >> the gif tunnel itself will never use offload. >=20 > There are cards that can do checksums for IPIP... with drivers in out = tree. >=20 >=20 >>=20 >> Modified: >> head/sys/net/if_gif.c >>=20 >> Modified: head/sys/net/if_gif.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/net/if_gif.c Tue Jun 12 12:40:15 2012 = (r236954) >> +++ head/sys/net/if_gif.c Tue Jun 12 12:44:17 2012 = (r236955) >> @@ -388,7 +388,8 @@ keep_going: >> /* Now pull back the af in packet that >> * was saved in the address location. >> */ >> - bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af)); >> + af =3D m->m_pkthdr.csum_data; >> + =09 >> if (ifp->if_bridge) >> af =3D AF_LINK; >>=20 >> @@ -503,10 +504,11 @@ gif_output(ifp, m, dst, ro) >> dst->sa_family =3D af; >> } >> af =3D dst->sa_family; >> - /* Now save the af in the inbound pkt mac >> - * address location. >> + /* Now save the af in the inbound pkt csum >> + * data, this is a cheat since really >> + * gif tunnels don't do offload. >> */ >> - bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af)); >> + m->m_pkthdr.csum_data =3D af; >> if (!(ifp->if_flags & IFF_UP) || >> sc->gif_psrc =3D=3D NULL || sc->gif_pdst =3D=3D NULL) { >> m_freem(m); >=20 > --=20 > Bjoern A. Zeeb You have to have = visions! > It does not matter how good you are. It matters what good you do! >=20 >=20 ------------------------------ Randall Stewart 803-317-4952 (cell) From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 13:31:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B1091065673; Tue, 12 Jun 2012 13:31:33 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 064BF8FC16; Tue, 12 Jun 2012 13:31:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CDVWh3056002; Tue, 12 Jun 2012 13:31:32 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CDVWLk056000; Tue, 12 Jun 2012 13:31:32 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201206121331.q5CDVWLk056000@svn.freebsd.org> From: Randall Stewart Date: Tue, 12 Jun 2012 13:31:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236957 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 13:31:33 -0000 Author: rrs Date: Tue Jun 12 13:31:32 2012 New Revision: 236957 URL: http://svn.freebsd.org/changeset/base/236957 Log: Fix comment to better reflect how we are cheating and using the csum_data. Also fix style issues with the comments. Modified: head/sys/net/if_gif.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Tue Jun 12 13:15:27 2012 (r236956) +++ head/sys/net/if_gif.c Tue Jun 12 13:31:32 2012 (r236957) @@ -385,8 +385,9 @@ keep_going: m->m_pkthdr.len -= GIF_HDR_LEN6; #endif #endif - /* Now pull back the af in packet that - * was saved in the address location. + /* + * Now pull back the af that we + * stashed in the csum_data. */ af = m->m_pkthdr.csum_data; @@ -504,9 +505,12 @@ gif_output(ifp, m, dst, ro) dst->sa_family = af; } af = dst->sa_family; - /* Now save the af in the inbound pkt csum - * data, this is a cheat since really - * gif tunnels don't do offload. + /* + * Now save the af in the inbound pkt csum + * data, this is a cheat since we are using + * the inbound csum_data field to carry the + * af over to the gif_start() routine, avoiding + * using yet another mtag. */ m->m_pkthdr.csum_data = af; if (!(ifp->if_flags & IFF_UP) || @@ -516,7 +520,8 @@ gif_output(ifp, m, dst, ro) goto end; } #ifdef ALTQ - /* Make altq aware of the bytes we will add + /* + * Make altq aware of the bytes we will add * when we actually send it. */ #ifdef INET From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 13:50:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 145581065670; Tue, 12 Jun 2012 13:50:02 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id A58928FC0A; Tue, 12 Jun 2012 13:50:00 +0000 (UTC) Received: by yenl8 with SMTP id l8so3893890yen.13 for ; Tue, 12 Jun 2012 06:50:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=cl7O+FCHZ72gH0qCl3AQVqwkWmaPXmD6ouzxCnfSJt8=; b=i0hoS1xDleMtArjHNmiPFUcblAL9oGaER/0k8N/fKh4Q5M4q0RyzgX+Mld+RpTjpOt kih8tCj77JoA1/urcbFC6N3azhoc0SDNzL1eiEo9FV8Xi7LrOXjAnuUreq5gEEfJQBzj rxB48Cx8mSiGYRVMYx1DH/UyqaBlp6quHWePxeCy/kU5PbSGm8yS/s9keEoD7lhPvIQu /YafBfndpXXfdHX8+D4q6PY3DLOxVt5DGE6g7kU55Uxh9BknNwor0VYZ2Ks1XkT5h3BQ zAcwuHOrNxwi49rHfm/92vwHXuxS0n1/oFDmVR1Wp83S/0WHjUC9HWeyyklQ97+3Hysg PtxQ== Received: by 10.236.73.6 with SMTP id u6mr27442323yhd.31.1339509000112; Tue, 12 Jun 2012 06:50:00 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id e5sm31515627ani.18.2012.06.12.06.49.58 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jun 2012 06:49:59 -0700 (PDT) Date: Tue, 12 Jun 2012 15:49:50 +0200 From: Mateusz Guzik To: Pawel Jakub Dawidek Message-ID: <20120612134950.GC20749@dft-labs.eu> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120612114335.GA1372@garage.freebsd.pl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 13:50:02 -0000 On Tue, Jun 12, 2012 at 01:43:35PM +0200, Pawel Jakub Dawidek wrote: > On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote: > > The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which > > still may not be enough to have place for new fd with high number. > > I was under impression that fd_first_free() can return at most > fdp->fd_nfiles, but indeed I missed this: > > if (low >= size) > return (low); > > So fd_first_free() can return number biffer than size... > > > This fixed the problem for me, although I'm not sure whether it's ok to > > grow the table like this: > > http://people.freebsd.org/~mjg/patches/fdalloc.patch > > The patch looks good to me, could you please commit it, preferably after > David's trying it and also update fd_first_free() comment, so it is > clear that returned value can exceed 'size -1'? > Given that you partially reverted r236935 I created a combined patch: http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free.patch Is this ok? Most changes are obiously yours, so I see no problem if you prefer to commit this yourself. Otherwise I plan to commit it with the following: Re-apply reverted parts of r236935 by pjd with some fixes. If fdalloc decides to grow fdtable it does it once and at most doubles the size. This still may be not enough for sufficiently large fd. Use fd in calculations of new size in order to fix this. Fix description of fd_first_free to note that it returns passed fd if it exceeds fdtable's size. ====== fd_last_used has very same problem with comment as fd_first_free. This function is static and the only caller always passes 0 as low. Given that, how about the following: http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch Thanks, -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 13:57:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05E611065677; Tue, 12 Jun 2012 13:57:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3D128FC08; Tue, 12 Jun 2012 13:57:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CDvu6w057132; Tue, 12 Jun 2012 13:57:56 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CDvu0P057130; Tue, 12 Jun 2012 13:57:56 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206121357.q5CDvu0P057130@svn.freebsd.org> From: Michael Tuexen Date: Tue, 12 Jun 2012 13:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236958 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 13:57:57 -0000 Author: tuexen Date: Tue Jun 12 13:57:56 2012 New Revision: 236958 URL: http://svn.freebsd.org/changeset/base/236958 Log: Deliver IPV6_TCLASS, IPV6_HOPLIMIT and IPV6_PKTINFO cmsgs (if requested) on IPV6 sockets, which have been marked to be not IPV6_V6ONLY, for each received IPV4 packet. MFC after: 3 days Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Tue Jun 12 13:31:32 2012 (r236957) +++ head/sys/netinet6/ip6_input.c Tue Jun 12 13:57:56 2012 (r236958) @@ -1321,19 +1321,28 @@ ip6_savecontrol_v4(struct inpcb *inp, st } #endif - if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { - if (v4only != NULL) - *v4only = 1; - return (mp); - } - #define IS2292(inp, x, y) (((inp)->inp_flags & IN6P_RFC2292) ? (x) : (y)) /* RFC 2292 sec. 5 */ if ((inp->inp_flags & IN6P_PKTINFO) != 0) { struct in6_pktinfo pi6; - bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); - in6_clearscope(&pi6.ipi6_addr); /* XXX */ + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + + ip = mtod(m, struct ip *); + pi6.ipi6_addr.s6_addr32[0] = 0; + pi6.ipi6_addr.s6_addr32[1] = 0; + pi6.ipi6_addr.s6_addr32[2] = IPV6_ADDR_INT32_SMP; + pi6.ipi6_addr.s6_addr32[3] = ip->ip_dst.s_addr; +#else + /* We won't hit this code */ + bzero(&pi6.ipi6_addr, sizeof(struct in6_addr)); +#endif + } else { + bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); + in6_clearscope(&pi6.ipi6_addr); /* XXX */ + } pi6.ipi6_ifindex = (m && m->m_pkthdr.rcvif) ? m->m_pkthdr.rcvif->if_index : 0; @@ -1345,8 +1354,21 @@ ip6_savecontrol_v4(struct inpcb *inp, st } if ((inp->inp_flags & IN6P_HOPLIMIT) != 0) { - int hlim = ip6->ip6_hlim & 0xff; + int hlim; + + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + ip = mtod(m, struct ip *); + hlim = ip->ip_ttl; +#else + /* We won't hit this code */ + hlim = 0; +#endif + } else { + hlim = ip6->ip6_hlim & 0xff; + } *mp = sbcreatecontrol((caddr_t) &hlim, sizeof(int), IS2292(inp, IPV6_2292HOPLIMIT, IPV6_HOPLIMIT), IPPROTO_IPV6); @@ -1354,8 +1376,40 @@ ip6_savecontrol_v4(struct inpcb *inp, st mp = &(*mp)->m_next; } - if (v4only != NULL) - *v4only = 0; + if ((inp->inp_flags & IN6P_TCLASS) != 0) { + int tclass; + + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { +#ifdef INET + struct ip *ip; + + ip = mtod(m, struct ip *); + tclass = ip->ip_tos; +#else + /* We won't hit this code */ + tclass = 0; +#endif + } else { + u_int32_t flowinfo; + + flowinfo = (u_int32_t)ntohl(ip6->ip6_flow & IPV6_FLOWINFO_MASK); + flowinfo >>= 20; + tclass = flowinfo & 0xff; + } + *mp = sbcreatecontrol((caddr_t) &tclass, sizeof(int), + IPV6_TCLASS, IPPROTO_IPV6); + if (*mp) + mp = &(*mp)->m_next; + } + + if (v4only != NULL) { + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { + *v4only = 1; + } else { + *v4only = 0; + } + } + return (mp); } @@ -1369,20 +1423,6 @@ ip6_savecontrol(struct inpcb *in6p, stru if (v4only) return; - if ((in6p->inp_flags & IN6P_TCLASS) != 0) { - u_int32_t flowinfo; - int tclass; - - flowinfo = (u_int32_t)ntohl(ip6->ip6_flow & IPV6_FLOWINFO_MASK); - flowinfo >>= 20; - - tclass = flowinfo & 0xff; - *mp = sbcreatecontrol((caddr_t) &tclass, sizeof(tclass), - IPV6_TCLASS, IPPROTO_IPV6); - if (*mp) - mp = &(*mp)->m_next; - } - /* * IPV6_HOPOPTS socket option. Recall that we required super-user * privilege for the option (see ip6_ctloutput), but it might be too From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 14:02:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 427E11065679; Tue, 12 Jun 2012 14:02:39 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09D618FC18; Tue, 12 Jun 2012 14:02:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CE2cCk057399; Tue, 12 Jun 2012 14:02:38 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CE2cs1057392; Tue, 12 Jun 2012 14:02:38 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206121402.q5CE2cs1057392@svn.freebsd.org> From: Michael Tuexen Date: Tue, 12 Jun 2012 14:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236959 - in head: share/man/man4 sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 14:02:39 -0000 Author: tuexen Date: Tue Jun 12 14:02:38 2012 New Revision: 236959 URL: http://svn.freebsd.org/changeset/base/236959 Log: Add a IP_RECVTOS socket option to receive for received UDP/IPv4 packets a cmsg of type IP_RECVTOS which contains the TOS byte. Much like IP_RECVTTL does for TTL. This allows to implement a protocol on top of UDP and implementing ECN. MFC after: 3 days Modified: head/share/man/man4/ip.4 head/sys/netinet/in.h head/sys/netinet/in_pcb.c head/sys/netinet/in_pcb.h head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c Modified: head/share/man/man4/ip.4 ============================================================================== --- head/share/man/man4/ip.4 Tue Jun 12 13:57:56 2012 (r236958) +++ head/share/man/man4/ip.4 Tue Jun 12 14:02:38 2012 (r236959) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd November 14, 2011 +.Dd June 12, 2012 .Dt IP 4 .Os .Sh NAME @@ -286,6 +286,29 @@ cmsg_type = IP_RECVTTL .\" .Pp If the +.Dv IP_RECVTOS +option is enabled on a +.Dv SOCK_DGRAM +socket, the +.Xr recvmsg 2 +call will return the +.Tn IP +.Tn TOS +(type of service) field for a +.Tn UDP +datagram. +The msg_control field in the msghdr structure points to a buffer +that contains a cmsghdr structure followed by the +.Tn TOS . +The cmsghdr fields have the following values: +.Bd -literal +cmsg_len = CMSG_LEN(sizeof(u_char)) +cmsg_level = IPPROTO_IP +cmsg_type = IP_RECVTOS +.Ed +.\" +.Pp +If the .Dv IP_RECVIF option is enabled on a .Dv SOCK_DGRAM Modified: head/sys/netinet/in.h ============================================================================== --- head/sys/netinet/in.h Tue Jun 12 13:57:56 2012 (r236958) +++ head/sys/netinet/in.h Tue Jun 12 14:02:38 2012 (r236959) @@ -462,6 +462,7 @@ __END_DECLS #define IP_RECVTTL 65 /* bool; receive IP TTL w/dgram */ #define IP_MINTTL 66 /* minimum TTL for packet or drop */ #define IP_DONTFRAG 67 /* don't fragment packet */ +#define IP_RECVTOS 68 /* bool; receive IP TOS w/dgram */ /* IPv4 Source Filter Multicast API [RFC3678] */ #define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */ Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Tue Jun 12 13:57:56 2012 (r236958) +++ head/sys/netinet/in_pcb.c Tue Jun 12 14:02:38 2012 (r236959) @@ -2295,6 +2295,10 @@ db_print_inpflags(int inp_flags) db_printf("%sINP_DONTFRAG", comma ? ", " : ""); comma = 1; } + if (inp_flags & INP_RECVTOS) { + db_printf("%sINP_RECVTOS", comma ? ", " : ""); + comma = 1; + } if (inp_flags & IN6P_IPV6_V6ONLY) { db_printf("%sIN6P_IPV6_V6ONLY", comma ? ", " : ""); comma = 1; Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Tue Jun 12 13:57:56 2012 (r236958) +++ head/sys/netinet/in_pcb.h Tue Jun 12 14:02:38 2012 (r236959) @@ -509,6 +509,7 @@ void inp_4tuple_get(struct inpcb *inp, #define INP_DONTFRAG 0x00000800 /* don't fragment packet */ #define INP_BINDANY 0x00001000 /* allow bind to any address */ #define INP_INHASHLIST 0x00002000 /* in_pcbinshash() has been called */ +#define INP_RECVTOS 0x00004000 /* receive incoming IP TOS */ #define IN6P_IPV6_V6ONLY 0x00008000 /* restrict AF_INET6 socket for v6 */ #define IN6P_PKTINFO 0x00010000 /* receive IP6 dst and I/F */ #define IN6P_HOPLIMIT 0x00020000 /* receive hoplimit */ @@ -528,7 +529,7 @@ void inp_4tuple_get(struct inpcb *inp, #define IN6P_MTU 0x80000000 /* receive path MTU */ #define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ - INP_RECVIF|INP_RECVTTL|\ + INP_RECVIF|INP_RECVTTL|INP_RECVTOS|\ IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\ IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\ IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\ Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Tue Jun 12 13:57:56 2012 (r236958) +++ head/sys/netinet/ip_input.c Tue Jun 12 14:02:38 2012 (r236959) @@ -1684,6 +1684,12 @@ makedummy: if (*mp) mp = &(*mp)->m_next; } + if (inp->inp_flags & INP_RECVTOS) { + *mp = sbcreatecontrol((caddr_t) &ip->ip_tos, + sizeof(u_char), IP_RECVTOS, IPPROTO_IP); + if (*mp) + mp = &(*mp)->m_next; + } } /* Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Tue Jun 12 13:57:56 2012 (r236958) +++ head/sys/netinet/ip_output.c Tue Jun 12 14:02:38 2012 (r236959) @@ -984,6 +984,7 @@ ip_ctloutput(struct socket *so, struct s case IP_FAITH: case IP_ONESBCAST: case IP_DONTFRAG: + case IP_RECVTOS: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); if (error) @@ -1047,6 +1048,9 @@ ip_ctloutput(struct socket *so, struct s case IP_BINDANY: OPTSET(INP_BINDANY); break; + case IP_RECVTOS: + OPTSET(INP_RECVTOS); + break; } break; #undef OPTSET @@ -1156,6 +1160,7 @@ ip_ctloutput(struct socket *so, struct s case IP_ONESBCAST: case IP_DONTFRAG: case IP_BINDANY: + case IP_RECVTOS: switch (sopt->sopt_name) { case IP_TOS: @@ -1214,6 +1219,9 @@ ip_ctloutput(struct socket *so, struct s case IP_BINDANY: optval = OPTBIT(INP_BINDANY); break; + case IP_RECVTOS: + optval = OPTBIT(INP_RECVTOS); + break; } error = sooptcopyout(sopt, &optval, sizeof optval); break; From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 14:40:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A47A81065673; Tue, 12 Jun 2012 14:40:20 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F64A8FC1A; Tue, 12 Jun 2012 14:40:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CEeKpb058962; Tue, 12 Jun 2012 14:40:20 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CEeK1e058959; Tue, 12 Jun 2012 14:40:20 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206121440.q5CEeK1e058959@svn.freebsd.org> From: Martin Matuska Date: Tue, 12 Jun 2012 14:40:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236960 - head/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 14:40:20 -0000 Author: mm Date: Tue Jun 12 14:40:19 2012 New Revision: 236960 URL: http://svn.freebsd.org/changeset/base/236960 Log: Document the -v flag for zpool list. PR: 168970 Suggested by: Marcelo Araujo MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Tue Jun 12 14:02:38 2012 (r236959) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Tue Jun 12 14:40:19 2012 (r236960) @@ -1348,6 +1348,8 @@ reports are printed. .It Fl H Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space. +.It Fl v +Show more detailed information. .It Fl o Ar property Ns Op , Ns Ar ... Comma-separated list of properties to display. See the .Qq Sx Properties Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Jun 12 14:02:38 2012 (r236959) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Jun 12 14:40:19 2012 (r236960) @@ -235,7 +235,7 @@ get_usage(zpool_help_t idx) { case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: - return (gettext("\tlist [-H] [-o property[,...]] " + return (gettext("\tlist [-Hv] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 14:56:08 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC549106564A; Tue, 12 Jun 2012 14:56:08 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6F308FC0A; Tue, 12 Jun 2012 14:56:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CEu8oX059723; Tue, 12 Jun 2012 14:56:08 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CEu8eI059721; Tue, 12 Jun 2012 14:56:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206121456.q5CEu8eI059721@svn.freebsd.org> From: Michael Tuexen Date: Tue, 12 Jun 2012 14:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236961 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 14:56:08 -0000 Author: tuexen Date: Tue Jun 12 14:56:08 2012 New Revision: 236961 URL: http://svn.freebsd.org/changeset/base/236961 Log: Add a cmsg of type IP_TOS for UDP/IPv4 sockets to specify the TOS byte. MFC after: 3 days Modified: head/sys/netinet/udp_usrreq.c Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Tue Jun 12 14:40:19 2012 (r236960) +++ head/sys/netinet/udp_usrreq.c Tue Jun 12 14:56:08 2012 (r236961) @@ -956,6 +956,7 @@ udp_output(struct inpcb *inp, struct mbu int ipflags; u_short fport, lport; int unlock_udbinfo; + u_char tos; /* * udp_output() may need to temporarily bind or connect the current @@ -972,6 +973,7 @@ udp_output(struct inpcb *inp, struct mbu src.sin_family = 0; INP_RLOCK(inp); + tos = inp->inp_ip_tos; if (control != NULL) { /* * XXX: Currently, we assume all the optional information is @@ -1010,6 +1012,14 @@ udp_output(struct inpcb *inp, struct mbu *(struct in_addr *)CMSG_DATA(cm); break; + case IP_TOS: + if (cm->cmsg_len != CMSG_LEN(sizeof(u_char))) { + error = EINVAL; + break; + } + tos = *(u_char *)CMSG_DATA(cm); + break; + default: error = ENOPROTOOPT; break; @@ -1225,7 +1235,7 @@ udp_output(struct inpcb *inp, struct mbu ui->ui_sum = 0; ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; ((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */ - ((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */ + ((struct ip *)ui)->ip_tos = tos; /* XXX */ UDPSTAT_INC(udps_opackets); if (unlock_udbinfo == UH_WLOCKED) From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 15:04:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 907101065670; Tue, 12 Jun 2012 15:04:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 77F9B8FC0A; Tue, 12 Jun 2012 15:04:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CF4Jrn060144; Tue, 12 Jun 2012 15:04:19 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CF4JYo060137; Tue, 12 Jun 2012 15:04:19 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206121504.q5CF4JYo060137@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 12 Jun 2012 15:04:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236962 - in head/contrib/gcc: . config/i386 doc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 15:04:19 -0000 Author: pfg Date: Tue Jun 12 15:04:18 2012 New Revision: 236962 URL: http://svn.freebsd.org/changeset/base/236962 Log: Add experimental support for amdfam10/barcelona from the GCC 4.3 branch. Initial support for the AMD barcelona chipsets has been available in the gcc43 branch under GPLv2 but was not included when the Core 2 support was brought to the system gcc. AMD and some linux distributions (OpenSUSE) did a backport of the amdfam10 support and made them available. Unfortunately this is still experimental and while it can improve performance, enabling the CPUTYPE may break some C++ ports (like clang). Special care was taken to make sure that the patches predate the GPLv3 switch upstream. Tested by: Vladimir Kushnir Reviewed by: mm Approved by: jhb (mentor) MFC after: 2 weeks Added: head/contrib/gcc/config/i386/ammintrin.h (contents, props changed) Modified: head/contrib/gcc/ChangeLog.gcc43 head/contrib/gcc/builtins.c head/contrib/gcc/config.gcc head/contrib/gcc/config/i386/athlon.md head/contrib/gcc/config/i386/driver-i386.c head/contrib/gcc/config/i386/i386.c head/contrib/gcc/config/i386/i386.h head/contrib/gcc/config/i386/i386.md head/contrib/gcc/config/i386/i386.opt head/contrib/gcc/config/i386/mmx.md head/contrib/gcc/config/i386/pmmintrin.h head/contrib/gcc/config/i386/sse.md head/contrib/gcc/config/i386/tmmintrin.h head/contrib/gcc/doc/extend.texi head/contrib/gcc/doc/invoke.texi head/contrib/gcc/fold-const.c head/contrib/gcc/gimplify.c head/contrib/gcc/tree-ssa-ccp.c head/contrib/gcc/tree-ssa-pre.c Modified: head/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- head/contrib/gcc/ChangeLog.gcc43 Tue Jun 12 14:56:08 2012 (r236961) +++ head/contrib/gcc/ChangeLog.gcc43 Tue Jun 12 15:04:18 2012 (r236962) @@ -1,3 +1,8 @@ +2007-05-01 Dwarakanath Rajagopal + + * doc/invoke.texi: Fix typo, 'AMD Family 10h core' instead of + 'AMD Family 10 core'. + 2007-05-01 Dwarakanath Rajagopal (r124339) * config/i386/i386.c (override_options): Accept k8-sse3, opteron-sse3 @@ -5,10 +10,39 @@ with SSE3 instruction set support. * doc/invoke.texi: Likewise. +2007-05-01 Dwarakanath Rajagopal + + * config/i386/i386.c (override_options): Tuning 32-byte loop + alignment for amdfam10 architecture. Increasing the max loop + alignment to 24 bytes. + +2007-04-12 Richard Guenther + + PR tree-optimization/24689 + PR tree-optimization/31307 + * fold-const.c (operand_equal_p): Compare INTEGER_CST array + indices by value. + * gimplify.c (canonicalize_addr_expr): To be consistent with + gimplify_compound_lval only set operands two and three of + ARRAY_REFs if they are not gimple_min_invariant. This makes + it never at this place. + * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise. + 2007-04-07 H.J. Lu (r123639) * config/i386/i386.c (ix86_handle_option): Handle SSSE3. +2007-03-28 Dwarakanath Rajagopal + + * config.gcc: Accept barcelona as a variant of amdfam10. + * config/i386/i386.c (override_options): Likewise. + * doc/invoke.texi: Likewise. + +2007-02-09 Dwarakanath Rajagopal + + * config/i386/driver-i386.c: Turn on -mtune=native for AMDFAM10. + (bit_SSE4a): New. + 2007-02-08 Harsha Jagasia (r121726) * config/i386/xmmintrin.h: Make inclusion of emmintrin.h @@ -26,6 +60,173 @@ * config/i386/i386.c (override_options): Set PTA_SSSE3 for core2. +2007-02-05 Harsha Jagasia + + * config/i386/athlon.md (athlon_fldxf_k8, athlon_fld_k8, + athlon_fstxf_k8, athlon_fst_k8, athlon_fist, athlon_fmov, + athlon_fadd_load, athlon_fadd_load_k8, athlon_fadd, athlon_fmul, + athlon_fmul_load, athlon_fmul_load_k8, athlon_fsgn, + athlon_fdiv_load, athlon_fdiv_load_k8, athlon_fdiv_k8, + athlon_fpspc_load, athlon_fpspc, athlon_fcmov_load, + athlon_fcmov_load_k8, athlon_fcmov_k8, athlon_fcomi_load_k8, + athlon_fcomi, athlon_fcom_load_k8, athlon_fcom): Added amdfam10. + +2007-02-05 Harsha Jagasia + + * config/i386/i386.md (x86_sahf_1, cmpfp_i_mixed, cmpfp_i_sse, + cmpfp_i_i387, cmpfp_iu_mixed, cmpfp_iu_sse, cmpfp_iu_387, + swapsi, swaphi_1, swapqi_1, swapdi_rex64, fix_truncsfdi_sse, + fix_truncdfdi_sse, fix_truncsfsi_sse, fix_truncdfsi_sse, + x86_fldcw_1, floatsisf2_mixed, floatsisf2_sse, floatdisf2_mixed, + floatdisf2_sse, floatsidf2_mixed, floatsidf2_sse, + floatdidf2_mixed, floatdidf2_sse, muldi3_1_rex64, mulsi3_1, + mulsi3_1_zext, mulhi3_1, mulqi3_1, umulqihi3_1, mulqihi3_insn, + umulditi3_insn, umulsidi3_insn, mulditi3_insn, mulsidi3_insn, + umuldi3_highpart_rex64, umulsi3_highpart_insn, + umulsi3_highpart_zext, smuldi3_highpart_rex64, + smulsi3_highpart_insn, smulsi3_highpart_zext, x86_64_shld, + x86_shld_1, x86_64_shrd, sqrtsf2_mixed, sqrtsf2_sse, + sqrtsf2_i387, sqrtdf2_mixed, sqrtdf2_sse, sqrtdf2_i387, + sqrtextendsfdf2_i387, sqrtxf2, sqrtextendsfxf2_i387, + sqrtextenddfxf2_i387): Added amdfam10_decode. + + * config/i386/athlon.md (athlon_idirect_amdfam10, + athlon_ivector_amdfam10, athlon_idirect_load_amdfam10, + athlon_ivector_load_amdfam10, athlon_idirect_both_amdfam10, + athlon_ivector_both_amdfam10, athlon_idirect_store_amdfam10, + athlon_ivector_store_amdfam10): New define_insn_reservation. + (athlon_idirect_loadmov, athlon_idirect_movstore): Added + amdfam10. + +2007-02-05 Harsha Jagasia + + * config/i386/athlon.md (athlon_call_amdfam10, + athlon_pop_amdfam10, athlon_lea_amdfam10): New + define_insn_reservation. + (athlon_branch, athlon_push, athlon_leave_k8, athlon_imul_k8, + athlon_imul_k8_DI, athlon_imul_mem_k8, athlon_imul_mem_k8_DI, + athlon_idiv, athlon_idiv_mem, athlon_str): Added amdfam10. + +2007-02-05 Harsha Jagasia + + * config/i386/athlon.md (athlon_sseld_amdfam10, + athlon_mmxld_amdfam10, athlon_ssest_amdfam10, + athlon_mmxssest_short_amdfam10): New define_insn_reservation. + +2007-02-05 Harsha Jagasia + + * config/i386/athlon.md (athlon_sseins_amdfam10): New + define_insn_reservation. + * config/i386/i386.md (sseins): Added sseins to define_attr type + and define_attr unit. + * config/i386/sse.md: Set type attribute to sseins for insertq + and insertqi. + +2007-02-05 Harsha Jagasia + + * config/i386/athlon.md (sselog_load_amdfam10, sselog_amdfam10, + ssecmpvector_load_amdfam10, ssecmpvector_amdfam10, + ssecomi_load_amdfam10, ssecomi_amdfam10, + sseaddvector_load_amdfam10, sseaddvector_amdfam10): New + define_insn_reservation. + (ssecmp_load_k8, ssecmp, sseadd_load_k8, seadd): Added amdfam10. + +2007-02-05 Harsha Jagasia + + * config/i386/athlon.md (cvtss2sd_load_amdfam10, + cvtss2sd_amdfam10, cvtps2pd_load_amdfam10, cvtps2pd_amdfam10, + cvtsi2sd_load_amdfam10, cvtsi2ss_load_amdfam10, + cvtsi2sd_amdfam10, cvtsi2ss_amdfam10, cvtsd2ss_load_amdfam10, + cvtsd2ss_amdfam10, cvtpd2ps_load_amdfam10, cvtpd2ps_amdfam10, + cvtsX2si_load_amdfam10, cvtsX2si_amdfam10): New + define_insn_reservation. + + * config/i386/sse.md (cvtsi2ss, cvtsi2ssq, cvtss2si, + cvtss2siq, cvttss2si, cvttss2siq, cvtsi2sd, cvtsi2sdq, + cvtsd2si, cvtsd2siq, cvttsd2si, cvttsd2siq, + cvtpd2dq, cvttpd2dq, cvtsd2ss, cvtss2sd, + cvtpd2ps, cvtps2pd): Added amdfam10_decode attribute. + +2007-02-05 Harsha Jagasia + + * config/i386/athlon.md (athlon_ssedivvector_amdfam10, + athlon_ssedivvector_load_amdfam10, athlon_ssemulvector_amdfam10, + athlon_ssemulvector_load_amdfam10): New define_insn_reservation. + (athlon_ssediv, athlon_ssediv_load_k8, athlon_ssemul, + athlon_ssemul_load_k8): Added amdfam10. + +2007-02-05 Harsha Jagasia + + * config/i386/i386.h (TARGET_SSE_UNALIGNED_MOVE_OPTIMAL): New macro. + (x86_sse_unaligned_move_optimal): New variable. + + * config/i386/i386.c (x86_sse_unaligned_move_optimal): Enable for + m_AMDFAM10. + (ix86_expand_vector_move_misalign): Add code to generate movupd/movups + for unaligned vector SSE double/single precision loads for AMDFAM10. + +2007-02-05 Harsha Jagasia + + * config/i386/i386.h (TARGET_AMDFAM10): New macro. + (TARGET_CPU_CPP_BUILTINS): Add code for amdfam10. + Define TARGET_CPU_DEFAULT_amdfam10. + (TARGET_CPU_DEFAULT_NAMES): Add amdfam10. + (processor_type): Add PROCESSOR_AMDFAM10. + + * config/i386/i386.md: Add amdfam10 as a new cpu attribute to match + processor_type in config/i386/i386.h. + Enable imul peepholes for TARGET_AMDFAM10. + + * config.gcc: Add support for --with-cpu option for amdfam10. + + * config/i386/i386.c (amdfam10_cost): New variable. + (m_AMDFAM10): New macro. + (m_ATHLON_K8_AMDFAM10): New macro. + (x86_use_leave, x86_push_memory, x86_movx, x86_unroll_strlen, + x86_cmove, x86_3dnow_a, x86_deep_branch, x86_use_simode_fiop, + x86_promote_QImode, x86_integer_DFmode_moves, + x86_partial_reg_dependency, x86_memory_mismatch_stall, + x86_accumulate_outgoing_args, x86_arch_always_fancy_math_387, + x86_sse_partial_reg_dependency, x86_sse_typeless_stores, + x86_use_ffreep, x86_use_incdec, x86_four_jump_limit, + x86_schedule, x86_use_bt, x86_cmpxchg16b, x86_pad_returns): + Enable/disable for amdfam10. + (override_options): Add amdfam10_cost to processor_target_table. + Set up PROCESSOR_AMDFAM10 for amdfam10 entry in + processor_alias_table. + (ix86_issue_rate): Add PROCESSOR_AMDFAM10. + (ix86_adjust_cost): Add code for amdfam10. + +2007-02-05 Harsha Jagasia + + * config/i386/i386.opt: Add new Advanced Bit Manipulation (-mabm) + instruction set feature flag. Add new (-mpopcnt) flag for popcnt + instruction. Add new SSE4A (-msse4a) instruction set feature flag. + * config/i386/i386.h: Add builtin definition for SSE4A. + * config/i386/i386.md: Add support for ABM instructions + (popcnt and lzcnt). + * config/i386/sse.md: Add support for SSE4A instructions + (movntss, movntsd, extrq, insertq). + * config/i386/i386.c: Add support for ABM and SSE4A builtins. + Add -march=amdfam10 flag. + * config/i386/ammintrin.h: Add support for SSE4A intrinsics. + * doc/invoke.texi: Add documentation on flags for sse4a, abm, popcnt + and amdfam10. + * doc/extend.texi: Add documentation for SSE4A builtins. + +2007-01-24 Jakub Jelinek + + * config/i386/i386.h (x86_cmpxchg16b): Remove const. + (TARGET_CMPXCHG16B): Define to x86_cmpxchg16b. + * config/i386/i386.c (x86_cmpxchg16b): Remove const. + (override_options): Add PTA_CX16 flag. Set x86_cmpxchg16b + for CPUs that have PTA_CX16 set. + +2007-01-18 Michael Meissner + + * config/i386/i386.c (ix86_compute_frame_layout): Make fprintf's + in #if 0 code type correct. + 2007-01-17 Eric Christopher (r120846) * config.gcc: Support core2 processor. @@ -62,7 +263,30 @@ x86_pad_returns): Add m_CORE2. (override_options): Add entries for Core2. (ix86_issue_rate): Add case for Core2. + +2006-10-28 Uros Bizjak + + * config/i386/i386.h (GENERAL_REGNO_P): Use STACK_POINTER_REGNUM. + (NON_QI_REG_P): Use IN_RANGE. + (REX_INT_REGNO_P): Use IN_RANGE. + (FP_REGNO_P): Use IN_RANGE. + (SSE_REGNO_P): Use IN_RANGE. + (REX_SSE_REGNO_P): Use IN_RANGE. + (MMX_REGNO_P): Use IN_RANGE. + (STACK_REGNO_P): New macro. + (STACK_REG_P): Use STACK_REGNO_P. + (NON_STACK_REG_P): Use STACK_REGNO_P. + (REGNO_OK_FOR_INDEX_P): Use REX_INT_REGNO_P. + (REGNO_OK_FOR_BASE_P): Use GENERAL_REGNO_P. + (REG_OK_FOR_INDEX_NONSTRICT_P): Use REX_INT_REGNO_P. + (REG_OK_FOR_BASE_NONSTRICT_P): Use GENERAL_REGNO_P. + (HARD_REGNO_RENAME_OK): Use !IN_RANGE. +2006-10-28 Uros Bizjak + + * config/i386/i386.c (output_387_ffreep): Create output from a + template string for !HAVE_AS_IX86_FFREEP. + 2006-10-27 Vladimir Makarov (r118090) * config/i386/i386.h (TARGET_GEODE): @@ -95,7 +319,31 @@ * config/i386/geode.md: New file. * doc/invoke.texi: Add entry about geode processor. - + +2006-10-24 Uros Bizjak + + * config/i386/i386.h (FIRST_PSEUDO_REGISTER): Define to 54. + (FIXED_REGISTERS, CALL_USED_REGISTERS): Add fpcr register. + (REG_ALLOC_ORDER): Add one element to allocate fpcr register. + (FRAME_POINTER_REGNUM): Update register number to 21. + (REG_CLASS_CONTENTS): Update contents for added fpcr register. + (HI_REGISTER_NAMES): Add "fpcr" for fpcr register. + + * config/i386/i386.c (regclass_map): Add fpcr entry. + (dbx_register_map, dbx64_register_map, svr4_dbx_register_map): + Add fpcr entry. + (print_reg): Assert REGNO (x) != FPCR_REG. + + * config/i386/i386.md (FPCR_REG, R11_REG): New constants. + (DIRFLAG_REG): Renumber. + (x86_fnstcw_1, x86_fldcw_1): Use FPCR_REG instead of FPSR_REG. + (*sibcall_1_rex64_v, *sibcall_value_1_rex64_v): Use R11_REG. + (sse_prologue_save, *sse_prologue_save_insn): Renumber + hardcoded SSE register numbers. + + * config/i386/mmx.md (mmx_emms, mmx_femms): Renumber + hardcoded MMX register numbers. + 2006-10-24 Richard Guenther PR middle-end/28796 @@ -104,6 +352,17 @@ for deciding optimizations in consistency with fold-const.c (fold_builtin_unordered_cmp): Likewise. +2006-10-24 Richard Guenther + + * builtins.c (fold_builtin_floor): Fold floor (x) where + x is nonnegative to trunc (x). + (fold_builtin_int_roundingfn): Fold lfloor (x) where x is + nonnegative to FIX_TRUNC_EXPR. + +2006-10-22 H.J. Lu + + * config/i386/tmmintrin.h: Remove the duplicated content. + 2006-10-22 H.J. Lu (r117958) * config.gcc (i[34567]86-*-*): Add tmmintrin.h to extra_headers. @@ -170,6 +429,18 @@ * doc/invoke.texi: Document -mssse3/-mno-ssse3 switches. +2006-10-21 H.J. Lu + + * config/i386/i386.md (UNSPEC_LDQQU): Renamed to ... + (UNSPEC_LDDQU): This. + * config/i386/sse.md (sse3_lddqu): Updated. + +2006-10-21 Richard Guenther + + PR tree-optimization/3511 + * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that + got new invariant arguments during PHI translation. + 2006-10-21 Richard Guenther * builtins.c (fold_builtin_classify): Fix typo. Modified: head/contrib/gcc/builtins.c ============================================================================== --- head/contrib/gcc/builtins.c Tue Jun 12 14:56:08 2012 (r236961) +++ head/contrib/gcc/builtins.c Tue Jun 12 15:04:18 2012 (r236962) @@ -7355,6 +7355,12 @@ fold_builtin_ceil (tree fndecl, tree arg } } + /* Fold floor (x) where x is nonnegative to trunc (x). */ + if (tree_expr_nonnegative_p (arg)) + return build_function_call_expr (mathfn_built_in (TREE_TYPE (arg), + BUILT_IN_TRUNC), + arglist); + return fold_trunc_transparent_mathfn (fndecl, arglist); } @@ -7442,6 +7448,18 @@ fold_builtin_int_roundingfn (tree fndecl } } + switch (DECL_FUNCTION_CODE (fndecl)) + { + CASE_FLT_FN (BUILT_IN_LFLOOR): + CASE_FLT_FN (BUILT_IN_LLFLOOR): + /* Fold lfloor (x) where x is nonnegative to FIX_TRUNC (x). */ + if (tree_expr_nonnegative_p (arg)) + return fold_build1 (FIX_TRUNC_EXPR, TREE_TYPE (TREE_TYPE (fndecl)), + arg); + break; + default:; + } + return fold_fixed_mathfn (fndecl, arglist); } Modified: head/contrib/gcc/config.gcc ============================================================================== --- head/contrib/gcc/config.gcc Tue Jun 12 14:56:08 2012 (r236961) +++ head/contrib/gcc/config.gcc Tue Jun 12 15:04:18 2012 (r236962) @@ -269,12 +269,12 @@ xscale-*-*) i[34567]86-*-*) cpu_type=i386 extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h - pmmintrin.h tmmintrin.h" + pmmintrin.h tmmintrin.h ammintrin.h" ;; x86_64-*-*) cpu_type=i386 extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h - pmmintrin.h tmmintrin.h" + pmmintrin.h tmmintrin.h ammintrin.h" need_64bit_hwint=yes ;; ia64-*-*) @@ -1209,14 +1209,14 @@ i[34567]86-*-solaris2*) # FIXME: -m64 for i[34567]86-*-* should be allowed just # like -m32 for x86_64-*-*. case X"${with_cpu}" in - Xgeneric|Xcore2|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx) + Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx) ;; X) with_cpu=generic ;; *) echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 - echo "generic core2 nocona x86-64 k8 opteron athlon64 athlon-fx" 1>&2 + echo "generic core2 nocona x86-64amd fam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2 exit 1 ;; esac @@ -2515,6 +2515,9 @@ if test x$with_cpu = x ; then ;; i686-*-* | i786-*-*) case ${target_noncanonical} in + amdfam10-*|barcelona-*) + with_cpu=amdfam10 + ;; k8-*|opteron-*|athlon_64-*) with_cpu=k8 ;; @@ -2555,6 +2558,9 @@ if test x$with_cpu = x ; then ;; x86_64-*-*) case ${target_noncanonical} in + amdfam10-*|barcelona-*) + with_cpu=amdfam10 + ;; k8-*|opteron-*|athlon_64-*) with_cpu=k8 ;; @@ -2795,7 +2801,7 @@ case "${target}" in esac # OK ;; - "" | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | generic) + "" | amdfam10 | barcelona | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | generic) # OK ;; *) Added: head/contrib/gcc/config/i386/ammintrin.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/gcc/config/i386/ammintrin.h Tue Jun 12 15:04:18 2012 (r236962) @@ -0,0 +1,73 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* Implemented from the specification included in the AMD Programmers + Manual Update, version 2.x */ + +#ifndef _AMMINTRIN_H_INCLUDED +#define _AMMINTRIN_H_INCLUDED + +#ifndef __SSE4A__ +# error "SSE4A instruction set not enabled" +#else + +/* We need definitions from the SSE3, SSE2 and SSE header files*/ +#include + +static __inline void __attribute__((__always_inline__)) +_mm_stream_sd (double * __P, __m128d __Y) +{ + __builtin_ia32_movntsd (__P, (__v2df) __Y); +} + +static __inline void __attribute__((__always_inline__)) +_mm_stream_ss (float * __P, __m128 __Y) +{ + __builtin_ia32_movntss (__P, (__v4sf) __Y); +} + +static __inline __m128i __attribute__((__always_inline__)) +_mm_extract_si64 (__m128i __X, __m128i __Y) +{ + return (__m128i) __builtin_ia32_extrq ((__v2di) __X, (__v16qi) __Y); +} + +#define _mm_extracti_si64(X, I, L) \ +((__m128i) __builtin_ia32_extrqi ((__v2di)(X), I, L)) + +static __inline __m128i __attribute__((__always_inline__)) +_mm_insert_si64 (__m128i __X,__m128i __Y) +{ + return (__m128i) __builtin_ia32_insertq ((__v2di)__X, (__v2di)__Y); +} + +#define _mm_inserti_si64(X, Y, I, L) \ +((__m128i) __builtin_ia32_insertqi ((__v2di)(X), (__v2di)(Y), I, L)) + + +#endif /* __SSE4A__ */ + +#endif /* _AMMINTRIN_H_INCLUDED */ Modified: head/contrib/gcc/config/i386/athlon.md ============================================================================== --- head/contrib/gcc/config/i386/athlon.md Tue Jun 12 14:56:08 2012 (r236961) +++ head/contrib/gcc/config/i386/athlon.md Tue Jun 12 15:04:18 2012 (r236962) @@ -29,6 +29,8 @@ (const_string "vector")] (const_string "direct"))) +(define_attr "amdfam10_decode" "direct,vector,double" + (const_string "direct")) ;; ;; decode0 decode1 decode2 ;; \ | / @@ -131,18 +133,22 @@ ;; Jump instructions are executed in the branch unit completely transparent to us (define_insn_reservation "athlon_branch" 0 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "ibr")) "athlon-direct,athlon-ieu") (define_insn_reservation "athlon_call" 0 (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "call,callv")) "athlon-vector,athlon-ieu") +(define_insn_reservation "athlon_call_amdfam10" 0 + (and (eq_attr "cpu" "amdfam10") + (eq_attr "type" "call,callv")) + "athlon-double,athlon-ieu") ;; Latency of push operation is 3 cycles, but ESP value is available ;; earlier (define_insn_reservation "athlon_push" 2 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "push")) "athlon-direct,athlon-agu,athlon-store") (define_insn_reservation "athlon_pop" 4 @@ -153,12 +159,16 @@ (and (eq_attr "cpu" "k8,generic64") (eq_attr "type" "pop")) "athlon-double,(athlon-ieu+athlon-load)") +(define_insn_reservation "athlon_pop_amdfam10" 3 + (and (eq_attr "cpu" "amdfam10") + (eq_attr "type" "pop")) + "athlon-direct,(athlon-ieu+athlon-load)") (define_insn_reservation "athlon_leave" 3 (and (eq_attr "cpu" "athlon") (eq_attr "type" "leave")) "athlon-vector,(athlon-ieu+athlon-load)") (define_insn_reservation "athlon_leave_k8" 3 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (eq_attr "type" "leave")) "athlon-double,(athlon-ieu+athlon-load)") @@ -167,6 +177,11 @@ (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "lea")) "athlon-direct,athlon-agu,nothing") +;; Lea executes in AGU unit with 1 cycle latency on AMDFAM10 +(define_insn_reservation "athlon_lea_amdfam10" 1 + (and (eq_attr "cpu" "amdfam10") + (eq_attr "type" "lea")) + "athlon-direct,athlon-agu,nothing") ;; Mul executes in special multiplier unit attached to IEU0 (define_insn_reservation "athlon_imul" 5 @@ -176,29 +191,35 @@ "athlon-vector,athlon-ieu0,athlon-mult,nothing,nothing,athlon-ieu0") ;; ??? Widening multiply is vector or double. (define_insn_reservation "athlon_imul_k8_DI" 4 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "imul") (and (eq_attr "mode" "DI") (eq_attr "memory" "none,unknown")))) "athlon-direct0,athlon-ieu0,athlon-mult,nothing,athlon-ieu0") (define_insn_reservation "athlon_imul_k8" 3 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "imul") (eq_attr "memory" "none,unknown"))) "athlon-direct0,athlon-ieu0,athlon-mult,athlon-ieu0") +(define_insn_reservation "athlon_imul_amdfam10_HI" 4 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "type" "imul") + (and (eq_attr "mode" "HI") + (eq_attr "memory" "none,unknown")))) + "athlon-vector,athlon-ieu0,athlon-mult,nothing,athlon-ieu0") (define_insn_reservation "athlon_imul_mem" 8 (and (eq_attr "cpu" "athlon") (and (eq_attr "type" "imul") (eq_attr "memory" "load,both"))) "athlon-vector,athlon-load,athlon-ieu,athlon-mult,nothing,nothing,athlon-ieu") (define_insn_reservation "athlon_imul_mem_k8_DI" 7 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "imul") (and (eq_attr "mode" "DI") (eq_attr "memory" "load,both")))) "athlon-vector,athlon-load,athlon-ieu,athlon-mult,nothing,athlon-ieu") (define_insn_reservation "athlon_imul_mem_k8" 6 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "imul") (eq_attr "memory" "load,both"))) "athlon-vector,athlon-load,athlon-ieu,athlon-mult,athlon-ieu") @@ -209,21 +230,23 @@ ;; other instructions. ;; ??? Experiments show that the idiv can overlap with roughly 6 cycles ;; of the other code +;; Using the same heuristics for amdfam10 as K8 with idiv (define_insn_reservation "athlon_idiv" 6 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (and (eq_attr "type" "idiv") (eq_attr "memory" "none,unknown"))) "athlon-vector,(athlon-ieu0*6+(athlon-fpsched,athlon-fvector))") (define_insn_reservation "athlon_idiv_mem" 9 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (and (eq_attr "type" "idiv") (eq_attr "memory" "load,both"))) "athlon-vector,((athlon-load,athlon-ieu0*6)+(athlon-fpsched,athlon-fvector))") ;; The parallelism of string instructions is not documented. Model it same way ;; as idiv to create smaller automata. This probably does not matter much. +;; Using the same heuristics for amdfam10 as K8 with idiv (define_insn_reservation "athlon_str" 6 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (and (eq_attr "type" "str") (eq_attr "memory" "load,both,store"))) "athlon-vector,athlon-load,athlon-ieu0*6") @@ -234,34 +257,62 @@ (and (eq_attr "unit" "integer,unknown") (eq_attr "memory" "none,unknown")))) "athlon-direct,athlon-ieu") +(define_insn_reservation "athlon_idirect_amdfam10" 1 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "amdfam10_decode" "direct") + (and (eq_attr "unit" "integer,unknown") + (eq_attr "memory" "none,unknown")))) + "athlon-direct,athlon-ieu") (define_insn_reservation "athlon_ivector" 2 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") (and (eq_attr "unit" "integer,unknown") (eq_attr "memory" "none,unknown")))) "athlon-vector,athlon-ieu,athlon-ieu") +(define_insn_reservation "athlon_ivector_amdfam10" 2 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "amdfam10_decode" "vector") + (and (eq_attr "unit" "integer,unknown") + (eq_attr "memory" "none,unknown")))) + "athlon-vector,athlon-ieu,athlon-ieu") + (define_insn_reservation "athlon_idirect_loadmov" 3 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (and (eq_attr "type" "imov") (eq_attr "memory" "load"))) "athlon-direct,athlon-load") + (define_insn_reservation "athlon_idirect_load" 4 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "direct") (and (eq_attr "unit" "integer,unknown") (eq_attr "memory" "load")))) "athlon-direct,athlon-load,athlon-ieu") +(define_insn_reservation "athlon_idirect_load_amdfam10" 4 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "amdfam10_decode" "direct") + (and (eq_attr "unit" "integer,unknown") + (eq_attr "memory" "load")))) + "athlon-direct,athlon-load,athlon-ieu") (define_insn_reservation "athlon_ivector_load" 6 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") (and (eq_attr "unit" "integer,unknown") (eq_attr "memory" "load")))) "athlon-vector,athlon-load,athlon-ieu,athlon-ieu") +(define_insn_reservation "athlon_ivector_load_amdfam10" 6 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "amdfam10_decode" "vector") + (and (eq_attr "unit" "integer,unknown") + (eq_attr "memory" "load")))) + "athlon-vector,athlon-load,athlon-ieu,athlon-ieu") + (define_insn_reservation "athlon_idirect_movstore" 1 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (and (eq_attr "type" "imov") (eq_attr "memory" "store"))) "athlon-direct,athlon-agu,athlon-store") + (define_insn_reservation "athlon_idirect_both" 4 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "direct") @@ -270,6 +321,15 @@ "athlon-direct,athlon-load, athlon-ieu,athlon-store, athlon-store") +(define_insn_reservation "athlon_idirect_both_amdfam10" 4 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "amdfam10_decode" "direct") + (and (eq_attr "unit" "integer,unknown") + (eq_attr "memory" "both")))) + "athlon-direct,athlon-load, + athlon-ieu,athlon-store, + athlon-store") + (define_insn_reservation "athlon_ivector_both" 6 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") @@ -279,6 +339,16 @@ athlon-ieu, athlon-ieu, athlon-store") +(define_insn_reservation "athlon_ivector_both_amdfam10" 6 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "amdfam10_decode" "vector") + (and (eq_attr "unit" "integer,unknown") + (eq_attr "memory" "both")))) + "athlon-vector,athlon-load, + athlon-ieu, + athlon-ieu, + athlon-store") + (define_insn_reservation "athlon_idirect_store" 1 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "direct") @@ -286,6 +356,14 @@ (eq_attr "memory" "store")))) "athlon-direct,(athlon-ieu+athlon-agu), athlon-store") +(define_insn_reservation "athlon_idirect_store_amdfam10" 1 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "amdfam10_decode" "direct") + (and (eq_attr "unit" "integer,unknown") + (eq_attr "memory" "store")))) + "athlon-direct,(athlon-ieu+athlon-agu), + athlon-store") + (define_insn_reservation "athlon_ivector_store" 2 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") @@ -293,6 +371,13 @@ (eq_attr "memory" "store")))) "athlon-vector,(athlon-ieu+athlon-agu),athlon-ieu, athlon-store") +(define_insn_reservation "athlon_ivector_store_amdfam10" 2 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "amdfam10_decode" "vector") + (and (eq_attr "unit" "integer,unknown") + (eq_attr "memory" "store")))) + "athlon-vector,(athlon-ieu+athlon-agu),athlon-ieu, + athlon-store") ;; Athlon floatin point unit (define_insn_reservation "athlon_fldxf" 12 @@ -302,7 +387,7 @@ (eq_attr "mode" "XF")))) "athlon-vector,athlon-fpload2,athlon-fvector*9") (define_insn_reservation "athlon_fldxf_k8" 13 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fmov") (and (eq_attr "memory" "load") (eq_attr "mode" "XF")))) @@ -314,7 +399,7 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fany") (define_insn_reservation "athlon_fld_k8" 2 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fmov") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fstore") @@ -326,7 +411,7 @@ (eq_attr "mode" "XF")))) "athlon-vector,(athlon-fpsched+athlon-agu),(athlon-store2+(athlon-fvector*7))") (define_insn_reservation "athlon_fstxf_k8" 8 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fmov") (and (eq_attr "memory" "store,both") (eq_attr "mode" "XF")))) @@ -337,16 +422,16 @@ (eq_attr "memory" "store,both"))) "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") (define_insn_reservation "athlon_fst_k8" 2 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fmov") (eq_attr "memory" "store,both"))) "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") (define_insn_reservation "athlon_fist" 4 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "fistp,fisttp")) "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") (define_insn_reservation "athlon_fmov" 2 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "fmov")) "athlon-direct,athlon-fpsched,athlon-faddmul") (define_insn_reservation "athlon_fadd_load" 4 @@ -355,12 +440,12 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fadd") (define_insn_reservation "athlon_fadd_load_k8" 6 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fop") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_fadd" 4 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "fop")) "athlon-direct,athlon-fpsched,athlon-fadd") (define_insn_reservation "athlon_fmul_load" 4 @@ -369,16 +454,16 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fmul") (define_insn_reservation "athlon_fmul_load_k8" 6 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fmul") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fmul") (define_insn_reservation "athlon_fmul" 4 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "fmul")) "athlon-direct,athlon-fpsched,athlon-fmul") (define_insn_reservation "athlon_fsgn" 2 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "fsgn")) "athlon-direct,athlon-fpsched,athlon-fmul") (define_insn_reservation "athlon_fdiv_load" 24 @@ -387,7 +472,7 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fmul") (define_insn_reservation "athlon_fdiv_load_k8" 13 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fdiv") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fmul") @@ -396,16 +481,16 @@ (eq_attr "type" "fdiv")) "athlon-direct,athlon-fpsched,athlon-fmul") (define_insn_reservation "athlon_fdiv_k8" 11 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (eq_attr "type" "fdiv")) "athlon-direct,athlon-fpsched,athlon-fmul") (define_insn_reservation "athlon_fpspc_load" 103 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (and (eq_attr "type" "fpspc") (eq_attr "memory" "load"))) "athlon-vector,athlon-fpload,athlon-fvector") (define_insn_reservation "athlon_fpspc" 100 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "fpspc")) "athlon-vector,athlon-fpsched,athlon-fvector") (define_insn_reservation "athlon_fcmov_load" 7 @@ -418,12 +503,12 @@ (eq_attr "type" "fcmov")) "athlon-vector,athlon-fpsched,athlon-fvector") (define_insn_reservation "athlon_fcmov_load_k8" 17 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fcmov") (eq_attr "memory" "load"))) "athlon-vector,athlon-fploadk8,athlon-fvector") (define_insn_reservation "athlon_fcmov_k8" 15 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (eq_attr "type" "fcmov")) "athlon-vector,athlon-fpsched,athlon-fvector") ;; fcomi is vector decoded by uses only one pipe. @@ -434,13 +519,13 @@ (eq_attr "memory" "load")))) "athlon-vector,athlon-fpload,athlon-fadd") (define_insn_reservation "athlon_fcomi_load_k8" 5 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fcmp") (and (eq_attr "athlon_decode" "vector") (eq_attr "memory" "load")))) "athlon-vector,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_fcomi" 3 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (and (eq_attr "athlon_decode" "vector") (eq_attr "type" "fcmp"))) "athlon-vector,athlon-fpsched,athlon-fadd") @@ -450,18 +535,18 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fadd") (define_insn_reservation "athlon_fcom_load_k8" 4 - (and (eq_attr "cpu" "k8,generic64") + (and (eq_attr "cpu" "k8,generic64,amdfam10") (and (eq_attr "type" "fcmp") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_fcom" 2 - (and (eq_attr "cpu" "athlon,k8,generic64") + (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") (eq_attr "type" "fcmp")) "athlon-direct,athlon-fpsched,athlon-fadd") ;; Never seen by the scheduler because we still don't do post reg-stack ;; scheduling. ;(define_insn_reservation "athlon_fxch" 2 -; (and (eq_attr "cpu" "athlon,k8,generic64") +; (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") ; (eq_attr "type" "fxch")) ; "athlon-direct,athlon-fpsched,athlon-fany") @@ -516,6 +601,23 @@ (and (eq_attr "type" "mmxmov,ssemov") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fstore") +;; On AMDFAM10 all double, single and integer packed and scalar SSEx data +;; loads generated are direct path, latency of 2 and do not use any FP +;; executions units. No seperate entries for movlpx/movhpx loads, which +;; are direct path, latency of 4 and use the FADD/FMUL FP execution units, +;; as they will not be generated. +(define_insn_reservation "athlon_sseld_amdfam10" 2 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "type" "ssemov") + (eq_attr "memory" "load"))) + "athlon-direct,athlon-fploadk8") +;; On AMDFAM10 MMX data loads generated are direct path, latency of 4 +;; and can use any FP executions units +(define_insn_reservation "athlon_mmxld_amdfam10" 4 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "type" "mmxmov") + (eq_attr "memory" "load"))) + "athlon-direct,athlon-fploadk8, athlon-fany") (define_insn_reservation "athlon_mmxssest" 3 (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "mmxmov,ssemov") @@ -533,6 +635,25 @@ (and (eq_attr "type" "mmxmov,ssemov") (eq_attr "memory" "store,both"))) "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") +;; On AMDFAM10 all double, single and integer packed SSEx data stores +;; generated are all double path, latency of 2 and use the FSTORE FP +;; execution unit. No entries seperate for movupx/movdqu, which are +;; vector path, latency of 3 and use the FSTORE*2 FP execution unit, +;; as they will not be generated. +(define_insn_reservation "athlon_ssest_amdfam10" 2 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "type" "ssemov") + (and (eq_attr "mode" "V4SF,V2DF,TI") + (eq_attr "memory" "store,both")))) + "athlon-double,(athlon-fpsched+athlon-agu),((athlon-fstore+athlon-store)*2)") +;; On AMDFAM10 all double, single and integer scalar SSEx and MMX +;; data stores generated are all direct path, latency of 2 and use +;; the FSTORE FP execution unit +(define_insn_reservation "athlon_mmxssest_short_amdfam10" 2 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "type" "mmxmov,ssemov") + (eq_attr "memory" "store,both"))) + "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") (define_insn_reservation "athlon_movaps_k8" 2 (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "ssemov") @@ -578,6 +699,11 @@ (and (eq_attr "type" "sselog,sselog1") (eq_attr "memory" "load"))) "athlon-double,athlon-fpload2k8,(athlon-fmul*2)") +(define_insn_reservation "athlon_sselog_load_amdfam10" 4 + (and (eq_attr "cpu" "amdfam10") + (and (eq_attr "type" "sselog,sselog1") + (eq_attr "memory" "load"))) + "athlon-direct,athlon-fploadk8,(athlon-fadd|athlon-fmul)") (define_insn_reservation "athlon_sselog" 3 (and (eq_attr "cpu" "athlon") (eq_attr "type" "sselog,sselog1")) @@ -586,6 +712,11 @@ (and (eq_attr "cpu" "k8,generic64") (eq_attr "type" "sselog,sselog1")) "athlon-double,athlon-fpsched,athlon-fmul") +(define_insn_reservation "athlon_sselog_amdfam10" 2 + (and (eq_attr "cpu" "amdfam10") + (eq_attr "type" "sselog,sselog1")) + "athlon-direct,athlon-fpsched,(athlon-fadd|athlon-fmul)") + ;; ??? pcmp executes in addmul, probably not worthwhile to bother about that. (define_insn_reservation "athlon_ssecmp_load" 2 (and (eq_attr "cpu" "athlon") @@ -594,13 +725,13 @@ (eq_attr "memory" "load")))) "athlon-direct,athlon-fpload,athlon-fadd") *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 15:32:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCA38106564A; Tue, 12 Jun 2012 15:32:14 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A767C8FC08; Tue, 12 Jun 2012 15:32:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CFWEr6061272; Tue, 12 Jun 2012 15:32:14 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CFWEGO061270; Tue, 12 Jun 2012 15:32:14 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206121532.q5CFWEGO061270@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 12 Jun 2012 15:32:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236963 - head/release/picobsd/tinyware/passwd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 15:32:15 -0000 Author: des Date: Tue Jun 12 15:32:14 2012 New Revision: 236963 URL: http://svn.freebsd.org/changeset/base/236963 Log: Remove dead code. Modified: head/release/picobsd/tinyware/passwd/passwd.c Modified: head/release/picobsd/tinyware/passwd/passwd.c ============================================================================== --- head/release/picobsd/tinyware/passwd/passwd.c Tue Jun 12 15:04:18 2012 (r236962) +++ head/release/picobsd/tinyware/passwd/passwd.c Tue Jun 12 15:32:14 2012 (r236963) @@ -64,10 +64,6 @@ int yp_errno = YP_TRUE; extern int yp_passwd( char * ); #endif -#ifdef KERBEROS -#include "krb.h" -#endif - #include "extern.h" static void usage(void); @@ -81,26 +77,12 @@ main(argc, argv) { int ch; char *uname; -#ifdef KERBEROS - char *iflag = 0, *rflag = 0, *uflag = 0; - char *k; -#endif #ifdef YP -#ifdef KERBEROS - char realm[REALM_SZ]; -#define OPTIONS "d:h:lysfoi:r:u:" -#else #define OPTIONS "d:h:lysfo" -#endif -#else -#ifdef KERBEROS - char realm[REALM_SZ]; -#define OPTIONS "li:r:u:" #else #define OPTIONS "l" #endif -#endif #ifdef YP int res = 0; @@ -113,17 +95,6 @@ main(argc, argv) case 'l': /* change local password file */ use_local_passwd = 1; break; -#ifdef KERBEROS - case 'i': - iflag = optarg; - break; - case 'r': - rflag = optarg; - break; - case 'u': - uflag = optarg; - break; -#endif /* KERBEROS */ #ifdef YP case 'y': /* Change NIS password */ __use_yp = 1; @@ -182,46 +153,29 @@ main(argc, argv) /* * If NIS is turned on in the password database, use it, else punt. */ -#ifdef KERBEROS - if (__use_yp || (iflag == NULL && rflag == NULL && uflag == NULL)) { -#endif - res = use_yp(uname, 0, 0); - if (res == USER_YP_ONLY) { - if (!use_local_passwd) { - exit(yp_passwd(uname)); - } else { + res = use_yp(uname, 0, 0); + if (res == USER_YP_ONLY) { + if (!use_local_passwd) { + exit(yp_passwd(uname)); + } else { /* * Reject -l flag if NIS is turned on and the user * doesn't exist in the local password database. */ - errx(1, "unknown local user: %s", uname); - } - } else if (res == USER_LOCAL_ONLY) { - /* - * Reject -y flag if user only exists locally. - */ - if (__use_yp) - errx(1, "unknown NIS user: %s", uname); - } else if (res == USER_YP_AND_LOCAL) { - if (!use_local_passwd && (yp_in_pw_file || __use_yp)) - exit(yp_passwd(uname)); + errx(1, "unknown local user: %s", uname); } -#ifdef KERBEROS + } else if (res == USER_LOCAL_ONLY) { + /* + * Reject -y flag if user only exists locally. + */ + if (__use_yp) + errx(1, "unknown NIS user: %s", uname); + } else if (res == USER_YP_AND_LOCAL) { + if (!use_local_passwd && (yp_in_pw_file || __use_yp)) + exit(yp_passwd(uname)); } #endif -#endif - if (!use_local_passwd) { -#ifdef KERBEROS - k = auth_getval("auth_list"); - if (k && strstr(k, "kerberos")) - if(krb_get_lrealm(realm, 0) == KSUCCESS) { - setuid(getuid()); - fprintf(stderr, "realm %s\n", realm); - exit(krb_passwd(argv[0], iflag, rflag, uflag)); - } -#endif - } exit(local_passwd(uname)); } @@ -230,21 +184,10 @@ usage() { #ifdef YP -#ifdef KERBEROS - fprintf(stderr, "%s\n%s\n", - "usage: passwd [-l] [-i instance] [-r realm] [-u fullname]", - " passwd [-l] [-y] [-o] [-d domain [-h host]] [user]"); -#else (void)fprintf(stderr, "usage: passwd [-l] [-y] [-o] [-d domain [-h host]] [user]\n"); -#endif #else -#ifdef KERBEROS - fprintf(stderr, - "usage: passwd [-l] [-i instance] [-r realm] [-u fullname] [user]\n"); -#else - (void)fprintf(stderr, "usage: passwd user\n"); -#endif + (void)fprintf(stderr, "usage: passwd [-l] user\n"); #endif exit(1); } From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 15:49:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 673EC106566B; Tue, 12 Jun 2012 15:49:46 +0000 (UTC) (envelope-from fluffy@fluffy.khv.ru) Received: from forward16.mail.yandex.net (forward16.mail.yandex.net [IPv6:2a02:6b8:0:1402::1]) by mx1.freebsd.org (Postfix) with ESMTP id D6EE08FC16; Tue, 12 Jun 2012 15:49:45 +0000 (UTC) Received: from smtp17.mail.yandex.net (smtp17.mail.yandex.net [95.108.252.17]) by forward16.mail.yandex.net (Yandex) with ESMTP id 541F3D20DFE; Tue, 12 Jun 2012 19:49:44 +0400 (MSK) Received: from smtp17.mail.yandex.net (localhost [127.0.0.1]) by smtp17.mail.yandex.net (Yandex) with ESMTP id 134851900212; Tue, 12 Jun 2012 19:49:44 +0400 (MSK) Received: from host85.static2.l2tp.ttkdv.ru (host85.static2.l2tp.ttkdv.ru [46.38.1.85]) by smtp17.mail.yandex.net (nwsmtp/Yandex) with ESMTP id nfDqbvAS-ngDaIU2d; Tue, 12 Jun 2012 19:49:43 +0400 X-Yandex-Rcpt-Suid: pfg@FreeBSD.org X-Yandex-Rcpt-Suid: src-committers@freebsd.org X-Yandex-Rcpt-Suid: svn-src-all@freebsd.org X-Yandex-Rcpt-Suid: svn-src-head@freebsd.org Message-ID: <4FD76522.9050509@fluffy.khv.ru> Date: Wed, 13 Jun 2012 02:49:54 +1100 From: Dima Panov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: "Pedro F. Giffuni" References: <201206121504.q5CF4JYo060137@svn.freebsd.org> In-Reply-To: <201206121504.q5CF4JYo060137@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236962 - in head/contrib/gcc: . config/i386 doc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: fluffy@FreeBSD.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 15:49:46 -0000 13.06.2012 2:04, Pedro F. Giffuni написал: > @@ -1209,14 +1209,14 @@ i[34567]86-*-solaris2*) > # FIXME: -m64 for i[34567]86-*-* should be allowed just > # like -m32 for x86_64-*-*. > case X"${with_cpu}" in > - Xgeneric|Xcore2|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx) > + Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx) > ;; > X) > with_cpu=generic > ;; > *) > echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 > - echo "generic core2 nocona x86-64 k8 opteron athlon64 athlon-fx" 1>&2 > + echo "generic core2 nocona x86-64amd fam10 barcelona k8 opteron Please take a look at typo. x86-64amd fam10 > athlon64 athlon-fx" 1>&2 > exit 1 > ;; > esac > @@ -2515,6 +2515,9 @@ if test x$with_cpu = x ; then > -- Dima Panov (fluffy@FreeBSD.org) (KDE, Office)@FreeBSD team Facebook: http://www.facebook.com/fluffy.khv IRC: fluffy@EFNet, fluffykhv@FreeNode twitter: fluffy_khv | skype: dima.panov From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 15:51:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D2ECB1065673 for ; Tue, 12 Jun 2012 15:51:48 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm12-vm0.bullet.mail.bf1.yahoo.com (nm12-vm0.bullet.mail.bf1.yahoo.com [98.139.213.140]) by mx1.freebsd.org (Postfix) with SMTP id 77C968FC17 for ; Tue, 12 Jun 2012 15:51:48 +0000 (UTC) Received: from [98.139.212.150] by nm12.bullet.mail.bf1.yahoo.com with NNFMP; 12 Jun 2012 15:51:42 -0000 Received: from [98.139.213.1] by tm7.bullet.mail.bf1.yahoo.com with NNFMP; 12 Jun 2012 15:51:42 -0000 Received: from [127.0.0.1] by smtp101.mail.bf1.yahoo.com with NNFMP; 12 Jun 2012 15:51:42 -0000 X-Yahoo-Newman-Id: 348778.2599.bm@smtp101.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: g8EUHxAVM1lGj0llGl1U1Zzu50xr6KyjlxLAdxtN0Nv4LdW BZ8J5UV94d65UHAVptEUWpQwQzgNnLKtR8YHNwHgoTUUCw1bFKJw40CnYh_A raYlmqyNFZa8utDlcQE9bm_1T2ETsWN9j4dobdxooH3JJ1jlYkUFKHn0yejU Eqzr9bKmfmmNw8l9Ks9u9F8Ar7QdNh8hErAML3ps8uMHMXbdyhG1JwpUAp14 XogYpbiAgBBf7sHeBuIGEjxXF2bMNGxAsTedBE7gbl8LGIxfTnPN0hTcIxcM 7whOVou.uZ7Mdp3.dOz5.YlyqHox2g7wEReHlvZS0SlKoaUsVDyDzEit_d9V QFXRHzEKYtYvX70fyx8QT9nttnL0Tifyien.QufgQsA8H8qVx80mADq_u9ML 92ApHtL7DChaXI19iVgeRNS4a8DMmsuc7M57Tqq7BzZb.Pwy2NJnh2QQ2VV7 UBHsZTBUjxZUVrdVroRxvDMzLkCe5CL2X2h2onnUsB_1t5YDhKpyailnPIce 95sAWaPvNPr..8p4nYhKlrx3SJwK_55XLfuPjtWf3nTxRAjletx2rExk6yA- - X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Received: from [192.168.10.102] (pfg@200.118.157.7 with plain) by smtp101.mail.bf1.yahoo.com with SMTP; 12 Jun 2012 15:51:42 +0000 UTC Message-ID: <4FD7658C.4010604@FreeBSD.org> Date: Tue, 12 Jun 2012 10:51:40 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120506 Thunderbird/12.0.1 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201206121504.q5CF4JYo060137@svn.freebsd.org> In-Reply-To: <201206121504.q5CF4JYo060137@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r236962 - in head/contrib/gcc: . config/i386 doc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 15:51:48 -0000 On 06/12/12 10:04, Pedro F. Giffuni wrote: > Author: pfg > Date: Tue Jun 12 15:04:18 2012 > New Revision: 236962 > URL: http://svn.freebsd.org/changeset/base/236962 > > Log: > Add experimental support for amdfam10/barcelona from the GCC 4.3 branch. > > Initial support for the AMD barcelona chipsets has been available in the > gcc43 branch under GPLv2 but was not included when the Core 2 support > was brought to the system gcc. > > AMD and some linux distributions (OpenSUSE) did a backport of the amdfam10 > support and made them available. Unfortunately this is still experimental > and while it can improve performance, enabling the CPUTYPE may break some > C++ ports (like clang). > > Special care was taken to make sure that the patches predate the GPLv3 > switch upstream. > > Tested by: Vladimir Kushnir > Reviewed by: mm > Approved by: jhb (mentor) > MFC after: 2 weeks > > As a side note, I didn't add the CPUTYPE to bsd.cpu.mk because it may break buildworld in clang, so normally most of this optimizations are not available. The patch does include some minor fixes for optimizations that GCC developers didn't consider regressions so were never back ported. This was, of course, tested by building world on amd64 (not amdfam10) and shouldn't cause any trouble. I think this ends the series of GPLv2 patches we could bring in. Pedro. From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 16:03:24 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E11A106564A; Tue, 12 Jun 2012 16:03:24 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 499798FC14; Tue, 12 Jun 2012 16:03:24 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 1E694256; Tue, 12 Jun 2012 18:03:23 +0200 (CEST) Date: Tue, 12 Jun 2012 18:01:29 +0200 From: Pawel Jakub Dawidek To: Mateusz Guzik Message-ID: <20120612160128.GA1429@garage.freebsd.pl> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vtzGhvizbBRQ85DL" Content-Disposition: inline In-Reply-To: <20120612134950.GC20749@dft-labs.eu> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 16:03:24 -0000 --vtzGhvizbBRQ85DL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 12, 2012 at 03:49:50PM +0200, Mateusz Guzik wrote: > On Tue, Jun 12, 2012 at 01:43:35PM +0200, Pawel Jakub Dawidek wrote: > > On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote: > > > The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which > > > still may not be enough to have place for new fd with high number. > >=20 > > I was under impression that fd_first_free() can return at most > > fdp->fd_nfiles, but indeed I missed this: > >=20 > > if (low >=3D size) > > return (low); > >=20 > > So fd_first_free() can return number biffer than size... > >=20 > > > This fixed the problem for me, although I'm not sure whether it's ok = to > > > grow the table like this: > > > http://people.freebsd.org/~mjg/patches/fdalloc.patch > >=20 > > The patch looks good to me, could you please commit it, preferably after > > David's trying it and also update fd_first_free() comment, so it is > > clear that returned value can exceed 'size -1'? > >=20 >=20 > Given that you partially reverted r236935 I created a combined patch: > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free.patch >=20 > Is this ok? >=20 > Most changes are obiously yours, so I see no problem if you prefer to > commit this yourself. >=20 > Otherwise I plan to commit it with the following: > Re-apply reverted parts of r236935 by pjd with some fixes. >=20 > If fdalloc decides to grow fdtable it does it once and at most doubles > the size. This still may be not enough for sufficiently large fd. Use fd > in calculations of new size in order to fix this. >=20 > Fix description of fd_first_free to note that it returns passed fd if it > exceeds fdtable's size. >=20 > =3D=3D=3D=3D=3D=3D Look good and you can just add 'In co-operation with: pjd'. One minor thing is that fd_first_free() can return 'size' if there are no free slots available. Could you include that in the comment as well? > fd_last_used has very same problem with comment as fd_first_free. This > function is static and the only caller always passes 0 as low. Given > that, how about the following: > http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch Looks good too. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --vtzGhvizbBRQ85DL Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/XZ9gACgkQForvXbEpPzSxcACg9Se9DL/jMJYYHQ/mGvGl6vrg DrMAmgNm+j6clNG0yy6B3A5Rv/wLHcGC =/aXA -----END PGP SIGNATURE----- --vtzGhvizbBRQ85DL-- From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 16:07:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 197D9106566B; Tue, 12 Jun 2012 16:07:04 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0573F8FC15; Tue, 12 Jun 2012 16:07:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CG738X062739; Tue, 12 Jun 2012 16:07:03 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CG733d062737; Tue, 12 Jun 2012 16:07:03 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206121607.q5CG733d062737@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 12 Jun 2012 16:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236964 - head/contrib/gcc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 16:07:04 -0000 Author: pfg Date: Tue Jun 12 16:07:03 2012 New Revision: 236964 URL: http://svn.freebsd.org/changeset/base/236964 Log: Space mismatch - typo in r236962. Found by: Dima Panov Approved by: jhb (mentor) MFC after: 2 weeks Modified: head/contrib/gcc/config.gcc Modified: head/contrib/gcc/config.gcc ============================================================================== --- head/contrib/gcc/config.gcc Tue Jun 12 15:32:14 2012 (r236963) +++ head/contrib/gcc/config.gcc Tue Jun 12 16:07:03 2012 (r236964) @@ -1216,7 +1216,7 @@ i[34567]86-*-solaris2*) ;; *) echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 - echo "generic core2 nocona x86-64amd fam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2 + echo "generic core2 nocona x86-64 amdfam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2 exit 1 ;; esac From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 17:02:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C8CE4106564A; Tue, 12 Jun 2012 17:02:53 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAE438FC0A; Tue, 12 Jun 2012 17:02:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CH2r77065082; Tue, 12 Jun 2012 17:02:53 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CH2rqY065075; Tue, 12 Jun 2012 17:02:53 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206121702.q5CH2rqY065075@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 12 Jun 2012 17:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236965 - in head: etc include lib/libutil share/examples/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 17:02:53 -0000 Author: des Date: Tue Jun 12 17:02:53 2012 New Revision: 236965 URL: http://svn.freebsd.org/changeset/base/236965 Log: Finally nuke auth.conf, nine years after it was deprecated. The only thing it was still used for was to set the "global default" password hash. Since the stock auth.conf contained nothing but comments, the global default was actually the first algorithm in crypt(3)'s list, which happens to be DES; I take the fact that nobody noticed as proof that it was not used outside of crypt(3). The only other use in our tree was in the Kerberos support code in in tinyware's passwd(1). I removed that code in an earlier commit; it would not have compiled anyway, as it only supported Kerberos IV. The auth_getval() function is now a stub that always returns NULL, which has the same effect as a functional auth_getval() with an empty auth.conf. MFC after: 3 weeks Deleted: head/etc/auth.conf head/lib/libutil/auth.3 head/lib/libutil/auth.conf.5 Modified: head/etc/Makefile head/include/paths.h head/lib/libutil/Makefile head/lib/libutil/auth.c head/lib/libutil/property.3 head/share/examples/etc/README.examples Modified: head/etc/Makefile ============================================================================== --- head/etc/Makefile Tue Jun 12 16:07:03 2012 (r236964) +++ head/etc/Makefile Tue Jun 12 17:02:53 2012 (r236965) @@ -7,8 +7,7 @@ SUBDIR= sendmail .endif -BIN1= auth.conf \ - crontab \ +BIN1= crontab \ devd.conf \ devfs.conf \ ddb.conf \ Modified: head/include/paths.h ============================================================================== --- head/include/paths.h Tue Jun 12 16:07:03 2012 (r236964) +++ head/include/paths.h Tue Jun 12 17:02:53 2012 (r236965) @@ -42,7 +42,6 @@ /* Locate system binaries. */ #define _PATH_SYSPATH "/sbin:/usr/sbin" -#define _PATH_AUTHCONF "/etc/auth.conf" #define _PATH_BSHELL "/bin/sh" #define _PATH_CAPABILITY "/etc/capability" #define _PATH_CAPABILITY_DB "/etc/capability.db" Modified: head/lib/libutil/Makefile ============================================================================== --- head/lib/libutil/Makefile Tue Jun 12 16:07:03 2012 (r236964) +++ head/lib/libutil/Makefile Tue Jun 12 17:02:53 2012 (r236965) @@ -25,14 +25,13 @@ CFLAGS+= -DINET6 CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libc/gen/ -MAN+= auth.3 expand_number.3 flopen.3 fparseln.3 hexdump.3 \ +MAN+= expand_number.3 flopen.3 fparseln.3 hexdump.3 \ humanize_number.3 kinfo_getallproc.3 kinfo_getfile.3 \ kinfo_getproc.3 kinfo_getvmmap.3 kld.3 login_auth.3 login_cap.3 \ login_class.3 login_ok.3 login_times.3 login_tty.3 pidfile.3 \ property.3 pty.3 quotafile.3 realhostname.3 realhostname_sa.3 \ _secure_path.3 trimdomain.3 uucplock.3 -MAN+= auth.conf.5 login.conf.5 -MLINKS+= auth.3 auth_getval.3 +MAN+= login.conf.5 MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3 MLINKS+=login_auth.3 auth_cat.3 login_auth.3 auth_checknologin.3 MLINKS+=login_cap.3 login_close.3 login_cap.3 login_getcapbool.3 \ Modified: head/lib/libutil/auth.c ============================================================================== --- head/lib/libutil/auth.c Tue Jun 12 16:07:03 2012 (r236964) +++ head/lib/libutil/auth.c Tue Jun 12 17:02:53 2012 (r236965) @@ -31,40 +31,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include -#include -#include -#include -#include - -static properties P; - -static int -initauthconf(const char *path) -{ - int fd; +#include - if (!P) { - if ((fd = open(path, O_RDONLY)) < 0) { - syslog(LOG_ERR, "initauthconf: unable to open file: %s", path); - return 1; - } - P = properties_read(fd); - close(fd); - if (!P) { - syslog(LOG_ERR, "initauthconf: unable to parse file: %s", path); - return 1; - } - } - return 0; -} +#include char * auth_getval(const char *name) { - if (!P && initauthconf(_PATH_AUTHCONF)) - return NULL; - else - return property_find(P, name); + + (void)name; + return (NULL); } Modified: head/lib/libutil/property.3 ============================================================================== --- head/lib/libutil/property.3 Tue Jun 12 16:07:03 2012 (r236964) +++ head/lib/libutil/property.3 Tue Jun 12 17:02:53 2012 (r236965) @@ -90,8 +90,6 @@ are desired, the entire value should be characters. Any line beginning with a # or ; character is assumed to be a comment and will be ignored. -.Sh SEE ALSO -.Xr auth_getval 3 .Sh AUTHORS .An Jordan Hubbard .Sh BUGS Modified: head/share/examples/etc/README.examples ============================================================================== --- head/share/examples/etc/README.examples Tue Jun 12 16:07:03 2012 (r236964) +++ head/share/examples/etc/README.examples Tue Jun 12 17:02:53 2012 (r236965) @@ -9,7 +9,6 @@ This directory contains the following fi amd.map - filesystem automounter lookup resolution map (see amd(8)) apmd.conf - configuration file for apmd(8) -auth.conf - authentication capability database (see auth.conf(5)) bsd-style-copyright - copyright style for bsd system crontab - system scheduled command table (see crontab(5)) csh.cshrc - sample .cshrc (see csh(1)) From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 17:04:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB45B106566B; Tue, 12 Jun 2012 17:04:56 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D700D8FC19; Tue, 12 Jun 2012 17:04:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CH4uGJ065195; Tue, 12 Jun 2012 17:04:56 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CH4uWM065193; Tue, 12 Jun 2012 17:04:56 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206121704.q5CH4uWM065193@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 12 Jun 2012 17:04:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236966 - head/sys/mips/rmi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 17:04:57 -0000 Author: des Date: Tue Jun 12 17:04:56 2012 New Revision: 236966 URL: http://svn.freebsd.org/changeset/base/236966 Log: auth.conf is dead. Modified: head/sys/mips/rmi/rootfs_list.txt Modified: head/sys/mips/rmi/rootfs_list.txt ============================================================================== --- head/sys/mips/rmi/rootfs_list.txt Tue Jun 12 17:02:53 2012 (r236965) +++ head/sys/mips/rmi/rootfs_list.txt Tue Jun 12 17:04:56 2012 (r236966) @@ -1,3 +1,5 @@ +# $FreeBSD$ +# # This is the list of files that # should be in your rootfs (copy it from # the build world nfsmount dir. When the rge0 @@ -321,7 +323,6 @@ ./etc/ssh/moduli ./etc/ssl ./etc/ssl/openssl.cnf -./etc/auth.conf ./etc/crontab ./etc/devd.conf ./etc/devfs.conf From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 17:14:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A287106564A; Tue, 12 Jun 2012 17:14:20 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E00F18FC0C; Tue, 12 Jun 2012 17:14:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CHEJHf065659; Tue, 12 Jun 2012 17:14:19 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CHEJhY065655; Tue, 12 Jun 2012 17:14:19 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206121714.q5CHEJhY065655@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 12 Jun 2012 17:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236967 - head/lib/libcrypt X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 17:14:20 -0000 Author: des Date: Tue Jun 12 17:14:19 2012 New Revision: 236967 URL: http://svn.freebsd.org/changeset/base/236967 Log: Stop using auth_getval() now that it always returns NULL. Instead, hardcode the default to what it would be if we didn't hardcode it, i.e. DES if supported and MD5 otherwise. MFC after: 3 weeks Modified: head/lib/libcrypt/Makefile head/lib/libcrypt/crypt.3 head/lib/libcrypt/crypt.c Modified: head/lib/libcrypt/Makefile ============================================================================== --- head/lib/libcrypt/Makefile Tue Jun 12 17:04:56 2012 (r236966) +++ head/lib/libcrypt/Makefile Tue Jun 12 17:14:19 2012 (r236967) @@ -26,11 +26,7 @@ SRCS+= crypt-des.c crypt-blowfish.c blo CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH .endif -# And the auth_getval() code and support. -.PATH: ${.CURDIR}/../libutil -SRCS+= auth.c property.c -.for sym in auth_getval property_find properties_read properties_free \ - MD4Init MD4Final MD4Update MD4Pad \ +.for sym in MD4Init MD4Final MD4Update MD4Pad \ MD5Init MD5Final MD5Update MD5Pad \ SHA256_Init SHA256_Final SHA256_Update \ SHA512_Init SHA512_Final SHA512_Update Modified: head/lib/libcrypt/crypt.3 ============================================================================== --- head/lib/libcrypt/crypt.3 Tue Jun 12 17:04:56 2012 (r236966) +++ head/lib/libcrypt/crypt.3 Tue Jun 12 17:14:19 2012 (r236967) @@ -238,12 +238,6 @@ The .Fn crypt_set_format function sets the default encoding format according to the supplied .Fa string . -.Pp -The global default format can be set using the -.Pa /etc/auth.conf -file using the -.Va crypt_default -property. .Sh RETURN VALUES The .Fn crypt @@ -260,9 +254,7 @@ Otherwise, a value of 0 is returned. .Sh SEE ALSO .Xr login 1 , .Xr passwd 1 , -.Xr auth_getval 3 , .Xr getpass 3 , -.Xr auth.conf 5 , .Xr passwd 5 .Sh HISTORY A rotor-based Modified: head/lib/libcrypt/crypt.c ============================================================================== --- head/lib/libcrypt/crypt.c Tue Jun 12 17:04:56 2012 (r236966) +++ head/lib/libcrypt/crypt.c Tue Jun 12 17:14:19 2012 (r236967) @@ -79,23 +79,23 @@ static const struct { } }; +#ifdef HAS_DES +#define CRYPT_DEFAULT "des" +#else +#define CRYPT_DEFAULT "md5" +#endif + static int crypt_type = -1; static void crypt_setdefault(void) { - char *def; size_t i; if (crypt_type != -1) return; - def = auth_getval("crypt_default"); - if (def == NULL) { - crypt_type = 0; - return; - } for (i = 0; i < sizeof(crypt_types) / sizeof(crypt_types[0]) - 1; i++) { - if (strcmp(def, crypt_types[i].name) == 0) { + if (strcmp(CRYPT_DEFAULT, crypt_types[i].name) == 0) { crypt_type = (int)i; return; } From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 18:19:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA5BF1065674; Tue, 12 Jun 2012 18:19:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 961668FC17; Tue, 12 Jun 2012 18:19:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CIJkDF068468; Tue, 12 Jun 2012 18:19:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CIJkPf068466; Tue, 12 Jun 2012 18:19:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206121819.q5CIJkPf068466@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Jun 2012 18:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236968 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 18:19:46 -0000 Author: jhb Date: Tue Jun 12 18:19:46 2012 New Revision: 236968 URL: http://svn.freebsd.org/changeset/base/236968 Log: Replace a reference to the non-existent SI_ORDER_LAST in a comment with SI_ORDER_ANY. Submitted by: Brandon Gooch brandongooch yahoo com Modified: head/sys/sys/kernel.h Modified: head/sys/sys/kernel.h ============================================================================== --- head/sys/sys/kernel.h Tue Jun 12 17:14:19 2012 (r236967) +++ head/sys/sys/kernel.h Tue Jun 12 18:19:46 2012 (r236968) @@ -267,7 +267,7 @@ void sysinit_add(struct sysinit **set, s /* * Infrastructure for tunable 'constants'. Value may be specified at compile * time or kernel load time. Rules relating tunables together can be placed - * in a SYSINIT function at SI_SUB_TUNABLES with SI_ORDER_LAST. + * in a SYSINIT function at SI_SUB_TUNABLES with SI_ORDER_ANY. * * WARNING: developers should never use the reserved suffixes specified in * loader.conf(5) for any tunables or conflicts will result. From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 19:18:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 63A52106566B; Tue, 12 Jun 2012 19:18:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 48AC78FC17; Tue, 12 Jun 2012 19:18:42 +0000 (UTC) Received: by eabm6 with SMTP id m6so918313eab.13 for ; Tue, 12 Jun 2012 12:18:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=NHWwI0lWfaklNMRmyAG+BWhSvucpbSy+lwayFcSxzlw=; b=CE/FbpM4KsyXlmsLRdZKOn1sXZIfh5ZJx+0WXrTi5MxK7oKw8hw1HWJgE0b7Kyy6Cc X1d68gFLn0S0kXCBXwh6uKEjwzM6ds5alMq0YTnDpRISpPj6hiQJgjQ7iDykO4GdImXH ntB3vYofDiOPTkPW97Dz0DTSCw/s/fbB/TFIqujjPjKay/mZI/DdQj934+8tjV6tFQKT vmNJGPeTAafYXLN7TNDygO6ZJLylTHrR5O6qwENFOw8cMaKix1F4XOg4/FWZLAPxiOM7 92dEZJmirAcuDmu0PJqJ5ngcVuYSaxYhkgYrPuv/wN0BcgH/L9aFze13tc1gOQKRDiuk ekCA== Received: by 10.14.119.134 with SMTP id n6mr7391063eeh.0.1339528719682; Tue, 12 Jun 2012 12:18:39 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id e45sm67625081eeb.6.2012.06.12.12.18.37 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jun 2012 12:18:38 -0700 (PDT) Date: Tue, 12 Jun 2012 21:18:28 +0200 From: Mateusz Guzik To: Pawel Jakub Dawidek Message-ID: <20120612191828.GD20749@dft-labs.eu> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120612160128.GA1429@garage.freebsd.pl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 19:18:43 -0000 On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote: > On Tue, Jun 12, 2012 at 03:49:50PM +0200, Mateusz Guzik wrote: > > On Tue, Jun 12, 2012 at 01:43:35PM +0200, Pawel Jakub Dawidek wrote: > > > On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote: > > > > The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which > > > > still may not be enough to have place for new fd with high number. > > > > > > I was under impression that fd_first_free() can return at most > > > fdp->fd_nfiles, but indeed I missed this: > > > > > > if (low >= size) > > > return (low); > > > > > > So fd_first_free() can return number biffer than size... > > > > > > > This fixed the problem for me, although I'm not sure whether it's ok to > > > > grow the table like this: > > > > http://people.freebsd.org/~mjg/patches/fdalloc.patch > > > > > > The patch looks good to me, could you please commit it, preferably after > > > David's trying it and also update fd_first_free() comment, so it is > > > clear that returned value can exceed 'size -1'? > > > > > > > Given that you partially reverted r236935 I created a combined patch: > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free.patch > > > > Is this ok? > > > > Most changes are obiously yours, so I see no problem if you prefer to > > commit this yourself. > > > > Otherwise I plan to commit it with the following: > > Re-apply reverted parts of r236935 by pjd with some fixes. > > > > If fdalloc decides to grow fdtable it does it once and at most doubles > > the size. This still may be not enough for sufficiently large fd. Use fd > > in calculations of new size in order to fix this. > > > > Fix description of fd_first_free to note that it returns passed fd if it > > exceeds fdtable's size. > > > > ====== > > Look good and you can just add 'In co-operation with: pjd'. > One minor thing is that fd_first_free() can return 'size' if there are > no free slots available. Could you include that in the comment as well? > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch > > fd_last_used has very same problem with comment as fd_first_free. This > > function is static and the only caller always passes 0 as low. Given > > that, how about the following: > > http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch > > Looks good too. > Updated in similar manner: http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup2.patch -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 20:01:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA8B31065674; Tue, 12 Jun 2012 20:01:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D56008FC17; Tue, 12 Jun 2012 20:01:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CK1Tj8072829; Tue, 12 Jun 2012 20:01:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CK1Tsb072826; Tue, 12 Jun 2012 20:01:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206122001.q5CK1Tsb072826@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 12 Jun 2012 20:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236969 - in stable/9/sys: i386/conf modules X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 20:01:30 -0000 Author: kib Date: Tue Jun 12 20:01:29 2012 New Revision: 236969 URL: http://svn.freebsd.org/changeset/base/236969 Log: MFC r235859: Enable drm2 modules build. Modified: stable/9/sys/i386/conf/XEN stable/9/sys/modules/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/i386/conf/XEN ============================================================================== --- stable/9/sys/i386/conf/XEN Tue Jun 12 18:19:46 2012 (r236968) +++ stable/9/sys/i386/conf/XEN Tue Jun 12 20:01:29 2012 (r236969) @@ -7,7 +7,7 @@ cpu I686_CPU ident XEN makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -makeoptions WITHOUT_MODULES="aha ahb amd cxgb dpt drm hptmv ida malo mps mwl nve sound sym trm xfs" +makeoptions WITHOUT_MODULES="aha ahb amd cxgb dpt drm drm2 hptmv ida malo mps mwl nve sound sym trm xfs" options SCHED_ULE # ULE scheduler options PREEMPTION # Enable kernel thread preemption Modified: stable/9/sys/modules/Makefile ============================================================================== --- stable/9/sys/modules/Makefile Tue Jun 12 18:19:46 2012 (r236968) +++ stable/9/sys/modules/Makefile Tue Jun 12 20:01:29 2012 (r236969) @@ -84,6 +84,7 @@ SUBDIR= ${_3dfx} \ ${_dpms} \ ${_dpt} \ ${_drm} \ + ${_drm2} \ ${_dtrace} \ dummynet \ ${_ed} \ @@ -452,6 +453,7 @@ _cyclic= cyclic .endif _dpms= dpms _drm= drm +_drm2= drm2 .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _dtrace= dtrace .endif @@ -620,6 +622,7 @@ _cyclic= cyclic .endif _dpms= dpms _drm= drm +_drm2= drm2 .if ${MK_CDDL} != "no" || defined(ALL_MODULES) _dtrace= dtrace .endif From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 20:04:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 51ED4106564A; Tue, 12 Jun 2012 20:04:24 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C7B98FC0A; Tue, 12 Jun 2012 20:04:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CK4ODB072980; Tue, 12 Jun 2012 20:04:24 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CK4OMs072977; Tue, 12 Jun 2012 20:04:24 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201206122004.q5CK4OMs072977@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 12 Jun 2012 20:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236970 - stable/9/usr.sbin/daemon X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 20:04:24 -0000 Author: trociny Date: Tue Jun 12 20:04:23 2012 New Revision: 236970 URL: http://svn.freebsd.org/changeset/base/236970 Log: MFC r236550, r236551: r236550: On a child exit, call waitpid(2) to clean up the process table. Submitted by: Andrey Zonov r236551: Document -r option in SYNOPSIS and usage statement. Submitted by: Andrey Zonov Modified: stable/9/usr.sbin/daemon/daemon.8 stable/9/usr.sbin/daemon/daemon.c Directory Properties: stable/9/usr.sbin/daemon/ (props changed) Modified: stable/9/usr.sbin/daemon/daemon.8 ============================================================================== --- stable/9/usr.sbin/daemon/daemon.8 Tue Jun 12 20:01:29 2012 (r236969) +++ stable/9/usr.sbin/daemon/daemon.8 Tue Jun 12 20:04:23 2012 (r236970) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2012 +.Dd June 4, 2012 .Dt DAEMON 8 .Os .Sh NAME @@ -34,7 +34,7 @@ .Nd run detached from the controlling terminal .Sh SYNOPSIS .Nm -.Op Fl cf +.Op Fl cfr .Op Fl p Ar pidfile .Op Fl u Ar user .Ar command arguments ... Modified: stable/9/usr.sbin/daemon/daemon.c ============================================================================== --- stable/9/usr.sbin/daemon/daemon.c Tue Jun 12 20:01:29 2012 (r236969) +++ stable/9/usr.sbin/daemon/daemon.c Tue Jun 12 20:04:23 2012 (r236970) @@ -217,6 +217,10 @@ wait_child(pid_t pid, sigset_t *mask) } switch (signo) { case SIGCHLD: + if (waitpid(pid, NULL, WNOHANG) == -1) { + warn("waitpid"); + return (-1); + } return (terminate); case SIGTERM: terminate = 1; @@ -236,7 +240,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: daemon [-cf] [-p pidfile] [-u user] command " + "usage: daemon [-cfr] [-p pidfile] [-u user] command " "arguments ...\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 20:05:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B12B7106566C; Tue, 12 Jun 2012 20:05:22 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B1A28FC1E; Tue, 12 Jun 2012 20:05:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CK5M0i073059; Tue, 12 Jun 2012 20:05:22 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CK5Mod073055; Tue, 12 Jun 2012 20:05:22 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201206122005.q5CK5Mod073055@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 12 Jun 2012 20:05:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236971 - stable/8/usr.sbin/daemon X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 20:05:22 -0000 Author: trociny Date: Tue Jun 12 20:05:22 2012 New Revision: 236971 URL: http://svn.freebsd.org/changeset/base/236971 Log: MFC r236550, r236551: r236550: On a child exit, call waitpid(2) to clean up the process table. Submitted by: Andrey Zonov r236551: Document -r option in SYNOPSIS and usage statement. Submitted by: Andrey Zonov Modified: stable/8/usr.sbin/daemon/daemon.8 stable/8/usr.sbin/daemon/daemon.c Directory Properties: stable/8/usr.sbin/daemon/ (props changed) Modified: stable/8/usr.sbin/daemon/daemon.8 ============================================================================== --- stable/8/usr.sbin/daemon/daemon.8 Tue Jun 12 20:04:23 2012 (r236970) +++ stable/8/usr.sbin/daemon/daemon.8 Tue Jun 12 20:05:22 2012 (r236971) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 19, 2012 +.Dd June 4, 2012 .Dt DAEMON 8 .Os .Sh NAME @@ -34,7 +34,7 @@ .Nd run detached from the controlling terminal .Sh SYNOPSIS .Nm -.Op Fl cf +.Op Fl cfr .Op Fl p Ar pidfile .Op Fl u Ar user .Ar command arguments ... Modified: stable/8/usr.sbin/daemon/daemon.c ============================================================================== --- stable/8/usr.sbin/daemon/daemon.c Tue Jun 12 20:04:23 2012 (r236970) +++ stable/8/usr.sbin/daemon/daemon.c Tue Jun 12 20:05:22 2012 (r236971) @@ -217,6 +217,10 @@ wait_child(pid_t pid, sigset_t *mask) } switch (signo) { case SIGCHLD: + if (waitpid(pid, NULL, WNOHANG) == -1) { + warn("waitpid"); + return (-1); + } return (terminate); case SIGTERM: terminate = 1; @@ -236,7 +240,7 @@ static void usage(void) { (void)fprintf(stderr, - "usage: daemon [-cf] [-p pidfile] [-u user] command " + "usage: daemon [-cfr] [-p pidfile] [-u user] command " "arguments ...\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 20:24:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D3D8D10656D0; Tue, 12 Jun 2012 20:24:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF1218FC08; Tue, 12 Jun 2012 20:24:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CKOv09073914; Tue, 12 Jun 2012 20:24:57 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CKOv3I073912; Tue, 12 Jun 2012 20:24:57 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206122024.q5CKOv3I073912@svn.freebsd.org> From: Dimitry Andric Date: Tue, 12 Jun 2012 20:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236972 - head/lib/libkiconv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 20:24:58 -0000 Author: dim Date: Tue Jun 12 20:24:57 2012 New Revision: 236972 URL: http://svn.freebsd.org/changeset/base/236972 Log: Make sure libkiconv.so.4 is installed into /lib, not into /usr/lib, which was inadvertently caused by r236185: if SHLIBDIR is set using the ?= operator, it must be done *before* bsd.own.mk is included, otherwise the default value is still used. Note, bsd.lib.mk will take care of removing the copy in /usr/lib upon installation, so no addition to ObsoleteFiles.inc is needed. X-MFC-With: r236185 Modified: head/lib/libkiconv/Makefile Modified: head/lib/libkiconv/Makefile ============================================================================== --- head/lib/libkiconv/Makefile Tue Jun 12 20:05:22 2012 (r236971) +++ head/lib/libkiconv/Makefile Tue Jun 12 20:24:57 2012 (r236972) @@ -1,9 +1,10 @@ # $FreeBSD$ +SHLIBDIR?= /lib + .include LIB= kiconv -SHLIBDIR?= /lib SRCS= kiconv_sysctl.c xlat16_iconv.c xlat16_sysctl.c SRCS+= quirks.c From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 20:54:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DD98106564A; Tue, 12 Jun 2012 20:54:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5FB9C8FC19; Tue, 12 Jun 2012 20:54:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CKsvKf075153; Tue, 12 Jun 2012 20:54:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CKsv0Q075151; Tue, 12 Jun 2012 20:54:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206122054.q5CKsv0Q075151@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Jun 2012 20:54:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236973 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 20:54:57 -0000 Author: jhb Date: Tue Jun 12 20:54:55 2012 New Revision: 236973 URL: http://svn.freebsd.org/changeset/base/236973 Log: Release Pedro Giffuni (pfg@) from mentorship. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Tue Jun 12 20:24:57 2012 (r236972) +++ svnadmin/conf/mentors Tue Jun 12 20:54:55 2012 (r236973) @@ -30,7 +30,6 @@ miwi rwatson mjg trasz monthadar adrian nork imp -pfg jhb ray adrian rdivacky rpaulo snb dwmalone From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 20:55:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 182FC10658CB; Tue, 12 Jun 2012 20:55:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEA3D8FC14; Tue, 12 Jun 2012 20:55:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CKtvqq075244; Tue, 12 Jun 2012 20:55:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CKtvhO075242; Tue, 12 Jun 2012 20:55:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206122055.q5CKtvhO075242@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Jun 2012 20:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236974 - head/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 20:55:58 -0000 Author: jhb Date: Tue Jun 12 20:55:57 2012 New Revision: 236974 URL: http://svn.freebsd.org/changeset/base/236974 Log: Add pfg@ as one of my mentees. Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Tue Jun 12 20:54:55 2012 (r236973) +++ head/share/misc/committers-src.dot Tue Jun 12 20:55:57 2012 (r236974) @@ -436,6 +436,7 @@ jhb -> avg jhb -> jeff jhb -> kbyanc jhb -> rnoland +jhb -> pfg jkh -> imp jkh -> jlemon From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 21:03:25 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EB27106568E; Tue, 12 Jun 2012 21:03:25 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6933E8FC0C; Tue, 12 Jun 2012 21:03:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CL3P4c075605; Tue, 12 Jun 2012 21:03:25 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CL3PSY075603; Tue, 12 Jun 2012 21:03:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206122103.q5CL3PSY075603@svn.freebsd.org> From: Dimitry Andric Date: Tue, 12 Jun 2012 21:03:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236975 - stable/9/sys/dev/aic7xxx/aicasm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 21:03:25 -0000 Author: dim Date: Tue Jun 12 21:03:24 2012 New Revision: 236975 URL: http://svn.freebsd.org/changeset/base/236975 Log: MFC r236578: Fix build of aicasm when CC=clang. This was due to a side-effect of the EARLY_BUILD macro: the -Qunused-arguments flag isn't passed anymore when building this particular program. However, with clang 3.1 and -Werror, such unused argument warnings are flagged as errors, causing buildkernel to fail at this stage, due to the -nostdinc flag passed during linking. Since the -nostdinc flag isn't actually needed, just remove it. Modified: stable/9/sys/dev/aic7xxx/aicasm/Makefile Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/aic7xxx/aicasm/Makefile ============================================================================== --- stable/9/sys/dev/aic7xxx/aicasm/Makefile Tue Jun 12 20:55:57 2012 (r236974) +++ stable/9/sys/dev/aic7xxx/aicasm/Makefile Tue Jun 12 21:03:24 2012 (r236975) @@ -24,8 +24,7 @@ WARNS?= 5 DEPENDFILE= .depend_aicasm .endif -NOSTDINC= -nostdinc -CFLAGS+= ${NOSTDINC} -I/usr/include -I. +CFLAGS+= -I. .ifdef MAKESRCPATH CFLAGS+= -I${MAKESRCPATH} .endif From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 21:37:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D66E106564A; Tue, 12 Jun 2012 21:37:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC9088FC15; Tue, 12 Jun 2012 21:37:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CLbRod077125; Tue, 12 Jun 2012 21:37:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CLbReK077123; Tue, 12 Jun 2012 21:37:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206122137.q5CLbReK077123@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 12 Jun 2012 21:37:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236976 - head/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 21:37:28 -0000 Author: kib Date: Tue Jun 12 21:37:27 2012 New Revision: 236976 URL: http://svn.freebsd.org/changeset/base/236976 Log: For incompleted block allocations or frees, the inode block count usage must be recalculated. The blk_check pass of suj checker explicitely marks inodes which owned such blocks as needing block count adjustment. But ino_adjblks() is only called by cg_trunc pass, which is performed before blk_check. As result, the block use count for such inodes is left wrong. This causes full fsck run after journaled run to still find inconsistencies like 'INCORRECT BLOCK COUNT I=14557 (328 should be 0)' in phase 1. Fix this issue by running additional adj_blk pass after blk_check, which updates the field. Reviewed by: jeff, mckusick MFC after: 1 week Modified: head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Tue Jun 12 21:03:24 2012 (r236975) +++ head/sbin/fsck_ffs/suj.c Tue Jun 12 21:37:27 2012 (r236976) @@ -1789,6 +1789,20 @@ cg_trunc(struct suj_cg *sc) } } +static void +cg_adj_blk(struct suj_cg *sc) +{ + struct suj_ino *sino; + int i; + + for (i = 0; i < SUJ_HASHSIZE; i++) { + LIST_FOREACH(sino, &sc->sc_inohash[i], si_next) { + if (sino->si_blkadj) + ino_adjblks(sino); + } + } +} + /* * Free any partially allocated blocks and then resolve inode block * counts. @@ -2720,6 +2734,7 @@ suj_check(const char *filesys) printf("** Processing journal entries.\n"); cg_apply(cg_trunc); cg_apply(cg_check_blk); + cg_apply(cg_adj_blk); cg_apply(cg_check_ino); } if (preen == 0 && (jrecs > 0 || jbytes > 0) && reply("WRITE CHANGES") == 0) From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 21:46:03 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 913671065677; Tue, 12 Jun 2012 21:46:03 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 3EAD98FC12; Tue, 12 Jun 2012 21:46:03 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id D702B36F; Tue, 12 Jun 2012 23:45:54 +0200 (CEST) Date: Tue, 12 Jun 2012 23:44:00 +0200 From: Pawel Jakub Dawidek To: Mateusz Guzik Message-ID: <20120612214400.GB1429@garage.freebsd.pl> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EuxKj2iCbKjpUGkD" Content-Disposition: inline In-Reply-To: <20120612191828.GD20749@dft-labs.eu> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 21:46:03 -0000 --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 12, 2012 at 09:18:28PM +0200, Mateusz Guzik wrote: > On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote: > > Look good and you can just add 'In co-operation with: pjd'. > > One minor thing is that fd_first_free() can return 'size' if there are > > no free slots available. Could you include that in the comment as well? > >=20 >=20 > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch Ok. Merge racct_set() call into one line, it now fits into 80 chars. I have no more objections. > > > fd_last_used has very same problem with comment as fd_first_free. This > > > function is static and the only caller always passes 0 as low. Given > > > that, how about the following: > > > http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch > >=20 > > Looks good too. > >=20 >=20 > Updated in similar manner: > http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup2.patch Ok. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --EuxKj2iCbKjpUGkD Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/XuB8ACgkQForvXbEpPzRj0gCeK86N67zB4OQTukA3B9jX1Ih1 jDYAoPi14muxXnESwmNYqv3rjjSqUuTP =gzMA -----END PGP SIGNATURE----- --EuxKj2iCbKjpUGkD-- From owner-svn-src-all@FreeBSD.ORG Tue Jun 12 23:16:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82BC8106566C; Tue, 12 Jun 2012 23:16:01 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 63ACE8FC12; Tue, 12 Jun 2012 23:16:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5CNG1Fv081415; Tue, 12 Jun 2012 23:16:01 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5CNG1ba081405; Tue, 12 Jun 2012 23:16:01 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201206122316.q5CNG1ba081405@svn.freebsd.org> From: "David E. O'Brien" Date: Tue, 12 Jun 2012 23:16:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236977 - head/tools/regression/usr.bin/make/variables/modifier_t X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 23:16:01 -0000 Author: obrien Date: Tue Jun 12 23:16:00 2012 New Revision: 236977 URL: http://svn.freebsd.org/changeset/base/236977 Log: Add a test for the :tl & :tu modifiers. Added: head/tools/regression/usr.bin/make/variables/modifier_t/ head/tools/regression/usr.bin/make/variables/modifier_t/Makefile (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.1 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.2 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.3 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.1 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.2 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.3 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.1 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.2 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.3 (contents, props changed) head/tools/regression/usr.bin/make/variables/modifier_t/test.t (contents, props changed) Added: head/tools/regression/usr.bin/make/variables/modifier_t/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/variables/modifier_t/Makefile Tue Jun 12 23:16:00 2012 (r236977) @@ -0,0 +1,15 @@ +# $FreeBSD$ +# +# Test the t modifier. +# +# below is missing ' +ASCII= !"\#$$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ + +test1: + @echo '${ASCII}' + +test2: + @echo '${ASCII:tl}' + +test3: + @echo '${ASCII:tu}' Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.1 Tue Jun 12 23:16:00 2012 (r236977) @@ -0,0 +1 @@ +0 Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.2 Tue Jun 12 23:16:00 2012 (r236977) @@ -0,0 +1 @@ +0 Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.status.3 Tue Jun 12 23:16:00 2012 (r236977) @@ -0,0 +1 @@ +0 Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.1 ============================================================================== Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.2 ============================================================================== Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stderr.3 ============================================================================== Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.1 Tue Jun 12 23:16:00 2012 (r236977) @@ -0,0 +1 @@ +!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.2 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.2 Tue Jun 12 23:16:00 2012 (r236977) @@ -0,0 +1 @@ +!"#$%&()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Added: head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/make/variables/modifier_t/expected.stdout.3 Tue Jun 12 23:16:00 2012 (r236977) @@ -0,0 +1 @@ +!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~ Added: head/tools/regression/usr.bin/make/variables/modifier_t/test.t ============================================================================== Binary file. No diff available. From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 00:12:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 00062106566C; Wed, 13 Jun 2012 00:12:47 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4C7F8FC08; Wed, 13 Jun 2012 00:12:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D0ClAJ083895; Wed, 13 Jun 2012 00:12:47 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D0Clth083894; Wed, 13 Jun 2012 00:12:47 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201206130012.q5D0Clth083894@svn.freebsd.org> From: "Andrey A. Chernov" Date: Wed, 13 Jun 2012 00:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236978 - stable/9/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 00:12:48 -0000 Author: ache Date: Wed Jun 13 00:12:47 2012 New Revision: 236978 URL: http://svn.freebsd.org/changeset/base/236978 Log: Forget to propogate mergeinfo to directories Modified: Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdlib/realpath.c (props changed) From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 02:00:28 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A3E8D106566C; Wed, 13 Jun 2012 02:00:28 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 270AB8FC19; Wed, 13 Jun 2012 02:00:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5D20Exu093894; Wed, 13 Jun 2012 02:00:15 GMT (envelope-from listlog2011@gmail.com) Message-ID: <4FD7F42E.5080505@gmail.com> Date: Wed, 13 Jun 2012 10:00:14 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Mateusz Guzik References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> In-Reply-To: <20120612191828.GD20749@dft-labs.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek , davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: davidxu@FreeBSD.org List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 02:00:28 -0000 On 2012/6/13 3:18, Mateusz Guzik wrote: > On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote: >> On Tue, Jun 12, 2012 at 03:49:50PM +0200, Mateusz Guzik wrote: >>> On Tue, Jun 12, 2012 at 01:43:35PM +0200, Pawel Jakub Dawidek wrote: >>>> On Tue, Jun 12, 2012 at 12:47:49PM +0200, Mateusz Guzik wrote: >>>>> The problem is that fdalloc grows to at most fdp->fd_nfiles * 2, which >>>>> still may not be enough to have place for new fd with high number. >>>> I was under impression that fd_first_free() can return at most >>>> fdp->fd_nfiles, but indeed I missed this: >>>> >>>> if (low>= size) >>>> return (low); >>>> >>>> So fd_first_free() can return number biffer than size... >>>> >>>>> This fixed the problem for me, although I'm not sure whether it's ok to >>>>> grow the table like this: >>>>> http://people.freebsd.org/~mjg/patches/fdalloc.patch >>>> The patch looks good to me, could you please commit it, preferably after >>>> David's trying it and also update fd_first_free() comment, so it is >>>> clear that returned value can exceed 'size -1'? >>>> >>> Given that you partially reverted r236935 I created a combined patch: >>> http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free.patch >>> >>> Is this ok? >>> >>> Most changes are obiously yours, so I see no problem if you prefer to >>> commit this yourself. >>> >>> Otherwise I plan to commit it with the following: >>> Re-apply reverted parts of r236935 by pjd with some fixes. >>> >>> If fdalloc decides to grow fdtable it does it once and at most doubles >>> the size. This still may be not enough for sufficiently large fd. Use fd >>> in calculations of new size in order to fix this. >>> >>> Fix description of fd_first_free to note that it returns passed fd if it >>> exceeds fdtable's size. >>> >>> ====== >> Look good and you can just add 'In co-operation with: pjd'. >> One minor thing is that fd_first_free() can return 'size' if there are >> no free slots available. Could you include that in the comment as well? >> > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch > >>> fd_last_used has very same problem with comment as fd_first_free. This >>> function is static and the only caller always passes 0 as low. Given >>> that, how about the following: >>> http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup.patch >> Looks good too. >> > Updated in similar manner: > http://people.freebsd.org/~mjg/patches/fd_last_used-cleanup2.patch I have tested it, the machine does not panic. Thanks, David Xu From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 02:24:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8C42106566C; Wed, 13 Jun 2012 02:24:31 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) by mx1.freebsd.org (Postfix) with ESMTP id 84B618FC0C; Wed, 13 Jun 2012 02:24:31 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 226DC25D39FF; Wed, 13 Jun 2012 02:24:30 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 3D2BABE8046; Wed, 13 Jun 2012 02:24:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id t44GFgHhL6Kl; Wed, 13 Jun 2012 02:24:28 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id A8CFEBE8044; Wed, 13 Jun 2012 02:24:27 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <201206122137.q5CLbReK077123@svn.freebsd.org> Date: Wed, 13 Jun 2012 02:24:26 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <59C39E5A-C63D-490C-B260-E00A4D90E213@lists.zabbadoz.net> References: <201206122137.q5CLbReK077123@svn.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236976 - head/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 02:24:31 -0000 On 12. Jun 2012, at 21:37 , Konstantin Belousov wrote: > Author: kib > Date: Tue Jun 12 21:37:27 2012 > New Revision: 236976 > URL: http://svn.freebsd.org/changeset/base/236976 >=20 > Log: > For incompleted block allocations or frees, the inode block count = usage > must be recalculated. The blk_check pass of suj checker explicitely = marks > inodes which owned such blocks as needing block count adjustment. But > ino_adjblks() is only called by cg_trunc pass, which is performed = before > blk_check. As result, the block use count for such inodes is left = wrong. > This causes full fsck run after journaled run to still find = inconsistencies > like 'INCORRECT BLOCK COUNT I=3D14557 (328 should be 0)' in phase 1. >=20 > Fix this issue by running additional adj_blk pass after blk_check, = which > updates the field. >=20 > Reviewed by: jeff, mckusick Thanks a lot! /bz --=20 Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 02:38:10 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18C7F106564A; Wed, 13 Jun 2012 02:38:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id A4F1C8FC14; Wed, 13 Jun 2012 02:38:09 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5D2btHs031153 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 13 Jun 2012 12:37:57 +1000 Date: Wed, 13 Jun 2012 12:37:50 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <20120612115117.GB1372@garage.freebsd.pl> Message-ID: <20120613115111.R5323@besplex.bde.org> References: <201206112017.q5BKHKsW007722@svn.freebsd.org> <20120612114254.V1572@besplex.bde.org> <20120612115117.GB1372@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r236917 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 02:38:10 -0000 On Tue, 12 Jun 2012, Pawel Jakub Dawidek wrote: > On Tue, Jun 12, 2012 at 12:53:47PM +1000, Bruce Evans wrote: >> On Mon, 11 Jun 2012, Pawel Jakub Dawidek wrote: >>> - KASSERT(fd >= 0 && fd < fdp->fd_nfiles, >>> + KASSERT((unsigned int)fd < fdp->fd_nfiles, >>> ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); >>> return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); >>> } >> >> This is backwards. Apart from using the worst possible (most verbose) >> spelling of `unsigned', it uses a type hack manually optimize away the >> test for fd being < 0. The compiler will do this "optimization" >> automatically if it is any good (or undo it if it is not), so all the >> hack does is obfuscate the test. With the verbose spelling of u_int, >> it even takes more space. > > Well, to be honest I presonally would prefer explicit check for fd being > less than 0, but my impression was that using cast is the most popular > way and I wanted this check to be consistent across our source tree. > > Feel free to change it. I'm only free to ask you to back out it out. > BTW. I really dislike using 'unsigned' with omitted 'int'. u_int is fine. I really dislike 'unsigned int'. The int in it is just noise, as in 'long int'. >From K&R 1: p34: "The declarations for the qualifiers look like [...] unsigned int x; The word int can be omitted in such situations, and typically is." p45: example that uses plain unsigned. p183: "Unisgned integers, declared unsigned, ...". p193: [semi-formal grammar]: "type-specifier: char, short, int, long, unsigned, float, double, struct-or-union-specifier, typedef-name. [short int, long int, unsigned int, long float are also acceptable]". >From K&R 2: p36: same as above p34. p49: similar to above p45 (now missing in index; no longer "implicit int" for the function return type; excessive use of unsigned fixed). p196: similar to above p183 (now says "...declared using the unsigned keyword). p211: similzr to above p193 (add void, signed, enum-specifier; remove long float, and tighten up the description of which combinations are allowed in other ways). Other interesting points from K&R: - according to the grammar, both `unsigned' and 'signed' are full-fledged types, not qualifiers for integer types. You can even write plain 'signed' meaning 'signed int', but no one does that. - K&R very rarely uses `unsigned'. This shows that it should rarely be used. I could only find the above examples in it (these are all that are in the index for K&R 1), plus 1 more a page later than the p45/49 one (the index is broken in a different way for this -- in K&R 1 the one on p46 is not indexed, while in K&R 2 the one on p49 is not indexed). Bruce From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 03:18:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7497D106579D; Wed, 13 Jun 2012 03:18:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F0408FC0C; Wed, 13 Jun 2012 03:18:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3Im8K092068; Wed, 13 Jun 2012 03:18:48 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3ImAN092066; Wed, 13 Jun 2012 03:18:48 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130318.q5D3ImAN092066@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:18:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236979 - stable/9/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:18:48 -0000 Author: eadler Date: Wed Jun 13 03:18:47 2012 New Revision: 236979 URL: http://svn.freebsd.org/changeset/base/236979 Log: MFC r236290: Document daily_status_security_chkportsum_enable PR: docs/167980 Approved by: cperciva (implicit) Modified: stable/9/share/man/man5/periodic.conf.5 Directory Properties: stable/9/share/man/man5/ (props changed) Modified: stable/9/share/man/man5/periodic.conf.5 ============================================================================== --- stable/9/share/man/man5/periodic.conf.5 Wed Jun 13 00:12:47 2012 (r236978) +++ stable/9/share/man/man5/periodic.conf.5 Wed Jun 13 03:18:47 2012 (r236979) @@ -504,6 +504,12 @@ Set to .Dq Li YES to compare the modes and modification times of setuid executables with the previous day's values. +.It Va daily_status_security_chkportsum_enable +.Pq Vt bool +Set to +.Dq Li YES +to verify checksums of all installed packages against the known checksums in +.Pa /var/db/pkg . .It Va daily_status_security_neggrpperm_enable .Pq Vt bool Set to From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 03:19:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26664106567D; Wed, 13 Jun 2012 03:19:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10CDC8FC16; Wed, 13 Jun 2012 03:19:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3JBwS092120; Wed, 13 Jun 2012 03:19:11 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3JBlO092118; Wed, 13 Jun 2012 03:19:11 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130319.q5D3JBlO092118@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:19:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236980 - stable/8/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:19:12 -0000 Author: eadler Date: Wed Jun 13 03:19:11 2012 New Revision: 236980 URL: http://svn.freebsd.org/changeset/base/236980 Log: MFC r236290: Document daily_status_security_chkportsum_enable PR: docs/167980 Approved by: cperciva (implicit) Modified: stable/8/share/man/man5/periodic.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/periodic.conf.5 ============================================================================== --- stable/8/share/man/man5/periodic.conf.5 Wed Jun 13 03:18:47 2012 (r236979) +++ stable/8/share/man/man5/periodic.conf.5 Wed Jun 13 03:19:11 2012 (r236980) @@ -504,6 +504,12 @@ Set to .Dq Li YES to compare the modes and modification times of setuid executables with the previous day's values. +.It Va daily_status_security_chkportsum_enable +.Pq Vt bool +Set to +.Dq Li YES +to verify checksums of all installed packages against the known checksums in +.Pa /var/db/pkg . .It Va daily_status_security_neggrpperm_enable .Pq Vt bool Set to From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 03:29:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E40F6106566B; Wed, 13 Jun 2012 03:29:57 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF58D8FC12; Wed, 13 Jun 2012 03:29:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3TvUp092620; Wed, 13 Jun 2012 03:29:57 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3Tv8O092618; Wed, 13 Jun 2012 03:29:57 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130329.q5D3Tv8O092618@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236981 - stable/7/lib/libc/stdio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:29:58 -0000 Author: eadler Date: Wed Jun 13 03:29:57 2012 New Revision: 236981 URL: http://svn.freebsd.org/changeset/base/236981 Log: MFC r236288: Only set _w to 0 when the file stream is not currently reading. Without this fflush may fail to write data in the buffer. PR: kern/137819 Approved by: cperciva (implicit) Modified: stable/7/lib/libc/stdio/fpurge.c Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/stdio/fpurge.c ============================================================================== --- stable/7/lib/libc/stdio/fpurge.c Wed Jun 13 03:19:11 2012 (r236980) +++ stable/7/lib/libc/stdio/fpurge.c Wed Jun 13 03:29:57 2012 (r236981) @@ -62,7 +62,7 @@ fpurge(fp) FREEUB(fp); fp->_p = fp->_bf._base; fp->_r = 0; - fp->_w = fp->_flags & (__SLBF|__SNBF) ? 0 : fp->_bf._size; + fp->_w = fp->_flags & (__SLBF|__SNBF|__SRD) ? 0 : fp->_bf._size; retval = 0; } FUNLOCKFILE(fp); From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 03:30:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E382A10656E9; Wed, 13 Jun 2012 03:30:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CED008FC18; Wed, 13 Jun 2012 03:30:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3UOwr092683; Wed, 13 Jun 2012 03:30:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3UOoK092681; Wed, 13 Jun 2012 03:30:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130330.q5D3UOoK092681@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236982 - stable/8/lib/libc/stdio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:30:25 -0000 Author: eadler Date: Wed Jun 13 03:30:24 2012 New Revision: 236982 URL: http://svn.freebsd.org/changeset/base/236982 Log: MFC r236288: Only set _w to 0 when the file stream is not currently reading. Without this fflush may fail to write data in the buffer. PR: kern/137819 Approved by: cperciva (implicit) Modified: stable/8/lib/libc/stdio/fpurge.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/stdio/fpurge.c ============================================================================== --- stable/8/lib/libc/stdio/fpurge.c Wed Jun 13 03:29:57 2012 (r236981) +++ stable/8/lib/libc/stdio/fpurge.c Wed Jun 13 03:30:24 2012 (r236982) @@ -62,7 +62,7 @@ fpurge(fp) FREEUB(fp); fp->_p = fp->_bf._base; fp->_r = 0; - fp->_w = fp->_flags & (__SLBF|__SNBF) ? 0 : fp->_bf._size; + fp->_w = fp->_flags & (__SLBF|__SNBF|__SRD) ? 0 : fp->_bf._size; retval = 0; } FUNLOCKFILE(fp); From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 03:34:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EDDD1065673; Wed, 13 Jun 2012 03:34:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59CE38FC17; Wed, 13 Jun 2012 03:34:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3Yhc9092916; Wed, 13 Jun 2012 03:34:43 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3Yhdo092914; Wed, 13 Jun 2012 03:34:43 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130334.q5D3Yhdo092914@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236983 - stable/9/lib/libc/stdio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:34:43 -0000 Author: eadler Date: Wed Jun 13 03:34:42 2012 New Revision: 236983 URL: http://svn.freebsd.org/changeset/base/236983 Log: MFC r236288: Only set _w to 0 when the file stream is not currently reading. Without this fflush may fail to write data in the buffer. PR: kern/137819 Approved by: cperciva (implicit) Modified: stable/9/lib/libc/stdio/fpurge.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdio/fpurge.c ============================================================================== --- stable/9/lib/libc/stdio/fpurge.c Wed Jun 13 03:30:24 2012 (r236982) +++ stable/9/lib/libc/stdio/fpurge.c Wed Jun 13 03:34:42 2012 (r236983) @@ -62,7 +62,7 @@ fpurge(fp) FREEUB(fp); fp->_p = fp->_bf._base; fp->_r = 0; - fp->_w = fp->_flags & (__SLBF|__SNBF) ? 0 : fp->_bf._size; + fp->_w = fp->_flags & (__SLBF|__SNBF|__SRD) ? 0 : fp->_bf._size; retval = 0; } FUNLOCKFILE(fp); From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 03:41:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 09AD31065674; Wed, 13 Jun 2012 03:41:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8BBA8FC0A; Wed, 13 Jun 2012 03:40:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3exNw093235; Wed, 13 Jun 2012 03:40:59 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3exH6093233; Wed, 13 Jun 2012 03:40:59 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130340.q5D3exH6093233@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:40:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236984 - stable/9/usr.bin/mail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:41:00 -0000 Author: eadler Date: Wed Jun 13 03:40:59 2012 New Revision: 236984 URL: http://svn.freebsd.org/changeset/base/236984 Log: MFC r236286: Fix likely race condition if wait_child() is interrupted by sigchild() PR: bin/102834 Approved by: cperciva (implicit) Modified: stable/9/usr.bin/mail/popen.c Directory Properties: stable/9/usr.bin/mail/ (props changed) Modified: stable/9/usr.bin/mail/popen.c ============================================================================== --- stable/9/usr.bin/mail/popen.c Wed Jun 13 03:34:42 2012 (r236983) +++ stable/9/usr.bin/mail/popen.c Wed Jun 13 03:40:59 2012 (r236984) @@ -336,12 +336,14 @@ int wait_child(int pid) { sigset_t nset, oset; - struct child *cp = findchild(pid); + struct child *cp; (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); (void)sigprocmask(SIG_BLOCK, &nset, &oset); + cp = findchild(pid); + while (!cp->done) (void)sigsuspend(&oset); wait_status = cp->status; From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 03:41:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2320A10657EA; Wed, 13 Jun 2012 03:41:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DFA38FC12; Wed, 13 Jun 2012 03:41:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3fM7R093290; Wed, 13 Jun 2012 03:41:22 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3fMKY093288; Wed, 13 Jun 2012 03:41:22 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130341.q5D3fMKY093288@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236985 - stable/8/usr.bin/mail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:41:23 -0000 Author: eadler Date: Wed Jun 13 03:41:22 2012 New Revision: 236985 URL: http://svn.freebsd.org/changeset/base/236985 Log: MFC r236286: Fix likely race condition if wait_child() is interrupted by sigchild() PR: bin/102834 Approved by: cperciva (implicit) Modified: stable/8/usr.bin/mail/popen.c Directory Properties: stable/8/usr.bin/mail/ (props changed) Modified: stable/8/usr.bin/mail/popen.c ============================================================================== --- stable/8/usr.bin/mail/popen.c Wed Jun 13 03:40:59 2012 (r236984) +++ stable/8/usr.bin/mail/popen.c Wed Jun 13 03:41:22 2012 (r236985) @@ -364,12 +364,14 @@ wait_child(pid) int pid; { sigset_t nset, oset; - struct child *cp = findchild(pid); + struct child *cp; (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); (void)sigprocmask(SIG_BLOCK, &nset, &oset); + cp = findchild(pid); + while (!cp->done) (void)sigsuspend(&oset); wait_status = cp->status; From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 03:41:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9961B1065674; Wed, 13 Jun 2012 03:41:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 841AB8FC0A; Wed, 13 Jun 2012 03:41:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D3fgjG093338; Wed, 13 Jun 2012 03:41:42 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D3fgIB093336; Wed, 13 Jun 2012 03:41:42 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130341.q5D3fgIB093336@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 03:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236986 - stable/7/usr.bin/mail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 03:41:42 -0000 Author: eadler Date: Wed Jun 13 03:41:42 2012 New Revision: 236986 URL: http://svn.freebsd.org/changeset/base/236986 Log: MFC r236286: Fix likely race condition if wait_child() is interrupted by sigchild() PR: bin/102834 Approved by: cperciva (implicit) Modified: stable/7/usr.bin/mail/popen.c Directory Properties: stable/7/usr.bin/mail/ (props changed) Modified: stable/7/usr.bin/mail/popen.c ============================================================================== --- stable/7/usr.bin/mail/popen.c Wed Jun 13 03:41:22 2012 (r236985) +++ stable/7/usr.bin/mail/popen.c Wed Jun 13 03:41:42 2012 (r236986) @@ -364,12 +364,14 @@ wait_child(pid) int pid; { sigset_t nset, oset; - struct child *cp = findchild(pid); + struct child *cp; (void)sigemptyset(&nset); (void)sigaddset(&nset, SIGCHLD); (void)sigprocmask(SIG_BLOCK, &nset, &oset); + cp = findchild(pid); + while (!cp->done) (void)sigsuspend(&oset); wait_status = cp->status; From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 04:09:04 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EA62106566B; Wed, 13 Jun 2012 04:09:04 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id CAA068FC12; Wed, 13 Jun 2012 04:09:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q5D491b8089102; Wed, 13 Jun 2012 08:09:01 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q5D491Zu089101; Wed, 13 Jun 2012 08:09:01 +0400 (MSK) (envelope-from ache) Date: Wed, 13 Jun 2012 08:09:01 +0400 From: Andrey Chernov To: Bruce Evans Message-ID: <20120613040900.GA88971@vniz.net> Mail-Followup-To: Andrey Chernov , Bruce Evans , Pawel Jakub Dawidek , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <201206112017.q5BKHKsW007722@svn.freebsd.org> <20120612114254.V1572@besplex.bde.org> <20120612115117.GB1372@garage.freebsd.pl> <20120613115111.R5323@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120613115111.R5323@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Pawel Jakub Dawidek Subject: Re: svn commit: r236917 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 04:09:04 -0000 On Wed, Jun 13, 2012 at 12:37:50PM +1000, Bruce Evans wrote: > >> On Mon, 11 Jun 2012, Pawel Jakub Dawidek wrote: > >>> - KASSERT(fd >= 0 && fd < fdp->fd_nfiles, > >>> + KASSERT((unsigned int)fd < fdp->fd_nfiles, > >>> ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); > >>> return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); > >>> } > >> > >> This is backwards. Apart from using the worst possible (most verbose) > >> spelling of `unsigned', it uses a type hack manually optimize away the > >> test for fd being < 0. The compiler will do this "optimization" > >> automatically if it is any good (or undo it if it is not), so all the > >> hack does is obfuscate the test. With the verbose spelling of u_int, > >> it even takes more space. > > > > Well, to be honest I presonally would prefer explicit check for fd being > > less than 0, but my impression was that using cast is the most popular > > way and I wanted this check to be consistent across our source tree. > > > > Feel free to change it. > > I'm only free to ask you to back out it out. I agree that this change should backed out for better. It gains nothing for modern compilers, but makes code reading harder. -- http://ache.vniz.net/ From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 04:38:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1A281065672; Wed, 13 Jun 2012 04:38:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABAC18FC14; Wed, 13 Jun 2012 04:38:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D4cAeH095699; Wed, 13 Jun 2012 04:38:10 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D4cAM2095668; Wed, 13 Jun 2012 04:38:10 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206130438.q5D4cAM2095668@svn.freebsd.org> From: Warner Losh Date: Wed, 13 Jun 2012 04:38:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236987 - in head/sys/arm/xscale: i80321 i8134x ixp425 pxa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 04:38:10 -0000 Author: imp Date: Wed Jun 13 04:38:09 2012 New Revision: 236987 URL: http://svn.freebsd.org/changeset/base/236987 Log: trim trailing spaces that have accumulated over the years (these files served as the basis for too many other platforms). Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c head/sys/arm/xscale/i80321/i80321.c head/sys/arm/xscale/i80321/i80321_aau.c head/sys/arm/xscale/i80321/i80321_dma.c head/sys/arm/xscale/i80321/i80321_intr.h head/sys/arm/xscale/i80321/i80321_pci.c head/sys/arm/xscale/i80321/i80321_space.c head/sys/arm/xscale/i80321/i80321_timer.c head/sys/arm/xscale/i80321/i80321reg.h head/sys/arm/xscale/i80321/iq31244_7seg.c head/sys/arm/xscale/i80321/iq31244_machdep.c head/sys/arm/xscale/i80321/iq80321.c head/sys/arm/xscale/i80321/obio.c head/sys/arm/xscale/i8134x/crb_machdep.c head/sys/arm/xscale/i8134x/i81342.c head/sys/arm/xscale/i8134x/i81342_mcu.c head/sys/arm/xscale/i8134x/i81342_pci.c head/sys/arm/xscale/i8134x/i81342_space.c head/sys/arm/xscale/i8134x/i81342reg.h head/sys/arm/xscale/i8134x/iq81342_7seg.c head/sys/arm/xscale/i8134x/obio.c head/sys/arm/xscale/i8134x/uart_cpu_i81342.c head/sys/arm/xscale/ixp425/avila_ata.c head/sys/arm/xscale/ixp425/avila_gpio.c head/sys/arm/xscale/ixp425/avila_machdep.c head/sys/arm/xscale/ixp425/cambria_exp_space.c head/sys/arm/xscale/ixp425/if_npe.c head/sys/arm/xscale/ixp425/if_npereg.h head/sys/arm/xscale/ixp425/ixp425.c head/sys/arm/xscale/ixp425/ixp425_iic.c head/sys/arm/xscale/ixp425/ixp425_npe.c head/sys/arm/xscale/ixp425/ixp425_npereg.h head/sys/arm/xscale/ixp425/ixp425_pci.c head/sys/arm/xscale/ixp425/ixp425_pci_space.c head/sys/arm/xscale/ixp425/ixp425_qmgr.c head/sys/arm/xscale/ixp425/ixp425_qmgr.h head/sys/arm/xscale/ixp425/ixp425reg.h head/sys/arm/xscale/pxa/if_smc_smi.c head/sys/arm/xscale/pxa/pxa_machdep.c head/sys/arm/xscale/pxa/pxareg.h Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/ep80219_machdep.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/ep80219_machdep.c Wed Jun 13 04:38:09 2012 (r236987) @@ -40,7 +40,7 @@ * * Machine dependant functions for kernel setup * - * This file needs a lot of work. + * This file needs a lot of work. * * Created : 17/09/94 */ @@ -142,7 +142,7 @@ struct pv_addr minidataclean; /* Static device mappings. */ static const struct pmap_devmap ep80219_devmap[] = { - /* + /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. */ @@ -150,7 +150,7 @@ static const struct pmap_devmap ep80219_ IQ80321_OBIO_BASE, IQ80321_OBIO_BASE, IQ80321_OBIO_SIZE, - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { @@ -159,7 +159,7 @@ static const struct pmap_devmap ep80219_ VERDE_OUT_XLATE_IO_WIN_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, - }, + }, { IQ80321_80321_VBASE, VERDE_PMMR_BASE, @@ -192,8 +192,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); @@ -222,7 +222,7 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_pa = freemempos + (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * L2_TABLE_SIZE_REAL; - kernel_pt_table[loop].pv_va = + kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa + 0x20000000; } } @@ -291,13 +291,13 @@ initarm(struct arm_boot_params *abp) (((uint32_t)(lastaddr) - KERNBASE - 0x200000) + L1_S_SIZE) & ~(L1_S_SIZE - 1), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); freemem_after = ((int)lastaddr + PAGE_SIZE) & ~(PAGE_SIZE - 1); - afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & ~(L1_S_SIZE + afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1)); for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { pmap_link_l2pt(l1pagetable, afterkern + i * 0x00100000, &kernel_pt_table[KERNEL_PT_AFKERNEL + i]); } - pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa, + pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); @@ -306,7 +306,7 @@ initarm(struct arm_boot_params *abp) arm_add_smallalloc_pages((void *)(freemem_after), (void*)(freemem_after + PAGE_SIZE), afterkern - (freemem_after + PAGE_SIZE), 0); - + } #endif @@ -338,7 +338,7 @@ initarm(struct arm_boot_params *abp) * of the stack memory. */ - + set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_ABT32_MODE, @@ -386,7 +386,7 @@ initarm(struct arm_boot_params *abp) dump_avail[1] = 0xa0000000 + memsize; dump_avail[2] = 0; dump_avail[3] = 0; - pmap_bootstrap(pmap_curmaxkvaddr, + pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: head/sys/arm/xscale/i80321/i80321.c ============================================================================== --- head/sys/arm/xscale/i80321/i80321.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/i80321.c Wed Jun 13 04:38:09 2012 (r236987) @@ -225,9 +225,9 @@ i80321_attach(struct i80321_softc *sc) static __inline uint32_t i80321_iintsrc_read(void) -{ - uint32_t iintsrc; - +{ + uint32_t iintsrc; + __asm __volatile("mrc p6, 0, %0, c8, c0, 0" : "=r" (iintsrc)); Modified: head/sys/arm/xscale/i80321/i80321_aau.c ============================================================================== --- head/sys/arm/xscale/i80321/i80321_aau.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/i80321_aau.c Wed Jun 13 04:38:09 2012 (r236987) @@ -111,14 +111,14 @@ i80321_aau_attach(device_t dev) mtx_init(&softc->mtx, "AAU mtx", NULL, MTX_SPIN); softc->sc_st = sc->sc_st; - if (bus_space_subregion(softc->sc_st, sc->sc_sh, VERDE_AAU_BASE, + if (bus_space_subregion(softc->sc_st, sc->sc_sh, VERDE_AAU_BASE, VERDE_AAU_SIZE, &softc->sc_aau_sh) != 0) panic("%s: unable to subregion AAU registers", device_get_name(dev)); if (bus_dma_tag_create(NULL, sizeof(i80321_aaudesc_t), 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, AAU_RING_SIZE * sizeof(i80321_aaudesc_t), - 1, sizeof(i80321_aaudesc_t), BUS_DMA_ALLOCNOW, busdma_lock_mutex, + 1, sizeof(i80321_aaudesc_t), BUS_DMA_ALLOCNOW, busdma_lock_mutex, &Giant, &softc->dmatag)) panic("Couldn't create a dma tag"); if (bus_dmamem_alloc(softc->dmatag, (void **)&aaudescs, @@ -186,7 +186,7 @@ aau_bzero(void *dst, int len, int flags) desc->next_desc = 0; desc->count = len; desc->descr_ctrl = 2 << 1 | 1 << 31; /* Fill, enable dest write */ - bus_dmamap_sync(sc->dmatag, sc->aauring[0].map, + bus_dmamap_sync(sc->dmatag, sc->aauring[0].map, BUS_DMASYNC_PREWRITE); } else { test_virt_addr(dst, len); @@ -218,8 +218,8 @@ aau_bzero(void *dst, int len, int flags) if (tmplen <= 0 && descnb > 0) { sc->aauring[descnb - 1].desc->next_desc = 0; - bus_dmamap_sync(sc->dmatag, - sc->aauring[descnb - 1].map, + bus_dmamap_sync(sc->dmatag, + sc->aauring[descnb - 1].map, BUS_DMASYNC_PREWRITE); } continue; @@ -241,15 +241,15 @@ aau_bzero(void *dst, int len, int flags) if (tmplen > 0) { desc->next_desc = sc->aauring[descnb + 1]. phys_addr; - bus_dmamap_sync(sc->dmatag, - sc->aauring[descnb].map, + bus_dmamap_sync(sc->dmatag, + sc->aauring[descnb].map, BUS_DMASYNC_PREWRITE); desc = sc->aauring[descnb + 1].desc; descnb++; } else { desc->next_desc = 0; - bus_dmamap_sync(sc->dmatag, - sc->aauring[descnb].map, + bus_dmamap_sync(sc->dmatag, + sc->aauring[descnb].map, BUS_DMASYNC_PREWRITE); } Modified: head/sys/arm/xscale/i80321/i80321_dma.c ============================================================================== --- head/sys/arm/xscale/i80321/i80321_dma.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/i80321_dma.c Wed Jun 13 04:38:09 2012 (r236987) @@ -115,13 +115,13 @@ i80321_dma_attach(device_t dev) mtx_init(&softc->mtx, "DMA engine mtx", NULL, MTX_SPIN); softc->sc_st = sc->sc_st; if (bus_space_subregion(softc->sc_st, sc->sc_sh, unit == 0 ? - VERDE_DMA_BASE0 : VERDE_DMA_BASE1, VERDE_DMA_SIZE, + VERDE_DMA_BASE0 : VERDE_DMA_BASE1, VERDE_DMA_SIZE, &softc->sc_dma_sh) != 0) panic("%s: unable to subregion DMA registers", device_get_name(dev)); if (bus_dma_tag_create(NULL, sizeof(i80321_dmadesc_t), - 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, - DMA_RING_SIZE * sizeof(i80321_dmadesc_t), 1, + 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + DMA_RING_SIZE * sizeof(i80321_dmadesc_t), 1, sizeof(i80321_dmadesc_t), BUS_DMA_ALLOCNOW, busdma_lock_mutex, &Giant, &softc->dmatag)) panic("Couldn't create a dma tag"); @@ -131,7 +131,7 @@ i80321_dma_attach(device_t dev) panic("Couldn't alloc dma memory"); for (int i = 0; i < DMA_RING_SIZE; i++) { if (i > 0) - if (bus_dmamap_create(softc->dmatag, 0, + if (bus_dmamap_create(softc->dmatag, 0, &softc->dmaring[i].map)) panic("Couldn't alloc dmamap"); softc->dmaring[i].desc = &dmadescs[i]; @@ -213,11 +213,11 @@ dma_memcpy(void *dst, void *src, int len desc->local_addr = (vm_paddr_t)dst; desc->count = len; desc->descr_ctrl = 1 << 6; /* Local memory to local memory. */ - bus_dmamap_sync(sc->dmatag, - sc->dmaring[0].map, + bus_dmamap_sync(sc->dmatag, + sc->dmaring[0].map, BUS_DMASYNC_PREWRITE); } else { - if (!virt_addr_is_valid(dst, len, 1, !(flags & DST_IS_USER)) || + if (!virt_addr_is_valid(dst, len, 1, !(flags & DST_IS_USER)) || !virt_addr_is_valid(src, len, 0, !(flags & SRC_IS_USER))) { mtx_lock_spin(&sc->mtx); sc->flags &= ~BUSY; @@ -275,8 +275,8 @@ dma_memcpy(void *dst, void *src, int len if (tmplen <= 0 && descnb > 0) { sc->dmaring[descnb - 1].desc->next_desc = 0; - bus_dmamap_sync(sc->dmatag, - sc->dmaring[descnb - 1].map, + bus_dmamap_sync(sc->dmatag, + sc->dmaring[descnb - 1].map, BUS_DMASYNC_PREWRITE); } continue; @@ -301,8 +301,8 @@ dma_memcpy(void *dst, void *src, int len if (tmplen > 0) { desc->next_desc = sc->dmaring[descnb + 1]. phys_addr; - bus_dmamap_sync(sc->dmatag, - sc->dmaring[descnb].map, + bus_dmamap_sync(sc->dmatag, + sc->dmaring[descnb].map, BUS_DMASYNC_PREWRITE); desc = sc->dmaring[descnb + 1].desc; descnb++; Modified: head/sys/arm/xscale/i80321/i80321_intr.h ============================================================================== --- head/sys/arm/xscale/i80321/i80321_intr.h Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/i80321_intr.h Wed Jun 13 04:38:09 2012 (r236987) @@ -33,7 +33,7 @@ * 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$ * */ Modified: head/sys/arm/xscale/i80321/i80321_pci.c ============================================================================== --- head/sys/arm/xscale/i80321/i80321_pci.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/i80321_pci.c Wed Jun 13 04:38:09 2012 (r236987) @@ -79,7 +79,7 @@ static int i80321_pci_attach(device_t dev) { - uint32_t busno; + uint32_t busno; struct i80321_pci_softc *sc = device_get_softc(dev); sc->sc_st = i80321_softc->sc_st; @@ -100,16 +100,16 @@ i80321_pci_attach(device_t dev) sc->sc_io_rman.rm_type = RMAN_ARRAY; sc->sc_io_rman.rm_descr = "I80321 PCI I/O Ports"; if (rman_init(&sc->sc_io_rman) != 0 || - rman_manage_region(&sc->sc_io_rman, - sc->sc_io, - sc->sc_io + + rman_manage_region(&sc->sc_io_rman, + sc->sc_io, + sc->sc_io + VERDE_OUT_XLATE_IO_WIN_SIZE) != 0) { panic("i80321_pci_probe: failed to set up I/O rman"); } sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "I80321 PCI Memory"; if (rman_init(&sc->sc_mem_rman) != 0 || - rman_manage_region(&sc->sc_mem_rman, + rman_manage_region(&sc->sc_mem_rman, 0, VERDE_OUT_XLATE_MEM_WIN_SIZE) != 0) { panic("i80321_pci_probe: failed to set up memory rman"); } @@ -325,7 +325,7 @@ i80321_pci_alloc_resource(device_t bus, rman_release_resource(rv); return (NULL); } - } + } } return (rv); } @@ -340,7 +340,7 @@ i80321_pci_activate_resource(device_t bu if (type == SYS_RES_MEMORY) { error = bus_space_map(rman_get_bustag(r), rman_get_bushandle(r), rman_get_size(r), 0, &p); - if (error) + if (error) return (error); rman_set_bushandle(r, p); @@ -350,8 +350,8 @@ i80321_pci_activate_resource(device_t bu static int i80321_pci_setup_intr(device_t dev, device_t child, - struct resource *ires, int flags, driver_filter_t *filt, - driver_intr_t *intr, void *arg, void **cookiep) + struct resource *ires, int flags, driver_filter_t *filt, + driver_intr_t *intr, void *arg, void **cookiep) { return (BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, filt, intr, arg, cookiep)); Modified: head/sys/arm/xscale/i80321/i80321_space.c ============================================================================== --- head/sys/arm/xscale/i80321/i80321_space.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/i80321_space.c Wed Jun 13 04:38:09 2012 (r236987) @@ -279,7 +279,7 @@ i80321_io_bs_alloc(void *t, bus_addr_t r panic("i80321_io_bs_alloc(): not implemented"); } -void +void i80321_io_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) { @@ -299,7 +299,7 @@ i80321_mem_bs_map(void *t, bus_addr_t bp endpa = round_page(bpa + size); *bshp = (vm_offset_t)pmap_mapdev(pa, endpa - pa); - + return (0); } @@ -324,7 +324,7 @@ i80321_mem_bs_alloc(void *t, bus_addr_t panic("i80321_mem_bs_alloc(): not implemented"); } -void +void i80321_mem_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) { Modified: head/sys/arm/xscale/i80321/i80321_timer.c ============================================================================== --- head/sys/arm/xscale/i80321/i80321_timer.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/i80321_timer.c Wed Jun 13 04:38:09 2012 (r236987) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef CPU_XSCALE_81342 -#define ICU_INT_TIMER0 (8) /* XXX: Can't include i81342reg.h because +#define ICU_INT_TIMER0 (8) /* XXX: Can't include i81342reg.h because definitions overrides the ones from i80321reg.h */ #endif @@ -79,7 +79,7 @@ static unsigned i80321_timer_get_timecou static uint32_t counts_per_hz; -#if defined(XSCALE_DISABLE_CCNT) || defined(CPU_XSCALE_81342) +#if defined(XSCALE_DISABLE_CCNT) || defined(CPU_XSCALE_81342) static uint32_t offset; static uint32_t last = -1; #endif @@ -383,17 +383,17 @@ cpu_initclocks(void) oldirqstate = disable_interrupts(I32_bit); - irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, + irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, #ifdef CPU_XSCALE_81342 ICU_INT_TIMER0, ICU_INT_TIMER0, #else - ICU_INT_TMR0, ICU_INT_TMR0, + ICU_INT_TMR0, ICU_INT_TMR0, #endif 1, RF_ACTIVE); if (!irq) panic("Unable to setup the clock irq handler.\n"); else - bus_setup_intr(dev, irq, INTR_TYPE_CLK, clockhandler, NULL, + bus_setup_intr(dev, irq, INTR_TYPE_CLK, clockhandler, NULL, NULL, &ihl); tmr0_write(0); /* stop timer */ tisr_write(TISR_TMR0); /* clear interrupt */ Modified: head/sys/arm/xscale/i80321/i80321reg.h ============================================================================== --- head/sys/arm/xscale/i80321/i80321reg.h Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/i80321reg.h Wed Jun 13 04:38:09 2012 (r236987) @@ -38,8 +38,8 @@ * */ -#ifndef _ARM_XSCALE_I80321REG_H_ -#define _ARM_XSCALE_I80321REG_H_ +#ifndef _ARM_XSCALE_I80321REG_H_ +#define _ARM_XSCALE_I80321REG_H_ /* * Register definitions for the Intel 80321 (``Verde'') I/O processor, @@ -102,7 +102,7 @@ #if defined(CPU_XSCALE_80321) #define VERDE_AAU_BASE 0x0800 #define VERDE_AAU_SIZE 0x0100 -#endif +#endif #define VERDE_I2C_BASE 0x1680 #define VERDE_I2C_BASE0 (VERDE_I2C_BASE + 0x00) Modified: head/sys/arm/xscale/i80321/iq31244_7seg.c ============================================================================== --- head/sys/arm/xscale/i80321/iq31244_7seg.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/iq31244_7seg.c Wed Jun 13 04:38:09 2012 (r236987) @@ -206,7 +206,7 @@ static const uint8_t digitmap[] = { SEG_D|SEG_E, }; -static uint8_t +static uint8_t iq80321_7seg_xlate(char c) { uint8_t rv; @@ -336,7 +336,7 @@ static const uint8_t snakemap[][2] = { static SYSCTL_NODE(_hw, OID_AUTO, sevenseg, CTLFLAG_RD, 0, "7 seg"); static int freq = 20; -SYSCTL_INT(_hw_sevenseg, OID_AUTO, freq, CTLFLAG_RW, &freq, 0, +SYSCTL_INT(_hw_sevenseg, OID_AUTO, freq, CTLFLAG_RW, &freq, 0, "7 Seg update frequency"); static void iq31244_7seg_snake(void) Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/iq31244_machdep.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/iq31244_machdep.c Wed Jun 13 04:38:09 2012 (r236987) @@ -40,7 +40,7 @@ * * Machine dependant functions for kernel setup * - * This file needs a lot of work. + * This file needs a lot of work. * * Created : 17/09/94 */ @@ -140,7 +140,7 @@ struct pv_addr minidataclean; #define IQ80321_OBIO_SIZE 0x00100000UL /* Static device mappings. */ static const struct pmap_devmap iq80321_devmap[] = { - /* + /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. */ @@ -148,7 +148,7 @@ static const struct pmap_devmap iq80321_ IQ80321_OBIO_BASE, IQ80321_OBIO_BASE, IQ80321_OBIO_SIZE, - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { @@ -158,7 +158,7 @@ static const struct pmap_devmap iq80321_ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - + { IQ80321_80321_VBASE, VERDE_PMMR_BASE, @@ -193,8 +193,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); @@ -223,7 +223,7 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_pa = freemempos + (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * L2_TABLE_SIZE_REAL; - kernel_pt_table[loop].pv_va = + kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa + 0x20000000; } } @@ -290,13 +290,13 @@ initarm(struct arm_boot_params *abp) (((uint32_t)(lastaddr) - KERNBASE - 0x200000) + L1_S_SIZE) & ~(L1_S_SIZE - 1), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); freemem_after = ((int)lastaddr + PAGE_SIZE) & ~(PAGE_SIZE - 1); - afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & ~(L1_S_SIZE + afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1)); for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { pmap_link_l2pt(l1pagetable, afterkern + i * 0x00100000, &kernel_pt_table[KERNEL_PT_AFKERNEL + i]); } - pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa, + pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); @@ -305,7 +305,7 @@ initarm(struct arm_boot_params *abp) arm_add_smallalloc_pages((void *)(freemem_after), (void*)(freemem_after + PAGE_SIZE), afterkern - (freemem_after + PAGE_SIZE), 0); - + } #endif @@ -337,7 +337,7 @@ initarm(struct arm_boot_params *abp) * of the stack memory. */ - + set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_ABT32_MODE, @@ -393,7 +393,7 @@ initarm(struct arm_boot_params *abp) dump_avail[2] = 0; dump_avail[3] = 0; - pmap_bootstrap(pmap_curmaxkvaddr, + pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: head/sys/arm/xscale/i80321/iq80321.c ============================================================================== --- head/sys/arm/xscale/i80321/iq80321.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/iq80321.c Wed Jun 13 04:38:09 2012 (r236987) @@ -324,7 +324,7 @@ arm_unmask_irq(uintptr_t nb) void cpu_reset() -{ +{ (void) disable_interrupts(I32_bit|F32_bit); *(__volatile uint32_t *)(IQ80321_80321_VBASE + VERDE_ATU_BASE + ATU_PCSR) = PCSR_RIB | PCSR_RPB; @@ -351,7 +351,7 @@ iq80321_alloc_resource(device_t dev, dev static int iq80321_setup_intr(device_t dev, device_t child, - struct resource *ires, int flags, driver_filter_t *filt, + struct resource *ires, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { int error; Modified: head/sys/arm/xscale/i80321/obio.c ============================================================================== --- head/sys/arm/xscale/i80321/obio.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i80321/obio.c Wed Jun 13 04:38:09 2012 (r236987) @@ -120,7 +120,7 @@ obio_alloc_resource(device_t bus, device rv = rman_reserve_resource(rm, start, end, count, flags, child); - if (rv == NULL) + if (rv == NULL) return (NULL); if (type == SYS_RES_IRQ) return (rv); Modified: head/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- head/sys/arm/xscale/i8134x/crb_machdep.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/crb_machdep.c Wed Jun 13 04:38:09 2012 (r236987) @@ -40,7 +40,7 @@ * * Machine dependant functions for kernel setup * - * This file needs a lot of work. + * This file needs a lot of work. * * Created : 17/09/94 */ @@ -162,7 +162,7 @@ static const struct pmap_devmap iq81342_ VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - { + { 0, 0, 0, @@ -189,8 +189,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); @@ -219,7 +219,7 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_pa = freemempos + (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * L2_TABLE_SIZE_REAL; - kernel_pt_table[loop].pv_va = + kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa + 0xc0000000; } } @@ -278,7 +278,7 @@ initarm(struct arm_boot_params *abp) (((uint32_t)(lastaddr) - KERNBASE - 0x200000) + L1_S_SIZE) & ~(L1_S_SIZE - 1), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); freemem_after = ((int)lastaddr + PAGE_SIZE) & ~(PAGE_SIZE - 1); - afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & ~(L1_S_SIZE + afterkern = round_page(((vm_offset_t)lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1)); for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { pmap_link_l2pt(l1pagetable, afterkern + i * 0x00100000, @@ -291,7 +291,7 @@ initarm(struct arm_boot_params *abp) arm_add_smallalloc_pages((void *)(freemem_after), (void*)(freemem_after + PAGE_SIZE), afterkern - (freemem_after + PAGE_SIZE), 0); - + } #endif @@ -319,7 +319,7 @@ initarm(struct arm_boot_params *abp) * of the stack memory. */ - + set_stackptr(PSR_IRQ32_MODE, irqstack.pv_va + IRQ_STACK_SIZE * PAGE_SIZE); set_stackptr(PSR_ABT32_MODE, @@ -365,7 +365,7 @@ initarm(struct arm_boot_params *abp) dump_avail[2] = 0; dump_avail[3] = 0; - pmap_bootstrap(pmap_curmaxkvaddr, + pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: head/sys/arm/xscale/i8134x/i81342.c ============================================================================== --- head/sys/arm/xscale/i8134x/i81342.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/i81342.c Wed Jun 13 04:38:09 2012 (r236987) @@ -425,8 +425,8 @@ i81342_alloc_resource(device_t dev, devi } static int -i81342_setup_intr(device_t dev, device_t child, struct resource *ires, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, +i81342_setup_intr(device_t dev, device_t child, struct resource *ires, + int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { int error; Modified: head/sys/arm/xscale/i8134x/i81342_mcu.c ============================================================================== --- head/sys/arm/xscale/i8134x/i81342_mcu.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/i81342_mcu.c Wed Jun 13 04:38:09 2012 (r236987) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include void -i81342_sdram_bounds(bus_space_tag_t bt, bus_space_handle_t bh, +i81342_sdram_bounds(bus_space_tag_t bt, bus_space_handle_t bh, vm_paddr_t *start, vm_size_t *size) { uint32_t reg; Modified: head/sys/arm/xscale/i8134x/i81342_pci.c ============================================================================== --- head/sys/arm/xscale/i8134x/i81342_pci.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/i81342_pci.c Wed Jun 13 04:38:09 2012 (r236987) @@ -180,7 +180,7 @@ i81342_pci_attach(device_t dev) sc->sc_io_rman.rm_type = RMAN_ARRAY; sc->sc_io_rman.rm_descr = "I81342 PCI I/O Ports"; if (rman_init(&sc->sc_io_rman) != 0 || - rman_manage_region(&sc->sc_io_rman, + rman_manage_region(&sc->sc_io_rman, sc->sc_is_atux ? IOP34X_PCIX_OIOBAR_VADDR : IOP34X_PCIE_OIOBAR_VADDR, (sc->sc_is_atux ? IOP34X_PCIX_OIOBAR_VADDR : @@ -190,7 +190,7 @@ i81342_pci_attach(device_t dev) sc->sc_mem_rman.rm_type = RMAN_ARRAY; sc->sc_mem_rman.rm_descr = "I81342 PCI Memory"; if (rman_init(&sc->sc_mem_rman) != 0 || - rman_manage_region(&sc->sc_mem_rman, + rman_manage_region(&sc->sc_mem_rman, 0, 0xffffffff) != 0) { panic("i81342_pci_attach: failed to set up memory rman"); } @@ -198,12 +198,12 @@ i81342_pci_attach(device_t dev) sc->sc_irq_rman.rm_descr = "i81342 PCI IRQs"; if (sc->sc_is_atux) { if (rman_init(&sc->sc_irq_rman) != 0 || - rman_manage_region(&sc->sc_irq_rman, ICU_INT_XINT0, + rman_manage_region(&sc->sc_irq_rman, ICU_INT_XINT0, ICU_INT_XINT3) != 0) panic("i83142_pci_attach: failed to set up IRQ rman"); } else { if (rman_init(&sc->sc_irq_rman) != 0 || - rman_manage_region(&sc->sc_irq_rman, ICU_INT_ATUE_MA, + rman_manage_region(&sc->sc_irq_rman, ICU_INT_ATUE_MA, ICU_INT_ATUE_MD) != 0) panic("i81342_pci_attach: failed to set up IRQ rman"); @@ -242,7 +242,7 @@ i81342_pci_conf_setup(struct i81342_pci_ *addr = (1 << (slot + 16)) | (slot << 11) | (func << 8) | reg; else - *addr = (bus << 16) | (slot << 11) | (func << 11) | + *addr = (bus << 16) | (slot << 11) | (func << 11) | reg | 1; } else { *addr = (bus << 24) | (slot << 19) | (func << 16) | reg; @@ -297,7 +297,7 @@ i81342_pci_read_config(device_t dev, u_i } static void -i81342_pci_write_config(device_t dev, u_int bus, u_int slot, u_int func, +i81342_pci_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg, u_int32_t data, int bytes) { struct i81342_pci_softc *sc = device_get_softc(dev); @@ -372,7 +372,7 @@ i81342_pci_alloc_resource(device_t bus, rman_release_resource(rv); return (NULL); } - } + } } return (rv); Modified: head/sys/arm/xscale/i8134x/i81342_space.c ============================================================================== --- head/sys/arm/xscale/i8134x/i81342_space.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/i81342_space.c Wed Jun 13 04:38:09 2012 (r236987) @@ -260,7 +260,7 @@ i81342_io_bs_alloc(void *t, bus_addr_t r panic("i81342_io_bs_alloc(): not implemented"); } -void +void i81342_io_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) { @@ -337,7 +337,7 @@ i81342_mem_bs_alloc(void *t, bus_addr_t panic("i81342_mem_bs_alloc(): not implemented"); } -void +void i81342_mem_bs_free(void *t, bus_space_handle_t bsh, bus_size_t size) { Modified: head/sys/arm/xscale/i8134x/i81342reg.h ============================================================================== --- head/sys/arm/xscale/i8134x/i81342reg.h Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/i81342reg.h Wed Jun 13 04:38:09 2012 (r236987) @@ -29,7 +29,7 @@ #ifndef I83142_REG_H_ #define I83142_REG_H_ /* Physical Memory Map */ -/* +/* * 0x000000000 - 0x07FFFFFFF SDRAM * 0x090100000 - 0x0901FFFFF ATUe Outbound IO Window * 0x0F0000000 - 0x0F1FFFFFF Flash @@ -62,7 +62,7 @@ #define IOP34X_ADMA_IE (1 << 0) /* Interrupt enable */ #define IOP34X_ADMA_TR (1 << 1) /* Transfert Direction */ -/* +/* * Source Destination * 00 Host I/O Interface Local Memory * 01 Local Memory Host I/O Interface Modified: head/sys/arm/xscale/i8134x/iq81342_7seg.c ============================================================================== --- head/sys/arm/xscale/i8134x/iq81342_7seg.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/iq81342_7seg.c Wed Jun 13 04:38:09 2012 (r236987) @@ -207,7 +207,7 @@ static const uint8_t digitmap[] = { ~(SEG_D|SEG_E), }; -static uint8_t +static uint8_t iq81342_7seg_xlate(char c) { uint8_t rv; @@ -337,7 +337,7 @@ static const uint8_t snakemap[][2] = { static SYSCTL_NODE(_hw, OID_AUTO, sevenseg, CTLFLAG_RD, 0, "7 seg"); static int freq = 20; -SYSCTL_INT(_hw_sevenseg, OID_AUTO, freq, CTLFLAG_RW, &freq, 0, +SYSCTL_INT(_hw_sevenseg, OID_AUTO, freq, CTLFLAG_RW, &freq, 0, "7 Seg update frequency"); static void iq81342_7seg_snake(void) Modified: head/sys/arm/xscale/i8134x/obio.c ============================================================================== --- head/sys/arm/xscale/i8134x/obio.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/obio.c Wed Jun 13 04:38:09 2012 (r236987) @@ -127,7 +127,7 @@ obio_alloc_resource(device_t bus, device rv = rman_reserve_resource(rm, start, end, count, flags, child); - if (rv == NULL) + if (rv == NULL) return (NULL); if (type == SYS_RES_IRQ) return (rv); Modified: head/sys/arm/xscale/i8134x/uart_cpu_i81342.c ============================================================================== --- head/sys/arm/xscale/i8134x/uart_cpu_i81342.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/i8134x/uart_cpu_i81342.c Wed Jun 13 04:38:09 2012 (r236987) @@ -55,7 +55,7 @@ uart_cpu_getdev(int devtype, struct uart di->ops = uart_getops(&uart_ns8250_class); di->bas.chan = 0; di->bas.bst = &obio_bs_tag; - di->bas.regshft = 2; + di->bas.regshft = 2; di->bas.rclk = 33334000; di->baudrate = 115200; di->databits = 8; Modified: head/sys/arm/xscale/ixp425/avila_ata.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_ata.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/ixp425/avila_ata.c Wed Jun 13 04:38:09 2012 (r236987) @@ -304,7 +304,7 @@ ata_avila_release_resource(device_t dev, } static int -ata_avila_setup_intr(device_t dev, device_t child, struct resource *irq, +ata_avila_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filt, driver_intr_t *function, void *argument, void **cookiep) { Modified: head/sys/arm/xscale/ixp425/avila_gpio.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_gpio.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/ixp425/avila_gpio.c Wed Jun 13 04:38:09 2012 (r236987) @@ -102,7 +102,7 @@ static struct avila_gpio_pin avila_gpio_ /* * Helpers */ -static void avila_gpio_pin_configure(struct avila_gpio_softc *sc, +static void avila_gpio_pin_configure(struct avila_gpio_softc *sc, struct gpio_pin *pin, uint32_t flags); static int avila_gpio_pin_flags(struct avila_gpio_softc *sc, uint32_t pin); Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Wed Jun 13 04:38:09 2012 (r236987) @@ -40,7 +40,7 @@ * * Machine dependant functions for kernel setup * - * This file needs a lot of work. + * This file needs a lot of work. * * Created : 17/09/94 */ @@ -238,8 +238,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize; + lastaddr = parse_boot_param(abp); set_cpufuncs(); /* NB: sets cputype */ - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); @@ -283,7 +283,7 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_pa = freemempos + (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * L2_TABLE_SIZE_REAL; - kernel_pt_table[loop].pv_va = + kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa + (KERNVIRTADDR - KERNPHYSADDR); } @@ -364,7 +364,7 @@ initarm(struct arm_boot_params *abp) pmap_link_l2pt(l1pagetable, afterkern + i * 0x00100000, &kernel_pt_table[KERNEL_PT_AFKERNEL + i]); } - pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa, + pmap_map_entry(l1pagetable, afterkern, minidataclean.pv_pa, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); #ifdef ARM_USE_SMALL_ALLOC @@ -372,7 +372,7 @@ initarm(struct arm_boot_params *abp) arm_add_smallalloc_pages((void *)(freemem_after), (void*)(freemem_after + PAGE_SIZE), afterkern - (freemem_after + PAGE_SIZE), 0); - + } #endif Modified: head/sys/arm/xscale/ixp425/cambria_exp_space.c ============================================================================== --- head/sys/arm/xscale/ixp425/cambria_exp_space.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/ixp425/cambria_exp_space.c Wed Jun 13 04:38:09 2012 (r236987) @@ -249,7 +249,7 @@ cambria_exp_bus_init(struct ixp425_softc cs3 = EXP_BUS_READ_4(sc, EXP_TIMING_CS3_OFFSET); /* XXX force slowest possible timings and byte mode */ EXP_BUS_WRITE_4(sc, EXP_TIMING_CS3_OFFSET, - cs3 | (EXP_T1|EXP_T2|EXP_T3|EXP_T4|EXP_T5) | + cs3 | (EXP_T1|EXP_T2|EXP_T3|EXP_T4|EXP_T5) | EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); /* XXX force GPIO 3+4 for GPS+RS485 uarts */ Modified: head/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- head/sys/arm/xscale/ixp425/if_npe.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/ixp425/if_npe.c Wed Jun 13 04:38:09 2012 (r236987) @@ -89,8 +89,8 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" -/* - * XXX: For the main bus dma tag. Can go away if the new method to get the +/* + * XXX: For the main bus dma tag. Can go away if the new method to get the * dma tag from the parent got MFC'd into RELENG_6. */ extern struct ixp425_softc *ixp425_softc; @@ -302,7 +302,7 @@ npe_probe(device_t dev) int unit = device_get_unit(dev); int npeid; - if (unit > 2 || + if (unit > 2 || (ixp4xx_read_feature_bits() & (unit == 0 ? EXP_FCTRL_ETH0 : EXP_FCTRL_ETH1)) == 0) return EINVAL; @@ -496,7 +496,7 @@ npe_dma_setup(struct npe_softc *sc, stru } /* DMA tag and map for the NPE buffers */ - error = bus_dma_tag_create(ixp425_softc->sc_dmat, sizeof(uint32_t), 0, + error = bus_dma_tag_create(ixp425_softc->sc_dmat, sizeof(uint32_t), 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, nbuf * sizeof(struct npehwbuf), 1, nbuf * sizeof(struct npehwbuf), 0, @@ -1445,7 +1445,7 @@ npestop(struct npe_softc *sc) /* * The MAC core rx/tx disable may leave the MAC hardware in an - * unpredictable state. A hw reset is executed before resetting + * unpredictable state. A hw reset is executed before resetting * all the MAC parameters to a known value. */ WR4(sc, NPE_MAC_CORE_CNTRL, NPE_CORE_RESET); Modified: head/sys/arm/xscale/ixp425/if_npereg.h ============================================================================== --- head/sys/arm/xscale/ixp425/if_npereg.h Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/ixp425/if_npereg.h Wed Jun 13 04:38:09 2012 (r236987) @@ -32,7 +32,7 @@ /* * Copyright (c) 2001-2005, Intel Corporation. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -44,8 +44,8 @@ * 3. Neither the name of the Intel Corporation nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * - * + * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 @@ -253,19 +253,19 @@ struct npestats { /* NB: shorthands for mii bus mdio routines */ #define NPE_MAC_MDIO_CMD NPE_MAC_MDIO_CMD_1 #define NPE_MAC_MDIO_STS NPE_MAC_MDIO_STS_1 - + #define NPE_MII_GO (1<<31) #define NPE_MII_WRITE (1<<26) -#define NPE_MII_TIMEOUT_10TH_SECS 5 +#define NPE_MII_TIMEOUT_10TH_SECS 5 #define NPE_MII_10TH_SEC_IN_MILLIS 100 #define NPE_MII_READ_FAIL (1<<31) - + #define NPE_MII_PHY_DEF_DELAY 300 /* max delay before link up, etc. */ #define NPE_MII_PHY_NO_DELAY 0x0 /* do not delay */ #define NPE_MII_PHY_NULL 0xff /* PHY is not present */ #define NPE_MII_PHY_DEF_ADDR 0x0 /* default PHY's logical address */ -/* Register definition */ +/* Register definition */ #define NPE_MII_CTRL_REG 0x0 /* Control Register */ #define NPE_MII_STAT_REG 0x1 /* Status Register */ #define NPE_MII_PHY_ID1_REG 0x2 /* PHY identifier 1 Register */ Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Wed Jun 13 03:41:42 2012 (r236986) +++ head/sys/arm/xscale/ixp425/ixp425.c Wed Jun 13 04:38:09 2012 (r236987) @@ -177,7 +177,7 @@ ixp425_set_gpio(struct ixp425_softc *sc, gpiotr | GPIO_TYPE(pin, type)); /* configure gpio line as an input */ - GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOER, + GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOER, GPIO_CONF_READ_4(sc, IXP425_GPIO_GPOER) | (1<sc_dmat)) panic("%s: failed to create dma tag", __func__); @@ -534,7 +534,7 @@ ixp425_alloc_resource(device_t dev, devi device_printf(child, "%s: assign 0x%lx:0x%lx%s\n", __func__, start, end - start, - vtrans->isa4x ? " A4X" : + vtrans->isa4x ? " A4X" : vtrans->isslow ? " SLOW" : ""); } } else @@ -602,7 +602,7 @@ ixp425_activate_resource(device_t dev, d static int ixp425_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) + struct resource *r) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 04:40:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 56D07106566C; Wed, 13 Jun 2012 04:40:30 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F8688FC15; Wed, 13 Jun 2012 04:40:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D4eUo7095854; Wed, 13 Jun 2012 04:40:30 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D4eT9E095833; Wed, 13 Jun 2012 04:40:29 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206130440.q5D4eT9E095833@svn.freebsd.org> From: Warner Losh Date: Wed, 13 Jun 2012 04:40:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236988 - head/sys/arm/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 04:40:30 -0000 Author: imp Date: Wed Jun 13 04:40:29 2012 New Revision: 236988 URL: http://svn.freebsd.org/changeset/base/236988 Log: Strip trailing whitespace. Modified: head/sys/arm/conf/AVILA head/sys/arm/conf/BWCT head/sys/arm/conf/CAMBRIA head/sys/arm/conf/CNS11XXNAS head/sys/arm/conf/CRB head/sys/arm/conf/EP80219 head/sys/arm/conf/GUMSTIX head/sys/arm/conf/GUMSTIX-QEMU head/sys/arm/conf/HL200 head/sys/arm/conf/HL201 head/sys/arm/conf/IQ31244 head/sys/arm/conf/KB920X head/sys/arm/conf/LN2410SBC head/sys/arm/conf/NSLU head/sys/arm/conf/QILA9G20 head/sys/arm/conf/QILA9G20.hints head/sys/arm/conf/SAM9G20EK head/sys/arm/conf/SAM9G20EK.hints head/sys/arm/conf/SIMICS Modified: head/sys/arm/conf/AVILA ============================================================================== --- head/sys/arm/conf/AVILA Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/AVILA Wed Jun 13 04:40:29 2012 (r236988) @@ -12,8 +12,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/BWCT ============================================================================== --- head/sys/arm/conf/BWCT Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/BWCT Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/CAMBRIA ============================================================================== --- head/sys/arm/conf/CAMBRIA Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/CAMBRIA Wed Jun 13 04:40:29 2012 (r236988) @@ -12,8 +12,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/CNS11XXNAS ============================================================================== --- head/sys/arm/conf/CNS11XXNAS Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/CNS11XXNAS Wed Jun 13 04:40:29 2012 (r236988) @@ -12,8 +12,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/CRB ============================================================================== --- head/sys/arm/conf/CRB Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/CRB Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/EP80219 ============================================================================== --- head/sys/arm/conf/EP80219 Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/EP80219 Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/GUMSTIX ============================================================================== --- head/sys/arm/conf/GUMSTIX Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/GUMSTIX Wed Jun 13 04:40:29 2012 (r236988) @@ -12,8 +12,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/GUMSTIX-QEMU ============================================================================== --- head/sys/arm/conf/GUMSTIX-QEMU Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/GUMSTIX-QEMU Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/HL200 ============================================================================== --- head/sys/arm/conf/HL200 Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/HL200 Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/HL201 ============================================================================== --- head/sys/arm/conf/HL201 Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/HL201 Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/IQ31244 ============================================================================== --- head/sys/arm/conf/IQ31244 Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/IQ31244 Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/KB920X ============================================================================== --- head/sys/arm/conf/KB920X Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/KB920X Wed Jun 13 04:40:29 2012 (r236988) @@ -12,8 +12,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/LN2410SBC ============================================================================== --- head/sys/arm/conf/LN2410SBC Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/LN2410SBC Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/NSLU ============================================================================== --- head/sys/arm/conf/NSLU Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/NSLU Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ Modified: head/sys/arm/conf/QILA9G20 ============================================================================== --- head/sys/arm/conf/QILA9G20 Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/QILA9G20 Wed Jun 13 04:40:29 2012 (r236988) @@ -1,5 +1,5 @@ -# Kernel configuration for Calao Syatems QIL-A9G20 development card -# http://www.calao-systems.com +# Kernel configuration for Calao Syatems QIL-A9G20 development card +# http://www.calao-systems.com # # For more information on this file, please read the handbook section on # Kernel Configuration Files: @@ -12,8 +12,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ @@ -93,11 +93,11 @@ option AT91_ATE_USE_RMII device at91_twi # TWI: Two Wire Interface (EEPROM) device at91_wdt # WDT: Watchdog timer -# NOTE: SPI DataFlash and mci/mmc/mmcsd have hardware +# NOTE: SPI DataFlash and mci/mmc/mmcsd have hardware # confilict on this card. Use one or the other. # see board_sam9g20ek.c -# SPI: Data Flash +# SPI: Data Flash #device at91_spi # SPI: #device spibus #device at45d # at45db642 and maybe others Modified: head/sys/arm/conf/QILA9G20.hints ============================================================================== --- head/sys/arm/conf/QILA9G20.hints Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/QILA9G20.hints Wed Jun 13 04:40:29 2012 (r236988) @@ -1,9 +1,9 @@ # $FreeBSD$ -# Kernel configuration hits for Calao Syatems QIL-A9G20 development card -# http://www.calao-systems.com +# Kernel configuration hits for Calao Syatems QIL-A9G20 development card +# http://www.calao-systems.com # STMicroelctrtronics M41T94 Real-Time Clock -# on SPI0 NPCS0 +# on SPI0 NPCS0 # STMicroelctrtronics M95640 8k x 8 EEPROM # on SPI0 NPCS1 Modified: head/sys/arm/conf/SAM9G20EK ============================================================================== --- head/sys/arm/conf/SAM9G20EK Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/SAM9G20EK Wed Jun 13 04:40:29 2012 (r236988) @@ -1,4 +1,4 @@ -# Kernel configuration for Atmel AT91SAM9G20EK Rev B. development card +# Kernel configuration for Atmel AT91SAM9G20EK Rev B. development card # # For more information on this file, please read the handbook section on # Kernel Configuration Files: @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ @@ -92,11 +92,11 @@ option AT91_ATE_USE_RMII device at91_twi # TWI: Two Wire Interface (EEPROM) device at91_wdt # WDT: Watchdog timer -# NOTE: SPI DataFlash and mci/mmc/mmcsd have hardware +# NOTE: SPI DataFlash and mci/mmc/mmcsd have hardware # confilict on this card. Use one or the other. # see board_sam9g20ek.c -# SPI: Data Flash +# SPI: Data Flash #device at91_spi # SPI: #device spibus #device at45d # at45db642 and maybe others Modified: head/sys/arm/conf/SAM9G20EK.hints ============================================================================== --- head/sys/arm/conf/SAM9G20EK.hints Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/SAM9G20EK.hints Wed Jun 13 04:40:29 2012 (r236988) @@ -1,7 +1,7 @@ # $FreeBSD$ # -# EEPROM +# EEPROM hint.icee.0.at="iicbus0" hint.icee.0.addr=0xa0 hint.icee.0.type=16 Modified: head/sys/arm/conf/SIMICS ============================================================================== --- head/sys/arm/conf/SIMICS Wed Jun 13 04:38:09 2012 (r236987) +++ head/sys/arm/conf/SIMICS Wed Jun 13 04:40:29 2012 (r236988) @@ -11,8 +11,8 @@ # latest information. # # An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # # $FreeBSD$ From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 04:52:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89C841065672; Wed, 13 Jun 2012 04:52:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 705578FC17; Wed, 13 Jun 2012 04:52:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D4qKmn096483; Wed, 13 Jun 2012 04:52:20 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D4qKnU096465; Wed, 13 Jun 2012 04:52:20 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206130452.q5D4qKnU096465@svn.freebsd.org> From: Warner Losh Date: Wed, 13 Jun 2012 04:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236989 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 04:52:20 -0000 Author: imp Date: Wed Jun 13 04:52:19 2012 New Revision: 236989 URL: http://svn.freebsd.org/changeset/base/236989 Log: Strip trailing whitespace before other changes. Modified: head/sys/arm/at91/at91.c head/sys/arm/at91/at91_mci.c head/sys/arm/at91/at91_pio_rm9200.h head/sys/arm/at91/at91_pitreg.h head/sys/arm/at91/at91_pmcvar.h head/sys/arm/at91/at91_reset.S head/sys/arm/at91/at91_ssc.c head/sys/arm/at91/at91_wdtreg.h head/sys/arm/at91/at91rm9200.c head/sys/arm/at91/at91rm92reg.h head/sys/arm/at91/at91sam9260reg.h head/sys/arm/at91/at91sam9g20.c head/sys/arm/at91/at91sam9g20reg.h head/sys/arm/at91/board_qila9g20.c head/sys/arm/at91/board_sam9g20ek.c head/sys/arm/at91/if_macb.c head/sys/arm/at91/uart_cpu_at91rm9200usart.c Modified: head/sys/arm/at91/at91.c ============================================================================== --- head/sys/arm/at91/at91.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91.c Wed Jun 13 04:52:19 2012 (r236989) @@ -72,7 +72,7 @@ at91_bs_map(void *t, bus_addr_t bpa, bus endpa = round_page(bpa + size); *bshp = (vm_offset_t)pmap_mapdev(pa, endpa - pa); - + return (0); } @@ -98,7 +98,7 @@ at91_bs_subregion(void *t, bus_space_han } static void -at91_barrier(void *t, bus_space_handle_t bsh, bus_size_t size, bus_size_t b, +at91_barrier(void *t, bus_space_handle_t bsh, bus_size_t size, bus_size_t b, int a) { } @@ -272,7 +272,7 @@ at91_attach(device_t dev) /* Our device list will be added automatically by the cpu device * e.g. at91rm9200.c when it is identified. To ensure that the - * CPU and PMC are attached first any other "identified" devices + * CPU and PMC are attached first any other "identified" devices * call BUS_ADD_CHILD(9) with an "order" of at least 2. */ bus_generic_probe(dev); @@ -357,8 +357,8 @@ at91_release_resource(device_t dev, devi static int at91_setup_intr(device_t dev, device_t child, - struct resource *ires, int flags, driver_filter_t *filt, - driver_intr_t *intr, void *arg, void **cookiep) + struct resource *ires, int flags, driver_filter_t *filt, + driver_intr_t *intr, void *arg, void **cookiep) { struct at91_softc *sc = device_get_softc(dev); int error; @@ -381,7 +381,7 @@ at91_teardown_intr(device_t dev, device_ { struct at91_softc *sc = device_get_softc(dev); - bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, + bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_IDCR, 1 << rman_get_start(res)); return (BUS_TEARDOWN_INTR(device_get_parent(dev), child, res, cookie)); } @@ -397,7 +397,7 @@ at91_activate_resource(device_t bus, dev if (type == SYS_RES_MEMORY) { error = bus_space_map(rman_get_bustag(r), rman_get_bushandle(r), rman_get_size(r), 0, &p); - if (error) + if (error) return (error); rman_set_bushandle(r, p); } @@ -432,7 +432,7 @@ void arm_mask_irq(uintptr_t nb) { - bus_space_write_4(at91_softc->sc_st, + bus_space_write_4(at91_softc->sc_st, at91_softc->sc_aic_sh, IC_IDCR, 1 << nb); } @@ -458,7 +458,7 @@ void arm_unmask_irq(uintptr_t nb) { - bus_space_write_4(at91_softc->sc_st, + bus_space_write_4(at91_softc->sc_st, at91_softc->sc_aic_sh, IC_IECR, 1 << nb); bus_space_write_4(at91_softc->sc_st, at91_softc->sc_aic_sh, IC_EOICR, 0); Modified: head/sys/arm/at91/at91_mci.c ============================================================================== --- head/sys/arm/at91/at91_mci.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91_mci.c Wed Jun 13 04:52:19 2012 (r236989) @@ -155,8 +155,8 @@ at91_mci_init(device_t dev) #ifndef AT91_MCI_SLOT_B WR4(sc, MCI_SDCR, 0); /* SLOT A, 1 bit bus */ #else - /* XXX Really should add second "unit" but nobody using using - * a two slot card that we know of. XXX */ + /* XXX Really should add second "unit" but nobody using using + * a two slot card that we know of. -- except they are... XXX */ WR4(sc, MCI_SDCR, 1); /* SLOT B, 1 bit bus */ #endif } Modified: head/sys/arm/at91/at91_pio_rm9200.h ============================================================================== --- head/sys/arm/at91/at91_pio_rm9200.h Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91_pio_rm9200.h Wed Jun 13 04:52:19 2012 (r236989) @@ -161,13 +161,13 @@ #define AT91C_PD1_ETX1 (AT91C_PIO_PD1) // Ethernet MAC Transmit Data 1 #define AT91C_PD10_PCK3 (AT91C_PIO_PD10) // PMC Programmable Clock Output 3 #define AT91C_PD10_TPS1 (AT91C_PIO_PD10) // ETM ARM9 pipeline status 1 -#define AT91C_PD11_ (AT91C_PIO_PD11) // +#define AT91C_PD11_ (AT91C_PIO_PD11) // #define AT91C_PD11_TPS2 (AT91C_PIO_PD11) // ETM ARM9 pipeline status 2 -#define AT91C_PD12_ (AT91C_PIO_PD12) // +#define AT91C_PD12_ (AT91C_PIO_PD12) // #define AT91C_PD12_TPK0 (AT91C_PIO_PD12) // ETM Trace Packet 0 -#define AT91C_PD13_ (AT91C_PIO_PD13) // +#define AT91C_PD13_ (AT91C_PIO_PD13) // #define AT91C_PD13_TPK1 (AT91C_PIO_PD13) // ETM Trace Packet 1 -#define AT91C_PD14_ (AT91C_PIO_PD14) // +#define AT91C_PD14_ (AT91C_PIO_PD14) // #define AT91C_PD14_TPK2 (AT91C_PIO_PD14) // ETM Trace Packet 2 #define AT91C_PD15_TD0 (AT91C_PIO_PD15) // SSC Transmit data #define AT91C_PD15_TPK3 (AT91C_PIO_PD15) // ETM Trace Packet 3 Modified: head/sys/arm/at91/at91_pitreg.h ============================================================================== --- head/sys/arm/at91/at91_pitreg.h Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91_pitreg.h Wed Jun 13 04:52:19 2012 (r236989) @@ -28,7 +28,7 @@ #ifndef ARM_AT91_AT91PITREG_H #define ARM_AT91_AT91PITREG_H -#define PIT_MR 0x0 +#define PIT_MR 0x0 #define PIT_SR 0x4 #define PIT_PIVR 0x8 #define PIT_PIIR 0xc Modified: head/sys/arm/at91/at91_pmcvar.h ============================================================================== --- head/sys/arm/at91/at91_pmcvar.h Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91_pmcvar.h Wed Jun 13 04:52:19 2012 (r236989) @@ -28,7 +28,7 @@ #ifndef ARM_AT91_AT91_PMCVAR_H #define ARM_AT91_AT91_PMCVAR_H -struct at91_pmc_clock +struct at91_pmc_clock { char *name; uint32_t hz; Modified: head/sys/arm/at91/at91_reset.S ============================================================================== --- head/sys/arm/at91/at91_reset.S Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91_reset.S Wed Jun 13 04:52:19 2012 (r236989) @@ -10,21 +10,21 @@ __FBSDID("$FreeBSD$"); #define RSTC_RCR (AT91SAM9G20_BASE + \ AT91SAM9G20_RSTC_BASE + RST_CR) -/* +/* * From AT91SAM9G20 Datasheet errata 44:3.5: * * When User Reset occurs durring SDRAM read acces, eh SDRAM clock is turned * off while data are ready to be read on the data bus. The SDRAM maintains - * the data until the clock restarts. - * + * the data until the clock restarts. + * * If the User reset is programed to assert a general reset, the data * maintained by the SDRAM leads to a data bus conflict and adversly affects * the boot memories connected to the EBI: * + NAND Flash boot functionality, if the system boots out of internal ROM. - * + NOR Flash boot, if the system boots on an external memory connected to + * + NOR Flash boot, if the system boots on an external memory connected to * the EBI CS0. * - * Assembly code is mandatory for the following sequnce as ARM + * Assembly code is mandatory for the following sequnce as ARM * instructions need to be piplined. * */ @@ -38,12 +38,12 @@ ENTRY(cpu_reset_sam9g20) /* Change Refresh to block all data access */ ldr r0, =SDRAM_TR - ldr r1, =1 + ldr r1, =1 str r1, [r0] /* Prepare power down command */ ldr r0, =SDRAM_LPR - ldr r1, =2 + ldr r1, =2 /* Prepare proc_reset and periph reset */ ldr r2, =RSTC_RCR Modified: head/sys/arm/at91/at91_ssc.c ============================================================================== --- head/sys/arm/at91/at91_ssc.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91_ssc.c Wed Jun 13 04:52:19 2012 (r236989) @@ -214,7 +214,7 @@ at91_ssc_intr(void *xsc) return; } -static int +static int at91_ssc_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { struct at91_ssc_softc *sc; Modified: head/sys/arm/at91/at91_wdtreg.h ============================================================================== --- head/sys/arm/at91/at91_wdtreg.h Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91_wdtreg.h Wed Jun 13 04:52:19 2012 (r236989) @@ -23,7 +23,7 @@ * SUCH DAMAGE. */ -/* +/* * $FreeBSD$ */ Modified: head/sys/arm/at91/at91rm9200.c ============================================================================== --- head/sys/arm/at91/at91rm9200.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91rm9200.c Wed Jun 13 04:52:19 2012 (r236989) @@ -164,7 +164,7 @@ at91_add_child(device_t dev, int prio, c bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1); if (irq2 != 0) bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1); - if (addr != 0 && addr < AT91RM92_BASE) + if (addr != 0 && addr < AT91RM92_BASE) addr += AT91RM92_BASE; if (addr != 0) bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size); @@ -189,7 +189,7 @@ at91_pll_outb(int freq) if (freq > 155000000) return (0x0000); - else + else return (0x8000); } @@ -241,7 +241,7 @@ at91_attach(device_t dev) at91sc->sc_irq_system = AT91RM92_IRQ_SYSTEM; for (i = 0; i < 32; i++) { - bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR + + bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR + i * 4, i); /* Priority. */ bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SMR + i * 4, Modified: head/sys/arm/at91/at91rm92reg.h ============================================================================== --- head/sys/arm/at91/at91rm92reg.h Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91rm92reg.h Wed Jun 13 04:52:19 2012 (r236989) @@ -34,9 +34,9 @@ #define RM9200_PLL_A_MIN_OUT_FREQ 80000000 /* 80 MHz */ #define RM9200_PLL_A_MAX_OUT_FREQ 180000000 /* 180 MHz */ #define RM9200_PLL_A_MUL_SHIFT 16 -#define RM9200_PLL_A_MUL_MASK 0x7FF +#define RM9200_PLL_A_MUL_MASK 0x7FF #define RM9200_PLL_A_DIV_SHIFT 0 -#define RM9200_PLL_A_DIV_MASK 0xFF +#define RM9200_PLL_A_DIV_MASK 0xFF /* * PLL B input frequency spec sheet says it must be between 1MHz and 32MHz, @@ -51,10 +51,11 @@ #define RM9200_PLL_B_MIN_OUT_FREQ 30000000 /* 30 MHz */ #define RM9200_PLL_B_MAX_OUT_FREQ 240000000 /* 240 MHz */ #define RM9200_PLL_B_MUL_SHIFT 16 -#define RM9200_PLL_B_MUL_MASK 0x7FF +#define RM9200_PLL_B_MUL_MASK 0x7FF #define RM9200_PLL_B_DIV_SHIFT 0 -#define RM9200_PLL_B_DIV_MASK 0xFF -/* +#define RM9200_PLL_B_DIV_MASK 0xFF + +/* * Memory map, from datasheet : * 0x00000000 - 0x0ffffffff : Internal Memories * 0x10000000 - 0x1ffffffff : Chip Select 0 @@ -112,7 +113,7 @@ /* IRQs : */ /* - * 0: AIC + * 0: AIC * 1: System peripheral (System timer, RTC, DBGU) * 2: PIO Controller A * 3: PIO Controller B Modified: head/sys/arm/at91/at91sam9260reg.h ============================================================================== --- head/sys/arm/at91/at91sam9260reg.h Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91sam9260reg.h Wed Jun 13 04:52:19 2012 (r236989) @@ -34,9 +34,9 @@ #define SAM9260_PLL_A_MIN_OUT_FREQ 80000000 /* 80 Mhz */ #define SAM9260_PLL_A_MAX_OUT_FREQ 240000000 /* 240 Mhz */ #define SAM9260_PLL_A_MUL_SHIFT 16 -#define SAM9260_PLL_A_MUL_MASK 0x3FF +#define SAM9260_PLL_A_MUL_MASK 0x3FF #define SAM9260_PLL_A_DIV_SHIFT 0 -#define SAM9260_PLL_A_DIV_MASK 0xFF +#define SAM9260_PLL_A_DIV_MASK 0xFF #define SAM9260_PLL_B_MIN_IN_FREQ 1000000 /* 1 Mhz */ #define SAM9260_PLL_B_MAX_IN_FREQ 5000000 /* 5 Mhz */ @@ -45,9 +45,9 @@ #define SAM9260_PLL_B_MUL_SHIFT 16 #define SAM9260_PLL_B_MUL_MASK 0x3FF #define SAM9260_PLL_B_DIV_SHIFT 0 -#define SAM9260_PLL_B_DIV_MASK 0xFF +#define SAM9260_PLL_B_DIV_MASK 0xFF -/* +/* * Memory map, from datasheet : * 0x00000000 - 0x0ffffffff : Internal Memories * 0x10000000 - 0x1ffffffff : Chip Select 0 @@ -73,7 +73,6 @@ #define AT91SAM9260_BASE 0xd0000000 - #define AT91SAM9260_EMAC_BASE 0xffc4000 #define AT91SAM9260_EMAC_SIZE 0x4000 @@ -156,7 +155,7 @@ #define AT91RM92_PMC_SIZE 0x100 /* IRQs : */ /* - * 0: AIC + * 0: AIC * 1: System peripheral (System timer, RTC, DBGU) * 2: PIO Controller A * 3: PIO Controller B Modified: head/sys/arm/at91/at91sam9g20.c ============================================================================== --- head/sys/arm/at91/at91sam9g20.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91sam9g20.c Wed Jun 13 04:52:19 2012 (r236989) @@ -157,7 +157,7 @@ at91_add_child(device_t dev, int prio, c bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1); if (irq2 != 0) bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1); - if (addr != 0 && addr < AT91SAM9G20_BASE) + if (addr != 0 && addr < AT91SAM9G20_BASE) addr += AT91SAM9G20_BASE; if (addr != 0) bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size); @@ -231,7 +231,7 @@ at91_attach(device_t dev) sc->sc_sh = at91sc->sc_sh; sc->dev = dev; - /* + /* * XXX These values work for the RM9200, SAM926[01], and SAM9G20 * will have to fix this when we want to support anything else. XXX */ @@ -252,7 +252,7 @@ at91_attach(device_t dev) at91sc->sc_irq_system = AT91SAM9G20_IRQ_SYSTEM; for (i = 0; i < 32; i++) { - bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR + + bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SVR + i * 4, i); /* Priority. */ bus_space_write_4(sc->sc_st, sc->sc_aic_sh, IC_SMR + i * 4, @@ -281,7 +281,7 @@ at91_attach(device_t dev) i = bus_space_read_4(sc->sc_st, sc->sc_matrix_sh, AT91SAM9G20_EBICSA); bus_space_write_4(sc->sc_st, sc->sc_matrix_sh, - AT91SAM9G20_EBICSA, + AT91SAM9G20_EBICSA, i | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); Modified: head/sys/arm/at91/at91sam9g20reg.h ============================================================================== --- head/sys/arm/at91/at91sam9g20reg.h Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/at91sam9g20reg.h Wed Jun 13 04:52:19 2012 (r236989) @@ -35,20 +35,20 @@ #define SAM9G20_PLL_A_MIN_OUT_FREQ 400000000 /* 400 Mhz */ #define SAM9G20_PLL_A_MAX_OUT_FREQ 800000000 /* 800 Mhz */ #define SAM9G20_PLL_A_MUL_SHIFT 16 -#define SAM9G20_PLL_A_MUL_MASK 0xFF +#define SAM9G20_PLL_A_MUL_MASK 0xFF #define SAM9G20_PLL_A_DIV_SHIFT 0 -#define SAM9G20_PLL_A_DIV_MASK 0xFF +#define SAM9G20_PLL_A_DIV_MASK 0xFF #define SAM9G20_PLL_B_MIN_IN_FREQ 2000000 /* 2 Mhz */ #define SAM9G20_PLL_B_MAX_IN_FREQ 32000000 /* 32 Mhz */ #define SAM9G20_PLL_B_MIN_OUT_FREQ 30000000 /* 30 Mhz */ #define SAM9G20_PLL_B_MAX_OUT_FREQ 100000000 /* 100 Mhz */ #define SAM9G20_PLL_B_MUL_SHIFT 16 -#define SAM9G20_PLL_B_MUL_MASK 0x3F +#define SAM9G20_PLL_B_MUL_MASK 0x3F #define SAM9G20_PLL_B_DIV_SHIFT 0 -#define SAM9G20_PLL_B_DIV_MASK 0xFF +#define SAM9G20_PLL_B_DIV_MASK 0xFF -/* +/* * Memory map, from datasheet : * 0x00000000 - 0x0ffffffff : Internal Memories * 0x10000000 - 0x1ffffffff : Chip Select 0 @@ -74,7 +74,6 @@ #define AT91SAM9G20_BASE 0xd0000000 - #define AT91SAM9G20_EMAC_BASE 0xffc4000 #define AT91SAM9G20_EMAC_SIZE 0x4000 @@ -157,7 +156,7 @@ #define AT91RM92_PMC_SIZE 0x100 /* IRQs : */ /* - * 0: AIC + * 0: AIC * 1: System peripheral (System timer, RTC, DBGU) * 2: PIO Controller A * 3: PIO Controller B Modified: head/sys/arm/at91/board_qila9g20.c ============================================================================== --- head/sys/arm/at91/board_qila9g20.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/board_qila9g20.c Wed Jun 13 04:52:19 2012 (r236989) @@ -24,7 +24,7 @@ */ /* Calao Systems QIL-9G20-Cxx - * http://www.calao-systems.com + * http://www.calao-systems.com */ #include Modified: head/sys/arm/at91/board_sam9g20ek.c ============================================================================== --- head/sys/arm/at91/board_sam9g20ek.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/board_sam9g20ek.c Wed Jun 13 04:52:19 2012 (r236989) @@ -23,9 +23,9 @@ * SUCH DAMAGE. */ -/* +/* * This board file can be used for both: - * Atmel SAM9G20-EK Development Card + * Atmel SAM9G20-EK Development Card */ #include @@ -69,7 +69,7 @@ board_init(void) at91_pio_use_periph_a(AT91SAM9G20_PIOA_BASE,AT91C_PA24_TWCK, 1); #if 1 - /* + /* * Turn off Clock to DataFlash, conflicts with MCI clock. */ at91_pio_use_gpio(AT91SAM9G20_PIOA_BASE,AT91C_PIO_PA2); Modified: head/sys/arm/at91/if_macb.c ============================================================================== --- head/sys/arm/at91/if_macb.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/if_macb.c Wed Jun 13 04:52:19 2012 (r236989) @@ -730,7 +730,7 @@ macb_rx(struct macb_softc *sc) m = sc->rx_desc[sc->rx_cons].buff; - bus_dmamap_sync(sc->dmatag_ring_rx, + bus_dmamap_sync(sc->dmatag_ring_rx, sc->rx_desc[sc->rx_cons].dmamap, BUS_DMASYNC_POSTREAD); if (macb_new_rxbuf(sc, sc->rx_cons) != 0) { ifp->if_iqdrops++; @@ -739,7 +739,7 @@ macb_rx(struct macb_softc *sc) do { rxdesc->flags = DATA_SIZE; MACB_DESC_INC(sc->rx_cons, MACB_MAX_RX_BUFFERS); - if ((rxdesc->flags & RD_EOF) != 0) + if ((rxdesc->flags & RD_EOF) != 0) break; rxdesc = &(sc->desc_rx[sc->rx_cons]); } while (sc->rx_cons != first); @@ -776,7 +776,7 @@ macb_rx(struct macb_softc *sc) if (nsegs > 1) { sc->macb_cdata.rxtail->m_len = (rxbytes - ((nsegs - 1) * DATA_SIZE)) + 2; - } + } m = sc->macb_cdata.rxhead; m->m_flags |= M_PKTHDR; @@ -1102,7 +1102,7 @@ set_filter(struct macb_softc *sc) int count; uint32_t multicast_filter[2]; - ifp = sc->ifp; + ifp = sc->ifp; config = read_4(sc, EMAC_NCFGR); @@ -1132,7 +1132,7 @@ set_filter(struct macb_softc *sc) if (ifma->ifma_addr->sa_family != AF_LINK) continue; count++; - set_mac_filter(multicast_filter, + set_mac_filter(multicast_filter, LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); } if (count) { @@ -1501,7 +1501,7 @@ macb_miibus_statchg(device_t dev) mii = device_get_softc(sc->miibus); - sc->flags &= ~MACB_FLAG_LINK; + sc->flags &= ~MACB_FLAG_LINK; config = read_4(sc, EMAC_NCFGR); Modified: head/sys/arm/at91/uart_cpu_at91rm9200usart.c ============================================================================== --- head/sys/arm/at91/uart_cpu_at91rm9200usart.c Wed Jun 13 04:40:29 2012 (r236988) +++ head/sys/arm/at91/uart_cpu_at91rm9200usart.c Wed Jun 13 04:52:19 2012 (r236989) @@ -69,7 +69,7 @@ uart_cpu_getdev(int devtype, struct uart di->ops = uart_getops(class); di->bas.chan = 0; di->bas.bst = &at91_bs_tag; - /* + /* * XXX: Not pretty, but will work because we map the needed addresses * early. */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 04:59:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C32EB1065692; Wed, 13 Jun 2012 04:59:01 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7021E8FC0A; Wed, 13 Jun 2012 04:59:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D4x1dO096819; Wed, 13 Jun 2012 04:59:01 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D4x198096802; Wed, 13 Jun 2012 04:59:01 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206130459.q5D4x198096802@svn.freebsd.org> From: Warner Losh Date: Wed, 13 Jun 2012 04:59:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236990 - in head/sys/arm: mv s3c2xx0 sa11x0 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 04:59:02 -0000 Author: imp Date: Wed Jun 13 04:59:00 2012 New Revision: 236990 URL: http://svn.freebsd.org/changeset/base/236990 Log: Trim trailing whitespace... Modified: head/sys/arm/mv/mv_machdep.c head/sys/arm/mv/mvwin.h head/sys/arm/s3c2xx0/s3c2410reg.h head/sys/arm/s3c2xx0/s3c2440reg.h head/sys/arm/s3c2xx0/s3c24x0.c head/sys/arm/s3c2xx0/s3c24x0_machdep.c head/sys/arm/s3c2xx0/s3c24x0reg.h head/sys/arm/sa11x0/assabet_machdep.c head/sys/arm/sa11x0/sa11x0.c head/sys/arm/sa11x0/sa11x0_gpioreg.h head/sys/arm/sa11x0/sa11x0_io_asm.S head/sys/arm/sa11x0/sa11x0_irq.S head/sys/arm/sa11x0/sa11x0_ost.c head/sys/arm/sa11x0/sa11x0_ostreg.h head/sys/arm/sa11x0/sa11x0_var.h head/sys/arm/sa11x0/uart_dev_sa1110.c Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/mv/mv_machdep.c Wed Jun 13 04:59:00 2012 (r236990) @@ -285,7 +285,7 @@ physmap_init(void) availmem_regions[i].mr_start + availmem_regions[i].mr_size, availmem_regions[i].mr_size); - /* + /* * We should not map the page at PA 0x0000000, the VM can't * handle it, as pmap_extract() == 0 means failure. */ Modified: head/sys/arm/mv/mvwin.h ============================================================================== --- head/sys/arm/mv/mvwin.h Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/mv/mvwin.h Wed Jun 13 04:59:00 2012 (r236990) @@ -46,7 +46,7 @@ #define MV_PCIE_IO_PHYS_BASE (MV_PHYS_BASE + MV_SIZE) #define MV_PCIE_IO_BASE MV_PCIE_IO_PHYS_BASE #define MV_PCIE_IO_SIZE (1024 * 1024) -#define MV_PCI_IO_PHYS_BASE (MV_PCIE_IO_PHYS_BASE + MV_PCIE_IO_SIZE) +#define MV_PCI_IO_PHYS_BASE (MV_PCIE_IO_PHYS_BASE + MV_PCIE_IO_SIZE) #define MV_PCI_IO_BASE MV_PCI_IO_PHYS_BASE #define MV_PCI_IO_SIZE (1024 * 1024) Modified: head/sys/arm/s3c2xx0/s3c2410reg.h ============================================================================== --- head/sys/arm/s3c2xx0/s3c2410reg.h Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/s3c2xx0/s3c2410reg.h Wed Jun 13 04:59:00 2012 (r236990) @@ -36,7 +36,7 @@ * Samsung S3C2410X processor is ARM920T based integrated CPU * * Reference: - * S3C2410X User's Manual + * S3C2410X User's Manual */ #ifndef _ARM_S3C2XX0_S3C2410REG_H_ #define _ARM_S3C2XX0_S3C2410REG_H_ Modified: head/sys/arm/s3c2xx0/s3c2440reg.h ============================================================================== --- head/sys/arm/s3c2xx0/s3c2440reg.h Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/s3c2xx0/s3c2440reg.h Wed Jun 13 04:59:00 2012 (r236990) @@ -30,7 +30,7 @@ * Samsung S3C2440X processor is ARM920T based integrated CPU * * Reference: - * S3C2440A/S3C2442B User's Manual + * S3C2440A/S3C2442B User's Manual */ #ifndef _ARM_S3C2XX0_S3C2440REG_H_ #define _ARM_S3C2XX0_S3C2440REG_H_ Modified: head/sys/arm/s3c2xx0/s3c24x0.c ============================================================================== --- head/sys/arm/s3c2xx0/s3c24x0.c Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/s3c2xx0/s3c24x0.c Wed Jun 13 04:59:00 2012 (r236990) @@ -283,7 +283,7 @@ s3c24x0_config_intr(device_t dev, int ir s3c2xx0_softc->sc_gpio_ioh, reg, value); return (0); -} +} static struct resource * s3c24x0_alloc_resource(device_t bus, device_t child, int type, int *rid, @@ -356,7 +356,7 @@ s3c24x0_alloc_resource(device_t bus, dev rman_release_resource(res); return (NULL); } - } + } break; } @@ -751,19 +751,19 @@ arm_mask_irq(uintptr_t irq) mask = bus_space_read_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK); mask |= (1 << irq); - bus_space_write_4(&s3c2xx0_bs_tag, + bus_space_write_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK, mask); } else if (irq < S3C24X0_EXTIRQ_MIN) { mask = bus_space_read_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK); mask |= (1 << (irq - S3C24X0_SUBIRQ_MIN)); - bus_space_write_4(&s3c2xx0_bs_tag, + bus_space_write_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask); } else { mask = bus_space_read_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_gpio_ioh, GPIO_EINTMASK); mask |= (1 << (irq - S3C24X0_EXTIRQ_MIN)); - bus_space_write_4(&s3c2xx0_bs_tag, + bus_space_write_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, GPIO_EINTMASK, mask); } } @@ -787,13 +787,13 @@ arm_unmask_irq(uintptr_t irq) mask = bus_space_read_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK); mask &= ~(1 << (irq - S3C24X0_SUBIRQ_MIN)); - bus_space_write_4(&s3c2xx0_bs_tag, + bus_space_write_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask); } else { mask = bus_space_read_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_gpio_ioh, GPIO_EINTMASK); mask &= ~(1 << (irq - S3C24X0_EXTIRQ_MIN)); - bus_space_write_4(&s3c2xx0_bs_tag, + bus_space_write_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, GPIO_EINTMASK, mask); } } Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c ============================================================================== --- head/sys/arm/s3c2xx0/s3c24x0_machdep.c Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c Wed Jun 13 04:59:00 2012 (r236990) @@ -38,7 +38,7 @@ * * Machine dependant functions for kernel setup * - * This file needs a lot of work. + * This file needs a lot of work. * * Created : 17/09/94 */ @@ -150,42 +150,42 @@ static const struct pmap_devmap s3c24x0_ _A(S3C24X0_CLKMAN_BASE), _A(S3C24X0_CLKMAN_PA_BASE), _S(S3C24X0_CLKMAN_SIZE), - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { _A(S3C24X0_GPIO_BASE), _A(S3C24X0_GPIO_PA_BASE), _S(S3C2410_GPIO_SIZE), - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { _A(S3C24X0_INTCTL_BASE), _A(S3C24X0_INTCTL_PA_BASE), _S(S3C24X0_INTCTL_SIZE), - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { _A(S3C24X0_TIMER_BASE), _A(S3C24X0_TIMER_PA_BASE), _S(S3C24X0_TIMER_SIZE), - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { _A(S3C24X0_UART0_BASE), _A(S3C24X0_UART0_PA_BASE), _S(S3C24X0_UART_PA_BASE(3) - S3C24X0_UART0_PA_BASE), - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { _A(S3C24X0_WDT_BASE), _A(S3C24X0_WDT_PA_BASE), _S(S3C24X0_WDT_SIZE), - VM_PROT_READ|VM_PROT_WRITE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, { @@ -281,7 +281,7 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_va = freemempos - (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * L2_TABLE_SIZE_REAL; - kernel_pt_table[loop].pv_pa = + kernel_pt_table[loop].pv_pa = kernel_pt_table[loop].pv_va - KERNVIRTADDR + KERNPHYSADDR; } @@ -315,7 +315,7 @@ initarm(struct arm_boot_params *abp) pmap_map_chunk(l1pagetable, KERNBASE, PHYSADDR, (((uint32_t)(lastaddr) - KERNBASE) + PAGE_SIZE) & ~(PAGE_SIZE - 1), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - afterkern = round_page((lastaddr + L1_S_SIZE) & ~(L1_S_SIZE + afterkern = round_page((lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1)); for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) { pmap_link_l2pt(l1pagetable, afterkern + i * L1_S_SIZE, Modified: head/sys/arm/s3c2xx0/s3c24x0reg.h ============================================================================== --- head/sys/arm/s3c2xx0/s3c24x0reg.h Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/s3c2xx0/s3c24x0reg.h Wed Jun 13 04:59:00 2012 (r236990) @@ -36,7 +36,7 @@ * Samsung S3C2410X/2400 processor is ARM920T based integrated CPU * * Reference: - * S3C2410X User's Manual + * S3C2410X User's Manual * S3C2400 User's Manual */ #ifndef _ARM_S3C2XX0_S3C24X0REG_H_ @@ -691,7 +691,7 @@ #define SPCON_CPOL (1<<2) #define SPCON_IDLELOW_RISING (0|0) #define SPCON_IDLELOW_FALLING (0|SPCON_CPHA) -#define SPCON_IDLEHIGH_FALLING (SPCON_CPOL|0) +#define SPCON_IDLEHIGH_FALLING (SPCON_CPOL|0) #define SPCON_IDLEHIGH_RISING (SPCON_CPOL|SPCON_CPHA) #define SPCON_MSTR (1<<3) #define SPCON_ENSCK (1<<4) Modified: head/sys/arm/sa11x0/assabet_machdep.c ============================================================================== --- head/sys/arm/sa11x0/assabet_machdep.c Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/assabet_machdep.c Wed Jun 13 04:59:00 2012 (r236990) @@ -40,7 +40,7 @@ * * Machine dependant functions for kernel setup * - * This file needs a lot of work. + * This file needs a lot of work. * * Created : 17/09/94 */ @@ -257,7 +257,7 @@ initarm(struct arm_boot_params *abp) kernel_pt_table[loop].pv_pa = freemempos + (loop % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) * L2_TABLE_SIZE_REAL; - kernel_pt_table[loop].pv_va = + kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa; } } @@ -343,7 +343,7 @@ initarm(struct arm_boot_params *abp) VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); /* Map the statically mapped devices. */ pmap_devmap_bootstrap(l1pagetable, assabet_devmap); - pmap_map_chunk(l1pagetable, sa1_cache_clean_addr, 0xf0000000, + pmap_map_chunk(l1pagetable, sa1_cache_clean_addr, 0xf0000000, CPU_SA110_CACHE_CLEAN_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); data_abort_handler_address = (u_int)data_abort_handler; Modified: head/sys/arm/sa11x0/sa11x0.c ============================================================================== --- head/sys/arm/sa11x0/sa11x0.c Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/sa11x0.c Wed Jun 13 04:59:00 2012 (r236990) @@ -88,12 +88,12 @@ struct sa11x0_softc *sa11x0_softc; /* Th static int sa1110_setup_intr(device_t dev, device_t child, - struct resource *ires, int flags, driver_filter_t *filt, + struct resource *ires, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { int saved_cpsr; - if (flags & INTR_TYPE_TTY) + if (flags & INTR_TYPE_TTY) rman_set_start(ires, 15); else if (flags & INTR_TYPE_CLK) { if (rman_get_start(ires) == 0) @@ -101,10 +101,10 @@ sa1110_setup_intr(device_t dev, device_t else rman_set_start(ires, 27); } - saved_cpsr = SetCPSR(I32_bit, I32_bit); + saved_cpsr = SetCPSR(I32_bit, I32_bit); SetCPSR(I32_bit, saved_cpsr & I32_bit); - BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, filt, + BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, filt, intr, arg, cookiep); return (0); } Modified: head/sys/arm/sa11x0/sa11x0_gpioreg.h ============================================================================== --- head/sys/arm/sa11x0/sa11x0_gpioreg.h Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/sa11x0_gpioreg.h Wed Jun 13 04:59:00 2012 (r236990) @@ -32,7 +32,7 @@ */ /* - * SA-11x0 GPIO Register + * SA-11x0 GPIO Register */ #define SAGPIO_NPORTS 8 Modified: head/sys/arm/sa11x0/sa11x0_io_asm.S ============================================================================== --- head/sys/arm/sa11x0/sa11x0_io_asm.S Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/sa11x0_io_asm.S Wed Jun 13 04:59:00 2012 (r236990) @@ -208,7 +208,7 @@ ENTRY(sa11x0_bs_rr_2) movle pc, lr sa11x0_bs_rr_2_loop: - ldrh r1, [r0], #0x0002 + ldrh r1, [r0], #0x0002 strh r1, [r3], #0x0002 subs r2, r2, #0x00000001 bgt sa11x0_bs_rr_2_loop @@ -222,7 +222,7 @@ sa11x0_bs_rr_2_loop: ENTRY(sa11x0_bs_wr_2) add r0, r1, r2 ldr r2, [sp, #0] - cmp r2, #0x00000000 + cmp r2, #0x00000000 movle pc, lr sa11x0_bs_wr_2_loop: Modified: head/sys/arm/sa11x0/sa11x0_irq.S ============================================================================== --- head/sys/arm/sa11x0/sa11x0_irq.S Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/sa11x0_irq.S Wed Jun 13 04:59:00 2012 (r236990) @@ -120,7 +120,7 @@ ENTRY(sa11x0_activateirqs) mov pc, lr .global _C_LABEL(intrnames), _C_LABEL(sintrnames) -_C_LABEL(intrnames): +_C_LABEL(intrnames): _C_LABEL(sintrnames): .int 0 Modified: head/sys/arm/sa11x0/sa11x0_ost.c ============================================================================== --- head/sys/arm/sa11x0/sa11x0_ost.c Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/sa11x0_ost.c Wed Jun 13 04:59:00 2012 (r236990) @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include @@ -127,7 +127,7 @@ saost_attach(device_t dev) saost_sc = sc; - if(bus_space_map(sa->sc_iot, sc->sc_baseaddr, 8, 0, + if(bus_space_map(sa->sc_iot, sc->sc_baseaddr, 8, 0, &sc->sc_ioh)) panic("%s: Cannot map registers", device_get_name(dev)); Modified: head/sys/arm/sa11x0/sa11x0_ostreg.h ============================================================================== --- head/sys/arm/sa11x0/sa11x0_ostreg.h Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/sa11x0_ostreg.h Wed Jun 13 04:59:00 2012 (r236990) @@ -32,7 +32,7 @@ */ /* - * SA-11x0 OS Timer Register + * SA-11x0 OS Timer Register */ /* OS Timer Match Register */ Modified: head/sys/arm/sa11x0/sa11x0_var.h ============================================================================== --- head/sys/arm/sa11x0/sa11x0_var.h Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/sa11x0_var.h Wed Jun 13 04:59:00 2012 (r236990) @@ -58,7 +58,7 @@ typedef void *sa11x0_chipset_tag_t; extern struct bus_space sa11x0_bs_tag; -void *sa11x0_intr_establish(sa11x0_chipset_tag_t, int, int, int, +void *sa11x0_intr_establish(sa11x0_chipset_tag_t, int, int, int, int (*)(void *), void *); void sa11x0_intr_disestablish(sa11x0_chipset_tag_t, void *); Modified: head/sys/arm/sa11x0/uart_dev_sa1110.c ============================================================================== --- head/sys/arm/sa11x0/uart_dev_sa1110.c Wed Jun 13 04:52:19 2012 (r236989) +++ head/sys/arm/sa11x0/uart_dev_sa1110.c Wed Jun 13 04:59:00 2012 (r236990) @@ -179,12 +179,12 @@ sa1110_bus_transmit(struct uart_softc *s while (!(uart_getreg(&sc->sc_bas, SACOM_CR3) & CR3_TIE)) uart_setreg(&sc->sc_bas, SACOM_CR3, - uart_getreg(&sc->sc_bas, SACOM_CR3) | CR3_TIE); + uart_getreg(&sc->sc_bas, SACOM_CR3) | CR3_TIE); #endif sc->sc_txbusy = 1; uart_setreg(&sc->sc_bas, SACOM_CR3, uart_getreg(&sc->sc_bas, SACOM_CR3) - | CR3_TIE); + | CR3_TIE); for (i = 0; i < sc->sc_txdatasz; i++) { while (!(uart_getreg(&sc->sc_bas, SACOM_SR1) & SR1_TNF)); @@ -252,7 +252,7 @@ sa1110_bus_ipend(struct uart_softc *sc) ipend |= SER_INT_RXREADY; mask &= ~CR3_RIE; } - uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | mask); + uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | mask); return (ipend); } static int From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 04:59:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43135106564A; Wed, 13 Jun 2012 04:59:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CBA68FC1B; Wed, 13 Jun 2012 04:59:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D4xuii096919; Wed, 13 Jun 2012 04:59:56 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D4xtLt096890; Wed, 13 Jun 2012 04:59:55 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206130459.q5D4xtLt096890@svn.freebsd.org> From: Warner Losh Date: Wed, 13 Jun 2012 04:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236991 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 04:59:56 -0000 Author: imp Date: Wed Jun 13 04:59:55 2012 New Revision: 236991 URL: http://svn.freebsd.org/changeset/base/236991 Log: Final whitespace trim. Modified: head/sys/arm/arm/bcopyinout_xscale.S head/sys/arm/arm/bootconfig.c head/sys/arm/arm/busdma_machdep.c head/sys/arm/arm/cpufunc.c head/sys/arm/arm/cpufunc_asm.S head/sys/arm/arm/cpufunc_asm_arm10.S head/sys/arm/arm/cpufunc_asm_arm11.S head/sys/arm/arm/cpufunc_asm_arm7tdmi.S head/sys/arm/arm/cpufunc_asm_arm8.S head/sys/arm/arm/cpufunc_asm_arm9.S head/sys/arm/arm/cpufunc_asm_armv4.S head/sys/arm/arm/cpufunc_asm_armv5.S head/sys/arm/arm/cpufunc_asm_sa1.S head/sys/arm/arm/cpufunc_asm_xscale.S head/sys/arm/arm/cpufunc_asm_xscale_c3.S head/sys/arm/arm/db_disasm.c head/sys/arm/arm/db_interface.c head/sys/arm/arm/db_trace.c head/sys/arm/arm/disassem.c head/sys/arm/arm/dump_machdep.c head/sys/arm/arm/elf_trampoline.c head/sys/arm/arm/exception.S head/sys/arm/arm/gdb_machdep.c head/sys/arm/arm/in_cksum.c head/sys/arm/arm/intr.c head/sys/arm/arm/irq_dispatch.S head/sys/arm/arm/machdep.c head/sys/arm/arm/mem.c head/sys/arm/arm/nexus.c head/sys/arm/arm/pmap.c head/sys/arm/arm/support.S head/sys/arm/arm/swtch.S head/sys/arm/arm/sys_machdep.c head/sys/arm/arm/trap.c head/sys/arm/arm/undefined.c head/sys/arm/arm/vectors.S head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/bcopyinout_xscale.S ============================================================================== --- head/sys/arm/arm/bcopyinout_xscale.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/bcopyinout_xscale.S Wed Jun 13 04:59:55 2012 (r236991) @@ -333,10 +333,10 @@ ENTRY(copyin) str r6, [r1], #0x04 str r7, [r1], #0x04 .Lcopyin_bad1: - subs r2, r2, #0x10 + subs r2, r2, #0x10 bge .Lcopyin_bad1_loop16 - adds r2, r2, #0x10 + adds r2, r2, #0x10 ldmeqfd sp!, {r4-r7} RETeq /* Return now if done */ subs r2, r2, #0x04 @@ -394,10 +394,10 @@ ENTRY(copyin) str r6, [r1], #0x04 str r7, [r1], #0x04 .Lcopyin_bad2: - subs r2, r2, #0x10 + subs r2, r2, #0x10 bge .Lcopyin_bad2_loop16 - adds r2, r2, #0x10 + adds r2, r2, #0x10 ldmeqfd sp!, {r4-r7} RETeq /* Return now if done */ subs r2, r2, #0x04 @@ -455,10 +455,10 @@ ENTRY(copyin) str r6, [r1], #0x04 str r7, [r1], #0x04 .Lcopyin_bad3: - subs r2, r2, #0x10 + subs r2, r2, #0x10 bge .Lcopyin_bad3_loop16 - adds r2, r2, #0x10 + adds r2, r2, #0x10 ldmeqfd sp!, {r4-r7} RETeq /* Return now if done */ subs r2, r2, #0x04 @@ -785,10 +785,10 @@ ENTRY(copyout) strt r6, [r1], #0x04 strt r7, [r1], #0x04 .Lcopyout_bad1: - subs r2, r2, #0x10 + subs r2, r2, #0x10 bge .Lcopyout_bad1_loop16 - adds r2, r2, #0x10 + adds r2, r2, #0x10 ldmeqfd sp!, {r4-r7} RETeq /* Return now if done */ subs r2, r2, #0x04 @@ -846,10 +846,10 @@ ENTRY(copyout) strt r6, [r1], #0x04 strt r7, [r1], #0x04 .Lcopyout_bad2: - subs r2, r2, #0x10 + subs r2, r2, #0x10 bge .Lcopyout_bad2_loop16 - adds r2, r2, #0x10 + adds r2, r2, #0x10 ldmeqfd sp!, {r4-r7} RETeq /* Return now if done */ subs r2, r2, #0x04 @@ -907,10 +907,10 @@ ENTRY(copyout) strt r6, [r1], #0x04 strt r7, [r1], #0x04 .Lcopyout_bad3: - subs r2, r2, #0x10 + subs r2, r2, #0x10 bge .Lcopyout_bad3_loop16 - adds r2, r2, #0x10 + adds r2, r2, #0x10 ldmeqfd sp!, {r4-r7} RETeq /* Return now if done */ subs r2, r2, #0x04 Modified: head/sys/arm/arm/bootconfig.c ============================================================================== --- head/sys/arm/arm/bootconfig.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/bootconfig.c Wed Jun 13 04:59:55 2012 (r236991) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include -/* +/* * Function to identify and process different types of boot argument */ Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/busdma_machdep.c Wed Jun 13 04:59:55 2012 (r236991) @@ -156,7 +156,7 @@ struct bus_dmamap { static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; -static TAILQ_HEAD(,bus_dmamap) dmamap_freelist = +static TAILQ_HEAD(,bus_dmamap) dmamap_freelist = TAILQ_HEAD_INITIALIZER(dmamap_freelist); #define BUSDMA_STATIC_MAPS 500 @@ -210,7 +210,7 @@ arm_dmamap_freelist_init(void *dummy) { int i; - for (i = 0; i < BUSDMA_STATIC_MAPS; i++) + for (i = 0; i < BUSDMA_STATIC_MAPS; i++) TAILQ_INSERT_HEAD(&dmamap_freelist, &map_pool[i], freelist); } @@ -231,7 +231,7 @@ _bus_dma_can_bounce(vm_offset_t lowaddr, int i; for (i = 0; phys_avail[i] && phys_avail[i + 1]; i += 2) { if ((lowaddr >= phys_avail[i] && lowaddr <= phys_avail[i + 1]) - || (lowaddr < phys_avail[i] && + || (lowaddr < phys_avail[i] && highaddr > phys_avail[i])) return (1); } @@ -313,7 +313,7 @@ _busdma_alloc_dmamap(void) return (map); } -static __inline void +static __inline void _busdma_free_dmamap(bus_dmamap_t map) { if (map->flags & DMAMAP_ALLOCATED) @@ -633,7 +633,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi *vaddr = tmpaddr; } else newmap->origbuffer = newmap->allocbuffer = NULL; - } else + } else newmap->origbuffer = newmap->allocbuffer = NULL; return (0); } @@ -844,7 +844,7 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma if (seg >= 0 && curaddr == lastaddr && (segs[seg].ds_len + sgsize) <= dmat->maxsegsz && (dmat->boundary == 0 || - (segs[seg].ds_addr & bmask) == + (segs[seg].ds_addr & bmask) == (curaddr & bmask))) { segs[seg].ds_len += sgsize; goto segdone; @@ -941,7 +941,7 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, for (m = m0; m != NULL && error == 0; m = m->m_next) { if (m->m_len > 0) { error = bus_dmamap_load_buffer(dmat, - dm_segments, map, m->m_data, m->m_len, + dm_segments, map, m->m_data, m->m_len, pmap_kernel(), flags, &lastaddr, &nsegs); map->len += m->m_len; } @@ -951,7 +951,7 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, } if (error) { - /* + /* * force "no valid mappings" on error in callback. */ (*callback)(callback_arg, dm_segments, 0, 0, error); @@ -1057,7 +1057,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, } if (error) { - /* + /* * force "no valid mappings" on error in callback. */ (*callback)(callback_arg, dm_segments, 0, 0, error); @@ -1092,7 +1092,7 @@ bus_dmamap_sync_buf(void *buf, int len, { char _tmp_cl[arm_dcache_align], _tmp_clend[arm_dcache_align]; register_t s; - int partial; + int partial; if ((op & BUS_DMASYNC_PREWRITE) && !(op & BUS_DMASYNC_PREREAD)) { cpu_dcache_wb_range((vm_offset_t)buf, len); @@ -1116,7 +1116,7 @@ bus_dmamap_sync_buf(void *buf, int len, ~arm_dcache_align_mask), (vm_offset_t)buf & arm_dcache_align_mask); if (((vm_offset_t)buf + len) & arm_dcache_align_mask) - memcpy(_tmp_clend, + memcpy(_tmp_clend, (void *)((vm_offset_t)buf + len), arm_dcache_align - (((vm_offset_t)(buf) + len) & arm_dcache_align_mask)); @@ -1126,11 +1126,11 @@ bus_dmamap_sync_buf(void *buf, int len, if (partial) { if ((vm_offset_t)buf & arm_dcache_align_mask) memcpy((void *)((vm_offset_t)buf & - ~arm_dcache_align_mask), _tmp_cl, + ~arm_dcache_align_mask), _tmp_cl, (vm_offset_t)buf & arm_dcache_align_mask); if (((vm_offset_t)buf + len) & arm_dcache_align_mask) - memcpy((void *)((vm_offset_t)buf + len), - _tmp_clend, arm_dcache_align - + memcpy((void *)((vm_offset_t)buf + len), + _tmp_clend, arm_dcache_align - (((vm_offset_t)(buf) + len) & arm_dcache_align_mask)); intr_restore(s); @@ -1146,7 +1146,7 @@ _bus_dmamap_sync_bp(bus_dma_tag_t dmat, STAILQ_FOREACH(bpage, &map->bpages, links) { if (op & BUS_DMASYNC_PREWRITE) { bcopy((void *)bpage->datavaddr, - (void *)(bpage->vaddr_nocache != 0 ? + (void *)(bpage->vaddr_nocache != 0 ? bpage->vaddr_nocache : bpage->vaddr), bpage->datacount); if (bpage->vaddr_nocache == 0) { @@ -1164,7 +1164,7 @@ _bus_dmamap_sync_bp(bus_dma_tag_t dmat, cpu_l2cache_inv_range(bpage->vaddr, bpage->datacount); } - bcopy((void *)(bpage->vaddr_nocache != 0 ? + bcopy((void *)(bpage->vaddr_nocache != 0 ? bpage->vaddr_nocache : bpage->vaddr), (void *)bpage->datavaddr, bpage->datacount); dmat->bounce_zone->total_bounced++; @@ -1179,7 +1179,7 @@ _bus_dma_buf_is_in_bp(bus_dmamap_t map, STAILQ_FOREACH(bpage, &map->bpages, links) { if ((vm_offset_t)buf >= bpage->datavaddr && - (vm_offset_t)buf + len <= bpage->datavaddr + + (vm_offset_t)buf + len <= bpage->datavaddr + bpage->datacount) return (1); } Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc.c Wed Jun 13 04:59:55 2012 (r236991) @@ -222,7 +222,7 @@ struct cpu_functions arm8_cpufuncs = { arm8_context_switch, /* context_switch */ arm8_setup /* cpu setup */ -}; +}; #endif /* CPU_ARM8 */ #ifdef CPU_ARM9 @@ -328,7 +328,7 @@ struct cpu_functions armv5_ec_cpufuncs = (void *)cpufunc_nullop, /* l2cache_wbinv_range */ (void *)cpufunc_nullop, /* l2cache_inv_range */ (void *)cpufunc_nullop, /* l2cache_wb_range */ - + /* Other functions */ cpufunc_nullop, /* flush_prefetchbuf */ @@ -530,7 +530,7 @@ struct cpu_functions sa110_cpufuncs = { sa110_context_switch, /* context_switch */ sa110_setup /* cpu setup */ -}; +}; #endif /* CPU_SA110 */ #if defined(CPU_SA1100) || defined(CPU_SA1110) @@ -591,7 +591,7 @@ struct cpu_functions sa11x0_cpufuncs = { sa11x0_context_switch, /* context_switch */ sa11x0_setup /* cpu setup */ -}; +}; #endif /* CPU_SA1100 || CPU_SA1110 */ #ifdef CPU_IXP12X0 @@ -652,7 +652,7 @@ struct cpu_functions ixp12x0_cpufuncs = ixp12x0_context_switch, /* context_switch */ ixp12x0_setup /* cpu setup */ -}; +}; #endif /* CPU_IXP12X0 */ #if defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321) || \ @@ -841,7 +841,7 @@ struct cpu_functions fa526_cpufuncs = { fa526_context_switch, /* context_switch */ fa526_setup /* cpu setup */ -}; +}; #endif /* CPU_FA526 || CPU_FA626TE */ @@ -1099,7 +1099,7 @@ set_cpufuncs() cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */ get_cachetype_cp15(); arm10_dcache_sets_inc = 1U << arm_dcache_l2_linesize; - arm10_dcache_sets_max = + arm10_dcache_sets_max = (1U << (arm_dcache_l2_linesize + arm_dcache_l2_nsets)) - arm10_dcache_sets_inc; arm10_dcache_index_inc = 1U << (32 - arm_dcache_l2_assoc); @@ -1353,7 +1353,7 @@ early_abort_fixup(arg) int loop; int count; int *registers = &frame->tf_r0; - + DFC_PRINTF(("LDM/STM\n")); DFC_DISASSEMBLE(fault_pc); if (fault_instruction & (1 << 21)) { @@ -1533,7 +1533,7 @@ late_abort_fixup(arg) offset = fault_instruction & 0x0f; if (offset == base) return ABORT_FIXUP_FAILED; - + /* * Register offset - hard we have to * cope with shifts ! @@ -1647,8 +1647,8 @@ static u_int parse_cpu_options(char *, s static u_int parse_cpu_options(args, optlist, cpuctrl) char *args; - struct cpu_option *optlist; - u_int cpuctrl; + struct cpu_option *optlist; + u_int cpuctrl; { int integer; @@ -1811,7 +1811,7 @@ arm8_setup(args) ctrl = cpuctrl; cpu_control(0xffffffff, cpuctrl); - /* Set the clock/test register */ + /* Set the clock/test register */ if (setclock) arm8_clock_config(0x7f, clocktest); } @@ -1891,7 +1891,7 @@ arm10_setup(args) int cpuctrl, cpuctrlmask; cpuctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_SYST_ENABLE - | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE + | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE | CPU_CONTROL_WBUF_ENABLE | CPU_CONTROL_BPRD_ENABLE; cpuctrlmask = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_SYST_ENABLE | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE @@ -2031,7 +2031,7 @@ sa110_setup(args) /* cpu_control(cpuctrlmask, cpuctrl);*/ cpu_control(0xffffffff, cpuctrl); - /* + /* * enable clockswitching, note that this doesn't read or write to r0, * r0 is just to make it valid asm */ @@ -2089,7 +2089,7 @@ sa11x0_setup(args) cpuctrl |= CPU_CONTROL_VECRELOC; /* Clear out the cache */ cpu_idcache_wbinv_all(); - /* Set the control register */ + /* Set the control register */ ctrl = cpuctrl; cpu_control(0xffffffff, cpuctrl); } @@ -2198,7 +2198,7 @@ ixp12x0_setup(args) /* Clear out the cache */ cpu_idcache_wbinv_all(); - /* Set the control register */ + /* Set the control register */ ctrl = cpuctrl; /* cpu_control(0xffffffff, cpuctrl); */ cpu_control(cpuctrlmask, cpuctrl); @@ -2292,5 +2292,5 @@ xscale_setup(args) __asm __volatile("mcr p15, 0, %0, c1, c0, 1" : : "r" (auxctl)); } -#endif /* CPU_XSCALE_80200 || CPU_XSCALE_80321 || CPU_XSCALE_PXA2X0 || CPU_XSCALE_IXP425 +#endif /* CPU_XSCALE_80200 || CPU_XSCALE_80321 || CPU_XSCALE_PXA2X0 || CPU_XSCALE_IXP425 CPU_XSCALE_80219 */ Modified: head/sys/arm/arm/cpufunc_asm.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm.S Wed Jun 13 04:59:55 2012 (r236991) @@ -34,14 +34,14 @@ * * RiscBSD kernel project * - * cpufunc.S + * cpufunc.S * * Assembly functions for CPU / MMU / TLB specific operations * * Created : 30/01/97 * */ - + #include __FBSDID("$FreeBSD$"); @@ -86,13 +86,13 @@ ENTRY(cpufunc_faultaddress) * Generic functions to write the internal coprocessor registers * * - * Currently these registers are + * Currently these registers are * c1 - CPU Control * c3 - Domain Access Control * * All other registers are CPU architecture specific */ - + #if 0 /* See below. */ ENTRY(cpufunc_control) mcr p15, 0, r0, c1, c0, 0 @@ -107,12 +107,12 @@ ENTRY(cpufunc_domains) * Generic functions to read/modify/write the internal coprocessor registers * * - * Currently these registers are + * Currently these registers are * c1 - CPU Control * * All other registers are CPU architecture specific */ - + ENTRY(cpufunc_control) mrc p15, 0, r3, c1, c0, 0 /* Read the control register */ bic r2, r3, r0 /* Clear bits */ Modified: head/sys/arm/arm/cpufunc_asm_arm10.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm10.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_arm10.S Wed Jun 13 04:59:55 2012 (r236991) @@ -31,7 +31,7 @@ * ARM10 assembly functions for CPU / MMU / TLB specific operations * */ - + #include __FBSDID("$FreeBSD$"); @@ -255,7 +255,7 @@ ENTRY(arm10_context_switch) /* * Parameters for the cache cleaning code. Note that the order of these - * four variables is assumed in the code above. Hence the reason for + * four variables is assumed in the code above. Hence the reason for * declaring them in the assembler file. */ .align 0 Modified: head/sys/arm/arm/cpufunc_asm_arm11.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm11.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_arm11.S Wed Jun 13 04:59:55 2012 (r236991) @@ -33,7 +33,7 @@ * XXX We make no attempt at present to take advantage of the v6 memroy * architecture or physically tagged cache. */ - + #include __FBSDID("$FreeBSD$"); Modified: head/sys/arm/arm/cpufunc_asm_arm7tdmi.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm7tdmi.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_arm7tdmi.S Wed Jun 13 04:59:55 2012 (r236991) @@ -34,7 +34,7 @@ * ARM7TDMI assembly functions for CPU / MMU / TLB specific operations * */ - + #include __FBSDID("$FreeBSD$"); Modified: head/sys/arm/arm/cpufunc_asm_arm8.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm8.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_arm8.S Wed Jun 13 04:59:55 2012 (r236991) @@ -35,7 +35,7 @@ * ARM8 assembly functions for CPU / MMU / TLB specific operations * */ - + #include __FBSDID("$FreeBSD$"); Modified: head/sys/arm/arm/cpufunc_asm_arm9.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_arm9.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_arm9.S Wed Jun 13 04:59:55 2012 (r236991) @@ -30,7 +30,7 @@ * * ARM9 assembly functions for CPU / MMU / TLB specific operations */ - + #include __FBSDID("$FreeBSD$"); @@ -242,7 +242,7 @@ ENTRY(arm9_context_switch) /* * Parameters for the cache cleaning code. Note that the order of these - * four variables is assumed in the code above. Hence the reason for + * four variables is assumed in the code above. Hence the reason for * declaring them in the assembler file. */ .align 0 Modified: head/sys/arm/arm/cpufunc_asm_armv4.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_armv4.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_armv4.S Wed Jun 13 04:59:55 2012 (r236991) @@ -36,7 +36,7 @@ * ARM9 assembly functions for CPU / MMU / TLB specific operations * */ - + #include __FBSDID("$FreeBSD$"); Modified: head/sys/arm/arm/cpufunc_asm_armv5.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_armv5.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_armv5.S Wed Jun 13 04:59:55 2012 (r236991) @@ -32,7 +32,7 @@ * These routines can be used by any core that supports the set/index * operations. */ - + #include __FBSDID("$FreeBSD$"); @@ -224,7 +224,7 @@ ENTRY(armv5_dcache_wbinv_all) /* * Parameters for the cache cleaning code. Note that the order of these - * four variables is assumed in the code above. Hence the reason for + * four variables is assumed in the code above. Hence the reason for * declaring them in the assembler file. */ .align 0 Modified: head/sys/arm/arm/cpufunc_asm_sa1.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_sa1.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_sa1.S Wed Jun 13 04:59:55 2012 (r236991) @@ -35,7 +35,7 @@ * SA-1 assembly functions for CPU / MMU / TLB specific operations * */ - + #include __FBSDID("$FreeBSD$"); @@ -58,7 +58,7 @@ ENTRY(sa1_setttb) #else ldr r3, .Lblock_userspace_access ldr r2, [r3] - orr r1, r2, #1 + orr r1, r2, #1 str r1, [r3] #endif stmfd sp!, {r0-r3, lr} @@ -67,7 +67,7 @@ ENTRY(sa1_setttb) mcr p15, 0, r0, c7, c5, 0 /* invalidate I$ and BTB */ mcr p15, 0, r0, c7, c10, 4 /* drain write and fill buffer */ - /* Write the TTB */ + /* Write the TTB */ mcr p15, 0, r0, c2, c0, 0 /* If we have updated the TTB we must flush the TLB */ Modified: head/sys/arm/arm/cpufunc_asm_xscale.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_xscale.S Wed Jun 13 04:59:55 2012 (r236991) @@ -71,7 +71,7 @@ * * XScale assembly functions for CPU / MMU / TLB specific operations */ - + #include __FBSDID("$FreeBSD$"); @@ -138,7 +138,7 @@ ENTRY(xscale_setttb) #else ldr r3, .Lblock_userspace_access ldr r2, [r3] - orr r1, r2, #1 + orr r1, r2, #1 str r1, [r3] #endif stmfd sp!, {r0-r3, lr} @@ -150,7 +150,7 @@ ENTRY(xscale_setttb) ldmfd sp!, {r0-r3, lr} - /* Write the TTB */ + /* Write the TTB */ mcr p15, 0, r0, c2, c0, 0 /* If we have updated the TTB we must flush the TLB */ Modified: head/sys/arm/arm/cpufunc_asm_xscale_c3.S ============================================================================== --- head/sys/arm/arm/cpufunc_asm_xscale_c3.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/cpufunc_asm_xscale_c3.S Wed Jun 13 04:59:55 2012 (r236991) @@ -72,7 +72,7 @@ * * XScale core 3 assembly functions for CPU / MMU / TLB specific operations */ - + #include __FBSDID("$FreeBSD$"); @@ -339,7 +339,7 @@ ENTRY(xscalec3_setttb) #else ldr r3, .Lblock_userspace_access ldr r2, [r3] - orr r1, r2, #1 + orr r1, r2, #1 str r1, [r3] #endif stmfd sp!, {r0-r3, lr} @@ -354,7 +354,7 @@ ENTRY(xscalec3_setttb) #ifdef ARM_USE_L2_CACHE orr r0, r0, #0x18 /* cache the page table in L2 */ #endif - /* Write the TTB */ + /* Write the TTB */ mcr p15, 0, r0, c2, c0, 0 /* If we have updated the TTB we must flush the TLB */ Modified: head/sys/arm/arm/db_disasm.c ============================================================================== --- head/sys/arm/arm/db_disasm.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/db_disasm.c Wed Jun 13 04:59:55 2012 (r236991) @@ -50,7 +50,7 @@ static u_int db_disasm_read_word(u_int); static void db_disasm_printaddr(u_int); static const disasm_interface_t db_disasm_interface = { - db_disasm_read_word, + db_disasm_read_word, db_disasm_printaddr, db_printf }; Modified: head/sys/arm/arm/db_interface.c ============================================================================== --- head/sys/arm/arm/db_interface.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/db_interface.c Wed Jun 13 04:59:55 2012 (r236991) @@ -6,24 +6,24 @@ * Mach Operating System * Copyright (c) 1991,1990 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * @@ -325,7 +325,7 @@ branch_taken(u_int insn, db_addr_t pc) break; default: break; /* XXX */ - } + } } return (addr + offset); Modified: head/sys/arm/arm/db_trace.c ============================================================================== --- head/sys/arm/arm/db_trace.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/db_trace.c Wed Jun 13 04:59:55 2012 (r236991) @@ -7,24 +7,24 @@ * Mach Operating System * Copyright (c) 1991,1990 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); * a structure to represent them is a good idea. * * Here's the diagram from the APCS. Increasing address is _up_ the page. - * + * * save code pointer [fp] <- fp points to here * return link value [fp, #-4] * return sp value [fp, #-8] @@ -72,9 +72,9 @@ __FBSDID("$FreeBSD$"); * [saved a2 value] * [saved a1 value] * - * The save code pointer points twelve bytes beyond the start of the - * code sequence (usually a single STM) that created the stack frame. - * We have to disassemble it if we want to know which of the optional + * The save code pointer points twelve bytes beyond the start of the + * code sequence (usually a single STM) that created the stack frame. + * We have to disassemble it if we want to know which of the optional * fields are actually present. */ Modified: head/sys/arm/arm/disassem.c ============================================================================== --- head/sys/arm/arm/disassem.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/disassem.c Wed Jun 13 04:59:55 2012 (r236991) @@ -131,9 +131,9 @@ static const struct arm32_insn arm32_i[] { 0x0c500000, 0x04400000, "strb", "daW" }, { 0x0c500000, 0x04500000, "ldrb", "daW" }, { 0x0e1f0000, 0x080d0000, "stm", "YnWl" },/* separate out r13 base */ - { 0x0e1f0000, 0x081d0000, "ldm", "YnWl" },/* separate out r13 base */ + { 0x0e1f0000, 0x081d0000, "ldm", "YnWl" },/* separate out r13 base */ { 0x0e100000, 0x08000000, "stm", "XnWl" }, - { 0x0e100000, 0x08100000, "ldm", "XnWl" }, + { 0x0e100000, 0x08100000, "ldm", "XnWl" }, { 0x0e1000f0, 0x00100090, "ldrb", "de" }, { 0x0e1000f0, 0x00000090, "strb", "de" }, { 0x0e1000f0, 0x001000d0, "ldrsb", "de" }, @@ -329,7 +329,7 @@ disasm(const disasm_interface_t *di, vm_ di->di_printf("#0x%08x", (insn & 0xff) << (32 - rotate) | (insn & 0xff) >> rotate); - } else { + } else { disasm_register_shift(di, insn); } break; Modified: head/sys/arm/arm/dump_machdep.c ============================================================================== --- head/sys/arm/arm/dump_machdep.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/dump_machdep.c Wed Jun 13 04:59:55 2012 (r236991) @@ -197,7 +197,7 @@ cb_dumpdata(struct md_pa *mdp, int seqnr #ifdef SW_WATCHDOG wdog_kern_pat(WD_LASTVAL); #endif - error = dump_write(di, + error = dump_write(di, (void *)(pa - (pa & L1_ADDR_BITS)),0, dumplo, sz); if (error) break; Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/elf_trampoline.c Wed Jun 13 04:59:55 2012 (r236991) @@ -202,7 +202,7 @@ _startC(void) "orr %0, %0, %1\n" "mrc p15, 0, %1, c1, c0, 0\n" "bic %1, %1, #1\n" /* Disable MMU */ - "orr %1, %1, #(4 | 8)\n" /* Add DC enable, + "orr %1, %1, #(4 | 8)\n" /* Add DC enable, WBUF enable */ "orr %1, %1, #0x1000\n" /* Add IC enable */ "orr %1, %1, #(0x800)\n" /* BPRD enable */ @@ -397,7 +397,7 @@ inflate_kernel(void *kernel, void *start #endif void * -load_kernel(unsigned int kstart, unsigned int curaddr,unsigned int func_end, +load_kernel(unsigned int kstart, unsigned int curaddr,unsigned int func_end, int d) { Elf32_Ehdr *eh; @@ -436,7 +436,7 @@ load_kernel(unsigned int kstart, unsigne if (phdr[j].p_type == PT_LOAD && shdr[i].sh_offset >= phdr[j].p_offset && - (shdr[i].sh_offset + + (shdr[i].sh_offset + shdr[i].sh_size <= phdr[j].p_offset + phdr[j].p_filesz)) { @@ -445,7 +445,7 @@ load_kernel(unsigned int kstart, unsigne j = eh->e_phnum; } } - if (shdr[i].sh_offset != 0 && + if (shdr[i].sh_offset != 0 && shdr[i].sh_size != 0) { symtabindex = i; symstrindex = shdr[i].sh_link; @@ -457,7 +457,7 @@ load_kernel(unsigned int kstart, unsigne ssym = lastaddr; if (d) { memcpy((void *)func_end, (void *)( - shdr[symtabindex].sh_offset + kstart), + shdr[symtabindex].sh_offset + kstart), shdr[symtabindex].sh_size); memcpy((void *)(func_end + shdr[symtabindex].sh_size), @@ -469,7 +469,7 @@ load_kernel(unsigned int kstart, unsigne sizeof(shdr[symtabindex].sh_size)); lastaddr += sizeof(shdr[symstrindex].sh_size); lastaddr += shdr[symstrindex].sh_size; - lastaddr = roundup(lastaddr, + lastaddr = roundup(lastaddr, sizeof(shdr[symstrindex].sh_size)); } @@ -488,13 +488,13 @@ load_kernel(unsigned int kstart, unsigne (void*)(kstart + phdr[i].p_offset), phdr[i].p_filesz); /* Clean space from oversized segments, eg: bss. */ if (phdr[i].p_filesz < phdr[i].p_memsz) - bzero((void *)(phdr[i].p_vaddr - KERNVIRTADDR + + bzero((void *)(phdr[i].p_vaddr - KERNVIRTADDR + curaddr + phdr[i].p_filesz), phdr[i].p_memsz - phdr[i].p_filesz); } /* Now grab the symbol tables. */ if (symtabindex >= 0 && symstrindex >= 0) { - *(Elf_Size *)lastaddr = + *(Elf_Size *)lastaddr = shdr[symtabindex].sh_size; lastaddr += sizeof(shdr[symtabindex].sh_size); memcpy((void*)lastaddr, @@ -511,7 +511,7 @@ load_kernel(unsigned int kstart, unsigne shdr[symtabindex].sh_size), shdr[symstrindex].sh_size); lastaddr += shdr[symstrindex].sh_size; - lastaddr = roundup(lastaddr, + lastaddr = roundup(lastaddr, sizeof(shdr[symstrindex].sh_size)); *(Elf_Addr *)curaddr = MAGIC_TRAMP_NUMBER; *((Elf_Addr *)curaddr + 1) = ssym - curaddr + KERNVIRTADDR; @@ -572,10 +572,10 @@ setup_pagetables(unsigned int pt_addr, v "sub pc, pc, #4\n" : "=r" (tmp) : "r" (pd), "r" (domain)); - /* + /* * XXX: This is the most stupid workaround I've ever wrote. * For some reason, the KB9202 won't boot the kernel unless - * we access an address which is not in the + * we access an address which is not in the * 0x20000000 - 0x20ffffff range. I hope I'll understand * what's going on later. */ @@ -596,7 +596,7 @@ __start(void) curaddr = (void*)((unsigned int)curaddr & 0xfff00000); #ifdef KZIP if (*kernel == 0x1f && kernel[1] == 0x8b) { - pt_addr = (((int)&_end + KERNSIZE + 0x100) & + pt_addr = (((int)&_end + KERNSIZE + 0x100) & ~(L1_TABLE_SIZE - 1)) + L1_TABLE_SIZE; #ifdef CPU_ARM9 @@ -609,7 +609,7 @@ __start(void) /* Gzipped kernel */ dst = inflate_kernel(kernel, &_end); kernel = (char *)&_end; - altdst = 4 + load_kernel((unsigned int)kernel, + altdst = 4 + load_kernel((unsigned int)kernel, (unsigned int)curaddr, (unsigned int)&func_end + 800 , 0); if (altdst > dst) @@ -627,8 +627,8 @@ __start(void) :"=r" (pt_addr)); } else #endif - dst = 4 + load_kernel((unsigned int)&kernel_start, - (unsigned int)curaddr, + dst = 4 + load_kernel((unsigned int)&kernel_start, + (unsigned int)curaddr, (unsigned int)&func_end, 0); dst = (void *)(((vm_offset_t)dst & ~3)); pt_addr = ((unsigned int)dst &~(L1_TABLE_SIZE - 1)) + L1_TABLE_SIZE; @@ -637,8 +637,8 @@ __start(void) sp = pt_addr + L1_TABLE_SIZE + 8192; sp = sp &~3; dst = (void *)(sp + 4); - memcpy((void *)dst, (void *)&load_kernel, (unsigned int)&func_end - + memcpy((void *)dst, (void *)&load_kernel, (unsigned int)&func_end - (unsigned int)&load_kernel + 800); - do_call(dst, kernel, dst + (unsigned int)(&func_end) - + do_call(dst, kernel, dst + (unsigned int)(&func_end) - (unsigned int)(&load_kernel) + 800, sp); } Modified: head/sys/arm/arm/exception.S ============================================================================== --- head/sys/arm/arm/exception.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/exception.S Wed Jun 13 04:59:55 2012 (r236991) @@ -189,7 +189,7 @@ Laddress_exception_msg: * This function uses PULLFRAMEFROMSVCANDEXIT and * DO_AST * only be called if the exception handler used PUSHFRAMEINSVC - * + * */ exception_exit: Modified: head/sys/arm/arm/gdb_machdep.c ============================================================================== --- head/sys/arm/arm/gdb_machdep.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/gdb_machdep.c Wed Jun 13 04:59:55 2012 (r236991) @@ -74,8 +74,8 @@ gdb_cpu_getreg(int regnum, size_t *regsz case 12: return (&kdb_thrctx->un_32.pcb32_r12); case 13: stacktest = kdb_thrctx->un_32.pcb32_sp + 5 * 4; return (&stacktest); - case 15: - /* + case 15: + /* * On context switch, the PC is not put in the PCB, but * we can retrieve it from the stack. */ Modified: head/sys/arm/arm/in_cksum.c ============================================================================== --- head/sys/arm/arm/in_cksum.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/in_cksum.c Wed Jun 13 04:59:55 2012 (r236991) @@ -149,4 +149,4 @@ u_int in_cksum_hdr(const struct ip *ip) union l_util l_util; REDUCE16; return (~sum & 0xffff); -} +} Modified: head/sys/arm/arm/intr.c ============================================================================== --- head/sys/arm/arm/intr.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/intr.c Wed Jun 13 04:59:55 2012 (r236991) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include @@ -62,7 +62,7 @@ void arm_handler_execute(struct trapfram void (*arm_post_filter)(void *) = NULL; void -arm_setup_irqhandler(const char *name, driver_filter_t *filt, +arm_setup_irqhandler(const char *name, driver_filter_t *filt, void (*hand)(void*), void *arg, int irq, int flags, void **cookiep) { struct intr_event *event; @@ -78,7 +78,7 @@ arm_setup_irqhandler(const char *name, d if (error) return; intr_events[irq] = event; - last_printed += + last_printed += snprintf(intrnames + last_printed, MAXCOMLEN + 1, "irq%d: %s", irq, name); Modified: head/sys/arm/arm/irq_dispatch.S ============================================================================== --- head/sys/arm/arm/irq_dispatch.S Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/irq_dispatch.S Wed Jun 13 04:59:55 2012 (r236991) @@ -103,7 +103,7 @@ ASENTRY_NP(irq_entry) .global _C_LABEL(intrnames), _C_LABEL(sintrnames) .global _C_LABEL(intrcnt), _C_LABEL(sintrcnt) -_C_LABEL(intrnames): +_C_LABEL(intrnames): .space NIRQ * (MAXCOMLEN + 1) _C_LABEL(intrcnt): .space NIRQ * 4 Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Wed Jun 13 04:59:00 2012 (r236990) +++ head/sys/arm/arm/machdep.c Wed Jun 13 04:59:55 2012 (r236991) @@ -141,14 +141,14 @@ sendsig(catcher, ksi, mask) /* Allocate and validate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !(onstack) && SIGISMEMBER(psp->ps_sigonstack, sig)) { - fp = (struct sigframe *)(td->td_sigstk.ss_sp + + fp = (struct sigframe *)(td->td_sigstk.ss_sp + td->td_sigstk.ss_size); #if defined(COMPAT_43) td->td_sigstk.ss_flags |= SS_ONSTACK; #endif } else fp = (struct sigframe *)td->td_frame->tf_usr_sp; - + /* make room on the stack */ fp--; @@ -158,7 +158,7 @@ sendsig(catcher, ksi, mask) get_mcontext(td, &frame.sf_uc.uc_mcontext, 0); frame.sf_si = ksi->ksi_info; frame.sf_uc.uc_sigmask = *mask; - frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK ) + frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK ) ? ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE; frame.sf_uc.uc_stack = td->td_sigstk; mtx_unlock(&psp->ps_mtx); @@ -451,7 +451,7 @@ ptrace_single_step(struct thread *td) ("Didn't clear single step")); p = td->td_proc; PROC_UNLOCK(p); - error = ptrace_read_int(td, td->td_frame->tf_pc + 4, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 05:02:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 956BC106564A; Wed, 13 Jun 2012 05:02:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F0DC8FC14; Wed, 13 Jun 2012 05:02:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D52qBD097133; Wed, 13 Jun 2012 05:02:52 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D52q6Y097111; Wed, 13 Jun 2012 05:02:52 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206130502.q5D52q6Y097111@svn.freebsd.org> From: Warner Losh Date: Wed, 13 Jun 2012 05:02:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236992 - head/sys/arm/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 05:02:52 -0000 Author: imp Date: Wed Jun 13 05:02:51 2012 New Revision: 236992 URL: http://svn.freebsd.org/changeset/base/236992 Log: trim trailing whitespace Modified: head/sys/arm/include/armreg.h head/sys/arm/include/asmacros.h head/sys/arm/include/atomic.h head/sys/arm/include/blockio.h head/sys/arm/include/cpufunc.h head/sys/arm/include/elf.h head/sys/arm/include/endian.h head/sys/arm/include/fdt.h head/sys/arm/include/fp.h head/sys/arm/include/frame.h head/sys/arm/include/ieee.h head/sys/arm/include/in_cksum.h head/sys/arm/include/intr.h head/sys/arm/include/katelib.h head/sys/arm/include/param.h head/sys/arm/include/pmap.h head/sys/arm/include/profile.h head/sys/arm/include/pte.h head/sys/arm/include/resource.h head/sys/arm/include/stack.h head/sys/arm/include/vmparam.h Modified: head/sys/arm/include/armreg.h ============================================================================== --- head/sys/arm/include/armreg.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/armreg.h Wed Jun 13 05:02:51 2012 (r236992) @@ -327,7 +327,7 @@ /* * ARM Instructions * - * 3 3 2 2 2 + * 3 3 2 2 2 * 1 0 9 8 7 0 * +-------+-------------------------------------------------------+ * | cond | instruction dependant | Modified: head/sys/arm/include/asmacros.h ============================================================================== --- head/sys/arm/include/asmacros.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/asmacros.h Wed Jun 13 05:02:51 2012 (r236992) @@ -92,7 +92,7 @@ * This should only be used if the processor is not currently in SVC32 * mode. The processor mode is switched to SVC mode and the trap frame is * stored. The SVC lr field is used to store the previous value of - * lr in SVC mode. + * lr in SVC mode. * * NOTE: r13 and r14 are stored separately as a work around for the * SA110 rev 2 STM^ bug Modified: head/sys/arm/include/atomic.h ============================================================================== --- head/sys/arm/include/atomic.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/atomic.h Wed Jun 13 05:02:51 2012 (r236992) @@ -285,7 +285,6 @@ atomic_fetchadd_32(volatile uint32_t *p, return (start); } - #endif /* _KERNEL */ static __inline int Modified: head/sys/arm/include/blockio.h ============================================================================== --- head/sys/arm/include/blockio.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/blockio.h Wed Jun 13 05:02:51 2012 (r236992) @@ -14,7 +14,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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. Modified: head/sys/arm/include/cpufunc.h ============================================================================== --- head/sys/arm/include/cpufunc.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/cpufunc.h Wed Jun 13 05:02:51 2012 (r236992) @@ -315,7 +315,7 @@ void sa11x0_drain_readbuf (void); void sa11x0_context_switch (void); void sa11x0_cpu_sleep (int mode); - + void sa11x0_setup (char *string); #endif @@ -471,7 +471,7 @@ extern unsigned armv5_dcache_index_inc; defined(CPU_FA526) || defined(CPU_FA626TE) || \ defined(CPU_XSCALE_PXA2X0) || defined(CPU_XSCALE_IXP425) || \ defined(CPU_XSCALE_80219) || defined(CPU_XSCALE_81342) - + void armv4_tlb_flushID (void); void armv4_tlb_flushI (void); void armv4_tlb_flushD (void); @@ -526,7 +526,7 @@ void xscale_cache_flushD_rng (vm_offset_ void xscale_context_switch (void); void xscale_setup (char *string); -#endif /* CPU_XSCALE_80200 || CPU_XSCALE_80321 || CPU_XSCALE_PXA2X0 || CPU_XSCALE_IXP425 +#endif /* CPU_XSCALE_80200 || CPU_XSCALE_80321 || CPU_XSCALE_PXA2X0 || CPU_XSCALE_IXP425 CPU_XSCALE_80219 */ #ifdef CPU_XSCALE_81342 @@ -628,7 +628,7 @@ extern int arm_picache_ways; extern int arm_pdcache_size; /* and unified */ extern int arm_pdcache_line_size; -extern int arm_pdcache_ways; +extern int arm_pdcache_ways; extern int arm_pcache_type; extern int arm_pcache_unified; Modified: head/sys/arm/include/elf.h ============================================================================== --- head/sys/arm/include/elf.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/elf.h Wed Jun 13 05:02:51 2012 (r236992) @@ -99,8 +99,8 @@ __ElfType(Auxinfo); #define ELF_TARG_MACH EM_ARM #define ELF_TARG_VER 1 -/* - * Magic number for the elf trampoline, chosen wisely to be an immediate +/* + * Magic number for the elf trampoline, chosen wisely to be an immediate * value. */ #define MAGIC_TRAMP_NUMBER 0x5c000003 Modified: head/sys/arm/include/endian.h ============================================================================== --- head/sys/arm/include/endian.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/endian.h Wed Jun 13 05:02:51 2012 (r236992) @@ -78,7 +78,7 @@ __bswap64(__uint64_t _x) return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) | ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) | - ((_x << 24) & ((__uint64_t)0xff << 40)) | + ((_x << 24) & ((__uint64_t)0xff << 40)) | ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); } Modified: head/sys/arm/include/fdt.h ============================================================================== --- head/sys/arm/include/fdt.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/fdt.h Wed Jun 13 05:02:51 2012 (r236992) @@ -44,7 +44,7 @@ /* Max interrupt number */ #define FDT_INTR_MAX NIRQ -/* Map phandle/intpin pair to global IRQ number */ +/* Map phandle/intpin pair to global IRQ number */ #define FDT_MAP_IRQ(node, pin) (pin) /* Modified: head/sys/arm/include/fp.h ============================================================================== --- head/sys/arm/include/fp.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/fp.h Wed Jun 13 05:02:51 2012 (r236992) @@ -77,7 +77,7 @@ struct fpe_sp_state { * Type for a saved FP context, if we want to translate the context to a * user-readable form */ - + typedef struct { u_int32_t fpsr; fp_extended_precision_t regs[8]; Modified: head/sys/arm/include/frame.h ============================================================================== --- head/sys/arm/include/frame.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/frame.h Wed Jun 13 05:02:51 2012 (r236992) @@ -148,7 +148,7 @@ struct switchframe { u_int sf_r7; u_int sf_pc; }; - + /* * Stack frame. Used during stack traces (db_trace.c) */ @@ -162,5 +162,3 @@ struct frame { #endif /* !_LOCORE */ #endif /* _MACHINE_FRAME_H_ */ - -/* End of frame.h */ Modified: head/sys/arm/include/ieee.h ============================================================================== --- head/sys/arm/include/ieee.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/ieee.h Wed Jun 13 05:02:51 2012 (r236992) @@ -124,7 +124,7 @@ struct ieee_double { u_int dbl_sign:1; #if _IEEE_WORD_ORDER == _BIG_ENDIAN u_int dbl_fracl; -#endif +#endif #endif }; Modified: head/sys/arm/include/in_cksum.h ============================================================================== --- head/sys/arm/include/in_cksum.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/in_cksum.h Wed Jun 13 05:02:51 2012 (r236992) @@ -56,7 +56,7 @@ in_pseudo(u_int sum, u_int b, u_int c) __asm __volatile("adds %0, %0, %1\n" "adcs %0, %0, %2\n" "adc %0, %0, #0\n" - : "+r" (sum) + : "+r" (sum) : "r" (b), "r" (c)); sum = (sum & 0xffff) + (sum >> 16); if (sum > 0xffff) Modified: head/sys/arm/include/intr.h ============================================================================== --- head/sys/arm/include/intr.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/intr.h Wed Jun 13 05:02:51 2012 (r236992) @@ -59,8 +59,8 @@ int arm_get_next_irq(int); void arm_mask_irq(uintptr_t); void arm_unmask_irq(uintptr_t); -void arm_setup_irqhandler(const char *, int (*)(void*), void (*)(void*), - void *, int, int, void **); +void arm_setup_irqhandler(const char *, int (*)(void*), void (*)(void*), + void *, int, int, void **); int arm_remove_irqhandler(int, void *); extern void (*arm_post_filter)(void *); #endif /* _MACHINE_INTR_H */ Modified: head/sys/arm/include/katelib.h ============================================================================== --- head/sys/arm/include/katelib.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/katelib.h Wed Jun 13 05:02:51 2012 (r236992) @@ -43,7 +43,7 @@ * * This should not really be a separate header file. Eventually I will merge * this into other header files once I have decided where the declarations - * should go. + * should go. * * Created : 18/09/94 * Modified: head/sys/arm/include/param.h ============================================================================== --- head/sys/arm/include/param.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/param.h Wed Jun 13 05:02:51 2012 (r236992) @@ -62,7 +62,7 @@ #define MACHINE_ARCH "arm" #endif #endif -#define MID_MACHINE MID_ARM6 +#define MID_MACHINE MID_ARM6 #if defined(SMP) || defined(KLD_MODULE) #ifndef MAXCPU @@ -78,7 +78,7 @@ * ALIGNED_POINTER is a boolean macro that checks whether an address * is valid to fetch data elements of type t from on this architecture. * This does not reflect the optimal alignment, just the possibility - * (within reasonable limits). + * (within reasonable limits). */ #define ALIGNED_POINTER(p, t) ((((unsigned)(p)) & (sizeof(t)-1)) == 0) Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/pmap.h Wed Jun 13 05:02:51 2012 (r236992) @@ -58,7 +58,7 @@ #define PTE_NOCACHE 0 #define PTE_CACHE 1 #define PTE_PAGETABLE 2 - + #ifndef LOCORE #include @@ -413,7 +413,7 @@ extern pt_entry_t pte_l2_s_cache_mode_p extern pt_entry_t pte_l2_s_prot_u; extern pt_entry_t pte_l2_s_prot_w; extern pt_entry_t pte_l2_s_prot_mask; - + extern pt_entry_t pte_l1_s_proto; extern pt_entry_t pte_l1_c_proto; extern pt_entry_t pte_l2_s_proto; Modified: head/sys/arm/include/profile.h ============================================================================== --- head/sys/arm/include/profile.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/profile.h Wed Jun 13 05:02:51 2012 (r236992) @@ -38,7 +38,7 @@ #define _MACHINE_PROFILE_H_ /* - * Config generates something to tell the compiler to align functions on 32 + * Config generates something to tell the compiler to align functions on 32 * byte boundaries. A strict alignment is good for keeping the tables small. */ #define FUNCTION_ALIGNMENT 16 Modified: head/sys/arm/include/pte.h ============================================================================== --- head/sys/arm/include/pte.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/pte.h Wed Jun 13 05:02:51 2012 (r236992) @@ -58,7 +58,7 @@ typedef uint32_t pt_entry_t; /* page ta * was allocated for a PT then the other 3KB would also get mapped * whenever the 1KB was mapped. */ - + #define PT_RSIZE 0x0400 /* Real page table size */ #define PT_SIZE 0x1000 #define PD_SIZE 0x4000 @@ -315,7 +315,7 @@ typedef uint32_t pt_entry_t; /* page ta * * Cache attributes with L2 present, S = 0 * T E X C B L1 i-cache L1 d-cache L1 DC WP L2 cacheable write coalesce - * 0 0 0 0 0 N N - N N + * 0 0 0 0 0 N N - N N * 0 0 0 0 1 N N - N Y * 0 0 0 1 0 Y Y WT N Y * 0 0 0 1 1 Y Y WB Y Y @@ -342,7 +342,7 @@ typedef uint32_t pt_entry_t; /* page ta * * Cache attributes with L2 present, S = 1 * T E X C B L1 i-cache L1 d-cache L1 DC WP L2 cacheable write coalesce - * 0 0 0 0 0 N N - N N + * 0 0 0 0 0 N N - N N * 0 0 0 0 1 N N - N Y * 0 0 0 1 0 Y Y - N Y * 0 0 0 1 1 Y Y WT Y Y Modified: head/sys/arm/include/resource.h ============================================================================== --- head/sys/arm/include/resource.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/resource.h Wed Jun 13 05:02:51 2012 (r236992) @@ -12,7 +12,7 @@ * no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. - * + * * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF Modified: head/sys/arm/include/stack.h ============================================================================== --- head/sys/arm/include/stack.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/stack.h Wed Jun 13 05:02:51 2012 (r236992) @@ -5,24 +5,24 @@ * Mach Operating System * Copyright (c) 1991,1990 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * Modified: head/sys/arm/include/vmparam.h ============================================================================== --- head/sys/arm/include/vmparam.h Wed Jun 13 04:59:55 2012 (r236991) +++ head/sys/arm/include/vmparam.h Wed Jun 13 05:02:51 2012 (r236992) @@ -104,7 +104,7 @@ #define VM_MIN_ADDRESS (0x00001000) #ifdef ARM_USE_SMALL_ALLOC -/* +/* * ARM_KERN_DIRECTMAP is used to make sure there's enough space between * VM_MAXUSER_ADDRESS and KERNBASE to map the whole memory. * It has to be a compile-time constant, even if arm_init_smallalloc(), From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 05:39:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 936981065672; Wed, 13 Jun 2012 05:39:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 7E6AD8FC16; Wed, 13 Jun 2012 05:39:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D5dHAO098762; Wed, 13 Jun 2012 05:39:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D5dHRP098758; Wed, 13 Jun 2012 05:39:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206130539.q5D5dHRP098758@svn.freebsd.org> From: Adrian Chadd Date: Wed, 13 Jun 2012 05:39:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236993 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 05:39:17 -0000 Author: adrian Date: Wed Jun 13 05:39:16 2012 New Revision: 236993 URL: http://svn.freebsd.org/changeset/base/236993 Log: Replace the direct sc_txbuf manipulation with a pair of functions. This is preparation work for having a separate ath_buf queue for management traffic. PR: kern/168170 Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_misc.h head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed Jun 13 05:02:51 2012 (r236992) +++ head/sys/dev/ath/if_ath.c Wed Jun 13 05:39:16 2012 (r236993) @@ -2358,7 +2358,7 @@ ath_start(struct ifnet *ifp) IFQ_DEQUEUE(&ifp->if_snd, m); if (m == NULL) { ATH_TXBUF_LOCK(sc); - TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + ath_returnbuf_head(sc, bf); ATH_TXBUF_UNLOCK(sc); break; } @@ -2401,7 +2401,7 @@ ath_start(struct ifnet *ifp) bf->bf_m = NULL; bf->bf_node = NULL; ATH_TXBUF_LOCK(sc); - TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + ath_returnbuf_head(sc, bf); ath_txfrag_cleanup(sc, &frags, ni); ATH_TXBUF_UNLOCK(sc); if (ni != NULL) @@ -3631,6 +3631,24 @@ ath_txq_sched_tasklet(void *arg, int npe ATH_PCU_UNLOCK(sc); } +void +ath_returnbuf_tail(struct ath_softc *sc, struct ath_buf *bf) +{ + + ATH_TXBUF_LOCK_ASSERT(sc); + + TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); +} + +void +ath_returnbuf_head(struct ath_softc *sc, struct ath_buf *bf) +{ + + ATH_TXBUF_LOCK_ASSERT(sc); + + TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); +} + /* * Return a buffer to the pool and update the 'busy' flag on the * previous 'tail' entry. @@ -3653,7 +3671,7 @@ ath_freebuf(struct ath_softc *sc, struct ATH_TXBUF_LOCK(sc); ath_tx_update_busy(sc); - TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); + ath_returnbuf_tail(sc, bf); ATH_TXBUF_UNLOCK(sc); } Modified: head/sys/dev/ath/if_ath_misc.h ============================================================================== --- head/sys/dev/ath/if_ath_misc.h Wed Jun 13 05:02:51 2012 (r236992) +++ head/sys/dev/ath/if_ath_misc.h Wed Jun 13 05:39:16 2012 (r236993) @@ -55,6 +55,8 @@ extern struct ath_buf * _ath_getbuf_lock extern struct ath_buf * ath_buf_clone(struct ath_softc *sc, const struct ath_buf *bf); extern void ath_freebuf(struct ath_softc *sc, struct ath_buf *bf); +extern void ath_returnbuf_head(struct ath_softc *sc, struct ath_buf *bf); +extern void ath_returnbuf_tail(struct ath_softc *sc, struct ath_buf *bf); extern int ath_reset(struct ifnet *, ATH_RESET_TYPE); extern void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq); Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Wed Jun 13 05:02:51 2012 (r236992) +++ head/sys/dev/ath/if_ath_tx.c Wed Jun 13 05:39:16 2012 (r236993) @@ -184,7 +184,7 @@ ath_txfrag_cleanup(struct ath_softc *sc, TAILQ_FOREACH_SAFE(bf, frags, bf_list, next) { /* NB: bf assumed clean */ TAILQ_REMOVE(frags, bf, bf_list); - TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + ath_returnbuf_head(sc, bf); ieee80211_node_decref(ni); } } @@ -1916,7 +1916,7 @@ ath_raw_xmit(struct ieee80211_node *ni, return 0; bad2: ATH_TXBUF_LOCK(sc); - TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + ath_returnbuf_head(sc, bf); ATH_TXBUF_UNLOCK(sc); bad: ATH_PCU_LOCK(sc); @@ -3137,7 +3137,7 @@ ath_tx_retry_clone(struct ath_softc *sc, * the list.) */ ATH_TXBUF_LOCK(sc); - TAILQ_INSERT_HEAD(&sc->sc_txbuf, nbf, bf_list); + ath_returnbuf_head(sc, bf); ATH_TXBUF_UNLOCK(sc); return NULL; } From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 05:41:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1136D1065674; Wed, 13 Jun 2012 05:41:01 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id F148A8FC1A; Wed, 13 Jun 2012 05:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D5f0vt098875; Wed, 13 Jun 2012 05:41:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D5f0Rw098872; Wed, 13 Jun 2012 05:41:00 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206130541.q5D5f0Rw098872@svn.freebsd.org> From: Adrian Chadd Date: Wed, 13 Jun 2012 05:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236994 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 05:41:01 -0000 Author: adrian Date: Wed Jun 13 05:41:00 2012 New Revision: 236994 URL: http://svn.freebsd.org/changeset/base/236994 Log: Oops, return the newly allocated buffer to the queue, not the completed buffer. PR: kern/168170 Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Wed Jun 13 05:39:16 2012 (r236993) +++ head/sys/dev/ath/if_ath_tx.c Wed Jun 13 05:41:00 2012 (r236994) @@ -3137,7 +3137,7 @@ ath_tx_retry_clone(struct ath_softc *sc, * the list.) */ ATH_TXBUF_LOCK(sc); - ath_returnbuf_head(sc, bf); + ath_returnbuf_head(sc, nbf); ATH_TXBUF_UNLOCK(sc); return NULL; } From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 05:47:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E93CD106564A; Wed, 13 Jun 2012 05:47:24 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D4CA78FC15; Wed, 13 Jun 2012 05:47:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D5lOvn099207; Wed, 13 Jun 2012 05:47:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D5lOR8099205; Wed, 13 Jun 2012 05:47:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206130547.q5D5lOR8099205@svn.freebsd.org> From: Adrian Chadd Date: Wed, 13 Jun 2012 05:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236995 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 05:47:25 -0000 Author: adrian Date: Wed Jun 13 05:47:24 2012 New Revision: 236995 URL: http://svn.freebsd.org/changeset/base/236995 Log: Remove a duplicate definition. Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Wed Jun 13 05:41:00 2012 (r236994) +++ head/sys/dev/ath/if_ath_tx_ht.c Wed Jun 13 05:47:24 2012 (r236995) @@ -438,7 +438,6 @@ static void ath_rateseries_setup(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf, HAL_11N_RATE_SERIES *series) { -#define HT_RC_2_STREAMS(_rc) ((((_rc) & 0x78) >> 3) + 1) struct ieee80211com *ic = ni->ni_ic; struct ath_hal *ah = sc->sc_ah; HAL_BOOL shortPreamble = AH_FALSE; @@ -528,7 +527,6 @@ ath_rateseries_setup(struct ath_softc *s rt, pktlen, rc[i].rix, shortPreamble); } } -#undef HT_RC_2_STREAMS } #if 0 From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 06:38:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 719781065674; Wed, 13 Jun 2012 06:38:26 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 5C8B58FC08; Wed, 13 Jun 2012 06:38:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D6cQ4S001666; Wed, 13 Jun 2012 06:38:26 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D6cQvD001663; Wed, 13 Jun 2012 06:38:26 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201206130638.q5D6cQvD001663@svn.freebsd.org> From: Fabien Thomas Date: Wed, 13 Jun 2012 06:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236997 - in head/sys: arm/include dev/hwpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 06:38:26 -0000 Author: fabient Date: Wed Jun 13 06:38:25 2012 New Revision: 236997 URL: http://svn.freebsd.org/changeset/base/236997 Log: Add ARM callchain support for hwpmc. Sponsored by: NETASQ MFC after: 3 days Modified: head/sys/arm/include/pmc_mdep.h head/sys/dev/hwpmc/hwpmc_arm.c Modified: head/sys/arm/include/pmc_mdep.h ============================================================================== --- head/sys/arm/include/pmc_mdep.h Wed Jun 13 06:19:08 2012 (r236996) +++ head/sys/arm/include/pmc_mdep.h Wed Jun 13 06:38:25 2012 (r236997) @@ -50,9 +50,17 @@ union pmc_md_pmc { struct pmc_md_xscale_pmc pm_xscale; }; -#define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_pc) -#define PMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_usr_lr) -#define PMC_TRAPFRAME_TO_SP(TF) ((TF)->tf_usr_sp) +#define PMC_IN_KERNEL_STACK(S,START,END) \ + ((S) >= (START) && (S) < (END)) +#define PMC_IN_KERNEL(va) (((va) >= USRSTACK) && \ + ((va) < VM_MAX_KERNEL_ADDRESS)) + +#define PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS) + +#define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_pc) +#define PMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_r11) +#define PMC_TRAPFRAME_TO_SVC_SP(TF) ((TF)->tf_svc_sp) +#define PMC_TRAPFRAME_TO_USR_SP(TF) ((TF)->tf_usr_sp) /* Build a fake kernel trapframe from current instruction pointer. */ #define PMC_FAKE_TRAPFRAME(TF) \ Modified: head/sys/dev/hwpmc/hwpmc_arm.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_arm.c Wed Jun 13 06:19:08 2012 (r236996) +++ head/sys/dev/hwpmc/hwpmc_arm.c Wed Jun 13 06:38:25 2012 (r236997) @@ -30,10 +30,16 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include -#include +#include #include +#include + +#include +#include +#include struct pmc_mdep * pmc_md_initialize() @@ -58,27 +64,101 @@ pmc_md_finalize(struct pmc_mdep *md) #endif } -static int -pmc_save_callchain(uintptr_t *cc, int maxsamples, - struct trapframe *tf) -{ - - *cc = PMC_TRAPFRAME_TO_PC(tf); - return (1); -} - int pmc_save_kernel_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { + uintptr_t pc, r, stackstart, stackend, fp; + struct thread *td; + int count; + + KASSERT(TRAPF_USERMODE(tf) == 0,("[arm,%d] not a kernel backtrace", + __LINE__)); + + pc = PMC_TRAPFRAME_TO_PC(tf); + *cc++ = pc; + + if ((td = curthread) == NULL) + return (1); + + if (maxsamples <= 1) + return (1); + + stackstart = (uintptr_t) td->td_kstack; + stackend = (uintptr_t) td->td_kstack + td->td_kstack_pages * PAGE_SIZE; + fp = PMC_TRAPFRAME_TO_FP(tf); + + if (!PMC_IN_KERNEL(pc) || + !PMC_IN_KERNEL_STACK(fp, stackstart, stackend)) + return (1); + + for (count = 1; count < maxsamples; count++) { + /* Use saved lr as pc. */ + r = fp - sizeof(uintptr_t); + if (!PMC_IN_KERNEL_STACK(r, stackstart, stackend)) + break; + pc = *(uintptr_t *)r; + if (!PMC_IN_KERNEL(pc)) + break; + + *cc++ = pc; + + /* Switch to next frame up */ + r = fp - 3 * sizeof(uintptr_t); + if (!PMC_IN_KERNEL_STACK(r, stackstart, stackend)) + break; + fp = *(uintptr_t *)r; + if (!PMC_IN_KERNEL_STACK(fp, stackstart, stackend)) + break; + } - return pmc_save_callchain(cc, maxsamples, tf); + return (count); } int pmc_save_user_callchain(uintptr_t *cc, int maxsamples, struct trapframe *tf) { + uintptr_t pc, r, oldfp, fp; + struct thread *td; + int count; + + KASSERT(TRAPF_USERMODE(tf), ("[x86,%d] Not a user trap frame tf=%p", + __LINE__, (void *) tf)); + + pc = PMC_TRAPFRAME_TO_PC(tf); + *cc++ = pc; + + if ((td = curthread) == NULL) + return (1); + + if (maxsamples <= 1) + return (1); + + oldfp = fp = PMC_TRAPFRAME_TO_FP(tf); + + if (!PMC_IN_USERSPACE(pc) || + !PMC_IN_USERSPACE(fp)) + return (1); + + for (count = 1; count < maxsamples; count++) { + /* Use saved lr as pc. */ + r = fp - sizeof(uintptr_t); + if (copyin((void *)r, &pc, sizeof(pc)) != 0) + break; + if (!PMC_IN_USERSPACE(pc)) + break; + + *cc++ = pc; + + /* Switch to next frame up */ + oldfp = fp; + r = fp - 3 * sizeof(uintptr_t); + if (copyin((void *)r, &fp, sizeof(fp)) != 0) + break; + if (fp < oldfp || !PMC_IN_USERSPACE(fp)) + break; + } - return pmc_save_callchain(cc, maxsamples, tf); + return (count); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 06:42:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9DAD0106568A; Wed, 13 Jun 2012 06:42:36 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8890B8FC18; Wed, 13 Jun 2012 06:42:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D6gaaY001894; Wed, 13 Jun 2012 06:42:36 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D6ga9v001892; Wed, 13 Jun 2012 06:42:36 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201206130642.q5D6ga9v001892@svn.freebsd.org> From: Fabien Thomas Date: Wed, 13 Jun 2012 06:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236998 - stable/9/usr.sbin/pmcstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 06:42:36 -0000 Author: fabient Date: Wed Jun 13 06:42:36 2012 New Revision: 236998 URL: http://svn.freebsd.org/changeset/base/236998 Log: MFC r236669: Remove spurious ARM symbols from lookup table. Modified: stable/9/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/9/usr.sbin/pmcstat/ (props changed) Modified: stable/9/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcstat_log.c Wed Jun 13 06:38:25 2012 (r236997) +++ stable/9/usr.sbin/pmcstat/pmcstat_log.c Wed Jun 13 06:42:36 2012 (r236998) @@ -554,6 +554,14 @@ pmcstat_image_add_symbols(struct pmcstat if ((fnname = elf_strptr(e, sh->sh_link, sym.st_name)) == NULL) continue; +#ifdef __arm__ + /* Remove spurious ARM function name. */ + if (fnname[0] == '$' && + (fnname[1] == 'a' || fnname[1] == 't' || + fnname[1] == 'd') && + fnname[2] == '\0') + continue; +#endif symptr->ps_name = pmcstat_string_intern(fnname); symptr->ps_start = sym.st_value - image->pi_vaddr; From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 06:46:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A212C106564A; Wed, 13 Jun 2012 06:46:00 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8E1028FC08; Wed, 13 Jun 2012 06:46:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D6k013002089; Wed, 13 Jun 2012 06:46:00 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D6k0FV002086; Wed, 13 Jun 2012 06:46:00 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206130646.q5D6k0FV002086@svn.freebsd.org> From: Eitan Adler Date: Wed, 13 Jun 2012 06:46:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236999 - head/share/examples/csh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 06:46:00 -0000 Author: eadler Date: Wed Jun 13 06:46:00 2012 New Revision: 236999 URL: http://svn.freebsd.org/changeset/base/236999 Log: Include a warning when using the example code as it may not work in unusual situations. Also slightly optimize the command. Submitted by: Jeremy Chadwick jdc@koitsu.org Approved by: cperciva (implicit) MFC after: 1 week Modified: head/share/examples/csh/dot.cshrc Modified: head/share/examples/csh/dot.cshrc ============================================================================== --- head/share/examples/csh/dot.cshrc Wed Jun 13 06:42:36 2012 (r236998) +++ head/share/examples/csh/dot.cshrc Wed Jun 13 06:46:00 2012 (r236999) @@ -4,8 +4,12 @@ # # Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running +# +# This has a couple caveats, the most notable being that if a user +# has multiple ssh-agent(1) processes running, this will very likely +# set SSH_AUTH_SOCK to point to the wrong file/domain socket. if (${?SSH_AUTH_SOCK} != "1") then - setenv SSH_AUTH_SOCK `sockstat | grep "^${USER} " | awk '/ssh-agent/ { print $6 }'` + setenv SSH_AUTH_SOCK `sockstat -u | awk '/^${USER}.+ ssh-agent/ { print $6 }' endif # Change only root's prompt From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 06:57:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D571A1065675; Wed, 13 Jun 2012 06:57:55 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BFDF68FC12; Wed, 13 Jun 2012 06:57:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D6vtF2002642; Wed, 13 Jun 2012 06:57:55 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D6vteo002636; Wed, 13 Jun 2012 06:57:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206130657.q5D6vteo002636@svn.freebsd.org> From: Adrian Chadd Date: Wed, 13 Jun 2012 06:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237000 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 06:57:55 -0000 Author: adrian Date: Wed Jun 13 06:57:55 2012 New Revision: 237000 URL: http://svn.freebsd.org/changeset/base/237000 Log: Implement a separate, smaller pool of ath_buf entries for use by management traffic. * Create sc_mgmt_txbuf and sc_mgmt_txdesc, initialise/free them appropriately. * Create an enum to represent buffer types in the API. * Extend ath_getbuf() and _ath_getbuf_locked() to take the above enum. * Right now anything sent via ic_raw_xmit() allocates via ATH_BUFTYPE_MGMT. This may not be very useful. * Add ATH_BUF_MGMT flag (ath_buf.bf_flags) which indicates the current buffer is a mgmt buffer and should go back onto the mgmt free list. * Extend 'txagg' to include debugging output for both normal and mgmt txbufs. * When checking/clearing ATH_BUF_BUSY, do it on both TX pools. Tested: * STA mode, with heavy UDP injection via iperf. This filled the TX queue however BARs were still going out successfully. TODO: * Initialise the mgmt buffers with ATH_BUF_MGMT and then ensure the right type is being allocated and freed on the appropriate list. That'd save a write operation (to bf->bf_flags) on each buffer alloc/free. * Test on AP mode, ensure that BAR TX and probe responses go out nicely when the main TX queue is filled (eg with paused traffic to a TID, awaiting a BAR to complete.) PR: kern/168170 Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_misc.h head/sys/dev/ath/if_ath_sysctl.c head/sys/dev/ath/if_ath_tx.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed Jun 13 06:46:00 2012 (r236999) +++ head/sys/dev/ath/if_ath.c Wed Jun 13 06:57:55 2012 (r237000) @@ -246,6 +246,10 @@ static int ath_txbuf = ATH_TXBUF; /* # SYSCTL_INT(_hw_ath, OID_AUTO, txbuf, CTLFLAG_RW, &ath_txbuf, 0, "tx buffers allocated"); TUNABLE_INT("hw.ath.txbuf", &ath_txbuf); +static int ath_txbuf_mgmt = ATH_MGMT_TXBUF; /* # mgmt tx buffers to allocate */ +SYSCTL_INT(_hw_ath, OID_AUTO, txbuf_mgmt, CTLFLAG_RW, &ath_txbuf_mgmt, + 0, "tx (mgmt) buffers allocated"); +TUNABLE_INT("hw.ath.txbuf_mgmt", &ath_txbuf_mgmt); int ath_bstuck_threshold = 4; /* max missed beacons */ SYSCTL_INT(_hw_ath, OID_AUTO, bstuck, CTLFLAG_RW, &ath_bstuck_threshold, @@ -2212,13 +2216,17 @@ ath_reset_vap(struct ieee80211vap *vap, } struct ath_buf * -_ath_getbuf_locked(struct ath_softc *sc) +_ath_getbuf_locked(struct ath_softc *sc, ath_buf_type_t btype) { struct ath_buf *bf; ATH_TXBUF_LOCK_ASSERT(sc); - bf = TAILQ_FIRST(&sc->sc_txbuf); + if (btype == ATH_BUFTYPE_MGMT) + bf = TAILQ_FIRST(&sc->sc_txbuf_mgmt); + else + bf = TAILQ_FIRST(&sc->sc_txbuf); + if (bf == NULL) { sc->sc_stats.ast_tx_getnobuf++; } else { @@ -2228,18 +2236,29 @@ _ath_getbuf_locked(struct ath_softc *sc) } } - if (bf != NULL && (bf->bf_flags & ATH_BUF_BUSY) == 0) - TAILQ_REMOVE(&sc->sc_txbuf, bf, bf_list); - else + if (bf != NULL && (bf->bf_flags & ATH_BUF_BUSY) == 0) { + if (btype == ATH_BUFTYPE_MGMT) + TAILQ_REMOVE(&sc->sc_txbuf_mgmt, bf, bf_list); + else + TAILQ_REMOVE(&sc->sc_txbuf, bf, bf_list); + } else bf = NULL; if (bf == NULL) { + /* XXX should check which list, mgmt or otherwise */ DPRINTF(sc, ATH_DEBUG_XMIT, "%s: %s\n", __func__, TAILQ_FIRST(&sc->sc_txbuf) == NULL ? "out of xmit buffers" : "xmit buffer busy"); return NULL; } + /* XXX TODO: should do this at buffer list initialisation */ + /* XXX (then, ensure the buffer has the right flag set) */ + if (btype == ATH_BUFTYPE_MGMT) + bf->bf_flags |= ATH_BUF_MGMT; + else + bf->bf_flags &= (~ATH_BUF_MGMT); + /* Valid bf here; clear some basic fields */ bf->bf_next = NULL; /* XXX just to be sure */ bf->bf_last = NULL; /* XXX again, just to be sure */ @@ -2274,7 +2293,9 @@ ath_buf_clone(struct ath_softc *sc, cons { struct ath_buf *tbf; - tbf = ath_getbuf(sc); + tbf = ath_getbuf(sc, + (bf->bf_flags & ATH_BUF_MGMT) ? + ATH_BUFTYPE_MGMT : ATH_BUFTYPE_NORMAL); if (tbf == NULL) return NULL; /* XXX failure? Why? */ @@ -2302,12 +2323,18 @@ ath_buf_clone(struct ath_softc *sc, cons } struct ath_buf * -ath_getbuf(struct ath_softc *sc) +ath_getbuf(struct ath_softc *sc, ath_buf_type_t btype) { struct ath_buf *bf; ATH_TXBUF_LOCK(sc); - bf = _ath_getbuf_locked(sc); + bf = _ath_getbuf_locked(sc, btype); + /* + * If a mgmt buffer was requested but we're out of those, + * try requesting a normal one. + */ + if (bf == NULL && btype == ATH_BUFTYPE_MGMT) + bf = _ath_getbuf_locked(sc, ATH_BUFTYPE_NORMAL); ATH_TXBUF_UNLOCK(sc); if (bf == NULL) { struct ifnet *ifp = sc->sc_ifp; @@ -2351,7 +2378,7 @@ ath_start(struct ifnet *ifp) /* * Grab a TX buffer and associated resources. */ - bf = ath_getbuf(sc); + bf = ath_getbuf(sc, ATH_BUFTYPE_NORMAL); if (bf == NULL) break; @@ -2857,11 +2884,26 @@ ath_desc_alloc(struct ath_softc *sc) return error; } + error = ath_descdma_setup(sc, &sc->sc_txdma_mgmt, &sc->sc_txbuf_mgmt, + "tx_mgmt", ath_txbuf_mgmt, ATH_TXDESC); + if (error != 0) { + ath_descdma_cleanup(sc, &sc->sc_rxdma, &sc->sc_rxbuf); + ath_descdma_cleanup(sc, &sc->sc_txdma, &sc->sc_txbuf); + return error; + } + + /* + * XXX mark txbuf_mgmt frames with ATH_BUF_MGMT, so the + * flag doesn't have to be set in ath_getbuf_locked(). + */ + error = ath_descdma_setup(sc, &sc->sc_bdma, &sc->sc_bbuf, "beacon", ATH_BCBUF, 1); if (error != 0) { - ath_descdma_cleanup(sc, &sc->sc_txdma, &sc->sc_txbuf); ath_descdma_cleanup(sc, &sc->sc_rxdma, &sc->sc_rxbuf); + ath_descdma_cleanup(sc, &sc->sc_txdma, &sc->sc_txbuf); + ath_descdma_cleanup(sc, &sc->sc_txdma_mgmt, + &sc->sc_txbuf_mgmt); return error; } return 0; @@ -2877,6 +2919,9 @@ ath_desc_free(struct ath_softc *sc) ath_descdma_cleanup(sc, &sc->sc_txdma, &sc->sc_txbuf); if (sc->sc_rxdma.dd_desc_len != 0) ath_descdma_cleanup(sc, &sc->sc_rxdma, &sc->sc_rxbuf); + if (sc->sc_txdma_mgmt.dd_desc_len != 0) + ath_descdma_cleanup(sc, &sc->sc_txdma_mgmt, + &sc->sc_txbuf_mgmt); } static struct ieee80211_node * @@ -3323,12 +3368,14 @@ ath_tx_update_busy(struct ath_softc *sc) * descriptor. */ ATH_TXBUF_LOCK_ASSERT(sc); + last = TAILQ_LAST(&sc->sc_txbuf_mgmt, ath_bufhead_s); + if (last != NULL) + last->bf_flags &= ~ATH_BUF_BUSY; last = TAILQ_LAST(&sc->sc_txbuf, ath_bufhead_s); if (last != NULL) last->bf_flags &= ~ATH_BUF_BUSY; } - /* * Process completed xmit descriptors from the specified queue. * Kick the packet scheduler if needed. This can occur from this @@ -3637,7 +3684,10 @@ ath_returnbuf_tail(struct ath_softc *sc, ATH_TXBUF_LOCK_ASSERT(sc); - TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); + if (bf->bf_flags & ATH_BUF_MGMT) + TAILQ_INSERT_TAIL(&sc->sc_txbuf_mgmt, bf, bf_list); + else + TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); } void @@ -3646,7 +3696,10 @@ ath_returnbuf_head(struct ath_softc *sc, ATH_TXBUF_LOCK_ASSERT(sc); - TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + if (bf->bf_flags & ATH_BUF_MGMT) + TAILQ_INSERT_HEAD(&sc->sc_txbuf_mgmt, bf, bf_list); + else + TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); } /* @@ -3727,6 +3780,9 @@ ath_tx_draintxq(struct ath_softc *sc, st bf = TAILQ_LAST(&sc->sc_txbuf, ath_bufhead_s); if (bf != NULL) bf->bf_flags &= ~ATH_BUF_BUSY; + bf = TAILQ_LAST(&sc->sc_txbuf_mgmt, ath_bufhead_s); + if (bf != NULL) + bf->bf_flags &= ~ATH_BUF_BUSY; ATH_TXBUF_UNLOCK(sc); for (ix = 0;; ix++) { Modified: head/sys/dev/ath/if_ath_misc.h ============================================================================== --- head/sys/dev/ath/if_ath_misc.h Wed Jun 13 06:46:00 2012 (r236999) +++ head/sys/dev/ath/if_ath_misc.h Wed Jun 13 06:57:55 2012 (r237000) @@ -50,10 +50,13 @@ extern int ath_tx_findrix(const struct ath_softc *sc, uint8_t rate); -extern struct ath_buf * ath_getbuf(struct ath_softc *sc); -extern struct ath_buf * _ath_getbuf_locked(struct ath_softc *sc); +extern struct ath_buf * ath_getbuf(struct ath_softc *sc, + ath_buf_type_t btype); +extern struct ath_buf * _ath_getbuf_locked(struct ath_softc *sc, + ath_buf_type_t btype); extern struct ath_buf * ath_buf_clone(struct ath_softc *sc, const struct ath_buf *bf); +/* XXX change this to NULL the buffer pointer? */ extern void ath_freebuf(struct ath_softc *sc, struct ath_buf *bf); extern void ath_returnbuf_head(struct ath_softc *sc, struct ath_buf *bf); extern void ath_returnbuf_tail(struct ath_softc *sc, struct ath_buf *bf); Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Wed Jun 13 06:46:00 2012 (r236999) +++ head/sys/dev/ath/if_ath_sysctl.c Wed Jun 13 06:57:55 2012 (r237000) @@ -377,6 +377,19 @@ ath_sysctl_txagg(SYSCTL_HANDLER_ARGS) printf("Total TX buffers: %d; Total TX buffers busy: %d\n", t, i); + i = t = 0; + ATH_TXBUF_LOCK(sc); + TAILQ_FOREACH(bf, &sc->sc_txbuf_mgmt, bf_list) { + if (bf->bf_flags & ATH_BUF_BUSY) { + printf("Busy: %d\n", t); + i++; + } + t++; + } + ATH_TXBUF_UNLOCK(sc); + printf("Total mgmt TX buffers: %d; Total mgmt TX buffers busy: %d\n", + t, i); + return 0; } Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Wed Jun 13 06:46:00 2012 (r236999) +++ head/sys/dev/ath/if_ath_tx.c Wed Jun 13 06:57:55 2012 (r237000) @@ -203,7 +203,8 @@ ath_txfrag_setup(struct ath_softc *sc, a ATH_TXBUF_LOCK(sc); for (m = m0->m_nextpkt; m != NULL; m = m->m_nextpkt) { - bf = _ath_getbuf_locked(sc); + /* XXX non-management? */ + bf = _ath_getbuf_locked(sc, ATH_BUFTYPE_NORMAL); if (bf == NULL) { /* out of buffers, cleanup */ device_printf(sc->sc_dev, "%s: no buffer?\n", __func__); @@ -1878,7 +1879,7 @@ ath_raw_xmit(struct ieee80211_node *ni, /* * Grab a TX buffer and associated resources. */ - bf = ath_getbuf(sc); + bf = ath_getbuf(sc, ATH_BUFTYPE_MGMT); if (bf == NULL) { sc->sc_stats.ast_tx_nobuf++; m_freem(m); Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Wed Jun 13 06:46:00 2012 (r236999) +++ head/sys/dev/ath/if_athvar.h Wed Jun 13 06:57:55 2012 (r237000) @@ -44,6 +44,14 @@ #define ATH_TIMEOUT 1000 /* + * There is a separate TX ath_buf pool for management frames. + * This ensures that management frames such as probe responses + * and BAR frames can be transmitted during periods of high + * TX activity. + */ +#define ATH_MGMT_TXBUF 32 + +/* * 802.11n requires more TX and RX buffers to do AMPDU. */ #ifdef ATH_ENABLE_11N @@ -172,6 +180,11 @@ struct ath_node { ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul)) #define ATH_RSSI(x) ATH_EP_RND(x, HAL_RSSI_EP_MULTIPLIER) +typedef enum { + ATH_BUFTYPE_NORMAL = 0, + ATH_BUFTYPE_MGMT = 1, +} ath_buf_type_t; + struct ath_buf { TAILQ_ENTRY(ath_buf) bf_list; struct ath_buf * bf_next; /* next buffer in the aggregate */ @@ -243,6 +256,7 @@ struct ath_buf { }; typedef TAILQ_HEAD(ath_bufhead_s, ath_buf) ath_bufhead; +#define ATH_BUF_MGMT 0x00000001 /* (tx) desc is a mgmt desc */ #define ATH_BUF_BUSY 0x00000002 /* (tx) desc owned by h/w */ /* @@ -487,6 +501,8 @@ struct ath_softc { struct ath_descdma sc_txdma; /* TX descriptors */ ath_bufhead sc_txbuf; /* transmit buffer */ + struct ath_descdma sc_txdma_mgmt; /* mgmt TX descriptors */ + ath_bufhead sc_txbuf_mgmt; /* mgmt transmit buffer */ struct mtx sc_txbuflock; /* txbuf lock */ char sc_txname[12]; /* e.g. "ath0_buf" */ u_int sc_txqsetup; /* h/w queues setup */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 07:18:10 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 70DA11065676; Wed, 13 Jun 2012 07:18:10 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id DCD8D8FC19; Wed, 13 Jun 2012 07:18:09 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 9334349D; Wed, 13 Jun 2012 09:18:08 +0200 (CEST) Date: Wed, 13 Jun 2012 09:16:13 +0200 From: Pawel Jakub Dawidek To: Andrey Chernov , Bruce Evans , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20120613071613.GA1386@garage.freebsd.pl> References: <201206112017.q5BKHKsW007722@svn.freebsd.org> <20120612114254.V1572@besplex.bde.org> <20120612115117.GB1372@garage.freebsd.pl> <20120613115111.R5323@besplex.bde.org> <20120613040900.GA88971@vniz.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cWoXeonUoKmBZSoM" Content-Disposition: inline In-Reply-To: <20120613040900.GA88971@vniz.net> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: svn commit: r236917 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 07:18:10 -0000 --cWoXeonUoKmBZSoM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 13, 2012 at 08:09:01AM +0400, Andrey Chernov wrote: > On Wed, Jun 13, 2012 at 12:37:50PM +1000, Bruce Evans wrote: > > >> On Mon, 11 Jun 2012, Pawel Jakub Dawidek wrote: > > >>> - KASSERT(fd >=3D 0 && fd < fdp->fd_nfiles, > > >>> + KASSERT((unsigned int)fd < fdp->fd_nfiles, > > >>> ("file descriptor %d out of range (0, %d)", fd, fdp->fd= _nfiles)); > > >>> return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) !=3D 0); > > >>> } > > >> > > >> This is backwards. Apart from using the worst possible (most verbos= e) > > >> spelling of `unsigned', it uses a type hack manually optimize away t= he > > >> test for fd being < 0. The compiler will do this "optimization" > > >> automatically if it is any good (or undo it if it is not), so all the > > >> hack does is obfuscate the test. With the verbose spelling of u_int, > > >> it even takes more space. > > > > > > Well, to be honest I presonally would prefer explicit check for fd be= ing > > > less than 0, but my impression was that using cast is the most popular > > > way and I wanted this check to be consistent across our source tree. > > > > > > Feel free to change it. > >=20 > > I'm only free to ask you to back out it out. >=20 > I agree that this change should backed out for better. It gains nothing= =20 > for modern compilers, but makes code reading harder.=20 Maybe I'll try again. I much prefer checking fd explicitly for being less than zero than using cast. The thing is using cast is the most popular method for that check. I decided to use that method as it was the least discruptive way of gaining consistency. For me, when I was reading the code it was more confusing to see different methods of checking if fd is valid than to see less pretty, but consistent, method everywhere. Backing it out would mean that we will use better method in some places, but reintroduce inconsistency and I don't want to do that. I also don't want to convert all such checks to more pretty method, as people may work in this area and I'll just add more conflicts to them to resolve. I'm experimenting with some changes in perforce. If the experiment succeeds I'll end up changing a lot of code in this area, which will allow me to convert all the checks to the preferred method. If in the meantime one of you would like to change it, be prepare that people might not be happy and can start to scream. I'll try not to. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --cWoXeonUoKmBZSoM Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/YPj0ACgkQForvXbEpPzSxNgCaAgqHdbqH8KABZNZzwZRNeJ7c 5tUAoOJT1Dr8t1c5MScFnTOb63/joZG6 =QX90 -----END PGP SIGNATURE----- --cWoXeonUoKmBZSoM-- From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 08:00:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 93729106566B; Wed, 13 Jun 2012 08:00:33 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 7FCD88FC12; Wed, 13 Jun 2012 08:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5D80XGC005402; Wed, 13 Jun 2012 08:00:33 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5D80XGY005400; Wed, 13 Jun 2012 08:00:33 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206130800.q5D80XGY005400@svn.freebsd.org> From: Martin Matuska Date: Wed, 13 Jun 2012 08:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237001 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 08:00:33 -0000 Author: mm Date: Wed Jun 13 08:00:32 2012 New Revision: 237001 URL: http://svn.freebsd.org/changeset/base/237001 Log: Fix ZFS boot with pre-features pools (version <= 28) broken in r236884 Reported by: mav MFC after: 1 month Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Wed Jun 13 06:57:55 2012 (r237000) +++ head/sys/boot/zfs/zfsimpl.c Wed Jun 13 08:00:32 2012 (r237001) @@ -888,9 +888,10 @@ vdev_probe(vdev_phys_read_t *read, void } /* Check ZFS features for read */ - rc = nvlist_find(nvlist, ZPOOL_CONFIG_FEATURES_FOR_READ, - DATA_TYPE_NVLIST, 0, &features); - if (nvlist_check_features_for_read(features) != 0) + if (nvlist_find(nvlist, + ZPOOL_CONFIG_FEATURES_FOR_READ, + DATA_TYPE_NVLIST, 0, &features) == 0 + && nvlist_check_features_for_read(features) != 0) return (EIO); if (nvlist_find(nvlist, From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 09:38:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1CE681065670; Wed, 13 Jun 2012 09:38:24 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 03E238FC16; Wed, 13 Jun 2012 09:38:22 +0000 (UTC) Received: by eabm6 with SMTP id m6so126713eab.13 for ; Wed, 13 Jun 2012 02:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=16BDir8t0FhqOGueHJJCyURTSw4Kgyb0vpNjBN5YkwU=; b=hHKgh2qsN+I7dYWJGKiHxyWp8tP2A59m2kBly6bb/w0hKXYHEvbkJvjbmorv6kV1Ng L0xV5Z0JMNsg3bKiRDJVdNPAqKMdjGDfW9M2m9zF5j1xwO1UyMLnO9/yqPklxLSGmDxW L5Pn2b4x/emj7gpx6ozwZvS6MCeTrLA69T1bpkIXubmOLDG0QRjJdg34uoTFymZroS7Z dDKLL7jQLwo7ed1GU7zteKmpucMFqM9CyzqpLDZKLXBitKp5CzfbwrmMPVuB4+UYMpoS QlslEUeVNLcC1cbiWCNJORX3L6d1h3xnEyDUvGApzkFuavXUfVBHy4DxHC5pFh5dZsL4 b+7w== Received: by 10.14.47.3 with SMTP id s3mr7899539eeb.127.1339580301848; Wed, 13 Jun 2012 02:38:21 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id t3sm5341598eeb.15.2012.06.13.02.38.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jun 2012 02:38:15 -0700 (PDT) Date: Wed, 13 Jun 2012 11:38:07 +0200 From: Mateusz Guzik To: Pawel Jakub Dawidek Message-ID: <20120613093807.GA3893@dft-labs.eu> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> <20120612214400.GB1429@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120612214400.GB1429@garage.freebsd.pl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 09:38:24 -0000 On Tue, Jun 12, 2012 at 11:44:00PM +0200, Pawel Jakub Dawidek wrote: > On Tue, Jun 12, 2012 at 09:18:28PM +0200, Mateusz Guzik wrote: > > On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote: > > > Look good and you can just add 'In co-operation with: pjd'. > > > One minor thing is that fd_first_free() can return 'size' if there are > > > no free slots available. Could you include that in the comment as well? > > > > > > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch > > Ok. Merge racct_set() call into one line, it now fits into 80 chars. > I have no more objections. > This patch contains terrible brain-o: if (fd >= fdp->fd_nfiles) { allocfd = 2 * max(fdp->fd_nfiles, fd); allocfd is always 2 * fd, which I think is ok, just no reason to compare again with fdp->fd_nfiles. Also the patch can be simplified. fdp xlock is held for whole duration of fdalloc. Code: fdgrowtable(fdp, min(allocfd, maxfd)); /* Retry... */ fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); if (fd >= maxfd) return (EMFILE); fdgrowtable never fails and when we call it we know that new fd will fit in the table. In case of no free entries fd_first_free returns size, which coressponds to first newly allocated fd after growth. So fd after table growth is already the first free descriptor that can be used and would be returned by another call to fd_first_free. To sum up: http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free4.patch Any comments? Thanks, -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 10:30:57 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E8E29106566B; Wed, 13 Jun 2012 10:30:57 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 911518FC16; Wed, 13 Jun 2012 10:30:57 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 1E889520; Wed, 13 Jun 2012 12:30:56 +0200 (CEST) Date: Wed, 13 Jun 2012 12:29:01 +0200 From: Pawel Jakub Dawidek To: Mateusz Guzik Message-ID: <20120613102900.GD1386@garage.freebsd.pl> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> <20120612214400.GB1429@garage.freebsd.pl> <20120613093807.GA3893@dft-labs.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="p2kqVDKq5asng8Dg" Content-Disposition: inline In-Reply-To: <20120613093807.GA3893@dft-labs.eu> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 10:30:58 -0000 --p2kqVDKq5asng8Dg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 13, 2012 at 11:38:07AM +0200, Mateusz Guzik wrote: > On Tue, Jun 12, 2012 at 11:44:00PM +0200, Pawel Jakub Dawidek wrote: > > On Tue, Jun 12, 2012 at 09:18:28PM +0200, Mateusz Guzik wrote: > > > On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote: > > > > Look good and you can just add 'In co-operation with: pjd'. > > > > One minor thing is that fd_first_free() can return 'size' if there = are > > > > no free slots available. Could you include that in the comment as w= ell? > > > >=20 > > >=20 > > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch > >=20 > > Ok. Merge racct_set() call into one line, it now fits into 80 chars. > > I have no more objections. > >=20 >=20 > This patch contains terrible brain-o: >=20 > if (fd >=3D fdp->fd_nfiles) { > allocfd =3D 2 * max(fdp->fd_nfiles, fd); >=20 > allocfd is always 2 * fd, which I think is ok, just no reason to compare > again with fdp->fd_nfiles. >=20 > Also the patch can be simplified. >=20 > fdp xlock is held for whole duration of fdalloc. >=20 > Code: > fdgrowtable(fdp, min(allocfd, maxfd)); > /* Retry... */ > fd =3D fd_first_free(fdp, minfd, fdp->fd_nfiles); > if (fd >=3D maxfd) > return (EMFILE); >=20 > fdgrowtable never fails and when we call it we know that new fd will fit > in the table. In case of no free entries fd_first_free returns size, > which coressponds to first newly allocated fd after growth. So fd after > table growth is already the first free descriptor that can be used and > would be returned by another call to fd_first_free. >=20 > To sum up: > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free4.patch >=20 > Any comments? All makes sense and the code looks good, but I'd love to see such an explanation in the code as well (below or above fdgrowtable() call). --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --p2kqVDKq5asng8Dg Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/Ya2wACgkQForvXbEpPzQXXgCg4w58aYAPKd6Sme7c6LdJgekn BW4An0Qlnq5YQeM+VHwawpBcw8ScVm9s =aGeV -----END PGP SIGNATURE----- --p2kqVDKq5asng8Dg-- From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 10:53:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6D6401065670; Wed, 13 Jun 2012 10:53:55 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3EFC18FC17; Wed, 13 Jun 2012 10:53:54 +0000 (UTC) Received: by eeke49 with SMTP id e49so162383eek.13 for ; Wed, 13 Jun 2012 03:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=40EiSlTavIZfLXH/c3ZBh4wDYpU6Yq2r3Cr2mz10Hy8=; b=Ldtr/ESX5Cy7aFD0pqiFkzJOxoSF2yfo8STn5/P6Qwt9fuzhwus8JpIcRsumCiT6OV 5OuTqWEekNN2AwAfGRU7r4HEUQGAqaecjI9kvzyBrc4hpbgkx66XtfFFiBvz+Aqew5kp v6YgNCxTAj6Lhtch298luKSkUm8xFgIfSAASQZA3JCX12PeAnPt61rKOx4t6A2e0NrsH /N5wK61ZHlrRWqfinJOROu5itaTNQGOXUE/HSNePfCe7Ez1kowAFCK4QYL9dtZl7aXaw X4kdBrk5mtGLjqvUo38z034vtXsgI83dZ4aoCBet2luDRvFLOLUX5zoHPsjPKN6bOZbM 1BYw== Received: by 10.14.97.137 with SMTP id t9mr7890617eef.73.1339584833303; Wed, 13 Jun 2012 03:53:53 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id c42sm6143642eeb.2.2012.06.13.03.53.51 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jun 2012 03:53:52 -0700 (PDT) Date: Wed, 13 Jun 2012 12:53:44 +0200 From: Mateusz Guzik To: Pawel Jakub Dawidek Message-ID: <20120613105344.GB3893@dft-labs.eu> References: <201206112205.q5BM5QIv013266@svn.freebsd.org> <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> <20120612214400.GB1429@garage.freebsd.pl> <20120613093807.GA3893@dft-labs.eu> <20120613102900.GD1386@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120613102900.GD1386@garage.freebsd.pl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 10:53:55 -0000 On Wed, Jun 13, 2012 at 12:29:01PM +0200, Pawel Jakub Dawidek wrote: > On Wed, Jun 13, 2012 at 11:38:07AM +0200, Mateusz Guzik wrote: > > On Tue, Jun 12, 2012 at 11:44:00PM +0200, Pawel Jakub Dawidek wrote: > > > On Tue, Jun 12, 2012 at 09:18:28PM +0200, Mateusz Guzik wrote: > > > > On Tue, Jun 12, 2012 at 06:01:29PM +0200, Pawel Jakub Dawidek wrote: > > > > > Look good and you can just add 'In co-operation with: pjd'. > > > > > One minor thing is that fd_first_free() can return 'size' if there are > > > > > no free slots available. Could you include that in the comment as well? > > > > > > > > > > > > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free2.patch > > > > > > Ok. Merge racct_set() call into one line, it now fits into 80 chars. > > > I have no more objections. > > > > > > > This patch contains terrible brain-o: > > > > if (fd >= fdp->fd_nfiles) { > > allocfd = 2 * max(fdp->fd_nfiles, fd); > > > > allocfd is always 2 * fd, which I think is ok, just no reason to compare > > again with fdp->fd_nfiles. > > > > Also the patch can be simplified. > > > > fdp xlock is held for whole duration of fdalloc. > > > > Code: > > fdgrowtable(fdp, min(allocfd, maxfd)); > > /* Retry... */ > > fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); > > if (fd >= maxfd) > > return (EMFILE); > > > > fdgrowtable never fails and when we call it we know that new fd will fit > > in the table. In case of no free entries fd_first_free returns size, > > which coressponds to first newly allocated fd after growth. So fd after > > table growth is already the first free descriptor that can be used and > > would be returned by another call to fd_first_free. > > > > To sum up: > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free4.patch > > > > Any comments? > > All makes sense and the code looks good, but I'd love to see such an > explanation in the code as well (below or above fdgrowtable() call). > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free5.patch David reported that previous version of the patch fixed panic he was experiencing, so I consider the patch tested. Thanks, -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 11:15:05 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 83419106566C; Wed, 13 Jun 2012 11:15:05 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 2962A8FC1B; Wed, 13 Jun 2012 11:15:05 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 1C503553; Wed, 13 Jun 2012 13:15:04 +0200 (CEST) Date: Wed, 13 Jun 2012 13:13:09 +0200 From: Pawel Jakub Dawidek To: Mateusz Guzik Message-ID: <20120613111309.GE1386@garage.freebsd.pl> References: <4FD6FD39.5090800@gmail.com> <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> <20120612214400.GB1429@garage.freebsd.pl> <20120613093807.GA3893@dft-labs.eu> <20120613102900.GD1386@garage.freebsd.pl> <20120613105344.GB3893@dft-labs.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J5MfuwkIyy7RmF4Q" Content-Disposition: inline In-Reply-To: <20120613105344.GB3893@dft-labs.eu> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 11:15:05 -0000 --J5MfuwkIyy7RmF4Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 13, 2012 at 12:53:44PM +0200, Mateusz Guzik wrote: > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free5.patch >=20 > David reported that previous version of the patch fixed panic he was > experiencing, so I consider the patch tested. Looks good, one (hopefully last) minor nit. I'd change this comment: * Search the bitmap for a free descriptor starting at minfd. If none * is found, try to grow the file table. To something like this: * Search the bitmap for a free descriptor starting at minfd. * If none is found, grow the file table. 'try' is a bit misleading for my taste, as it suggest that growing the file table might fail, I think. That's all from me:) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --J5MfuwkIyy7RmF4Q Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/YdcQACgkQForvXbEpPzRz9ACdGv4lUkw6NG7Ec6wDW9dKdDmZ vGIAoJY1XtySkVRuV5bZCxLwKvd2HZ8m =+RpD -----END PGP SIGNATURE----- --J5MfuwkIyy7RmF4Q-- From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 11:19:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7FB21106564A; Wed, 13 Jun 2012 11:19:04 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 677828FC14; Wed, 13 Jun 2012 11:19:03 +0000 (UTC) Received: by eabm6 with SMTP id m6so173553eab.13 for ; Wed, 13 Jun 2012 04:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=bViCmpw7E8fPxgBYrMvUGzIhER/rcewjdezLcqMiZ88=; b=m24qE/OHy6HXq8/GUDurTg2uavSzjGlidHdgvNRYivt3p+rj5Q0hx/lCo4XfQl7mo4 jHzB2l2w93Zfb5eDWreySsA+0ePmQQPsJU5Kpm6SS1AehExDF+NI9UBXDwr5uZIVaq/Y Innyo4P3Qk4Tt9mr2sP/ouOGQRMmsTa5erUbrX3dbpnkMhJYssnaTrZ9FTEf+c7bjDT8 3vSRLrTW/dOKFQZcwVCs0xVsd0Y9QKopZ/k4GU3wJahR+VW8Iv0N+zL3X9MbK1BJ+ob2 6sRSj6FE+06ZNx/VXiInFO4AZcLsieQm3lAWGeGGuWZv3Ic+qdOHFpU7yu3BfH3g0HOM PecA== Received: by 10.14.28.133 with SMTP id g5mr1255796eea.168.1339586342188; Wed, 13 Jun 2012 04:19:02 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPS id x52sm6343316eea.11.2012.06.13.04.19.00 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Jun 2012 04:19:01 -0700 (PDT) Date: Wed, 13 Jun 2012 13:18:53 +0200 From: Mateusz Guzik To: Pawel Jakub Dawidek Message-ID: <20120613111853.GC3893@dft-labs.eu> References: <20120612104749.GB20749@dft-labs.eu> <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> <20120612214400.GB1429@garage.freebsd.pl> <20120613093807.GA3893@dft-labs.eu> <20120613102900.GD1386@garage.freebsd.pl> <20120613105344.GB3893@dft-labs.eu> <20120613111309.GE1386@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20120613111309.GE1386@garage.freebsd.pl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 11:19:04 -0000 On Wed, Jun 13, 2012 at 01:13:09PM +0200, Pawel Jakub Dawidek wrote: > On Wed, Jun 13, 2012 at 12:53:44PM +0200, Mateusz Guzik wrote: > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free5.patch > > > > David reported that previous version of the patch fixed panic he was > > experiencing, so I consider the patch tested. > > Looks good, one (hopefully last) minor nit. I'd change this comment: > > * Search the bitmap for a free descriptor starting at minfd. If none > * is found, try to grow the file table. > > To something like this: > > * Search the bitmap for a free descriptor starting at minfd. > * If none is found, grow the file table. > > 'try' is a bit misleading for my taste, as it suggest that growing the > file table might fail, I think. > Done in: http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free6.patch > That's all from me:) > Thanks for your comments and suggestions. -- Mateusz Guzik From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 11:59:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F005C106566C; Wed, 13 Jun 2012 11:59:03 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id DC1788FC0C; Wed, 13 Jun 2012 11:59:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DBx3iX022523; Wed, 13 Jun 2012 11:59:03 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DBx3HB022521; Wed, 13 Jun 2012 11:59:03 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206131159.q5DBx3HB022521@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 13 Jun 2012 11:59:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237005 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 11:59:04 -0000 Author: des Date: Wed Jun 13 11:59:03 2012 New Revision: 237005 URL: http://svn.freebsd.org/changeset/base/237005 Log: Remove auth.conf and related files. Submitted by: trhodes@ MFC after: 3 weeks Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jun 13 10:42:55 2012 (r237004) +++ head/ObsoleteFiles.inc Wed Jun 13 11:59:03 2012 (r237005) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20120613: auth.conf removed +OLD_FILES+=/etc/auth.conf +OLD_FILES+=/usr/share/man/man3/auth.3.gz +OLD_FILES+=/usr/share/man/man5/auth.conf.5.gz # 20120530: kde pam lives now in ports OLD_FILES+=/etc/pam.d/kde # 20120505: new clang import installed a redundant internal header From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 11:59:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A02FE106566B; Wed, 13 Jun 2012 11:59:47 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8B63F8FC15; Wed, 13 Jun 2012 11:59:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DBxlrL022583; Wed, 13 Jun 2012 11:59:47 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DBxl2j022581; Wed, 13 Jun 2012 11:59:47 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206131159.q5DBxl2j022581@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 13 Jun 2012 11:59:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237006 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 11:59:47 -0000 Author: des Date: Wed Jun 13 11:59:47 2012 New Revision: 237006 URL: http://svn.freebsd.org/changeset/base/237006 Log: Remove leading / MFC after: 3 weeks Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jun 13 11:59:03 2012 (r237005) +++ head/ObsoleteFiles.inc Wed Jun 13 11:59:47 2012 (r237006) @@ -39,11 +39,11 @@ # done # 20120613: auth.conf removed -OLD_FILES+=/etc/auth.conf -OLD_FILES+=/usr/share/man/man3/auth.3.gz -OLD_FILES+=/usr/share/man/man5/auth.conf.5.gz +OLD_FILES+=etc/auth.conf +OLD_FILES+=usr/share/man/man3/auth.3.gz +OLD_FILES+=usr/share/man/man5/auth.conf.5.gz # 20120530: kde pam lives now in ports -OLD_FILES+=/etc/pam.d/kde +OLD_FILES+=etc/pam.d/kde # 20120505: new clang import installed a redundant internal header OLD_FILES+=usr/include/clang/3.1/stdalign.h # 20120428: MD2 removed from libmd From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 13:13:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D8FB1065676 for ; Wed, 13 Jun 2012 13:13:02 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 9E0668FC1F for ; Wed, 13 Jun 2012 13:13:01 +0000 (UTC) Received: (qmail 72460 invoked from network); 13 Jun 2012 15:10:08 -0000 Received: from c00l3r.networx.ch (HELO [127.0.0.1]) ([62.48.2.2]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 13 Jun 2012 15:10:08 -0000 Message-ID: <4FD891D2.5080306@freebsd.org> Date: Wed, 13 Jun 2012 15:12:50 +0200 From: Andre Oppermann User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Michael Tuexen References: <201206121402.q5CE2cs1057392@svn.freebsd.org> In-Reply-To: <201206121402.q5CE2cs1057392@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236959 - in head: share/man/man4 sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 13:13:02 -0000 On 12.06.2012 16:02, Michael Tuexen wrote: > Author: tuexen > Date: Tue Jun 12 14:02:38 2012 > New Revision: 236959 > URL: http://svn.freebsd.org/changeset/base/236959 > > Log: > Add a IP_RECVTOS socket option to receive for received UDP/IPv4 > packets a cmsg of type IP_RECVTOS which contains the TOS byte. > Much like IP_RECVTTL does for TTL. This allows to implement a > protocol on top of UDP and implementing ECN. You may want to consider to alias IP_RECVTOS with IP_TOS as it is done with IP_SENDSRCADDR+IP_RECVDSTADDR to allow for simpler replying of received UDP packets. That way IP_RECVTOS has the same ip socket option number and it can be used for direct TOS reflection. -- Andre From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 14:47:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B61A21065677; Wed, 13 Jun 2012 14:47:03 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9FE4E8FC15; Wed, 13 Jun 2012 14:47:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DEl3cj030491; Wed, 13 Jun 2012 14:47:03 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DEl3Dk030488; Wed, 13 Jun 2012 14:47:03 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201206131447.q5DEl3Dk030488@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 13 Jun 2012 14:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237007 - stable/9/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 14:47:03 -0000 Author: pluknet Date: Wed Jun 13 14:47:03 2012 New Revision: 237007 URL: http://svn.freebsd.org/changeset/base/237007 Log: MFC r234188,r234463,r234465: - Update the swi_add prototype after struct ithd was split up into struct intr_event and struct intr_thread. [1] - Update the rest of struct ithd references. - net_ih and softclock_ih cookies have gone away. - Document swi_remove(9). PR: docs/166864 [1] Modified: stable/9/share/man/man9/Makefile stable/9/share/man/man9/swi.9 Directory Properties: stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man9/Makefile ============================================================================== --- stable/9/share/man/man9/Makefile Wed Jun 13 11:59:47 2012 (r237006) +++ stable/9/share/man/man9/Makefile Wed Jun 13 14:47:03 2012 (r237007) @@ -1245,6 +1245,7 @@ MLINKS+=store.9 subyte.9 \ store.9 suword32.9 \ store.9 suword64.9 MLINKS+=swi.9 swi_add.9 \ + swi.9 swi_remove.9 \ swi.9 swi_sched.9 MLINKS+=sx.9 sx_assert.9 \ sx.9 sx_destroy.9 \ Modified: stable/9/share/man/man9/swi.9 ============================================================================== --- stable/9/share/man/man9/swi.9 Wed Jun 13 11:59:47 2012 (r237006) +++ stable/9/share/man/man9/swi.9 Wed Jun 13 14:47:03 2012 (r237007) @@ -24,25 +24,24 @@ .\" .\" $FreeBSD$ .\" -.Dd October 30, 2000 +.Dd April 19, 2012 .Dt SWI 9 .Os .Sh NAME .Nm swi_add , +.Nm swi_remove , .Nm swi_sched .Nd register and schedule software interrupt handlers .Sh SYNOPSIS .In sys/param.h .In sys/bus.h .In sys/interrupt.h -.Vt "extern struct ithd *tty_ithd" ; -.Vt "extern struct ithd *clk_ithd" ; -.Vt "extern void *net_ih" ; -.Vt "extern void *softclock_ih" ; +.Vt "extern struct intr_event *tty_intr_event" ; +.Vt "extern struct intr_event *clk_intr_event" ; .Vt "extern void *vm_ih" ; .Ft int .Fo swi_add -.Fa "struct ithd **ithdp" +.Fa "struct intr_event **eventp" .Fa "const char *name" .Fa "driver_intr_t handler" .Fa "void *arg" @@ -50,6 +49,8 @@ .Fa "enum intr_type flags" .Fa "void **cookiep" .Fc +.Ft int +.Fn swi_remove "void *cookie" .Ft void .Fn swi_sched "void *cookie" "int flags" .Sh DESCRIPTION @@ -67,20 +68,21 @@ time, and that they can be run via a lig .Pp The .Fn swi_add -function is used to register a new software interrupt handler. +function is used to add a new software interrupt handler to a specified +interrupt event. The -.Fa ithdp +.Fa eventp argument is an optional pointer to a -.Vt struct ithd +.Vt struct intr_event pointer. -If this argument points to an existing software interrupt thread, then this -handler will be attached to that thread. -Otherwise a new thread will be created, and if -.Fa ithdp +If this argument points to an existing event that holds a list of +interrupt handlers, then this handler will be attached to that event. +Otherwise a new event will be created, and if +.Fa eventp is not .Dv NULL , then the pointer at that address to will be modified to point to the -newly created thread. +newly created event. The .Fa name argument is used to associate a name with a specific handler. @@ -99,7 +101,7 @@ The .Fa pri value specifies the priority of this interrupt handler relative to other software interrupt handlers. -If an interrupt thread is created, then this value is used as the vector, +If an interrupt event is created, then this value is used as the vector, and the .Fa flags argument is used to specify the attributes of a handler such as @@ -113,6 +115,14 @@ This cookie will be set to a value that and is used to schedule the handler for execution later on. .Pp The +.Fn swi_remove +function is used to teardown an interrupt handler pointed to by the +.Fa cookie +argument. +It detaches the interrupt handler from the associated interrupt event +and frees its memory. +.Pp +The .Fn swi_sched function is used to schedule an interrupt handler and its associated thread to run. @@ -140,30 +150,29 @@ in earlier versions of .El .Pp The -.Va tty_ithd +.Va tty_intr_event and -.Va clk_ithd -variables contain pointers to the software interrupt threads for the tty and +.Va clk_intr_event +variables contain pointers to the software interrupt handlers for the tty and clock software interrupts, respectively. -.Va tty_ithd +.Va tty_intr_event is used to hang tty software interrupt handlers off of the same thread. -.Va clk_ithd +.Va clk_intr_event is used to hang delayed handlers off of the clock software interrupt thread so that the functionality of .Fn setdelayed can be obtained in conjunction with .Dv SWI_DELAY . The -.Va net_ih , -.Va softclock_ih , -and .Va vm_ih -handler cookies are used to schedule software interrupt threads to run for the -networking stack, clock interrupt, and VM subsystem respectively. +handler cookie is used to schedule software interrupt threads to run for the +VM subsystem. .Sh RETURN VALUES The .Fn swi_add -function returns zero on success and non-zero on failure. +and +.Fn swi_remove +functions return zero on success and non-zero on failure. .Sh ERRORS The .Fn swi_add @@ -183,7 +192,7 @@ argument specifies .Dv INTR_ENTROPY . .It Bq Er EINVAL The -.Fa ithdp +.Fa eventp argument points to a hardware interrupt thread. .It Bq Er EINVAL Either of the @@ -195,11 +204,22 @@ arguments are .It Bq Er EINVAL The .Dv INTR_EXCL -flag is specified and the interrupt thread pointed to by -.Fa ithdp -already has at least one handler, or the interrupt thread already has an +flag is specified and the interrupt event pointed to by +.Fa eventp +already has at least one handler, or the interrupt event already has an exclusive handler. .El +.Pp +The +.Fn swi_remove +function will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +A software interrupt handler pointed to by +.Fa cookie +is +.Dv NULL . +.El .Sh SEE ALSO .Xr ithread 9 , .Xr taskqueue 9 @@ -220,6 +240,10 @@ and .Fn schedsoft* functions which date back to at least .Bx 4.4 . +The +.Fn swi_remove +function first appeared in +.Fx 6.1 . .Sh BUGS Most of the global variables described in this manual page should not be global, or at the very least should not be declared in From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 15:04:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14E251065673; Wed, 13 Jun 2012 15:04:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id F3E738FC0A; Wed, 13 Jun 2012 15:04:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DF4obf031338; Wed, 13 Jun 2012 15:04:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DF4opt031336; Wed, 13 Jun 2012 15:04:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206131504.q5DF4opt031336@svn.freebsd.org> From: John Baldwin Date: Wed, 13 Jun 2012 15:04:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237008 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 15:04:51 -0000 Author: jhb Date: Wed Jun 13 15:04:50 2012 New Revision: 237008 URL: http://svn.freebsd.org/changeset/base/237008 Log: Fix a couple of bugs that prevented windows in PCI-PCI bridges from growing "downward" (moving the start address down). First, an off by one error caused the end address to be moved down an extra alignment chunk unnecessarily. Second, when aligning the new candidate starting address, the wrong bits were masked off. Tested by: Andrey Zonov andrey zonov org MFC after: 3 days Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Wed Jun 13 14:47:03 2012 (r237007) +++ head/sys/dev/pci/pci_pci.c Wed Jun 13 15:04:50 2012 (r237008) @@ -893,9 +893,9 @@ pcib_grow_window(struct pcib_softc *sc, if (start < rman_get_start(w->res)) { if (rman_first_free_region(&w->rman, &start_free, &end_free) != 0 || start_free != rman_get_start(w->res)) - end_free = rman_get_start(w->res) - 1; + end_free = rman_get_start(w->res); if (end_free > end) - end_free = end; + end_free = end + 1; /* Move end_free down until it is properly aligned. */ end_free &= ~(align - 1); @@ -913,7 +913,7 @@ pcib_grow_window(struct pcib_softc *sc, if (bootverbose) printf("\tfront candidate range: %#lx-%#lx\n", front, end_free); - front &= (1ul << w->step) - 1; + front &= ~(1ul << w->step) - 1; front = rman_get_start(w->res) - front; } else front = 0; From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 15:07:33 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 169351065673 for ; Wed, 13 Jun 2012 15:07:33 +0000 (UTC) (envelope-from andrey@zonov.org) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx1.freebsd.org (Postfix) with ESMTP id 930198FC18 for ; Wed, 13 Jun 2012 15:07:32 +0000 (UTC) Received: by wibhj8 with SMTP id hj8so4370760wib.13 for ; Wed, 13 Jun 2012 08:07:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=lxxBZ/DtmKqufWCdDnA4f9RvWb8ngtBh1lIqkfEYGZw=; b=khSQG6Z+0CBipBXpOnbjxoaW/gh0GVIQdMve8Mrn5e+o1SBRuOBCJWuEzKgP0CQiXA jj/+yD+/ZnJKdkAHX2dQuI4hpTe/abuoBfoHynCV6orO3dfCKucU7ADqh88xsbfO9x8L lvEn6XLl4kh5diBc9gDYV4oDCC5yr8CPwHAvMFJe0oaMWZYKpKSgy9M3HoW17GSeNEbO xtcqpukDxmYiH/04Uk3LT4m9lG5d+ain5xMfNtSOZjbbBNgejhLPE+LpqoJC+qKNKl4W FUPIS7Rz7ThE/lDYw5xCM/zJuyt8PU8DR/FU487+wpUoU2kwk9dVkenpxJi/bxwHfQWg istQ== MIME-Version: 1.0 Received: by 10.181.11.137 with SMTP id ei9mr221557wid.21.1339600046131; Wed, 13 Jun 2012 08:07:26 -0700 (PDT) Received: by 10.217.2.75 with HTTP; Wed, 13 Jun 2012 08:07:26 -0700 (PDT) X-Originating-IP: [2a02:6b8:0:401:c0c2:4137:d020:7ba2] In-Reply-To: <201206131159.q5DBx3HB022521@svn.freebsd.org> References: <201206131159.q5DBx3HB022521@svn.freebsd.org> Date: Wed, 13 Jun 2012 19:07:26 +0400 Message-ID: From: Andrey Zonov To: Dag-Erling Smorgrav Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQmBgRNZo03p9peeqhxVdTD1PBMPXiwpbBYMhfdEzKHZiTrlxzfoNLIRiOl0W+MrsuvWJttC Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237005 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 15:07:33 -0000 On Wed, Jun 13, 2012 at 3:59 PM, Dag-Erling Smorgrav wrot= e: > Author: des > Date: Wed Jun 13 11:59:03 2012 > New Revision: 237005 > URL: http://svn.freebsd.org/changeset/base/237005 > > Log: > =A0Remove auth.conf and related files. > > =A0Submitted by: trhodes@ > =A0MFC after: =A0 =A03 weeks > > Modified: > =A0head/ObsoleteFiles.inc > > Modified: head/ObsoleteFiles.inc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/ObsoleteFiles.inc =A0 =A0 =A0Wed Jun 13 10:42:55 2012 =A0 =A0 = =A0 =A0(r237004) > +++ head/ObsoleteFiles.inc =A0 =A0 =A0Wed Jun 13 11:59:03 2012 =A0 =A0 = =A0 =A0(r237005) > @@ -38,6 +38,10 @@ > =A0# =A0 xargs -n1 | sort | uniq -d; > =A0# done > > +# 20120613: auth.conf removed > +OLD_FILES+=3D/etc/auth.conf > +OLD_FILES+=3D/usr/share/man/man3/auth.3.gz > +OLD_FILES+=3D/usr/share/man/man5/auth.conf.5.gz I think you missed usr/share/examples/etc/auth.conf > =A0# 20120530: kde pam lives now in ports > =A0OLD_FILES+=3D/etc/pam.d/kde > =A0# 20120505: new clang import installed a redundant internal header --=20 Andrey Zonov From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 15:25:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FA001065678; Wed, 13 Jun 2012 15:25:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 752718FC08; Wed, 13 Jun 2012 15:25:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DFPrab032334; Wed, 13 Jun 2012 15:25:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DFPr3o032307; Wed, 13 Jun 2012 15:25:53 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206131525.q5DFPr3o032307@svn.freebsd.org> From: John Baldwin Date: Wed, 13 Jun 2012 15:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237009 - in stable/8: lib/libc/amd64/gen lib/libc/arm/gen lib/libc/gen lib/libc/i386/gen lib/libc/ia64/gen lib/libc/mips/gen lib/libc/powerpc/gen lib/libc/sparc64/gen sys/amd64/acpica ... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 15:25:53 -0000 Author: jhb Date: Wed Jun 13 15:25:52 2012 New Revision: 237009 URL: http://svn.freebsd.org/changeset/base/237009 Log: MFC 230260-230262,230269,230270,230426,230429,230538,230765,230766,230864, 232520 (partial),235563: Add support for the extended FPU states on amd64, both for native 64bit and 32bit ABIs. As a side-effect, it enables AVX on capable CPUs. In particular: - Query the CPU support for XSAVE, list of the supported extensions and the required size of FPU save area. The hw.use_xsave tunable is provided for disabling XSAVE, and hw.xsave_mask may be used to select the enabled extensions. - Remove the FPU save area from PCB and dynamically allocate the (run-time sized) user save area on the top of the kernel stack, right above the PCB. Reorganize the thread0 PCB initialization to postpone it after BSP is queried for save area size. - The dumppcb, stoppcbs and susppcbs now do not carry the FPU state as well. FPU state is only useful for suspend, where it is saved in dynamically allocated suspfpusave area. - Use XSAVE and XRSTOR to save/restore FPU state, if supported and enabled. - Define new mcontext_t flag _MC_HASFPXSTATE, indicating that mcontext_t has a valid pointer to out-of-struct extended FPU state. Signal handlers are supplied with stack-allocated fpu state. The sigreturn(2) and setcontext(2) syscall honour the flag, allowing the signal handlers to inspect and manipilate extended state in the interrupted context. - The getcontext(2) never returns extended state, since there is no place in the fixed-sized mcontext_t to place variable-sized save area. And, since mcontext_t is embedded into ucontext_t, makes it impossible to fix in a reasonable way. Provide a sysarch(2) facility to query extended FPU state. - Add API for obtaining extended machine context states that cannot be fit into existing mcontext_t. On i386 and amd64 return the extended FPU states using getcontextx(3). For other architectures, getcontextx(3) returns the same information as getcontext(2). - Add ptrace(2) support for getting and setting extended state; while there, implement missed PT_I386_{GET,SET}XMMREGS for 32bit binaries. - Change fpu_kern KPI to not expose struct fpu_kern_ctx layout to consumers, making it opaque. Internally, struct fpu_kern_ctx now contains a space for the extended state. Convert in-kernel consumers of fpu_kern KPI both on i386 and amd64. Reviewed by: kib Added: stable/8/lib/libc/amd64/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/amd64/gen/getcontextx.c stable/8/lib/libc/arm/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/arm/gen/getcontextx.c stable/8/lib/libc/i386/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/i386/gen/getcontextx.c stable/8/lib/libc/ia64/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/ia64/gen/getcontextx.c stable/8/lib/libc/mips/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/mips/gen/getcontextx.c stable/8/lib/libc/powerpc/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/powerpc/gen/getcontextx.c stable/8/lib/libc/sparc64/gen/getcontextx.c - copied, changed from r230429, head/lib/libc/sparc64/gen/getcontextx.c stable/8/sys/amd64/amd64/ptrace_machdep.c - copied, changed from r230426, head/sys/amd64/amd64/ptrace_machdep.c Modified: stable/8/lib/libc/amd64/gen/Makefile.inc stable/8/lib/libc/arm/gen/Makefile.inc stable/8/lib/libc/gen/Symbol.map stable/8/lib/libc/gen/getcontext.3 stable/8/lib/libc/gen/ucontext.3 stable/8/lib/libc/i386/gen/Makefile.inc stable/8/lib/libc/ia64/gen/Makefile.inc stable/8/lib/libc/mips/gen/Makefile.inc stable/8/lib/libc/powerpc/gen/Makefile.inc stable/8/lib/libc/sparc64/gen/Makefile.inc stable/8/sys/amd64/acpica/acpi_switch.S stable/8/sys/amd64/acpica/acpi_wakecode.S stable/8/sys/amd64/acpica/acpi_wakeup.c stable/8/sys/amd64/amd64/cpu_switch.S stable/8/sys/amd64/amd64/fpu.c stable/8/sys/amd64/amd64/genassym.c stable/8/sys/amd64/amd64/initcpu.c stable/8/sys/amd64/amd64/machdep.c stable/8/sys/amd64/amd64/mp_machdep.c stable/8/sys/amd64/amd64/sys_machdep.c stable/8/sys/amd64/amd64/trap.c stable/8/sys/amd64/amd64/vm_machdep.c stable/8/sys/amd64/ia32/ia32_reg.c stable/8/sys/amd64/ia32/ia32_signal.c stable/8/sys/amd64/include/fpu.h stable/8/sys/amd64/include/frame.h stable/8/sys/amd64/include/md_var.h stable/8/sys/amd64/include/pcb.h stable/8/sys/amd64/include/pcpu.h stable/8/sys/amd64/include/ptrace.h stable/8/sys/amd64/include/signal.h stable/8/sys/amd64/include/specialreg.h stable/8/sys/amd64/include/sysarch.h stable/8/sys/amd64/include/ucontext.h stable/8/sys/compat/ia32/ia32_signal.h stable/8/sys/conf/files.amd64 stable/8/sys/crypto/aesni/aesni.c stable/8/sys/crypto/aesni/aesni.h stable/8/sys/crypto/aesni/aesni_wrap.c stable/8/sys/crypto/via/padlock.c stable/8/sys/crypto/via/padlock.h stable/8/sys/crypto/via/padlock_cipher.c stable/8/sys/crypto/via/padlock_hash.c stable/8/sys/dev/random/nehemiah.c stable/8/sys/i386/i386/machdep.c stable/8/sys/i386/include/npx.h stable/8/sys/i386/include/ptrace.h stable/8/sys/i386/include/signal.h stable/8/sys/i386/include/specialreg.h stable/8/sys/i386/include/sysarch.h stable/8/sys/i386/include/ucontext.h stable/8/sys/i386/isa/npx.c stable/8/sys/pc98/pc98/machdep.c stable/8/sys/sys/ucontext.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) stable/8/lib/libc/uuid/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/lib/libc/amd64/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/amd64/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/amd64/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -2,7 +2,7 @@ # $FreeBSD$ SRCS+= _setjmp.S _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \ - fabs.S modf.S \ + fabs.S getcontextx.c modf.S \ infinity.c ldexp.c makecontext.c signalcontext.c \ flt_rounds.c fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \ fpgetround.c fpsetround.c fpgetsticky.c Copied and modified: stable/8/lib/libc/amd64/gen/getcontextx.c (from r230429, head/lib/libc/amd64/gen/getcontextx.c) ============================================================================== --- head/lib/libc/amd64/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/amd64/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); static int xstate_sz = -1; -size_t +int __getcontextx_size(void) { u_int p[4]; Modified: stable/8/lib/libc/arm/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/arm/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/arm/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -2,5 +2,5 @@ # $FreeBSD$ SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \ - infinity.c ldexp.c makecontext.c modf.c \ + getcontextx.c infinity.c ldexp.c makecontext.c modf.c \ setjmp.S signalcontext.c sigsetjmp.S divsi3.S Copied and modified: stable/8/lib/libc/arm/gen/getcontextx.c (from r230429, head/lib/libc/arm/gen/getcontextx.c) ============================================================================== --- head/lib/libc/arm/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/arm/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/lib/libc/gen/Symbol.map ============================================================================== --- stable/8/lib/libc/gen/Symbol.map Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/gen/Symbol.map Wed Jun 13 15:25:52 2012 (r237009) @@ -371,6 +371,7 @@ FBSD_1.2 { FBSD_1.3 { __FreeBSD_libc_enter_restricted_mode; + getcontextx; }; FBSDprivate_1.0 { @@ -487,4 +488,6 @@ FBSDprivate_1.0 { _wait; __waitpid; _waitpid; + __fillcontextx; + __getcontextx_size; }; Modified: stable/8/lib/libc/gen/getcontext.3 ============================================================================== --- stable/8/lib/libc/gen/getcontext.3 Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/gen/getcontext.3 Wed Jun 13 15:25:52 2012 (r237009) @@ -35,11 +35,11 @@ .\" .\" $FreeBSD$ .\" -.Dd September 10, 2002 +.Dd December 26, 2011 .Dt GETCONTEXT 3 .Os .Sh NAME -.Nm getcontext , setcontext +.Nm getcontext , getcontextx , setcontext .Nd get and set user thread context .Sh LIBRARY .Lb libc @@ -59,6 +59,20 @@ This saved context may then later be res .Fn setcontext . .Pp The +.Fn getcontextx +function saves the current execution context in the newly allocated structure +.Vt ucontext_t , +which is returned on success. +If architecture defines additional CPU states that can be stored in extended +blocks referenced from the +.Vt ucontext_t , +the memory for them may be allocated and their context also stored. +Memory returned by +.Fn getcontextx +function shall be freed using +.Fn free 3 . +.Pp +The .Fn setcontext function makes a previously saved thread context the current thread context, i.e., @@ -109,11 +123,24 @@ If successful, returns zero and .Fn setcontext does not return; otherwise \-1 is returned. +The +.Fn getcontextx +returns pointer to the allocated and initialized context on success, and +.Va NULL +on failure. .Sh ERRORS No errors are defined for .Fn getcontext or .Fn setcontext . +The +.Fn getcontextx +may return the following errors in +.Va errno : +.Bl -tag -width Er +.It Bq Er ENOMEM +No memory was available to allocate for the context or some extended state. +.El .Sh SEE ALSO .Xr sigaction 2 , .Xr sigaltstack 2 , Modified: stable/8/lib/libc/gen/ucontext.3 ============================================================================== --- stable/8/lib/libc/gen/ucontext.3 Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/gen/ucontext.3 Wed Jun 13 15:25:52 2012 (r237009) @@ -92,6 +92,9 @@ structures: .Ft int .Fn getcontext "ucontext_t *" ; .It +.Ft "ucontext_t *" +.Fn getcontextx "void" ; +.It .Ft int .Fn setcontext "const ucontext_t *" ; .It @@ -104,4 +107,5 @@ structures: .Sh SEE ALSO .Xr sigaltstack 2 , .Xr getcontext 3 , +.Xr getcontextx 3 , .Xr makecontext 3 Modified: stable/8/lib/libc/i386/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/i386/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/i386/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -2,5 +2,5 @@ # $FreeBSD$ SRCS+= _ctx_start.S _setjmp.S _set_tp.c fabs.S \ - flt_rounds.c infinity.c ldexp.c makecontext.c modf.S \ + flt_rounds.c getcontextx.c infinity.c ldexp.c makecontext.c modf.S \ rfork_thread.S setjmp.S signalcontext.c sigsetjmp.S Copied and modified: stable/8/lib/libc/i386/gen/getcontextx.c (from r230429, head/lib/libc/i386/gen/getcontextx.c) ============================================================================== --- head/lib/libc/i386/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/i386/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); static int xstate_sz = -1; -size_t +int __getcontextx_size(void) { u_int p[4]; Modified: stable/8/lib/libc/ia64/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/ia64/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/ia64/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -3,8 +3,8 @@ SRCS+= __divdf3.S __divdi3.S __divsf3.S __divsi3.S __moddi3.S __modsi3.S \ __udivdi3.S __udivsi3.S __umoddi3.S __umodsi3.S _mcount.S _set_tp.c \ _setjmp.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c fpsetmask.c \ - fpsetround.c infinity.c ldexp.c makecontext.c modf.c setjmp.S \ - signalcontext.c sigsetjmp.S + fpsetround.c getcontextx.c infinity.c ldexp.c makecontext.c modf.c \ + setjmp.S signalcontext.c sigsetjmp.S # The following may go away if function _Unwind_FindTableEntry() # will be part of GCC. Copied and modified: stable/8/lib/libc/ia64/gen/getcontextx.c (from r230429, head/lib/libc/ia64/gen/getcontextx.c) ============================================================================== --- head/lib/libc/ia64/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/ia64/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/lib/libc/mips/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/mips/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/mips/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -6,4 +6,5 @@ SRCS+= infinity.c fabs.c ldexp.c modf.c # SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ # fpsetround.c fpsetsticky.c -SRCS+= _ctx_start.S _set_tp.c _setjmp.S makecontext.c setjmp.S signalcontext.c sigsetjmp.S +SRCS+= _ctx_start.S _set_tp.c _setjmp.S getcontextx.c makecontext.c \ + setjmp.S signalcontext.c sigsetjmp.S Copied and modified: stable/8/lib/libc/mips/gen/getcontextx.c (from r230429, head/lib/libc/mips/gen/getcontextx.c) ============================================================================== --- head/lib/libc/mips/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/mips/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/lib/libc/powerpc/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/powerpc/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/powerpc/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -1,7 +1,7 @@ # $FreeBSD$ SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ - fpgetsticky.c fpsetmask.c fpsetround.c \ + fpgetsticky.c fpsetmask.c fpsetround.c getcontextx.c \ infinity.c ldexp.c makecontext.c modf.c _setjmp.S \ setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ _set_tp.c Copied and modified: stable/8/lib/libc/powerpc/gen/getcontextx.c (from r230429, head/lib/libc/powerpc/gen/getcontextx.c) ============================================================================== --- head/lib/libc/powerpc/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/powerpc/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/lib/libc/sparc64/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/sparc64/gen/Makefile.inc Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/lib/libc/sparc64/gen/Makefile.inc Wed Jun 13 15:25:52 2012 (r237009) @@ -2,5 +2,5 @@ SRCS+= _ctx_start.S _setjmp.S fabs.S fixunsdfsi.S flt_rounds.c fpgetmask.c \ fpgetround.c fpgetsticky.c fpsetmask.c fpsetround.c \ - infinity.c ldexp.c makecontext.c modf.S \ + getcontextx.c infinity.c ldexp.c makecontext.c modf.S \ signalcontext.c setjmp.S sigsetjmp.S _set_tp.c Copied and modified: stable/8/lib/libc/sparc64/gen/getcontextx.c (from r230429, head/lib/libc/sparc64/gen/getcontextx.c) ============================================================================== --- head/lib/libc/sparc64/gen/getcontextx.c Sat Jan 21 18:00:28 2012 (r230429, copy source) +++ stable/8/lib/libc/sparc64/gen/getcontextx.c Wed Jun 13 15:25:52 2012 (r237009) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include -size_t +int __getcontextx_size(void) { Modified: stable/8/sys/amd64/acpica/acpi_switch.S ============================================================================== --- stable/8/sys/amd64/acpica/acpi_switch.S Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/acpica/acpi_switch.S Wed Jun 13 15:25:52 2012 (r237009) @@ -146,11 +146,22 @@ ENTRY(acpi_restorecpu) /* Restore FPU state. */ fninit - fxrstor PCB_USERFPU(%rdi) + movq WAKEUP_CTX(fpusave),%rdi + cmpl $0,use_xsave + jne 1f + fxrstor (%rdi) + jmp 2f +1: movl xsave_mask,%eax + movl xsave_mask+4,%edx +/* xrstor (%rdi) */ + .byte 0x0f,0xae,0x2f +2: /* Reload CR0. */ movq %rcx, %cr0 + movq WAKEUP_CTX(pcb),%rdi + /* Restore return address. */ movq PCB_RIP(%rdi), %rax movq %rax, (%rsp) Modified: stable/8/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- stable/8/sys/amd64/acpica/acpi_wakecode.S Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/acpica/acpi_wakecode.S Wed Jun 13 15:25:52 2012 (r237009) @@ -270,6 +270,8 @@ wakeup_pcb: wakeup_gdt: .word 0 .quad 0 +wakeup_fpusave: + .quad 0 ALIGN_DATA wakeup_efer: Modified: stable/8/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- stable/8/sys/amd64/acpica/acpi_wakeup.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/acpica/acpi_wakeup.c Wed Jun 13 15:25:52 2012 (r237009) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef SMP #include @@ -67,8 +68,10 @@ extern int acpi_reset_video; #ifdef SMP extern struct pcb **susppcbs; +extern void **suspfpusave; #else static struct pcb **susppcbs; +static void **suspfpusave; #endif int acpi_restorecpu(vm_offset_t, struct pcb *); @@ -105,6 +108,7 @@ acpi_wakeup_ap(struct acpi_softc *sc, in int ms; WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[cpu]); + WAKECODE_FIXUP(wakeup_fpusave, void *, suspfpusave[cpu]); WAKECODE_FIXUP(wakeup_gdt, uint16_t, susppcbs[cpu]->pcb_gdt.rd_limit); WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, susppcbs[cpu]->pcb_gdt.rd_base); @@ -243,6 +247,7 @@ acpi_sleep_machdep(struct acpi_softc *sc load_cr3(KPML4phys); if (savectx(susppcbs[0])) { + ctx_fpusave(suspfpusave[0]); #ifdef SMP if (wakeup_cpus != 0 && suspend_cpus(wakeup_cpus) == 0) { device_printf(sc->acpi_dev, @@ -256,6 +261,7 @@ acpi_sleep_machdep(struct acpi_softc *sc WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[0]); + WAKECODE_FIXUP(wakeup_fpusave, void *, suspfpusave[0]); WAKECODE_FIXUP(wakeup_gdt, uint16_t, susppcbs[0]->pcb_gdt.rd_limit); WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t, @@ -333,8 +339,11 @@ acpi_alloc_wakeup_handler(void) return (NULL); } susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK); - for (i = 0; i < mp_ncpus; i++) + suspfpusave = malloc(mp_ncpus * sizeof(void *), M_DEVBUF, M_WAITOK); + for (i = 0; i < mp_ncpus; i++) { susppcbs[i] = malloc(sizeof(**susppcbs), M_DEVBUF, M_WAITOK); + suspfpusave[i] = alloc_fpusave(M_WAITOK); + } return (wakeaddr); } Modified: stable/8/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/8/sys/amd64/amd64/cpu_switch.S Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/cpu_switch.S Wed Jun 13 15:25:52 2012 (r237009) @@ -112,16 +112,25 @@ done_store_dr: /* have we used fp, and need a save? */ cmpq %rdi,PCPU(FPCURTHREAD) - jne 1f + jne 3f movq PCB_SAVEFPU(%r8),%r8 clts + cmpl $0,use_xsave + jne 1f fxsave (%r8) - smsw %ax + jmp 2f +1: movq %rdx,%rcx + movl xsave_mask,%eax + movl xsave_mask+4,%edx +/* xsave (%r8) */ + .byte 0x41,0x0f,0xae,0x20 + movq %rcx,%rdx +2: smsw %ax orb $CR0_TS,%al lmsw %ax xorl %eax,%eax movq %rax,PCPU(FPCURTHREAD) -1: +3: /* Save is done. Now fire up new thread. Leave old vmspace. */ movq TD_PCB(%rsi),%r8 @@ -354,10 +363,19 @@ ENTRY(savectx) sldt PCB_LDT(%rdi) str PCB_TR(%rdi) - clts - fxsave PCB_USERFPU(%rdi) - movq %rsi,%cr0 /* The previous %cr0 is saved in %rsi. */ +2: movq %rsi,%cr0 /* The previous %cr0 is saved in %rsi. */ movl $1,%eax ret END(savectx) + +/* + * Wrapper around fpusave to care about TS0_CR. + */ +ENTRY(ctx_fpusave) + movq %cr0,%rsi + clts + call fpusave + movq %rsi,%cr0 + ret +END(ctx_fpusave) Modified: stable/8/sys/amd64/amd64/fpu.c ============================================================================== --- stable/8/sys/amd64/amd64/fpu.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/fpu.c Wed Jun 13 15:25:52 2012 (r237009) @@ -78,6 +78,41 @@ __FBSDID("$FreeBSD$"); : : "n" (CR0_TS) : "ax") #define stop_emulating() __asm __volatile("clts") +static __inline void +xrstor(char *addr, uint64_t mask) +{ + uint32_t low, hi; + + low = mask; + hi = mask >> 32; + /* xrstor (%rdi) */ + __asm __volatile(".byte 0x0f,0xae,0x2f" : : + "a" (low), "d" (hi), "D" (addr)); +} + +static __inline void +xsave(char *addr, uint64_t mask) +{ + uint32_t low, hi; + + low = mask; + hi = mask >> 32; + /* xsave (%rdi) */ + __asm __volatile(".byte 0x0f,0xae,0x27" : : + "a" (low), "d" (hi), "D" (addr) : "memory"); +} + +static __inline void +xsetbv(uint32_t reg, uint64_t val) +{ + uint32_t low, hi; + + low = val; + hi = val >> 32; + __asm __volatile(".byte 0x0f,0x01,0xd1" : : + "c" (reg), "a" (low), "d" (hi)); +} + #else /* !(__GNUCLIKE_ASM && !lint) */ void fldcw(u_short cw); @@ -90,25 +125,106 @@ void fxrstor(caddr_t addr); void ldmxcsr(u_int csr); void start_emulating(void); void stop_emulating(void); +void xrstor(char *addr, uint64_t mask); +void xsave(char *addr, uint64_t mask); +void xsetbv(uint32_t reg, uint64_t val); #endif /* __GNUCLIKE_ASM && !lint */ #define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_cw) #define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_sw) -typedef u_char bool_t; +CTASSERT(sizeof(struct savefpu) == 512); +CTASSERT(sizeof(struct xstate_hdr) == 64); +CTASSERT(sizeof(struct savefpu_ymm) == 832); + +/* + * This requirement is to make it easier for asm code to calculate + * offset of the fpu save area from the pcb address. FPU save area + * must by 64-bytes aligned. + */ +CTASSERT(sizeof(struct pcb) % XSAVE_AREA_ALIGN == 0); static void fpu_clean_state(void); SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, NULL, 1, "Floating point instructions executed in hardware"); -static struct savefpu fpu_initialstate; +int use_xsave; /* non-static for cpu_switch.S */ +uint64_t xsave_mask; /* the same */ +static struct savefpu *fpu_initialstate; + +void +fpusave(void *addr) +{ + + if (use_xsave) + xsave((char *)addr, xsave_mask); + else + fxsave((char *)addr); +} + +static void +fpurestore(void *addr) +{ + + if (use_xsave) + xrstor((char *)addr, xsave_mask); + else + fxrstor((char *)addr); +} /* - * Initialize the floating point unit. On the boot CPU we generate a - * clean state that is used to initialize the floating point unit when - * it is first used by a process. + * Enable XSAVE if supported and allowed by user. + * Calculate the xsave_mask. + */ +static void +fpuinit_bsp1(void) +{ + u_int cp[4]; + uint64_t xsave_mask_user; + + if ((cpu_feature2 & CPUID2_XSAVE) != 0) { + use_xsave = 1; + TUNABLE_INT_FETCH("hw.use_xsave", &use_xsave); + } + if (!use_xsave) + return; + + cpuid_count(0xd, 0x0, cp); + xsave_mask = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE; + if ((cp[0] & xsave_mask) != xsave_mask) + panic("CPU0 does not support X87 or SSE: %x", cp[0]); + xsave_mask = ((uint64_t)cp[3] << 32) | cp[0]; + xsave_mask_user = xsave_mask; + TUNABLE_ULONG_FETCH("hw.xsave_mask", &xsave_mask_user); + xsave_mask_user |= XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE; + xsave_mask &= xsave_mask_user; +} + +/* + * Calculate the fpu save area size. + */ +static void +fpuinit_bsp2(void) +{ + u_int cp[4]; + + if (use_xsave) { + cpuid_count(0xd, 0x0, cp); + cpu_max_ext_state_size = cp[1]; + + /* + * Reload the cpu_feature2, since we enabled OSXSAVE. + */ + do_cpuid(1, cp); + cpu_feature2 = cp[2]; + } else + cpu_max_ext_state_size = sizeof(struct savefpu); +} + +/* + * Initialize the floating point unit. */ void fpuinit(void) @@ -117,6 +233,20 @@ fpuinit(void) u_int mxcsr; u_short control; + if (IS_BSP()) + fpuinit_bsp1(); + + if (use_xsave) { + load_cr4(rcr4() | CR4_XSAVE); + xsetbv(XCR0, xsave_mask); + } + + /* + * XCR0 shall be set up before CPU can report the save area size. + */ + if (IS_BSP()) + fpuinit_bsp2(); + /* * It is too early for critical_enter() to work on AP. */ @@ -127,20 +257,46 @@ fpuinit(void) fldcw(control); mxcsr = __INITIAL_MXCSR__; ldmxcsr(mxcsr); - if (PCPU_GET(cpuid) == 0) { - fxsave(&fpu_initialstate); - if (fpu_initialstate.sv_env.en_mxcsr_mask) - cpu_mxcsr_mask = fpu_initialstate.sv_env.en_mxcsr_mask; - else - cpu_mxcsr_mask = 0xFFBF; - bzero(fpu_initialstate.sv_fp, sizeof(fpu_initialstate.sv_fp)); - bzero(fpu_initialstate.sv_xmm, sizeof(fpu_initialstate.sv_xmm)); - } start_emulating(); intr_restore(saveintr); } /* + * On the boot CPU we generate a clean state that is used to + * initialize the floating point unit when it is first used by a + * process. + */ +static void +fpuinitstate(void *arg __unused) +{ + register_t saveintr; + + fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, + M_WAITOK | M_ZERO); + saveintr = intr_disable(); + stop_emulating(); + + fpusave(fpu_initialstate); + if (fpu_initialstate->sv_env.en_mxcsr_mask) + cpu_mxcsr_mask = fpu_initialstate->sv_env.en_mxcsr_mask; + else + cpu_mxcsr_mask = 0xFFBF; + + /* + * The fninit instruction does not modify XMM registers. The + * fpusave call dumped the garbage contained in the registers + * after reset to the initial state saved. Clear XMM + * registers file image to make the startup program state and + * signal handler XMM register content predictable. + */ + bzero(&fpu_initialstate->sv_xmm[0], sizeof(struct xmmacc)); + + start_emulating(); + intr_restore(saveintr); +} +SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_ANY, fpuinitstate, NULL); + +/* * Free coprocessor (if we have it). */ void @@ -150,7 +306,7 @@ fpuexit(struct thread *td) critical_enter(); if (curthread == PCPU_GET(fpcurthread)) { stop_emulating(); - fxsave(PCPU_GET(curpcb)->pcb_save); + fpusave(PCPU_GET(curpcb)->pcb_save); start_emulating(); PCPU_SET(fpcurthread, 0); } @@ -423,7 +579,7 @@ fpudna(void) * the PCB doesn't contain a clean FPU state. Explicitly * load an initial state. */ - fxrstor(&fpu_initialstate); + fpurestore(fpu_initialstate); if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) fldcw(pcb->pcb_initial_fpucw); if (PCB_USER_FPU(pcb)) @@ -432,7 +588,7 @@ fpudna(void) else set_pcb_flags(pcb, PCB_FPUINITDONE); } else - fxrstor(pcb->pcb_save); + fpurestore(pcb->pcb_save); critical_exit(); } @@ -461,15 +617,16 @@ fpugetregs(struct thread *td) pcb = td->td_pcb; if ((pcb->pcb_flags & PCB_USERFPUINITDONE) == 0) { - bcopy(&fpu_initialstate, &pcb->pcb_user_save, - sizeof(fpu_initialstate)); - pcb->pcb_user_save.sv_env.en_cw = pcb->pcb_initial_fpucw; + bcopy(fpu_initialstate, get_pcb_user_save_pcb(pcb), + cpu_max_ext_state_size); + get_pcb_user_save_pcb(pcb)->sv_env.en_cw = + pcb->pcb_initial_fpucw; fpuuserinited(td); return (_MC_FPOWNED_PCB); } critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { - fxsave(&pcb->pcb_user_save); + fpusave(get_pcb_user_save_pcb(pcb)); critical_exit(); return (_MC_FPOWNED_FPU); } else { @@ -491,25 +648,78 @@ fpuuserinited(struct thread *td) set_pcb_flags(pcb, PCB_FPUINITDONE); } +int +fpusetxstate(struct thread *td, char *xfpustate, size_t xfpustate_size) +{ + struct xstate_hdr *hdr, *ehdr; + size_t len, max_len; + uint64_t bv; + + /* XXXKIB should we clear all extended state in xstate_bv instead ? */ + if (xfpustate == NULL) + return (0); + if (!use_xsave) + return (EOPNOTSUPP); + + len = xfpustate_size; + if (len < sizeof(struct xstate_hdr)) + return (EINVAL); + max_len = cpu_max_ext_state_size - sizeof(struct savefpu); + if (len > max_len) + return (EINVAL); + + ehdr = (struct xstate_hdr *)xfpustate; + bv = ehdr->xstate_bv; + + /* + * Avoid #gp. + */ + if (bv & ~xsave_mask) + return (EINVAL); + if ((bv & (XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE)) != + (XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE)) + return (EINVAL); + + hdr = (struct xstate_hdr *)(get_pcb_user_save_td(td) + 1); + + hdr->xstate_bv = bv; + bcopy(xfpustate + sizeof(struct xstate_hdr), + (char *)(hdr + 1), len - sizeof(struct xstate_hdr)); + + return (0); +} + /* * Set the state of the FPU. */ -void -fpusetregs(struct thread *td, struct savefpu *addr) +int +fpusetregs(struct thread *td, struct savefpu *addr, char *xfpustate, + size_t xfpustate_size) { struct pcb *pcb; + int error; pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { - fxrstor(addr); + error = fpusetxstate(td, xfpustate, xfpustate_size); + if (error != 0) { + critical_exit(); + return (error); + } + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); + fpurestore(get_pcb_user_save_td(td)); critical_exit(); set_pcb_flags(pcb, PCB_FPUINITDONE | PCB_USERFPUINITDONE); } else { critical_exit(); - bcopy(addr, &td->td_pcb->pcb_user_save, sizeof(*addr)); + error = fpusetxstate(td, xfpustate, xfpustate_size); + if (error != 0) + return (error); + bcopy(addr, get_pcb_user_save_td(td), sizeof(*addr)); fpuuserinited(td); } + return (0); } /* @@ -599,20 +809,62 @@ static devclass_t fpupnp_devclass; DRIVER_MODULE(fpupnp, acpi, fpupnp_driver, fpupnp_devclass, 0, 0); #endif /* DEV_ISA */ +static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", + "Kernel contexts for FPU state"); + +#define FPU_KERN_CTX_FPUINITDONE 0x01 + +struct fpu_kern_ctx { + struct savefpu *prev; + uint32_t flags; + char hwstate1[]; +}; + +struct fpu_kern_ctx * +fpu_kern_alloc_ctx(u_int flags) +{ + struct fpu_kern_ctx *res; + size_t sz; + + sz = sizeof(struct fpu_kern_ctx) + XSAVE_AREA_ALIGN + + cpu_max_ext_state_size; + res = malloc(sz, M_FPUKERN_CTX, ((flags & FPU_KERN_NOWAIT) ? + M_NOWAIT : M_WAITOK) | M_ZERO); + return (res); +} + +void +fpu_kern_free_ctx(struct fpu_kern_ctx *ctx) +{ + + /* XXXKIB clear the memory ? */ + free(ctx, M_FPUKERN_CTX); +} + +static struct savefpu * +fpu_kern_ctx_savefpu(struct fpu_kern_ctx *ctx) +{ + vm_offset_t p; + + p = (vm_offset_t)&ctx->hwstate1; + p = roundup2(p, XSAVE_AREA_ALIGN); + return ((struct savefpu *)p); +} + int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) { struct pcb *pcb; pcb = td->td_pcb; - KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == &pcb->pcb_user_save, - ("mangled pcb_save")); + KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == + get_pcb_user_save_pcb(pcb), ("mangled pcb_save")); ctx->flags = 0; if ((pcb->pcb_flags & PCB_FPUINITDONE) != 0) ctx->flags |= FPU_KERN_CTX_FPUINITDONE; fpuexit(td); ctx->prev = pcb->pcb_save; - pcb->pcb_save = &ctx->hwstate; + pcb->pcb_save = fpu_kern_ctx_savefpu(ctx); set_pcb_flags(pcb, PCB_KERNFPU); clear_pcb_flags(pcb, PCB_FPUINITDONE); return (0); @@ -629,7 +881,7 @@ fpu_kern_leave(struct thread *td, struct fpudrop(); critical_exit(); pcb->pcb_save = ctx->prev; - if (pcb->pcb_save == &pcb->pcb_user_save) { + if (pcb->pcb_save == get_pcb_user_save_pcb(pcb)) { if ((pcb->pcb_flags & PCB_USERFPUINITDONE) != 0) { set_pcb_flags(pcb, PCB_FPUINITDONE); clear_pcb_flags(pcb, PCB_KERNFPU); @@ -653,7 +905,8 @@ fpu_kern_thread(u_int flags) pcb = PCPU_GET(curpcb); KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, ("Only kthread may use fpu_kern_thread")); - KASSERT(pcb->pcb_save == &pcb->pcb_user_save, ("mangled pcb_save")); + KASSERT(pcb->pcb_save == get_pcb_user_save_pcb(pcb), + ("mangled pcb_save")); KASSERT(PCB_USER_FPU(pcb), ("recursive call")); set_pcb_flags(pcb, PCB_KERNFPU); Modified: stable/8/sys/amd64/amd64/genassym.c ============================================================================== --- stable/8/sys/amd64/amd64/genassym.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/genassym.c Wed Jun 13 15:25:52 2012 (r237009) @@ -156,7 +156,7 @@ ASSYM(PCB_GS32SD, offsetof(struct pcb, p ASSYM(PCB_TSSP, offsetof(struct pcb, pcb_tssp)); ASSYM(PCB_SAVEFPU, offsetof(struct pcb, pcb_save)); ASSYM(PCB_SAVEFPU_SIZE, sizeof(struct savefpu)); -ASSYM(PCB_USERFPU, offsetof(struct pcb, pcb_user_save)); +ASSYM(PCB_USERFPU, sizeof(struct pcb)); ASSYM(PCB_SIZE, sizeof(struct pcb)); ASSYM(PCB_FULL_IRET, PCB_FULL_IRET); ASSYM(PCB_DBREGS, PCB_DBREGS); Modified: stable/8/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/8/sys/amd64/amd64/initcpu.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/initcpu.c Wed Jun 13 15:25:52 2012 (r237009) @@ -72,6 +72,7 @@ u_int cpu_vendor_id; /* CPU vendor ID * u_int cpu_fxsr; /* SSE enabled */ u_int cpu_mxcsr_mask; /* Valid bits in mxcsr */ u_int cpu_clflush_line_size = 32; +u_int cpu_max_ext_state_size; SYSCTL_UINT(_hw, OID_AUTO, via_feature_rng, CTLFLAG_RD, &via_feature_rng, 0, "VIA C3/C7 RNG feature available in CPU"); Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Wed Jun 13 15:04:50 2012 (r237008) +++ stable/8/sys/amd64/amd64/machdep.c Wed Jun 13 15:25:52 2012 (r237009) @@ -149,8 +149,10 @@ extern void panicifcpuunsupported(void); #define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) static void cpu_startup(void *); -static void get_fpcontext(struct thread *td, mcontext_t *mcp); -static int set_fpcontext(struct thread *td, const mcontext_t *mcp); +static void get_fpcontext(struct thread *td, mcontext_t *mcp, + char *xfpusave, size_t xfpusave_len); +static int set_fpcontext(struct thread *td, const mcontext_t *mcp, + char *xfpustate, size_t xfpustate_len); SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); #ifdef DDB @@ -305,6 +307,8 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, struct sigacts *psp; char *sp; struct trapframe *regs; + char *xfpusave; + size_t xfpusave_len; int sig; int oonstack; @@ -318,6 +322,14 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); + if (cpu_max_ext_state_size > sizeof(struct savefpu) && use_xsave) { + xfpusave_len = cpu_max_ext_state_size - sizeof(struct savefpu); + xfpusave = __builtin_alloca(xfpusave_len); + } else { + xfpusave_len = 0; + xfpusave = NULL; + } + /* Save user context. */ bzero(&sf, sizeof(sf)); sf.sf_uc.uc_sigmask = *mask; @@ -327,7 +339,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; bcopy(regs, &sf.sf_uc.uc_mcontext.mc_rdi, sizeof(*regs)); sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */ - get_fpcontext(td, &sf.sf_uc.uc_mcontext); + get_fpcontext(td, &sf.sf_uc.uc_mcontext, xfpusave, xfpusave_len); fpstate_drop(td); sf.sf_uc.uc_mcontext.mc_fsbase = pcb->pcb_fsbase; sf.sf_uc.uc_mcontext.mc_gsbase = pcb->pcb_gsbase; @@ -338,13 +350,18 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, /* Allocate space for the signal handler context. */ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && SIGISMEMBER(psp->ps_sigonstack, sig)) { - sp = td->td_sigstk.ss_sp + - td->td_sigstk.ss_size - sizeof(struct sigframe); + sp = td->td_sigstk.ss_sp + td->td_sigstk.ss_size; #if defined(COMPAT_43) td->td_sigstk.ss_flags |= SS_ONSTACK; #endif } else - sp = (char *)regs->tf_rsp - sizeof(struct sigframe) - 128; + sp = (char *)regs->tf_rsp - 128; + if (xfpusave != NULL) { + sp -= xfpusave_len; + sp = (char *)((unsigned long)sp & ~0x3Ful); + sf.sf_uc.uc_mcontext.mc_xfpustate = (register_t)sp; + } + sp -= sizeof(struct sigframe); /* Align to 16 bytes. */ sfp = (struct sigframe *)((unsigned long)sp & ~0xFul); @@ -377,7 +394,10 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, /* * Copy the sigframe out to the user's stack. */ - if (copyout(&sf, sfp, sizeof(*sfp)) != 0) { + if (copyout(&sf, sfp, sizeof(*sfp)) != 0 || + (xfpusave != NULL && copyout(xfpusave, + (void *)sf.sf_uc.uc_mcontext.mc_xfpustate, xfpusave_len) + != 0)) { #ifdef DEBUG printf("process %ld has trashed its stack\n", (long)p->p_pid); #endif @@ -422,6 +442,8 @@ sigreturn(td, uap) struct proc *p; struct trapframe *regs; ucontext_t *ucp; + char *xfpustate; + size_t xfpustate_len; long rflags; int cs, error, ret; ksiginfo_t ksi; @@ -480,7 +502,28 @@ sigreturn(td, uap) return (EINVAL); } - ret = set_fpcontext(td, &ucp->uc_mcontext); + if ((uc.uc_mcontext.mc_flags & _MC_HASFPXSTATE) != 0) { + xfpustate_len = uc.uc_mcontext.mc_xfpustate_len; + if (xfpustate_len > cpu_max_ext_state_size - + sizeof(struct savefpu)) { + uprintf("pid %d (%s): sigreturn xfpusave_len = 0x%zx\n", + p->p_pid, td->td_name, xfpustate_len); + return (EINVAL); + } + xfpustate = __builtin_alloca(xfpustate_len); + error = copyin((const void *)uc.uc_mcontext.mc_xfpustate, + xfpustate, xfpustate_len); + if (error != 0) { + uprintf( + "pid %d (%s): sigreturn copying xfpustate failed\n", + p->p_pid, td->td_name); + return (error); + } + } else { + xfpustate = NULL; + xfpustate_len = 0; + } + ret = set_fpcontext(td, &ucp->uc_mcontext, xfpustate, xfpustate_len); if (ret != 0) { uprintf("pid %d (%s): sigreturn set_fpcontext err %d\n", p->p_pid, td->td_name, ret); @@ -1543,6 +1586,7 @@ hammer_time(u_int64_t modulep, u_int64_t int gsel_tss, x; struct pcpu *pc; struct nmi_pcpu *np; + struct xstate_hdr *xhdr; u_int64_t msr; char *env; size_t kstack0_sz; @@ -1552,7 +1596,6 @@ hammer_time(u_int64_t modulep, u_int64_t kstack0_sz = thread0.td_kstack_pages * PAGE_SIZE; bzero((void *)thread0.td_kstack, kstack0_sz); physfree += kstack0_sz; - thread0.td_pcb = (struct pcb *)(thread0.td_kstack + kstack0_sz) - 1; /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 15:40:05 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C5AFD1065673; Wed, 13 Jun 2012 15:40:05 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 69D378FC25; Wed, 13 Jun 2012 15:40:05 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id E5135640; Wed, 13 Jun 2012 17:40:03 +0200 (CEST) Date: Wed, 13 Jun 2012 17:38:09 +0200 From: Pawel Jakub Dawidek To: Mateusz Guzik Message-ID: <20120613153809.GB1399@garage.freebsd.pl> References: <20120612114335.GA1372@garage.freebsd.pl> <20120612134950.GC20749@dft-labs.eu> <20120612160128.GA1429@garage.freebsd.pl> <20120612191828.GD20749@dft-labs.eu> <20120612214400.GB1429@garage.freebsd.pl> <20120613093807.GA3893@dft-labs.eu> <20120613102900.GD1386@garage.freebsd.pl> <20120613105344.GB3893@dft-labs.eu> <20120613111309.GE1386@garage.freebsd.pl> <20120613111853.GC3893@dft-labs.eu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rJwd6BRFiFCcLxzm" Content-Disposition: inline In-Reply-To: <20120613111853.GC3893@dft-labs.eu> X-OS: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, davidxu@FreeBSD.org Subject: Re: svn commit: r236935 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 15:40:06 -0000 --rJwd6BRFiFCcLxzm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 13, 2012 at 01:18:53PM +0200, Mateusz Guzik wrote: > On Wed, Jun 13, 2012 at 01:13:09PM +0200, Pawel Jakub Dawidek wrote: > > On Wed, Jun 13, 2012 at 12:53:44PM +0200, Mateusz Guzik wrote: > > > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free5.patch > > >=20 > > > David reported that previous version of the patch fixed panic he was > > > experiencing, so I consider the patch tested. > >=20 > > Looks good, one (hopefully last) minor nit. I'd change this comment: > >=20 > > * Search the bitmap for a free descriptor starting at minfd. If none > > * is found, try to grow the file table. > >=20 > > To something like this: > >=20 > > * Search the bitmap for a free descriptor starting at minfd. > > * If none is found, grow the file table. > >=20 > > 'try' is a bit misleading for my taste, as it suggest that growing the > > file table might fail, I think. > >=20 >=20 > Done in: > http://people.freebsd.org/~mjg/patches/fdalloc%2bfd_first_free6.patch Perfect:) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl --rJwd6BRFiFCcLxzm Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iEYEARECAAYFAk/Ys94ACgkQForvXbEpPzTvuwCghGhiwc8dYyujbKPL/R5WaMHl +2QAoKqhApCORVHHGVUOzFtzKeNPB7cm =XJ4k -----END PGP SIGNATURE----- --rJwd6BRFiFCcLxzm-- From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 16:12:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8252E106564A; Wed, 13 Jun 2012 16:12:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 621278FC16; Wed, 13 Jun 2012 16:12:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DGCVNV034650; Wed, 13 Jun 2012 16:12:31 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DGCVBU034644; Wed, 13 Jun 2012 16:12:31 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206131612.q5DGCVBU034644@svn.freebsd.org> From: Warner Losh Date: Wed, 13 Jun 2012 16:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237010 - in head/sys/arm/xscale: i80321 i8134x ixp425 pxa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 16:12:31 -0000 Author: imp Date: Wed Jun 13 16:12:30 2012 New Revision: 237010 URL: http://svn.freebsd.org/changeset/base/237010 Log: Remove leakage of other patches into last commit. Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c head/sys/arm/xscale/i80321/iq31244_machdep.c head/sys/arm/xscale/i8134x/crb_machdep.c head/sys/arm/xscale/ixp425/avila_machdep.c head/sys/arm/xscale/pxa/pxa_machdep.c Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/ep80219_machdep.c Wed Jun 13 15:25:52 2012 (r237009) +++ head/sys/arm/xscale/i80321/ep80219_machdep.c Wed Jun 13 16:12:30 2012 (r237010) @@ -192,8 +192,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; - lastaddr = parse_boot_param(abp); set_cpufuncs(); + lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/iq31244_machdep.c Wed Jun 13 15:25:52 2012 (r237009) +++ head/sys/arm/xscale/i80321/iq31244_machdep.c Wed Jun 13 16:12:30 2012 (r237010) @@ -193,8 +193,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; - lastaddr = parse_boot_param(abp); set_cpufuncs(); + lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- head/sys/arm/xscale/i8134x/crb_machdep.c Wed Jun 13 15:25:52 2012 (r237009) +++ head/sys/arm/xscale/i8134x/crb_machdep.c Wed Jun 13 16:12:30 2012 (r237010) @@ -189,8 +189,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; - lastaddr = parse_boot_param(abp); set_cpufuncs(); + lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Wed Jun 13 15:25:52 2012 (r237009) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Wed Jun 13 16:12:30 2012 (r237010) @@ -238,8 +238,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize; - lastaddr = parse_boot_param(abp); set_cpufuncs(); /* NB: sets cputype */ + lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- head/sys/arm/xscale/pxa/pxa_machdep.c Wed Jun 13 15:25:52 2012 (r237009) +++ head/sys/arm/xscale/pxa/pxa_machdep.c Wed Jun 13 16:12:30 2012 (r237010) @@ -174,8 +174,8 @@ initarm(struct arm_boot_params *abp) int i, j; uint32_t memsize[PXA2X0_SDRAM_BANKS], memstart[PXA2X0_SDRAM_BANKS]; - lastaddr = parse_boot_param(abp); set_cpufuncs(); + lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 16:40:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC76A1065672; Wed, 13 Jun 2012 16:40:48 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 971138FC16; Wed, 13 Jun 2012 16:40:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DGemFp036155; Wed, 13 Jun 2012 16:40:48 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DGemfY036153; Wed, 13 Jun 2012 16:40:48 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206131640.q5DGemfY036153@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 13 Jun 2012 16:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237011 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 16:40:48 -0000 Author: des Date: Wed Jun 13 16:40:47 2012 New Revision: 237011 URL: http://svn.freebsd.org/changeset/base/237011 Log: Also remove /usr/share/examples/etc/auth.conf, which I didn't even realize existed. Noticed by: Andrey Zonov MFC after: 3 weeks Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jun 13 16:12:30 2012 (r237010) +++ head/ObsoleteFiles.inc Wed Jun 13 16:40:47 2012 (r237011) @@ -40,6 +40,7 @@ # 20120613: auth.conf removed OLD_FILES+=etc/auth.conf +OLD_FILES+=usr/share/examples/etc/auth.conf OLD_FILES+=usr/share/man/man3/auth.3.gz OLD_FILES+=usr/share/man/man5/auth.conf.5.gz # 20120530: kde pam lives now in ports From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 17:12:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B847106564A; Wed, 13 Jun 2012 17:12:54 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D15658FC0C; Wed, 13 Jun 2012 17:12:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DHCrkR037620; Wed, 13 Jun 2012 17:12:53 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DHCrbf037618; Wed, 13 Jun 2012 17:12:53 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201206131712.q5DHCrbf037618@svn.freebsd.org> From: Mateusz Guzik Date: Wed, 13 Jun 2012 17:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237012 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 17:12:54 -0000 Author: mjg Date: Wed Jun 13 17:12:53 2012 New Revision: 237012 URL: http://svn.freebsd.org/changeset/base/237012 Log: Re-apply reverted parts of r236935 by pjd with some changes. If fdalloc() decides to grow fdtable it does it once and at most doubles the size. This still may be not enough for sufficiently large fd. Use fd in calculations of new size in order to fix this. When growing the table, fd is already equal to first free descriptor >= minfd, also fdgrowtable() no longer drops the filedesc lock. As a result of this there is no need to retry allocation nor lookup. Fix description of fd_first_free to note all return values. In co-operation with: pjd Approved by: trasz (mentor) MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 13 16:40:47 2012 (r237011) +++ head/sys/kern/kern_descrip.c Wed Jun 13 17:12:53 2012 (r237012) @@ -189,8 +189,9 @@ void (*mq_fdclose)(struct thread *td, in static struct mtx fdesc_mtx; /* - * Find the first zero bit in the given bitmap, starting at low and not - * exceeding size - 1. + * If low >= size, just return low. Otherwise find the first zero bit in the + * given bitmap, starting at low and not exceeding size - 1. Return size if + * not found. */ static int fd_first_free(struct filedesc *fdp, int low, int size) @@ -1461,7 +1462,7 @@ fdalloc(struct thread *td, int minfd, in { struct proc *p = td->td_proc; struct filedesc *fdp = p->p_fd; - int fd = -1, maxfd; + int fd = -1, maxfd, allocfd; #ifdef RACCT int error; #endif @@ -1476,25 +1477,26 @@ fdalloc(struct thread *td, int minfd, in PROC_UNLOCK(p); /* - * Search the bitmap for a free descriptor. If none is found, try - * to grow the file table. Keep at it until we either get a file - * descriptor or run into process or system limits. + * Search the bitmap for a free descriptor starting at minfd. + * If none is found, grow the file table. */ - for (;;) { - fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); - if (fd >= maxfd) - return (EMFILE); - if (fd < fdp->fd_nfiles) - break; + fd = fd_first_free(fdp, minfd, fdp->fd_nfiles); + if (fd >= maxfd) + return (EMFILE); + if (fd >= fdp->fd_nfiles) { + allocfd = min(fd * 2, maxfd); #ifdef RACCT PROC_LOCK(p); - error = racct_set(p, RACCT_NOFILE, - min(fdp->fd_nfiles * 2, maxfd)); + error = racct_set(p, RACCT_NOFILE, allocfd); PROC_UNLOCK(p); if (error != 0) return (EMFILE); #endif - fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd)); + /* + * fd is already equal to first free descriptor >= minfd, so + * we only need to grow the table and we are done. + */ + fdgrowtable(fdp, allocfd); } /* From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 17:18:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E10D51065670; Wed, 13 Jun 2012 17:18:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B33E68FC0C; Wed, 13 Jun 2012 17:18:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DHIGGo037906; Wed, 13 Jun 2012 17:18:16 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DHIGH5037904; Wed, 13 Jun 2012 17:18:16 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201206131718.q5DHIGH5037904@svn.freebsd.org> From: Mateusz Guzik Date: Wed, 13 Jun 2012 17:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237013 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 17:18:17 -0000 Author: mjg Date: Wed Jun 13 17:18:16 2012 New Revision: 237013 URL: http://svn.freebsd.org/changeset/base/237013 Log: Remove 'low' argument from fd_last_used(). This function is static and the only caller always passes 0 as low. While here update note about return values in comment. Reviewed by: pjd Approved by: trasz (mentor) MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 13 17:12:53 2012 (r237012) +++ head/sys/kern/kern_descrip.c Wed Jun 13 17:18:16 2012 (r237013) @@ -119,7 +119,7 @@ static int closefp(struct filedesc *fdp, static int do_dup(struct thread *td, int flags, int old, int new, register_t *retval); static int fd_first_free(struct filedesc *, int, int); -static int fd_last_used(struct filedesc *, int, int); +static int fd_last_used(struct filedesc *, int); static void fdgrowtable(struct filedesc *, int); static void fdunused(struct filedesc *fdp, int fd); static void fdused(struct filedesc *fdp, int fd); @@ -217,19 +217,16 @@ fd_first_free(struct filedesc *fdp, int } /* - * Find the highest non-zero bit in the given bitmap, starting at low and - * not exceeding size - 1. + * Find the highest non-zero bit in the given bitmap, starting at 0 and + * not exceeding size - 1. Return -1 if not found. */ static int -fd_last_used(struct filedesc *fdp, int low, int size) +fd_last_used(struct filedesc *fdp, int size) { NDSLOTTYPE *map = fdp->fd_map; NDSLOTTYPE mask; int off, minoff; - if (low >= size) - return (-1); - off = NDSLOT(size); if (size % NDENTRIES) { mask = ~(~(NDSLOTTYPE)0 << (size % NDENTRIES)); @@ -237,10 +234,10 @@ fd_last_used(struct filedesc *fdp, int l return (off * NDENTRIES + flsl(mask) - 1); --off; } - for (minoff = NDSLOT(low); off >= minoff; --off) + for (minoff = NDSLOT(0); off >= minoff; --off) if (map[off] != 0) return (off * NDENTRIES + flsl(map[off]) - 1); - return (low - 1); + return (-1); } static int @@ -286,7 +283,7 @@ fdunused(struct filedesc *fdp, int fd) if (fd < fdp->fd_freefile) fdp->fd_freefile = fd; if (fd == fdp->fd_lastfile) - fdp->fd_lastfile = fd_last_used(fdp, 0, fd); + fdp->fd_lastfile = fd_last_used(fdp, fd); } /* From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 17:45:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 86A4F106564A; Wed, 13 Jun 2012 17:45:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 710A18FC08; Wed, 13 Jun 2012 17:45:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DHjd17039231; Wed, 13 Jun 2012 17:45:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DHjdaA039229; Wed, 13 Jun 2012 17:45:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206131745.q5DHjdaA039229@svn.freebsd.org> From: John Baldwin Date: Wed, 13 Jun 2012 17:45:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237014 - stable/8/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 17:45:39 -0000 Author: jhb Date: Wed Jun 13 17:45:38 2012 New Revision: 237014 URL: http://svn.freebsd.org/changeset/base/237014 Log: Restore 229262 which was accidentally reverted in a prior change: Implement BUS_ADD_CHILD() for the isab(4) driver. Submitted by: fabient Modified: stable/8/sys/dev/pci/isa_pci.c Modified: stable/8/sys/dev/pci/isa_pci.c ============================================================================== --- stable/8/sys/dev/pci/isa_pci.c Wed Jun 13 17:18:16 2012 (r237013) +++ stable/8/sys/dev/pci/isa_pci.c Wed Jun 13 17:45:38 2012 (r237014) @@ -57,6 +57,7 @@ static device_method_t isab_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 17:56:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D37E106566B; Wed, 13 Jun 2012 17:56:50 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 0B99E8FC0C; Wed, 13 Jun 2012 17:56:50 +0000 (UTC) Received: from ds4.des.no (smtp.des.no [194.63.250.102]) by smtp.des.no (Postfix) with ESMTP id F20DA6123; Wed, 13 Jun 2012 16:39:36 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id C404F81E6; Wed, 13 Jun 2012 18:39:36 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Andrey Zonov References: <201206131159.q5DBx3HB022521@svn.freebsd.org> Date: Wed, 13 Jun 2012 18:39:36 +0200 In-Reply-To: (Andrey Zonov's message of "Wed, 13 Jun 2012 19:07:26 +0400") Message-ID: <8662avjhdj.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237005 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 17:56:50 -0000 Andrey Zonov writes: > I think you missed usr/share/examples/etc/auth.conf Thanks, I didn't even realize it existed. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 18:57:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 362581065670; Wed, 13 Jun 2012 18:57:28 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 208BF8FC12; Wed, 13 Jun 2012 18:57:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DIvRQi042510; Wed, 13 Jun 2012 18:57:27 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DIvR2v042507; Wed, 13 Jun 2012 18:57:27 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206131857.q5DIvR2v042507@svn.freebsd.org> From: Joel Dahl Date: Wed, 13 Jun 2012 18:57:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237015 - in head: sys/netinet/libalias usr.sbin/apmd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 18:57:28 -0000 Author: joel (doc committer) Date: Wed Jun 13 18:57:27 2012 New Revision: 237015 URL: http://svn.freebsd.org/changeset/base/237015 Log: mdoc: avoid nested displays. Fixes mandoc warnings. Modified: head/sys/netinet/libalias/libalias.3 head/usr.sbin/apmd/apmd.8 Modified: head/sys/netinet/libalias/libalias.3 ============================================================================== --- head/sys/netinet/libalias/libalias.3 Wed Jun 13 17:45:38 2012 (r237014) +++ head/sys/netinet/libalias/libalias.3 Wed Jun 13 18:57:27 2012 (r237015) @@ -201,11 +201,10 @@ is closed. If this mode bit is set, traffic on the local network which does not originate from unregistered address spaces will be ignored. Standard Class A, B and C unregistered addresses are: -.Bd -literal -offset indent +.Pp 10.0.0.0 -> 10.255.255.255 (Class A subnet) 172.16.0.0 -> 172.31.255.255 (Class B subnets) 192.168.0.0 -> 192.168.255.255 (Class C subnets) -.Ed .Pp This option is useful in the case that the packet aliasing host has both registered and unregistered subnets on different interfaces. @@ -499,14 +498,13 @@ call. New traffic generated by any of the local machines, designated in the several function calls, will be aliased to the same address. Consider the following example: -.Bd -literal -offset indent +.Pp LibAliasRedirectAddr(la, inet_aton("192.168.0.2"), inet_aton("141.221.254.101")); LibAliasRedirectAddr(la, inet_aton("192.168.0.3"), inet_aton("141.221.254.101")); LibAliasRedirectAddr(la, inet_aton("192.168.0.4"), inet_aton("141.221.254.101")); -.Ed .Pp Any outgoing connections such as .Xr telnet 1 Modified: head/usr.sbin/apmd/apmd.8 ============================================================================== --- head/usr.sbin/apmd/apmd.8 Wed Jun 13 17:45:38 2012 (r237014) +++ head/usr.sbin/apmd/apmd.8 Wed Jun 13 18:57:27 2012 (r237015) @@ -245,13 +245,13 @@ just as with a command line. The following built-in functions are currently supported: .Bl -item .It -- reject: -.Bd -ragged -offset indent +.Bl -tag -width ".It - reject" +.It - reject Reject last request posted by APM BIOS. This can be used to reject a SUSPEND request when the LCD is closed and put the system in a STANDBY state instead. -.Ed +.El .El .Ed .El From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 19:00:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A4CBF1065672; Wed, 13 Jun 2012 19:00:30 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8ED088FC1C; Wed, 13 Jun 2012 19:00:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DJ0Uqn042701; Wed, 13 Jun 2012 19:00:30 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DJ0UiI042699; Wed, 13 Jun 2012 19:00:30 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206131900.q5DJ0UiI042699@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 19:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237016 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 19:00:30 -0000 Author: pjd Date: Wed Jun 13 19:00:29 2012 New Revision: 237016 URL: http://svn.freebsd.org/changeset/base/237016 Log: There is only one caller of the dupfdopen() function, so we can simplify it a bit: - We can assert that only ENODEV and ENXIO errors are passed instead of handling other errors. - The caller always call finstall() for indx descriptor, so we can assume it is set. Actually the filedesc lock is dropped between finstall() and dupfdopen(), so there is a window there for another thread to close the indx descriptor, but it will be closed in next commit. Reviewed by: mjg MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 13 18:57:27 2012 (r237015) +++ head/sys/kern/kern_descrip.c Wed Jun 13 19:00:29 2012 (r237016) @@ -2593,6 +2593,9 @@ dupfdopen(struct thread *td, struct file struct file *wfp; struct file *fp; + KASSERT(error == ENODEV || error == ENXIO, + ("unexpected error %d in %s", error, __func__)); + /* * If the to-be-dup'd fd number is greater than the allowed number * of file descriptors, or the fd to be dup'd has already been @@ -2612,9 +2615,8 @@ dupfdopen(struct thread *td, struct file * * For ENXIO steal away the file structure from (dfd) and store it in * (indx). (dfd) is effectively closed by this operation. - * - * Any other error code is just returned. */ + fp = fdp->fd_ofiles[indx]; switch (error) { case ENODEV: /* @@ -2625,48 +2627,28 @@ dupfdopen(struct thread *td, struct file FILEDESC_XUNLOCK(fdp); return (EACCES); } - fp = fdp->fd_ofiles[indx]; fdp->fd_ofiles[indx] = wfp; fdp->fd_ofileflags[indx] = fdp->fd_ofileflags[dfd]; - if (fp == NULL) - fdused(fdp, indx); fhold(wfp); - FILEDESC_XUNLOCK(fdp); - if (fp != NULL) - /* - * We now own the reference to fp that the ofiles[] - * array used to own. Release it. - */ - fdrop(fp, td); - return (0); - + break; case ENXIO: /* * Steal away the file pointer from dfd and stuff it into indx. */ - fp = fdp->fd_ofiles[indx]; - fdp->fd_ofiles[indx] = fdp->fd_ofiles[dfd]; + fdp->fd_ofiles[indx] = wfp; fdp->fd_ofiles[dfd] = NULL; fdp->fd_ofileflags[indx] = fdp->fd_ofileflags[dfd]; fdp->fd_ofileflags[dfd] = 0; fdunused(fdp, dfd); - if (fp == NULL) - fdused(fdp, indx); - FILEDESC_XUNLOCK(fdp); - - /* - * We now own the reference to fp that the ofiles[] array - * used to own. Release it. - */ - if (fp != NULL) - fdrop(fp, td); - return (0); - - default: - FILEDESC_XUNLOCK(fdp); - return (error); + break; } - /* NOTREACHED */ + FILEDESC_XUNLOCK(fdp); + /* + * We now own the reference to fp that the ofiles[] array used to own. + * Release it. + */ + fdrop(fp, td); + return (0); } /* From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 19:04:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B0591065670; Wed, 13 Jun 2012 19:04:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 152D28FC08; Wed, 13 Jun 2012 19:04:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DJ4dZn042927; Wed, 13 Jun 2012 19:04:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DJ4dOX042925; Wed, 13 Jun 2012 19:04:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201206131904.q5DJ4dOX042925@svn.freebsd.org> From: John Baldwin Date: Wed, 13 Jun 2012 19:04:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237017 - stable/9/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 19:04:40 -0000 Author: jhb Date: Wed Jun 13 19:04:39 2012 New Revision: 237017 URL: http://svn.freebsd.org/changeset/base/237017 Log: Ensure that the beginning of the DSS is aligned on a chunk boundary. If the _end symbol used an address with the low bit set, then the initial arena could end up with corrupted rb trees causing a crash during the first call to malloc(). This is a direct commit to stable/9 as it does not affect the version of malloc in HEAD. Reviewed by: jasone MFC after: 1 week Modified: stable/9/lib/libc/stdlib/malloc.c Modified: stable/9/lib/libc/stdlib/malloc.c ============================================================================== --- stable/9/lib/libc/stdlib/malloc.c Wed Jun 13 19:00:29 2012 (r237016) +++ stable/9/lib/libc/stdlib/malloc.c Wed Jun 13 19:04:39 2012 (r237017) @@ -5790,6 +5790,9 @@ MALLOC_OUT: #ifdef MALLOC_DSS malloc_mutex_init(&dss_mtx); dss_base = sbrk(0); + i = (uintptr_t)dss_base & QUANTUM_MASK; + if (i != 0) + dss_base = sbrk(QUANTUM - i); dss_prev = dss_base; dss_max = dss_base; extent_tree_szad_new(&dss_chunks_szad); From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 19:08:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2FAE1065670; Wed, 13 Jun 2012 19:08:00 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9DF198FC17; Wed, 13 Jun 2012 19:08:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DJ80q0043116; Wed, 13 Jun 2012 19:08:00 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DJ80UC043114; Wed, 13 Jun 2012 19:08:00 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206131908.q5DJ80UC043114@svn.freebsd.org> From: Joel Dahl Date: Wed, 13 Jun 2012 19:08:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237018 - head/share/examples/mdoc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 19:08:00 -0000 Author: joel (doc committer) Date: Wed Jun 13 19:08:00 2012 New Revision: 237018 URL: http://svn.freebsd.org/changeset/base/237018 Log: Sync example file with mdoc changes made in rev 235450. Modified: head/share/examples/mdoc/example.4 Modified: head/share/examples/mdoc/example.4 ============================================================================== --- head/share/examples/mdoc/example.4 Wed Jun 13 19:04:39 2012 (r237017) +++ head/share/examples/mdoc/example.4 Wed Jun 13 19:08:00 2012 (r237018) @@ -34,7 +34,6 @@ .Nd "example device driver manual page" .Sh SYNOPSIS To compile the -.Ns Nm driver into the kernel, place the following lines in the kernel configuration file: @@ -44,7 +43,6 @@ kernel configuration file: .Ed .Pp Alternatively, to load the -.Ns Nm driver as a module at boot time, place the following line in .Xr loader.conf 5 : From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 19:53:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 00E25106566C; Wed, 13 Jun 2012 19:53:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E0A338FC14; Wed, 13 Jun 2012 19:53:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DJrTbX045164; Wed, 13 Jun 2012 19:53:29 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DJrTSt045162; Wed, 13 Jun 2012 19:53:29 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201206131953.q5DJrTSt045162@svn.freebsd.org> From: Dimitry Andric Date: Wed, 13 Jun 2012 19:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237019 - stable/9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 19:53:30 -0000 Author: dim Date: Wed Jun 13 19:53:29 2012 New Revision: 237019 URL: http://svn.freebsd.org/changeset/base/237019 Log: MFC r233098: Make sure libgcc_s is finished building in _startup_libs before building libcxxrt with high -j levels. The workaround in libc++/Makefile isn't necessary once that race is solved. Reviewed by: theraven Modified: stable/9/Makefile.inc1 (contents, props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Wed Jun 13 19:08:00 2012 (r237018) +++ stable/9/Makefile.inc1 Wed Jun 13 19:53:29 2012 (r237019) @@ -1244,6 +1244,9 @@ _startup_libs+= lib/libcxxrt .endif gnu/lib/libgcc__L: lib/libc__L +.if ${MK_LIBCPLUSPLUS} != "no" +lib/libcxxrt__L: gnu/lib/libgcc__L +.endif _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \ ${_kerberos5_lib_libheimntlm} \ From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 20:21:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 22269106566C; Wed, 13 Jun 2012 20:21:09 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 0A88F8FC1D; Wed, 13 Jun 2012 20:21:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DKL82O046497; Wed, 13 Jun 2012 20:21:08 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DKL8oT046491; Wed, 13 Jun 2012 20:21:08 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201206132021.q5DKL8oT046491@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 13 Jun 2012 20:21:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237021 - in head/contrib/gcc: . config/i386 doc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 20:21:09 -0000 Author: pfg Date: Wed Jun 13 20:21:08 2012 New Revision: 237021 URL: http://svn.freebsd.org/changeset/base/237021 Log: Revert r236962 - Experimental amdfam10/barcelona support. The patches are unexpectedly causing gcc to fail while building ports/graphics/ImageMagick even when the cpu flags are not used. Reported by: Andreas Tobler Deleted: head/contrib/gcc/config/i386/ammintrin.h Modified: head/contrib/gcc/ChangeLog.gcc43 head/contrib/gcc/builtins.c head/contrib/gcc/config.gcc head/contrib/gcc/config/i386/athlon.md head/contrib/gcc/config/i386/driver-i386.c head/contrib/gcc/config/i386/i386.c head/contrib/gcc/config/i386/i386.h head/contrib/gcc/config/i386/i386.md head/contrib/gcc/config/i386/i386.opt head/contrib/gcc/config/i386/mmx.md head/contrib/gcc/config/i386/pmmintrin.h head/contrib/gcc/config/i386/sse.md head/contrib/gcc/config/i386/tmmintrin.h head/contrib/gcc/doc/extend.texi head/contrib/gcc/doc/invoke.texi head/contrib/gcc/fold-const.c head/contrib/gcc/gimplify.c head/contrib/gcc/tree-ssa-ccp.c head/contrib/gcc/tree-ssa-pre.c Modified: head/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- head/contrib/gcc/ChangeLog.gcc43 Wed Jun 13 20:14:41 2012 (r237020) +++ head/contrib/gcc/ChangeLog.gcc43 Wed Jun 13 20:21:08 2012 (r237021) @@ -1,8 +1,3 @@ -2007-05-01 Dwarakanath Rajagopal - - * doc/invoke.texi: Fix typo, 'AMD Family 10h core' instead of - 'AMD Family 10 core'. - 2007-05-01 Dwarakanath Rajagopal (r124339) * config/i386/i386.c (override_options): Accept k8-sse3, opteron-sse3 @@ -10,39 +5,10 @@ with SSE3 instruction set support. * doc/invoke.texi: Likewise. -2007-05-01 Dwarakanath Rajagopal - - * config/i386/i386.c (override_options): Tuning 32-byte loop - alignment for amdfam10 architecture. Increasing the max loop - alignment to 24 bytes. - -2007-04-12 Richard Guenther - - PR tree-optimization/24689 - PR tree-optimization/31307 - * fold-const.c (operand_equal_p): Compare INTEGER_CST array - indices by value. - * gimplify.c (canonicalize_addr_expr): To be consistent with - gimplify_compound_lval only set operands two and three of - ARRAY_REFs if they are not gimple_min_invariant. This makes - it never at this place. - * tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise. - 2007-04-07 H.J. Lu (r123639) * config/i386/i386.c (ix86_handle_option): Handle SSSE3. -2007-03-28 Dwarakanath Rajagopal - - * config.gcc: Accept barcelona as a variant of amdfam10. - * config/i386/i386.c (override_options): Likewise. - * doc/invoke.texi: Likewise. - -2007-02-09 Dwarakanath Rajagopal - - * config/i386/driver-i386.c: Turn on -mtune=native for AMDFAM10. - (bit_SSE4a): New. - 2007-02-08 Harsha Jagasia (r121726) * config/i386/xmmintrin.h: Make inclusion of emmintrin.h @@ -60,173 +26,6 @@ * config/i386/i386.c (override_options): Set PTA_SSSE3 for core2. -2007-02-05 Harsha Jagasia - - * config/i386/athlon.md (athlon_fldxf_k8, athlon_fld_k8, - athlon_fstxf_k8, athlon_fst_k8, athlon_fist, athlon_fmov, - athlon_fadd_load, athlon_fadd_load_k8, athlon_fadd, athlon_fmul, - athlon_fmul_load, athlon_fmul_load_k8, athlon_fsgn, - athlon_fdiv_load, athlon_fdiv_load_k8, athlon_fdiv_k8, - athlon_fpspc_load, athlon_fpspc, athlon_fcmov_load, - athlon_fcmov_load_k8, athlon_fcmov_k8, athlon_fcomi_load_k8, - athlon_fcomi, athlon_fcom_load_k8, athlon_fcom): Added amdfam10. - -2007-02-05 Harsha Jagasia - - * config/i386/i386.md (x86_sahf_1, cmpfp_i_mixed, cmpfp_i_sse, - cmpfp_i_i387, cmpfp_iu_mixed, cmpfp_iu_sse, cmpfp_iu_387, - swapsi, swaphi_1, swapqi_1, swapdi_rex64, fix_truncsfdi_sse, - fix_truncdfdi_sse, fix_truncsfsi_sse, fix_truncdfsi_sse, - x86_fldcw_1, floatsisf2_mixed, floatsisf2_sse, floatdisf2_mixed, - floatdisf2_sse, floatsidf2_mixed, floatsidf2_sse, - floatdidf2_mixed, floatdidf2_sse, muldi3_1_rex64, mulsi3_1, - mulsi3_1_zext, mulhi3_1, mulqi3_1, umulqihi3_1, mulqihi3_insn, - umulditi3_insn, umulsidi3_insn, mulditi3_insn, mulsidi3_insn, - umuldi3_highpart_rex64, umulsi3_highpart_insn, - umulsi3_highpart_zext, smuldi3_highpart_rex64, - smulsi3_highpart_insn, smulsi3_highpart_zext, x86_64_shld, - x86_shld_1, x86_64_shrd, sqrtsf2_mixed, sqrtsf2_sse, - sqrtsf2_i387, sqrtdf2_mixed, sqrtdf2_sse, sqrtdf2_i387, - sqrtextendsfdf2_i387, sqrtxf2, sqrtextendsfxf2_i387, - sqrtextenddfxf2_i387): Added amdfam10_decode. - - * config/i386/athlon.md (athlon_idirect_amdfam10, - athlon_ivector_amdfam10, athlon_idirect_load_amdfam10, - athlon_ivector_load_amdfam10, athlon_idirect_both_amdfam10, - athlon_ivector_both_amdfam10, athlon_idirect_store_amdfam10, - athlon_ivector_store_amdfam10): New define_insn_reservation. - (athlon_idirect_loadmov, athlon_idirect_movstore): Added - amdfam10. - -2007-02-05 Harsha Jagasia - - * config/i386/athlon.md (athlon_call_amdfam10, - athlon_pop_amdfam10, athlon_lea_amdfam10): New - define_insn_reservation. - (athlon_branch, athlon_push, athlon_leave_k8, athlon_imul_k8, - athlon_imul_k8_DI, athlon_imul_mem_k8, athlon_imul_mem_k8_DI, - athlon_idiv, athlon_idiv_mem, athlon_str): Added amdfam10. - -2007-02-05 Harsha Jagasia - - * config/i386/athlon.md (athlon_sseld_amdfam10, - athlon_mmxld_amdfam10, athlon_ssest_amdfam10, - athlon_mmxssest_short_amdfam10): New define_insn_reservation. - -2007-02-05 Harsha Jagasia - - * config/i386/athlon.md (athlon_sseins_amdfam10): New - define_insn_reservation. - * config/i386/i386.md (sseins): Added sseins to define_attr type - and define_attr unit. - * config/i386/sse.md: Set type attribute to sseins for insertq - and insertqi. - -2007-02-05 Harsha Jagasia - - * config/i386/athlon.md (sselog_load_amdfam10, sselog_amdfam10, - ssecmpvector_load_amdfam10, ssecmpvector_amdfam10, - ssecomi_load_amdfam10, ssecomi_amdfam10, - sseaddvector_load_amdfam10, sseaddvector_amdfam10): New - define_insn_reservation. - (ssecmp_load_k8, ssecmp, sseadd_load_k8, seadd): Added amdfam10. - -2007-02-05 Harsha Jagasia - - * config/i386/athlon.md (cvtss2sd_load_amdfam10, - cvtss2sd_amdfam10, cvtps2pd_load_amdfam10, cvtps2pd_amdfam10, - cvtsi2sd_load_amdfam10, cvtsi2ss_load_amdfam10, - cvtsi2sd_amdfam10, cvtsi2ss_amdfam10, cvtsd2ss_load_amdfam10, - cvtsd2ss_amdfam10, cvtpd2ps_load_amdfam10, cvtpd2ps_amdfam10, - cvtsX2si_load_amdfam10, cvtsX2si_amdfam10): New - define_insn_reservation. - - * config/i386/sse.md (cvtsi2ss, cvtsi2ssq, cvtss2si, - cvtss2siq, cvttss2si, cvttss2siq, cvtsi2sd, cvtsi2sdq, - cvtsd2si, cvtsd2siq, cvttsd2si, cvttsd2siq, - cvtpd2dq, cvttpd2dq, cvtsd2ss, cvtss2sd, - cvtpd2ps, cvtps2pd): Added amdfam10_decode attribute. - -2007-02-05 Harsha Jagasia - - * config/i386/athlon.md (athlon_ssedivvector_amdfam10, - athlon_ssedivvector_load_amdfam10, athlon_ssemulvector_amdfam10, - athlon_ssemulvector_load_amdfam10): New define_insn_reservation. - (athlon_ssediv, athlon_ssediv_load_k8, athlon_ssemul, - athlon_ssemul_load_k8): Added amdfam10. - -2007-02-05 Harsha Jagasia - - * config/i386/i386.h (TARGET_SSE_UNALIGNED_MOVE_OPTIMAL): New macro. - (x86_sse_unaligned_move_optimal): New variable. - - * config/i386/i386.c (x86_sse_unaligned_move_optimal): Enable for - m_AMDFAM10. - (ix86_expand_vector_move_misalign): Add code to generate movupd/movups - for unaligned vector SSE double/single precision loads for AMDFAM10. - -2007-02-05 Harsha Jagasia - - * config/i386/i386.h (TARGET_AMDFAM10): New macro. - (TARGET_CPU_CPP_BUILTINS): Add code for amdfam10. - Define TARGET_CPU_DEFAULT_amdfam10. - (TARGET_CPU_DEFAULT_NAMES): Add amdfam10. - (processor_type): Add PROCESSOR_AMDFAM10. - - * config/i386/i386.md: Add amdfam10 as a new cpu attribute to match - processor_type in config/i386/i386.h. - Enable imul peepholes for TARGET_AMDFAM10. - - * config.gcc: Add support for --with-cpu option for amdfam10. - - * config/i386/i386.c (amdfam10_cost): New variable. - (m_AMDFAM10): New macro. - (m_ATHLON_K8_AMDFAM10): New macro. - (x86_use_leave, x86_push_memory, x86_movx, x86_unroll_strlen, - x86_cmove, x86_3dnow_a, x86_deep_branch, x86_use_simode_fiop, - x86_promote_QImode, x86_integer_DFmode_moves, - x86_partial_reg_dependency, x86_memory_mismatch_stall, - x86_accumulate_outgoing_args, x86_arch_always_fancy_math_387, - x86_sse_partial_reg_dependency, x86_sse_typeless_stores, - x86_use_ffreep, x86_use_incdec, x86_four_jump_limit, - x86_schedule, x86_use_bt, x86_cmpxchg16b, x86_pad_returns): - Enable/disable for amdfam10. - (override_options): Add amdfam10_cost to processor_target_table. - Set up PROCESSOR_AMDFAM10 for amdfam10 entry in - processor_alias_table. - (ix86_issue_rate): Add PROCESSOR_AMDFAM10. - (ix86_adjust_cost): Add code for amdfam10. - -2007-02-05 Harsha Jagasia - - * config/i386/i386.opt: Add new Advanced Bit Manipulation (-mabm) - instruction set feature flag. Add new (-mpopcnt) flag for popcnt - instruction. Add new SSE4A (-msse4a) instruction set feature flag. - * config/i386/i386.h: Add builtin definition for SSE4A. - * config/i386/i386.md: Add support for ABM instructions - (popcnt and lzcnt). - * config/i386/sse.md: Add support for SSE4A instructions - (movntss, movntsd, extrq, insertq). - * config/i386/i386.c: Add support for ABM and SSE4A builtins. - Add -march=amdfam10 flag. - * config/i386/ammintrin.h: Add support for SSE4A intrinsics. - * doc/invoke.texi: Add documentation on flags for sse4a, abm, popcnt - and amdfam10. - * doc/extend.texi: Add documentation for SSE4A builtins. - -2007-01-24 Jakub Jelinek - - * config/i386/i386.h (x86_cmpxchg16b): Remove const. - (TARGET_CMPXCHG16B): Define to x86_cmpxchg16b. - * config/i386/i386.c (x86_cmpxchg16b): Remove const. - (override_options): Add PTA_CX16 flag. Set x86_cmpxchg16b - for CPUs that have PTA_CX16 set. - -2007-01-18 Michael Meissner - - * config/i386/i386.c (ix86_compute_frame_layout): Make fprintf's - in #if 0 code type correct. - 2007-01-17 Eric Christopher (r120846) * config.gcc: Support core2 processor. @@ -263,30 +62,7 @@ x86_pad_returns): Add m_CORE2. (override_options): Add entries for Core2. (ix86_issue_rate): Add case for Core2. - -2006-10-28 Uros Bizjak - - * config/i386/i386.h (GENERAL_REGNO_P): Use STACK_POINTER_REGNUM. - (NON_QI_REG_P): Use IN_RANGE. - (REX_INT_REGNO_P): Use IN_RANGE. - (FP_REGNO_P): Use IN_RANGE. - (SSE_REGNO_P): Use IN_RANGE. - (REX_SSE_REGNO_P): Use IN_RANGE. - (MMX_REGNO_P): Use IN_RANGE. - (STACK_REGNO_P): New macro. - (STACK_REG_P): Use STACK_REGNO_P. - (NON_STACK_REG_P): Use STACK_REGNO_P. - (REGNO_OK_FOR_INDEX_P): Use REX_INT_REGNO_P. - (REGNO_OK_FOR_BASE_P): Use GENERAL_REGNO_P. - (REG_OK_FOR_INDEX_NONSTRICT_P): Use REX_INT_REGNO_P. - (REG_OK_FOR_BASE_NONSTRICT_P): Use GENERAL_REGNO_P. - (HARD_REGNO_RENAME_OK): Use !IN_RANGE. -2006-10-28 Uros Bizjak - - * config/i386/i386.c (output_387_ffreep): Create output from a - template string for !HAVE_AS_IX86_FFREEP. - 2006-10-27 Vladimir Makarov (r118090) * config/i386/i386.h (TARGET_GEODE): @@ -319,31 +95,7 @@ * config/i386/geode.md: New file. * doc/invoke.texi: Add entry about geode processor. - -2006-10-24 Uros Bizjak - - * config/i386/i386.h (FIRST_PSEUDO_REGISTER): Define to 54. - (FIXED_REGISTERS, CALL_USED_REGISTERS): Add fpcr register. - (REG_ALLOC_ORDER): Add one element to allocate fpcr register. - (FRAME_POINTER_REGNUM): Update register number to 21. - (REG_CLASS_CONTENTS): Update contents for added fpcr register. - (HI_REGISTER_NAMES): Add "fpcr" for fpcr register. - - * config/i386/i386.c (regclass_map): Add fpcr entry. - (dbx_register_map, dbx64_register_map, svr4_dbx_register_map): - Add fpcr entry. - (print_reg): Assert REGNO (x) != FPCR_REG. - - * config/i386/i386.md (FPCR_REG, R11_REG): New constants. - (DIRFLAG_REG): Renumber. - (x86_fnstcw_1, x86_fldcw_1): Use FPCR_REG instead of FPSR_REG. - (*sibcall_1_rex64_v, *sibcall_value_1_rex64_v): Use R11_REG. - (sse_prologue_save, *sse_prologue_save_insn): Renumber - hardcoded SSE register numbers. - - * config/i386/mmx.md (mmx_emms, mmx_femms): Renumber - hardcoded MMX register numbers. - + 2006-10-24 Richard Guenther PR middle-end/28796 @@ -352,17 +104,6 @@ for deciding optimizations in consistency with fold-const.c (fold_builtin_unordered_cmp): Likewise. -2006-10-24 Richard Guenther - - * builtins.c (fold_builtin_floor): Fold floor (x) where - x is nonnegative to trunc (x). - (fold_builtin_int_roundingfn): Fold lfloor (x) where x is - nonnegative to FIX_TRUNC_EXPR. - -2006-10-22 H.J. Lu - - * config/i386/tmmintrin.h: Remove the duplicated content. - 2006-10-22 H.J. Lu (r117958) * config.gcc (i[34567]86-*-*): Add tmmintrin.h to extra_headers. @@ -429,18 +170,6 @@ * doc/invoke.texi: Document -mssse3/-mno-ssse3 switches. -2006-10-21 H.J. Lu - - * config/i386/i386.md (UNSPEC_LDQQU): Renamed to ... - (UNSPEC_LDDQU): This. - * config/i386/sse.md (sse3_lddqu): Updated. - -2006-10-21 Richard Guenther - - PR tree-optimization/3511 - * tree-ssa-pre.c (phi_translate): Fold CALL_EXPRs that - got new invariant arguments during PHI translation. - 2006-10-21 Richard Guenther * builtins.c (fold_builtin_classify): Fix typo. Modified: head/contrib/gcc/builtins.c ============================================================================== --- head/contrib/gcc/builtins.c Wed Jun 13 20:14:41 2012 (r237020) +++ head/contrib/gcc/builtins.c Wed Jun 13 20:21:08 2012 (r237021) @@ -7355,12 +7355,6 @@ fold_builtin_ceil (tree fndecl, tree arg } } - /* Fold floor (x) where x is nonnegative to trunc (x). */ - if (tree_expr_nonnegative_p (arg)) - return build_function_call_expr (mathfn_built_in (TREE_TYPE (arg), - BUILT_IN_TRUNC), - arglist); - return fold_trunc_transparent_mathfn (fndecl, arglist); } @@ -7448,18 +7442,6 @@ fold_builtin_int_roundingfn (tree fndecl } } - switch (DECL_FUNCTION_CODE (fndecl)) - { - CASE_FLT_FN (BUILT_IN_LFLOOR): - CASE_FLT_FN (BUILT_IN_LLFLOOR): - /* Fold lfloor (x) where x is nonnegative to FIX_TRUNC (x). */ - if (tree_expr_nonnegative_p (arg)) - return fold_build1 (FIX_TRUNC_EXPR, TREE_TYPE (TREE_TYPE (fndecl)), - arg); - break; - default:; - } - return fold_fixed_mathfn (fndecl, arglist); } Modified: head/contrib/gcc/config.gcc ============================================================================== --- head/contrib/gcc/config.gcc Wed Jun 13 20:14:41 2012 (r237020) +++ head/contrib/gcc/config.gcc Wed Jun 13 20:21:08 2012 (r237021) @@ -269,12 +269,12 @@ xscale-*-*) i[34567]86-*-*) cpu_type=i386 extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h - pmmintrin.h tmmintrin.h ammintrin.h" + pmmintrin.h tmmintrin.h" ;; x86_64-*-*) cpu_type=i386 extra_headers="mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h - pmmintrin.h tmmintrin.h ammintrin.h" + pmmintrin.h tmmintrin.h" need_64bit_hwint=yes ;; ia64-*-*) @@ -1209,14 +1209,14 @@ i[34567]86-*-solaris2*) # FIXME: -m64 for i[34567]86-*-* should be allowed just # like -m32 for x86_64-*-*. case X"${with_cpu}" in - Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx) + Xgeneric|Xcore2|Xnocona|Xx86-64|Xk8|Xopteron|Xathlon64|Xathlon-fx) ;; X) with_cpu=generic ;; *) echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2 - echo "generic core2 nocona x86-64 amdfam10 barcelona k8 opteron athlon64 athlon-fx" 1>&2 + echo "generic core2 nocona x86-64 k8 opteron athlon64 athlon-fx" 1>&2 exit 1 ;; esac @@ -2515,9 +2515,6 @@ if test x$with_cpu = x ; then ;; i686-*-* | i786-*-*) case ${target_noncanonical} in - amdfam10-*|barcelona-*) - with_cpu=amdfam10 - ;; k8-*|opteron-*|athlon_64-*) with_cpu=k8 ;; @@ -2558,9 +2555,6 @@ if test x$with_cpu = x ; then ;; x86_64-*-*) case ${target_noncanonical} in - amdfam10-*|barcelona-*) - with_cpu=amdfam10 - ;; k8-*|opteron-*|athlon_64-*) with_cpu=k8 ;; @@ -2801,7 +2795,7 @@ case "${target}" in esac # OK ;; - "" | amdfam10 | barcelona | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | generic) + "" | k8 | opteron | athlon64 | athlon-fx | nocona | core2 | generic) # OK ;; *) Modified: head/contrib/gcc/config/i386/athlon.md ============================================================================== --- head/contrib/gcc/config/i386/athlon.md Wed Jun 13 20:14:41 2012 (r237020) +++ head/contrib/gcc/config/i386/athlon.md Wed Jun 13 20:21:08 2012 (r237021) @@ -29,8 +29,6 @@ (const_string "vector")] (const_string "direct"))) -(define_attr "amdfam10_decode" "direct,vector,double" - (const_string "direct")) ;; ;; decode0 decode1 decode2 ;; \ | / @@ -133,22 +131,18 @@ ;; Jump instructions are executed in the branch unit completely transparent to us (define_insn_reservation "athlon_branch" 0 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "ibr")) "athlon-direct,athlon-ieu") (define_insn_reservation "athlon_call" 0 (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "call,callv")) "athlon-vector,athlon-ieu") -(define_insn_reservation "athlon_call_amdfam10" 0 - (and (eq_attr "cpu" "amdfam10") - (eq_attr "type" "call,callv")) - "athlon-double,athlon-ieu") ;; Latency of push operation is 3 cycles, but ESP value is available ;; earlier (define_insn_reservation "athlon_push" 2 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "push")) "athlon-direct,athlon-agu,athlon-store") (define_insn_reservation "athlon_pop" 4 @@ -159,16 +153,12 @@ (and (eq_attr "cpu" "k8,generic64") (eq_attr "type" "pop")) "athlon-double,(athlon-ieu+athlon-load)") -(define_insn_reservation "athlon_pop_amdfam10" 3 - (and (eq_attr "cpu" "amdfam10") - (eq_attr "type" "pop")) - "athlon-direct,(athlon-ieu+athlon-load)") (define_insn_reservation "athlon_leave" 3 (and (eq_attr "cpu" "athlon") (eq_attr "type" "leave")) "athlon-vector,(athlon-ieu+athlon-load)") (define_insn_reservation "athlon_leave_k8" 3 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (eq_attr "type" "leave")) "athlon-double,(athlon-ieu+athlon-load)") @@ -177,11 +167,6 @@ (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "lea")) "athlon-direct,athlon-agu,nothing") -;; Lea executes in AGU unit with 1 cycle latency on AMDFAM10 -(define_insn_reservation "athlon_lea_amdfam10" 1 - (and (eq_attr "cpu" "amdfam10") - (eq_attr "type" "lea")) - "athlon-direct,athlon-agu,nothing") ;; Mul executes in special multiplier unit attached to IEU0 (define_insn_reservation "athlon_imul" 5 @@ -191,35 +176,29 @@ "athlon-vector,athlon-ieu0,athlon-mult,nothing,nothing,athlon-ieu0") ;; ??? Widening multiply is vector or double. (define_insn_reservation "athlon_imul_k8_DI" 4 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "imul") (and (eq_attr "mode" "DI") (eq_attr "memory" "none,unknown")))) "athlon-direct0,athlon-ieu0,athlon-mult,nothing,athlon-ieu0") (define_insn_reservation "athlon_imul_k8" 3 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "imul") (eq_attr "memory" "none,unknown"))) "athlon-direct0,athlon-ieu0,athlon-mult,athlon-ieu0") -(define_insn_reservation "athlon_imul_amdfam10_HI" 4 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "type" "imul") - (and (eq_attr "mode" "HI") - (eq_attr "memory" "none,unknown")))) - "athlon-vector,athlon-ieu0,athlon-mult,nothing,athlon-ieu0") (define_insn_reservation "athlon_imul_mem" 8 (and (eq_attr "cpu" "athlon") (and (eq_attr "type" "imul") (eq_attr "memory" "load,both"))) "athlon-vector,athlon-load,athlon-ieu,athlon-mult,nothing,nothing,athlon-ieu") (define_insn_reservation "athlon_imul_mem_k8_DI" 7 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "imul") (and (eq_attr "mode" "DI") (eq_attr "memory" "load,both")))) "athlon-vector,athlon-load,athlon-ieu,athlon-mult,nothing,athlon-ieu") (define_insn_reservation "athlon_imul_mem_k8" 6 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "imul") (eq_attr "memory" "load,both"))) "athlon-vector,athlon-load,athlon-ieu,athlon-mult,athlon-ieu") @@ -230,23 +209,21 @@ ;; other instructions. ;; ??? Experiments show that the idiv can overlap with roughly 6 cycles ;; of the other code -;; Using the same heuristics for amdfam10 as K8 with idiv (define_insn_reservation "athlon_idiv" 6 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "type" "idiv") (eq_attr "memory" "none,unknown"))) "athlon-vector,(athlon-ieu0*6+(athlon-fpsched,athlon-fvector))") (define_insn_reservation "athlon_idiv_mem" 9 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "type" "idiv") (eq_attr "memory" "load,both"))) "athlon-vector,((athlon-load,athlon-ieu0*6)+(athlon-fpsched,athlon-fvector))") ;; The parallelism of string instructions is not documented. Model it same way ;; as idiv to create smaller automata. This probably does not matter much. -;; Using the same heuristics for amdfam10 as K8 with idiv (define_insn_reservation "athlon_str" 6 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "type" "str") (eq_attr "memory" "load,both,store"))) "athlon-vector,athlon-load,athlon-ieu0*6") @@ -257,62 +234,34 @@ (and (eq_attr "unit" "integer,unknown") (eq_attr "memory" "none,unknown")))) "athlon-direct,athlon-ieu") -(define_insn_reservation "athlon_idirect_amdfam10" 1 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "amdfam10_decode" "direct") - (and (eq_attr "unit" "integer,unknown") - (eq_attr "memory" "none,unknown")))) - "athlon-direct,athlon-ieu") (define_insn_reservation "athlon_ivector" 2 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") (and (eq_attr "unit" "integer,unknown") (eq_attr "memory" "none,unknown")))) "athlon-vector,athlon-ieu,athlon-ieu") -(define_insn_reservation "athlon_ivector_amdfam10" 2 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "amdfam10_decode" "vector") - (and (eq_attr "unit" "integer,unknown") - (eq_attr "memory" "none,unknown")))) - "athlon-vector,athlon-ieu,athlon-ieu") - (define_insn_reservation "athlon_idirect_loadmov" 3 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "type" "imov") (eq_attr "memory" "load"))) "athlon-direct,athlon-load") - (define_insn_reservation "athlon_idirect_load" 4 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "direct") (and (eq_attr "unit" "integer,unknown") (eq_attr "memory" "load")))) "athlon-direct,athlon-load,athlon-ieu") -(define_insn_reservation "athlon_idirect_load_amdfam10" 4 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "amdfam10_decode" "direct") - (and (eq_attr "unit" "integer,unknown") - (eq_attr "memory" "load")))) - "athlon-direct,athlon-load,athlon-ieu") (define_insn_reservation "athlon_ivector_load" 6 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") (and (eq_attr "unit" "integer,unknown") (eq_attr "memory" "load")))) "athlon-vector,athlon-load,athlon-ieu,athlon-ieu") -(define_insn_reservation "athlon_ivector_load_amdfam10" 6 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "amdfam10_decode" "vector") - (and (eq_attr "unit" "integer,unknown") - (eq_attr "memory" "load")))) - "athlon-vector,athlon-load,athlon-ieu,athlon-ieu") - (define_insn_reservation "athlon_idirect_movstore" 1 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "type" "imov") (eq_attr "memory" "store"))) "athlon-direct,athlon-agu,athlon-store") - (define_insn_reservation "athlon_idirect_both" 4 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "direct") @@ -321,15 +270,6 @@ "athlon-direct,athlon-load, athlon-ieu,athlon-store, athlon-store") -(define_insn_reservation "athlon_idirect_both_amdfam10" 4 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "amdfam10_decode" "direct") - (and (eq_attr "unit" "integer,unknown") - (eq_attr "memory" "both")))) - "athlon-direct,athlon-load, - athlon-ieu,athlon-store, - athlon-store") - (define_insn_reservation "athlon_ivector_both" 6 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") @@ -339,16 +279,6 @@ athlon-ieu, athlon-ieu, athlon-store") -(define_insn_reservation "athlon_ivector_both_amdfam10" 6 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "amdfam10_decode" "vector") - (and (eq_attr "unit" "integer,unknown") - (eq_attr "memory" "both")))) - "athlon-vector,athlon-load, - athlon-ieu, - athlon-ieu, - athlon-store") - (define_insn_reservation "athlon_idirect_store" 1 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "direct") @@ -356,14 +286,6 @@ (eq_attr "memory" "store")))) "athlon-direct,(athlon-ieu+athlon-agu), athlon-store") -(define_insn_reservation "athlon_idirect_store_amdfam10" 1 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "amdfam10_decode" "direct") - (and (eq_attr "unit" "integer,unknown") - (eq_attr "memory" "store")))) - "athlon-direct,(athlon-ieu+athlon-agu), - athlon-store") - (define_insn_reservation "athlon_ivector_store" 2 (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") @@ -371,13 +293,6 @@ (eq_attr "memory" "store")))) "athlon-vector,(athlon-ieu+athlon-agu),athlon-ieu, athlon-store") -(define_insn_reservation "athlon_ivector_store_amdfam10" 2 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "amdfam10_decode" "vector") - (and (eq_attr "unit" "integer,unknown") - (eq_attr "memory" "store")))) - "athlon-vector,(athlon-ieu+athlon-agu),athlon-ieu, - athlon-store") ;; Athlon floatin point unit (define_insn_reservation "athlon_fldxf" 12 @@ -387,7 +302,7 @@ (eq_attr "mode" "XF")))) "athlon-vector,athlon-fpload2,athlon-fvector*9") (define_insn_reservation "athlon_fldxf_k8" 13 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fmov") (and (eq_attr "memory" "load") (eq_attr "mode" "XF")))) @@ -399,7 +314,7 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fany") (define_insn_reservation "athlon_fld_k8" 2 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fmov") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fstore") @@ -411,7 +326,7 @@ (eq_attr "mode" "XF")))) "athlon-vector,(athlon-fpsched+athlon-agu),(athlon-store2+(athlon-fvector*7))") (define_insn_reservation "athlon_fstxf_k8" 8 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fmov") (and (eq_attr "memory" "store,both") (eq_attr "mode" "XF")))) @@ -422,16 +337,16 @@ (eq_attr "memory" "store,both"))) "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") (define_insn_reservation "athlon_fst_k8" 2 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fmov") (eq_attr "memory" "store,both"))) "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") (define_insn_reservation "athlon_fist" 4 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "fistp,fisttp")) "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") (define_insn_reservation "athlon_fmov" 2 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "fmov")) "athlon-direct,athlon-fpsched,athlon-faddmul") (define_insn_reservation "athlon_fadd_load" 4 @@ -440,12 +355,12 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fadd") (define_insn_reservation "athlon_fadd_load_k8" 6 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fop") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_fadd" 4 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "fop")) "athlon-direct,athlon-fpsched,athlon-fadd") (define_insn_reservation "athlon_fmul_load" 4 @@ -454,16 +369,16 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fmul") (define_insn_reservation "athlon_fmul_load_k8" 6 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fmul") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fmul") (define_insn_reservation "athlon_fmul" 4 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "fmul")) "athlon-direct,athlon-fpsched,athlon-fmul") (define_insn_reservation "athlon_fsgn" 2 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "fsgn")) "athlon-direct,athlon-fpsched,athlon-fmul") (define_insn_reservation "athlon_fdiv_load" 24 @@ -472,7 +387,7 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fmul") (define_insn_reservation "athlon_fdiv_load_k8" 13 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fdiv") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fmul") @@ -481,16 +396,16 @@ (eq_attr "type" "fdiv")) "athlon-direct,athlon-fpsched,athlon-fmul") (define_insn_reservation "athlon_fdiv_k8" 11 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (eq_attr "type" "fdiv")) "athlon-direct,athlon-fpsched,athlon-fmul") (define_insn_reservation "athlon_fpspc_load" 103 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "type" "fpspc") (eq_attr "memory" "load"))) "athlon-vector,athlon-fpload,athlon-fvector") (define_insn_reservation "athlon_fpspc" 100 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "fpspc")) "athlon-vector,athlon-fpsched,athlon-fvector") (define_insn_reservation "athlon_fcmov_load" 7 @@ -503,12 +418,12 @@ (eq_attr "type" "fcmov")) "athlon-vector,athlon-fpsched,athlon-fvector") (define_insn_reservation "athlon_fcmov_load_k8" 17 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fcmov") (eq_attr "memory" "load"))) "athlon-vector,athlon-fploadk8,athlon-fvector") (define_insn_reservation "athlon_fcmov_k8" 15 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (eq_attr "type" "fcmov")) "athlon-vector,athlon-fpsched,athlon-fvector") ;; fcomi is vector decoded by uses only one pipe. @@ -519,13 +434,13 @@ (eq_attr "memory" "load")))) "athlon-vector,athlon-fpload,athlon-fadd") (define_insn_reservation "athlon_fcomi_load_k8" 5 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fcmp") (and (eq_attr "athlon_decode" "vector") (eq_attr "memory" "load")))) "athlon-vector,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_fcomi" 3 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "athlon_decode" "vector") (eq_attr "type" "fcmp"))) "athlon-vector,athlon-fpsched,athlon-fadd") @@ -535,18 +450,18 @@ (eq_attr "memory" "load"))) "athlon-direct,athlon-fpload,athlon-fadd") (define_insn_reservation "athlon_fcom_load_k8" 4 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "fcmp") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_fcom" 2 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "fcmp")) "athlon-direct,athlon-fpsched,athlon-fadd") ;; Never seen by the scheduler because we still don't do post reg-stack ;; scheduling. ;(define_insn_reservation "athlon_fxch" 2 -; (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") +; (and (eq_attr "cpu" "athlon,k8,generic64") ; (eq_attr "type" "fxch")) ; "athlon-direct,athlon-fpsched,athlon-fany") @@ -601,23 +516,6 @@ (and (eq_attr "type" "mmxmov,ssemov") (eq_attr "memory" "load"))) "athlon-direct,athlon-fploadk8,athlon-fstore") -;; On AMDFAM10 all double, single and integer packed and scalar SSEx data -;; loads generated are direct path, latency of 2 and do not use any FP -;; executions units. No seperate entries for movlpx/movhpx loads, which -;; are direct path, latency of 4 and use the FADD/FMUL FP execution units, -;; as they will not be generated. -(define_insn_reservation "athlon_sseld_amdfam10" 2 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "type" "ssemov") - (eq_attr "memory" "load"))) - "athlon-direct,athlon-fploadk8") -;; On AMDFAM10 MMX data loads generated are direct path, latency of 4 -;; and can use any FP executions units -(define_insn_reservation "athlon_mmxld_amdfam10" 4 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "type" "mmxmov") - (eq_attr "memory" "load"))) - "athlon-direct,athlon-fploadk8, athlon-fany") (define_insn_reservation "athlon_mmxssest" 3 (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "mmxmov,ssemov") @@ -635,25 +533,6 @@ (and (eq_attr "type" "mmxmov,ssemov") (eq_attr "memory" "store,both"))) "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") -;; On AMDFAM10 all double, single and integer packed SSEx data stores -;; generated are all double path, latency of 2 and use the FSTORE FP -;; execution unit. No entries seperate for movupx/movdqu, which are -;; vector path, latency of 3 and use the FSTORE*2 FP execution unit, -;; as they will not be generated. -(define_insn_reservation "athlon_ssest_amdfam10" 2 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "type" "ssemov") - (and (eq_attr "mode" "V4SF,V2DF,TI") - (eq_attr "memory" "store,both")))) - "athlon-double,(athlon-fpsched+athlon-agu),((athlon-fstore+athlon-store)*2)") -;; On AMDFAM10 all double, single and integer scalar SSEx and MMX -;; data stores generated are all direct path, latency of 2 and use -;; the FSTORE FP execution unit -(define_insn_reservation "athlon_mmxssest_short_amdfam10" 2 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "type" "mmxmov,ssemov") - (eq_attr "memory" "store,both"))) - "athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)") (define_insn_reservation "athlon_movaps_k8" 2 (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "ssemov") @@ -699,11 +578,6 @@ (and (eq_attr "type" "sselog,sselog1") (eq_attr "memory" "load"))) "athlon-double,athlon-fpload2k8,(athlon-fmul*2)") -(define_insn_reservation "athlon_sselog_load_amdfam10" 4 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "type" "sselog,sselog1") - (eq_attr "memory" "load"))) - "athlon-direct,athlon-fploadk8,(athlon-fadd|athlon-fmul)") (define_insn_reservation "athlon_sselog" 3 (and (eq_attr "cpu" "athlon") (eq_attr "type" "sselog,sselog1")) @@ -712,11 +586,6 @@ (and (eq_attr "cpu" "k8,generic64") (eq_attr "type" "sselog,sselog1")) "athlon-double,athlon-fpsched,athlon-fmul") -(define_insn_reservation "athlon_sselog_amdfam10" 2 - (and (eq_attr "cpu" "amdfam10") - (eq_attr "type" "sselog,sselog1")) - "athlon-direct,athlon-fpsched,(athlon-fadd|athlon-fmul)") - ;; ??? pcmp executes in addmul, probably not worthwhile to bother about that. (define_insn_reservation "athlon_ssecmp_load" 2 (and (eq_attr "cpu" "athlon") @@ -725,13 +594,13 @@ (eq_attr "memory" "load")))) "athlon-direct,athlon-fpload,athlon-fadd") (define_insn_reservation "athlon_ssecmp_load_k8" 4 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "ssecmp") (and (eq_attr "mode" "SF,DF,DI,TI") (eq_attr "memory" "load")))) "athlon-direct,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_ssecmp" 2 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "type" "ssecmp") (eq_attr "mode" "SF,DF,DI,TI"))) "athlon-direct,athlon-fpsched,athlon-fadd") @@ -745,11 +614,6 @@ (and (eq_attr "type" "ssecmp") (eq_attr "memory" "load"))) "athlon-double,athlon-fpload2k8,(athlon-fadd*2)") -(define_insn_reservation "athlon_ssecmpvector_load_amdfam10" 4 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "type" "ssecmp") - (eq_attr "memory" "load"))) - "athlon-direct,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_ssecmpvector" 3 (and (eq_attr "cpu" "athlon") (eq_attr "type" "ssecmp")) @@ -758,10 +622,6 @@ (and (eq_attr "cpu" "k8,generic64") (eq_attr "type" "ssecmp")) "athlon-double,athlon-fpsched,(athlon-fadd*2)") -(define_insn_reservation "athlon_ssecmpvector_amdfam10" 2 - (and (eq_attr "cpu" "amdfam10") - (eq_attr "type" "ssecmp")) - "athlon-direct,athlon-fpsched,athlon-fadd") (define_insn_reservation "athlon_ssecomi_load" 4 (and (eq_attr "cpu" "athlon") (and (eq_attr "type" "ssecomi") @@ -772,20 +632,10 @@ (and (eq_attr "type" "ssecomi") (eq_attr "memory" "load"))) "athlon-vector,athlon-fploadk8,athlon-fadd") -(define_insn_reservation "athlon_ssecomi_load_amdfam10" 5 - (and (eq_attr "cpu" "amdfam10") - (and (eq_attr "type" "ssecomi") - (eq_attr "memory" "load"))) - "athlon-direct,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_ssecomi" 4 (and (eq_attr "cpu" "athlon,k8,generic64") (eq_attr "type" "ssecmp")) "athlon-vector,athlon-fpsched,athlon-fadd") -(define_insn_reservation "athlon_ssecomi_amdfam10" 3 - (and (eq_attr "cpu" "amdfam10") -;; It seems athlon_ssecomi has a bug in the attr_type, fixed for amdfam10 - (eq_attr "type" "ssecomi")) - "athlon-direct,athlon-fpsched,athlon-fadd") (define_insn_reservation "athlon_sseadd_load" 4 (and (eq_attr "cpu" "athlon") (and (eq_attr "type" "sseadd") @@ -793,13 +643,13 @@ (eq_attr "memory" "load")))) "athlon-direct,athlon-fpload,athlon-fadd") (define_insn_reservation "athlon_sseadd_load_k8" 6 - (and (eq_attr "cpu" "k8,generic64,amdfam10") + (and (eq_attr "cpu" "k8,generic64") (and (eq_attr "type" "sseadd") (and (eq_attr "mode" "SF,DF,DI") (eq_attr "memory" "load")))) "athlon-direct,athlon-fploadk8,athlon-fadd") (define_insn_reservation "athlon_sseadd" 4 - (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10") + (and (eq_attr "cpu" "athlon,k8,generic64") (and (eq_attr "type" "sseadd") (eq_attr "mode" "SF,DF,DI"))) "athlon-direct,athlon-fpsched,athlon-fadd") @@ -813,11 +663,6 @@ (and (eq_attr "type" "sseadd") (eq_attr "memory" "load"))) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 20:31:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E9171065672; Wed, 13 Jun 2012 20:31:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 780598FC16; Wed, 13 Jun 2012 20:31:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DKVUUh047022; Wed, 13 Jun 2012 20:31:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DKVUqT047020; Wed, 13 Jun 2012 20:31:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206132031.q5DKVUqT047020@svn.freebsd.org> From: Alexander Motin Date: Wed, 13 Jun 2012 20:31:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237023 - stable/9/lib/libc/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 20:31:30 -0000 Author: mav Date: Wed Jun 13 20:31:30 2012 New Revision: 237023 URL: http://svn.freebsd.org/changeset/base/237023 Log: MFC r230188i (by das): Correct some bugs that resulted from arm/_fpmath.h being blindly copied from the x86 version, which has a completely different long double format. Modified: stable/9/lib/libc/arm/_fpmath.h Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/arm/_fpmath.h ============================================================================== --- stable/9/lib/libc/arm/_fpmath.h Wed Jun 13 20:30:25 2012 (r237022) +++ stable/9/lib/libc/arm/_fpmath.h Wed Jun 13 20:31:30 2012 (r237023) @@ -55,9 +55,10 @@ union IEEEl2bits { }; #define LDBL_NBIT 0 +#define LDBL_IMPLICIT_NBIT #define mask_nbit_l(u) ((void)0) -#define LDBL_MANH_SIZE 32 +#define LDBL_MANH_SIZE 20 #define LDBL_MANL_SIZE 32 #define LDBL_TO_ARRAY32(u, a) do { \ From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 20:34:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F41C41065703; Wed, 13 Jun 2012 20:34:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id DD17F8FC0A; Wed, 13 Jun 2012 20:34:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DKYECv047212; Wed, 13 Jun 2012 20:34:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DKYEwA047210; Wed, 13 Jun 2012 20:34:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206132034.q5DKYEwA047210@svn.freebsd.org> From: Alexander Motin Date: Wed, 13 Jun 2012 20:34:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237024 - stable/8/lib/libc/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 20:34:15 -0000 Author: mav Date: Wed Jun 13 20:34:14 2012 New Revision: 237024 URL: http://svn.freebsd.org/changeset/base/237024 Log: MFC r230188i (by das): Correct some bugs that resulted from arm/_fpmath.h being blindly copied from the x86 version, which has a completely different long double format. Modified: stable/8/lib/libc/arm/_fpmath.h Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/arm/_fpmath.h ============================================================================== --- stable/8/lib/libc/arm/_fpmath.h Wed Jun 13 20:31:30 2012 (r237023) +++ stable/8/lib/libc/arm/_fpmath.h Wed Jun 13 20:34:14 2012 (r237024) @@ -55,9 +55,10 @@ union IEEEl2bits { }; #define LDBL_NBIT 0 +#define LDBL_IMPLICIT_NBIT #define mask_nbit_l(u) ((void)0) -#define LDBL_MANH_SIZE 32 +#define LDBL_MANH_SIZE 20 #define LDBL_MANL_SIZE 32 #define LDBL_TO_ARRAY32(u, a) do { \ From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 20:41:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1DD2D106566C; Wed, 13 Jun 2012 20:41:46 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 09D158FC1A; Wed, 13 Jun 2012 20:41:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DKfjPn047575; Wed, 13 Jun 2012 20:41:45 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DKfjRJ047573; Wed, 13 Jun 2012 20:41:45 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206132041.q5DKfjRJ047573@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 13 Jun 2012 20:41:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237025 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 20:41:46 -0000 Author: jkim Date: Wed Jun 13 20:41:45 2012 New Revision: 237025 URL: http://svn.freebsd.org/changeset/base/237025 Log: Add a convenience macro for the fastcall attribute. MFC after: 2 weeks Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Wed Jun 13 20:34:14 2012 (r237024) +++ head/sys/sys/cdefs.h Wed Jun 13 20:41:45 2012 (r237025) @@ -293,6 +293,12 @@ #define __nonnull(x) #endif +#if __GNUC_PREREQ__(3, 4) +#define __fastcall __attribute__((__fastcall__)) +#else +#define __fastcall +#endif + #if __GNUC_PREREQ__(4, 1) #define __returns_twice __attribute__((__returns_twice__)) #else From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:03:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 884D01065815; Wed, 13 Jun 2012 21:03:02 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2F8EA8FC12; Wed, 13 Jun 2012 21:03:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DL32E1048649; Wed, 13 Jun 2012 21:03:02 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DL31LK048643; Wed, 13 Jun 2012 21:03:01 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206132103.q5DL31LK048643@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 13 Jun 2012 21:03:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237027 - in head/sys: amd64/amd64 amd64/include i386/acpica i386/i386 i386/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:03:02 -0000 Author: jkim Date: Wed Jun 13 21:03:01 2012 New Revision: 237027 URL: http://svn.freebsd.org/changeset/base/237027 Log: - Fix resumectx() prototypes to reflect reality. - For i386, simply jump to resumectx() with PCB in %ecx. - Fix a style(9) nit while I am here. Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/include/pcb.h head/sys/i386/acpica/acpi_wakecode.S head/sys/i386/i386/swtch.s head/sys/i386/include/pcb.h Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Wed Jun 13 20:43:59 2012 (r237026) +++ head/sys/amd64/amd64/cpu_switch.S Wed Jun 13 21:03:01 2012 (r237027) @@ -394,7 +394,7 @@ ENTRY(savectx) END(savectx) /* - * resumectx(pcb in %rdi, cr3 in %rsi) + * resumectx(pcb, cr3) * Resuming processor state from pcb. */ ENTRY(resumectx) Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Wed Jun 13 20:43:59 2012 (r237026) +++ head/sys/amd64/include/pcb.h Wed Jun 13 21:03:01 2012 (r237027) @@ -100,7 +100,7 @@ struct pcb { register_t pcb_xsmask; /* fpu context for suspend/resume */ - void * pcb_fpususpend; + void *pcb_fpususpend; struct savefpu *pcb_save; @@ -142,7 +142,7 @@ clear_pcb_flags(struct pcb *pcb, const u void makectx(struct trapframe *, struct pcb *); int savectx(struct pcb *) __returns_twice; -void resumectx(struct pcb *); +void resumectx(struct pcb *, register_t); #endif Modified: head/sys/i386/acpica/acpi_wakecode.S ============================================================================== --- head/sys/i386/acpica/acpi_wakecode.S Wed Jun 13 20:43:59 2012 (r237026) +++ head/sys/i386/acpica/acpi_wakecode.S Wed Jun 13 21:03:01 2012 (r237027) @@ -142,8 +142,8 @@ wakeup_32: mov %ax, %ds /* Get PCB and return address. */ - movl wakeup_pcb - wakeup_start(%ebx), %esi - movl wakeup_ret - wakeup_start(%ebx), %edi + movl wakeup_pcb - wakeup_start(%ebx), %ecx + movl wakeup_ret - wakeup_start(%ebx), %edx /* Restore CR4 and CR3. */ movl wakeup_cr4 - wakeup_start(%ebx), %eax @@ -166,7 +166,7 @@ wakeup_32: jmp 1f 1: /* Jump to return address. */ - jmp *%edi + jmp *%edx .data Modified: head/sys/i386/i386/swtch.s ============================================================================== --- head/sys/i386/i386/swtch.s Wed Jun 13 20:43:59 2012 (r237026) +++ head/sys/i386/i386/swtch.s Wed Jun 13 21:03:01 2012 (r237027) @@ -460,13 +460,10 @@ ENTRY(savectx) END(savectx) /* - * resumectx(pcb in %esi) + * resumectx(pcb) __fastcall * Resuming processor state from pcb. */ ENTRY(resumectx) - /* Fetch PCB. */ - movl %esi,%ecx - /* Restore GDT. */ lgdt PCB_GDT(%ecx) Modified: head/sys/i386/include/pcb.h ============================================================================== --- head/sys/i386/include/pcb.h Wed Jun 13 20:43:59 2012 (r237026) +++ head/sys/i386/include/pcb.h Wed Jun 13 21:03:01 2012 (r237027) @@ -97,7 +97,7 @@ struct trapframe; void makectx(struct trapframe *, struct pcb *); int savectx(struct pcb *) __returns_twice; -void resumectx(struct pcb *); +void resumectx(struct pcb *) __fastcall; #endif #endif /* _I386_PCB_H_ */ From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:10:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9AE71065673; Wed, 13 Jun 2012 21:10:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B0ED98FC12; Wed, 13 Jun 2012 21:10:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DLA0ep048994; Wed, 13 Jun 2012 21:10:00 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DLA0rb048990; Wed, 13 Jun 2012 21:10:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206132110.q5DLA0rb048990@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 21:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237028 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:10:00 -0000 Author: pjd Date: Wed Jun 13 21:10:00 2012 New Revision: 237028 URL: http://svn.freebsd.org/changeset/base/237028 Log: There is no need to set td->td_retval[0] to -1 on error. Confirmed by: jhb MFC after: 1 month Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Jun 13 21:03:01 2012 (r237027) +++ head/sys/kern/vfs_syscalls.c Wed Jun 13 21:10:00 2012 (r237028) @@ -1250,7 +1250,6 @@ bad_unlocked: if (indx != -1) fdclose(fdp, fp, indx, td); fdrop(fp, td); - td->td_retval[0] = -1; return (error); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:11:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B6641065687; Wed, 13 Jun 2012 21:11:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 05D318FC18; Wed, 13 Jun 2012 21:11:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DLBwtD049124; Wed, 13 Jun 2012 21:11:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DLBwDV049122; Wed, 13 Jun 2012 21:11:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206132111.q5DLBwDV049122@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 21:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237029 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:11:59 -0000 Author: pjd Date: Wed Jun 13 21:11:58 2012 New Revision: 237029 URL: http://svn.freebsd.org/changeset/base/237029 Log: Style. MFC after: 1 month Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Jun 13 21:10:00 2012 (r237028) +++ head/sys/kern/vfs_syscalls.c Wed Jun 13 21:11:58 2012 (r237029) @@ -1111,13 +1111,14 @@ kern_openat(struct thread *td, int fd, c if (flags & O_EXEC) { if (flags & O_ACCMODE) return (EINVAL); - } else if ((flags & O_ACCMODE) == O_ACCMODE) + } else if ((flags & O_ACCMODE) == O_ACCMODE) { return (EINVAL); - else + } else flags = FFLAGS(flags); + } /* - * allocate the file descriptor, but don't install a descriptor yet + * Allocate the file descriptor, but don't install a descriptor yet. */ error = falloc_noinstall(td, &nfp); if (error) @@ -1141,7 +1142,7 @@ kern_openat(struct thread *td, int fd, c goto success; /* - * handle special fdopen() case. bleh. dupfdopen() is + * Handle special fdopen() case. bleh. dupfdopen() is * responsible for dropping the old contents of ofiles[indx] * if it succeeds. * @@ -1149,9 +1150,9 @@ kern_openat(struct thread *td, int fd, c * understand exactly what would happen, and we don't think * that it ever should. */ - if ((nd.ni_strictrelative == 0) && + if (nd.ni_strictrelative == 0 && (error == ENODEV || error == ENXIO) && - (td->td_dupfd >= 0)) { + td->td_dupfd >= 0) { /* XXX from fdopen */ error_open = error; if ((error = finstall(td, fp, &indx, flags)) != 0) @@ -1206,7 +1207,7 @@ kern_openat(struct thread *td, int fd, c if ((flags & FNONBLOCK) == 0) type |= F_WAIT; if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, - type)) != 0) + type)) != 0) goto bad; atomic_set_int(&fp->f_flag, FHASLOCK); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:13:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BDED0106566B; Wed, 13 Jun 2012 21:13:18 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 90B538FC17; Wed, 13 Jun 2012 21:13:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DLDIpZ049211; Wed, 13 Jun 2012 21:13:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DLDIrS049209; Wed, 13 Jun 2012 21:13:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206132113.q5DLDIrS049209@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 21:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237030 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:13:18 -0000 Author: pjd Date: Wed Jun 13 21:13:18 2012 New Revision: 237030 URL: http://svn.freebsd.org/changeset/base/237030 Log: Add missing {. MFC after: 1 month Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Jun 13 21:11:58 2012 (r237029) +++ head/sys/kern/vfs_syscalls.c Wed Jun 13 21:13:18 2012 (r237030) @@ -1113,7 +1113,7 @@ kern_openat(struct thread *td, int fd, c return (EINVAL); } else if ((flags & O_ACCMODE) == O_ACCMODE) { return (EINVAL); - } else + } else { flags = FFLAGS(flags); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:15:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 19E861065672; Wed, 13 Jun 2012 21:15:02 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 015688FC1B; Wed, 13 Jun 2012 21:15:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DLF1gu049339; Wed, 13 Jun 2012 21:15:01 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DLF1bP049336; Wed, 13 Jun 2012 21:15:01 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206132115.q5DLF1bP049336@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 21:15:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237031 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:15:02 -0000 Author: pjd Date: Wed Jun 13 21:15:01 2012 New Revision: 237031 URL: http://svn.freebsd.org/changeset/base/237031 Log: Remove duplicated code. MFC after: 1 month Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Jun 13 21:13:18 2012 (r237030) +++ head/sys/kern/vfs_syscalls.c Wed Jun 13 21:15:01 2012 (r237031) @@ -1161,17 +1161,9 @@ kern_openat(struct thread *td, int fd, c flags, error_open)) == 0) goto success; } - /* - * Clean up the descriptor, but only if another thread hadn't - * replaced or closed it. - */ - if (indx != -1) - fdclose(fdp, fp, indx, td); - fdrop(fp, td); - if (error == ERESTART) error = EINTR; - return (error); + goto bad_unlocked; } td->td_dupfd = 0; vfslocked = NDHASGIANT(&nd); From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:22:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1C3111065680; Wed, 13 Jun 2012 21:22:36 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E2C548FC1F; Wed, 13 Jun 2012 21:22:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DLMZcP049713; Wed, 13 Jun 2012 21:22:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DLMZdc049711; Wed, 13 Jun 2012 21:22:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206132122.q5DLMZdc049711@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 21:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237032 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:22:36 -0000 Author: pjd Date: Wed Jun 13 21:22:35 2012 New Revision: 237032 URL: http://svn.freebsd.org/changeset/base/237032 Log: - Remove nfp variable that is not really needed. - Update comment. - Style nits. MFC after: 1 month Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Jun 13 21:15:01 2012 (r237031) +++ head/sys/kern/vfs_syscalls.c Wed Jun 13 21:22:35 2012 (r237032) @@ -1093,7 +1093,6 @@ kern_openat(struct thread *td, int fd, c struct file *fp; struct vnode *vp; int cmode; - struct file *nfp; int type, indx = -1, error, error_open; struct flock lf; struct nameidata nd; @@ -1120,11 +1119,13 @@ kern_openat(struct thread *td, int fd, c /* * Allocate the file descriptor, but don't install a descriptor yet. */ - error = falloc_noinstall(td, &nfp); + error = falloc_noinstall(td, &fp); if (error) return (error); - /* An extra reference on `nfp' has been held for us by falloc_noinstall(). */ - fp = nfp; + /* + * An extra reference on `fp' has been held for us by + * falloc_noinstall(). + */ /* Set the flags early so the finit in devfs can pick them up. */ fp->f_flag = flags & FMASK; cmode = ((mode &~ fdp->fd_cmask) & ALLPERMS) &~ S_ISTXT; @@ -4480,7 +4481,6 @@ sys_fhopen(td, uap) struct flock lf; struct file *fp; int fmode, error, type; - struct file *nfp; int vfslocked; int indx; @@ -4508,15 +4508,17 @@ sys_fhopen(td, uap) return (error); } - error = falloc_noinstall(td, &nfp); + error = falloc_noinstall(td, &fp); if (error) { vput(vp); VFS_UNLOCK_GIANT(vfslocked); return (error); - } + } - /* An extra reference on `nfp' has been held for us by falloc(). */ - fp = nfp; + /* + * An extra reference on `fp' has been held for us by + * falloc_noinstall(). + */ #ifdef INVARIANTS td->td_dupfd = -1; #endif @@ -4549,7 +4551,7 @@ sys_fhopen(td, uap) if ((fmode & FNONBLOCK) == 0) type |= F_WAIT; if ((error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, - type)) != 0) + type)) != 0) goto bad; atomic_set_int(&fp->f_flag, FHASLOCK); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:32:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADDCA106566C; Wed, 13 Jun 2012 21:32:35 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 999178FC0C; Wed, 13 Jun 2012 21:32:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DLWZxF050199; Wed, 13 Jun 2012 21:32:35 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DLWZfo050195; Wed, 13 Jun 2012 21:32:35 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206132132.q5DLWZfo050195@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 21:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237033 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:32:35 -0000 Author: pjd Date: Wed Jun 13 21:32:35 2012 New Revision: 237033 URL: http://svn.freebsd.org/changeset/base/237033 Log: Allocate descriptor number in dupfdopen() itself instead of depending on the caller using finstall(). This saves us the filedesc lock/unlock cycle, fhold()/fdrop() cycle and closes a race between finstall() and dupfdopen(). MFC after: 1 month Modified: head/sys/kern/kern_descrip.c head/sys/kern/vfs_syscalls.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 13 21:22:35 2012 (r237032) +++ head/sys/kern/kern_descrip.c Wed Jun 13 21:32:35 2012 (r237033) @@ -2588,13 +2588,13 @@ done2: * Duplicate the specified descriptor to a free descriptor. */ int -dupfdopen(struct thread *td, struct filedesc *fdp, int indx, int dfd, int mode, int error) +dupfdopen(struct thread *td, struct filedesc *fdp, int dfd, int mode, int openerror, int *indxp) { - struct file *wfp; struct file *fp; + int error, indx; - KASSERT(error == ENODEV || error == ENXIO, - ("unexpected error %d in %s", error, __func__)); + KASSERT(openerror == ENODEV || openerror == ENXIO, + ("unexpected error %d in %s", openerror, __func__)); /* * If the to-be-dup'd fd number is greater than the allowed number @@ -2603,11 +2603,17 @@ dupfdopen(struct thread *td, struct file */ FILEDESC_XLOCK(fdp); if ((unsigned int)dfd >= fdp->fd_nfiles || - (wfp = fdp->fd_ofiles[dfd]) == NULL) { + (fp = fdp->fd_ofiles[dfd]) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } + error = fdalloc(td, 0, &indx); + if (error != 0) { + FILEDESC_XUNLOCK(fdp); + return (error); + } + /* * There are two cases of interest here. * @@ -2616,26 +2622,26 @@ dupfdopen(struct thread *td, struct file * For ENXIO steal away the file structure from (dfd) and store it in * (indx). (dfd) is effectively closed by this operation. */ - fp = fdp->fd_ofiles[indx]; - switch (error) { + switch (openerror) { case ENODEV: /* * Check that the mode the file is being opened for is a * subset of the mode of the existing descriptor. */ - if (((mode & (FREAD|FWRITE)) | wfp->f_flag) != wfp->f_flag) { + if (((mode & (FREAD|FWRITE)) | fp->f_flag) != fp->f_flag) { + fdunused(fdp, indx); FILEDESC_XUNLOCK(fdp); return (EACCES); } - fdp->fd_ofiles[indx] = wfp; + fdp->fd_ofiles[indx] = fp; fdp->fd_ofileflags[indx] = fdp->fd_ofileflags[dfd]; - fhold(wfp); + fhold(fp); break; case ENXIO: /* * Steal away the file pointer from dfd and stuff it into indx. */ - fdp->fd_ofiles[indx] = wfp; + fdp->fd_ofiles[indx] = fp; fdp->fd_ofiles[dfd] = NULL; fdp->fd_ofileflags[indx] = fdp->fd_ofileflags[dfd]; fdp->fd_ofileflags[dfd] = 0; @@ -2643,11 +2649,7 @@ dupfdopen(struct thread *td, struct file break; } FILEDESC_XUNLOCK(fdp); - /* - * We now own the reference to fp that the ofiles[] array used to own. - * Release it. - */ - fdrop(fp, td); + *indxp = indx; return (0); } Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Jun 13 21:22:35 2012 (r237032) +++ head/sys/kern/vfs_syscalls.c Wed Jun 13 21:32:35 2012 (r237033) @@ -1093,7 +1093,7 @@ kern_openat(struct thread *td, int fd, c struct file *fp; struct vnode *vp; int cmode; - int type, indx = -1, error, error_open; + int type, indx = -1, error; struct flock lf; struct nameidata nd; int vfslocked; @@ -1143,9 +1143,7 @@ kern_openat(struct thread *td, int fd, c goto success; /* - * Handle special fdopen() case. bleh. dupfdopen() is - * responsible for dropping the old contents of ofiles[indx] - * if it succeeds. + * Handle special fdopen() case. bleh. * * Don't do this for relative (capability) lookups; we don't * understand exactly what would happen, and we don't think @@ -1154,14 +1152,12 @@ kern_openat(struct thread *td, int fd, c if (nd.ni_strictrelative == 0 && (error == ENODEV || error == ENXIO) && td->td_dupfd >= 0) { - /* XXX from fdopen */ - error_open = error; - if ((error = finstall(td, fp, &indx, flags)) != 0) - goto bad_unlocked; - if ((error = dupfdopen(td, fdp, indx, td->td_dupfd, - flags, error_open)) == 0) + error = dupfdopen(td, fdp, td->td_dupfd, flags, error, + &indx); + if (error == 0) goto success; } + if (error == ERESTART) error = EINTR; goto bad_unlocked; @@ -4514,11 +4510,11 @@ sys_fhopen(td, uap) VFS_UNLOCK_GIANT(vfslocked); return (error); } - /* * An extra reference on `fp' has been held for us by * falloc_noinstall(). */ + #ifdef INVARIANTS td->td_dupfd = -1; #endif Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Wed Jun 13 21:22:35 2012 (r237032) +++ head/sys/sys/filedesc.h Wed Jun 13 21:32:35 2012 (r237033) @@ -109,8 +109,8 @@ struct filedesc_to_leader { struct thread; int closef(struct file *fp, struct thread *td); -int dupfdopen(struct thread *td, struct filedesc *fdp, int indx, int dfd, - int mode, int error); +int dupfdopen(struct thread *td, struct filedesc *fdp, int dfd, int mode, + int openerror, int *indxp); int falloc(struct thread *td, struct file **resultfp, int *resultfd, int flags); int falloc_noinstall(struct thread *td, struct file **resultfp); From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:38:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEA21106564A; Wed, 13 Jun 2012 21:38:07 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BADF08FC12; Wed, 13 Jun 2012 21:38:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DLc79R050486; Wed, 13 Jun 2012 21:38:07 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DLc76r050484; Wed, 13 Jun 2012 21:38:07 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206132138.q5DLc76r050484@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 21:38:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237034 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:38:07 -0000 Author: pjd Date: Wed Jun 13 21:38:07 2012 New Revision: 237034 URL: http://svn.freebsd.org/changeset/base/237034 Log: Now that dupfdopen() doesn't depend on finstall() being called earlier, indx will never be -1 on error, as none of dupfdopen(), finstall() and kern_capwrap() modifies it on error, but what is more important none of those functions install and leave file at indx descriptor on error. Leave an assert to prove my words. MFC after: 1 month Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Jun 13 21:32:35 2012 (r237033) +++ head/sys/kern/vfs_syscalls.c Wed Jun 13 21:38:07 2012 (r237034) @@ -1237,8 +1237,7 @@ success: bad: VFS_UNLOCK_GIANT(vfslocked); bad_unlocked: - if (indx != -1) - fdclose(fdp, fp, indx, td); + KASSERT(indx == -1, ("indx=%d, should be -1", indx)); fdrop(fp, td); return (error); } From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 21:53:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 269A81065679; Wed, 13 Jun 2012 21:53:41 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id EC6A98FC15; Wed, 13 Jun 2012 21:53:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DLre8o051213; Wed, 13 Jun 2012 21:53:40 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DLrenR051210; Wed, 13 Jun 2012 21:53:40 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201206132153.q5DLrenR051210@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 13 Jun 2012 21:53:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237035 - head/usr.bin/find X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 21:53:41 -0000 Author: jilles Date: Wed Jun 13 21:53:40 2012 New Revision: 237035 URL: http://svn.freebsd.org/changeset/base/237035 Log: find(1): Move description of -d option to -depth primary. The nullary -depth primary is standard and the -d option provides little advantage. PR: docs/168885 MFC after: 1 week Modified: head/usr.bin/find/find.1 Modified: head/usr.bin/find/find.1 ============================================================================== --- head/usr.bin/find/find.1 Wed Jun 13 21:38:07 2012 (r237034) +++ head/usr.bin/find/find.1 Wed Jun 13 21:53:40 2012 (r237035) @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd May 6, 2012 +.Dd June 13, 2012 .Dt FIND 1 .Os .Sh NAME @@ -126,36 +126,15 @@ as an effective alternative. .It Fl d Cause .Nm -to perform a depth-first traversal, i.e., directories -are visited in post-order and all entries in a directory will be acted -on before the directory itself. -By default, -.Nm -visits directories in pre-order, i.e., before their contents. -Note, the default is -.Em not -a breadth-first traversal. +to perform a depth-first traversal. .Pp -This option is the BSD-specific equivalent of the +This option is a BSD-specific equivalent of the .Ic -depth -primary of +primary specified by .St -p1003.1-2001 . -The -.Fl d -option -can be useful when -.Nm -is used with -.Xr cpio 1 -to process files that are contained in directories with unusual permissions. -It ensures that you have write permission while you are placing files in a -directory, then sets the directory's permissions as the last thing. -.It Fl f -Specify a file hierarchy for -.Nm -to traverse. -File hierarchies may also be specified as the operands immediately -following the options. +Refer to its description under +.Sx PRIMARIES +for more information. .It Fl s Cause .Nm @@ -327,8 +306,29 @@ Following symlinks is incompatible with Always true; same as the non-portable .Fl d -option. Refer to the primary description of -.Ic -depth for full information. +option. +Cause +.Nm +to perform a depth-first traversal, i.e., directories +are visited in post-order and all entries in a directory will be acted +on before the directory itself. +By default, +.Nm +visits directories in pre-order, i.e., before their contents. +Note, the default is +.Em not +a breadth-first traversal. +.Pp +The +.Ic -depth +primary +can be useful when +.Nm +is used with +.Xr cpio 1 +to process files that are contained in directories with unusual permissions. +It ensures that you have write permission while you are placing files in a +directory, then sets the directory's permissions as the last thing. .It Ic -depth Ar n True if the depth of the file relative to the starting point of the traversal is From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 22:12:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CB1B7106566B; Wed, 13 Jun 2012 22:12:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id ACCA88FC0C; Wed, 13 Jun 2012 22:12:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DMCBcS052177; Wed, 13 Jun 2012 22:12:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DMCBgV052173; Wed, 13 Jun 2012 22:12:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206132212.q5DMCBgV052173@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 13 Jun 2012 22:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237036 - in head/sys: kern netsmb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 22:12:12 -0000 Author: pjd Date: Wed Jun 13 22:12:10 2012 New Revision: 237036 URL: http://svn.freebsd.org/changeset/base/237036 Log: When checking if file descriptor number is valid, explicitely check for 'fd' being less than 0 instead of using cast-to-unsigned hack. Today's commit was brought to you by the letters 'B', 'D' and 'E' :) Modified: head/sys/kern/kern_descrip.c head/sys/kern/uipc_usrreq.c head/sys/netsmb/smb_dev.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 13 21:53:40 2012 (r237035) +++ head/sys/kern/kern_descrip.c Wed Jun 13 22:12:10 2012 (r237036) @@ -243,7 +243,7 @@ fd_last_used(struct filedesc *fdp, int s static int fdisused(struct filedesc *fdp, int fd) { - KASSERT((unsigned int)fd < fdp->fd_nfiles, + KASSERT(fd >= 0 && fd < fdp->fd_nfiles, ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); } @@ -433,7 +433,7 @@ fdtofp(int fd, struct filedesc *fdp) FILEDESC_LOCK_ASSERT(fdp); - if ((unsigned)fd >= fdp->fd_nfiles) + if (fd < 0 || fd >= fdp->fd_nfiles) return (NULL); return (fdp->fd_ofiles[fd]); @@ -677,7 +677,7 @@ kern_fcntl(struct thread *td, int fd, in vfslocked = 0; /* Check for race with close */ FILEDESC_SLOCK(fdp); - if ((unsigned) fd >= fdp->fd_nfiles || + if (fd < 0 || fd >= fdp->fd_nfiles || fp != fdp->fd_ofiles[fd]) { FILEDESC_SUNLOCK(fdp); flp->l_whence = SEEK_SET; @@ -1197,7 +1197,7 @@ kern_close(td, fd) AUDIT_SYSCLOSE(td, fd); FILEDESC_XLOCK(fdp); - if ((unsigned)fd >= fdp->fd_nfiles || + if (fd < 0 || fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); @@ -1500,7 +1500,7 @@ fdalloc(struct thread *td, int minfd, in * Perform some sanity checks, then mark the file descriptor as * used and return it to the caller. */ - KASSERT((unsigned int)fd < min(maxfd, fdp->fd_nfiles), + KASSERT(fd >= 0 && fd < min(maxfd, fdp->fd_nfiles), ("invalid descriptor %d", fd)); KASSERT(!fdisused(fdp, fd), ("fd_first_free() returned non-free descriptor")); @@ -2213,7 +2213,7 @@ fget_unlocked(struct filedesc *fdp, int struct file *fp; u_int count; - if ((unsigned int)fd >= fdp->fd_nfiles) + if (fd < 0 || fd >= fdp->fd_nfiles) return (NULL); /* * Fetch the descriptor locklessly. We avoid fdrop() races by @@ -2602,7 +2602,7 @@ dupfdopen(struct thread *td, struct file * closed, then reject. */ FILEDESC_XLOCK(fdp); - if ((unsigned int)dfd >= fdp->fd_nfiles || + if (dfd < 0 || dfd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[dfd]) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Wed Jun 13 21:53:40 2012 (r237035) +++ head/sys/kern/uipc_usrreq.c Wed Jun 13 22:12:10 2012 (r237036) @@ -1872,7 +1872,7 @@ unp_internalize(struct mbuf **controlp, FILEDESC_SLOCK(fdescp); for (i = 0; i < oldfds; i++) { fd = *fdp++; - if ((unsigned)fd >= fdescp->fd_nfiles || + if (fd < 0 || fd >= fdescp->fd_nfiles || fdescp->fd_ofiles[fd] == NULL) { FILEDESC_SUNLOCK(fdescp); error = EBADF; Modified: head/sys/netsmb/smb_dev.c ============================================================================== --- head/sys/netsmb/smb_dev.c Wed Jun 13 21:53:40 2012 (r237035) +++ head/sys/netsmb/smb_dev.c Wed Jun 13 22:12:10 2012 (r237036) @@ -375,7 +375,7 @@ nsmb_getfp(struct filedesc* fdp, int fd, struct file* fp; FILEDESC_SLOCK(fdp); - if (((u_int)fd) >= fdp->fd_nfiles || + if (fd < 0 || fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[fd]) == NULL || (fp->f_flag & flag) == 0) { FILEDESC_SUNLOCK(fdp); From owner-svn-src-all@FreeBSD.ORG Wed Jun 13 22:53:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 250DF106564A; Wed, 13 Jun 2012 22:53:57 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 0F6998FC08; Wed, 13 Jun 2012 22:53:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DMru15054120; Wed, 13 Jun 2012 22:53:56 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DMruKD054114; Wed, 13 Jun 2012 22:53:56 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201206132253.q5DMruKD054114@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 13 Jun 2012 22:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237037 - in head/sys: amd64/acpica amd64/amd64 amd64/include x86/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 22:53:57 -0000 Author: jkim Date: Wed Jun 13 22:53:56 2012 New Revision: 237037 URL: http://svn.freebsd.org/changeset/base/237037 Log: - Remove unused code for CR3 and CR4. - Fix few style(9) nits while I am here. Modified: head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/pcb.h head/sys/x86/acpica/acpi_wakeup.c Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/amd64/acpica/acpi_wakecode.S Wed Jun 13 22:53:56 2012 (r237037) @@ -220,7 +220,6 @@ wakeup_64: mov %ax, %ds /* Restore arguments. */ - movq wakeup_cr3 - wakeup_start(%rbx), %rsi movq wakeup_pcb - wakeup_start(%rbx), %rdi movq wakeup_ret - wakeup_start(%rbx), %rax @@ -273,10 +272,6 @@ bootgdtdesc: .long bootgdt - wakeup_start /* Offset plus %ds << 4 */ ALIGN_DATA -wakeup_cr4: /* not used */ - .quad 0 -wakeup_cr3: - .quad 0 wakeup_pcb: .quad 0 wakeup_ret: Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/amd64/amd64/cpu_switch.S Wed Jun 13 22:53:56 2012 (r237037) @@ -394,12 +394,13 @@ ENTRY(savectx) END(savectx) /* - * resumectx(pcb, cr3) + * resumectx(pcb) * Resuming processor state from pcb. */ ENTRY(resumectx) /* Switch to KPML4phys. */ - movq %rsi,%cr3 + movq KPML4phys,%rax + movq %rax,%cr3 /* Force kernel segment registers. */ movl $KDSEL,%eax Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/amd64/amd64/mp_machdep.c Wed Jun 13 22:53:56 2012 (r237037) @@ -1429,9 +1429,6 @@ cpususpend_handler(void) CPU_SET_ATOMIC(cpu, &suspended_cpus); } else { pmap_init_pat(); -#if 0 - load_cr3(susppcbs[cpu]->pcb_cr3); -#endif initializecpu(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/amd64/include/pcb.h Wed Jun 13 22:53:56 2012 (r237037) @@ -142,7 +142,7 @@ clear_pcb_flags(struct pcb *pcb, const u void makectx(struct trapframe *, struct pcb *); int savectx(struct pcb *) __returns_twice; -void resumectx(struct pcb *, register_t); +void resumectx(struct pcb *); #endif Modified: head/sys/x86/acpica/acpi_wakeup.c ============================================================================== --- head/sys/x86/acpica/acpi_wakeup.c Wed Jun 13 22:12:10 2012 (r237036) +++ head/sys/x86/acpica/acpi_wakeup.c Wed Jun 13 22:53:56 2012 (r237037) @@ -89,9 +89,11 @@ static void acpi_wakeup_cpus(struct acp #define ACPI_PAGETABLES 0 #endif -#define WAKECODE_VADDR(sc) ((sc)->acpi_wakeaddr + (ACPI_PAGETABLES * PAGE_SIZE)) -#define WAKECODE_PADDR(sc) ((sc)->acpi_wakephys + (ACPI_PAGETABLES * PAGE_SIZE)) -#define WAKECODE_FIXUP(offset, type, val) do { \ +#define WAKECODE_VADDR(sc) \ + ((sc)->acpi_wakeaddr + (ACPI_PAGETABLES * PAGE_SIZE)) +#define WAKECODE_PADDR(sc) \ + ((sc)->acpi_wakephys + (ACPI_PAGETABLES * PAGE_SIZE)) +#define WAKECODE_FIXUP(offset, type, val) do { \ type *addr; \ addr = (type *)(WAKECODE_VADDR(sc) + offset); \ *addr = val; \ @@ -210,7 +212,9 @@ acpi_sleep_machdep(struct acpi_softc *sc WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0)); WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0)); +#ifndef __amd64__ WAKECODE_FIXUP(wakeup_cr4, register_t, susppcbs[0]->pcb_cr4); +#endif WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[0]); WAKECODE_FIXUP(wakeup_gdt, uint16_t, susppcbs[0]->pcb_gdt.rd_limit); @@ -248,9 +252,6 @@ acpi_wakeup_machdep(struct acpi_softc *s /* Wakeup MD procedures in interrupt disabled context */ if (sleep_result == 1) { pmap_init_pat(); -#if 0 - load_cr3(susppcbs[0]->pcb_cr3); -#endif initializecpu(); PCPU_SET(switchtime, 0); PCPU_SET(switchticks, ticks); @@ -300,7 +301,8 @@ acpi_alloc_wakeup_handler(void) if (EVENTHANDLER_REGISTER(power_resume, acpi_stop_beep, NULL, EVENTHANDLER_PRI_LAST) == NULL) { printf("%s: can't register event handler\n", __func__); - contigfree(wakeaddr, (ACPI_PAGETABLES + 1) * PAGE_SIZE, M_DEVBUF); + contigfree(wakeaddr, (ACPI_PAGETABLES + 1) * PAGE_SIZE, + M_DEVBUF); return (NULL); } susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK); @@ -348,17 +350,14 @@ acpi_install_wakeup_handler(struct acpi_ /* Save pointers to some global data. */ WAKECODE_FIXUP(wakeup_ret, void *, resumectx); -#ifdef __amd64__ - WAKECODE_FIXUP(wakeup_cr3, uint64_t, KPML4phys); -#else +#ifndef __amd64__ #ifdef PAE WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdpt)); #else WAKECODE_FIXUP(wakeup_cr3, register_t, vtophys(kernel_pmap->pm_pdir)); #endif -#endif -#ifdef __amd64__ +#else /* Build temporary page tables below realmode code. */ pt4 = wakeaddr; pt3 = pt4 + (PAGE_SIZE) / sizeof(uint64_t); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 00:51:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 13833106566B; Thu, 14 Jun 2012 00:51:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id F34B28FC12; Thu, 14 Jun 2012 00:51:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E0prXS059275; Thu, 14 Jun 2012 00:51:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E0priH059271; Thu, 14 Jun 2012 00:51:53 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206140051.q5E0priH059271@svn.freebsd.org> From: Adrian Chadd Date: Thu, 14 Jun 2012 00:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237038 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 00:51:54 -0000 Author: adrian Date: Thu Jun 14 00:51:53 2012 New Revision: 237038 URL: http://svn.freebsd.org/changeset/base/237038 Log: Implement a global (all non-mgmt traffic) TX ath_buf limitation when ath_start() is called. This (defaults to 10 frames) gives for a little headway in the TX ath_buf allocation, so buffer cloning is still possible. This requires a lot omre experimenting and tuning. It also doesn't stop a node/TID from consuming all of the available ath_buf's, especially when the node is going through high packet loss or only talking at a low TX rate. It also doesn't stop a paused TID from taking all of the ath_bufs. I'll look at fixing that up in subsequent commits. PR: kern/168170 Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_sysctl.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed Jun 13 22:53:56 2012 (r237037) +++ head/sys/dev/ath/if_ath.c Thu Jun 14 00:51:53 2012 (r237038) @@ -2239,8 +2239,22 @@ _ath_getbuf_locked(struct ath_softc *sc, if (bf != NULL && (bf->bf_flags & ATH_BUF_BUSY) == 0) { if (btype == ATH_BUFTYPE_MGMT) TAILQ_REMOVE(&sc->sc_txbuf_mgmt, bf, bf_list); - else + else { TAILQ_REMOVE(&sc->sc_txbuf, bf, bf_list); + sc->sc_txbuf_cnt--; + + /* + * This shuldn't happen; however just to be + * safe print a warning and fudge the txbuf + * count. + */ + if (sc->sc_txbuf_cnt < 0) { + device_printf(sc->sc_dev, + "%s: sc_txbuf_cnt < 0?\n", + __func__); + sc->sc_txbuf_cnt = 0; + } + } } else bf = NULL; @@ -2367,6 +2381,7 @@ ath_start(struct ifnet *ifp) "%s: sc_inreset_cnt > 0; bailing\n", __func__); ATH_PCU_UNLOCK(sc); IF_LOCK(&ifp->if_snd); + sc->sc_stats.ast_tx_qstop++; ifp->if_drv_flags |= IFF_DRV_OACTIVE; IF_UNLOCK(&ifp->if_snd); return; @@ -2375,6 +2390,17 @@ ath_start(struct ifnet *ifp) ATH_PCU_UNLOCK(sc); for (;;) { + ATH_TXBUF_LOCK(sc); + if (sc->sc_txbuf_cnt <= sc->sc_txq_data_minfree) { + /* XXX increment counter? */ + ATH_TXBUF_UNLOCK(sc); + IF_LOCK(&ifp->if_snd); + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + IF_UNLOCK(&ifp->if_snd); + break; + } + ATH_TXBUF_UNLOCK(sc); + /* * Grab a TX buffer and associated resources. */ @@ -2883,6 +2909,7 @@ ath_desc_alloc(struct ath_softc *sc) ath_descdma_cleanup(sc, &sc->sc_rxdma, &sc->sc_rxbuf); return error; } + sc->sc_txbuf_cnt = ath_txbuf; error = ath_descdma_setup(sc, &sc->sc_txdma_mgmt, &sc->sc_txbuf_mgmt, "tx_mgmt", ath_txbuf_mgmt, ATH_TXDESC); @@ -3686,8 +3713,17 @@ ath_returnbuf_tail(struct ath_softc *sc, if (bf->bf_flags & ATH_BUF_MGMT) TAILQ_INSERT_TAIL(&sc->sc_txbuf_mgmt, bf, bf_list); - else + else { TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); + sc->sc_txbuf_cnt++; + if (sc->sc_txbuf_cnt > ath_txbuf) { + device_printf(sc->sc_dev, + "%s: sc_txbuf_cnt > %d?\n", + __func__, + ath_txbuf); + sc->sc_txbuf_cnt = ath_txbuf; + } + } } void @@ -3698,8 +3734,17 @@ ath_returnbuf_head(struct ath_softc *sc, if (bf->bf_flags & ATH_BUF_MGMT) TAILQ_INSERT_HEAD(&sc->sc_txbuf_mgmt, bf, bf_list); - else + else { TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + sc->sc_txbuf_cnt++; + if (sc->sc_txbuf_cnt > ATH_TXBUF) { + device_printf(sc->sc_dev, + "%s: sc_txbuf_cnt > %d?\n", + __func__, + ATH_TXBUF); + sc->sc_txbuf_cnt = ATH_TXBUF; + } + } } /* Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Wed Jun 13 22:53:56 2012 (r237037) +++ head/sys/dev/ath/if_ath_sysctl.c Thu Jun 14 00:51:53 2012 (r237038) @@ -374,8 +374,8 @@ ath_sysctl_txagg(SYSCTL_HANDLER_ARGS) t++; } ATH_TXBUF_UNLOCK(sc); - printf("Total TX buffers: %d; Total TX buffers busy: %d\n", - t, i); + printf("Total TX buffers: %d; Total TX buffers busy: %d (%d)\n", + t, i, sc->sc_txbuf_cnt); i = t = 0; ATH_TXBUF_LOCK(sc); @@ -620,12 +620,11 @@ ath_sysctlattach(struct ath_softc *sc) "tid_hwq_hi", CTLFLAG_RW, &sc->sc_tid_hwq_hi, 0, ""); -#if 0 SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "txq_data_minfree", CTLFLAG_RW, &sc->sc_txq_data_minfree, 0, "Minimum free buffers before adding a data frame" " to the TX queue"); -#endif + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "txq_mcastq_maxdepth", CTLFLAG_RW, &sc->sc_txq_mcastq_maxdepth, 0, Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Wed Jun 13 22:53:56 2012 (r237037) +++ head/sys/dev/ath/if_athvar.h Thu Jun 14 00:51:53 2012 (r237038) @@ -501,6 +501,7 @@ struct ath_softc { struct ath_descdma sc_txdma; /* TX descriptors */ ath_bufhead sc_txbuf; /* transmit buffer */ + int sc_txbuf_cnt; /* how many buffers avail */ struct ath_descdma sc_txdma_mgmt; /* mgmt TX descriptors */ ath_bufhead sc_txbuf_mgmt; /* mgmt transmit buffer */ struct mtx sc_txbuflock; /* txbuf lock */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 03:27:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EDF6106566B; Thu, 14 Jun 2012 03:27:02 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id EC4EF8FC0A; Thu, 14 Jun 2012 03:27:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E3R1ux066461; Thu, 14 Jun 2012 03:27:01 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E3R1FD066459; Thu, 14 Jun 2012 03:27:01 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201206140327.q5E3R1FD066459@svn.freebsd.org> From: Tim Kientzle Date: Thu, 14 Jun 2012 03:27:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237039 - head/lib/libc/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 03:27:02 -0000 Author: kientzle Date: Thu Jun 14 03:27:01 2012 New Revision: 237039 URL: http://svn.freebsd.org/changeset/base/237039 Log: __flt_rounds is a public symbol (expands from the FLT_ROUNDS macro), so include it in the public namespace on arm just as with other architectures. This corrects r236816. Submitted by: Jan Sieka MFC after: 1 week Modified: head/lib/libc/arm/Symbol.map Modified: head/lib/libc/arm/Symbol.map ============================================================================== --- head/lib/libc/arm/Symbol.map Thu Jun 14 00:51:53 2012 (r237038) +++ head/lib/libc/arm/Symbol.map Thu Jun 14 03:27:01 2012 (r237039) @@ -31,6 +31,7 @@ FBSD_1.0 { brk; cerror; /* XXX - Should this be .cerror (see sys/cerror.S)? */ sbrk; + __flt_rounds; }; FBSDprivate_1.0 { @@ -70,7 +71,6 @@ FBSDprivate_1.0 { __divdf3; __floatsisf; __floatsidf; - __flt_rounds; __fixsfsi; __fixdfsi; __fixunssfsi; From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 04:00:31 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 11AAB106564A; Thu, 14 Jun 2012 04:00:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id EE1388FC0A; Thu, 14 Jun 2012 04:00:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E40UHr067995; Thu, 14 Jun 2012 04:00:30 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E40U05067983; Thu, 14 Jun 2012 04:00:30 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206140400.q5E40U05067983@svn.freebsd.org> From: Warner Losh Date: Thu, 14 Jun 2012 04:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237040 - in head/sys/arm: arm at91 econa include mv s3c2xx0 sa11x0 xscale/i80321 xscale/i8134x xscale/ixp425 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 04:00:31 -0000 Author: imp Date: Thu Jun 14 04:00:30 2012 New Revision: 237040 URL: http://svn.freebsd.org/changeset/base/237040 Log: Modify all the arm platform files to call parse_boot_param passing in the boot parameters from initarm first thing. parse_boot_param parses the boot arguments and converts them to the /boot/loader metadata the rest of the kernel uses. parse_boot_param is a weak alias to fake_preload_metadata, which all the platforms use now, but may become more extensive in the future. Since it is a weak symbol, specific boards may define their own parse_boot_param to interface to custom boot loaders. Reviewed by: cognet@, Ian Lapore Modified: head/sys/arm/arm/machdep.c head/sys/arm/at91/at91_machdep.c head/sys/arm/econa/econa_machdep.c head/sys/arm/include/machdep.h head/sys/arm/mv/mv_machdep.c head/sys/arm/s3c2xx0/s3c24x0_machdep.c head/sys/arm/sa11x0/assabet_machdep.c head/sys/arm/xscale/i80321/ep80219_machdep.c head/sys/arm/xscale/i80321/iq31244_machdep.c head/sys/arm/xscale/i8134x/crb_machdep.c head/sys/arm/xscale/ixp425/avila_machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/arm/machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -666,7 +666,7 @@ makectx(struct trapframe *tf, struct pcb * Fake up a boot descriptor table */ vm_offset_t -fake_preload_metadata(void) +fake_preload_metadata(struct arm_boot_params *abp __unused) { #ifdef DDB vm_offset_t zstart = 0, zend = 0; @@ -713,6 +713,23 @@ fake_preload_metadata(void) } /* + * Stub version of the boot parameter parsing routine. We are + * called early in initarm, before even VM has been initialized. + * This routine needs to preserve any data that the boot loader + * has passed in before the kernel starts to grow past the end + * of the BSS, traditionally the place boot-loaders put this data. + * + * Since this is called so early, things that depend on the vm system + * being setup (including access to some SoC's serial ports), about + * all that can be done in this routine is to copy the arguments. + * + * This is the default boot parameter parsing routine. Individual + * kernels/boards can override this weak function with one of their + * own. We just fake metadata... + */ +__weak_reference(fake_preload_metadata, parse_boot_param); + +/* * Initialize proc0 */ void Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/at91/at91_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -392,8 +392,8 @@ initarm(struct arm_boot_params *abp) uint32_t memsize; vm_offset_t lastaddr; + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/econa/econa_machdep.c ============================================================================== --- head/sys/arm/econa/econa_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/econa/econa_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -194,9 +194,8 @@ initarm(struct arm_boot_params *abp) int mem_info; boothowto = RB_VERBOSE; - + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/include/machdep.h Thu Jun 14 04:00:30 2012 (r237040) @@ -6,11 +6,14 @@ /* misc prototypes used by the many arm machdeps */ void arm_lock_cache_line(vm_offset_t); -vm_offset_t fake_preload_metadata(void); void init_proc0(vm_offset_t kstack); void halt(void); void data_abort_handler(trapframe_t *); void prefetch_abort_handler(trapframe_t *); void undefinedinstruction_bounce(trapframe_t *); +struct arm_boot_params; +vm_offset_t fake_preload_metadata(struct arm_boot_params *); +vm_offset_t parse_boot_param(struct arm_boot_params *); + #endif /* !_MACHINE_MACHDEP_H_ */ Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/mv/mv_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -331,7 +331,7 @@ initarm(struct arm_boot_params *abp) */ mdp = (void *)((uint32_t)mdp & ~PAGE_MASK); - /* Parse metadata and fetch parameters */ + /* Parse metadata and fetch parameters (move to common machdep.c?) */ if (mdp != NULL) { preload_metadata = mdp; kmdp = preload_search_by_type("elf kernel"); @@ -350,7 +350,7 @@ initarm(struct arm_boot_params *abp) preload_addr_relocate = KERNVIRTADDR - KERNPHYSADDR; } else { /* Fall back to hardcoded metadata. */ - lastaddr = fake_preload_metadata(); + lastaddr = fake_preload_metadata(abp); } #if defined(FDT_DTB_STATIC) Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c ============================================================================== --- head/sys/arm/s3c2xx0/s3c24x0_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -244,10 +244,9 @@ initarm(struct arm_boot_params *abp) int i; uint32_t memsize; + boothowto = 0; /* Likely not needed */ + lastaddr = parse_boot_param(abp); i = 0; - - boothowto = 0; - set_cpufuncs(); cpufuncs.cf_sleep = s3c24x0_sleep; lastaddr = fake_preload_metadata(); Modified: head/sys/arm/sa11x0/assabet_machdep.c ============================================================================== --- head/sys/arm/sa11x0/assabet_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/sa11x0/assabet_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -215,10 +215,10 @@ initarm(struct arm_boot_params *abp) uint32_t memsize = 32 * 1024 * 1024; sa1110_uart_vaddr = SACOM1_VBASE; - boothowto = RB_VERBOSE | RB_SINGLE; + boothowto = RB_VERBOSE | RB_SINGLE; /* Default value */ + lastaddr = parse_boot_param(abp); cninit(); set_cpufuncs(); - lastaddr = fake_preload_metadata(); physmem = memsize / PAGE_SIZE; pc = &__pcpu; pcpu_init(pc, 0, sizeof(struct pcpu)); Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/ep80219_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/xscale/i80321/ep80219_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -192,8 +192,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/iq31244_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/xscale/i80321/iq31244_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -193,8 +193,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- head/sys/arm/xscale/i8134x/crb_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/xscale/i8134x/crb_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -189,8 +189,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize, memstart; + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Thu Jun 14 03:27:01 2012 (r237039) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Thu Jun 14 04:00:30 2012 (r237040) @@ -238,8 +238,8 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize; + lastaddr = parse_boot_param(abp); set_cpufuncs(); /* NB: sets cputype */ - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 04:01:26 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 10BD4106566B; Thu, 14 Jun 2012 04:01:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id EF3658FC0A; Thu, 14 Jun 2012 04:01:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E41PA2068074; Thu, 14 Jun 2012 04:01:25 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E41P64068072; Thu, 14 Jun 2012 04:01:25 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206140401.q5E41P64068072@svn.freebsd.org> From: Adrian Chadd Date: Thu, 14 Jun 2012 04:01:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237041 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 04:01:26 -0000 Author: adrian Date: Thu Jun 14 04:01:25 2012 New Revision: 237041 URL: http://svn.freebsd.org/changeset/base/237041 Log: Disable this warning debug for now, as I'm now aware of the particular situation where it's occuring. Whilst I'm here, flesh out a more descriptive description. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Thu Jun 14 04:00:30 2012 (r237040) +++ head/sys/dev/ath/if_ath_tx.c Thu Jun 14 04:01:25 2012 (r237041) @@ -1308,7 +1308,28 @@ ath_tx_normal_setup(struct ath_softc *sc return EIO; } - /* Check if the TXQ wouldn't match what the hardware TXQ is! */ + /* + * There are two known scenarios where the frame AC doesn't match + * what the destination TXQ is. + * + * + non-QoS frames (eg management?) that the net80211 stack has + * assigned a higher AC to, but since it's a non-QoS TID, it's + * being thrown into TID 16. TID 16 gets the AC_BE queue. + * It's quite possible that management frames should just be + * direct dispatched to hardware rather than go via the software + * queue; that should be investigated in the future. There are + * some specific scenarios where this doesn't make sense, mostly + * surrounding ADDBA request/response - hence why that is special + * cased. + * + * + Multicast frames going into the VAP mcast queue. That shows up + * as "TXQ 11". + * + * This driver should eventually support separate TID and TXQ locking, + * allowing for arbitrary AC frames to appear on arbitrary software + * queues, being queued to the "correct" hardware queue when needed. + */ +#if 0 if (txq != sc->sc_ac2q[pri]) { device_printf(sc->sc_dev, "%s: txq=%p (%d), pri=%d, pri txq=%p (%d)\n", @@ -1319,6 +1340,7 @@ ath_tx_normal_setup(struct ath_softc *sc sc->sc_ac2q[pri], sc->sc_ac2q[pri]->axq_qnum); } +#endif /* * Calculate miscellaneous flags. From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 04:09:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1CB5106566C; Thu, 14 Jun 2012 04:09:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9B86E8FC0C; Thu, 14 Jun 2012 04:09:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E49Lxf068456; Thu, 14 Jun 2012 04:09:21 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E49LuR068450; Thu, 14 Jun 2012 04:09:21 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206140409.q5E49LuR068450@svn.freebsd.org> From: Warner Losh Date: Thu, 14 Jun 2012 04:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237042 - in head/sys: arm/arm arm/include arm/mv conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 04:09:21 -0000 Author: imp Date: Thu Jun 14 04:09:20 2012 New Revision: 237042 URL: http://svn.freebsd.org/changeset/base/237042 Log: Create default_parse_boot_param which, if FreeBSD /boot/loader support is enabled, sets values based on the metadata passed in. Otherwise fake_preload_metadata is called. Change the default parse_boot_param to default_parse_boot_param. Enable this functionality only on the mv platform, which is where most of the code is from. Reviewed by: cognet, Ian Lapore Modified: head/sys/arm/arm/machdep.c head/sys/arm/include/machdep.h head/sys/arm/mv/mv_machdep.c head/sys/arm/mv/std.mv head/sys/conf/options.arm Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Thu Jun 14 04:01:25 2012 (r237041) +++ head/sys/arm/arm/machdep.c Thu Jun 14 04:09:20 2012 (r237042) @@ -712,6 +712,47 @@ fake_preload_metadata(struct arm_boot_pa return (lastaddr); } +vm_offset_t +default_parse_boot_param(struct arm_boot_params *abp) +{ + vm_offset_t lastaddr; +#if defined(FREEBSD_BOOT_LOADER) + void *mdp; + void *kmdp; + + /* + * Mask metadata pointer: it is supposed to be on page boundary. If + * the first argument (mdp) doesn't point to a valid address the + * bootloader must have passed us something else than the metadata + * ptr... In this case we want to fall back to some built-in settings. + */ + mdp = (void *)(abp->abp_r0 & ~PAGE_MASK); + + kmdp = NULL; + /* Parse metadata and fetch parameters (move to common machdep.c?) */ + if (mdp != NULL) { + preload_metadata = mdp; + kmdp = preload_search_by_type("elf kernel"); + if (kmdp != NULL) { + boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); + kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, + vm_offset_t); +#ifdef DDB + ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); + ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); +#endif + } else + lastaddr = fake_preload_metadata(abp); + + preload_addr_relocate = KERNVIRTADDR - KERNPHYSADDR; + } else +#endif + /* Fall back to hardcoded metadata. */ + lastaddr = fake_preload_metadata(abp); + return lastaddr; +} + /* * Stub version of the boot parameter parsing routine. We are * called early in initarm, before even VM has been initialized. @@ -727,7 +768,7 @@ fake_preload_metadata(struct arm_boot_pa * kernels/boards can override this weak function with one of their * own. We just fake metadata... */ -__weak_reference(fake_preload_metadata, parse_boot_param); +__weak_reference(default_parse_boot_param, parse_boot_param); /* * Initialize proc0 Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Thu Jun 14 04:01:25 2012 (r237041) +++ head/sys/arm/include/machdep.h Thu Jun 14 04:09:20 2012 (r237042) @@ -11,9 +11,9 @@ void halt(void); void data_abort_handler(trapframe_t *); void prefetch_abort_handler(trapframe_t *); void undefinedinstruction_bounce(trapframe_t *); - struct arm_boot_params; -vm_offset_t fake_preload_metadata(struct arm_boot_params *); -vm_offset_t parse_boot_param(struct arm_boot_params *); +vm_offset_t default_parse_boot_param(struct arm_boot_params *abp); +vm_offset_t fake_preload_metadata(struct arm_boot_params *abp); +vm_offset_t parse_boot_param(struct arm_boot_params *abp); #endif /* !_MACHINE_MACHDEP_H_ */ Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Thu Jun 14 04:01:25 2012 (r237041) +++ head/sys/arm/mv/mv_machdep.c Thu Jun 14 04:09:20 2012 (r237042) @@ -311,47 +311,22 @@ initarm(struct arm_boot_params *abp) vm_offset_t dtbp, freemempos, l2_start, lastaddr; uint32_t memsize, l2size; void *kmdp; - void *mdp; u_int l1pagetable; int i = 0, j = 0, err_devmap = 0; - mdp = (void *)abp->abp_r0; - kmdp = NULL; - lastaddr = 0; + lastaddr = parse_boot_param(abp); memsize = 0; - dtbp = (vm_offset_t)NULL; - set_cpufuncs(); /* - * Mask metadata pointer: it is supposed to be on page boundary. If - * the first argument (mdp) doesn't point to a valid address the - * bootloader must have passed us something else than the metadata - * ptr... In this case we want to fall back to some built-in settings. - */ - mdp = (void *)((uint32_t)mdp & ~PAGE_MASK); - - /* Parse metadata and fetch parameters (move to common machdep.c?) */ - if (mdp != NULL) { - preload_metadata = mdp; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp != NULL) { - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); - dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); - lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, - vm_offset_t); -#ifdef DDB - ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); - ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); -#endif - } - - preload_addr_relocate = KERNVIRTADDR - KERNPHYSADDR; - } else { - /* Fall back to hardcoded metadata. */ - lastaddr = fake_preload_metadata(abp); - } + * Find the dtb passed in by the boot loader. + */ + kmdp = preload_search_by_type("elf kernel"); + if (kmdp != NULL) + dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); + else + dtbp = (vm_offset_t)NULL; + #if defined(FDT_DTB_STATIC) /* Modified: head/sys/arm/mv/std.mv ============================================================================== --- head/sys/arm/mv/std.mv Thu Jun 14 04:01:25 2012 (r237041) +++ head/sys/arm/mv/std.mv Thu Jun 14 04:09:20 2012 (r237042) @@ -3,3 +3,4 @@ files "../mv/files.mv" cpu CPU_ARM9E makeoptions CONF_CFLAGS="-march=armv5te" +options FREEBSD_BOOT_LOADER Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Thu Jun 14 04:01:25 2012 (r237041) +++ head/sys/conf/options.arm Thu Jun 14 04:09:20 2012 (r237042) @@ -16,6 +16,7 @@ CPU_XSCALE_IXP425 opt_global.h CPU_XSCALE_IXP435 opt_global.h CPU_XSCALE_PXA2X0 opt_global.h FLASHADDR opt_global.h +FREEBSD_BOOT_LOADER opt_global.h IXP4XX_FLASH_SIZE opt_global.h KERNPHYSADDR opt_global.h KERNVIRTADDR opt_global.h From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 04:14:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8AF42106564A; Thu, 14 Jun 2012 04:14:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 759878FC0C; Thu, 14 Jun 2012 04:14:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E4E74q068765; Thu, 14 Jun 2012 04:14:07 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E4E7kr068763; Thu, 14 Jun 2012 04:14:07 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206140414.q5E4E7kr068763@svn.freebsd.org> From: Adrian Chadd Date: Thu, 14 Jun 2012 04:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237043 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 04:14:07 -0000 Author: adrian Date: Thu Jun 14 04:14:06 2012 New Revision: 237043 URL: http://svn.freebsd.org/changeset/base/237043 Log: Disable BGSCAN for 802.11n for now. Until scanning during traffic is fixed for 802.11n TX, this needs to be disabled or users wlil see randomly hanging aggregation sessions. Whilst I'm here, remove the warning about 802.11n being full of dragons. It's nowhere near that scary now. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Jun 14 04:09:20 2012 (r237042) +++ head/sys/dev/ath/if_ath.c Thu Jun 14 04:14:06 2012 (r237043) @@ -524,7 +524,9 @@ ath_attach(u_int16_t devid, struct ath_s | IEEE80211_C_SHPREAMBLE /* short preamble supported */ | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_WPA /* capable of WPA1+WPA2 */ +#ifndef ATH_ENABLE_11N | IEEE80211_C_BGSCAN /* capable of bg scanning */ +#endif | IEEE80211_C_TXFRAG /* handle tx frags */ #ifdef ATH_ENABLE_DFS | IEEE80211_C_DFS /* Enable radar detection */ @@ -660,12 +662,6 @@ ath_attach(u_int16_t devid, struct ath_s (void) ath_hal_settxchainmask(sc->sc_ah, tx_chainmask); } - /* - * The if_ath 11n support is completely not ready for normal use. - * Enabling this option will likely break everything and everything. - * Don't think of doing that unless you know what you're doing. - */ - #ifdef ATH_ENABLE_11N /* * Query HT capabilities From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 04:16:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4C6BD106566C; Thu, 14 Jun 2012 04:16:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 373888FC16; Thu, 14 Jun 2012 04:16:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E4GHMd068902; Thu, 14 Jun 2012 04:16:17 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E4GHWq068898; Thu, 14 Jun 2012 04:16:17 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206140416.q5E4GHWq068898@svn.freebsd.org> From: Warner Losh Date: Thu, 14 Jun 2012 04:16:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237044 - in head/sys: arm/arm arm/include conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 04:16:17 -0000 Author: imp Date: Thu Jun 14 04:16:16 2012 New Revision: 237044 URL: http://svn.freebsd.org/changeset/base/237044 Log: Add support for parsing Linux ATAGs such as you'd see from uboot or redboot. Support is very preiminary and likely needs some work. Also, do some minor code shuffling of the FreeBSD /boot/loader metadata parsing code. This code is preliminary and should be used with caution. Modified: head/sys/arm/arm/machdep.c head/sys/arm/include/machdep.h head/sys/conf/options.arm Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Thu Jun 14 04:14:06 2012 (r237043) +++ head/sys/arm/arm/machdep.c Thu Jun 14 04:16:16 2012 (r237044) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -110,6 +111,20 @@ extern int *end; extern vm_offset_t ksym_start, ksym_end; #endif +#if defined(LINUX_BOOT_ABI) +#define LBABI_MAX_BANKS 10 + +uint32_t board_id; +struct arm_lbabi_tag *atag_list; +uint32_t revision; +uint64_t serial; +char linux_command_line[LBABI_MAX_COMMAND_LINE + 1]; +char atags[LBABI_MAX_COMMAND_LINE * 2]; +uint32_t memstart[LBABI_MAX_BANKS]; +uint32_t memsize[LBABI_MAX_BANKS]; +uint32_t membanks; +#endif + void sendsig(catcher, ksi, mask) sig_t catcher; @@ -712,11 +727,73 @@ fake_preload_metadata(struct arm_boot_pa return (lastaddr); } +#if defined(LINUX_BOOT_ABI) vm_offset_t -default_parse_boot_param(struct arm_boot_params *abp) +linux_parse_boot_param(struct arm_boot_params *abp) { - vm_offset_t lastaddr; + struct arm_lbabi_tag *walker; + + /* + * Linux boot ABI: r0 = 0, r1 is the board type (!= 0) and r2 + * is atags or dtb pointer. If all of these aren't satisfied, + * then punt. + */ + if (!(abp->abp_r0 == 0 && abp->abp_r1 != 0 && abp->abp_r2 != 0)) + return 0; + + board_id = abp->abp_r1; + walker = (struct arm_lbabi_tag *) + (abp->abp_r2 + KERNVIRTADDR - KERNPHYSADDR); + + /* xxx - Need to also look for binary device tree */ + if (ATAG_TAG(walker) != ATAG_CORE) + return 0; + + atag_list = walker; + while (ATAG_TAG(walker) != ATAG_NONE) { + switch (ATAG_TAG(walker)) { + case ATAG_CORE: + break; + case ATAG_MEM: + if (membanks < LBABI_MAX_BANKS) { + memstart[membanks] = walker->u.tag_mem.start; + memsize[membanks] = walker->u.tag_mem.size; + } + membanks++; + break; + case ATAG_INITRD2: + break; + case ATAG_SERIAL: + serial = walker->u.tag_sn.low | + ((uint64_t)walker->u.tag_sn.high << 32); + break; + case ATAG_REVISION: + revision = walker->u.tag_rev.rev; + break; + case ATAG_CMDLINE: + /* XXX open question: Parse this for boothowto? */ + bcopy(walker->u.tag_cmd.command, linux_command_line, + ATAG_SIZE(walker)); + break; + default: + break; + } + walker = ATAG_NEXT(walker); + } + + /* Save a copy for later */ + bcopy(atag_list, atags, + (char *)walker - (char *)atag_list + ATAG_SIZE(walker)); + + return fake_preload_metadata(abp); +} +#endif + #if defined(FREEBSD_BOOT_LOADER) +vm_offset_t +freebsd_parse_boot_param(struct arm_boot_params *abp) +{ + vm_offset_t lastaddr = 0; void *mdp; void *kmdp; @@ -724,32 +801,45 @@ default_parse_boot_param(struct arm_boot * Mask metadata pointer: it is supposed to be on page boundary. If * the first argument (mdp) doesn't point to a valid address the * bootloader must have passed us something else than the metadata - * ptr... In this case we want to fall back to some built-in settings. + * ptr, so we give up. Also give up if we cannot find metadta section + * the loader creates that we get all this data out of. */ - mdp = (void *)(abp->abp_r0 & ~PAGE_MASK); - kmdp = NULL; - /* Parse metadata and fetch parameters (move to common machdep.c?) */ - if (mdp != NULL) { - preload_metadata = mdp; - kmdp = preload_search_by_type("elf kernel"); - if (kmdp != NULL) { - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); - lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, - vm_offset_t); + if ((mdp = (void *)(abp->abp_r0 & ~PAGE_MASK)) == NULL) + return 0; + preload_metadata = mdp; + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + return 0; + + boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); + kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); #ifdef DDB - ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); - ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); + ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); + ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); +#endif + preload_addr_relocate = KERNVIRTADDR - KERNPHYSADDR; + return lastaddr; +} #endif - } else - lastaddr = fake_preload_metadata(abp); - preload_addr_relocate = KERNVIRTADDR - KERNPHYSADDR; - } else +vm_offset_t +default_parse_boot_param(struct arm_boot_params *abp) +{ + vm_offset_t lastaddr; + +#if defined(LINUX_BOOT_ABI) + if ((lastaddr = linux_parse_boot_param(abp)) != 0) + return lastaddr; #endif - /* Fall back to hardcoded metadata. */ - lastaddr = fake_preload_metadata(abp); +#if defined(FREEBSD_BOOT_LOADER) + if ((lastaddr = freebsd_parse_boot_param(abp)) != 0) + return lastaddr; +#endif + /* Fall back to hardcoded metadata. */ + lastaddr = fake_preload_metadata(abp); + return lastaddr; } Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Thu Jun 14 04:14:06 2012 (r237043) +++ head/sys/arm/include/machdep.h Thu Jun 14 04:16:16 2012 (r237044) @@ -13,6 +13,8 @@ void prefetch_abort_handler(trapframe_t void undefinedinstruction_bounce(trapframe_t *); struct arm_boot_params; vm_offset_t default_parse_boot_param(struct arm_boot_params *abp); +vm_offset_t freebsd_parse_boot_param(struct arm_boot_params *abp); +vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp); vm_offset_t fake_preload_metadata(struct arm_boot_params *abp); vm_offset_t parse_boot_param(struct arm_boot_params *abp); Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Thu Jun 14 04:14:06 2012 (r237043) +++ head/sys/conf/options.arm Thu Jun 14 04:16:16 2012 (r237044) @@ -20,6 +20,7 @@ FREEBSD_BOOT_LOADER opt_global.h IXP4XX_FLASH_SIZE opt_global.h KERNPHYSADDR opt_global.h KERNVIRTADDR opt_global.h +LINUX_BOOT_ABI opt_global.h LOADERRAMADDR opt_global.h PHYSADDR opt_global.h QEMU_WORKAROUNDS opt_global.h From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 04:18:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8628D106566C; Thu, 14 Jun 2012 04:18:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 6E94C8FC1D; Thu, 14 Jun 2012 04:18:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E4IvqU069060; Thu, 14 Jun 2012 04:18:57 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E4IvrX069052; Thu, 14 Jun 2012 04:18:57 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206140418.q5E4IvrX069052@svn.freebsd.org> From: Warner Losh Date: Thu, 14 Jun 2012 04:18:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237045 - in head/sys/arm: arm at91 econa include mv s3c2xx0 xscale/ixp425 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 04:18:57 -0000 Author: imp Date: Thu Jun 14 04:18:56 2012 New Revision: 237045 URL: http://svn.freebsd.org/changeset/base/237045 Log: More Linux boot support. Create arm_dump_avail_init() to initialize this array either from Linux boot data, when enabled, or in the typical way that most ports do it. arm_pyhs_avail_init is coming soon since it must be a separate function. Modified: head/sys/arm/arm/machdep.c head/sys/arm/at91/at91_machdep.c head/sys/arm/econa/econa_machdep.c head/sys/arm/include/machdep.h head/sys/arm/mv/mv_machdep.c head/sys/arm/s3c2xx0/s3c24x0_machdep.c head/sys/arm/xscale/ixp425/avila_machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Thu Jun 14 04:16:16 2012 (r237044) +++ head/sys/arm/arm/machdep.c Thu Jun 14 04:18:56 2012 (r237045) @@ -678,6 +678,47 @@ makectx(struct trapframe *tf, struct pcb } /* + * Make a standard dump_avail array. Can't make the phys_avail + * since we need to do that after we call pmap_bootstrap, but this + * is needed before pmap_boostrap. + * + * ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before + * calling pmap_bootstrap. + */ +void +arm_dump_avail_init(vm_offset_t memsize, size_t max) +{ +#ifdef LINUX_BOOT_ABI + /* + * Linux boot loader passes us the actual banks of memory, so use them + * to construct the dump_avail array. + */ + if (membanks > 0) + { + int i, j; + + if (max < (membanks + 1) * 2) + panic("dump_avail[%d] too small for %d banks\n", + max, membanks); + for (j = 0, i = 0; i < membanks; i++) { + dump_avail[j++] = round_page(memstart[i]); + dump_avail[j++] = trunc_page(memstart[i] + memsize[i]); + } + dump_avail[j++] = 0; + dump_avail[j++] = 0; + return; + } +#endif + if (max < 4) + panic("dump_avail too small\n"); + + dump_avail[0] = round_page(PHYSADDR); + dump_avail[1] = trunc_page(PHYSADDR + memsize); + dump_avail[2] = 0; + dump_avail[3] = 0; +} + +/* * Fake up a boot descriptor table */ vm_offset_t Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Thu Jun 14 04:16:16 2012 (r237044) +++ head/sys/arm/at91/at91_machdep.c Thu Jun 14 04:18:56 2012 (r237045) @@ -552,19 +552,8 @@ initarm(struct arm_boot_params *abp) arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1); - - /* - * ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before - * calling pmap_bootstrap. - */ - dump_avail[0] = PHYSADDR; - dump_avail[1] = PHYSADDR + memsize; - dump_avail[2] = 0; - dump_avail[3] = 0; - - pmap_bootstrap(freemempos, - KERNVIRTADDR + 3 * memsize, - &kernel_l1pt); + arm_dump_avail_init(memsize, sizeof(dump_avail)/sizeof(dump_avail[0])); + pmap_bootstrap(freemempos, KERNVIRTADDR + 3 * memsize, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); mutex_init(); Modified: head/sys/arm/econa/econa_machdep.c ============================================================================== --- head/sys/arm/econa/econa_machdep.c Thu Jun 14 04:16:16 2012 (r237044) +++ head/sys/arm/econa/econa_machdep.c Thu Jun 14 04:18:56 2012 (r237045) @@ -342,19 +342,8 @@ initarm(struct arm_boot_params *abp) arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1); - - /* - * ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before - * calling pmap_bootstrap. - */ - dump_avail[0] = PHYSADDR; - dump_avail[1] = PHYSADDR + memsize; - dump_avail[2] = 0; - dump_avail[3] = 0; - - pmap_bootstrap(freemempos, - KERNVIRTADDR + 3 * memsize, - &kernel_l1pt); + arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0])); + pmap_bootstrap(freemempos, KERNVIRTADDR + 3 * memsize, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Thu Jun 14 04:16:16 2012 (r237044) +++ head/sys/arm/include/machdep.h Thu Jun 14 04:18:56 2012 (r237045) @@ -11,6 +11,8 @@ void halt(void); void data_abort_handler(trapframe_t *); void prefetch_abort_handler(trapframe_t *); void undefinedinstruction_bounce(trapframe_t *); + +/* Early boot related helper functions */ struct arm_boot_params; vm_offset_t default_parse_boot_param(struct arm_boot_params *abp); vm_offset_t freebsd_parse_boot_param(struct arm_boot_params *abp); @@ -18,4 +20,7 @@ vm_offset_t linux_parse_boot_param(struc vm_offset_t fake_preload_metadata(struct arm_boot_params *abp); vm_offset_t parse_boot_param(struct arm_boot_params *abp); +/* Setup standard arrays */ +void arm_dump_avail_init( vm_offset_t memsize, size_t max); + #endif /* !_MACHINE_MACHDEP_H_ */ Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Thu Jun 14 04:16:16 2012 (r237044) +++ head/sys/arm/mv/mv_machdep.c Thu Jun 14 04:18:56 2012 (r237045) @@ -552,12 +552,7 @@ initarm(struct arm_boot_params *abp) init_proc0(kernelstack.pv_va); arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); - - dump_avail[0] = 0; - dump_avail[1] = memsize; - dump_avail[2] = 0; - dump_avail[3] = 0; - + arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0])); pmap_bootstrap(freemempos, pmap_bootstrap_lastaddr, &kernel_l1pt); msgbufp = (void *)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c ============================================================================== --- head/sys/arm/s3c2xx0/s3c24x0_machdep.c Thu Jun 14 04:16:16 2012 (r237044) +++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c Thu Jun 14 04:18:56 2012 (r237045) @@ -409,18 +409,8 @@ initarm(struct arm_boot_params *abp) arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); pmap_curmaxkvaddr = afterkern + 0x100000 * (KERNEL_PT_KERN_NUM - 1); - /* - * ARM_USE_SMALL_ALLOC uses dump_avail, so it must be filled before - * calling pmap_bootstrap. - */ - dump_avail[0] = PHYSADDR; - dump_avail[1] = PHYSADDR + memsize; - dump_avail[2] = 0; - dump_avail[3] = 0; - - pmap_bootstrap(freemempos, - KERNVIRTADDR + 3 * memsize, - &kernel_l1pt); + arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0])); + pmap_bootstrap(freemempos, KERNVIRTADDR + 3 * memsize, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); mutex_init(); Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Thu Jun 14 04:16:16 2012 (r237044) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Thu Jun 14 04:18:56 2012 (r237045) @@ -446,11 +446,7 @@ initarm(struct arm_boot_params *abp) arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); pmap_curmaxkvaddr = afterkern + PAGE_SIZE; - dump_avail[0] = PHYSADDR; - dump_avail[1] = PHYSADDR + memsize; - dump_avail[2] = 0; - dump_avail[3] = 0; - + arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0])); pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 04:24:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2FE0E106564A; Thu, 14 Jun 2012 04:24:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1A6D88FC08; Thu, 14 Jun 2012 04:24:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E4ODef069326; Thu, 14 Jun 2012 04:24:13 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E4ODMB069324; Thu, 14 Jun 2012 04:24:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206140424.q5E4ODMB069324@svn.freebsd.org> From: Adrian Chadd Date: Thu, 14 Jun 2012 04:24:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237046 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 04:24:14 -0000 Author: adrian Date: Thu Jun 14 04:24:13 2012 New Revision: 237046 URL: http://svn.freebsd.org/changeset/base/237046 Log: Shrink ath_buf a little more: * Resize some types. In particular, bfs_seqno can be uint16_t for now. Previous work would assign the unassigned seqno a value of -1, which I obviously can't do here. * Remove bfs_pktdur. It was in the original code but nothing so far uses it. This gets ath_buf down (on my i386 system) to 292 bytes from 300 bytes. I'd rather it be much, much smaller. Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Thu Jun 14 04:18:56 2012 (r237045) +++ head/sys/dev/ath/if_athvar.h Thu Jun 14 04:24:13 2012 (r237046) @@ -211,15 +211,16 @@ struct ath_buf { /* This state is kept to support software retries and aggregation */ struct { - int bfs_seqno; /* sequence number of this packet */ - int bfs_retries; /* retry count */ - uint16_t bfs_tid; /* packet TID (or TID_MAX for no QoS) */ - uint16_t bfs_pri; /* packet AC priority */ - struct ath_txq *bfs_txq; /* eventual dest hardware TXQ */ - uint16_t bfs_pktdur; /* packet duration (at current rate?) */ - uint16_t bfs_nframes; /* number of frames in aggregate */ + uint16_t bfs_seqno; /* sequence number of this packet */ uint16_t bfs_ndelim; /* number of delims for padding */ + uint8_t bfs_retries; /* retry count */ + uint8_t bfs_tid; /* packet TID (or TID_MAX for no QoS) */ + uint8_t bfs_nframes; /* number of frames in aggregate */ + uint8_t bfs_pri; /* packet AC priority */ + + struct ath_txq *bfs_txq; /* eventual dest hardware TXQ */ + u_int32_t bfs_aggr:1, /* part of aggregate? */ bfs_aggrburst:1, /* part of aggregate burst? */ bfs_isretried:1, /* retried frame? */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 06:26:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6F4B106564A; Thu, 14 Jun 2012 06:26:58 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BFFE28FC0A; Thu, 14 Jun 2012 06:26:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E6QwEd074769; Thu, 14 Jun 2012 06:26:58 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E6QwJs074766; Thu, 14 Jun 2012 06:26:58 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206140626.q5E6QwJs074766@svn.freebsd.org> From: Eitan Adler Date: Thu, 14 Jun 2012 06:26:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237047 - stable/9/sbin/mca X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 06:26:59 -0000 Author: eadler Date: Thu Jun 14 06:26:58 2012 New Revision: 237047 URL: http://svn.freebsd.org/changeset/base/237047 Log: MFC r236355: Fix a variety of compile errors with gcc48 and clang PR: bin/165699 Approved by: cperciva (implicit) Modified: stable/9/sbin/mca/Makefile stable/9/sbin/mca/mca.c Directory Properties: stable/9/sbin/mca/ (props changed) Modified: stable/9/sbin/mca/Makefile ============================================================================== --- stable/9/sbin/mca/Makefile Thu Jun 14 04:24:13 2012 (r237046) +++ stable/9/sbin/mca/Makefile Thu Jun 14 06:26:58 2012 (r237047) @@ -1,6 +1,5 @@ # $FreeBSD$ PROG= mca -WARNS?= 4 MAN= mca.8 .include Modified: stable/9/sbin/mca/mca.c ============================================================================== --- stable/9/sbin/mca/mca.c Thu Jun 14 04:24:13 2012 (r237046) +++ stable/9/sbin/mca/mca.c Thu Jun 14 06:26:58 2012 (r237047) @@ -55,10 +55,10 @@ __FBSDID("$FreeBSD$"); #define HW_MCA_MAX_CPUID 255 -static char hw_mca_count[] = "hw.mca.count"; -static char hw_mca_first[] = "hw.mca.first"; -static char hw_mca_last[] = "hw.mca.last"; -static char hw_mca_recid[] = "hw.mca.%lu.%u"; +static const char hw_mca_count[] = "hw.mca.count"; +static const char hw_mca_first[] = "hw.mca.first"; +static const char hw_mca_last[] = "hw.mca.last"; +static const char hw_mca_recid[] = "hw.mca.%d.%u"; static char default_dumpfile[] = "/var/log/mca.log"; @@ -162,7 +162,9 @@ show_cpu(struct mca_cpu_record *cpu) char var[16]; struct mca_cpu_mod *mod; struct mca_cpu_cpuid *cpuid; +#ifdef notyet struct mca_cpu_psi *psi; +#endif int i, n; printf(" \n"); @@ -200,8 +202,10 @@ show_cpu(struct mca_cpu_record *cpu) show_value(6, var, "0x%016llx", (long long)cpuid->cpuid[i]); } - psi = (struct mca_cpu_psi*)(cpuid + 1); - /* TODO: Dump PSI */ +#ifdef notyet + psi = (struct mca_cpu_psi*)(cpuid + 1); +#endif + /* TODO: Dump PSI */ printf(" \n"); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 06:54:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1C1A71065688; Thu, 14 Jun 2012 06:54:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 06C088FC0A; Thu, 14 Jun 2012 06:54:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E6sZFt076614; Thu, 14 Jun 2012 06:54:35 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E6sZAb076612; Thu, 14 Jun 2012 06:54:35 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206140654.q5E6sZAb076612@svn.freebsd.org> From: Eitan Adler Date: Thu, 14 Jun 2012 06:54:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237048 - stable/9/usr.sbin/mptutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 06:54:36 -0000 Author: eadler Date: Thu Jun 14 06:54:35 2012 New Revision: 237048 URL: http://svn.freebsd.org/changeset/base/237048 Log: MFC r236287: add missing variable declaration when DEBUG is defined forgotten in r215046 PR: bin/166404 Approved by: cperciva (implicit) Modified: stable/9/usr.sbin/mptutil/mpt_show.c Directory Properties: stable/9/usr.sbin/mptutil/ (props changed) Modified: stable/9/usr.sbin/mptutil/mpt_show.c ============================================================================== --- stable/9/usr.sbin/mptutil/mpt_show.c Thu Jun 14 06:26:58 2012 (r237047) +++ stable/9/usr.sbin/mptutil/mpt_show.c Thu Jun 14 06:54:35 2012 (r237048) @@ -538,7 +538,7 @@ show_physdisks(int ac, char **av) { CONFIG_PAGE_RAID_PHYS_DISK_0 *pinfo; U16 IOCStatus; - int fd, i; + int error, fd, i; if (ac != 1) { warnx("show drives: extra arguments"); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 06:54:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F115410656AB; Thu, 14 Jun 2012 06:54:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D94288FC12; Thu, 14 Jun 2012 06:54:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E6smDZ076665; Thu, 14 Jun 2012 06:54:48 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E6smMW076655; Thu, 14 Jun 2012 06:54:48 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206140654.q5E6smMW076655@svn.freebsd.org> From: Michael Tuexen Date: Thu, 14 Jun 2012 06:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237049 - in head/sys: netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 06:54:49 -0000 Author: tuexen Date: Thu Jun 14 06:54:48 2012 New Revision: 237049 URL: http://svn.freebsd.org/changeset/base/237049 Log: Pass flowid explicitly through the stack instead of taking it from the mbuf chain at different places. While there: Fix several bugs related to VRFs. MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_input.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_indata.c Thu Jun 14 06:54:48 2012 (r237049) @@ -2516,8 +2516,10 @@ doit_again: int sctp_process_data(struct mbuf **mm, int iphlen, int *offset, int length, - struct sctphdr *sh, struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct sctp_nets *net, uint32_t * high_tsn) + struct sctphdr *sh, struct sctp_inpcb *inp, + struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t * high_tsn, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_data_chunk *ch, chunk_buf; struct sctp_association *asoc; @@ -2625,7 +2627,9 @@ sctp_process_data(struct mbuf **mm, int } stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INDATA + SCTP_LOC_19; sctp_abort_association(inp, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, port); return (2); } #ifdef SCTP_AUDITING_ENABLED @@ -2689,7 +2693,11 @@ sctp_process_data(struct mbuf **mm, int struct mbuf *op_err; op_err = sctp_generate_invmanparam(SCTP_CAUSE_PROTOCOL_VIOLATION); - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, 0, net->port); + sctp_abort_association(inp, stcb, + m, iphlen, + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); return (2); } break; Modified: head/sys/netinet/sctp_indata.h ============================================================================== --- head/sys/netinet/sctp_indata.h Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_indata.h Thu Jun 14 06:54:48 2012 (r237049) @@ -113,7 +113,9 @@ void int sctp_process_data(struct mbuf **, int, int *, int, struct sctphdr *, struct sctp_inpcb *, struct sctp_tcb *, - struct sctp_nets *, uint32_t *); + struct sctp_nets *, uint32_t *, + uint8_t, uint32_t, + uint32_t, uint16_t); void sctp_slide_mapping_arrays(struct sctp_tcb *stcb); Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_input.c Thu Jun 14 06:54:48 2012 (r237049) @@ -81,8 +81,10 @@ sctp_stop_all_cookie_timers(struct sctp_ /* INIT handler */ static void sctp_handle_init(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, - struct sctp_init_chunk *cp, struct sctp_inpcb *inp, struct sctp_tcb *stcb, - int *abort_no_unlock, uint32_t vrf_id, uint16_t port) + struct sctp_init_chunk *cp, struct sctp_inpcb *inp, + struct sctp_tcb *stcb, int *abort_no_unlock, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_init *init; struct mbuf *op_err; @@ -96,6 +98,7 @@ sctp_handle_init(struct mbuf *m, int iph if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_init_chunk)) { op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -107,6 +110,7 @@ sctp_handle_init(struct mbuf *m, int iph /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -116,6 +120,7 @@ sctp_handle_init(struct mbuf *m, int iph /* invalid parameter... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -125,6 +130,7 @@ sctp_handle_init(struct mbuf *m, int iph /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -134,6 +140,7 @@ sctp_handle_init(struct mbuf *m, int iph /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, + use_mflowid, mflowid, vrf_id, port); if (stcb) *abort_no_unlock = 1; @@ -142,7 +149,9 @@ sctp_handle_init(struct mbuf *m, int iph if (sctp_validate_init_auth_params(m, offset + sizeof(*cp), offset + ntohs(cp->ch.chunk_length))) { /* auth parameter(s) error... send abort */ - sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, vrf_id, port); + sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, + use_mflowid, mflowid, + vrf_id, port); if (stcb) *abort_no_unlock = 1; goto outnow; @@ -169,7 +178,9 @@ sctp_handle_init(struct mbuf *m, int iph * state :-) */ if (SCTP_BASE_SYSCTL(sctp_blackhole) == 0) { - sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); } goto outnow; } @@ -180,7 +191,9 @@ sctp_handle_init(struct mbuf *m, int iph sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); } else { SCTPDBG(SCTP_DEBUG_INPUT3, "sctp_handle_init: sending INIT-ACK\n"); - sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, vrf_id, port, + sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, + use_mflowid, mflowid, + vrf_id, port, ((stcb == NULL) ? SCTP_HOLDS_LOCK : SCTP_NOT_LOCKED)); } outnow: @@ -406,9 +419,11 @@ sctp_process_init(struct sctp_init_chunk * INIT-ACK message processing/consumption returns value < 0 on error */ static int -sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, - struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, - struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id) +sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, + struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, + struct sctp_nets *net, int *abort_no_unlock, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id) { struct sctp_association *asoc; struct mbuf *op_err; @@ -445,8 +460,9 @@ sctp_process_init_ack(struct mbuf *m, in SCTPDBG(SCTP_DEBUG_INPUT1, "Load addresses from INIT causes an abort %d\n", retval); - sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - NULL, 0, net->port); + sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, NULL, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -520,7 +536,9 @@ sctp_process_init_ack(struct mbuf *m, in mp->resv = 0; } sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, - sh, op_err, vrf_id, net->port); + sh, op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; } return (retval); @@ -1260,9 +1278,11 @@ sctp_handle_error(struct sctp_chunkhdr * } static int -sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, - struct sctphdr *sh, struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, - struct sctp_nets *net, int *abort_no_unlock, uint32_t vrf_id) +sctp_handle_init_ack(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, + struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, + struct sctp_nets *net, int *abort_no_unlock, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id) { struct sctp_init_ack *init_ack; struct mbuf *op_err; @@ -1279,7 +1299,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* Invalid length */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1289,7 +1311,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1297,7 +1321,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1305,7 +1331,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1313,7 +1341,9 @@ sctp_handle_init_ack(struct mbuf *m, int /* protocol error... send an abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, sh, - op_err, 0, net->port); + op_err, + use_mflowid, mflowid, + vrf_id, net->port); *abort_no_unlock = 1; return (-1); } @@ -1336,7 +1366,9 @@ sctp_handle_init_ack(struct mbuf *m, int stcb, 0, (void *)stcb->asoc.primary_destination, SCTP_SO_NOT_LOCKED); } if (sctp_process_init_ack(m, iphlen, offset, sh, cp, stcb, - net, abort_no_unlock, vrf_id) < 0) { + net, abort_no_unlock, + use_mflowid, mflowid, + vrf_id) < 0) { /* error in parsing parameters */ return (-1); } @@ -1391,6 +1423,7 @@ sctp_process_cookie_new(struct mbuf *m, struct sctp_inpcb *inp, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port); @@ -1405,7 +1438,9 @@ sctp_process_cookie_existing(struct mbuf struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, - uint32_t vrf_id, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, uint16_t port) + int auth_skipped, uint32_t auth_offset, uint32_t auth_len, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_association *asoc; struct sctp_init_chunk *init_cp, init_buf; @@ -1443,6 +1478,7 @@ sctp_process_cookie_existing(struct mbuf ph->param_type = htons(SCTP_CAUSE_COOKIE_IN_SHUTDOWN); ph->param_length = htons(sizeof(struct sctp_paramhdr)); sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, + use_mflowid, mflowid, vrf_id, net->port); if (how_indx < sizeof(asoc->cookie_how)) asoc->cookie_how[how_indx] = 2; @@ -1667,7 +1703,9 @@ sctp_process_cookie_existing(struct mbuf ph = mtod(op_err, struct sctp_paramhdr *); ph->param_type = htons(SCTP_CAUSE_NAT_COLLIDING_STATE); ph->param_length = htons(sizeof(struct sctp_paramhdr)); - sctp_send_abort(m, iphlen, sh, 0, op_err, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, op_err, + use_mflowid, mflowid, + vrf_id, port); return (NULL); } if ((ntohl(initack_cp->init.initiate_tag) == asoc->my_vtag) && @@ -1832,6 +1870,7 @@ sctp_process_cookie_existing(struct mbuf return (sctp_process_cookie_new(m, iphlen, offset, sh, cookie, cookie_len, inp, netp, init_src, notification, auth_skipped, auth_offset, auth_len, + use_mflowid, mflowid, vrf_id, port)); } /* @@ -1962,12 +2001,13 @@ sctp_process_cookie_existing(struct mbuf * cookie-echo chunk length: length of the cookie chunk to: where the init * was from returns a new TCB */ -struct sctp_tcb * +static struct sctp_tcb * sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, struct sctp_state_cookie *cookie, int cookie_len, struct sctp_inpcb *inp, struct sctp_nets **netp, struct sockaddr *init_src, int *notification, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { struct sctp_tcb *stcb; @@ -2062,7 +2102,9 @@ sctp_process_cookie_new(struct mbuf *m, op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen, - sh, op_err, vrf_id, port); + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); return (NULL); } /* get the correct sctp_nets */ @@ -2088,7 +2130,9 @@ sctp_process_cookie_new(struct mbuf *m, atomic_add_int(&stcb->asoc.refcnt, 1); op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, (struct sctp_tcb *)NULL, m, iphlen, - sh, op_err, vrf_id, port); + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_TCB_UNLOCK(stcb); SCTP_SOCKET_LOCK(so, 1); @@ -2335,7 +2379,9 @@ sctp_handle_cookie_echo(struct mbuf *m, struct sctphdr *sh, struct sctp_cookie_echo_chunk *cp, struct sctp_inpcb **inp_p, struct sctp_tcb **stcb, struct sctp_nets **netp, int auth_skipped, uint32_t auth_offset, uint32_t auth_len, - struct sctp_tcb **locked_tcb, uint32_t vrf_id, uint16_t port) + struct sctp_tcb **locked_tcb, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_state_cookie *cookie; struct sctp_tcb *l_stcb = *stcb; @@ -2571,6 +2617,7 @@ sctp_handle_cookie_echo(struct mbuf *m, tim = now.tv_usec - cookie->time_entered.tv_usec; scm->time_usec = htonl(tim); sctp_send_operr_to(m, sh, cookie->peers_vtag, op_err, + use_mflowid, mflowid, vrf_id, port); return (NULL); } @@ -2658,21 +2705,25 @@ sctp_handle_cookie_echo(struct mbuf *m, /* this is the "normal" case... get a new TCB */ *stcb = sctp_process_cookie_new(m, iphlen, offset, sh, cookie, cookie_len, *inp_p, netp, to, ¬ification, - auth_skipped, auth_offset, auth_len, vrf_id, port); + auth_skipped, auth_offset, auth_len, + use_mflowid, mflowid, + vrf_id, port); } else { /* this is abnormal... cookie-echo on existing TCB */ had_a_existing_tcb = 1; *stcb = sctp_process_cookie_existing(m, iphlen, offset, sh, cookie, cookie_len, *inp_p, *stcb, netp, to, - ¬ification, vrf_id, auth_skipped, auth_offset, auth_len, port); + ¬ification, auth_skipped, auth_offset, auth_len, + use_mflowid, mflowid, + vrf_id, port); } if (*stcb == NULL) { /* still no TCB... must be bad cookie-echo */ return (NULL); } - if ((*netp != NULL) && (m->m_flags & M_FLOWID)) { - (*netp)->flowid = m->m_pkthdr.flowid; + if ((*netp != NULL) && (use_mflowid != 0)) { + (*netp)->flowid = mflowid; #ifdef INVARIANTS (*netp)->flowidset = 1; #endif @@ -2745,7 +2796,9 @@ sctp_handle_cookie_echo(struct mbuf *m, SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: no room for another socket!\n"); op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(*inp_p, NULL, m, iphlen, - sh, op_err, vrf_id, port); + sh, op_err, + use_mflowid, mflowid, + vrf_id, port); #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) pcb_so = SCTP_INP_SO(*inp_p); atomic_add_int(&(*stcb)->asoc.refcnt, 1); @@ -4361,6 +4414,7 @@ __attribute__((noinline)) sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length, struct sctphdr *sh, struct sctp_chunkhdr *ch, struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { struct sctp_association *asoc; @@ -4517,6 +4571,7 @@ __attribute__((noinline)) if (stcb == NULL) { /* no association, so it's out of the blue... */ sctp_handle_ootb(m, iphlen, *offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); *offset = length; if (locked_tcb) { @@ -4554,6 +4609,7 @@ __attribute__((noinline)) SCTP_TCB_UNLOCK(locked_tcb); } sctp_handle_ootb(m, iphlen, *offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); return (NULL); } @@ -4695,7 +4751,9 @@ process_control_chunks: if ((num_chunks > 1) || (length - *offset > (int)SCTP_SIZE32(chk_length))) { sctp_abort_association(inp, stcb, m, - iphlen, sh, NULL, vrf_id, port); + iphlen, sh, NULL, + use_mflowid, mflowid, + vrf_id, port); *offset = length; return (NULL); } @@ -4705,13 +4763,17 @@ process_control_chunks: op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, stcb, m, - iphlen, sh, op_err, vrf_id, port); + iphlen, sh, op_err, + use_mflowid, mflowid, + vrf_id, port); *offset = length; return (NULL); } sctp_handle_init(m, iphlen, *offset, sh, (struct sctp_init_chunk *)ch, inp, - stcb, &abort_no_unlock, vrf_id, port); + stcb, &abort_no_unlock, + use_mflowid, mflowid, + vrf_id, port); *offset = length; if ((!abort_no_unlock) && (locked_tcb)) { SCTP_TCB_UNLOCK(locked_tcb); @@ -4760,7 +4822,11 @@ process_control_chunks: } if ((netp) && (*netp)) { ret = sctp_handle_init_ack(m, iphlen, *offset, sh, - (struct sctp_init_ack_chunk *)ch, stcb, *netp, &abort_no_unlock, vrf_id); + (struct sctp_init_ack_chunk *)ch, + stcb, *netp, + &abort_no_unlock, + use_mflowid, mflowid, + vrf_id); } else { ret = -1; } @@ -5066,7 +5132,9 @@ process_control_chunks: op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, stcb, m, - iphlen, sh, op_err, vrf_id, port); + iphlen, sh, op_err, + use_mflowid, mflowid, + vrf_id, port); } *offset = length; return (NULL); @@ -5098,6 +5166,8 @@ process_control_chunks: auth_offset, auth_len, &locked_tcb, + use_mflowid, + mflowid, vrf_id, port); } else { @@ -5550,8 +5620,10 @@ __attribute__((noinline)) void sctp_common_input_processing(struct mbuf **mm, int iphlen, int offset, int length, struct sctphdr *sh, struct sctp_chunkhdr *ch, - struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets *net, - uint8_t ecn_bits, uint32_t vrf_id, uint16_t port) + struct sctp_inpcb *inp, struct sctp_tcb *stcb, + struct sctp_nets *net, uint8_t ecn_bits, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { /* * Control chunk processing @@ -5587,6 +5659,7 @@ sctp_common_input_processing(struct mbuf */ SCTP_TCB_UNLOCK(stcb); sctp_handle_ootb(m, iphlen, offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); goto out_now; } @@ -5595,7 +5668,9 @@ sctp_common_input_processing(struct mbuf /* process the control portion of the SCTP packet */ /* sa_ignore NO_NULL_CHK */ stcb = sctp_process_control(m, iphlen, &offset, length, sh, ch, - inp, stcb, &net, &fwd_tsn_seen, vrf_id, port); + inp, stcb, &net, &fwd_tsn_seen, + use_mflowid, mflowid, + vrf_id, port); if (stcb) { /* * This covers us if the cookie-echo was there and @@ -5631,6 +5706,7 @@ sctp_common_input_processing(struct mbuf if (stcb == NULL) { /* out of the blue DATA chunk */ sctp_handle_ootb(m, iphlen, offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); goto out_now; } @@ -5700,6 +5776,7 @@ sctp_common_input_processing(struct mbuf * We consider OOTB any data sent during asoc setup. */ sctp_handle_ootb(m, iphlen, offset, sh, inp, + use_mflowid, mflowid, vrf_id, port); SCTP_TCB_UNLOCK(stcb); goto out_now; @@ -5720,7 +5797,9 @@ sctp_common_input_processing(struct mbuf } /* plow through the data chunks while length > offset */ retval = sctp_process_data(mm, iphlen, &offset, length, sh, - inp, stcb, net, &high_tsn); + inp, stcb, net, &high_tsn, + use_mflowid, mflowid, + vrf_id, port); if (retval == 2) { /* * The association aborted, NO UNLOCK needed since @@ -5820,6 +5899,8 @@ sctp_input_with_port(struct mbuf *i_pak, struct sctp_chunkhdr *ch; int refcount_up = 0; int length, mlen, offset; + uint32_t mflowid; + uint8_t use_mflowid; #if !defined(SCTP_WITH_NO_CSUM) uint32_t check, calc_check; @@ -5855,6 +5936,13 @@ sctp_input_with_port(struct mbuf *i_pak, if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) sctp_packet_log(m, mlen); #endif + if (m->m_flags & M_FLOWID) { + mflowid = m->m_pkthdr.flowid; + use_mflowid = 1; + } else { + mflowid = 0; + use_mflowid = 0; + } /* * Must take out the iphlen, since mlen expects this (only effect lb * case) @@ -5926,8 +6014,8 @@ sctp_input_with_port(struct mbuf *i_pak, } net->port = port; } - if ((net != NULL) && (m->m_flags & M_FLOWID)) { - net->flowid = m->m_pkthdr.flowid; + if ((net != NULL) && (use_mflowid != 0)) { + net->flowid = mflowid; #ifdef INVARIANTS net->flowidset = 1; #endif @@ -5961,8 +6049,8 @@ sctp_skip_csum_4: } net->port = port; } - if ((net != NULL) && (m->m_flags & M_FLOWID)) { - net->flowid = m->m_pkthdr.flowid; + if ((net != NULL) && (use_mflowid != 0)) { + net->flowid = mflowid; #ifdef INVARIANTS net->flowidset = 1; #endif @@ -5996,7 +6084,9 @@ sctp_skip_csum_4: sh->v_tag = init_chk->init.initiate_tag; } if (ch->chunk_type == SCTP_SHUTDOWN_ACK) { - sctp_send_shutdown_complete2(m, sh, vrf_id, port); + sctp_send_shutdown_complete2(m, sh, + use_mflowid, mflowid, + vrf_id, port); goto bad; } if (ch->chunk_type == SCTP_SHUTDOWN_COMPLETE) { @@ -6006,7 +6096,9 @@ sctp_skip_csum_4: if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && (ch->chunk_type != SCTP_INIT))) { - sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); } } goto bad; @@ -6035,7 +6127,9 @@ sctp_skip_csum_4: /* sa_ignore NO_NULL_CHK */ sctp_common_input_processing(&m, iphlen, offset, length, sh, ch, - inp, stcb, net, ecn_bits, vrf_id, port); + inp, stcb, net, ecn_bits, + use_mflowid, mflowid, + vrf_id, port); /* inp's ref-count reduced && stcb unlocked */ if (m) { sctp_m_freem(m); Modified: head/sys/netinet/sctp_input.h ============================================================================== --- head/sys/netinet/sctp_input.h Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_input.h Thu Jun 14 06:54:48 2012 (r237049) @@ -39,8 +39,11 @@ __FBSDID("$FreeBSD$"); #if defined(_KERNEL) || defined(__Userspace__) void sctp_common_input_processing(struct mbuf **, int, int, int, - struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb *, - struct sctp_tcb *, struct sctp_nets *, uint8_t, uint32_t, uint16_t); + struct sctphdr *, struct sctp_chunkhdr *, + struct sctp_inpcb *, struct sctp_tcb *, + struct sctp_nets *, uint8_t, + uint8_t, uint32_t, + uint32_t, uint16_t); struct sctp_stream_reset_out_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_output.c Thu Jun 14 06:54:48 2012 (r237049) @@ -3859,13 +3859,13 @@ sctp_lowlevel_chunk_output(struct sctp_i uint16_t dest_port, uint32_t v_tag, uint16_t port, + union sctp_sockstore *over_addr, + uint8_t use_mflowid, uint32_t mflowid, #if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) - int so_locked SCTP_UNUSED, + int so_locked SCTP_UNUSED #else - int so_locked, + int so_locked #endif - union sctp_sockstore *over_addr, - struct mbuf *init ) /* nofragment_flag to tell if IP_DF should be set (IPv4 only) */ { @@ -3951,8 +3951,8 @@ sctp_lowlevel_chunk_output(struct sctp_i m->m_pkthdr.flowid = net->flowid; m->m_flags |= M_FLOWID; } else { - if ((init != NULL) && (init->m_flags & M_FLOWID)) { - m->m_pkthdr.flowid = init->m_pkthdr.flowid; + if (use_mflowid != 0) { + m->m_pkthdr.flowid = mflowid; m->m_flags |= M_FLOWID; } } @@ -4243,8 +4243,8 @@ sctp_lowlevel_chunk_output(struct sctp_i m->m_pkthdr.flowid = net->flowid; m->m_flags |= M_FLOWID; } else { - if ((init != NULL) && (init->m_flags & M_FLOWID)) { - m->m_pkthdr.flowid = init->m_pkthdr.flowid; + if (use_mflowid != 0) { + m->m_pkthdr.flowid = mflowid; m->m_flags |= M_FLOWID; } } @@ -4841,7 +4841,9 @@ sctp_send_initiate(struct sctp_inpcb *in (struct sockaddr *)&net->ro._l_addr, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, stcb->rport, htonl(0), - net->port, so_locked, NULL, NULL); + net->port, NULL, + 0, 0, + so_locked); SCTPDBG(SCTP_DEBUG_OUTPUT4, "lowlevel_output - %d\n", ret); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); @@ -5370,8 +5372,10 @@ sctp_are_there_new_addresses(struct sctp */ void sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct mbuf *init_pkt, int iphlen, int offset, struct sctphdr *sh, - struct sctp_init_chunk *init_chk, uint32_t vrf_id, uint16_t port, int hold_inp_lock) + struct mbuf *init_pkt, int iphlen, int offset, + struct sctphdr *sh, struct sctp_init_chunk *init_chk, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port, int hold_inp_lock) { struct sctp_association *asoc; struct mbuf *m, *m_at, *m_tmp, *m_cookie, *op_err, *mp_last; @@ -5422,7 +5426,9 @@ sctp_send_initiate_ack(struct sctp_inpcb * though we even set the T bit and copy in the 0 tag.. this * looks no different than if no listener was present. */ - sctp_send_abort(init_pkt, iphlen, sh, 0, NULL, vrf_id, port); + sctp_send_abort(init_pkt, iphlen, sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); return; } abort_flag = 0; @@ -5432,7 +5438,9 @@ sctp_send_initiate_ack(struct sctp_inpcb if (abort_flag) { do_a_abort: sctp_send_abort(init_pkt, iphlen, sh, - init_chk->init.initiate_tag, op_err, vrf_id, port); + init_chk->init.initiate_tag, op_err, + use_mflowid, mflowid, + vrf_id, port); return; } m = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_DONTWAIT, 1, MT_DATA); @@ -6034,7 +6042,9 @@ do_a_abort: (void)sctp_lowlevel_chunk_output(inp, NULL, NULL, to, m, 0, NULL, 0, 0, 0, 0, inp->sctp_lport, sh->src_port, init_chk->init.initiate_tag, - port, SCTP_SO_NOT_LOCKED, over_addr, init_pkt); + port, over_addr, + use_mflowid, mflowid, + SCTP_SO_NOT_LOCKED); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -8116,7 +8126,9 @@ again_one_more_time: no_fragmentflg, 0, asconf, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - net->port, so_locked, NULL, NULL))) { + net->port, NULL, + 0, 0, + so_locked))) { if (error == ENOBUFS) { asoc->ifp_had_enobuf = 1; SCTP_STAT_INCR(sctps_lowlevelerr); @@ -8388,7 +8400,9 @@ again_one_more_time: no_fragmentflg, 0, asconf, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - net->port, so_locked, NULL, NULL))) { + net->port, NULL, + 0, 0, + so_locked))) { if (error == ENOBUFS) { asoc->ifp_had_enobuf = 1; SCTP_STAT_INCR(sctps_lowlevelerr); @@ -8727,7 +8741,9 @@ no_data_fill: asconf, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - net->port, so_locked, NULL, NULL))) { + net->port, NULL, + 0, 0, + so_locked))) { /* error, we could not output */ if (error == ENOBUFS) { SCTP_STAT_INCR(sctps_lowlevelerr); @@ -9429,7 +9445,9 @@ sctp_chunk_retransmission(struct sctp_in auth_offset, auth, stcb->asoc.authinfo.active_keyid, no_fragmentflg, 0, 0, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - chk->whoTo->port, so_locked, NULL, NULL))) { + chk->whoTo->port, NULL, + 0, 0, + so_locked))) { SCTP_STAT_INCR(sctps_lowlevelerr); return (error); } @@ -9694,7 +9712,9 @@ one_chunk_around: auth_offset, auth, auth_keyid, no_fragmentflg, 0, 0, inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - net->port, so_locked, NULL, NULL))) { + net->port, NULL, + 0, 0, + so_locked))) { /* error, we could not output */ SCTP_STAT_INCR(sctps_lowlevelerr); return (error); @@ -10812,7 +10832,9 @@ sctp_send_abort_tcb(struct sctp_tcb *stc (struct sockaddr *)&net->ro._l_addr, m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), - stcb->asoc.primary_destination->port, so_locked, NULL, NULL); + stcb->asoc.primary_destination->port, NULL, + 0, 0, + so_locked); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); } @@ -10849,14 +10871,18 @@ sctp_send_shutdown_complete(struct sctp_ m_shutdown_comp, 0, NULL, 0, 1, 0, 0, stcb->sctp_ep->sctp_lport, stcb->rport, htonl(vtag), - net->port, SCTP_SO_NOT_LOCKED, NULL, NULL); + net->port, NULL, + 0, 0, + SCTP_SO_NOT_LOCKED); SCTP_STAT_INCR_COUNTER64(sctps_outcontrolchunks); return; } static void sctp_send_resp_msg(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, - uint8_t type, struct mbuf *cause, uint32_t vrf_id, uint16_t port) + uint8_t type, struct mbuf *cause, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct mbuf *o_pak; struct mbuf *mout; @@ -10929,8 +10955,8 @@ sctp_send_resp_msg(struct mbuf *m, struc SCTP_BUF_RESV_UF(mout, max_linkhdr); SCTP_BUF_LEN(mout) = len; SCTP_BUF_NEXT(mout) = cause; - if (m->m_flags & M_FLOWID) { - mout->m_pkthdr.flowid = m->m_pkthdr.flowid; + if (use_mflowid != 0) { + mout->m_pkthdr.flowid = mflowid; mout->m_flags |= M_FLOWID; } #ifdef INET @@ -11110,9 +11136,12 @@ sctp_send_resp_msg(struct mbuf *m, struc void sctp_send_shutdown_complete2(struct mbuf *m, struct sctphdr *sh, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { - sctp_send_resp_msg(m, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL, vrf_id, port); + sctp_send_resp_msg(m, sh, 0, SCTP_SHUTDOWN_COMPLETE, NULL, + use_mflowid, mflowid, + vrf_id, port); } void @@ -11944,7 +11973,9 @@ skip_stuff: void sctp_send_abort(struct mbuf *m, int iphlen, struct sctphdr *sh, uint32_t vtag, - struct mbuf *cause, uint32_t vrf_id, uint16_t port) + struct mbuf *cause, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { /* Don't respond to an ABORT with an ABORT. */ if (sctp_is_there_an_abort_here(m, iphlen, &vtag)) { @@ -11952,15 +11983,21 @@ sctp_send_abort(struct mbuf *m, int iphl sctp_m_freem(cause); return; } - sctp_send_resp_msg(m, sh, vtag, SCTP_ABORT_ASSOCIATION, cause, vrf_id, port); + sctp_send_resp_msg(m, sh, vtag, SCTP_ABORT_ASSOCIATION, cause, + use_mflowid, mflowid, + vrf_id, port); return; } void sctp_send_operr_to(struct mbuf *m, struct sctphdr *sh, uint32_t vtag, - struct mbuf *cause, uint32_t vrf_id, uint16_t port) + struct mbuf *cause, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { - sctp_send_resp_msg(m, sh, vtag, SCTP_OPERATION_ERROR, cause, vrf_id, port); + sctp_send_resp_msg(m, sh, vtag, SCTP_OPERATION_ERROR, cause, + use_mflowid, mflowid, + vrf_id, port); return; } Modified: head/sys/netinet/sctp_output.h ============================================================================== --- head/sys/netinet/sctp_output.h Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctp_output.h Thu Jun 14 06:54:48 2012 (r237049) @@ -83,8 +83,9 @@ sctp_send_initiate(struct sctp_inpcb *, ); void -sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int, int, struct sctphdr *, struct sctp_init_chunk *, +sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, struct mbuf *, + int, int, struct sctphdr *, struct sctp_init_chunk *, + uint8_t, uint32_t, uint32_t, uint16_t, int); struct mbuf * @@ -116,6 +117,7 @@ void sctp_send_shutdown_complete(struct void sctp_send_shutdown_complete2(struct mbuf *, struct sctphdr *, + uint8_t, uint32_t, uint32_t, uint16_t); void sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked); @@ -202,15 +204,19 @@ sctp_send_str_reset_req(struct sctp_tcb void sctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t, - struct mbuf *, uint32_t, uint16_t); + struct mbuf *, + uint8_t, uint32_t, + uint32_t, uint16_t); void sctp_send_operr_to(struct mbuf *, struct sctphdr *, uint32_t, - struct mbuf *, uint32_t, uint16_t); + struct mbuf *, + uint8_t, uint32_t, + uint32_t, uint16_t); #endif /* _KERNEL || __Userspace__ */ -#if defined(_KERNEL) || defined (__Userspace__) +#if defined(_KERNEL) || defined(__Userspace__) int sctp_sosend(struct socket *so, struct sockaddr *addr, Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctputil.c Thu Jun 14 06:54:48 2012 (r237049) @@ -3823,7 +3823,9 @@ sctp_abort_notification(struct sctp_tcb void sctp_abort_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, - struct mbuf *m, int iphlen, struct sctphdr *sh, struct mbuf *op_err, + struct mbuf *m, int iphlen, struct sctphdr *sh, + struct mbuf *op_err, + uint8_t use_mflowid, uint32_t mflowid, uint32_t vrf_id, uint16_t port) { uint32_t vtag; @@ -3842,7 +3844,9 @@ sctp_abort_association(struct sctp_inpcb vrf_id = stcb->asoc.vrf_id; stcb->asoc.state |= SCTP_STATE_WAS_ABORTED; } - sctp_send_abort(m, iphlen, sh, vtag, op_err, vrf_id, port); + sctp_send_abort(m, iphlen, sh, vtag, op_err, + use_mflowid, mflowid, + vrf_id, port); if (stcb != NULL) { /* Ok, now lets free it */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -3992,7 +3996,9 @@ sctp_abort_an_association(struct sctp_in void sctp_handle_ootb(struct mbuf *m, int iphlen, int offset, struct sctphdr *sh, - struct sctp_inpcb *inp, uint32_t vrf_id, uint16_t port) + struct sctp_inpcb *inp, + uint8_t use_mflowid, uint32_t mflowid, + uint32_t vrf_id, uint16_t port) { struct sctp_chunkhdr *ch, chunk_buf; unsigned int chk_length; @@ -4035,7 +4041,9 @@ sctp_handle_ootb(struct mbuf *m, int iph */ return; case SCTP_SHUTDOWN_ACK: - sctp_send_shutdown_complete2(m, sh, vrf_id, port); + sctp_send_shutdown_complete2(m, sh, + use_mflowid, mflowid, + vrf_id, port); return; default: break; @@ -4047,7 +4055,9 @@ sctp_handle_ootb(struct mbuf *m, int iph if ((SCTP_BASE_SYSCTL(sctp_blackhole) == 0) || ((SCTP_BASE_SYSCTL(sctp_blackhole) == 1) && (contains_init_chunk == 0))) { - sctp_send_abort(m, iphlen, sh, 0, NULL, vrf_id, port); + sctp_send_abort(m, iphlen, sh, 0, NULL, + use_mflowid, mflowid, + vrf_id, port); } } Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Thu Jun 14 06:54:35 2012 (r237048) +++ head/sys/netinet/sctputil.h Thu Jun 14 06:54:48 2012 (r237049) @@ -185,8 +185,10 @@ sctp_abort_notification(struct sctp_tcb /* We abort responding to an IP packet for some reason */ void -sctp_abort_association(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int, struct sctphdr *, struct mbuf *, uint32_t, uint16_t); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 06:55:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 984C91065847; Thu, 14 Jun 2012 06:55:17 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 33BBC8FC14; Thu, 14 Jun 2012 06:55:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E6tHH4076733; Thu, 14 Jun 2012 06:55:17 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E6tHeK076731; Thu, 14 Jun 2012 06:55:17 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206140655.q5E6tHeK076731@svn.freebsd.org> From: Eitan Adler Date: Thu, 14 Jun 2012 06:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237050 - stable/8/usr.sbin/mptutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 06:55:17 -0000 Author: eadler Date: Thu Jun 14 06:55:16 2012 New Revision: 237050 URL: http://svn.freebsd.org/changeset/base/237050 Log: MFC r236287: add missing variable declaration when DEBUG is defined forgotten in r215046 PR: bin/166404 Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/mptutil/mpt_show.c Directory Properties: stable/8/usr.sbin/mptutil/ (props changed) Modified: stable/8/usr.sbin/mptutil/mpt_show.c ============================================================================== --- stable/8/usr.sbin/mptutil/mpt_show.c Thu Jun 14 06:54:48 2012 (r237049) +++ stable/8/usr.sbin/mptutil/mpt_show.c Thu Jun 14 06:55:16 2012 (r237050) @@ -538,7 +538,7 @@ show_physdisks(int ac, char **av) { CONFIG_PAGE_RAID_PHYS_DISK_0 *pinfo; U16 IOCStatus; - int fd, i; + int error, fd, i; if (ac != 1) { warnx("show drives: extra arguments"); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 06:55:41 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E665106585C; Thu, 14 Jun 2012 06:55:41 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 086498FC0C; Thu, 14 Jun 2012 06:55:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E6tebF076786; Thu, 14 Jun 2012 06:55:40 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E6teb0076783; Thu, 14 Jun 2012 06:55:40 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201206140655.q5E6teb0076783@svn.freebsd.org> From: Eitan Adler Date: Thu, 14 Jun 2012 06:55:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237051 - stable/7/usr.sbin/mptutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 06:55:41 -0000 Author: eadler Date: Thu Jun 14 06:55:40 2012 New Revision: 237051 URL: http://svn.freebsd.org/changeset/base/237051 Log: MFC r236287: add missing variable declaration when DEBUG is defined forgotten in r215046 PR: bin/166404 Approved by: cperciva (implicit) Modified: stable/7/usr.sbin/mptutil/mpt_show.c Directory Properties: stable/7/usr.sbin/mptutil/ (props changed) Modified: stable/7/usr.sbin/mptutil/mpt_show.c ============================================================================== --- stable/7/usr.sbin/mptutil/mpt_show.c Thu Jun 14 06:55:16 2012 (r237050) +++ stable/7/usr.sbin/mptutil/mpt_show.c Thu Jun 14 06:55:40 2012 (r237051) @@ -538,7 +538,7 @@ show_physdisks(int ac, char **av) { CONFIG_PAGE_RAID_PHYS_DISK_0 *pinfo; U16 IOCStatus; - int fd, i; + int error, fd, i; if (ac != 1) { warnx("show drives: extra arguments"); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 07:40:18 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA72A106564A; Thu, 14 Jun 2012 07:40:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B47BF8FC0C; Thu, 14 Jun 2012 07:40:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E7eIFr078863; Thu, 14 Jun 2012 07:40:18 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E7eIBx078861; Thu, 14 Jun 2012 07:40:18 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206140740.q5E7eIBx078861@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 14 Jun 2012 07:40:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237053 - stable/9/sys/contrib/pf/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 07:40:18 -0000 Author: glebius Date: Thu Jun 14 07:40:18 2012 New Revision: 237053 URL: http://svn.freebsd.org/changeset/base/237053 Log: Merge r236671 from head: Merge revision 1.715 from OpenBSD: date: 2010/12/24 20:12:56; author: henning; state: Exp; lines: +3 -3 in pf_src_connlimit, the indices to sk->addr were swapped. tracked down and diff sent by Robert B Mills thanks, very good work! ok claudio Impact is that the "flush" keyword didn't work. Obtained from: OpenBSD Modified: stable/9/sys/contrib/pf/net/pf.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/contrib/pf/ (props changed) Modified: stable/9/sys/contrib/pf/net/pf.c ============================================================================== --- stable/9/sys/contrib/pf/net/pf.c Thu Jun 14 07:12:41 2012 (r237052) +++ stable/9/sys/contrib/pf/net/pf.c Thu Jun 14 07:40:18 2012 (r237053) @@ -643,10 +643,10 @@ pf_src_connlimit(struct pf_state **state (*state)->key[PF_SK_WIRE]->af && (((*state)->direction == PF_OUT && PF_AEQ(&(*state)->src_node->addr, - &sk->addr[0], sk->af)) || + &sk->addr[1], sk->af)) || ((*state)->direction == PF_IN && PF_AEQ(&(*state)->src_node->addr, - &sk->addr[1], sk->af))) && + &sk->addr[0], sk->af))) && ((*state)->rule.ptr->flush & PF_FLUSH_GLOBAL || (*state)->rule.ptr == st->rule.ptr)) { From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 07:51:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 353D7106564A; Thu, 14 Jun 2012 07:51:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1F80B8FC0A; Thu, 14 Jun 2012 07:51:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5E7pb34079425; Thu, 14 Jun 2012 07:51:37 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5E7pb1T079423; Thu, 14 Jun 2012 07:51:37 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206140751.q5E7pb1T079423@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 14 Jun 2012 07:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237054 - stable/9/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 07:51:38 -0000 Author: glebius Date: Thu Jun 14 07:51:37 2012 New Revision: 237054 URL: http://svn.freebsd.org/changeset/base/237054 Log: Merge 236560 and following 236563,236598 from head: Optimise kern_sendfile(): skip cycling through the entire mbuf chain in m_cat(), storing pointer to last mbuf in chain in local variable and attaching new mbuf to the end of chain. Submitter reports that CPU load dropped for > 10% on a web server serving large files with this optimisation. Submitted by: Sergey Budnevitch Modified: stable/9/sys/kern/uipc_syscalls.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/uipc_syscalls.c ============================================================================== --- stable/9/sys/kern/uipc_syscalls.c Thu Jun 14 07:40:18 2012 (r237053) +++ stable/9/sys/kern/uipc_syscalls.c Thu Jun 14 07:51:37 2012 (r237054) @@ -1962,6 +1962,7 @@ kern_sendfile(struct thread *td, struct * and takes care of the overall progress. */ for (off = uap->offset, rem = uap->nbytes; ; ) { + struct mbuf *mtail = NULL; int loopbytes = 0; int space = 0; int done = 0; @@ -2181,10 +2182,13 @@ retry_space: m0->m_len = xfsize; /* Append to mbuf chain. */ - if (m != NULL) - m_cat(m, m0); + if (mtail != NULL) + mtail->m_next = m0; + else if (m != NULL) + m_last(m)->m_next = m0; else m = m0; + mtail = m0; /* Keep track of bits processed. */ loopbytes += xfsize; From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 11:17:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 861DC1065670; Thu, 14 Jun 2012 11:17:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 596868FC0A; Thu, 14 Jun 2012 11:17:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EBHtIY090747; Thu, 14 Jun 2012 11:17:55 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EBHtD7090745; Thu, 14 Jun 2012 11:17:55 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201206141117.q5EBHtD7090745@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 14 Jun 2012 11:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237057 - head/sys/geom/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 11:17:55 -0000 Author: ae Date: Thu Jun 14 11:17:54 2012 New Revision: 237057 URL: http://svn.freebsd.org/changeset/base/237057 Log: Always reconstruct partition entries in the PMBR when Boot Camp is disabled. This helps to easily recover from situations when PMBR is damaged and contains no entries. MFC after: 1 week Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Thu Jun 14 10:48:41 2012 (r237056) +++ head/sys/geom/part/g_part_gpt.c Thu Jun 14 11:17:54 2012 (r237057) @@ -341,9 +341,6 @@ gpt_update_bootcamp(struct g_part_table disable: table->bootcamp = 0; - bzero(table->mbr + DOSPARTOFF, DOSPARTSIZE * NDOSPART); - gpt_write_mbr_entry(table->mbr, 0, 0xee, 1ull, - MIN(table->lba[GPT_ELT_SECHDR], UINT32_MAX)); } static struct gpt_hdr * @@ -589,10 +586,6 @@ g_part_gpt_bootcode(struct g_part_table codesz = MIN(codesz, gpp->gpp_codesize); if (codesz > 0) bcopy(gpp->gpp_codeptr, table->mbr, codesz); - - /* Mark the PMBR active since some BIOS require it. */ - if (!table->bootcamp) - table->mbr[DOSPARTOFF] = 0x80; /* status */ return (0); } @@ -601,7 +594,6 @@ g_part_gpt_create(struct g_part_table *b { struct g_provider *pp; struct g_part_gpt_table *table; - quad_t last; size_t tblsz; /* We don't nest, which means that our depth should be 0. */ @@ -617,11 +609,6 @@ g_part_gpt_create(struct g_part_table *b pp->sectorsize) return (ENOSPC); - last = (pp->mediasize / pp->sectorsize) - 1; - - le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC); - gpt_write_mbr_entry(table->mbr, 0, 0xee, 1, MIN(last, UINT32_MAX)); - /* Allocate space for the header */ table->hdr = g_malloc(sizeof(struct gpt_hdr), M_WAITOK | M_ZERO); @@ -1047,6 +1034,16 @@ g_part_gpt_write(struct g_part_table *ba if (table->bootcamp) gpt_update_bootcamp(basetable); + /* Update partition entries in the PMBR if Boot Camp disabled. */ + if (!table->bootcamp) { + bzero(table->mbr + DOSPARTOFF, DOSPARTSIZE * NDOSPART); + gpt_write_mbr_entry(table->mbr, 0, 0xee, 1, + MIN(pp->mediasize / pp->sectorsize - 1, UINT32_MAX)); + /* Mark the PMBR active since some BIOS require it. */ + table->mbr[DOSPARTOFF] = 0x80; + } + le16enc(table->mbr + DOSMAGICOFFSET, DOSMAGIC); + /* Write the PMBR */ buf = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); bcopy(table->mbr, buf, MBRSIZE); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 11:20:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8248A106566C; Thu, 14 Jun 2012 11:20:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 6E1F48FC08; Thu, 14 Jun 2012 11:20:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EBKN7M090891; Thu, 14 Jun 2012 11:20:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EBKNs0090889; Thu, 14 Jun 2012 11:20:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206141120.q5EBKNs0090889@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 14 Jun 2012 11:20:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237058 - head/libexec/rtld-elf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 11:20:23 -0000 Author: kib Date: Thu Jun 14 11:20:22 2012 New Revision: 237058 URL: http://svn.freebsd.org/changeset/base/237058 Log: Eliminate the static buffer used to read the first page of the mapped object, and eliminate the pread(2) call as well [1]. Mmap the first page of the object temporaly, and unmap it on error or last use. Potentially, this leaves one-page gap between succeeding dlopen(3), but there are other mmap(2) consumers as well. Fix several cases were the whole mapping of the object leaked on error. Use MAP_PREFAULT_READ for mmap(2) calls which map real object pages [2]. Insipired by the patch by: Ian Lepore [1] Suggested by: alc [2] MFC after: 2 weeks Modified: head/libexec/rtld-elf/map_object.c Modified: head/libexec/rtld-elf/map_object.c ============================================================================== --- head/libexec/rtld-elf/map_object.c Thu Jun 14 11:17:54 2012 (r237057) +++ head/libexec/rtld-elf/map_object.c Thu Jun 14 11:20:22 2012 (r237058) @@ -38,7 +38,7 @@ #include "debug.h" #include "rtld.h" -static Elf_Ehdr *get_elf_header (int, const char *); +static Elf_Ehdr *get_elf_header(int, const char *); static int convert_prot(int); /* Elf flags -> mmap protection */ static int convert_flags(int); /* Elf flags -> mmap flags */ @@ -121,7 +121,7 @@ map_object(int fd, const char *path, con if ((segs[nsegs]->p_align & (PAGE_SIZE - 1)) != 0) { _rtld_error("%s: PT_LOAD segment %d not page-aligned", path, nsegs); - return NULL; + goto error; } break; @@ -161,12 +161,12 @@ map_object(int fd, const char *path, con } if (phdyn == NULL) { _rtld_error("%s: object is not dynamically-linked", path); - return NULL; + goto error; } if (nsegs < 0) { _rtld_error("%s: too few PT_LOAD segments", path); - return NULL; + goto error; } /* @@ -183,13 +183,12 @@ map_object(int fd, const char *path, con if (mapbase == (caddr_t) -1) { _rtld_error("%s: mmap of entire address space failed: %s", path, rtld_strerror(errno)); - return NULL; + goto error; } if (base_addr != NULL && mapbase != base_addr) { _rtld_error("%s: mmap returned wrong address: wanted %p, got %p", path, base_addr, mapbase); - munmap(mapbase, mapsize); - return NULL; + goto error1; } for (i = 0; i <= nsegs; i++) { @@ -201,10 +200,10 @@ map_object(int fd, const char *path, con data_prot = convert_prot(segs[i]->p_flags); data_flags = convert_flags(segs[i]->p_flags) | MAP_FIXED; if (mmap(data_addr, data_vlimit - data_vaddr, data_prot, - data_flags, fd, data_offset) == (caddr_t) -1) { + data_flags | MAP_PREFAULT_READ, fd, data_offset) == (caddr_t) -1) { _rtld_error("%s: mmap of data failed: %s", path, rtld_strerror(errno)); - return NULL; + goto error1; } /* Do BSS setup */ @@ -221,7 +220,7 @@ map_object(int fd, const char *path, con mprotect(clear_page, PAGE_SIZE, data_prot|PROT_WRITE)) { _rtld_error("%s: mprotect failed: %s", path, rtld_strerror(errno)); - return NULL; + goto error1; } memset(clear_addr, 0, nclear); @@ -240,7 +239,7 @@ map_object(int fd, const char *path, con data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) { _rtld_error("%s: mmap of bss failed: %s", path, rtld_strerror(errno)); - return NULL; + goto error1; } } } @@ -273,7 +272,7 @@ map_object(int fd, const char *path, con if (obj->phdr == NULL) { obj_free(obj); _rtld_error("%s: cannot allocate program header", path); - return NULL; + goto error1; } memcpy((char *)obj->phdr, (char *)hdr + hdr->e_phoff, phsize); obj->phdr_alloc = true; @@ -293,63 +292,72 @@ map_object(int fd, const char *path, con obj->relro_page = obj->relocbase + trunc_page(relro_page); obj->relro_size = round_page(relro_size); - return obj; + munmap(hdr, PAGE_SIZE); + return (obj); + +error1: + munmap(mapbase, mapsize); +error: + munmap(hdr, PAGE_SIZE); + return (NULL); } static Elf_Ehdr * -get_elf_header (int fd, const char *path) +get_elf_header(int fd, const char *path) { - static union { - Elf_Ehdr hdr; - char buf[PAGE_SIZE]; - } u; - ssize_t nbytes; - - if ((nbytes = pread(fd, u.buf, PAGE_SIZE, 0)) == -1) { - _rtld_error("%s: read error: %s", path, rtld_strerror(errno)); - return NULL; - } - - /* Make sure the file is valid */ - if (nbytes < (ssize_t)sizeof(Elf_Ehdr) || !IS_ELF(u.hdr)) { - _rtld_error("%s: invalid file format", path); - return NULL; - } - if (u.hdr.e_ident[EI_CLASS] != ELF_TARG_CLASS - || u.hdr.e_ident[EI_DATA] != ELF_TARG_DATA) { - _rtld_error("%s: unsupported file layout", path); - return NULL; - } - if (u.hdr.e_ident[EI_VERSION] != EV_CURRENT - || u.hdr.e_version != EV_CURRENT) { - _rtld_error("%s: unsupported file version", path); - return NULL; - } - if (u.hdr.e_type != ET_EXEC && u.hdr.e_type != ET_DYN) { - _rtld_error("%s: unsupported file type", path); - return NULL; - } - if (u.hdr.e_machine != ELF_TARG_MACH) { - _rtld_error("%s: unsupported machine", path); - return NULL; - } + Elf_Ehdr *hdr; - /* - * We rely on the program header being in the first page. This is - * not strictly required by the ABI specification, but it seems to - * always true in practice. And, it simplifies things considerably. - */ - if (u.hdr.e_phentsize != sizeof(Elf_Phdr)) { - _rtld_error( - "%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", path); - return NULL; - } - if (u.hdr.e_phoff + u.hdr.e_phnum * sizeof(Elf_Phdr) > (size_t)nbytes) { - _rtld_error("%s: program header too large", path); - return NULL; - } + hdr = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_PREFAULT_READ, + fd, 0); + if (hdr == (Elf_Ehdr *)MAP_FAILED) { + _rtld_error("%s: read error: %s", path, rtld_strerror(errno)); + return (NULL); + } + + /* Make sure the file is valid */ + if (!IS_ELF(*hdr)) { + _rtld_error("%s: invalid file format", path); + goto error; + } + if (hdr->e_ident[EI_CLASS] != ELF_TARG_CLASS || + hdr->e_ident[EI_DATA] != ELF_TARG_DATA) { + _rtld_error("%s: unsupported file layout", path); + goto error; + } + if (hdr->e_ident[EI_VERSION] != EV_CURRENT || + hdr->e_version != EV_CURRENT) { + _rtld_error("%s: unsupported file version", path); + goto error; + } + if (hdr->e_type != ET_EXEC && hdr->e_type != ET_DYN) { + _rtld_error("%s: unsupported file type", path); + goto error; + } + if (hdr->e_machine != ELF_TARG_MACH) { + _rtld_error("%s: unsupported machine", path); + goto error; + } - return (&u.hdr); + /* + * We rely on the program header being in the first page. This is + * not strictly required by the ABI specification, but it seems to + * always true in practice. And, it simplifies things considerably. + */ + if (hdr->e_phentsize != sizeof(Elf_Phdr)) { + _rtld_error( + "%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", path); + goto error; + } + if (hdr->e_phoff + hdr->e_phnum * sizeof(Elf_Phdr) > + (size_t)PAGE_SIZE) { + _rtld_error("%s: program header too large", path); + goto error; + } + return (hdr); + +error: + munmap(hdr, PAGE_SIZE); + return (NULL); } void From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 11:21:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 35BF81065675; Thu, 14 Jun 2012 11:21:22 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 207628FC1F; Thu, 14 Jun 2012 11:21:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EBLLCi090971; Thu, 14 Jun 2012 11:21:21 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EBLLZ3090968; Thu, 14 Jun 2012 11:21:21 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201206141121.q5EBLLZ3090968@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 14 Jun 2012 11:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237059 - stable/8/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 11:21:22 -0000 Author: pluknet Date: Thu Jun 14 11:21:21 2012 New Revision: 237059 URL: http://svn.freebsd.org/changeset/base/237059 Log: MFC r234188,r234463,r234465: - Update the swi_add prototype after struct ithd was split up into struct intr_event and struct intr_thread. [1] - Update the rest of struct ithd references. - net_ih and softclock_ih cookies have gone away. - Document swi_remove(9). PR: docs/166864 [1] Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/swi.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Thu Jun 14 11:20:22 2012 (r237058) +++ stable/8/share/man/man9/Makefile Thu Jun 14 11:21:21 2012 (r237059) @@ -1206,6 +1206,7 @@ MLINKS+=store.9 subyte.9 \ store.9 suword32.9 \ store.9 suword64.9 MLINKS+=swi.9 swi_add.9 \ + swi.9 swi_remove.9 \ swi.9 swi_sched.9 MLINKS+=sx.9 sx_assert.9 \ sx.9 sx_destroy.9 \ Modified: stable/8/share/man/man9/swi.9 ============================================================================== --- stable/8/share/man/man9/swi.9 Thu Jun 14 11:20:22 2012 (r237058) +++ stable/8/share/man/man9/swi.9 Thu Jun 14 11:21:21 2012 (r237059) @@ -24,25 +24,24 @@ .\" .\" $FreeBSD$ .\" -.Dd October 30, 2000 +.Dd April 19, 2012 .Dt SWI 9 .Os .Sh NAME .Nm swi_add , +.Nm swi_remove , .Nm swi_sched .Nd register and schedule software interrupt handlers .Sh SYNOPSIS .In sys/param.h .In sys/bus.h .In sys/interrupt.h -.Vt "extern struct ithd *tty_ithd" ; -.Vt "extern struct ithd *clk_ithd" ; -.Vt "extern void *net_ih" ; -.Vt "extern void *softclock_ih" ; +.Vt "extern struct intr_event *tty_intr_event" ; +.Vt "extern struct intr_event *clk_intr_event" ; .Vt "extern void *vm_ih" ; .Ft int .Fo swi_add -.Fa "struct ithd **ithdp" +.Fa "struct intr_event **eventp" .Fa "const char *name" .Fa "driver_intr_t handler" .Fa "void *arg" @@ -50,6 +49,8 @@ .Fa "enum intr_type flags" .Fa "void **cookiep" .Fc +.Ft int +.Fn swi_remove "void *cookie" .Ft void .Fn swi_sched "void *cookie" "int flags" .Sh DESCRIPTION @@ -67,20 +68,21 @@ time, and that they can be run via a lig .Pp The .Fn swi_add -function is used to register a new software interrupt handler. +function is used to add a new software interrupt handler to a specified +interrupt event. The -.Fa ithdp +.Fa eventp argument is an optional pointer to a -.Vt struct ithd +.Vt struct intr_event pointer. -If this argument points to an existing software interrupt thread, then this -handler will be attached to that thread. -Otherwise a new thread will be created, and if -.Fa ithdp +If this argument points to an existing event that holds a list of +interrupt handlers, then this handler will be attached to that event. +Otherwise a new event will be created, and if +.Fa eventp is not .Dv NULL , then the pointer at that address to will be modified to point to the -newly created thread. +newly created event. The .Fa name argument is used to associate a name with a specific handler. @@ -99,7 +101,7 @@ The .Fa pri value specifies the priority of this interrupt handler relative to other software interrupt handlers. -If an interrupt thread is created, then this value is used as the vector, +If an interrupt event is created, then this value is used as the vector, and the .Fa flags argument is used to specify the attributes of a handler such as @@ -113,6 +115,14 @@ This cookie will be set to a value that and is used to schedule the handler for execution later on. .Pp The +.Fn swi_remove +function is used to teardown an interrupt handler pointed to by the +.Fa cookie +argument. +It detaches the interrupt handler from the associated interrupt event +and frees its memory. +.Pp +The .Fn swi_sched function is used to schedule an interrupt handler and its associated thread to run. @@ -140,30 +150,29 @@ in earlier versions of .El .Pp The -.Va tty_ithd +.Va tty_intr_event and -.Va clk_ithd -variables contain pointers to the software interrupt threads for the tty and +.Va clk_intr_event +variables contain pointers to the software interrupt handlers for the tty and clock software interrupts, respectively. -.Va tty_ithd +.Va tty_intr_event is used to hang tty software interrupt handlers off of the same thread. -.Va clk_ithd +.Va clk_intr_event is used to hang delayed handlers off of the clock software interrupt thread so that the functionality of .Fn setdelayed can be obtained in conjunction with .Dv SWI_DELAY . The -.Va net_ih , -.Va softclock_ih , -and .Va vm_ih -handler cookies are used to schedule software interrupt threads to run for the -networking stack, clock interrupt, and VM subsystem respectively. +handler cookie is used to schedule software interrupt threads to run for the +VM subsystem. .Sh RETURN VALUES The .Fn swi_add -function returns zero on success and non-zero on failure. +and +.Fn swi_remove +functions return zero on success and non-zero on failure. .Sh ERRORS The .Fn swi_add @@ -185,7 +194,7 @@ or .Dv INTR_FAST . .It Bq Er EINVAL The -.Fa ithdp +.Fa eventp argument points to a hardware interrupt thread. .It Bq Er EINVAL Either of the @@ -197,11 +206,22 @@ arguments are .It Bq Er EINVAL The .Dv INTR_EXCL -flag is specified and the interrupt thread pointed to by -.Fa ithdp -already has at least one handler, or the interrupt thread already has an +flag is specified and the interrupt event pointed to by +.Fa eventp +already has at least one handler, or the interrupt event already has an exclusive handler. .El +.Pp +The +.Fn swi_remove +function will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +A software interrupt handler pointed to by +.Fa cookie +is +.Dv NULL . +.El .Sh SEE ALSO .Xr ithread 9 , .Xr taskqueue 9 @@ -222,6 +242,10 @@ and .Fn schedsoft* functions which date back to at least .Bx 4.4 . +The +.Fn swi_remove +function first appeared in +.Fx 6.1 . .Sh BUGS Most of the global variables described in this manual page should not be global, or at the very least should not be declared in From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 11:39:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7AF7106566B; Thu, 14 Jun 2012 11:39:43 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B27688FC0C; Thu, 14 Jun 2012 11:39:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EBdhgp091836; Thu, 14 Jun 2012 11:39:43 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EBdhdd091833; Thu, 14 Jun 2012 11:39:43 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201206141139.q5EBdhdd091833@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 14 Jun 2012 11:39:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237060 - stable/7/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 11:39:43 -0000 Author: pluknet Date: Thu Jun 14 11:39:43 2012 New Revision: 237060 URL: http://svn.freebsd.org/changeset/base/237060 Log: MFC r234188, r234463, r234465 (partially, except softclock_ih): - Update the swi_add prototype after struct ithd was split up into struct intr_event and struct intr_thread. [1] - Update the rest of struct ithd references. - net_ih cookie has gone away. - Document swi_remove(9). PR: docs/166864 [1] Modified: stable/7/share/man/man9/Makefile stable/7/share/man/man9/swi.9 Directory Properties: stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man9/Makefile ============================================================================== --- stable/7/share/man/man9/Makefile Thu Jun 14 11:21:21 2012 (r237059) +++ stable/7/share/man/man9/Makefile Thu Jun 14 11:39:43 2012 (r237060) @@ -1096,6 +1096,7 @@ MLINKS+=store.9 subyte.9 \ store.9 suword.9 MLINKS+=suser.9 suser_cred.9 MLINKS+=swi.9 swi_add.9 \ + swi.9 swi_remove.9 \ swi.9 swi_sched.9 MLINKS+=sx.9 sx_assert.9 \ sx.9 sx_destroy.9 \ Modified: stable/7/share/man/man9/swi.9 ============================================================================== --- stable/7/share/man/man9/swi.9 Thu Jun 14 11:21:21 2012 (r237059) +++ stable/7/share/man/man9/swi.9 Thu Jun 14 11:39:43 2012 (r237060) @@ -24,25 +24,25 @@ .\" .\" $FreeBSD$ .\" -.Dd October 30, 2000 +.Dd April 19, 2012 .Dt SWI 9 .Os .Sh NAME .Nm swi_add , +.Nm swi_remove , .Nm swi_sched .Nd register and schedule software interrupt handlers .Sh SYNOPSIS .In sys/param.h .In sys/bus.h .In sys/interrupt.h -.Vt "extern struct ithd *tty_ithd" ; -.Vt "extern struct ithd *clk_ithd" ; -.Vt "extern void *net_ih" ; +.Vt "extern struct intr_event *tty_intr_event" ; +.Vt "extern struct intr_event *clk_intr_event" ; .Vt "extern void *softclock_ih" ; .Vt "extern void *vm_ih" ; .Ft int .Fo swi_add -.Fa "struct ithd **ithdp" +.Fa "struct intr_event **eventp" .Fa "const char *name" .Fa "driver_intr_t handler" .Fa "void *arg" @@ -50,6 +50,8 @@ .Fa "enum intr_type flags" .Fa "void **cookiep" .Fc +.Ft int +.Fn swi_remove "void *cookie" .Ft void .Fn swi_sched "void *cookie" "int flags" .Sh DESCRIPTION @@ -67,20 +69,21 @@ time, and that they can be run via a lig .Pp The .Fn swi_add -function is used to register a new software interrupt handler. +function is used to add a new software interrupt handler to a specified +interrupt event. The -.Fa ithdp +.Fa eventp argument is an optional pointer to a -.Vt struct ithd +.Vt struct intr_event pointer. -If this argument points to an existing software interrupt thread, then this -handler will be attached to that thread. -Otherwise a new thread will be created, and if -.Fa ithdp +If this argument points to an existing event that holds a list of +interrupt handlers, then this handler will be attached to that event. +Otherwise a new event will be created, and if +.Fa eventp is not .Dv NULL , then the pointer at that address to will be modified to point to the -newly created thread. +newly created event. The .Fa name argument is used to associate a name with a specific handler. @@ -99,7 +102,7 @@ The .Fa pri value specifies the priority of this interrupt handler relative to other software interrupt handlers. -If an interrupt thread is created, then this value is used as the vector, +If an interrupt event is created, then this value is used as the vector, and the .Fa flags argument is used to specify the attributes of a handler such as @@ -113,6 +116,14 @@ This cookie will be set to a value that and is used to schedule the handler for execution later on. .Pp The +.Fn swi_remove +function is used to teardown an interrupt handler pointed to by the +.Fa cookie +argument. +It detaches the interrupt handler from the associated interrupt event +and frees its memory. +.Pp +The .Fn swi_sched function is used to schedule an interrupt handler and its associated thread to run. @@ -140,30 +151,31 @@ in earlier versions of .El .Pp The -.Va tty_ithd +.Va tty_intr_event and -.Va clk_ithd -variables contain pointers to the software interrupt threads for the tty and +.Va clk_intr_event +variables contain pointers to the software interrupt handlers for the tty and clock software interrupts, respectively. -.Va tty_ithd +.Va tty_intr_event is used to hang tty software interrupt handlers off of the same thread. -.Va clk_ithd +.Va clk_intr_event is used to hang delayed handlers off of the clock software interrupt thread so that the functionality of .Fn setdelayed can be obtained in conjunction with .Dv SWI_DELAY . The -.Va net_ih , -.Va softclock_ih , +.Va softclock_ih and .Va vm_ih handler cookies are used to schedule software interrupt threads to run for the -networking stack, clock interrupt, and VM subsystem respectively. +clock interrupt and VM subsystem respectively. .Sh RETURN VALUES The .Fn swi_add -function returns zero on success and non-zero on failure. +and +.Fn swi_remove +functions return zero on success and non-zero on failure. .Sh ERRORS The .Fn swi_add @@ -185,7 +197,7 @@ or .Dv INTR_FAST . .It Bq Er EINVAL The -.Fa ithdp +.Fa eventp argument points to a hardware interrupt thread. .It Bq Er EINVAL Either of the @@ -197,11 +209,22 @@ arguments are .It Bq Er EINVAL The .Dv INTR_EXCL -flag is specified and the interrupt thread pointed to by -.Fa ithdp -already has at least one handler, or the interrupt thread already has an +flag is specified and the interrupt event pointed to by +.Fa eventp +already has at least one handler, or the interrupt event already has an exclusive handler. .El +.Pp +The +.Fn swi_remove +function will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +A software interrupt handler pointed to by +.Fa cookie +is +.Dv NULL . +.El .Sh SEE ALSO .Xr ithread 9 , .Xr taskqueue 9 @@ -222,6 +245,10 @@ and .Fn schedsoft* functions which date back to at least .Bx 4.4 . +The +.Fn swi_remove +function first appeared in +.Fx 6.1 . .Sh BUGS Most of the global variables described in this manual page should not be global, or at the very least should not be declared in From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 12:28:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61FC41065670; Thu, 14 Jun 2012 12:28:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 4D7F98FC0C; Thu, 14 Jun 2012 12:28:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ECSipf094055; Thu, 14 Jun 2012 12:28:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ECSimn094053; Thu, 14 Jun 2012 12:28:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206141228.q5ECSimn094053@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 14 Jun 2012 12:28:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237061 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 12:28:44 -0000 Author: kib Date: Thu Jun 14 12:28:43 2012 New Revision: 237061 URL: http://svn.freebsd.org/changeset/base/237061 Log: Make sure that fstab fd is not leaked on exec. PR: kern/169023 Submitted by: Jukka Ukkonen MFC after: 1 week Modified: head/lib/libc/gen/fstab.c Modified: head/lib/libc/gen/fstab.c ============================================================================== --- head/lib/libc/gen/fstab.c Thu Jun 14 11:39:43 2012 (r237060) +++ head/lib/libc/gen/fstab.c Thu Jun 14 12:28:43 2012 (r237061) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -246,6 +247,8 @@ getfsfile(name) int setfsent() { + int fd; + if (_fs_fp) { rewind(_fs_fp); LineNo = 0; @@ -257,11 +260,18 @@ setfsent() else setfstab(getenv("PATH_FSTAB")); } - if ((_fs_fp = fopen(path_fstab, "r")) != NULL) { + fd = _open(path_fstab, O_RDONLY | O_CLOEXEC); + if (fd == -1) { + error(errno); + return (0); + } + _fs_fp = fdopen(fd, "r"); + if (_fs_fp != NULL) { LineNo = 0; return(1); } error(errno); + _close(fd); return(0); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 12:37:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6558C106566C; Thu, 14 Jun 2012 12:37:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 506528FC12; Thu, 14 Jun 2012 12:37:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ECbg99094522; Thu, 14 Jun 2012 12:37:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ECbgVX094520; Thu, 14 Jun 2012 12:37:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141237.q5ECbgVX094520@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 12:37:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237063 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 12:37:43 -0000 Author: pjd Date: Thu Jun 14 12:37:41 2012 New Revision: 237063 URL: http://svn.freebsd.org/changeset/base/237063 Log: Style. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 12:31:50 2012 (r237062) +++ head/sys/kern/kern_descrip.c Thu Jun 14 12:37:41 2012 (r237063) @@ -686,7 +686,7 @@ kern_fcntl(struct thread *td, int fd, in flp->l_type = F_UNLCK; vfslocked = VFS_LOCK_GIANT(vp->v_mount); (void) VOP_ADVLOCK(vp, (caddr_t)p->p_leader, - F_UNLCK, flp, F_POSIX); + F_UNLCK, flp, F_POSIX); VFS_UNLOCK_GIANT(vfslocked); vfslocked = 0; } else @@ -1370,6 +1370,7 @@ sys_fpathconf(struct thread *td, struct vp = fp->f_vnode; if (vp != NULL) { int vfslocked; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_PATHCONF(vp, uap->name, td->td_retval); @@ -1380,7 +1381,7 @@ sys_fpathconf(struct thread *td, struct error = EINVAL; } else { td->td_retval[0] = PIPE_BUF; - error = 0; + error = 0; } } else { error = EOPNOTSUPP; @@ -1834,11 +1835,8 @@ fdfree(struct thread *td) vp = fp->f_vnode; locked = VFS_LOCK_GIANT(vp->v_mount); (void) VOP_ADVLOCK(vp, - (caddr_t)td->td_proc-> - p_leader, - F_UNLCK, - &lf, - F_POSIX); + (caddr_t)td->td_proc->p_leader, F_UNLCK, + &lf, F_POSIX); VFS_UNLOCK_GIANT(locked); FILEDESC_XLOCK(fdp); fdrop(fp, td); @@ -2027,6 +2025,7 @@ void fdcloseexec(struct thread *td) { struct filedesc *fdp; + struct file *fp; int i; /* Certain daemons might not have file descriptors. */ @@ -2034,27 +2033,23 @@ fdcloseexec(struct thread *td) if (fdp == NULL) return; - FILEDESC_XLOCK(fdp); - /* * We cannot cache fd_ofiles or fd_ofileflags since operations * may block and rip them out from under us. */ + FILEDESC_XLOCK(fdp); for (i = 0; i <= fdp->fd_lastfile; i++) { - if (fdp->fd_ofiles[i] != NULL && - (fdp->fd_ofiles[i]->f_type == DTYPE_MQUEUE || + fp = fdp->fd_ofiles[i]; + if (fp != NULL && (fp->f_type == DTYPE_MQUEUE || (fdp->fd_ofileflags[i] & UF_EXCLOSE))) { - struct file *fp; - - knote_fdclose(td, i); /* * NULL-out descriptor prior to close to avoid * a race while close blocks. */ - fp = fdp->fd_ofiles[i]; fdp->fd_ofiles[i] = NULL; fdp->fd_ofileflags[i] = 0; fdunused(fdp, i); + knote_fdclose(td, i); if (fp->f_type == DTYPE_MQUEUE) mq_fdclose(td, i, fp); FILEDESC_XUNLOCK(fdp); @@ -2139,7 +2134,7 @@ closef(struct file *fp, struct thread *t * node, not the capability itself. */ (void)cap_funwrap(fp, 0, &fp_object); - if ((fp_object->f_type == DTYPE_VNODE) && (td != NULL)) { + if (fp_object->f_type == DTYPE_VNODE && td != NULL) { int vfslocked; vp = fp_object->f_vnode; @@ -2150,7 +2145,7 @@ closef(struct file *fp, struct thread *t lf.l_len = 0; lf.l_type = F_UNLCK; (void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc->p_leader, - F_UNLCK, &lf, F_POSIX); + F_UNLCK, &lf, F_POSIX); } fdtol = td->td_proc->p_fdtol; if (fdtol != NULL) { @@ -2174,8 +2169,8 @@ closef(struct file *fp, struct thread *t lf.l_type = F_UNLCK; vp = fp_object->f_vnode; (void) VOP_ADVLOCK(vp, - (caddr_t)fdtol->fdl_leader, - F_UNLCK, &lf, F_POSIX); + (caddr_t)fdtol->fdl_leader, F_UNLCK, &lf, + F_POSIX); FILEDESC_XLOCK(fdp); fdtol->fdl_holdcount--; if (fdtol->fdl_holdcount == 0 && From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 12:41:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1B804106564A; Thu, 14 Jun 2012 12:41:22 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 06CB38FC14; Thu, 14 Jun 2012 12:41:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ECfLWx094754; Thu, 14 Jun 2012 12:41:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ECfL3g094752; Thu, 14 Jun 2012 12:41:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141241.q5ECfL3g094752@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 12:41:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237065 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 12:41:22 -0000 Author: pjd Date: Thu Jun 14 12:41:21 2012 New Revision: 237065 URL: http://svn.freebsd.org/changeset/base/237065 Log: When we are closing capabilities during exec, we want to call mq_fdclose() on the underlying object and not on the capability itself. Similar bug was fixed in r236853. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 12:38:51 2012 (r237064) +++ head/sys/kern/kern_descrip.c Thu Jun 14 12:41:21 2012 (r237065) @@ -2025,7 +2025,7 @@ void fdcloseexec(struct thread *td) { struct filedesc *fdp; - struct file *fp; + struct file *fp, *fp_object; int i; /* Certain daemons might not have file descriptors. */ @@ -2050,8 +2050,14 @@ fdcloseexec(struct thread *td) fdp->fd_ofileflags[i] = 0; fdunused(fdp, i); knote_fdclose(td, i); - if (fp->f_type == DTYPE_MQUEUE) - mq_fdclose(td, i, fp); + /* + * When we're closing an fd with a capability, we need + * to notify mqueue if the underlying object is of type + * mqueue. + */ + (void)cap_funwrap(fp, 0, &fp_object); + if (fp_object->f_type == DTYPE_MQUEUE) + mq_fdclose(td, i, fp_object); FILEDESC_XUNLOCK(fdp); (void) closef(fp, td); FILEDESC_XLOCK(fdp); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 12:43:38 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 15641106566B; Thu, 14 Jun 2012 12:43:38 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id EA9D78FC15; Thu, 14 Jun 2012 12:43:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EChbWi094883; Thu, 14 Jun 2012 12:43:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EChbew094881; Thu, 14 Jun 2012 12:43:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141243.q5EChbew094881@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 12:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237066 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 12:43:38 -0000 Author: pjd Date: Thu Jun 14 12:43:37 2012 New Revision: 237066 URL: http://svn.freebsd.org/changeset/base/237066 Log: Remove code duplication from fdclosexec(), which was the reason of the bug fixed in r237065. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 12:41:21 2012 (r237065) +++ head/sys/kern/kern_descrip.c Thu Jun 14 12:43:37 2012 (r237066) @@ -115,7 +115,7 @@ static uma_zone_t file_zone; #define DUP_FCNTL 0x2 /* fcntl()-style errors */ static int closefp(struct filedesc *fdp, int fd, struct file *fp, - struct thread *td); + struct thread *td, int holdleaders); static int do_dup(struct thread *td, int flags, int old, int new, register_t *retval); static int fd_first_free(struct filedesc *, int, int); @@ -885,7 +885,7 @@ do_dup(struct thread *td, int flags, int *retval = new; if (delfp != NULL) { - (void) closefp(fdp, new, delfp, td); + (void) closefp(fdp, new, delfp, td, 1); /* closefp() drops the FILEDESC lock for us. */ } else { FILEDESC_XUNLOCK(fdp); @@ -1117,22 +1117,24 @@ fgetown(sigiop) * Function drops the filedesc lock on return. */ static int -closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td) +closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td, + int holdleaders) { struct file *fp_object; - int error, holdleaders; + int error; FILEDESC_XLOCK_ASSERT(fdp); - if (td->td_proc->p_fdtol != NULL) { - /* - * Ask fdfree() to sleep to ensure that all relevant - * process leaders can be traversed in closef(). - */ - fdp->fd_holdleaderscount++; - holdleaders = 1; - } else { - holdleaders = 0; + if (holdleaders) { + if (td->td_proc->p_fdtol != NULL) { + /* + * Ask fdfree() to sleep to ensure that all relevant + * process leaders can be traversed in closef(). + */ + fdp->fd_holdleaderscount++; + } else { + holdleaders = 0; + } } /* @@ -1207,7 +1209,7 @@ kern_close(td, fd) fdunused(fdp, fd); /* closefp() drops the FILEDESC lock for us. */ - return (closefp(fdp, fd, fp, td)); + return (closefp(fdp, fd, fp, td, 1)); } /* @@ -2025,7 +2027,7 @@ void fdcloseexec(struct thread *td) { struct filedesc *fdp; - struct file *fp, *fp_object; + struct file *fp; int i; /* Certain daemons might not have file descriptors. */ @@ -2042,24 +2044,11 @@ fdcloseexec(struct thread *td) fp = fdp->fd_ofiles[i]; if (fp != NULL && (fp->f_type == DTYPE_MQUEUE || (fdp->fd_ofileflags[i] & UF_EXCLOSE))) { - /* - * NULL-out descriptor prior to close to avoid - * a race while close blocks. - */ fdp->fd_ofiles[i] = NULL; fdp->fd_ofileflags[i] = 0; fdunused(fdp, i); - knote_fdclose(td, i); - /* - * When we're closing an fd with a capability, we need - * to notify mqueue if the underlying object is of type - * mqueue. - */ - (void)cap_funwrap(fp, 0, &fp_object); - if (fp_object->f_type == DTYPE_MQUEUE) - mq_fdclose(td, i, fp_object); - FILEDESC_XUNLOCK(fdp); - (void) closef(fp, td); + (void) closefp(fdp, i, fp, td, 0); + /* closefp() drops the FILEDESC lock. */ FILEDESC_XLOCK(fdp); } } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 14:38:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A146F106566B; Thu, 14 Jun 2012 14:38:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8CEB38FC12; Thu, 14 Jun 2012 14:38:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EEctSc000244; Thu, 14 Jun 2012 14:38:55 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EEctPq000241; Thu, 14 Jun 2012 14:38:55 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206141438.q5EEctPq000241@svn.freebsd.org> From: Warner Losh Date: Thu, 14 Jun 2012 14:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237069 - head/sys/arm/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 14:38:55 -0000 Author: imp Date: Thu Jun 14 14:38:55 2012 New Revision: 237069 URL: http://svn.freebsd.org/changeset/base/237069 Log: Defines for parsing linux ATAGs lists. Added: head/sys/arm/include/atags.h (contents, props changed) Added: head/sys/arm/include/atags.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/include/atags.h Thu Jun 14 14:38:55 2012 (r237069) @@ -0,0 +1,129 @@ +/*- + * Copyright (c) 2012 M. Warner Losh. + * 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$ + */ + +#ifndef __MACHINE_ATAGS_H__ +#define __MACHINE_ATAGS_H__ + +/* + * Linux boot ABI compatable ATAG definitions. All these structures + * assume tight packing, but since they are all uint32_t's, I've not + * bothered to do the usual alignment dance. + */ + +#define LBABI_MAX_COMMAND_LINE 1024 + +struct arm_lbabi_header +{ + uint32_t size; /* Size of this node, including header */ + uint32_t tag; /* Node type */ +}; + +#define ATAG_NONE 0x00000000 /* End of atags list */ +#define ATAG_CORE 0x54410001 /* List must start with ATAG_CORE */ +#define ATAG_MEM 0x54410002 /* Multiple ATAG_MEM nodes possible */ +#define ATAG_VIDEOTEXT 0x54410003 /* Video parameters */ +#define ATAG_RAMDISK 0x54410004 /* Describes the ramdisk parameters */ +#define ATAG_INITRD 0x54410005 /* Deprecated ramdisk -- used va not pa */ +#define ATAG_INITRD2 0x54420005 /* compressed ramdisk image */ +#define ATAG_SERIAL 0x54410006 /* 64-bits of serial number */ +#define ATAG_REVISION 0x54410007 /* Board revision */ +#define ATAG_VIDEOLFB 0x54410008 /* vesafb framebuffer */ +#define ATAG_CMDLINE 0x54410009 /* Command line */ + +/* + * ATAG_CORE data + */ +struct arm_lbabi_core +{ + uint32_t flags; /* bit 0 == read-only */ + uint32_t pagesize; + uint32_t rootdev; +}; + +/* + * ATAG_MEM data -- Can be more than one to describe different + * banks. + */ +struct arm_lbabi_mem32 +{ + uint32_t size; + uint32_t start; /* start of physical memory */ +}; + +/* + * ATAG_INITRD2 - Compressed ramdisk image details + */ +struct arm_lbabi_initrd +{ + uint32_t start; /* pa of start */ + uint32_t size; /* How big the ram disk is */ +}; + +/* + * ATAG_SERIAL - serial number + */ +struct arm_lbabi_serial_number +{ + uint32_t low; + uint32_t high; +}; + +/* + * ATAG_REVISION - board revision + */ +struct arm_lbabi_revision +{ + uint32_t rev; +}; + +/* + * ATAG_CMDLINE - Command line from uboot + */ +struct arm_lbabi_command_line +{ + char command[1]; /* Minimum command length */ +}; + +struct arm_lbabi_tag +{ + struct arm_lbabi_header tag_hdr; + union { + struct arm_lbabi_core tag_core; + struct arm_lbabi_mem32 tag_mem; + struct arm_lbabi_initrd tag_initrd; + struct arm_lbabi_serial_number tag_sn; + struct arm_lbabi_revision tag_rev; + struct arm_lbabi_command_line tag_cmd; + } u; +}; + +#define ATAG_TAG(a) (a)->tag_hdr.tag +#define ATAG_SIZE(a) (a)->tag_hdr.size +#define ATAG_NEXT(a) (struct arm_lbabi_tag *)((char *)(a) + ATAG_SIZE(a)) + +#endif /* __MACHINE_ATAGS_H__ */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 15:21:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E3DA1065672; Thu, 14 Jun 2012 15:21:58 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 69B2C8FC1A; Thu, 14 Jun 2012 15:21:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EFLw7f002194; Thu, 14 Jun 2012 15:21:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EFLwtT002192; Thu, 14 Jun 2012 15:21:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141521.q5EFLwtT002192@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 15:21:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237070 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 15:21:58 -0000 Author: pjd Date: Thu Jun 14 15:21:57 2012 New Revision: 237070 URL: http://svn.freebsd.org/changeset/base/237070 Log: Style fixes. Reported by: bde MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 14:38:55 2012 (r237069) +++ head/sys/kern/kern_descrip.c Thu Jun 14 15:21:57 2012 (r237070) @@ -102,7 +102,7 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_FILEDESC, "filedesc", "Open file descriptor table"); static MALLOC_DEFINE(M_FILEDESC_TO_LEADER, "filedesc_to_leader", - "file desc to leader structures"); + "file desc to leader structures"); static MALLOC_DEFINE(M_SIGIO, "sigio", "sigio structures"); MALLOC_DECLARE(M_FADVISE); @@ -114,22 +114,21 @@ static uma_zone_t file_zone; #define DUP_FIXED 0x1 /* Force fixed allocation */ #define DUP_FCNTL 0x2 /* fcntl()-style errors */ -static int closefp(struct filedesc *fdp, int fd, struct file *fp, +static int closefp(struct filedesc *fdp, int fd, struct file *fp, struct thread *td, int holdleaders); -static int do_dup(struct thread *td, int flags, int old, int new, +static int do_dup(struct thread *td, int flags, int old, int new, register_t *retval); -static int fd_first_free(struct filedesc *, int, int); -static int fd_last_used(struct filedesc *, int); -static void fdgrowtable(struct filedesc *, int); -static void fdunused(struct filedesc *fdp, int fd); -static void fdused(struct filedesc *fdp, int fd); -static int fill_vnode_info(struct vnode *vp, struct kinfo_file *kif); -static int fill_socket_info(struct socket *so, struct kinfo_file *kif); -static int fill_pts_info(struct tty *tp, struct kinfo_file *kif); -static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); -static int fill_procdesc_info(struct procdesc *pdp, - struct kinfo_file *kif); -static int fill_shm_info(struct file *fp, struct kinfo_file *kif); +static int fd_first_free(struct filedesc *fdp, int low, int size); +static int fd_last_used(struct filedesc *fdp, int size); +static void fdgrowtable(struct filedesc *fdp, int nfd); +static void fdunused(struct filedesc *fdp, int fd); +static void fdused(struct filedesc *fdp, int fd); +static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); +static int fill_procdesc_info(struct procdesc *pdp, struct kinfo_file *kif); +static int fill_pts_info(struct tty *tp, struct kinfo_file *kif); +static int fill_shm_info(struct file *fp, struct kinfo_file *kif); +static int fill_socket_info(struct socket *so, struct kinfo_file *kif); +static int fill_vnode_info(struct vnode *vp, struct kinfo_file *kif); /* * A process is initially started out with NDFILE descriptors stored within @@ -183,10 +182,10 @@ struct filedesc0 { */ volatile int openfiles; /* actual number of open files */ struct mtx sigio_lock; /* mtx to protect pointers to sigio */ -void (*mq_fdclose)(struct thread *td, int fd, struct file *fp); +void (*mq_fdclose)(struct thread *td, int fd, struct file *fp); /* A mutex to protect the association between a proc and filedesc. */ -static struct mtx fdesc_mtx; +static struct mtx fdesc_mtx; /* * If low >= size, just return low. Otherwise find the first zero bit in the From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 15:23:52 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 36DC8106564A; Thu, 14 Jun 2012 15:23:52 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2221D8FC18; Thu, 14 Jun 2012 15:23:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EFNptj002318; Thu, 14 Jun 2012 15:23:51 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EFNpsh002316; Thu, 14 Jun 2012 15:23:51 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141523.q5EFNpsh002316@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 15:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237071 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 15:23:52 -0000 Author: pjd Date: Thu Jun 14 15:23:51 2012 New Revision: 237071 URL: http://svn.freebsd.org/changeset/base/237071 Log: Explicitly check if 'fd' is less than 0 instead of using cast-to-unsinged hack. MFC after: 1 month Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Thu Jun 14 15:21:57 2012 (r237070) +++ head/sys/sys/filedesc.h Thu Jun 14 15:23:51 2012 (r237071) @@ -141,7 +141,7 @@ static __inline struct file * fget_locked(struct filedesc *fdp, int fd) { - return ((unsigned int)fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]); + return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]); } #endif /* _KERNEL */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 15:24:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E13A1065674; Thu, 14 Jun 2012 15:24:46 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 69E4D8FC1F; Thu, 14 Jun 2012 15:24:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EFOkpH002394; Thu, 14 Jun 2012 15:24:46 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EFOkL0002392; Thu, 14 Jun 2012 15:24:46 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141524.q5EFOkL0002392@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 15:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237072 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 15:24:46 -0000 Author: pjd Date: Thu Jun 14 15:24:45 2012 New Revision: 237072 URL: http://svn.freebsd.org/changeset/base/237072 Log: Add FILEDESC_UNLOCK_ASSERT() macro which asserts that the filedesc is not being held by the current thread (at least exclusively). MFC after: 1 month Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Thu Jun 14 15:23:51 2012 (r237071) +++ head/sys/sys/filedesc.h Thu Jun 14 15:24:45 2012 (r237072) @@ -105,6 +105,7 @@ struct filedesc_to_leader { SX_NOTRECURSED) #define FILEDESC_XLOCK_ASSERT(fdp) sx_assert(&(fdp)->fd_sx, SX_XLOCKED | \ SX_NOTRECURSED) +#define FILEDESC_UNLOCK_ASSERT(fdp) sx_assert(&(fdp)->fd_sx, SX_UNLOCKED) struct thread; From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 15:26:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9A3791065672; Thu, 14 Jun 2012 15:26:24 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 866BE8FC14; Thu, 14 Jun 2012 15:26:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EFQO0B002508; Thu, 14 Jun 2012 15:26:24 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EFQOCR002506; Thu, 14 Jun 2012 15:26:24 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141526.q5EFQOCR002506@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 15:26:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237073 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 15:26:24 -0000 Author: pjd Date: Thu Jun 14 15:26:23 2012 New Revision: 237073 URL: http://svn.freebsd.org/changeset/base/237073 Log: Assert that the filedesc lock is not held when closef() is called. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 15:24:45 2012 (r237072) +++ head/sys/kern/kern_descrip.c Thu Jun 14 15:26:23 2012 (r237073) @@ -2112,6 +2112,9 @@ closef(struct file *fp, struct thread *t struct filedesc *fdp; struct file *fp_object; + fdp = td->td_proc->p_fd; + FILEDESC_UNLOCK_ASSERT(fdp); + /* * POSIX record locking dictates that any close releases ALL * locks owned by this process. This is handled by setting @@ -2147,7 +2150,6 @@ closef(struct file *fp, struct thread *t * Handle special case where file descriptor table is * shared between multiple process leaders. */ - fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); for (fdtol = fdtol->fdl_next; fdtol != td->td_proc->p_fdtol; From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 15:34:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 41D821065677; Thu, 14 Jun 2012 15:34:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2DC9B8FC08; Thu, 14 Jun 2012 15:34:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EFYBpn002937; Thu, 14 Jun 2012 15:34:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EFYAiW002935; Thu, 14 Jun 2012 15:34:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141534.q5EFYAiW002935@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 15:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237075 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 15:34:11 -0000 Author: pjd Date: Thu Jun 14 15:34:10 2012 New Revision: 237075 URL: http://svn.freebsd.org/changeset/base/237075 Log: Style fixes and assertions improvements. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 15:27:33 2012 (r237074) +++ head/sys/kern/kern_descrip.c Thu Jun 14 15:34:10 2012 (r237075) @@ -242,8 +242,10 @@ fd_last_used(struct filedesc *fdp, int s static int fdisused(struct filedesc *fdp, int fd) { + KASSERT(fd >= 0 && fd < fdp->fd_nfiles, ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); + return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); } @@ -255,8 +257,8 @@ fdused(struct filedesc *fdp, int fd) { FILEDESC_XLOCK_ASSERT(fdp); - KASSERT(!fdisused(fdp, fd), - ("fd already used")); + + KASSERT(!fdisused(fdp, fd), ("fd=%d is already used", fd)); fdp->fd_map[NDSLOT(fd)] |= NDBIT(fd); if (fd > fdp->fd_lastfile) @@ -273,10 +275,9 @@ fdunused(struct filedesc *fdp, int fd) { FILEDESC_XLOCK_ASSERT(fdp); - KASSERT(fdisused(fdp, fd), - ("fd is already unused")); - KASSERT(fdp->fd_ofiles[fd] == NULL, - ("fd is still in use")); + + KASSERT(fdisused(fdp, fd), ("fd=%d is already unused", fd)); + KASSERT(fdp->fd_ofiles[fd] == NULL, ("fd=%d is still in use", fd)); fdp->fd_map[NDSLOT(fd)] &= ~NDBIT(fd); if (fd < fdp->fd_freefile) From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 15:35:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECD5D106567A; Thu, 14 Jun 2012 15:35:14 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D90C28FC22; Thu, 14 Jun 2012 15:35:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EFZE1w003022; Thu, 14 Jun 2012 15:35:14 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EFZEbw003020; Thu, 14 Jun 2012 15:35:14 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141535.q5EFZEbw003020@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 15:35:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237076 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 15:35:15 -0000 Author: pjd Date: Thu Jun 14 15:35:14 2012 New Revision: 237076 URL: http://svn.freebsd.org/changeset/base/237076 Log: - Assert that the filedesc lock is being held when fdisused() is called. - Fix white spaces. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 15:34:10 2012 (r237075) +++ head/sys/kern/kern_descrip.c Thu Jun 14 15:35:14 2012 (r237076) @@ -243,8 +243,10 @@ static int fdisused(struct filedesc *fdp, int fd) { - KASSERT(fd >= 0 && fd < fdp->fd_nfiles, - ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); + FILEDESC_LOCK_ASSERT(fdp); + + KASSERT(fd >= 0 && fd < fdp->fd_nfiles, + ("file descriptor %d out of range (0, %d)", fd, fdp->fd_nfiles)); return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 15:37:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D2EC2106566C; Thu, 14 Jun 2012 15:37:15 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BEB848FC17; Thu, 14 Jun 2012 15:37:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EFbFZs003159; Thu, 14 Jun 2012 15:37:15 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EFbFHl003157; Thu, 14 Jun 2012 15:37:15 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141537.q5EFbFHl003157@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 15:37:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237077 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 15:37:15 -0000 Author: pjd Date: Thu Jun 14 15:37:15 2012 New Revision: 237077 URL: http://svn.freebsd.org/changeset/base/237077 Log: Simplify the code by making more use of the fdtofp() function. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 15:35:14 2012 (r237076) +++ head/sys/kern/kern_descrip.c Thu Jun 14 15:37:15 2012 (r237077) @@ -679,8 +679,7 @@ kern_fcntl(struct thread *td, int fd, in vfslocked = 0; /* Check for race with close */ FILEDESC_SLOCK(fdp); - if (fd < 0 || fd >= fdp->fd_nfiles || - fp != fdp->fd_ofiles[fd]) { + if (fdtofp(fd, fdp) != fp) { FILEDESC_SUNLOCK(fdp); flp->l_whence = SEEK_SET; flp->l_start = 0; @@ -822,7 +821,7 @@ do_dup(struct thread *td, int flags, int return (flags & DUP_FCNTL ? EINVAL : EBADF); FILEDESC_XLOCK(fdp); - if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL) { + if (fdtofp(old, fdp) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } @@ -1201,8 +1200,7 @@ kern_close(td, fd) AUDIT_SYSCLOSE(td, fd); FILEDESC_XLOCK(fdp); - if (fd < 0 || fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[fd]) == NULL) { + if ((fp = fdtofp(fd, fdp)) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } @@ -2596,8 +2594,7 @@ dupfdopen(struct thread *td, struct file * closed, then reject. */ FILEDESC_XLOCK(fdp); - if (dfd < 0 || dfd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[dfd]) == NULL) { + if ((fp = fdtofp(dfd, fdp)) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 15:39:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 588F51065678; Thu, 14 Jun 2012 15:39:15 +0000 (UTC) (envelope-from emax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 43CAC8FC17; Thu, 14 Jun 2012 15:39:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EFdF8r003282; Thu, 14 Jun 2012 15:39:15 GMT (envelope-from emax@svn.freebsd.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EFdFSR003280; Thu, 14 Jun 2012 15:39:15 GMT (envelope-from emax@svn.freebsd.org) Message-Id: <201206141539.q5EFdFSR003280@svn.freebsd.org> From: Maksim Yevmenkin Date: Thu, 14 Jun 2012 15:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237078 - stable/9/contrib/bsnmp/snmp_mibII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 15:39:15 -0000 Author: emax Date: Thu Jun 14 15:39:14 2012 New Revision: 237078 URL: http://svn.freebsd.org/changeset/base/237078 Log: MFC r236693 Count both IPv4 and IPv6 TCP connections in tcpCurrEstab Timeout from: current, syrinx Modified: stable/9/contrib/bsnmp/snmp_mibII/mibII_tcp.c Directory Properties: stable/9/contrib/bsnmp/ (props changed) Modified: stable/9/contrib/bsnmp/snmp_mibII/mibII_tcp.c ============================================================================== --- stable/9/contrib/bsnmp/snmp_mibII/mibII_tcp.c Thu Jun 14 15:37:15 2012 (r237077) +++ stable/9/contrib/bsnmp/snmp_mibII/mibII_tcp.c Thu Jun 14 15:39:14 2012 (r237078) @@ -109,10 +109,12 @@ fetch_tcp(void) ptr = (struct xinpgen *)(void *)((char *)ptr + ptr->xig_len)) { tp = (struct xtcpcb *)ptr; if (tp->xt_inp.inp_gencnt > xinpgen->xig_gen || - (tp->xt_inp.inp_vflag & INP_IPV4) == 0) + (tp->xt_inp.inp_vflag & (INP_IPV4|INP_IPV6)) == 0) continue; - tcp_total++; + if (tp->xt_inp.inp_vflag & INP_IPV4) + tcp_total++; + if (tp->xt_tp.t_state == TCPS_ESTABLISHED || tp->xt_tp.t_state == TCPS_CLOSE_WAIT) tcp_count++; From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 16:20:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0227A1065672; Thu, 14 Jun 2012 16:20:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D8AC48FC14; Thu, 14 Jun 2012 16:20:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EGKJpv005117; Thu, 14 Jun 2012 16:20:19 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EGKJfU005114; Thu, 14 Jun 2012 16:20:19 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201206141620.q5EGKJfU005114@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 14 Jun 2012 16:20:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237079 - in head/sys/dev/usb: . quirk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 16:20:20 -0000 Author: hselasky Date: Thu Jun 14 16:20:19 2012 New Revision: 237079 URL: http://svn.freebsd.org/changeset/base/237079 Log: Add more quirks for USB MIDI adapters. Obtained from: Clemens Ladisch MFC after: 1 week Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Thu Jun 14 15:39:14 2012 (r237078) +++ head/sys/dev/usb/quirk/usb_quirk.c Thu Jun 14 16:20:19 2012 (r237079) @@ -454,7 +454,13 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(ROLAND, SD20, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), USB_QUIRK(ROLAND, SD80, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), USB_QUIRK(ROLAND, UA700, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), + USB_QUIRK(EGO, M4U, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), + USB_QUIRK(LOGILINK, U2M, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), USB_QUIRK(MEDELI, DD305, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI, UQ_MATCH_VENDOR_ONLY), + USB_QUIRK(REDOCTANE, GHMIDI, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), + USB_QUIRK(TEXTECH, U2M_1, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), + USB_QUIRK(TEXTECH, U2M_2, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), + USB_QUIRK(WCH2, U2M, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI), /* * Quirks for manufacturers which USB devices does not respond Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Thu Jun 14 15:39:14 2012 (r237078) +++ head/sys/dev/usb/usbdevs Thu Jun 14 16:20:19 2012 (r237079) @@ -487,6 +487,7 @@ vendor BROADCOM 0x0a5c Broadcom vendor GREENHOUSE 0x0a6b GREENHOUSE vendor MEDELI 0x0a67 Medeli vendor GEOCAST 0x0a79 Geocast Network Systems +vendor EGO 0x0a92 EGO systems vendor IDQUANTIQUE 0x0aba id Quantique vendor ZYDAS 0x0ace Zydas Technology Corporation vendor NEODIO 0x0aec Neodio @@ -611,6 +612,7 @@ vendor INITIO 0x13fd Initio Corporation vendor EMTEC 0x13fe Emtec vendor NOVATEL 0x1410 Novatel Wireless vendor MERLIN 0x1416 Merlin +vendor REDOCTANE 0x1430 RedOctane vendor WISTRONNEWEB 0x1435 Wistron NeWeb vendor RADIOSHACK 0x1453 Radio Shack vendor HUAWEI3COM 0x1472 Huawei-3Com @@ -633,6 +635,7 @@ vendor FIBERLINE 0x1582 Fiberline vendor SPARKLAN 0x15a9 SparkLAN vendor SOUNDGRAPH 0x15c2 Soundgraph, Inc. vendor AMIT2 0x15c5 AMIT +vendor TEXTECH 0x15ca Textech International Ltd. vendor SOHOWARE 0x15e8 SOHOware vendor UMAX 0x1606 UMAX Data Systems vendor INSIDEOUT 0x1608 Inside Out Networks @@ -723,6 +726,7 @@ vendor MARVELL 0x9e88 Marvell Technolog vendor 3COM3 0xa727 3Com vendor DATAAPEX 0xdaae DataApex vendor HP2 0xf003 Hewlett Packard +vendor LOGILINK 0xfc08 LogiLink vendor USRP 0xfffe GNU Radio USRP /* @@ -1472,6 +1476,10 @@ product EGALAX TPANEL 0x0001 Touch Pane product EGALAX TPANEL2 0x0002 Touch Panel product EGALAX2 TPANEL 0x0001 Touch Panel +/* EGO Products */ +product EGO DUMMY 0x0000 Dummy Product +product EGO M4U 0x1020 ESI M4U + /* Eicon Networks */ product EICON DIVA852 0x4905 Diva 852 ISDN TA @@ -2090,6 +2098,10 @@ product LINKSYS4 WUSB54GCV3 0x0077 WUSB5 product LINKSYS4 RT3070 0x0078 RT3070 product LINKSYS4 WUSB600NV2 0x0079 WUSB600N v2 +/* Logilink products */ +product LOGILINK DUMMY 0x0000 Dummy product +product LOGILINK U2M 0x0101 LogiLink USB MIDI Cable + /* Logitech products */ product LOGITECH M2452 0x0203 M2452 keyboard product LOGITECH M4848 0x0301 M4848 mouse @@ -2813,6 +2825,10 @@ product REALTEK RTL8187B_0 0x8189 RTL818 product REALTEK RTL8187B_1 0x8197 RTL8187B Wireless Adapter product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Adapter +/* RedOctane products */ +product REDOCTANE DUMMY 0x0000 Dummy product +product REDOCTANE GHMIDI 0x474b GH MIDI INTERFACE + /* Renesas products */ product RENESAS RX610 0x0053 RX610 RX-Stick @@ -3249,6 +3265,11 @@ product SYNTECH CYPHERLAB100 0x1000 Ciph /* Teclast products */ product TECLAST TLC300 0x3203 USB Media Player +/* TexTech products */ +product TEXTECH DUMMY 0x0000 Dummy product +product TEXTECH U2M_1 0x0101 Textech USB MIDI cable +product TEXTECH U2M_2 0x1806 Textech USB MIDI cable + /* Supra products */ product DIAMOND2 SUPRAEXPRESS56K 0x07da Supra Express 56K modem product DIAMOND2 SUPRA2890 0x0b4a SupraMax 2890 56K Modem @@ -3421,7 +3442,9 @@ product WAVESENSE JAZZ 0xaaaa Jazz bloo /* WCH products */ product WCH CH341SER 0x5523 CH341/CH340 USB-Serial Bridge +product WCH2 DUMMY 0x0000 Dummy product product WCH2 CH341SER 0x7523 CH341/CH340 USB-Serial Bridge +product WCH2 U2M 0X752d CH345 USB2.0-MIDI /* Western Digital products */ product WESTERN COMBO 0x0200 Firewire USB Combo From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 16:23:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7B46106564A; Thu, 14 Jun 2012 16:23:16 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 907518FC0C; Thu, 14 Jun 2012 16:23:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EGNGAc005286; Thu, 14 Jun 2012 16:23:16 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EGNGa5005284; Thu, 14 Jun 2012 16:23:16 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141623.q5EGNGa5005284@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 16:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237080 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 16:23:16 -0000 Author: pjd Date: Thu Jun 14 16:23:16 2012 New Revision: 237080 URL: http://svn.freebsd.org/changeset/base/237080 Log: Assert that the filedesc lock is being held when the fdunwrap() function is called. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 16:20:19 2012 (r237079) +++ head/sys/kern/kern_descrip.c Thu Jun 14 16:23:16 2012 (r237080) @@ -445,6 +445,8 @@ static inline int fdunwrap(int fd, cap_rights_t rights, struct filedesc *fdp, struct file **fpp) { + FILEDESC_LOCK_ASSERT(fdp); + *fpp = fdtofp(fd, fdp); if (*fpp == NULL) return (EBADF); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 16:24:03 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D75E7106566B; Thu, 14 Jun 2012 16:24:03 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C2C8A8FC17; Thu, 14 Jun 2012 16:24:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EGO3SA005357; Thu, 14 Jun 2012 16:24:03 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EGO3Do005355; Thu, 14 Jun 2012 16:24:03 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141624.q5EGO3Do005355@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 16:24:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237081 - head/sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 16:24:03 -0000 Author: pjd Date: Thu Jun 14 16:24:03 2012 New Revision: 237081 URL: http://svn.freebsd.org/changeset/base/237081 Log: Explicitly assert that the filedesc lock is held when the fget_locked() function is called. MFC after: 1 month Modified: head/sys/sys/filedesc.h Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Thu Jun 14 16:23:16 2012 (r237080) +++ head/sys/sys/filedesc.h Thu Jun 14 16:24:03 2012 (r237081) @@ -142,7 +142,12 @@ static __inline struct file * fget_locked(struct filedesc *fdp, int fd) { - return (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]); + FILEDESC_LOCK_ASSERT(fdp); + + if (fd < 0 || fd >= fdp->fd_nfiles) + return (NULL); + + return (fdp->fd_ofiles[fd]); } #endif /* _KERNEL */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 16:25:10 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6C7A1065675; Thu, 14 Jun 2012 16:25:10 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C267D8FC1B; Thu, 14 Jun 2012 16:25:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EGPAFH005447; Thu, 14 Jun 2012 16:25:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EGPATF005445; Thu, 14 Jun 2012 16:25:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141625.q5EGPATF005445@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 16:25:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237082 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 16:25:10 -0000 Author: pjd Date: Thu Jun 14 16:25:10 2012 New Revision: 237082 URL: http://svn.freebsd.org/changeset/base/237082 Log: Remove fdtofp() function and use fget_locked(), which works exactly the same. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 16:24:03 2012 (r237081) +++ head/sys/kern/kern_descrip.c Thu Jun 14 16:25:10 2012 (r237082) @@ -429,25 +429,13 @@ sys_fcntl(struct thread *td, struct fcnt return (error); } -static inline struct file * -fdtofp(int fd, struct filedesc *fdp) -{ - - FILEDESC_LOCK_ASSERT(fdp); - - if (fd < 0 || fd >= fdp->fd_nfiles) - return (NULL); - - return (fdp->fd_ofiles[fd]); -} - static inline int fdunwrap(int fd, cap_rights_t rights, struct filedesc *fdp, struct file **fpp) { FILEDESC_LOCK_ASSERT(fdp); - *fpp = fdtofp(fd, fdp); + *fpp = fget_locked(fdp, fd); if (*fpp == NULL) return (EBADF); @@ -496,7 +484,7 @@ kern_fcntl(struct thread *td, int fd, in case F_GETFD: FILEDESC_SLOCK(fdp); - if ((fp = fdtofp(fd, fdp)) == NULL) { + if ((fp = fget_locked(fdp, fd)) == NULL) { FILEDESC_SUNLOCK(fdp); error = EBADF; break; @@ -508,7 +496,7 @@ kern_fcntl(struct thread *td, int fd, in case F_SETFD: FILEDESC_XLOCK(fdp); - if ((fp = fdtofp(fd, fdp)) == NULL) { + if ((fp = fget_locked(fdp, fd)) == NULL) { FILEDESC_XUNLOCK(fdp); error = EBADF; break; @@ -681,7 +669,7 @@ kern_fcntl(struct thread *td, int fd, in vfslocked = 0; /* Check for race with close */ FILEDESC_SLOCK(fdp); - if (fdtofp(fd, fdp) != fp) { + if (fget_locked(fdp, fd) != fp) { FILEDESC_SUNLOCK(fdp); flp->l_whence = SEEK_SET; flp->l_start = 0; @@ -746,7 +734,7 @@ kern_fcntl(struct thread *td, int fd, in /* FALLTHROUGH */ case F_READAHEAD: FILEDESC_SLOCK(fdp); - if ((fp = fdtofp(fd, fdp)) == NULL) { + if ((fp = fget_locked(fdp, fd)) == NULL) { FILEDESC_SUNLOCK(fdp); error = EBADF; break; @@ -823,7 +811,7 @@ do_dup(struct thread *td, int flags, int return (flags & DUP_FCNTL ? EINVAL : EBADF); FILEDESC_XLOCK(fdp); - if (fdtofp(old, fdp) == NULL) { + if (fget_locked(fdp, old) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } @@ -1202,7 +1190,7 @@ kern_close(td, fd) AUDIT_SYSCLOSE(td, fd); FILEDESC_XLOCK(fdp); - if ((fp = fdtofp(fd, fdp)) == NULL) { + if ((fp = fget_locked(fdp, fd)) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } @@ -2596,7 +2584,7 @@ dupfdopen(struct thread *td, struct file * closed, then reject. */ FILEDESC_XLOCK(fdp); - if ((fp = fdtofp(dfd, fdp)) == NULL) { + if ((fp = fget_locked(fdp, dfd)) == NULL) { FILEDESC_XUNLOCK(fdp); return (EBADF); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 17:32:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DFA63106564A; Thu, 14 Jun 2012 17:32:58 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id CB7658FC0A; Thu, 14 Jun 2012 17:32:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EHWwJh008664; Thu, 14 Jun 2012 17:32:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EHWw7q008662; Thu, 14 Jun 2012 17:32:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141732.q5EHWw7q008662@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 17:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237084 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 17:32:59 -0000 Author: pjd Date: Thu Jun 14 17:32:58 2012 New Revision: 237084 URL: http://svn.freebsd.org/changeset/base/237084 Log: Update comment. MFC after: 1 month Modified: head/sys/kern/kern_event.c Modified: head/sys/kern/kern_event.c ============================================================================== --- head/sys/kern/kern_event.c Thu Jun 14 16:53:08 2012 (r237083) +++ head/sys/kern/kern_event.c Thu Jun 14 17:32:58 2012 (r237084) @@ -692,7 +692,7 @@ sys_kqueue(struct thread *td, struct kqu if (error) goto done2; - /* An extra reference on `nfp' has been held for us by falloc(). */ + /* An extra reference on `fp' has been held for us by falloc(). */ kq = malloc(sizeof *kq, M_KQUEUE, M_WAITOK | M_ZERO); mtx_init(&kq->kq_lock, "kqueue", NULL, MTX_DEF|MTX_DUPOK); TAILQ_INIT(&kq->kq_head); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 17:40:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBD6D106566C; Thu, 14 Jun 2012 17:40:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id C7FE18FC1D; Thu, 14 Jun 2012 17:40:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EHenXl009049; Thu, 14 Jun 2012 17:40:49 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EHenWF009047; Thu, 14 Jun 2012 17:40:49 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206141740.q5EHenWF009047@svn.freebsd.org> From: Alan Cox Date: Thu, 14 Jun 2012 17:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237085 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 17:40:50 -0000 Author: alc Date: Thu Jun 14 17:40:49 2012 New Revision: 237085 URL: http://svn.freebsd.org/changeset/base/237085 Log: Correctly identify the function in a KASSERT(). MFC after: 3 days Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Jun 14 17:32:58 2012 (r237084) +++ head/sys/amd64/amd64/pmap.c Thu Jun 14 17:40:49 2012 (r237085) @@ -4408,8 +4408,9 @@ small_mappings: pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pde = pmap_pde(pmap, pv->pv_va); - KASSERT((*pde & PG_PS) == 0, ("pmap_clear_write: found" - " a 2mpage in page %p's pv list", m)); + KASSERT((*pde & PG_PS) == 0, + ("pmap_remove_write: found a 2mpage in page %p's pv list", + m)); pte = pmap_pde_to_pte(pde, pv->pv_va); retry: oldpte = *pte; From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 17:47:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 203C51065670; Thu, 14 Jun 2012 17:47:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 0BCE28FC0C; Thu, 14 Jun 2012 17:47:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EHlsuY009401; Thu, 14 Jun 2012 17:47:54 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EHlsbJ009399; Thu, 14 Jun 2012 17:47:54 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206141747.q5EHlsbJ009399@svn.freebsd.org> From: Alan Cox Date: Thu, 14 Jun 2012 17:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237086 - head/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 17:47:55 -0000 Author: alc Date: Thu Jun 14 17:47:54 2012 New Revision: 237086 URL: http://svn.freebsd.org/changeset/base/237086 Log: Update a couple comments to reflect r235598. X-MFC after: r235598 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Jun 14 17:40:49 2012 (r237085) +++ head/sys/amd64/amd64/pmap.c Thu Jun 14 17:47:54 2012 (r237086) @@ -2373,7 +2373,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offs * Transfer the first page's pv entry for this mapping to the * 2mpage's pv list. Aside from avoiding the cost of a call * to get_pv_entry(), a transfer avoids the possibility that - * get_pv_entry() calls pmap_collect() and that pmap_collect() + * get_pv_entry() calls pmap_pv_reclaim() and that pmap_pv_reclaim() * removes one of the mappings that is being promoted. */ m = PHYS_TO_VM_PAGE(pa); @@ -2588,7 +2588,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t /* * Demote the pv entry. This depends on the earlier demotion * of the mapping. Specifically, the (re)creation of a per- - * page pv entry might trigger the execution of pmap_collect(), + * page pv entry might trigger the execution of pmap_pv_reclaim(), * which might reclaim a newly (re)created per-page pv entry * and destroy the associated mapping. In order to destroy * the mapping, the PDE must have already changed from mapping From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 18:16:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3183A106564A; Thu, 14 Jun 2012 18:16:36 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1BE8B8FC0C; Thu, 14 Jun 2012 18:16:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EIGZQG010792; Thu, 14 Jun 2012 18:16:35 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EIGZaX010790; Thu, 14 Jun 2012 18:16:35 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206141816.q5EIGZaX010790@svn.freebsd.org> From: Martin Matuska Date: Thu, 14 Jun 2012 18:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237088 - stable/9/lib/libc/locale X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 18:16:36 -0000 Author: mm Date: Thu Jun 14 18:16:35 2012 New Revision: 237088 URL: http://svn.freebsd.org/changeset/base/237088 Log: MFC r236889 (theraven): Fix a leak when setting the global character locale to "C" from something else. Reported by: mm (myself) Approved by: theraven (IRC) Modified: stable/9/lib/libc/locale/setrunelocale.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/locale/setrunelocale.c ============================================================================== --- stable/9/lib/libc/locale/setrunelocale.c Thu Jun 14 17:54:52 2012 (r237087) +++ stable/9/lib/libc/locale/setrunelocale.c Thu Jun 14 18:16:35 2012 (r237088) @@ -89,6 +89,17 @@ const _RuneLocale *__getCurrentRuneLocal return XLOCALE_CTYPE(__get_locale())->runes; } +static void free_runes(_RuneLocale *rl) +{ + /* FIXME: The "EUC" check here is a hideous abstraction violation. */ + if ((rl != &_DefaultRuneLocale) && (rl)) { + if (strcmp(rl->__encoding, "EUC") == 0) { + free(rl->__variable); + } + free(rl); + } +} + static int __setrunelocale(struct xlocale_ctype *l, const char *encoding) { @@ -102,6 +113,7 @@ __setrunelocale(struct xlocale_ctype *l, * The "C" and "POSIX" locale are always here. */ if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0) { + free_runes(saved.runes); (void) _none_init(l, (_RuneLocale*)&_DefaultRuneLocale); return (0); } @@ -153,13 +165,7 @@ __setrunelocale(struct xlocale_ctype *l, if (ret == 0) { /* Free the old runes if it exists. */ - /* FIXME: The "EUC" check here is a hideous abstraction violation. */ - if ((saved.runes != &_DefaultRuneLocale) && (saved.runes)) { - if (strcmp(saved.runes->__encoding, "EUC") == 0) { - free(saved.runes->__variable); - } - free(saved.runes); - } + free_runes(saved.runes); } else { /* Restore the saved version if this failed. */ memcpy(l, &saved, sizeof(struct xlocale_ctype)); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 18:37:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B57BB106564A; Thu, 14 Jun 2012 18:37:00 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id A07F88FC19; Thu, 14 Jun 2012 18:37:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EIb04c011751; Thu, 14 Jun 2012 18:37:00 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EIb02Z011749; Thu, 14 Jun 2012 18:37:00 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206141837.q5EIb02Z011749@svn.freebsd.org> From: Warner Losh Date: Thu, 14 Jun 2012 18:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237089 - head/sys/arm/xscale/pxa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 18:37:00 -0000 Author: imp Date: Thu Jun 14 18:37:00 2012 New Revision: 237089 URL: http://svn.freebsd.org/changeset/base/237089 Log: Fix missing straggler for the move to parse_boot_param() Modified: head/sys/arm/xscale/pxa/pxa_machdep.c Modified: head/sys/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- head/sys/arm/xscale/pxa/pxa_machdep.c Thu Jun 14 18:16:35 2012 (r237088) +++ head/sys/arm/xscale/pxa/pxa_machdep.c Thu Jun 14 18:37:00 2012 (r237089) @@ -174,8 +174,8 @@ initarm(struct arm_boot_params *abp) int i, j; uint32_t memsize[PXA2X0_SDRAM_BANKS], memstart[PXA2X0_SDRAM_BANKS]; + lastaddr = parse_boot_param(abp); set_cpufuncs(); - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 19:30:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49C75106564A; Thu, 14 Jun 2012 19:30:32 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 1B2F28FC0C; Thu, 14 Jun 2012 19:30:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EJUVvD014182; Thu, 14 Jun 2012 19:30:31 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EJUVeY014180; Thu, 14 Jun 2012 19:30:31 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206141930.q5EJUVeY014180@svn.freebsd.org> From: Doug Barton Date: Thu, 14 Jun 2012 19:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237090 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 19:30:32 -0000 Author: dougb Date: Thu Jun 14 19:30:31 2012 New Revision: 237090 URL: http://svn.freebsd.org/changeset/base/237090 Log: Improve the functionality of the PORTS_MODULES knob by adding LOCALBASE/bin and sbin to PATH, allowing dependencies to be found; adding SRC_BASE and OSVERSION to match the new kernel, and putting the related builds under MAKEOBJDIRPREFIX so that they only need to be built once per kernel. In addition to the PR this includes ideas/contributions from crees and matthew. PR: ports/161452 Submitted by: Garrett Cooper Modified: head/sys/conf/kern.post.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Thu Jun 14 18:37:00 2012 (r237089) +++ head/sys/conf/kern.post.mk Thu Jun 14 19:30:31 2012 (r237090) @@ -36,9 +36,30 @@ modules-${target}: .endif .endfor -# Handle out of tree ports +# Handle ports (as defined by the user) that build kernel modules .if !defined(NO_MODULES) && defined(PORTS_MODULES) -PORTSMODULESENV=SYSDIR=${SYSDIR} +# +# The ports tree needs some environment variables defined to match the new kernel +# +# Ports search for some dependencies in PATH, so add the location of the installed files +LOCALBASE?= /usr/local +# SRC_BASE is how the ports tree refers to the location of the base source files +.if !defined(SRC_BASE) +SRC_BASE!= realpath "${SYSDIR:H}/" +.endif +# OSVERSION is used by some ports to determine build options +.if !defined(OSRELDATE) +# Definition copied from src/Makefile.inc1 +OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ + ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h +.endif +# Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build +WRKDIRPREFIX?= ${MAKEOBJDIRPREFIX}${SRC_BASE}/sys/${KERNCONF} +PORTSMODULESENV=\ + PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \ + SRC_BASE=${SRC_BASE} \ + OSVERSION=${OSRELDATE} \ + WRKDIRPREFIX=${WRKDIRPREFIX} .for __target in all install reinstall clean ${__target}: ports-${__target} ports-${__target}: From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 19:55:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3AE31065670; Thu, 14 Jun 2012 19:55:19 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id BD9238FC14; Thu, 14 Jun 2012 19:55:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EJtJp9015432; Thu, 14 Jun 2012 19:55:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EJtJFh015430; Thu, 14 Jun 2012 19:55:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206141955.q5EJtJFh015430@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 19:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237091 - stable/9/sys/boot/ofw/libofw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 19:55:20 -0000 Author: marius Date: Thu Jun 14 19:55:19 2012 New Revision: 237091 URL: http://svn.freebsd.org/changeset/base/237091 Log: MFC: r236579 The workaround added in r151650 for handling firmwares that don't allow a single device to be opened multiple times concurrently unfortunately isn't sufficient with ZFS. This is due to the fact, that ZFS may open different partitions of a single device simultaneously. So the best we can do in this case is to cache the lastly used device path and close and open devices in ofwd_strategy() as needed. PR: 165025 Submitted by: Gavin Mu Modified: stable/9/sys/boot/ofw/libofw/ofw_disk.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/boot/ofw/libofw/ofw_disk.c ============================================================================== --- stable/9/sys/boot/ofw/libofw/ofw_disk.c Thu Jun 14 19:30:31 2012 (r237090) +++ stable/9/sys/boot/ofw/libofw/ofw_disk.c Thu Jun 14 19:55:19 2012 (r237091) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); */ #include -#include #include @@ -43,8 +42,8 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" static int ofwd_init(void); -static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); +static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, + size_t size, char *buf, size_t *rsize); static int ofwd_open(struct open_file *f, ...); static int ofwd_close(struct open_file *f); static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); @@ -61,120 +60,109 @@ struct devsw ofwdisk = { ofwd_print }; -struct opened_dev { - ihandle_t handle; - u_int count; - SLIST_ENTRY(opened_dev) link; -}; - -SLIST_HEAD(, opened_dev) opened_devs = SLIST_HEAD_INITIALIZER(opened_devs); +/* + * We're not guaranteed to be able to open a device more than once and there + * is no OFW standard method to determine whether a device is already opened. + * Opening a device multiple times simultaneously happens to work with most + * OFW block device drivers but triggers a trap with at least the driver for + * the on-board controllers of Sun Fire V100 and Ultra 1. Upper layers and MI + * code expect to be able to open a device more than once however. Given that + * different partitions of the same device might be opened at the same time as + * done by ZFS, we can't generally just keep track of the opened devices and + * reuse the instance handle when asked to open an already opened device. So + * the best we can do is to cache the lastly used device path and close and + * open devices in ofwd_strategy() as needed. + */ +static struct ofw_devdesc *kdp; static int ofwd_init(void) { - return 0; + return (0); } static int -ofwd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, - size_t *rsize) +ofwd_strategy(void *devdata, int flag __unused, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { struct ofw_devdesc *dp = (struct ofw_devdesc *)devdata; daddr_t pos; int n; + if (dp != kdp) { + if (kdp != NULL) { +#if !defined(__powerpc__) + OF_close(kdp->d_handle); +#endif + kdp = NULL; + } + if ((dp->d_handle = OF_open(dp->d_path)) == -1) + return (ENOENT); + kdp = dp; + } + pos = dblk * 512; do { if (OF_seek(dp->d_handle, pos) < 0) - return EIO; + return (EIO); n = OF_read(dp->d_handle, buf, size); if (n < 0 && n != -2) - return EIO; + return (EIO); } while (n == -2); *rsize = size; - return 0; + return (0); } static int ofwd_open(struct open_file *f, ...) { - char path[256]; struct ofw_devdesc *dp; - struct opened_dev *odp; va_list vl; va_start(vl, f); dp = va_arg(vl, struct ofw_devdesc *); va_end(vl); - /* - * We're not guaranteed to be able to open a device more than once - * simultaneously and there is no OFW standard method to determine - * whether a device is already opened. Opening a device more than - * once happens to work with most OFW block device drivers but - * triggers a trap with at least the driver for the on-board SCSI - * controller in Sun Ultra 1. Upper layers and MI code expect to - * be able to open a device more than once however. As a workaround - * keep track of the opened devices and reuse the instance handle - * when asked to open an already opened device. - */ - SLIST_FOREACH(odp, &opened_devs, link) { - if (OF_instance_to_path(odp->handle, path, sizeof(path)) == -1) - continue; - if (strcmp(path, dp->d_path) == 0) { - odp->count++; - dp->d_handle = odp->handle; - return 0; + + if (dp != kdp) { + if (kdp != NULL) { + OF_close(kdp->d_handle); + kdp = NULL; } + if ((dp->d_handle = OF_open(dp->d_path)) == -1) { + printf("%s: Could not open %s\n", __func__, + dp->d_path); + return (ENOENT); + } + kdp = dp; } - odp = malloc(sizeof(struct opened_dev)); - if (odp == NULL) { - printf("ofwd_open: malloc failed\n"); - return ENOMEM; - } - if ((odp->handle = OF_open(dp->d_path)) == -1) { - printf("ofwd_open: Could not open %s\n", dp->d_path); - free(odp); - return ENOENT; - } - odp->count = 1; - SLIST_INSERT_HEAD(&opened_devs, odp, link); - dp->d_handle = odp->handle; - return 0; + return (0); } static int ofwd_close(struct open_file *f) { struct ofw_devdesc *dev = f->f_devdata; - struct opened_dev *odp; - SLIST_FOREACH(odp, &opened_devs, link) { - if (odp->handle == dev->d_handle) { - odp->count--; - if (odp->count == 0) { - SLIST_REMOVE(&opened_devs, odp, opened_dev, - link); - #if !defined(__powerpc__) - OF_close(odp->handle); - #endif - free(odp); - } - break; - } + if (dev == kdp) { +#if !defined(__powerpc__) + OF_close(dev->d_handle); +#endif + kdp = NULL; } - return 0; + return (0); } static int -ofwd_ioctl(struct open_file *f, u_long cmd, void *data) +ofwd_ioctl(struct open_file *f __unused, u_long cmd __unused, + void *data __unused) { return (EINVAL); } static void -ofwd_print(int verbose) +ofwd_print(int verbose __unused) { } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 19:55:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3A84106566C; Thu, 14 Jun 2012 19:55:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id CDAF28FC0A; Thu, 14 Jun 2012 19:55:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EJtMG5015468; Thu, 14 Jun 2012 19:55:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EJtMpX015466; Thu, 14 Jun 2012 19:55:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206141955.q5EJtMpX015466@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 19:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237092 - stable/8/sys/boot/ofw/libofw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 19:55:23 -0000 Author: marius Date: Thu Jun 14 19:55:22 2012 New Revision: 237092 URL: http://svn.freebsd.org/changeset/base/237092 Log: MFC: r236579 The workaround added in r151650 for handling firmwares that don't allow a single device to be opened multiple times concurrently unfortunately isn't sufficient with ZFS. This is due to the fact, that ZFS may open different partitions of a single device simultaneously. So the best we can do in this case is to cache the lastly used device path and close and open devices in ofwd_strategy() as needed. PR: 165025 Submitted by: Gavin Mu Modified: stable/8/sys/boot/ofw/libofw/ofw_disk.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/boot/ofw/libofw/ofw_disk.c ============================================================================== --- stable/8/sys/boot/ofw/libofw/ofw_disk.c Thu Jun 14 19:55:19 2012 (r237091) +++ stable/8/sys/boot/ofw/libofw/ofw_disk.c Thu Jun 14 19:55:22 2012 (r237092) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); */ #include -#include #include @@ -43,8 +42,8 @@ __FBSDID("$FreeBSD$"); #include "libofw.h" static int ofwd_init(void); -static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); +static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, + size_t size, char *buf, size_t *rsize); static int ofwd_open(struct open_file *f, ...); static int ofwd_close(struct open_file *f); static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data); @@ -61,120 +60,109 @@ struct devsw ofwdisk = { ofwd_print }; -struct opened_dev { - ihandle_t handle; - u_int count; - SLIST_ENTRY(opened_dev) link; -}; - -SLIST_HEAD(, opened_dev) opened_devs = SLIST_HEAD_INITIALIZER(opened_devs); +/* + * We're not guaranteed to be able to open a device more than once and there + * is no OFW standard method to determine whether a device is already opened. + * Opening a device multiple times simultaneously happens to work with most + * OFW block device drivers but triggers a trap with at least the driver for + * the on-board controllers of Sun Fire V100 and Ultra 1. Upper layers and MI + * code expect to be able to open a device more than once however. Given that + * different partitions of the same device might be opened at the same time as + * done by ZFS, we can't generally just keep track of the opened devices and + * reuse the instance handle when asked to open an already opened device. So + * the best we can do is to cache the lastly used device path and close and + * open devices in ofwd_strategy() as needed. + */ +static struct ofw_devdesc *kdp; static int ofwd_init(void) { - return 0; + return (0); } static int -ofwd_strategy(void *devdata, int flag, daddr_t dblk, size_t size, char *buf, - size_t *rsize) +ofwd_strategy(void *devdata, int flag __unused, daddr_t dblk, size_t size, + char *buf, size_t *rsize) { struct ofw_devdesc *dp = (struct ofw_devdesc *)devdata; daddr_t pos; int n; + if (dp != kdp) { + if (kdp != NULL) { +#if !defined(__powerpc__) + OF_close(kdp->d_handle); +#endif + kdp = NULL; + } + if ((dp->d_handle = OF_open(dp->d_path)) == -1) + return (ENOENT); + kdp = dp; + } + pos = dblk * 512; do { if (OF_seek(dp->d_handle, pos) < 0) - return EIO; + return (EIO); n = OF_read(dp->d_handle, buf, size); if (n < 0 && n != -2) - return EIO; + return (EIO); } while (n == -2); *rsize = size; - return 0; + return (0); } static int ofwd_open(struct open_file *f, ...) { - char path[256]; struct ofw_devdesc *dp; - struct opened_dev *odp; va_list vl; va_start(vl, f); dp = va_arg(vl, struct ofw_devdesc *); va_end(vl); - /* - * We're not guaranteed to be able to open a device more than once - * simultaneously and there is no OFW standard method to determine - * whether a device is already opened. Opening a device more than - * once happens to work with most OFW block device drivers but - * triggers a trap with at least the driver for the on-board SCSI - * controller in Sun Ultra 1. Upper layers and MI code expect to - * be able to open a device more than once however. As a workaround - * keep track of the opened devices and reuse the instance handle - * when asked to open an already opened device. - */ - SLIST_FOREACH(odp, &opened_devs, link) { - if (OF_instance_to_path(odp->handle, path, sizeof(path)) == -1) - continue; - if (strcmp(path, dp->d_path) == 0) { - odp->count++; - dp->d_handle = odp->handle; - return 0; + + if (dp != kdp) { + if (kdp != NULL) { + OF_close(kdp->d_handle); + kdp = NULL; } + if ((dp->d_handle = OF_open(dp->d_path)) == -1) { + printf("%s: Could not open %s\n", __func__, + dp->d_path); + return (ENOENT); + } + kdp = dp; } - odp = malloc(sizeof(struct opened_dev)); - if (odp == NULL) { - printf("ofwd_open: malloc failed\n"); - return ENOMEM; - } - if ((odp->handle = OF_open(dp->d_path)) == -1) { - printf("ofwd_open: Could not open %s\n", dp->d_path); - free(odp); - return ENOENT; - } - odp->count = 1; - SLIST_INSERT_HEAD(&opened_devs, odp, link); - dp->d_handle = odp->handle; - return 0; + return (0); } static int ofwd_close(struct open_file *f) { struct ofw_devdesc *dev = f->f_devdata; - struct opened_dev *odp; - SLIST_FOREACH(odp, &opened_devs, link) { - if (odp->handle == dev->d_handle) { - odp->count--; - if (odp->count == 0) { - SLIST_REMOVE(&opened_devs, odp, opened_dev, - link); - #if !defined(__powerpc__) - OF_close(odp->handle); - #endif - free(odp); - } - break; - } + if (dev == kdp) { +#if !defined(__powerpc__) + OF_close(dev->d_handle); +#endif + kdp = NULL; } - return 0; + return (0); } static int -ofwd_ioctl(struct open_file *f, u_long cmd, void *data) +ofwd_ioctl(struct open_file *f __unused, u_long cmd __unused, + void *data __unused) { return (EINVAL); } static void -ofwd_print(int verbose) +ofwd_print(int verbose __unused) { } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 20:02:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 13B6E106566C; Thu, 14 Jun 2012 20:02:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id F12998FC1A; Thu, 14 Jun 2012 20:02:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EK2rWN015972; Thu, 14 Jun 2012 20:02:53 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EK2rSU015963; Thu, 14 Jun 2012 20:02:53 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142002.q5EK2rSU015963@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237093 - in stable/9/sys/arm: at91 econa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:02:54 -0000 Author: marius Date: Thu Jun 14 20:02:53 2012 New Revision: 237093 URL: http://svn.freebsd.org/changeset/base/237093 Log: MFC: r225882 Remove pointless semicolons after label Modified: stable/9/sys/arm/at91/at91_mci.c stable/9/sys/arm/at91/at91_pio.c stable/9/sys/arm/at91/at91_rtc.c stable/9/sys/arm/at91/at91_spi.c stable/9/sys/arm/at91/at91_ssc.c stable/9/sys/arm/at91/at91_twi.c stable/9/sys/arm/at91/uart_dev_at91usart.c stable/9/sys/arm/econa/if_ece.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/arm/at91/at91_mci.c ============================================================================== --- stable/9/sys/arm/at91/at91_mci.c Thu Jun 14 19:55:22 2012 (r237092) +++ stable/9/sys/arm/at91/at91_mci.c Thu Jun 14 20:02:53 2012 (r237093) @@ -249,7 +249,7 @@ at91_mci_attach(device_t dev) child = device_add_child(dev, "mmc", 0); device_set_ivars(dev, &sc->host); err = bus_generic_attach(dev); -out:; +out: if (err) at91_mci_deactivate(dev); return (err); Modified: stable/9/sys/arm/at91/at91_pio.c ============================================================================== --- stable/9/sys/arm/at91/at91_pio.c Thu Jun 14 19:55:22 2012 (r237092) +++ stable/9/sys/arm/at91/at91_pio.c Thu Jun 14 20:02:53 2012 (r237093) @@ -165,7 +165,7 @@ at91_pio_attach(device_t dev) goto out; } sc->cdev->si_drv1 = sc; -out:; +out: if (err) at91_pio_deactivate(dev); return (err); Modified: stable/9/sys/arm/at91/at91_rtc.c ============================================================================== --- stable/9/sys/arm/at91/at91_rtc.c Thu Jun 14 19:55:22 2012 (r237092) +++ stable/9/sys/arm/at91/at91_rtc.c Thu Jun 14 20:02:53 2012 (r237093) @@ -118,7 +118,7 @@ at91_rtc_attach(device_t dev) goto out; } clock_register(dev, 1000000); -out:; +out: if (err) at91_rtc_deactivate(dev); return (err); Modified: stable/9/sys/arm/at91/at91_spi.c ============================================================================== --- stable/9/sys/arm/at91/at91_spi.c Thu Jun 14 19:55:22 2012 (r237092) +++ stable/9/sys/arm/at91/at91_spi.c Thu Jun 14 20:02:53 2012 (r237093) @@ -134,7 +134,7 @@ at91_spi_attach(device_t dev) device_add_child(dev, "spibus", -1); bus_generic_attach(dev); -out:; +out: if (err) at91_spi_deactivate(dev); return (err); @@ -259,7 +259,7 @@ at91_spi_transfer(device_t dev, device_t for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); return (err); -out:; +out: for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); return (EIO); Modified: stable/9/sys/arm/at91/at91_ssc.c ============================================================================== --- stable/9/sys/arm/at91/at91_ssc.c Thu Jun 14 19:55:22 2012 (r237092) +++ stable/9/sys/arm/at91/at91_ssc.c Thu Jun 14 20:02:53 2012 (r237093) @@ -150,7 +150,7 @@ at91_ssc_attach(device_t dev) WR4(sc, SSC_TFMR, 0x1f | SSC_TFMR_DATDEF | SSC_TFMR_MSFBF | SSC_TFMR_FSOS_NEG_PULSE); -out:; +out: if (err) at91_ssc_deactivate(dev); return (err); Modified: stable/9/sys/arm/at91/at91_twi.c ============================================================================== --- stable/9/sys/arm/at91/at91_twi.c Thu Jun 14 19:55:22 2012 (r237092) +++ stable/9/sys/arm/at91/at91_twi.c Thu Jun 14 20:02:53 2012 (r237093) @@ -142,7 +142,7 @@ at91_twi_attach(device_t dev) device_printf(dev, "could not allocate iicbus instance\n"); /* probe and attach the iicbus */ bus_generic_attach(dev); -out:; +out: if (err) at91_twi_deactivate(dev); return (err); @@ -369,7 +369,7 @@ at91_twi_transfer(device_t dev, struct i if ((err = at91_twi_wait(sc, TWI_SR_TXCOMP))) break; } -out:; +out: if (err) { WR4(sc, TWI_CR, TWI_CR_SWRST); WR4(sc, TWI_CR, TWI_CR_MSEN | TWI_CR_SVDIS); Modified: stable/9/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- stable/9/sys/arm/at91/uart_dev_at91usart.c Thu Jun 14 19:55:22 2012 (r237092) +++ stable/9/sys/arm/at91/uart_dev_at91usart.c Thu Jun 14 20:02:53 2012 (r237093) @@ -428,7 +428,7 @@ at91_usart_bus_attach(struct uart_softc WR4(&sc->sc_bas, USART_IER, USART_CSR_RXRDY); } WR4(&sc->sc_bas, USART_IER, USART_CSR_RXBRK); -errout:; +errout: return (err); } Modified: stable/9/sys/arm/econa/if_ece.c ============================================================================== --- stable/9/sys/arm/econa/if_ece.c Thu Jun 14 19:55:22 2012 (r237092) +++ stable/9/sys/arm/econa/if_ece.c Thu Jun 14 20:02:53 2012 (r237093) @@ -441,7 +441,7 @@ ece_attach(device_t dev) taskqueue_start_threads(&sc->sc_tq, 1, PI_NET, "%s taskq", device_get_nameunit(sc->dev)); -out:; +out: if (err) ece_deactivate(dev); if (err && ifp) From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 20:02:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9533D1065676; Thu, 14 Jun 2012 20:02:55 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 800D38FC14; Thu, 14 Jun 2012 20:02:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EK2txA016008; Thu, 14 Jun 2012 20:02:55 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EK2tZb016000; Thu, 14 Jun 2012 20:02:55 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142002.q5EK2tZb016000@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:02:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237094 - stable/8/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:02:55 -0000 Author: marius Date: Thu Jun 14 20:02:54 2012 New Revision: 237094 URL: http://svn.freebsd.org/changeset/base/237094 Log: MFC: r225882 Remove pointless semicolons after label Modified: stable/8/sys/arm/at91/at91_mci.c stable/8/sys/arm/at91/at91_pio.c stable/8/sys/arm/at91/at91_rtc.c stable/8/sys/arm/at91/at91_spi.c stable/8/sys/arm/at91/at91_ssc.c stable/8/sys/arm/at91/at91_twi.c stable/8/sys/arm/at91/uart_dev_at91usart.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/arm/at91/at91_mci.c ============================================================================== --- stable/8/sys/arm/at91/at91_mci.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_mci.c Thu Jun 14 20:02:54 2012 (r237094) @@ -211,7 +211,7 @@ at91_mci_attach(device_t dev) child = device_add_child(dev, "mmc", 0); device_set_ivars(dev, &sc->host); err = bus_generic_attach(dev); -out:; +out: if (err) at91_mci_deactivate(dev); return (err); Modified: stable/8/sys/arm/at91/at91_pio.c ============================================================================== --- stable/8/sys/arm/at91/at91_pio.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_pio.c Thu Jun 14 20:02:54 2012 (r237094) @@ -162,7 +162,7 @@ at91_pio_attach(device_t dev) goto out; } sc->cdev->si_drv1 = sc; -out:; +out: if (err) at91_pio_deactivate(dev); return (err); Modified: stable/8/sys/arm/at91/at91_rtc.c ============================================================================== --- stable/8/sys/arm/at91/at91_rtc.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_rtc.c Thu Jun 14 20:02:54 2012 (r237094) @@ -118,7 +118,7 @@ at91_rtc_attach(device_t dev) goto out; } clock_register(dev, 1000000); -out:; +out: if (err) at91_rtc_deactivate(dev); return (err); Modified: stable/8/sys/arm/at91/at91_spi.c ============================================================================== --- stable/8/sys/arm/at91/at91_spi.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_spi.c Thu Jun 14 20:02:54 2012 (r237094) @@ -134,7 +134,7 @@ at91_spi_attach(device_t dev) device_add_child(dev, "spibus", -1); bus_generic_attach(dev); -out:; +out: if (err) at91_spi_deactivate(dev); return (err); @@ -259,7 +259,7 @@ at91_spi_transfer(device_t dev, device_t for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); return (err); -out:; +out: for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); return (EIO); Modified: stable/8/sys/arm/at91/at91_ssc.c ============================================================================== --- stable/8/sys/arm/at91/at91_ssc.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_ssc.c Thu Jun 14 20:02:54 2012 (r237094) @@ -150,7 +150,7 @@ at91_ssc_attach(device_t dev) WR4(sc, SSC_TFMR, 0x1f | SSC_TFMR_DATDEF | SSC_TFMR_MSFBF | SSC_TFMR_FSOS_NEG_PULSE); -out:; +out: if (err) at91_ssc_deactivate(dev); return (err); Modified: stable/8/sys/arm/at91/at91_twi.c ============================================================================== --- stable/8/sys/arm/at91/at91_twi.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/at91_twi.c Thu Jun 14 20:02:54 2012 (r237094) @@ -140,7 +140,7 @@ at91_twi_attach(device_t dev) device_printf(dev, "could not allocate iicbus instance\n"); /* probe and attach the iicbus */ bus_generic_attach(dev); -out:; +out: if (err) at91_twi_deactivate(dev); return (err); @@ -369,7 +369,7 @@ at91_twi_transfer(device_t dev, struct i if ((err = at91_twi_wait(sc, TWI_SR_TXCOMP))) break; } -out:; +out: if (err) { WR4(sc, TWI_CR, TWI_CR_SWRST); WR4(sc, TWI_CR, TWI_CR_MSEN | TWI_CR_SVDIS); Modified: stable/8/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- stable/8/sys/arm/at91/uart_dev_at91usart.c Thu Jun 14 20:02:53 2012 (r237093) +++ stable/8/sys/arm/at91/uart_dev_at91usart.c Thu Jun 14 20:02:54 2012 (r237094) @@ -412,7 +412,7 @@ at91_usart_bus_attach(struct uart_softc } WR4(&sc->sc_bas, USART_IER, USART_CSR_RXBRK); #ifndef SKYEYE_WORKAROUNDS -errout:; +errout: // XXX bad return (err); #else From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 20:05:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 814DA1065679; Thu, 14 Jun 2012 20:05:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 6A7218FC18; Thu, 14 Jun 2012 20:05:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EK5C6v016209; Thu, 14 Jun 2012 20:05:12 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EK5C2k016201; Thu, 14 Jun 2012 20:05:12 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142005.q5EK5C2k016201@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:05:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237095 - stable/9/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:05:12 -0000 Author: marius Date: Thu Jun 14 20:05:12 2012 New Revision: 237095 URL: http://svn.freebsd.org/changeset/base/237095 Log: MFC: r236495 - Prepend the device description with "AT91" to reflect its nature. [1] - Move DMA tag and map creature to at91_spi_activate() where the other resource allocation also lives. [1] - Flesh out at91_spi_deactivate(). [1] - Work around the "Software Reset must be Written Twice" erratum. - For now, run the bus at the slowest speed possible in order to work around data corruption on transit even seen with 9 MHz on ETHERNUT5 (15 MHz maximum) and AT45DB321D (20 MHz maximum). This also serves as a poor man's work-around for the "NPCSx rises if no data data is to be transmitted" erratum of RM9200. Being able to use the appropriate bus speed would require: 1) Adding a proper work-around for the RM9200 bug consisting of taking the chip select control away from the SPI peripheral and managing it directly as a GPIO line. 2) Taking the maximum frequencies supported by the actual board and the slave devices into account and basing the whole thing on the master clock instead of hardcoding a divisor as previously done. 3) Fixing the above mentioned data corruption. - KASSERT that TX/RX command and data sizes match on transfers. - Introduce a mutex ensuring that only one child device is running a SPI transfer at a time. [1] - Add preliminary, #ifdef'ed out support for setting the chip select. [1] - Use the RX instead of the TX commando size when setting up the RX side of a transfer. - For controllers having SPI_SR_TXEMPTY, i.e. !RM9200, also wait for the completion of the TX part of transfers before stopping the whole thing again. - Use DEVMETHOD_END. [1] - Use NULL instead of 0 for pointers. [1, partially] Additional testing by: Ian Lepore Submitted by: Ian Lepore [1] Modified: stable/9/sys/arm/at91/at91_spi.c stable/9/sys/arm/at91/at91_spireg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/arm/at91/at91_spi.c ============================================================================== --- stable/9/sys/arm/at91/at91_spi.c Thu Jun 14 20:02:54 2012 (r237094) +++ stable/9/sys/arm/at91/at91_spi.c Thu Jun 14 20:05:12 2012 (r237095) @@ -1,5 +1,7 @@ /*- - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2011-2012 Ian Lepore. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,17 +33,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include #include +#include + #include #include #include +#include #include + #include "spibus_if.h" struct at91_spi_softc @@ -50,29 +56,39 @@ struct at91_spi_softc void *intrhand; /* Interrupt handle */ struct resource *irq_res; /* IRQ resource */ struct resource *mem_res; /* Memory resource */ - bus_dma_tag_t dmatag; /* bus dma tag for mbufs */ + bus_dma_tag_t dmatag; /* bus dma tag for transfers */ bus_dmamap_t map[4]; /* Maps for the transaction */ - int rxdone; + struct sx xfer_mtx; /* Enforce one transfer at a time */ + uint32_t xfer_mask; /* Bits to wait on for completion */ + uint32_t xfer_done; /* interrupt<->mainthread signaling */ }; +#define CS_TO_MR(cs) ((~(1 << (cs)) & 0x0f) << 16) + static inline uint32_t RD4(struct at91_spi_softc *sc, bus_size_t off) { - return bus_read_4(sc->mem_res, off); + + return (bus_read_4(sc->mem_res, off)); } static inline void WR4(struct at91_spi_softc *sc, bus_size_t off, uint32_t val) { + bus_write_4(sc->mem_res, off, val); } /* bus entry points */ -static int at91_spi_probe(device_t dev); static int at91_spi_attach(device_t dev); static int at91_spi_detach(device_t dev); +static int at91_spi_probe(device_t dev); +static int at91_spi_transfer(device_t dev, device_t child, + struct spi_command *cmd); /* helper routines */ +static void at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, + int error); static int at91_spi_activate(device_t dev); static void at91_spi_deactivate(device_t dev); static void at91_spi_intr(void *arg); @@ -80,43 +96,64 @@ static void at91_spi_intr(void *arg); static int at91_spi_probe(device_t dev) { - device_set_desc(dev, "SPI"); + + device_set_desc(dev, "AT91 SPI"); return (0); } static int at91_spi_attach(device_t dev) { - struct at91_spi_softc *sc = device_get_softc(dev); - int err, i; + struct at91_spi_softc *sc; + int err; + uint32_t csr; + + sc = device_get_softc(dev); sc->dev = dev; + sx_init(&sc->xfer_mtx, device_get_nameunit(dev)); + + /* + * Allocate resources. + */ err = at91_spi_activate(dev); if (err) goto out; /* - * Allocate DMA tags and maps + * Set up the hardware. */ - err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 2058, 1, - 2048, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); - if (err != 0) - goto out; - for (i = 0; i < 4; i++) { - err = bus_dmamap_create(sc->dmatag, 0, &sc->map[i]); - if (err != 0) - goto out; - } - // reset the SPI + sc->xfer_mask = SPI_SR_RXBUFF | (at91_is_rm92() ? 0 : SPI_SR_TXEMPTY); + WR4(sc, SPI_CR, SPI_CR_SWRST); + /* "Software Reset must be Written Twice" erratum */ WR4(sc, SPI_CR, SPI_CR_SWRST); WR4(sc, SPI_IDR, 0xffffffff); WR4(sc, SPI_MR, (0xf << 24) | SPI_MR_MSTR | SPI_MR_MODFDIS | - (0xE << 16)); + CS_TO_MR(0)); + + /* + * For now, run the bus at the slowest speed possible as otherwise we + * may encounter data corruption on transmit as seen with ETHERNUT5 + * and AT45DB321D even though both board and slave device can take + * more. + * This also serves as a work-around for the "NPCSx rises if no data + * data is to be transmitted" erratum. The ideal workaround for the + * latter is to take the chip select control away from the peripheral + * and manage it directly as a GPIO line. The easy solution is to + * slow down the bus so dramatically that it just never gets starved + * as may be seen when the OCHI controller is running and consuming + * memory and APB bandwidth. + * Also, currently we lack a way for lettting both the board and the + * slave devices take their maximum supported SPI clocks into account. + */ + csr = SPI_CSR_CPOL | (4 << 16) | (0xff << 8); + WR4(sc, SPI_CSR0, csr); + WR4(sc, SPI_CSR1, csr); + WR4(sc, SPI_CSR2, csr); + WR4(sc, SPI_CSR3, csr); - WR4(sc, SPI_CSR0, SPI_CSR_CPOL | (4 << 16) | (2 << 8)); WR4(sc, SPI_CR, SPI_CR_SPIEN); WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS); @@ -143,6 +180,7 @@ out: static int at91_spi_detach(device_t dev) { + return (EBUSY); /* XXX */ } @@ -150,26 +188,41 @@ static int at91_spi_activate(device_t dev) { struct at91_spi_softc *sc; - int rid, err = ENOMEM; + int err, i, rid; sc = device_get_softc(dev); + err = ENOMEM; + rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem_res == NULL) - goto errout; + goto out; + rid = 0; sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); if (sc->irq_res == NULL) - goto errout; + goto out; err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, at91_spi_intr, sc, &sc->intrhand); if (err != 0) - goto errout; - return (0); -errout: - at91_spi_deactivate(dev); + goto out; + + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 2048, 1, + 2048, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); + if (err != 0) + goto out; + + for (i = 0; i < 4; i++) { + err = bus_dmamap_create(sc->dmatag, 0, &sc->map[i]); + if (err != 0) + goto out; + } +out: + if (err != 0) + at91_spi_deactivate(dev); return (err); } @@ -177,26 +230,37 @@ static void at91_spi_deactivate(device_t dev) { struct at91_spi_softc *sc; + int i; sc = device_get_softc(dev); + bus_generic_detach(dev); + + for (i = 0; i < 4; i++) + if (sc->map[i]) + bus_dmamap_destroy(sc->dmatag, sc->map[i]); + + if (sc->dmatag) + bus_dma_tag_destroy(sc->dmatag); + if (sc->intrhand) bus_teardown_intr(dev, sc->irq_res, sc->intrhand); - sc->intrhand = 0; - bus_generic_detach(sc->dev); - if (sc->mem_res) - bus_release_resource(dev, SYS_RES_IOPORT, - rman_get_rid(sc->mem_res), sc->mem_res); - sc->mem_res = 0; + sc->intrhand = NULL; if (sc->irq_res) bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq_res), sc->irq_res); - sc->irq_res = 0; - return; + sc->irq_res = NULL; + + if (sc->mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem_res), sc->mem_res); + sc->mem_res = NULL; } static void -at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs __unused, + int error) { + if (error != 0) return; *(bus_addr_t *)arg = segs[0].ds_addr; @@ -206,80 +270,133 @@ static int at91_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) { struct at91_spi_softc *sc; - int i, j, rxdone, err, mode[4]; bus_addr_t addr; + int err, i, j, mode[4]; + uint32_t mask; + + KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, + ("%s: TX/RX command sizes should be equal", __func__)); + KASSERT(cmd->tx_data_sz == cmd->rx_data_sz, + ("%s: TX/RX data sizes should be equal", __func__)); sc = device_get_softc(dev); - WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); i = 0; - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_cmd, - cmd->tx_cmd_sz, at91_getaddr, &addr, 0) != 0) + + sx_xlock(&sc->xfer_mtx); + + /* + * Disable transfers while we set things up. + */ + WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); + +#ifdef SPI_CHIPSEL_SUPPORT + if (cmd->cs < 0 || cmd->cs > 3) { + device_printf(dev, + "Invalid chip select %d requested by %s\n", cmd->cs, + device_get_nameunit(child)); + err = EINVAL; + goto out; + } +#ifdef SPI_CHIP_SELECT_HIGH_SUPPORT + if (at91_is_rm92() && cmd->cs == 0 && + (cmd->flags & SPI_CHIP_SELECT_HIGH) != 0) { + device_printf(dev, + "Invalid chip select high requested by %s\n", + device_get_nameunit(child)); + err = EINVAL; + goto out; + } +#endif + WR4(sc, SPI_MR, (RD4(sc, SPI_MR) & ~0x000f0000) | CS_TO_MR(cmd->cs)); +#endif + + /* + * Set up the TX side of the transfer. + */ + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_cmd, + cmd->tx_cmd_sz, at91_getaddr, &addr, 0)) != 0) goto out; WR4(sc, PDC_TPR, addr); WR4(sc, PDC_TCR, cmd->tx_cmd_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREWRITE); mode[i++] = BUS_DMASYNC_POSTWRITE; if (cmd->tx_data_sz > 0) { - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_data, - cmd->tx_data_sz, at91_getaddr, &addr, 0) != 0) + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], + cmd->tx_data, cmd->tx_data_sz, at91_getaddr, &addr, 0)) != + 0) goto out; WR4(sc, PDC_TNPR, addr); WR4(sc, PDC_TNCR, cmd->tx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREWRITE); mode[i++] = BUS_DMASYNC_POSTWRITE; } - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_cmd, - cmd->tx_cmd_sz, at91_getaddr, &addr, 0) != 0) + + /* + * Set up the RX side of the transfer. + */ + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_cmd, + cmd->rx_cmd_sz, at91_getaddr, &addr, 0)) != 0) goto out; WR4(sc, PDC_RPR, addr); - WR4(sc, PDC_RCR, cmd->tx_cmd_sz); + WR4(sc, PDC_RCR, cmd->rx_cmd_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; if (cmd->rx_data_sz > 0) { - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_data, - cmd->tx_data_sz, at91_getaddr, &addr, 0) != 0) + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], + cmd->rx_data, cmd->rx_data_sz, at91_getaddr, &addr, 0)) != + 0) goto out; WR4(sc, PDC_RNPR, addr); WR4(sc, PDC_RNCR, cmd->rx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; } - WR4(sc, SPI_IER, SPI_SR_ENDRX); + + /* + * Start the transfer, wait for it to complete. + */ + sc->xfer_done = 0; + mask = sc->xfer_mask; + WR4(sc, SPI_IER, mask); WR4(sc, PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); + do + err = tsleep(&sc->xfer_done, PCATCH | PZERO, "at91_spi", hz); + while (sc->xfer_done != mask && err != EINTR); - rxdone = sc->rxdone; - do { - err = tsleep(&sc->rxdone, PCATCH | PZERO, "spi", hz); - } while (rxdone == sc->rxdone && err != EINTR); + /* + * Stop the transfer and clean things up. + */ WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); - if (err == 0) { - for (j = 0; j < i; j++) + if (err == 0) + for (j = 0; j < i; j++) bus_dmamap_sync(sc->dmatag, sc->map[j], mode[j]); - } - for (j = 0; j < i; j++) - bus_dmamap_unload(sc->dmatag, sc->map[j]); - return (err); out: for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); - return (EIO); + + sx_xunlock(&sc->xfer_mtx); + + return (err); } static void at91_spi_intr(void *arg) { - struct at91_spi_softc *sc = (struct at91_spi_softc*)arg; - uint32_t sr; + struct at91_spi_softc *sc; + uint32_t mask, sr; + sc = (struct at91_spi_softc*)arg; + + mask = sc->xfer_mask; sr = RD4(sc, SPI_SR) & RD4(sc, SPI_IMR); - if (sr & SPI_SR_ENDRX) { - sc->rxdone++; - WR4(sc, SPI_IDR, SPI_SR_ENDRX); - wakeup(&sc->rxdone); + if ((sr & mask) != 0) { + sc->xfer_done |= sr & mask; + WR4(sc, SPI_IDR, mask); + wakeup(&sc->xfer_done); } - if (sr & ~SPI_SR_ENDRX) { + if ((sr & ~mask) != 0) { device_printf(sc->dev, "Unexpected ISR %#x\n", sr); - WR4(sc, SPI_IDR, sr & ~SPI_SR_ENDRX); + WR4(sc, SPI_IDR, sr & ~mask); } } @@ -293,7 +410,8 @@ static device_method_t at91_spi_methods[ /* spibus interface */ DEVMETHOD(spibus_transfer, at91_spi_transfer), - { 0, 0 } + + DEVMETHOD_END }; static driver_t at91_spi_driver = { @@ -302,4 +420,5 @@ static driver_t at91_spi_driver = { sizeof(struct at91_spi_softc), }; -DRIVER_MODULE(at91_spi, atmelarm, at91_spi_driver, at91_spi_devclass, 0, 0); +DRIVER_MODULE(at91_spi, atmelarm, at91_spi_driver, at91_spi_devclass, NULL, + NULL); Modified: stable/9/sys/arm/at91/at91_spireg.h ============================================================================== --- stable/9/sys/arm/at91/at91_spireg.h Thu Jun 14 20:02:54 2012 (r237094) +++ stable/9/sys/arm/at91/at91_spireg.h Thu Jun 14 20:05:12 2012 (r237095) @@ -54,6 +54,8 @@ #define SPI_SR_ENDTX 0x00020 #define SPI_SR_RXBUFF 0x00040 #define SPI_SR_TXBUFE 0x00080 +#define SPI_SR_NSSR 0x00100 +#define SPI_SR_TXEMPTY 0x00200 #define SPI_SR_SPIENS 0x10000 #define SPI_IER 0x14 /* IER: Interrupt Enable Regsiter */ #define SPI_IDR 0x18 /* IDR: Interrupt Disable Regsiter */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 20:05:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 764701065670; Thu, 14 Jun 2012 20:05:13 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 211188FC1B; Thu, 14 Jun 2012 20:05:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EK5Dkr016226; Thu, 14 Jun 2012 20:05:13 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EK5DhQ016223; Thu, 14 Jun 2012 20:05:13 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142005.q5EK5DhQ016223@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237096 - stable/8/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:05:13 -0000 Author: marius Date: Thu Jun 14 20:05:12 2012 New Revision: 237096 URL: http://svn.freebsd.org/changeset/base/237096 Log: MFC: r236495 - Prepend the device description with "AT91" to reflect its nature. [1] - Move DMA tag and map creature to at91_spi_activate() where the other resource allocation also lives. [1] - Flesh out at91_spi_deactivate(). [1] - Work around the "Software Reset must be Written Twice" erratum. - For now, run the bus at the slowest speed possible in order to work around data corruption on transit even seen with 9 MHz on ETHERNUT5 (15 MHz maximum) and AT45DB321D (20 MHz maximum). This also serves as a poor man's work-around for the "NPCSx rises if no data data is to be transmitted" erratum of RM9200. Being able to use the appropriate bus speed would require: 1) Adding a proper work-around for the RM9200 bug consisting of taking the chip select control away from the SPI peripheral and managing it directly as a GPIO line. 2) Taking the maximum frequencies supported by the actual board and the slave devices into account and basing the whole thing on the master clock instead of hardcoding a divisor as previously done. 3) Fixing the above mentioned data corruption. - KASSERT that TX/RX command and data sizes match on transfers. - Introduce a mutex ensuring that only one child device is running a SPI transfer at a time. [1] - Add preliminary, #ifdef'ed out support for setting the chip select. [1] - Use the RX instead of the TX commando size when setting up the RX side of a transfer. - For controllers having SPI_SR_TXEMPTY, i.e. !RM9200, also wait for the completion of the TX part of transfers before stopping the whole thing again. - Use DEVMETHOD_END. [1] - Use NULL instead of 0 for pointers. [1, partially] Additional testing by: Ian Lepore Submitted by: Ian Lepore [1] Modified: stable/8/sys/arm/at91/at91_spi.c stable/8/sys/arm/at91/at91_spireg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/arm/at91/at91_spi.c ============================================================================== --- stable/8/sys/arm/at91/at91_spi.c Thu Jun 14 20:05:12 2012 (r237095) +++ stable/8/sys/arm/at91/at91_spi.c Thu Jun 14 20:05:12 2012 (r237096) @@ -1,5 +1,7 @@ /*- - * Copyright (c) 2006 M. Warner Losh. All rights reserved. + * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2011-2012 Ian Lepore. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,17 +33,21 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include #include +#include + #include #include #include +#include #include + #include "spibus_if.h" struct at91_spi_softc @@ -50,29 +56,39 @@ struct at91_spi_softc void *intrhand; /* Interrupt handle */ struct resource *irq_res; /* IRQ resource */ struct resource *mem_res; /* Memory resource */ - bus_dma_tag_t dmatag; /* bus dma tag for mbufs */ + bus_dma_tag_t dmatag; /* bus dma tag for transfers */ bus_dmamap_t map[4]; /* Maps for the transaction */ - int rxdone; + struct sx xfer_mtx; /* Enforce one transfer at a time */ + uint32_t xfer_mask; /* Bits to wait on for completion */ + uint32_t xfer_done; /* interrupt<->mainthread signaling */ }; +#define CS_TO_MR(cs) ((~(1 << (cs)) & 0x0f) << 16) + static inline uint32_t RD4(struct at91_spi_softc *sc, bus_size_t off) { - return bus_read_4(sc->mem_res, off); + + return (bus_read_4(sc->mem_res, off)); } static inline void WR4(struct at91_spi_softc *sc, bus_size_t off, uint32_t val) { + bus_write_4(sc->mem_res, off, val); } /* bus entry points */ -static int at91_spi_probe(device_t dev); static int at91_spi_attach(device_t dev); static int at91_spi_detach(device_t dev); +static int at91_spi_probe(device_t dev); +static int at91_spi_transfer(device_t dev, device_t child, + struct spi_command *cmd); /* helper routines */ +static void at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, + int error); static int at91_spi_activate(device_t dev); static void at91_spi_deactivate(device_t dev); static void at91_spi_intr(void *arg); @@ -80,43 +96,64 @@ static void at91_spi_intr(void *arg); static int at91_spi_probe(device_t dev) { - device_set_desc(dev, "SPI"); + + device_set_desc(dev, "AT91 SPI"); return (0); } static int at91_spi_attach(device_t dev) { - struct at91_spi_softc *sc = device_get_softc(dev); - int err, i; + struct at91_spi_softc *sc; + int err; + uint32_t csr; + + sc = device_get_softc(dev); sc->dev = dev; + sx_init(&sc->xfer_mtx, device_get_nameunit(dev)); + + /* + * Allocate resources. + */ err = at91_spi_activate(dev); if (err) goto out; /* - * Allocate DMA tags and maps + * Set up the hardware. */ - err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 2058, 1, - 2048, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); - if (err != 0) - goto out; - for (i = 0; i < 4; i++) { - err = bus_dmamap_create(sc->dmatag, 0, &sc->map[i]); - if (err != 0) - goto out; - } - // reset the SPI + sc->xfer_mask = SPI_SR_RXBUFF | (at91_is_rm92() ? 0 : SPI_SR_TXEMPTY); + WR4(sc, SPI_CR, SPI_CR_SWRST); + /* "Software Reset must be Written Twice" erratum */ WR4(sc, SPI_CR, SPI_CR_SWRST); WR4(sc, SPI_IDR, 0xffffffff); WR4(sc, SPI_MR, (0xf << 24) | SPI_MR_MSTR | SPI_MR_MODFDIS | - (0xE << 16)); + CS_TO_MR(0)); + + /* + * For now, run the bus at the slowest speed possible as otherwise we + * may encounter data corruption on transmit as seen with ETHERNUT5 + * and AT45DB321D even though both board and slave device can take + * more. + * This also serves as a work-around for the "NPCSx rises if no data + * data is to be transmitted" erratum. The ideal workaround for the + * latter is to take the chip select control away from the peripheral + * and manage it directly as a GPIO line. The easy solution is to + * slow down the bus so dramatically that it just never gets starved + * as may be seen when the OCHI controller is running and consuming + * memory and APB bandwidth. + * Also, currently we lack a way for lettting both the board and the + * slave devices take their maximum supported SPI clocks into account. + */ + csr = SPI_CSR_CPOL | (4 << 16) | (0xff << 8); + WR4(sc, SPI_CSR0, csr); + WR4(sc, SPI_CSR1, csr); + WR4(sc, SPI_CSR2, csr); + WR4(sc, SPI_CSR3, csr); - WR4(sc, SPI_CSR0, SPI_CSR_CPOL | (4 << 16) | (2 << 8)); WR4(sc, SPI_CR, SPI_CR_SPIEN); WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS); @@ -143,6 +180,7 @@ out: static int at91_spi_detach(device_t dev) { + return (EBUSY); /* XXX */ } @@ -150,26 +188,41 @@ static int at91_spi_activate(device_t dev) { struct at91_spi_softc *sc; - int rid, err = ENOMEM; + int err, i, rid; sc = device_get_softc(dev); + err = ENOMEM; + rid = 0; sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem_res == NULL) - goto errout; + goto out; + rid = 0; sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); if (sc->irq_res == NULL) - goto errout; + goto out; err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, at91_spi_intr, sc, &sc->intrhand); if (err != 0) - goto errout; - return (0); -errout: - at91_spi_deactivate(dev); + goto out; + + err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 2048, 1, + 2048, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->dmatag); + if (err != 0) + goto out; + + for (i = 0; i < 4; i++) { + err = bus_dmamap_create(sc->dmatag, 0, &sc->map[i]); + if (err != 0) + goto out; + } +out: + if (err != 0) + at91_spi_deactivate(dev); return (err); } @@ -177,26 +230,37 @@ static void at91_spi_deactivate(device_t dev) { struct at91_spi_softc *sc; + int i; sc = device_get_softc(dev); + bus_generic_detach(dev); + + for (i = 0; i < 4; i++) + if (sc->map[i]) + bus_dmamap_destroy(sc->dmatag, sc->map[i]); + + if (sc->dmatag) + bus_dma_tag_destroy(sc->dmatag); + if (sc->intrhand) bus_teardown_intr(dev, sc->irq_res, sc->intrhand); - sc->intrhand = 0; - bus_generic_detach(sc->dev); - if (sc->mem_res) - bus_release_resource(dev, SYS_RES_IOPORT, - rman_get_rid(sc->mem_res), sc->mem_res); - sc->mem_res = 0; + sc->intrhand = NULL; if (sc->irq_res) bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(sc->irq_res), sc->irq_res); - sc->irq_res = 0; - return; + sc->irq_res = NULL; + + if (sc->mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->mem_res), sc->mem_res); + sc->mem_res = NULL; } static void -at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +at91_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs __unused, + int error) { + if (error != 0) return; *(bus_addr_t *)arg = segs[0].ds_addr; @@ -206,80 +270,133 @@ static int at91_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) { struct at91_spi_softc *sc; - int i, j, rxdone, err, mode[4]; bus_addr_t addr; + int err, i, j, mode[4]; + uint32_t mask; + + KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, + ("%s: TX/RX command sizes should be equal", __func__)); + KASSERT(cmd->tx_data_sz == cmd->rx_data_sz, + ("%s: TX/RX data sizes should be equal", __func__)); sc = device_get_softc(dev); - WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); i = 0; - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_cmd, - cmd->tx_cmd_sz, at91_getaddr, &addr, 0) != 0) + + sx_xlock(&sc->xfer_mtx); + + /* + * Disable transfers while we set things up. + */ + WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); + +#ifdef SPI_CHIPSEL_SUPPORT + if (cmd->cs < 0 || cmd->cs > 3) { + device_printf(dev, + "Invalid chip select %d requested by %s\n", cmd->cs, + device_get_nameunit(child)); + err = EINVAL; + goto out; + } +#ifdef SPI_CHIP_SELECT_HIGH_SUPPORT + if (at91_is_rm92() && cmd->cs == 0 && + (cmd->flags & SPI_CHIP_SELECT_HIGH) != 0) { + device_printf(dev, + "Invalid chip select high requested by %s\n", + device_get_nameunit(child)); + err = EINVAL; + goto out; + } +#endif + WR4(sc, SPI_MR, (RD4(sc, SPI_MR) & ~0x000f0000) | CS_TO_MR(cmd->cs)); +#endif + + /* + * Set up the TX side of the transfer. + */ + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_cmd, + cmd->tx_cmd_sz, at91_getaddr, &addr, 0)) != 0) goto out; WR4(sc, PDC_TPR, addr); WR4(sc, PDC_TCR, cmd->tx_cmd_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREWRITE); mode[i++] = BUS_DMASYNC_POSTWRITE; if (cmd->tx_data_sz > 0) { - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->tx_data, - cmd->tx_data_sz, at91_getaddr, &addr, 0) != 0) + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], + cmd->tx_data, cmd->tx_data_sz, at91_getaddr, &addr, 0)) != + 0) goto out; WR4(sc, PDC_TNPR, addr); WR4(sc, PDC_TNCR, cmd->tx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREWRITE); mode[i++] = BUS_DMASYNC_POSTWRITE; } - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_cmd, - cmd->tx_cmd_sz, at91_getaddr, &addr, 0) != 0) + + /* + * Set up the RX side of the transfer. + */ + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_cmd, + cmd->rx_cmd_sz, at91_getaddr, &addr, 0)) != 0) goto out; WR4(sc, PDC_RPR, addr); - WR4(sc, PDC_RCR, cmd->tx_cmd_sz); + WR4(sc, PDC_RCR, cmd->rx_cmd_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; if (cmd->rx_data_sz > 0) { - if (bus_dmamap_load(sc->dmatag, sc->map[i], cmd->rx_data, - cmd->tx_data_sz, at91_getaddr, &addr, 0) != 0) + if ((err = bus_dmamap_load(sc->dmatag, sc->map[i], + cmd->rx_data, cmd->rx_data_sz, at91_getaddr, &addr, 0)) != + 0) goto out; WR4(sc, PDC_RNPR, addr); WR4(sc, PDC_RNCR, cmd->rx_data_sz); bus_dmamap_sync(sc->dmatag, sc->map[i], BUS_DMASYNC_PREREAD); mode[i++] = BUS_DMASYNC_POSTREAD; } - WR4(sc, SPI_IER, SPI_SR_ENDRX); + + /* + * Start the transfer, wait for it to complete. + */ + sc->xfer_done = 0; + mask = sc->xfer_mask; + WR4(sc, SPI_IER, mask); WR4(sc, PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); + do + err = tsleep(&sc->xfer_done, PCATCH | PZERO, "at91_spi", hz); + while (sc->xfer_done != mask && err != EINTR); - rxdone = sc->rxdone; - do { - err = tsleep(&sc->rxdone, PCATCH | PZERO, "spi", hz); - } while (rxdone == sc->rxdone && err != EINTR); + /* + * Stop the transfer and clean things up. + */ WR4(sc, PDC_PTCR, PDC_PTCR_TXTDIS | PDC_PTCR_RXTDIS); - if (err == 0) { - for (j = 0; j < i; j++) + if (err == 0) + for (j = 0; j < i; j++) bus_dmamap_sync(sc->dmatag, sc->map[j], mode[j]); - } - for (j = 0; j < i; j++) - bus_dmamap_unload(sc->dmatag, sc->map[j]); - return (err); out: for (j = 0; j < i; j++) bus_dmamap_unload(sc->dmatag, sc->map[j]); - return (EIO); + + sx_xunlock(&sc->xfer_mtx); + + return (err); } static void at91_spi_intr(void *arg) { - struct at91_spi_softc *sc = (struct at91_spi_softc*)arg; - uint32_t sr; + struct at91_spi_softc *sc; + uint32_t mask, sr; + sc = (struct at91_spi_softc*)arg; + + mask = sc->xfer_mask; sr = RD4(sc, SPI_SR) & RD4(sc, SPI_IMR); - if (sr & SPI_SR_ENDRX) { - sc->rxdone++; - WR4(sc, SPI_IDR, SPI_SR_ENDRX); - wakeup(&sc->rxdone); + if ((sr & mask) != 0) { + sc->xfer_done |= sr & mask; + WR4(sc, SPI_IDR, mask); + wakeup(&sc->xfer_done); } - if (sr & ~SPI_SR_ENDRX) { + if ((sr & ~mask) != 0) { device_printf(sc->dev, "Unexpected ISR %#x\n", sr); - WR4(sc, SPI_IDR, sr & ~SPI_SR_ENDRX); + WR4(sc, SPI_IDR, sr & ~mask); } } @@ -293,7 +410,8 @@ static device_method_t at91_spi_methods[ /* spibus interface */ DEVMETHOD(spibus_transfer, at91_spi_transfer), - { 0, 0 } + + DEVMETHOD_END }; static driver_t at91_spi_driver = { @@ -302,4 +420,5 @@ static driver_t at91_spi_driver = { sizeof(struct at91_spi_softc), }; -DRIVER_MODULE(at91_spi, atmelarm, at91_spi_driver, at91_spi_devclass, 0, 0); +DRIVER_MODULE(at91_spi, atmelarm, at91_spi_driver, at91_spi_devclass, NULL, + NULL); Modified: stable/8/sys/arm/at91/at91_spireg.h ============================================================================== --- stable/8/sys/arm/at91/at91_spireg.h Thu Jun 14 20:05:12 2012 (r237095) +++ stable/8/sys/arm/at91/at91_spireg.h Thu Jun 14 20:05:12 2012 (r237096) @@ -54,6 +54,8 @@ #define SPI_SR_ENDTX 0x00020 #define SPI_SR_RXBUFF 0x00040 #define SPI_SR_TXBUFE 0x00080 +#define SPI_SR_NSSR 0x00100 +#define SPI_SR_TXEMPTY 0x00200 #define SPI_SR_SPIENS 0x10000 #define SPI_IER 0x14 /* IER: Interrupt Enable Regsiter */ #define SPI_IDR 0x18 /* IDR: Interrupt Disable Regsiter */ From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 20:27:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0BC4F106566C; Thu, 14 Jun 2012 20:27:29 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id EA3448FC0C; Thu, 14 Jun 2012 20:27:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EKRSmY017382; Thu, 14 Jun 2012 20:27:28 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EKRSev017379; Thu, 14 Jun 2012 20:27:28 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142027.q5EKRSev017379@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237098 - in head/gnu/lib: libgomp libstdc++ X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:27:29 -0000 Author: marius Date: Thu Jun 14 20:27:28 2012 New Revision: 237098 URL: http://svn.freebsd.org/changeset/base/237098 Log: Turn on TLS support for arm on here as it is supported since r231618/ r231619 and working since r233106. Modified: head/gnu/lib/libgomp/config.h head/gnu/lib/libstdc++/config.h Modified: head/gnu/lib/libgomp/config.h ============================================================================== --- head/gnu/lib/libgomp/config.h Thu Jun 14 20:20:59 2012 (r237097) +++ head/gnu/lib/libgomp/config.h Thu Jun 14 20:27:28 2012 (r237098) @@ -59,7 +59,7 @@ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if the target supports thread-local storage. */ -#if !defined(__arm__) && !defined(__mips__) +#if !defined(__mips__) #define HAVE_TLS 1 #endif Modified: head/gnu/lib/libstdc++/config.h ============================================================================== --- head/gnu/lib/libstdc++/config.h Thu Jun 14 20:20:59 2012 (r237097) +++ head/gnu/lib/libstdc++/config.h Thu Jun 14 20:27:28 2012 (r237098) @@ -371,7 +371,7 @@ /* #undef HAVE_TANL */ /* Define to 1 if the target supports thread-local storage. */ -#if !defined(__arm__) && !defined(__mips__) +#if !defined(__mips__) #define HAVE_TLS 1 #endif From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 20:29:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F0A6106564A; Thu, 14 Jun 2012 20:29:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 29E728FC18; Thu, 14 Jun 2012 20:29:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EKTocB017514; Thu, 14 Jun 2012 20:29:50 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EKTnWL017512; Thu, 14 Jun 2012 20:29:49 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142029.q5EKTnWL017512@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:29:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237099 - head/contrib/gcc/config/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:29:50 -0000 Author: marius Date: Thu Jun 14 20:29:49 2012 New Revision: 237099 URL: http://svn.freebsd.org/changeset/base/237099 Log: Merge r236137 from x86: Enable GNU hash generation for dynamic ELF binaries. Modified: head/contrib/gcc/config/arm/freebsd.h Modified: head/contrib/gcc/config/arm/freebsd.h ============================================================================== --- head/contrib/gcc/config/arm/freebsd.h Thu Jun 14 20:27:28 2012 (r237098) +++ head/contrib/gcc/config/arm/freebsd.h Thu Jun 14 20:29:49 2012 (r237099) @@ -50,6 +50,7 @@ %{rdynamic:-export-dynamic} \ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ %{static:-Bstatic}} \ + %{!static:--hash-style=both} \ %{symbolic:-Bsymbolic} \ -X %{mbig-endian:-EB} %{mlittle-endian:-EL}" From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 20:44:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6A4831065672; Thu, 14 Jun 2012 20:44:57 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 51BC38FC1A; Thu, 14 Jun 2012 20:44:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EKivqt018285; Thu, 14 Jun 2012 20:44:57 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EKivWa018281; Thu, 14 Jun 2012 20:44:57 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201206142044.q5EKivWa018281@svn.freebsd.org> From: "David E. O'Brien" Date: Thu, 14 Jun 2012 20:44:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237100 - in stable/9: tools/regression/usr.bin/make tools/regression/usr.bin/make/variables/modifier_t tools/regression/usr.bin/make/variables/opt_V usr.bin/make X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:44:57 -0000 Author: obrien Date: Thu Jun 14 20:44:56 2012 New Revision: 237100 URL: http://svn.freebsd.org/changeset/base/237100 Log: MFC: r236338, r236339, r236346, r236347, r236365, & r236977 * Deprecate the FreeBSD make's ":U" (to-upper case) and ":L" (to-lower case) modifiers for ":tu" and ":tl". * make it easier to test newly-built make. * Add "-V '${VAR}'" variable expansion from Portable Berkeley Make. * regression test for '-V' command line option and the :t[lu] modifiers. Added: stable/9/tools/regression/usr.bin/make/test-new.mk - copied unchanged from r236339, head/tools/regression/usr.bin/make/test-new.mk stable/9/tools/regression/usr.bin/make/variables/modifier_t/ - copied from r236977, head/tools/regression/usr.bin/make/variables/modifier_t/ stable/9/tools/regression/usr.bin/make/variables/opt_V/ - copied from r236347, head/tools/regression/usr.bin/make/variables/opt_V/ Modified: stable/9/usr.bin/make/Makefile stable/9/usr.bin/make/make.1 stable/9/usr.bin/make/var.c Directory Properties: stable/9/ (props changed) stable/9/tools/ (props changed) stable/9/tools/regression/usr.bin/make/all.sh (props changed) stable/9/usr.bin/ (props changed) stable/9/usr.bin/make/ (props changed) Copied: stable/9/tools/regression/usr.bin/make/test-new.mk (from r236339, head/tools/regression/usr.bin/make/test-new.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/usr.bin/make/test-new.mk Thu Jun 14 20:44:56 2012 (r237100, copy of r236339, head/tools/regression/usr.bin/make/test-new.mk) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +NEW_DIR!= make -C ${.CURDIR}/../../../../usr.bin/make -V .OBJDIR + +all: + rm -rf /tmp/${USER}.make.test + env MAKE_PROG=${NEW_DIR}/make ${.SHELL} ./all.sh + +.include Modified: stable/9/usr.bin/make/Makefile ============================================================================== --- stable/9/usr.bin/make/Makefile Thu Jun 14 20:29:49 2012 (r237099) +++ stable/9/usr.bin/make/Makefile Thu Jun 14 20:44:56 2012 (r237100) @@ -14,7 +14,9 @@ SRCS= arch.c buf.c cond.c dir.c for.c ha NO_SHARED?= YES .endif -CFLAGS+=-DMAKE_VERSION=\"5200408120\" +# Version has the RYYYYMMDDX format, where R is from RELENG_ +CFLAGS+=-DMAKE_VERSION=\"9201120530\" + # There is no obvious performance improvement currently. # CFLAGS+=-DUSE_KQUEUE Modified: stable/9/usr.bin/make/make.1 ============================================================================== --- stable/9/usr.bin/make/make.1 Thu Jun 14 20:29:49 2012 (r237099) +++ stable/9/usr.bin/make/make.1 Thu Jun 14 20:44:56 2012 (r237100) @@ -32,7 +32,7 @@ .\" @(#)make.1 8.8 (Berkeley) 6/13/95 .\" $FreeBSD$ .\" -.Dd November 5, 2011 +.Dd May 30, 2012 .Dt MAKE 1 .Os .Sh NAME @@ -320,6 +320,11 @@ Do not build any targets. Multiple instances of this option may be specified; the variables will be printed one per line, with a blank line for each null or undefined variable. +If +.Ar variable +contains a +.Sq Ic $ +then the value will be expanded before printing. .It Fl v Be extra verbose. Print any extra information. @@ -902,6 +907,7 @@ Replaces each word in the variable with Replaces each word in the variable with everything but the last component. .It Cm :L Converts variable to lower-case letters. +(deprecated) .It Cm :M Ns Ar pattern Select only those words that match the rest of the modifier. The standard shell wildcard characters @@ -993,8 +999,13 @@ to be replaced in .Ar new_string . .It Cm :T Replaces each word in the variable with its last component. +.It Cm :tl +Converts variable to lower-case letters. +.It Cm :tu +Converts variable to upper-case letters. .It Cm :U Converts variable to upper-case letters. +(deprecated) .It Cm :u Remove adjacent duplicate words (like .Xr uniq 1 ) . @@ -1742,6 +1753,19 @@ is set to the same value as .Va .MAKE ; support for this may be removed in the future. .Pp +The use of the +.Cm :L +and +.Cm :U +modifiers will be deprecated +in +.Fx 10.0 +and the more portable (among Pmake decedents) +.Cm :tl +and +.Cm :tu +should be used instead. +.Pp Most of the more esoteric features of .Nm should probably be avoided for greater compatibility. Modified: stable/9/usr.bin/make/var.c ============================================================================== --- stable/9/usr.bin/make/var.c Thu Jun 14 20:29:49 2012 (r237099) +++ stable/9/usr.bin/make/var.c Thu Jun 14 20:44:56 2012 (r237100) @@ -1746,6 +1746,19 @@ ParseModifier(VarParser *vp, char startc case 'C': newStr = modifier_C(vp, value, v); break; + case 't': + /* :tl :tu for OSF ODE & NetBSD make compatibility */ + switch (vp->ptr[1]) { + case 'l': + vp->ptr++; + goto mod_lower; + break; + case 'u': + vp->ptr++; + goto mod_upper; + break; + } + /* FALLTHROUGH */ default: if (vp->ptr[1] != endc && vp->ptr[1] != ':') { #ifdef SUNSHCMD @@ -1774,6 +1787,7 @@ ParseModifier(VarParser *vp, char startc switch (vp->ptr[0]) { case 'L': + mod_lower: { const char *cp; Buffer *buf; @@ -1799,6 +1813,7 @@ ParseModifier(VarParser *vp, char startc vp->ptr++; break; case 'U': + mod_upper: { const char *cp; Buffer *buf; @@ -2578,7 +2593,7 @@ void Var_Print(Lst *vlist, Boolean expandVars) { LstNode *n; - const char *name; + char *name; LST_FOREACH(n, vlist) { name = Lst_Datum(n); @@ -2586,13 +2601,17 @@ Var_Print(Lst *vlist, Boolean expandVars char *value; char *v; - v = emalloc(strlen(name) + 1 + 3); - sprintf(v, "${%s}", name); - + if (*name == '$') { + v = name; + } else { + v = emalloc(strlen(name) + 1 + 3); + sprintf(v, "${%s}", name); + } value = Buf_Peel(Var_Subst(v, VAR_GLOBAL, FALSE)); printf("%s\n", value); - free(v); + if (v != name) + free(v); free(value); } else { const char *value = Var_Value(name, VAR_GLOBAL); From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 20:49:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E72B106566B; Thu, 14 Jun 2012 20:49:23 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E3F538FC0C; Thu, 14 Jun 2012 20:49:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EKnMAr018515; Thu, 14 Jun 2012 20:49:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EKnMGw018512; Thu, 14 Jun 2012 20:49:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142049.q5EKnMGw018512@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 20:49:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237101 - head/sys/dev/sym X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 20:49:23 -0000 Author: marius Date: Thu Jun 14 20:49:22 2012 New Revision: 237101 URL: http://svn.freebsd.org/changeset/base/237101 Log: Fix a braino in r236469; the number of DMA tags required for handling MAXPHYS should be based on PAGE_SIZE rather than SYM_CONF_DMA_BOUNDARY. While at it, reuse the SYM_CONF_MAX_SG macro for specifying the maximum number of DMA tags so sym(4) itself doesn't size memory beyond what's required for handling MAXPHYS. PR: 168928 MFC after: 3 days Modified: head/sys/dev/sym/sym_conf.h head/sys/dev/sym/sym_hipd.c Modified: head/sys/dev/sym/sym_conf.h ============================================================================== --- head/sys/dev/sym/sym_conf.h Thu Jun 14 20:44:56 2012 (r237100) +++ head/sys/dev/sym/sym_conf.h Thu Jun 14 20:49:22 2012 (r237101) @@ -90,11 +90,12 @@ #define SYM_CONF_DMA_BOUNDARY (1UL << 24) /* - * Max number of scatter/gather entries for en IO. + * Max number of scatter/gather entries for an I/O. * Each entry costs 8 bytes in the internal CCB data structure. - * For now 65 should suffice given the BSD O/Ses capabilities. + * We use at most 33 segments but also no more than required for handling + * MAXPHYS. */ -#define SYM_CONF_MAX_SG (33) +#define SYM_CONF_MAX_SG (MIN(33, (MAXPHYS / PAGE_SIZE) + 1)) /* * Max number of targets. Modified: head/sys/dev/sym/sym_hipd.c ============================================================================== --- head/sys/dev/sym/sym_hipd.c Thu Jun 14 20:44:56 2012 (r237100) +++ head/sys/dev/sym/sym_hipd.c Thu Jun 14 20:49:22 2012 (r237101) @@ -1609,7 +1609,6 @@ struct sym_hcb { u_int features; /* Chip features map */ u_char myaddr; /* SCSI id of the adapter */ u_char maxburst; /* log base 2 of dwords burst */ - u_char maxsegcnt; /* Max DMA S/G segments */ u_char maxwide; /* Maximum transfer width */ u_char minsync; /* Min sync period factor (ST) */ u_char maxsync; /* Max sync period factor (ST) */ @@ -8135,7 +8134,7 @@ static void sym_action2(struct cam_sim * cpi->xport_specific.spi.ppr_options = SID_SPI_CLOCK_DT_ST; } - cpi->maxio = np->maxsegcnt * SYM_CONF_DMA_BOUNDARY; + cpi->maxio = SYM_CONF_MAX_SG * PAGE_SIZE; sym_xpt_done2(np, ccb, CAM_REQ_CMP); break; case XPT_ABORT: @@ -8536,11 +8535,9 @@ sym_pci_attach(device_t dev) /* * Allocate a tag for the DMA of user data. */ - np->maxsegcnt = MIN(SYM_CONF_MAX_SG, - (MAXPHYS / SYM_CONF_DMA_BOUNDARY) + 1); if (bus_dma_tag_create(np->bus_dmat, 1, SYM_CONF_DMA_BOUNDARY, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - BUS_SPACE_MAXSIZE, np->maxsegcnt, SYM_CONF_DMA_BOUNDARY, + BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, BUS_DMA_ALLOCNOW, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { device_printf(dev, "failed to create DMA tag.\n"); goto attach_failed; From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 21:16:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B5C9106566B; Thu, 14 Jun 2012 21:16:20 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E8A138FC12; Thu, 14 Jun 2012 21:16:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ELGJsr021325; Thu, 14 Jun 2012 21:16:19 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ELGJ15021321; Thu, 14 Jun 2012 21:16:19 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142116.q5ELGJ15021321@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 21:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237102 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 21:16:20 -0000 Author: marius Date: Thu Jun 14 21:16:19 2012 New Revision: 237102 URL: http://svn.freebsd.org/changeset/base/237102 Log: - Add support for the FT2232 based egnite Turtelizer 2 JTAG/RS232 Adapter. This includes adding support for skipping FTDI interfaces used for JTAG leaving them for userland and just attaching to the RS232 half, similarly to how the corresponding Linux drivers handles these kind of adapters. While at it, sort uftdi_devs and return BUS_PROBE_SPECIFIC (because uftdi_probe() alters the instance variables for better or worse as do other probe routines of USB drivers) instead of 0. - Remove duplicated entries for BeagleBone. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers. - Remove some stray lines. MFC after: 3 days Modified: head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/uftdi_reg.h head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Thu Jun 14 20:49:22 2012 (r237101) +++ head/sys/dev/usb/serial/uftdi.c Thu Jun 14 21:16:19 2012 (r237102) @@ -81,7 +81,7 @@ SYSCTL_INT(_hw_usb_uftdi, OID_AUTO, debu #endif #define UFTDI_CONFIG_INDEX 0 -#define UFTDI_IFACE_INDEX 0 +#define UFTDI_IFACE_INDEX_JTAG 0 #define UFTDI_OBUFSIZE 64 /* bytes, cannot be increased due to * do size encoding */ @@ -102,10 +102,10 @@ struct uftdi_softc { struct mtx sc_mtx; uint32_t sc_unit; - enum uftdi_type sc_type; uint16_t sc_last_lcr; + uint8_t sc_type; uint8_t sc_iface_index; uint8_t sc_hdrlen; uint8_t sc_msr; @@ -190,7 +190,7 @@ static device_method_t uftdi_methods[] = DEVMETHOD(device_attach, uftdi_attach), DEVMETHOD(device_detach, uftdi_detach), - {0, 0} + DEVMETHOD_END }; static devclass_t uftdi_devclass; @@ -201,59 +201,61 @@ static driver_t uftdi_driver = { .size = sizeof(struct uftdi_softc), }; -DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); +DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, NULL); MODULE_DEPEND(uftdi, ucom, 1, 1, 1); MODULE_DEPEND(uftdi, usb, 1, 1, 1); MODULE_VERSION(uftdi, 1); -static STRUCT_USB_HOST_ID uftdi_devs[] = { -#define UFTDI_DEV(v,p,t) \ - { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, UFTDI_TYPE_##t) } - UFTDI_DEV(ATMEL, STK541, 8U232AM), - UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, 8U232AM), - UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, 8U232AM), - UFTDI_DEV(FALCOM, TWIST, 8U232AM), - UFTDI_DEV(FTDI, GAMMASCOUT, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U100AX, SIO), - UFTDI_DEV(FTDI, SERIAL_2232C, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_2232D, 8U232AM), - UFTDI_DEV(FTDI, BEAGLEBONE, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_4232H, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U232AM, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_8U232AM4, 8U232AM), - UFTDI_DEV(FTDI, SERIAL_BEAGLEBONE, 8U232AM), - UFTDI_DEV(FTDI, SEMC_DSS20, 8U232AM), - UFTDI_DEV(FTDI, CFA_631, 8U232AM), - UFTDI_DEV(FTDI, CFA_632, 8U232AM), - UFTDI_DEV(FTDI, CFA_633, 8U232AM), - UFTDI_DEV(FTDI, CFA_634, 8U232AM), - UFTDI_DEV(FTDI, CFA_635, 8U232AM), - UFTDI_DEV(FTDI, USB_UIRT, 8U232AM), - UFTDI_DEV(FTDI, USBSERIAL, 8U232AM), - UFTDI_DEV(FTDI, KBS, 8U232AM), - UFTDI_DEV(FTDI, MX2_3, 8U232AM), - UFTDI_DEV(FTDI, MX4_5, 8U232AM), - UFTDI_DEV(FTDI, LK202, 8U232AM), - UFTDI_DEV(FTDI, LK204, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13M, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13S, 8U232AM), - UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13U, 8U232AM), - UFTDI_DEV(FTDI, EISCOU, 8U232AM), - UFTDI_DEV(FTDI, UOPTBR, 8U232AM), - UFTDI_DEV(FTDI, EMCU2D, 8U232AM), - UFTDI_DEV(FTDI, PCMSFU, 8U232AM), - UFTDI_DEV(FTDI, EMCU2H, 8U232AM), - UFTDI_DEV(FTDI, MAXSTREAM, 8U232AM), - UFTDI_DEV(FTDI, CTI_USB_NANO_485, 8U232AM), - UFTDI_DEV(FTDI, CTI_USB_MINI_485, 8U232AM), - UFTDI_DEV(SIIG2, US2308, 8U232AM), - UFTDI_DEV(INTREPIDCS, VALUECAN, 8U232AM), - UFTDI_DEV(INTREPIDCS, NEOVI, 8U232AM), - UFTDI_DEV(BBELECTRONICS, USOTL4, 8U232AM), - UFTDI_DEV(MATRIXORBITAL, MOUA, 8U232AM), - UFTDI_DEV(MARVELL, SHEEVAPLUG, 8U232AM), - UFTDI_DEV(MELCO, PCOPRS1, 8U232AM), - UFTDI_DEV(RATOC, REXUSB60F, 8U232AM), +static const STRUCT_USB_HOST_ID uftdi_devs[] = { +#define UFTDI_DEV(v, p, i) \ + { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + UFTDI_DEV(ATMEL, STK541, UFTDI_TYPE_8U232AM), + UFTDI_DEV(BBELECTRONICS, USOTL4, UFTDI_TYPE_8U232AM), + UFTDI_DEV(DRESDENELEKTRONIK, SENSORTERMINALBOARD, + UFTDI_TYPE_8U232AM), + UFTDI_DEV(DRESDENELEKTRONIK, WIRELESSHANDHELDTERMINAL, + UFTDI_TYPE_8U232AM), + UFTDI_DEV(FALCOM, TWIST, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, BEAGLEBONE, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_631, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_632, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_633, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_634, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CFA_635, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CTI_USB_MINI_485, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, CTI_USB_NANO_485, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EISCOU, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EMCU2D, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, EMCU2H, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, GAMMASCOUT, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, KBS, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, LK202, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, LK204, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MAXSTREAM, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MX2_3, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, MX4_5, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, PCMSFU, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SEMC_DSS20, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_2232C, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_2232D, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_4232H, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_8U100AX, UFTDI_TYPE_SIO), + UFTDI_DEV(FTDI, SERIAL_8U232AM, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, SERIAL_8U232AM4, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13M, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13S, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TACTRIX_OPENPORT_13U, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, TURTELIZER2, UFTDI_TYPE_8U232AM | UFTDI_FLAG_JTAG), + UFTDI_DEV(FTDI, UOPTBR, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, USBSERIAL, UFTDI_TYPE_8U232AM), + UFTDI_DEV(FTDI, USB_UIRT, UFTDI_TYPE_8U232AM), + UFTDI_DEV(INTREPIDCS, NEOVI, UFTDI_TYPE_8U232AM), + UFTDI_DEV(INTREPIDCS, VALUECAN, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MARVELL, SHEEVAPLUG, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MATRIXORBITAL, MOUA, UFTDI_TYPE_8U232AM), + UFTDI_DEV(MELCO, PCOPRS1, UFTDI_TYPE_8U232AM), + UFTDI_DEV(RATOC, REXUSB60F, UFTDI_TYPE_8U232AM), + UFTDI_DEV(SIIG2, US2308, UFTDI_TYPE_8U232AM) #undef UFTDI_DEV }; @@ -261,6 +263,7 @@ static int uftdi_probe(device_t dev) { struct usb_attach_arg *uaa = device_get_ivars(dev); + const struct usb_device_id *id; if (uaa->usb_mode != USB_MODE_HOST) { return (ENXIO); @@ -268,9 +271,18 @@ uftdi_probe(device_t dev) if (uaa->info.bConfigIndex != UFTDI_CONFIG_INDEX) { return (ENXIO); } - /* attach to all present interfaces */ - return (usbd_lookup_id_by_uaa(uftdi_devs, sizeof(uftdi_devs), uaa)); + /* + * Attach to all present interfaces unless this is a JTAG one, which + * we leave for userland. + */ + id = usbd_lookup_id_by_info(uftdi_devs, sizeof(uftdi_devs), + &uaa->info); + if (id == NULL || ((id->driver_info & UFTDI_FLAG_JTAG) != 0 && + uaa->info.bIfaceIndex == UFTDI_IFACE_INDEX_JTAG)) + return (ENXIO); + uaa->driver_info = id->driver_info; + return (BUS_PROBE_SPECIFIC); } static int @@ -293,7 +305,7 @@ uftdi_attach(device_t dev) DPRINTF("\n"); sc->sc_iface_index = uaa->info.bIfaceIndex; - sc->sc_type = USB_GET_DRIVER_INFO(uaa); + sc->sc_type = USB_GET_DRIVER_INFO(uaa) & UFTDI_TYPE_MASK; switch (sc->sc_type) { case UFTDI_TYPE_SIO: @@ -562,6 +574,7 @@ static int uftdi_set_parm_soft(struct termios *t, struct uftdi_param_config *cfg, uint8_t type) { + memset(cfg, 0, sizeof(*cfg)); switch (type) { @@ -824,5 +837,6 @@ static void uftdi_poll(struct ucom_softc *ucom) { struct uftdi_softc *sc = ucom->sc_parent; + usbd_transfer_poll(sc->sc_xfer, UFTDI_N_TRANSFER); } Modified: head/sys/dev/usb/serial/uftdi_reg.h ============================================================================== --- head/sys/dev/usb/serial/uftdi_reg.h Thu Jun 14 20:49:22 2012 (r237101) +++ head/sys/dev/usb/serial/uftdi_reg.h Thu Jun 14 21:16:19 2012 (r237102) @@ -35,10 +35,12 @@ #define FTDI_PIT_SIOB 2 /* SIOB */ #define FTDI_PIT_PARALLEL 3 /* Parallel */ -enum uftdi_type { - UFTDI_TYPE_SIO, - UFTDI_TYPE_8U232AM -}; +/* Values for driver_info */ +#define UFTDI_TYPE_MASK 0x000000ff +#define UFTDI_TYPE_SIO 0x00000001 +#define UFTDI_TYPE_8U232AM 0x00000002 +#define UFTDI_FLAG_MASK 0x0000ff00 +#define UFTDI_FLAG_JTAG 0x00000100 /* * BmRequestType: 0100 0000B @@ -63,14 +65,11 @@ enum uftdi_type { * baud and data format not reset * * The Purge RX and TX buffer commands affect nothing except the buffers - * */ /* FTDI_SIO_RESET */ #define FTDI_SIO_RESET_SIO 0 #define FTDI_SIO_RESET_PURGE_RX 1 #define FTDI_SIO_RESET_PURGE_TX 2 - - /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_SET_BAUDRATE @@ -134,8 +133,6 @@ enum { #define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11) #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) #define FTDI_SIO_SET_BREAK (0x1 << 14) - - /* * BmRequestType: 0100 0000B * bRequest: FTDI_SIO_MODEM_CTRL @@ -171,8 +168,6 @@ enum { #define FTDI_SIO_SET_RTS_MASK 0x2 #define FTDI_SIO_SET_RTS_HIGH (2 | ( FTDI_SIO_SET_RTS_MASK << 8)) #define FTDI_SIO_SET_RTS_LOW (0 | ( FTDI_SIO_SET_RTS_MASK << 8)) - - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_FLOW_CTRL @@ -202,8 +197,6 @@ enum { #define FTDI_SIO_RTS_CTS_HS 0x1 #define FTDI_SIO_DTR_DSR_HS 0x2 #define FTDI_SIO_XON_XOFF_HS 0x4 - - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_EVENT_CHAR @@ -226,9 +219,6 @@ enum { * data read so far - rather than wait 40ms or until 62 bytes are read * which is what normally happens. */ - - - /* * BmRequestType: 0100 0000b * bRequest: FTDI_SIO_SET_ERROR_CHAR @@ -243,14 +233,10 @@ enum { * 0 = disabled * 1 = enabled * B9..15 Reserved - * - * * FTDI_SIO_SET_ERROR_CHAR * Set the parity error replacement character for the specified communications * port. */ - - /* * BmRequestType: 1100 0000b * bRequest: FTDI_SIO_GET_MODEM_STATUS @@ -281,9 +267,6 @@ enum { #define FTDI_SIO_DSR_MASK 0x20 #define FTDI_SIO_RI_MASK 0x40 #define FTDI_SIO_RLSD_MASK 0x80 - - - /* * * DATA FORMAT @@ -317,8 +300,6 @@ enum { * B5 Transmitter Holding Register (THRE) * B6 Transmitter Empty (TEMT) * B7 Error in RCVR FIFO - * - * * OUT Endpoint * * This device reserves the first bytes of data on this endpoint contain the @@ -330,7 +311,6 @@ enum { * Offset Description * B0..1 Port * B2..7 Length of message - (not including Byte 0) - * */ #define FTDI_PORT_MASK 0x0f #define FTDI_MSR_MASK 0xf0 Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Thu Jun 14 20:49:22 2012 (r237101) +++ head/sys/dev/usb/usbdevs Thu Jun 14 21:16:19 2012 (r237102) @@ -1612,9 +1612,9 @@ product FTDI SERIAL_8U232AM 0x6001 8U232 product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial product FTDI SERIAL_2232D 0x9e90 FT2232D Dual port Serial -product FTDI BEAGLEBONE 0xA6D0 BeagleBone product FTDI SERIAL_4232H 0x6011 FT4232H Quad port Serial -product FTDI SERIAL_BEAGLEBONE 0xa6d0 BeagleBone FTDI Serial +product FTDI BEAGLEBONE 0xa6d0 BeagleBone +product FTDI TURTELIZER2 0xbdc8 egnite Turtelizer 2 JTAG/RS232 Adapter /* Gude Analog- und Digitalsysteme products also uses FTDI's id: */ product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi product FTDI TACTRIX_OPENPORT_13S 0xcc49 OpenPort 1.3 Subaru From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 21:35:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A4DE1065672; Thu, 14 Jun 2012 21:35:21 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 346AA8FC14; Thu, 14 Jun 2012 21:35:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ELZLWd022272; Thu, 14 Jun 2012 21:35:21 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ELZLpc022270; Thu, 14 Jun 2012 21:35:21 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201206142135.q5ELZLpc022270@svn.freebsd.org> From: Andrew Thompson Date: Thu, 14 Jun 2012 21:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237103 - stable/9/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 21:35:21 -0000 Author: thompsa Date: Thu Jun 14 21:35:20 2012 New Revision: 237103 URL: http://svn.freebsd.org/changeset/base/237103 Log: MFC r236916 Fix a panic I introduced in r234487, the bridge softc pointer is set to null early in the detach so rearrange things not to explode. Reported by: David Roffiaen, Gustau Perez Querol Modified: stable/9/sys/net/if_bridge.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/net/if_bridge.c ============================================================================== --- stable/9/sys/net/if_bridge.c Thu Jun 14 21:16:19 2012 (r237102) +++ stable/9/sys/net/if_bridge.c Thu Jun 14 21:35:20 2012 (r237103) @@ -334,6 +334,7 @@ static int bridge_ip6_checkbasic(struct static int bridge_fragment(struct ifnet *, struct mbuf *, struct ether_header *, int, struct llc *); static void bridge_linkstate(struct ifnet *ifp); +static void bridge_linkcheck(struct bridge_softc *sc); extern void (*bridge_linkstate_p)(struct ifnet *ifp); @@ -964,6 +965,7 @@ bridge_delete_member(struct bridge_softc EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); } + bridge_linkcheck(sc); bridge_mutecaps(sc); /* recalcuate now this interface is removed */ bridge_rtdelete(sc, ifs, IFBF_FLUSHALL); KASSERT(bif->bif_addrcnt == 0, @@ -993,7 +995,6 @@ bridge_delete_member(struct bridge_softc bridge_set_ifcap(sc, bif, bif->bif_savedcaps); } bstp_destroy(&bif->bif_stp); /* prepare to free */ - bridge_linkstate(ifs); BRIDGE_LOCK(sc); free(bif, M_DEVBUF); } @@ -1092,18 +1093,17 @@ bridge_ioctl_add(struct bridge_softc *sc /* Set interface capabilities to the intersection set of all members */ bridge_mutecaps(sc); + bridge_linkcheck(sc); - BRIDGE_UNLOCK(sc); - /* Update the linkstate for the bridge */ - bridge_linkstate(ifs); /* Place the interface into promiscuous mode */ switch (ifs->if_type) { case IFT_ETHER: case IFT_L2VLAN: + BRIDGE_UNLOCK(sc); error = ifpromisc(ifs, 1); + BRIDGE_LOCK(sc); break; } - BRIDGE_LOCK(sc); if (error) bridge_delete_member(sc, bif, 0); out: @@ -3486,8 +3486,7 @@ static void bridge_linkstate(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_bridge; - struct bridge_iflist *bif, *bif2; - int new_link, hasls; + struct bridge_iflist *bif; BRIDGE_LOCK(sc); bif = bridge_lookup_member_if(sc, ifp); @@ -3495,13 +3494,26 @@ bridge_linkstate(struct ifnet *ifp) BRIDGE_UNLOCK(sc); return; } + bridge_linkcheck(sc); + BRIDGE_UNLOCK(sc); + + bstp_linkstate(&bif->bif_stp); +} + +static void +bridge_linkcheck(struct bridge_softc *sc) +{ + struct bridge_iflist *bif; + int new_link, hasls; + + BRIDGE_LOCK_ASSERT(sc); new_link = LINK_STATE_DOWN; hasls = 0; /* Our link is considered up if at least one of our ports is active */ - LIST_FOREACH(bif2, &sc->sc_iflist, bif_next) { - if (bif2->bif_ifp->if_capabilities & IFCAP_LINKSTATE) + LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + if (bif->bif_ifp->if_capabilities & IFCAP_LINKSTATE) hasls++; - if (bif2->bif_ifp->if_link_state == LINK_STATE_UP) { + if (bif->bif_ifp->if_link_state == LINK_STATE_UP) { new_link = LINK_STATE_UP; break; } @@ -3511,8 +3523,4 @@ bridge_linkstate(struct ifnet *ifp) new_link = LINK_STATE_UP; } if_link_state_change(sc->sc_ifp, new_link); - BRIDGE_UNLOCK(sc); - - bstp_linkstate(&bif->bif_stp); } - From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 21:36:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7CAC2106567D; Thu, 14 Jun 2012 21:36:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 64AB98FC14; Thu, 14 Jun 2012 21:36:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ELaHOj022351; Thu, 14 Jun 2012 21:36:17 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ELaHv8022348; Thu, 14 Jun 2012 21:36:17 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201206142136.q5ELaHv8022348@svn.freebsd.org> From: Andrew Thompson Date: Thu, 14 Jun 2012 21:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237104 - in stable/8/sys: net netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 21:36:17 -0000 Author: thompsa Date: Thu Jun 14 21:36:16 2012 New Revision: 237104 URL: http://svn.freebsd.org/changeset/base/237104 Log: MFC r236916 Fix a panic I introduced in r234487, the bridge softc pointer is set to null early in the detach so rearrange things not to explode. Reported by: David Roffiaen, Gustau Perez Querol Modified: stable/8/sys/net/if_bridge.c stable/8/sys/netinet/ip_carp.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/net/if_bridge.c ============================================================================== --- stable/8/sys/net/if_bridge.c Thu Jun 14 21:35:20 2012 (r237103) +++ stable/8/sys/net/if_bridge.c Thu Jun 14 21:36:16 2012 (r237104) @@ -334,6 +334,7 @@ static int bridge_ip6_checkbasic(struct static int bridge_fragment(struct ifnet *, struct mbuf *, struct ether_header *, int, struct llc *); static void bridge_linkstate(struct ifnet *ifp); +static void bridge_linkcheck(struct bridge_softc *sc); extern void (*bridge_linkstate_p)(struct ifnet *ifp); @@ -964,6 +965,7 @@ bridge_delete_member(struct bridge_softc EVENTHANDLER_INVOKE(iflladdr_event, sc->sc_ifp); } + bridge_linkcheck(sc); bridge_mutecaps(sc); /* recalcuate now this interface is removed */ bridge_rtdelete(sc, ifs, IFBF_FLUSHALL); KASSERT(bif->bif_addrcnt == 0, @@ -993,7 +995,6 @@ bridge_delete_member(struct bridge_softc bridge_set_ifcap(sc, bif, bif->bif_savedcaps); } bstp_destroy(&bif->bif_stp); /* prepare to free */ - bridge_linkstate(ifs); BRIDGE_LOCK(sc); free(bif, M_DEVBUF); } @@ -1092,18 +1093,17 @@ bridge_ioctl_add(struct bridge_softc *sc /* Set interface capabilities to the intersection set of all members */ bridge_mutecaps(sc); + bridge_linkcheck(sc); - BRIDGE_UNLOCK(sc); - /* Update the linkstate for the bridge */ - bridge_linkstate(ifs); /* Place the interface into promiscuous mode */ switch (ifs->if_type) { case IFT_ETHER: case IFT_L2VLAN: + BRIDGE_UNLOCK(sc); error = ifpromisc(ifs, 1); + BRIDGE_LOCK(sc); break; } - BRIDGE_LOCK(sc); if (error) bridge_delete_member(sc, bif, 0); out: @@ -3485,8 +3485,7 @@ static void bridge_linkstate(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_bridge; - struct bridge_iflist *bif, *bif2; - int new_link, hasls; + struct bridge_iflist *bif; BRIDGE_LOCK(sc); bif = bridge_lookup_member_if(sc, ifp); @@ -3494,13 +3493,26 @@ bridge_linkstate(struct ifnet *ifp) BRIDGE_UNLOCK(sc); return; } + bridge_linkcheck(sc); + BRIDGE_UNLOCK(sc); + + bstp_linkstate(&bif->bif_stp); +} + +static void +bridge_linkcheck(struct bridge_softc *sc) +{ + struct bridge_iflist *bif; + int new_link, hasls; + + BRIDGE_LOCK_ASSERT(sc); new_link = LINK_STATE_DOWN; hasls = 0; /* Our link is considered up if at least one of our ports is active */ - LIST_FOREACH(bif2, &sc->sc_iflist, bif_next) { - if (bif2->bif_ifp->if_capabilities & IFCAP_LINKSTATE) + LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { + if (bif->bif_ifp->if_capabilities & IFCAP_LINKSTATE) hasls++; - if (bif2->bif_ifp->if_link_state == LINK_STATE_UP) { + if (bif->bif_ifp->if_link_state == LINK_STATE_UP) { new_link = LINK_STATE_UP; break; } @@ -3510,8 +3522,4 @@ bridge_linkstate(struct ifnet *ifp) new_link = LINK_STATE_UP; } if_link_state_change(sc->sc_ifp, new_link); - BRIDGE_UNLOCK(sc); - - bstp_linkstate(&bif->bif_stp); } - Modified: stable/8/sys/netinet/ip_carp.c ============================================================================== --- stable/8/sys/netinet/ip_carp.c Thu Jun 14 21:35:20 2012 (r237103) +++ stable/8/sys/netinet/ip_carp.c Thu Jun 14 21:36:16 2012 (r237104) @@ -100,6 +100,7 @@ struct carp_softc { #ifdef INET6 struct in6_ifaddr *sc_ia6; /* primary iface address v6 */ struct ip6_moptions sc_im6o; + struct in6_ifaddr *sc_llia; #endif /* INET6 */ TAILQ_ENTRY(carp_softc) sc_list; @@ -1239,6 +1240,16 @@ carp_iamatch6(struct ifnet *ifp, struct cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { + if (IN6_ARE_ADDR_EQUAL(taddr, + &vh->sc_llia->ia_addr.sin6_addr) && + (SC2IFP(vh)->if_flags & IFF_UP) && + (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING) && + vh->sc_state == MASTER) { + ifa = &vh->sc_llia->ia_addr; + ifa_ref(ifa); + CARP_UNLOCK(cif); + return (ifa); + } IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, @@ -1270,6 +1281,28 @@ carp_macmatch6(struct ifnet *ifp, struct cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) { + if (IN6_ARE_ADDR_EQUAL(taddr, + sc->sc_llia->ia_addr.sin6_addr) && + (SC2IFP(sc)->if_flags & IFF_UP) && + (SC2IFP(sc)->if_drv_flags & IFF_DRV_RUNNING) && + sc->sc_state == MASTER) { + struct ifnet *ifp = SC2IFP(sc); + mtag = m_tag_get(PACKET_TAG_CARP, + sizeof(struct ifnet *), M_NOWAIT); + if (mtag == NULL) { + /* better a bit than nothing */ + IF_ADDR_RUNLOCK(SC2IFP(sc)); + CARP_UNLOCK(cif); + return (IF_LLADDR(sc->sc_ifp)); + } + bcopy(&ifp, (caddr_t)(mtag + 1), + sizeof(struct ifnet *)); + m_tag_prepend(m, mtag); + + IF_ADDR_RUNLOCK(SC2IFP(sc)); + CARP_UNLOCK(cif); + return (IF_LLADDR(sc->sc_ifp)); + } IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, @@ -1749,6 +1782,33 @@ carp_set_addr6(struct carp_softc *sc, st goto cleanup; im6o->im6o_membership[1] = in6m; im6o->im6o_num_memberships++; + + /* Add link local */ + bzero(&ifra, sizeof(ifra)); + ifra.ifra_addr.sin6_family = AF_INET6; + ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_addr.sin6_addr.s6_addr32[0] = htonl(0xfe800000); + ifra.ifra_addr.sin6_addr.s6_addr32[1] = 0; + if ((error = in6_get_hw_ifid(sc->sc_ifp, NULL, &ifra.ifra_addr.sin6_addr)) != 0) + goto cleanup; + if ((error = in6_setscope(&ifra.ifra_addr.sin6_addr, ifp, NULL))) + goto cleanup; + ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); + ifra.ifra_prefixmask.sin6_family = AF_INET6; + ifra.ifra_prefixmask.sin6_addr = in6mask64; + /* link-local addresses should NEVER expire. */ + ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; + ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; + + if ((error = in6_update_ifa(ifp, &ifra, NULL, + IN6_IFAUPDATE_DADDELAY)) != 0) + goto cleanup; + sc->sc_llia = in6ifa_ifpwithaddr(ifp, &ifra->ifra_addr.sin6_addr); + if (sc->sc_llia == NULL) { + error = ESRCH; + goto cleanup; + } + ifa_free(&sc->sc_llia->ia_ifa); } if (!ifp->if_carp) { From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 21:40:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3346B1065672; Thu, 14 Jun 2012 21:40:15 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 142298FC0C; Thu, 14 Jun 2012 21:40:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ELeEJx022580; Thu, 14 Jun 2012 21:40:14 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ELeE6l022578; Thu, 14 Jun 2012 21:40:14 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201206142140.q5ELeE6l022578@svn.freebsd.org> From: Andrew Thompson Date: Thu, 14 Jun 2012 21:40:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237105 - stable/8/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 21:40:15 -0000 Author: thompsa Date: Thu Jun 14 21:40:14 2012 New Revision: 237105 URL: http://svn.freebsd.org/changeset/base/237105 Log: Revert an inintended change in r237104 Modified: stable/8/sys/netinet/ip_carp.c Modified: stable/8/sys/netinet/ip_carp.c ============================================================================== --- stable/8/sys/netinet/ip_carp.c Thu Jun 14 21:36:16 2012 (r237104) +++ stable/8/sys/netinet/ip_carp.c Thu Jun 14 21:40:14 2012 (r237105) @@ -100,7 +100,6 @@ struct carp_softc { #ifdef INET6 struct in6_ifaddr *sc_ia6; /* primary iface address v6 */ struct ip6_moptions sc_im6o; - struct in6_ifaddr *sc_llia; #endif /* INET6 */ TAILQ_ENTRY(carp_softc) sc_list; @@ -1240,16 +1239,6 @@ carp_iamatch6(struct ifnet *ifp, struct cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { - if (IN6_ARE_ADDR_EQUAL(taddr, - &vh->sc_llia->ia_addr.sin6_addr) && - (SC2IFP(vh)->if_flags & IFF_UP) && - (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING) && - vh->sc_state == MASTER) { - ifa = &vh->sc_llia->ia_addr; - ifa_ref(ifa); - CARP_UNLOCK(cif); - return (ifa); - } IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, @@ -1281,28 +1270,6 @@ carp_macmatch6(struct ifnet *ifp, struct cif = ifp->if_carp; CARP_LOCK(cif); TAILQ_FOREACH(sc, &cif->vhif_vrs, sc_list) { - if (IN6_ARE_ADDR_EQUAL(taddr, - sc->sc_llia->ia_addr.sin6_addr) && - (SC2IFP(sc)->if_flags & IFF_UP) && - (SC2IFP(sc)->if_drv_flags & IFF_DRV_RUNNING) && - sc->sc_state == MASTER) { - struct ifnet *ifp = SC2IFP(sc); - mtag = m_tag_get(PACKET_TAG_CARP, - sizeof(struct ifnet *), M_NOWAIT); - if (mtag == NULL) { - /* better a bit than nothing */ - IF_ADDR_RUNLOCK(SC2IFP(sc)); - CARP_UNLOCK(cif); - return (IF_LLADDR(sc->sc_ifp)); - } - bcopy(&ifp, (caddr_t)(mtag + 1), - sizeof(struct ifnet *)); - m_tag_prepend(m, mtag); - - IF_ADDR_RUNLOCK(SC2IFP(sc)); - CARP_UNLOCK(cif); - return (IF_LLADDR(sc->sc_ifp)); - } IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { if (IN6_ARE_ADDR_EQUAL(taddr, @@ -1782,33 +1749,6 @@ carp_set_addr6(struct carp_softc *sc, st goto cleanup; im6o->im6o_membership[1] = in6m; im6o->im6o_num_memberships++; - - /* Add link local */ - bzero(&ifra, sizeof(ifra)); - ifra.ifra_addr.sin6_family = AF_INET6; - ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); - ifra.ifra_addr.sin6_addr.s6_addr32[0] = htonl(0xfe800000); - ifra.ifra_addr.sin6_addr.s6_addr32[1] = 0; - if ((error = in6_get_hw_ifid(sc->sc_ifp, NULL, &ifra.ifra_addr.sin6_addr)) != 0) - goto cleanup; - if ((error = in6_setscope(&ifra.ifra_addr.sin6_addr, ifp, NULL))) - goto cleanup; - ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); - ifra.ifra_prefixmask.sin6_family = AF_INET6; - ifra.ifra_prefixmask.sin6_addr = in6mask64; - /* link-local addresses should NEVER expire. */ - ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; - ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; - - if ((error = in6_update_ifa(ifp, &ifra, NULL, - IN6_IFAUPDATE_DADDELAY)) != 0) - goto cleanup; - sc->sc_llia = in6ifa_ifpwithaddr(ifp, &ifra->ifra_addr.sin6_addr); - if (sc->sc_llia == NULL) { - error = ESRCH; - goto cleanup; - } - ifa_free(&sc->sc_llia->ia_ifa); } if (!ifp->if_carp) { From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 21:48:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E5F4106566B; Thu, 14 Jun 2012 21:48:15 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 4808C8FC08; Thu, 14 Jun 2012 21:48:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5ELmFOa023004; Thu, 14 Jun 2012 21:48:15 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ELmFul023002; Thu, 14 Jun 2012 21:48:15 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201206142148.q5ELmFul023002@svn.freebsd.org> From: Guy Helmer Date: Thu, 14 Jun 2012 21:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237106 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 21:48:15 -0000 Author: ghelmer Date: Thu Jun 14 21:48:14 2012 New Revision: 237106 URL: http://svn.freebsd.org/changeset/base/237106 Log: MFC 235739-235740,236402: Apply style(9) to return and switch/case statements. Add checks for memory allocation failures in appropriate places, and avoid creating bad entries in the grp list as a result of memory allocation failures while building new entries. Style(9) improvements: remove unnecessary parenthesis, improve order of local variable declarations, remove bogus casts, and resolve long lines. PR: bin/83340 Modified: stable/9/lib/libc/gen/getnetgrent.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/gen/getnetgrent.c ============================================================================== --- stable/9/lib/libc/gen/getnetgrent.c Thu Jun 14 21:40:14 2012 (r237105) +++ stable/9/lib/libc/gen/getnetgrent.c Thu Jun 14 21:48:14 2012 (r237106) @@ -203,9 +203,7 @@ setnetgrent(const char *group) if (parse_netgrp(group)) endnetgrent(); else { - grouphead.grname = (char *) - malloc(strlen(group) + 1); - strcpy(grouphead.grname, group); + grouphead.grname = strdup(group); } if (netf) fclose(netf); @@ -292,12 +290,12 @@ _listmatch(const char *list, const char while(*ptr != ',' && *ptr != '\0' && !isspace((unsigned char)*ptr)) ptr++; if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr)) - return(1); + return (1); while(*ptr == ',' || isspace((unsigned char)*ptr)) ptr++; } - return(0); + return (0); } static int @@ -311,32 +309,37 @@ _revnetgr_lookup(char* lookupdom, char* for (rot = 0; ; rot++) { switch (rot) { - case(0): snprintf(key, MAXHOSTNAMELEN, "%s.%s", - str, dom?dom:lookupdom); - break; - case(1): snprintf(key, MAXHOSTNAMELEN, "%s.*", - str); - break; - case(2): snprintf(key, MAXHOSTNAMELEN, "*.%s", - dom?dom:lookupdom); - break; - case(3): snprintf(key, MAXHOSTNAMELEN, "*.*"); - break; - default: return(0); + case 0: + snprintf(key, MAXHOSTNAMELEN, "%s.%s", str, + dom ? dom : lookupdom); + break; + case 1: + snprintf(key, MAXHOSTNAMELEN, "%s.*", str); + break; + case 2: + snprintf(key, MAXHOSTNAMELEN, "*.%s", + dom ? dom : lookupdom); + break; + case 3: + snprintf(key, MAXHOSTNAMELEN, "*.*"); + break; + default: + return (0); } y = yp_match(lookupdom, map, key, strlen(key), &result, - &resultlen); + &resultlen); if (y == 0) { rv = _listmatch(result, group, resultlen); free(result); - if (rv) return(1); + if (rv) + return (1); } else if (y != YPERR_KEY) { /* * If we get an error other than 'no * such key in map' then something is * wrong and we should stop the search. */ - return(-1); + return (-1); } } } @@ -386,14 +389,14 @@ innetgr(const char *group, const char *h if (_use_only_yp && (host == NULL) != (user == NULL)) { int ret; if(yp_get_default_domain(&_netgr_yp_domain)) - return(0); + return (0); ret = _revnetgr_lookup(_netgr_yp_domain, host?"netgroup.byhost":"netgroup.byuser", host?host:user, dom, group); if (ret == 1) - return(1); + return (1); else if (ret == 0 && dom != NULL) - return(0); + return (0); } setnetgrent(group); @@ -416,14 +419,14 @@ innetgr(const char *group, const char *h static int parse_netgrp(const char *group) { - char *spos, *epos; - int len, strpos; + struct netgrp *grp; + struct linelist *lp = linehead; + char **ng; + char *epos, *gpos, *pos, *spos; + int freepos, len, strpos; #ifdef DEBUG int fields; #endif - char *pos, *gpos; - struct netgrp *grp; - struct linelist *lp = linehead; /* * First, see if the line has already been read in. @@ -453,43 +456,51 @@ parse_netgrp(const char *group) /* Watch for null pointer dereferences, dammit! */ while (pos != NULL && *pos != '\0') { if (*pos == '(') { - grp = (struct netgrp *)malloc(sizeof (struct netgrp)); - bzero((char *)grp, sizeof (struct netgrp)); - grp->ng_next = grouphead.gr; - grouphead.gr = grp; + grp = malloc(sizeof(*grp)); + if (grp == NULL) + return (1); + ng = grp->ng_str; + bzero(grp, sizeof(*grp)); pos++; gpos = strsep(&pos, ")"); #ifdef DEBUG fields = 0; #endif for (strpos = 0; strpos < 3; strpos++) { - if ((spos = strsep(&gpos, ","))) { -#ifdef DEBUG - fields++; -#endif - while (*spos == ' ' || *spos == '\t') - spos++; - if ((epos = strpbrk(spos, " \t"))) { - *epos = '\0'; - len = epos - spos; - } else - len = strlen(spos); - if (len > 0) { - grp->ng_str[strpos] = (char *) - malloc(len + 1); - bcopy(spos, grp->ng_str[strpos], - len + 1); - } - } else { + if ((spos = strsep(&gpos, ",")) == NULL) { /* * All other systems I've tested * return NULL for empty netgroup * fields. It's up to user programs * to handle the NULLs appropriately. */ - grp->ng_str[strpos] = NULL; + ng[strpos] = NULL; + continue; } +#ifdef DEBUG + fields++; +#endif + while (*spos == ' ' || *spos == '\t') + spos++; + if ((epos = strpbrk(spos, " \t"))) { + *epos = '\0'; + len = epos - spos; + } else + len = strlen(spos); + if (len <= 0) + continue; + ng[strpos] = malloc(len + 1); + if (ng[strpos] == NULL) { + for (freepos = 0; freepos < strpos; + freepos++) + free(ng[freepos]); + free(grp); + return (1); + } + bcopy(spos, ng[strpos], len + 1); } + grp->ng_next = grouphead.gr; + grouphead.gr = grp; #ifdef DEBUG /* * Note: on other platforms, malformed netgroup @@ -497,14 +508,15 @@ parse_netgrp(const char *group) * can catch bad entries and report them, we should * stay silent by default for compatibility's sake. */ - if (fields < 3) - fprintf(stderr, "Bad entry (%s%s%s%s%s) in netgroup \"%s\"\n", - grp->ng_str[NG_HOST] == NULL ? "" : grp->ng_str[NG_HOST], - grp->ng_str[NG_USER] == NULL ? "" : ",", - grp->ng_str[NG_USER] == NULL ? "" : grp->ng_str[NG_USER], - grp->ng_str[NG_DOM] == NULL ? "" : ",", - grp->ng_str[NG_DOM] == NULL ? "" : grp->ng_str[NG_DOM], - lp->l_groupname); + if (fields < 3) { + fprintf(stderr, + "Bad entry (%s%s%s%s%s) in netgroup \"%s\"\n", + ng[NG_HOST] == NULL ? "" : ng[NG_HOST], + ng[NG_USER] == NULL ? "" : ",", + ng[NG_USER] == NULL ? "" : ng[NG_USER], + ng[NG_DOM] == NULL ? "" : ",", + ng[NG_DOM] == NULL ? "" : ng[NG_DOM], + lp->l_groupname); #endif } else { spos = strsep(&pos, ", \t"); @@ -526,7 +538,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep, *olinep; + char *pos, *spos, *linep; int len, olen; int cont; struct linelist *lp; @@ -534,6 +546,7 @@ read_for_group(const char *group) #ifdef YP char *result; int resultlen; + linep = NULL; while (_netgr_yp_enabled || fgets(line, LINSIZ, netf) != NULL) { if (_netgr_yp_enabled) { @@ -541,7 +554,7 @@ read_for_group(const char *group) if(yp_get_default_domain(&_netgr_yp_domain)) continue; if (yp_match(_netgr_yp_domain, "netgroup", group, - strlen(group), &result, &resultlen)) { + strlen(group), &result, &resultlen)) { free(result); if (_use_only_yp) return ((struct linelist *)0); @@ -554,6 +567,7 @@ read_for_group(const char *group) free(result); } #else + linep = NULL; while (fgets(line, LINSIZ, netf) != NULL) { #endif pos = (char *)&line; @@ -576,8 +590,14 @@ read_for_group(const char *group) pos++; if (*pos != '\n' && *pos != '\0') { lp = (struct linelist *)malloc(sizeof (*lp)); + if (lp == NULL) + return (NULL); lp->l_parsed = 0; lp->l_groupname = (char *)malloc(len + 1); + if (lp->l_groupname == NULL) { + free(lp); + return (NULL); + } bcopy(spos, lp->l_groupname, len); *(lp->l_groupname + len) = '\0'; len = strlen(pos); @@ -595,15 +615,15 @@ read_for_group(const char *group) } else cont = 0; if (len > 0) { - linep = (char *)malloc(olen + len + 1); - if (olen > 0) { - bcopy(olinep, linep, olen); - free(olinep); + linep = reallocf(linep, olen + len + 1); + if (linep == NULL) { + free(lp->l_groupname); + free(lp); + return (NULL); } bcopy(pos, linep + olen, len); olen += len; *(linep + olen) = '\0'; - olinep = linep; } if (cont) { if (fgets(line, LINSIZ, netf)) { @@ -634,5 +654,5 @@ read_for_group(const char *group) */ rewind(netf); #endif - return ((struct linelist *)0); + return (NULL); } From owner-svn-src-all@FreeBSD.ORG Thu Jun 14 22:19:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 88948106564A; Thu, 14 Jun 2012 22:19:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 747848FC0A; Thu, 14 Jun 2012 22:19:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5EMJOZN024473; Thu, 14 Jun 2012 22:19:24 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5EMJOvx024471; Thu, 14 Jun 2012 22:19:24 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201206142219.q5EMJOvx024471@svn.freebsd.org> From: Marius Strobl Date: Thu, 14 Jun 2012 22:19:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237107 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 22:19:24 -0000 Author: marius Date: Thu Jun 14 22:19:23 2012 New Revision: 237107 URL: http://svn.freebsd.org/changeset/base/237107 Log: - As a baind-aid, disable ATAPI DMA when using ATA_CAM for these controllers as well as it causes the kernel to hang during boot. Reported and tested by: Kevin Oberman - Use NULL instead of 0 for a pointer. MFC after: 3 days Modified: head/sys/dev/ata/chipsets/ata-ite.c Modified: head/sys/dev/ata/chipsets/ata-ite.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ite.c Thu Jun 14 21:48:14 2012 (r237106) +++ head/sys/dev/ata/chipsets/ata-ite.c Thu Jun 14 22:19:23 2012 (r237107) @@ -105,10 +105,10 @@ ata_ite_chipinit(device_t dev) ctlr->setmode = ata_ite_821x_setmode; /* No timing restrictions initally. */ - ctlr->chipset_data = (void *)0; + ctlr->chipset_data = NULL; } ctlr->ch_attach = ata_ite_ch_attach; - return 0; + return (0); } static int @@ -119,6 +119,9 @@ ata_ite_ch_attach(device_t dev) error = ata_pci_ch_attach(dev); ch->flags |= ATA_CHECKS_CABLE; +#ifdef ATA_CAM + ch->flags |= ATA_NO_ATAPI_DMA; +#endif return (error); } From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 01:16:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EE021065679; Fri, 15 Jun 2012 01:16:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 2A92B8FC12; Fri, 15 Jun 2012 01:16:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F1G0mA032596; Fri, 15 Jun 2012 01:16:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F1FxBr032594; Fri, 15 Jun 2012 01:15:59 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206150115.q5F1FxBr032594@svn.freebsd.org> From: Adrian Chadd Date: Fri, 15 Jun 2012 01:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237108 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 01:16:00 -0000 Author: adrian Date: Fri Jun 15 01:15:59 2012 New Revision: 237108 URL: http://svn.freebsd.org/changeset/base/237108 Log: Convert ath(4) to just use ieee80211_suspend_all() and ieee80211_resume_all(). The existing code tries to use the beacon miss timer to signal that the AP has gone away. Unfortunately this doesn't seem to be behaving itself. I'll try to investigate why this is for the sake of completeness. The result is the STA will stay "associated" to the AP it was associated with when it suspended. It never receives a bmiss notification so it never tries reassociating. PR: kern/169084 Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Jun 14 22:19:23 2012 (r237107) +++ head/sys/dev/ath/if_ath.c Fri Jun 15 01:15:59 2012 (r237108) @@ -1310,8 +1310,13 @@ ath_suspend(struct ath_softc *sc) sc->sc_resume_up = (ifp->if_flags & IFF_UP) != 0; if (ic->ic_opmode == IEEE80211_M_STA) + /* + * This has been disabled - see PR kern/169084. + */ +#if 0 ath_stop(ifp); else +#endif ieee80211_suspend_all(ic); /* * NB: don't worry about putting the chip in low power @@ -1379,6 +1384,15 @@ ath_resume(struct ath_softc *sc) ath_hal_setledstate(ah, HAL_LED_INIT); if (sc->sc_resume_up) { + /* + * This particular feature doesn't work at the present, + * at least on the 802.11n chips. It's quite possible + * that the STA Beacon timers aren't being configured + * properly. + * + * See PR kern/169084. + */ +#if 0 if (ic->ic_opmode == IEEE80211_M_STA) { ath_init(sc); ath_hal_setledstate(ah, HAL_LED_RUN); @@ -1392,7 +1406,9 @@ ath_resume(struct ath_softc *sc) */ ath_beacon_config(sc, NULL); sc->sc_syncbeacon = 1; + ieee80211_resume_all(ic); } else +#endif ieee80211_resume_all(ic); } From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 02:06:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69B52106566B; Fri, 15 Jun 2012 02:06:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id DBED08FC12; Fri, 15 Jun 2012 02:06:50 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5F26bGx018816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 Jun 2012 12:06:43 +1000 Date: Fri, 15 Jun 2012 12:06:32 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <201206141521.q5EFLwtT002192@svn.freebsd.org> Message-ID: <20120615111325.T999@besplex.bde.org> References: <201206141521.q5EFLwtT002192@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237070 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 02:06:51 -0000 On Thu, 14 Jun 2012, Pawel Jakub Dawidek wrote: > Log: > Style fixes. > > Reported by: bde > MFC after: 1 month Thanks, but these are mostly not what I reported, and are mostly backwards. > Modified: head/sys/kern/kern_descrip.c > ============================================================================== > --- head/sys/kern/kern_descrip.c Thu Jun 14 14:38:55 2012 (r237069) > +++ head/sys/kern/kern_descrip.c Thu Jun 14 15:21:57 2012 (r237070) > @@ -102,7 +102,7 @@ __FBSDID("$FreeBSD$"); > > static MALLOC_DEFINE(M_FILEDESC, "filedesc", "Open file descriptor table"); > static MALLOC_DEFINE(M_FILEDESC_TO_LEADER, "filedesc_to_leader", > - "file desc to leader structures"); > + "file desc to leader structures"); This is correct, though possibly incomplete (perhaps there should be a tab instead of a space after `static'). > static MALLOC_DEFINE(M_SIGIO, "sigio", "sigio structures"); > > MALLOC_DECLARE(M_FADVISE); > @@ -114,22 +114,21 @@ static uma_zone_t file_zone; > #define DUP_FIXED 0x1 /* Force fixed allocation */ > #define DUP_FCNTL 0x2 /* fcntl()-style errors */ Not fixed (space instead of tab after #define, and some smaller problems). > > -static int closefp(struct filedesc *fdp, int fd, struct file *fp, > +static int closefp(struct filedesc *fdp, int fd, struct file *fp, > struct thread *td, int holdleaders); What I reported was the broken indentation of the continuation line. The indentation starts relative to the function name (see stdlib.h), but was started relative to column 0. The change preserves this bug, and breaks the tabbing for the previous line. Without that tabbing, the function names don't line up, and continuation indentation relative to them would be similarly misaligned and thus worse than useless. Perhaps there should also be a space after `static', to line up the function types, but that was not used in old code so it is not a regression to leave it alone. > -static int do_dup(struct thread *td, int flags, int old, int new, > +static int do_dup(struct thread *td, int flags, int old, int new, > register_t *retval); > -static int fd_first_free(struct filedesc *, int, int); > -static int fd_last_used(struct filedesc *, int); > -static void fdgrowtable(struct filedesc *, int); The patch is hard to read since it breaks all the tabs. What I pointed out for these 3 prototypes is that they are missing function parameters, unlike all the other prototypes in this file. I also pointed out that some prototypes are unsorted. > -static void fdunused(struct filedesc *fdp, int fd); > -static void fdused(struct filedesc *fdp, int fd); > -static int fill_vnode_info(struct vnode *vp, struct kinfo_file *kif); > -static int fill_socket_info(struct socket *so, struct kinfo_file *kif); > -static int fill_pts_info(struct tty *tp, struct kinfo_file *kif); > -static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); > -static int fill_procdesc_info(struct procdesc *pdp, > - struct kinfo_file *kif); > -static int fill_shm_info(struct file *fp, struct kinfo_file *kif); > +static int fd_first_free(struct filedesc *fdp, int low, int size); > +static int fd_last_used(struct filedesc *fdp, int size); > +static void fdgrowtable(struct filedesc *fdp, int nfd); > +static void fdunused(struct filedesc *fdp, int fd); > +static void fdused(struct filedesc *fdp, int fd); > +static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); > +static int fill_procdesc_info(struct procdesc *pdp, struct kinfo_file *kif); > +static int fill_pts_info(struct tty *tp, struct kinfo_file *kif); > +static int fill_shm_info(struct file *fp, struct kinfo_file *kif); > +static int fill_socket_info(struct socket *so, struct kinfo_file *kif); > +static int fill_vnode_info(struct vnode *vp, struct kinfo_file *kif); I also pointed out namespace errors. Probably all functions in this file (except syscall entry points) should have a name beginning with fd. Some old ones do, and are named fdfoo(). Some not so old ones are slightly gratuitously different and are named fd_foo(). Many newer ones are named quite differently and much worse as fill_bar(). do_dup() is an old mistake in the same direction (put a generic verb first in the name to combine namespaces from unrelated subsystem). But fixing these old mistakes is beyond the scope of these fixes. > > /* > * A process is initially started out with NDFILE descriptors stored within > @@ -183,10 +182,10 @@ struct filedesc0 { > */ > volatile int openfiles; /* actual number of open files */ > struct mtx sigio_lock; /* mtx to protect pointers to sigio */ > -void (*mq_fdclose)(struct thread *td, int fd, struct file *fp); > +void (*mq_fdclose)(struct thread *td, int fd, struct file *fp); This had a tab in it. Now the tab is not so useful, since there are no nearby declarations to line up nicely with. The nearby declarations of openfiles and sigio lock were formatted without tabs. The would have needed 2 tabs to line up, since their type declaration is longer than 7 characters. > > /* A mutex to protect the association between a proc and filedesc. */ > -static struct mtx fdesc_mtx; > +static struct mtx fdesc_mtx; Another type declaration longer than 7 characters, but tabbing was used for it. This declaration is also unsorted (it isn't with the other static data declarations at the top of the file, and those are also missing tabbing). > > /* > * If low >= size, just return low. Otherwise find the first zero bit in the > indent(1) with suitable parameters can fix some of these bugs. OTOH, it is hard to vary the parameters to tell indent(1) to _not_ fix these bugs so as to use it to focus on more serious bugs. With my default parameters, it gives: % --- kern_descrip.c.BAK 2012-06-15 01:40:51.447682000 +0000 % +++ kern_descrip.c 2012-06-15 01:40:51.455672000 +0000 % @@ -103,2 +103,3 @@ % -static MALLOC_DEFINE(M_FILEDESC, "filedesc", "Open file descriptor table"); % -static MALLOC_DEFINE(M_FILEDESC_TO_LEADER, "filedesc_to_leader", % +static MALLOC_DEFINE(M_FILEDESC, "filedesc", "Open file descriptor table"); % +static % +MALLOC_DEFINE(M_FILEDESC_TO_LEADER, "filedesc_to_leader", Here it fixes the corrupted tab after `static'. It is conservative about this, and only uses tabs for short storage class specifiers and type declarators. It doesn't understand the MALLOC_DEFINE() obfuscation of a declaration, and messes up the second one. % @@ -106 +107 @@ % -static MALLOC_DEFINE(M_SIGIO, "sigio", "sigio structures"); % +static MALLOC_DEFINE(M_SIGIO, "sigio", "sigio structures"); Similarly. % @@ -114,2 +115,2 @@ % -#define DUP_FIXED 0x1 /* Force fixed allocation */ % -#define DUP_FCNTL 0x2 /* fcntl()-style errors */ % +#define DUP_FIXED 0x1 /* Force fixed allocation */ % +#define DUP_FCNTL 0x2 /* fcntl()-style errors */ It fixes these too. It makes unwanted changes to the comment indentation, since it parameters have to choose between -c33 or -c41 and both of these are in common use (I choose -c41 since this is slightly more common, but the above was formatted with -c33). % @@ -117 +118,2 @@ % -static int closefp(struct filedesc *fdp, int fd, struct file *fp, % +static int % +closefp(struct filedesc *fdp, int fd, struct file *fp, Here it starts mangling prototypes. It doesn't understand prototypes. % @@ -119 +121,2 @@ % -static int do_dup(struct thread *td, int flags, int old, int new, % +static int % +do_dup(struct thread *td, int flags, int old, int new, It mangles this too. Strangely, it doesn't touch any of the other prototypes. The above 2 are the only multi-line ones. Apparently they look like functions to indent. % @@ -157,2 +160,2 @@ % - struct file **ft_table; % - SLIST_ENTRY(freetable) ft_next; % + struct file **ft_table; % + SLIST_ENTRY(freetable) ft_next; Here it removes the fancy indentation for the first field of a struct member member name, since fancy indentation (anything other than a single tab after a short type declaration) is too hard. Then it is confused by the SLIST_ENTRY() obfuscation of a type declaration. % @@ -166 +169 @@ % - struct filedesc fd_fd; % + struct filedesc fd_fd; Here it fixes the mindless tabbing after the first word in a long type declaration. This tabbing used to be normal in KNF. It was typically between `struct' and the struct tag, as here. The FreeBSD replacement is to mostly not use tabs in declarations with long type names, and `struct foo' always gives a long type name. % @@ -170 +173 @@ % - SLIST_HEAD(,freetable) fd_free; % + SLIST_HEAD(, freetable) fd_free; It is confused as usual by macro obfuscations. % @@ -175 +178 @@ % - struct file *fd_dfiles[NDFILE]; % + struct file *fd_dfiles[NDFILE]; Another fix for old bogusness for a struct member (in the same struct as above). The tabs gave worse-than-useless alignment. % @@ -184,2 +187,2 @@ % -struct mtx sigio_lock; /* mtx to protect pointers to sigio */ % -void (*mq_fdclose)(struct thread *td, int fd, struct file *fp); % +struct mtx sigio_lock; /* mtx to protect pointers to sigio */ % +void (*mq_fdclose) (struct thread *td, int fd, struct file *fp); Here it undoes one of your recent changes, but makes messes. % @@ -207 +210 @@ % - mask = ~(~(NDSLOTTYPE)0 >> (NDENTRIES - (low % NDENTRIES))); % + mask = ~(~(NDSLOTTYPE) 0 >> (NDENTRIES - (low % NDENTRIES))); Here it is confused by the type name not being spelled with a _t and not being a parameter. % [...] Despite all the bugs in indent(1) and kern_descrip.c, indent only produces another 381 lines of diffs, with about 1/3 clearly correct and 1/3 to make messes of fancily formatted data declarations. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 02:16:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 89F50106566C; Fri, 15 Jun 2012 02:16:30 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 74A958FC0C; Fri, 15 Jun 2012 02:16:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F2GUPj036619; Fri, 15 Jun 2012 02:16:30 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F2GUnU036616; Fri, 15 Jun 2012 02:16:30 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206150216.q5F2GUnU036616@svn.freebsd.org> From: Adrian Chadd Date: Fri, 15 Jun 2012 02:16:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237109 - in head/sys: amd64/conf i386/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 02:16:30 -0000 Author: adrian Date: Fri Jun 15 02:16:29 2012 New Revision: 237109 URL: http://svn.freebsd.org/changeset/base/237109 Log: Ok, ok. 802.11n can be on by default in GENERIC in -HEAD. God help me. Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Fri Jun 15 01:15:59 2012 (r237108) +++ head/sys/amd64/conf/GENERIC Fri Jun 15 02:16:29 2012 (r237109) @@ -273,6 +273,8 @@ device ath # Atheros NIC's device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +options AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation +options ATH_SUPPORT_11N # Enable 802.11n support for AR5416 and later device ath_rate_sample # SampleRate tx rate control for ath #device bwi # Broadcom BCM430x/BCM431x wireless NICs. #device bwn # Broadcom BCM43xx wireless NICs. Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Fri Jun 15 01:15:59 2012 (r237108) +++ head/sys/i386/conf/GENERIC Fri Jun 15 02:16:29 2012 (r237109) @@ -285,6 +285,8 @@ device ath # Atheros NIC's device ath_pci # Atheros pci/cardbus glue device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +options AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation +options ATH_SUPPORT_11N # Enable 802.11n support for AR5416 and later device ath_rate_sample # SampleRate tx rate control for ath #device bwi # Broadcom BCM430x/BCM431x wireless NICs. #device bwn # Broadcom BCM43xx wireless NICs. From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 03:57:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 603761065675; Fri, 15 Jun 2012 03:57:17 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 4BF7E8FC0A; Fri, 15 Jun 2012 03:57:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F3vHVL041646; Fri, 15 Jun 2012 03:57:17 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F3vHaW041644; Fri, 15 Jun 2012 03:57:17 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201206150357.q5F3vHaW041644@svn.freebsd.org> From: Tim Kientzle Date: Fri, 15 Jun 2012 03:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237110 - head/lib/libc/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 03:57:17 -0000 Author: kientzle Date: Fri Jun 15 03:57:16 2012 New Revision: 237110 URL: http://svn.freebsd.org/changeset/base/237110 Log: Per kib, since __flt_rounds is being added to FreeBSD 10, it belongs in FBSD_1.3. MFC after: 1 week Modified: head/lib/libc/arm/Symbol.map Modified: head/lib/libc/arm/Symbol.map ============================================================================== --- head/lib/libc/arm/Symbol.map Fri Jun 15 02:16:29 2012 (r237109) +++ head/lib/libc/arm/Symbol.map Fri Jun 15 03:57:16 2012 (r237110) @@ -31,6 +31,9 @@ FBSD_1.0 { brk; cerror; /* XXX - Should this be .cerror (see sys/cerror.S)? */ sbrk; +}; + +FBSD_1.3 { __flt_rounds; }; From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 06:13:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D65B106566B; Fri, 15 Jun 2012 06:13:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 37DD38FC1A; Fri, 15 Jun 2012 06:13:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F6DDXt047377; Fri, 15 Jun 2012 06:13:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F6DCYD047375; Fri, 15 Jun 2012 06:13:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206150613.q5F6DCYD047375@svn.freebsd.org> From: Alexander Motin Date: Fri, 15 Jun 2012 06:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237113 - stable/9/sys/dev/ahci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 06:13:13 -0000 Author: mav Date: Fri Jun 15 06:13:12 2012 New Revision: 237113 URL: http://svn.freebsd.org/changeset/base/237113 Log: MFC r236737: Add IDs for Marvell 88SE9220/9230/9235 PCIe 2.0 x2 6Gbps SATA controllers. Marvell 88SE9230 was confirmed to work, the rest two are just guessed. Modified: stable/9/sys/dev/ahci/ahci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Fri Jun 15 06:00:56 2012 (r237112) +++ stable/9/sys/dev/ahci/ahci.c Fri Jun 15 06:13:12 2012 (r237113) @@ -202,6 +202,9 @@ static struct { {0x91301b4b, 0x00, "Marvell 88SE9130", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, {0x91721b4b, 0x00, "Marvell 88SE9172", AHCI_Q_NOBSYRES}, {0x91821b4b, 0x00, "Marvell 88SE9182", AHCI_Q_NOBSYRES}, + {0x92201b4b, 0x00, "Marvell 88SE9220", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, + {0x92301b4b, 0x00, "Marvell 88SE9230", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, + {0x92351b4b, 0x00, "Marvell 88SE9235", AHCI_Q_NOBSYRES}, {0x06201103, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06201b4b, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06221103, 0x00, "HighPoint RocketRAID 622", AHCI_Q_NOBSYRES}, From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 06:14:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A0AF1065675; Fri, 15 Jun 2012 06:14:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8481D8FC08; Fri, 15 Jun 2012 06:14:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F6EUlh047485; Fri, 15 Jun 2012 06:14:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F6EUqa047483; Fri, 15 Jun 2012 06:14:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201206150614.q5F6EUqa047483@svn.freebsd.org> From: Alexander Motin Date: Fri, 15 Jun 2012 06:14:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237114 - stable/8/sys/dev/ahci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 06:14:30 -0000 Author: mav Date: Fri Jun 15 06:14:29 2012 New Revision: 237114 URL: http://svn.freebsd.org/changeset/base/237114 Log: MFC r236737: Add IDs for Marvell 88SE9220/9230/9235 PCIe 2.0 x2 6Gbps SATA controllers. Marvell 88SE9230 was confirmed to work, the rest two are just guessed. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Fri Jun 15 06:13:12 2012 (r237113) +++ stable/8/sys/dev/ahci/ahci.c Fri Jun 15 06:14:29 2012 (r237114) @@ -201,6 +201,9 @@ static struct { {0x91281b4b, 0x00, "Marvell 88SE9128", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, {0x91721b4b, 0x00, "Marvell 88SE9172", AHCI_Q_NOBSYRES}, {0x91821b4b, 0x00, "Marvell 88SE9182", AHCI_Q_NOBSYRES}, + {0x92201b4b, 0x00, "Marvell 88SE9220", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, + {0x92301b4b, 0x00, "Marvell 88SE9230", AHCI_Q_NOBSYRES|AHCI_Q_ALTSIG}, + {0x92351b4b, 0x00, "Marvell 88SE9235", AHCI_Q_NOBSYRES}, {0x06201103, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06201b4b, 0x00, "HighPoint RocketRAID 620", AHCI_Q_NOBSYRES}, {0x06221103, 0x00, "HighPoint RocketRAID 622", AHCI_Q_NOBSYRES}, From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 06:38:56 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BF72106566C; Fri, 15 Jun 2012 06:38:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 574478FC08; Fri, 15 Jun 2012 06:38:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F6cuXD048493; Fri, 15 Jun 2012 06:38:56 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F6cuDd048489; Fri, 15 Jun 2012 06:38:56 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206150638.q5F6cuDd048489@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 06:38:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237115 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 06:38:56 -0000 Author: imp Date: Fri Jun 15 06:38:55 2012 New Revision: 237115 URL: http://svn.freebsd.org/changeset/base/237115 Log: Take half a step closer towards having a unified atmel kernel by rearranging where we initialize the time counter and putting the common stubs into a central place. Modified: head/sys/arm/at91/at91_machdep.c head/sys/arm/at91/at91_pit.c head/sys/arm/at91/at91_st.c Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Fri Jun 15 06:14:29 2012 (r237114) +++ head/sys/arm/at91/at91_machdep.c Fri Jun 15 06:38:55 2012 (r237115) @@ -572,3 +572,24 @@ initarm(struct arm_boot_params *abp) return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - sizeof(struct pcb))); } + +/* + * These functions are handled elsewhere, so make them nops here. + */ +void +cpu_startprofclock(void) +{ + +} + +void +cpu_stopprofclock(void) +{ + +} + +void +cpu_initclocks(void) +{ + +} Modified: head/sys/arm/at91/at91_pit.c ============================================================================== --- head/sys/arm/at91/at91_pit.c Fri Jun 15 06:14:29 2012 (r237114) +++ head/sys/arm/at91/at91_pit.c Fri Jun 15 06:38:55 2012 (r237115) @@ -206,24 +206,3 @@ DELAY(int us) last = piv; } } - -/* - * The 3 next functions must be implement with the future PLL code. - */ -void -cpu_startprofclock(void) -{ - -} - -void -cpu_stopprofclock(void) -{ - -} - -void -cpu_initclocks(void) -{ - -} Modified: head/sys/arm/at91/at91_st.c ============================================================================== --- head/sys/arm/at91/at91_st.c Fri Jun 15 06:14:29 2012 (r237114) +++ head/sys/arm/at91/at91_st.c Fri Jun 15 06:38:55 2012 (r237115) @@ -60,6 +60,7 @@ static struct at91st_softc { bus_space_write_4(timer_softc->sc_st, timer_softc->sc_sh, (off), (val)) static void at91st_watchdog(void *, u_int, int *); +static void at91st_initclocks(struct at91st_softc *); static inline int st_crtr(void) @@ -114,8 +115,11 @@ at91st_attach(device_t dev) timer_softc->sc_wet = EVENTHANDLER_REGISTER(watchdog_list, at91st_watchdog, dev, 0); + device_printf(dev, "watchdog registered, timeout intervall max. 64 sec\n"); + + at91st_initclocks(timer_softc); return (0); } @@ -183,14 +187,14 @@ clock_intr(void *arg) return (FILTER_STRAY); } -void -cpu_initclocks(void) +static void +at91st_initclocks(struct at91st_softc *sc) { int rel_value; struct resource *irq; int rid = 0; void *ih; - device_t dev = timer_softc->sc_dev; + device_t dev = sc->sc_dev; rel_value = 32768 / hz; if (rel_value < 1) @@ -251,13 +255,3 @@ cpu_reset(void) while (1) continue; } - -void -cpu_startprofclock(void) -{ -} - -void -cpu_stopprofclock(void) -{ -} From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 07:14:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0704A1065701; Fri, 15 Jun 2012 07:14:17 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E51458FC12; Fri, 15 Jun 2012 07:14:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F7EGxt050185; Fri, 15 Jun 2012 07:14:16 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F7EGtS050182; Fri, 15 Jun 2012 07:14:16 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206150714.q5F7EGtS050182@svn.freebsd.org> From: Martin Matuska Date: Fri, 15 Jun 2012 07:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237116 - stable/9/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 07:14:17 -0000 Author: mm Date: Fri Jun 15 07:14:16 2012 New Revision: 237116 URL: http://svn.freebsd.org/changeset/base/237116 Log: MFC r236960: Document the -v flag for zpool list. PR: 168970 Suggested by: Marcelo Araujo Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 06:38:55 2012 (r237115) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 07:14:16 2012 (r237116) @@ -1301,6 +1301,8 @@ reports are printed. .It Fl H Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space. +.It Fl v +Show more detailed information. .It Fl o Ar property Ns Op , Ns Ar ... Comma-separated list of properties to display. See the .Qq Sx Properties Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Jun 15 06:38:55 2012 (r237115) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Jun 15 07:14:16 2012 (r237116) @@ -234,7 +234,7 @@ get_usage(zpool_help_t idx) { case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: - return (gettext("\tlist [-H] [-o property[,...]] " + return (gettext("\tlist [-Hv] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 07:14:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE14E1065701; Fri, 15 Jun 2012 07:14:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B92828FC1A; Fri, 15 Jun 2012 07:14:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F7EhUn050253; Fri, 15 Jun 2012 07:14:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F7Eh0P050250; Fri, 15 Jun 2012 07:14:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206150714.q5F7Eh0P050250@svn.freebsd.org> From: Martin Matuska Date: Fri, 15 Jun 2012 07:14:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237117 - stable/8/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 07:14:43 -0000 Author: mm Date: Fri Jun 15 07:14:43 2012 New Revision: 237117 URL: http://svn.freebsd.org/changeset/base/237117 Log: MFC r236960: Document the -v flag for zpool list. PR: 168970 Suggested by: Marcelo Araujo Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 07:14:16 2012 (r237116) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 07:14:43 2012 (r237117) @@ -1301,6 +1301,8 @@ reports are printed. .It Fl H Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space. +.It Fl v +Show more detailed information. .It Fl o Ar property Ns Op , Ns Ar ... Comma-separated list of properties to display. See the .Qq Sx Properties Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Jun 15 07:14:16 2012 (r237116) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Fri Jun 15 07:14:43 2012 (r237117) @@ -234,7 +234,7 @@ get_usage(zpool_help_t idx) { case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: - return (gettext("\tlist [-H] [-o property[,...]] " + return (gettext("\tlist [-Hv] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 07:26:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDB721065674; Fri, 15 Jun 2012 07:26:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id AA20A8FC1B; Fri, 15 Jun 2012 07:26:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F7QdWq051172; Fri, 15 Jun 2012 07:26:39 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F7Qd4A051170; Fri, 15 Jun 2012 07:26:39 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206150726.q5F7Qd4A051170@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 07:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237118 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 07:26:39 -0000 Author: imp Date: Fri Jun 15 07:26:39 2012 New Revision: 237118 URL: http://svn.freebsd.org/changeset/base/237118 Log: Fix a global shadowing problem when LINUX_BOOT_ABI was defined. Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Fri Jun 15 07:14:43 2012 (r237117) +++ head/sys/arm/arm/machdep.c Fri Jun 15 07:26:39 2012 (r237118) @@ -686,7 +686,7 @@ makectx(struct trapframe *tf, struct pcb * calling pmap_bootstrap. */ void -arm_dump_avail_init(vm_offset_t memsize, size_t max) +arm_dump_avail_init(vm_offset_t ramsize, size_t max) { #ifdef LINUX_BOOT_ABI /* @@ -713,7 +713,7 @@ arm_dump_avail_init(vm_offset_t memsize, panic("dump_avail too small\n"); dump_avail[0] = round_page(PHYSADDR); - dump_avail[1] = trunc_page(PHYSADDR + memsize); + dump_avail[1] = trunc_page(PHYSADDR + ramsize); dump_avail[2] = 0; dump_avail[3] = 0; } From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 07:38:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5DF3D106566B; Fri, 15 Jun 2012 07:38:22 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 4909E8FC08; Fri, 15 Jun 2012 07:38:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F7cMp5052054; Fri, 15 Jun 2012 07:38:22 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F7cM8F052052; Fri, 15 Jun 2012 07:38:22 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201206150738.q5F7cM8F052052@svn.freebsd.org> From: Martin Matuska Date: Fri, 15 Jun 2012 07:38:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237119 - head/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 07:38:22 -0000 Author: mm Date: Fri Jun 15 07:38:21 2012 New Revision: 237119 URL: http://svn.freebsd.org/changeset/base/237119 Log: Do not remount ZFS dataset if changing canmount property to "on" and dataset is already mounted. PR: 167905 Submitted by: Bryan Drewery MFC after: 1 week Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jun 15 07:26:39 2012 (r237118) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Fri Jun 15 07:38:21 2012 (r237119) @@ -1485,11 +1485,13 @@ zfs_prop_set(zfs_handle_t *zhp, const ch /* * If the dataset's canmount property is being set to noauto, + * or being set to on and the dataset is already mounted, * then we want to prevent unmounting & remounting it. */ do_prefix = !((prop == ZFS_PROP_CANMOUNT) && (zprop_string_to_index(prop, propval, &idx, - ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO)); + ZFS_TYPE_DATASET) == 0) && (idx == ZFS_CANMOUNT_NOAUTO || + (idx == ZFS_CANMOUNT_ON && zfs_is_mounted(zhp, NULL)))); if (do_prefix && (ret = changelist_prefix(cl)) != 0) goto error; From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 07:50:27 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7B42106564A; Fri, 15 Jun 2012 07:50:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id D2E4C8FC17; Fri, 15 Jun 2012 07:50:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F7oQoF052999; Fri, 15 Jun 2012 07:50:26 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F7oQss052994; Fri, 15 Jun 2012 07:50:26 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206150750.q5F7oQss052994@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 07:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237122 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 07:50:27 -0000 Author: imp Date: Fri Jun 15 07:50:26 2012 New Revision: 237122 URL: http://svn.freebsd.org/changeset/base/237122 Log: Collapse the files.at91 and files.at91sam9 back into files.at91. Create a new option for at91rm9200 support. Set this option in std.at91. Create a new option for the at91sam9 standard devices. Set this option in std.at91sam9. Retire files.at91sam9. Add options for at91sam9x25 SoC and SAM9X25EK board, but don't connect it just yet as the supporting files aren't quite ready. Note: device at91rm9200 and device at91sam9 are presently mutually exclusive. Deleted: head/sys/arm/at91/files.at91sam9 Modified: head/sys/arm/at91/files.at91 head/sys/arm/at91/std.at91 head/sys/arm/at91/std.at91sam9 Modified: head/sys/arm/at91/files.at91 ============================================================================== --- head/sys/arm/at91/files.at91 Fri Jun 15 07:42:44 2012 (r237121) +++ head/sys/arm/at91/files.at91 Fri Jun 15 07:50:26 2012 (r237122) @@ -8,25 +8,38 @@ arm/at91/at91_mci.c optional at91_mci arm/at91/at91_nand.c optional nand arm/at91/at91_pio.c standard arm/at91/at91_pmc.c standard +arm/at91/at91_pit.c optional at91sam9 +arm/at91/at91_reset.S optional at91sam9 +arm/at91/at91_rst.c optional at91sam9 arm/at91/at91_rtc.c optional at91_rtc arm/at91/at91_spi.c optional at91_spi \ dependency "spibus_if.h" arm/at91/at91_ssc.c optional at91_ssc -arm/at91/at91_st.c standard +arm/at91/at91_st.c optional at91rm9200 arm/at91/at91_tc.c optional at91_tc arm/at91/at91_twi.c optional at91_twi +arm/at91/at91_wdt.c optional at91_wdt arm/at91/if_ate.c optional ate +arm/at91/if_macb.c optional macb arm/at91/uart_bus_at91usart.c optional uart arm/at91/uart_cpu_at91rm9200usart.c optional uart arm/at91/uart_dev_at91usart.c optional uart # # All the "systems on a chip" we support # -arm/at91/at91rm9200.c standard +arm/at91/at91rm9200.c optional at91rm9200 +arm/at91/at91sam9260.c optional at91sam9260 +arm/at91/at91sam9g20.c optional at91sam9g20 +arm/at91/at91sam9x25.c optional at91sam9x25 # # All the boards we support # arm/at91/board_bwct.c optional at91_board_bwct +arm/at91/board_ethernut5.c optional at91_board_ethernut5 arm/at91/board_hl200.c optional at91_board_hl200 +arm/at91/board_hl201.c optional at91_board_hl201 arm/at91/board_kb920x.c optional at91_board_kb920x +arm/at91/board_qila9g20.c optional at91_board_qila9g20 +arm/at91/board_sam9g20ek.c optional at91_board_sam9g20ek +arm/at91/board_sam9x25ek.c optional at91_board_sam9x25ek arm/at91/board_tsc4370.c optional at91_board_tsc4370 Modified: head/sys/arm/at91/std.at91 ============================================================================== --- head/sys/arm/at91/std.at91 Fri Jun 15 07:42:44 2012 (r237121) +++ head/sys/arm/at91/std.at91 Fri Jun 15 07:50:26 2012 (r237122) @@ -4,3 +4,6 @@ files "../at91/files.at91" cpu CPU_ARM9 makeoptions CONF_CFLAGS=-mcpu=arm9 options PHYSADDR=0x20000000 + +# For now, just do the AT91RM9200 +device at91rm9200 Modified: head/sys/arm/at91/std.at91sam9 ============================================================================== --- head/sys/arm/at91/std.at91sam9 Fri Jun 15 07:42:44 2012 (r237121) +++ head/sys/arm/at91/std.at91sam9 Fri Jun 15 07:50:26 2012 (r237122) @@ -1,9 +1,12 @@ # $FreeBSD$ -files "../at91/files.at91sam9" +files "../at91/files.at91" cpu CPU_ARM9 -makeoptions CONF_CFLAGS="-mcpu=arm9" +makeoptions CONF_CFLAGS=-mcpu=arm9 options PHYSADDR=0x20000000 -device at91sam9g20 +# bring in the sam specific timers and such +device at91sam9 + device at91sam9260 +device at91sam9g20 From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 07:56:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B22B2106566B; Fri, 15 Jun 2012 07:56:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9DEF28FC0C; Fri, 15 Jun 2012 07:56:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F7urc0053526; Fri, 15 Jun 2012 07:56:53 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F7urbf053524; Fri, 15 Jun 2012 07:56:53 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206150756.q5F7urbf053524@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 07:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237124 - head/sys/arm/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 07:56:53 -0000 Author: imp Date: Fri Jun 15 07:56:53 2012 New Revision: 237124 URL: http://svn.freebsd.org/changeset/base/237124 Log: This hints file doesn't actually do anything, and besides it is commented out here. Remove it. Modified: head/sys/arm/conf/BWCT Modified: head/sys/arm/conf/BWCT ============================================================================== --- head/sys/arm/conf/BWCT Fri Jun 15 07:52:20 2012 (r237123) +++ head/sys/arm/conf/BWCT Fri Jun 15 07:56:53 2012 (r237124) @@ -25,7 +25,6 @@ options AT91_BWCT include "../at91/std.bwct" #To statically compile in device wiring instead of /boot/device.hints -#hints "hints.at91rm9200" hints "BWCT.hints" makeoptions MODULES_OVERRIDE="" From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 08:01:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 61F10106564A; Fri, 15 Jun 2012 08:01:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 4D8518FC17; Fri, 15 Jun 2012 08:01:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F81Hgw053862; Fri, 15 Jun 2012 08:01:17 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F81HRm053859; Fri, 15 Jun 2012 08:01:17 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206150801.q5F81HRm053859@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 08:01:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237125 - in head/sys: arm/conf conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 08:01:17 -0000 Author: imp Date: Fri Jun 15 08:01:16 2012 New Revision: 237125 URL: http://svn.freebsd.org/changeset/base/237125 Log: These options are unused, and can safely be retired. Modified: head/sys/arm/conf/BWCT head/sys/conf/options.arm Modified: head/sys/arm/conf/BWCT ============================================================================== --- head/sys/arm/conf/BWCT Fri Jun 15 07:56:53 2012 (r237124) +++ head/sys/arm/conf/BWCT Fri Jun 15 08:01:16 2012 (r237125) @@ -21,7 +21,6 @@ ident BWCT options VERBOSE_INIT_ARM -options AT91_BWCT include "../at91/std.bwct" #To statically compile in device wiring instead of /boot/device.hints Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Fri Jun 15 07:56:53 2012 (r237124) +++ head/sys/conf/options.arm Fri Jun 15 08:01:16 2012 (r237125) @@ -24,7 +24,6 @@ LINUX_BOOT_ABI opt_global.h LOADERRAMADDR opt_global.h PHYSADDR opt_global.h QEMU_WORKAROUNDS opt_global.h -SKYEYE_WORKAROUNDS opt_global.h SOC_MV_DISCOVERY opt_global.h SOC_MV_KIRKWOOD opt_global.h SOC_MV_ORION opt_global.h @@ -33,9 +32,6 @@ XSCALE_CACHE_READ_WRITE_ALLOCATE opt_glo XSACLE_DISABLE_CCNT opt_timer.h VERBOSE_INIT_ARM opt_global.h AT91_ATE_USE_RMII opt_at91.h -AT91_BWCT opt_at91.h -AT91_TSC opt_at91.h -AT91_KWIKBYTE opt_at91.h AT91_MCI_HAS_4WIRE opt_at91.h AT91_MCI_SLOT_B opt_at91.h AT91C_MAIN_CLOCK opt_at91.h From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 08:37:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A49C3106566B; Fri, 15 Jun 2012 08:37:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 901EB8FC16; Fri, 15 Jun 2012 08:37:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F8bkAt055804; Fri, 15 Jun 2012 08:37:46 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F8bkOr055802; Fri, 15 Jun 2012 08:37:46 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206150837.q5F8bkOr055802@svn.freebsd.org> From: Adrian Chadd Date: Fri, 15 Jun 2012 08:37:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237129 - head/tools/tools/net80211/wlanstats X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 08:37:46 -0000 Author: adrian Date: Fri Jun 15 08:37:46 2012 New Revision: 237129 URL: http://svn.freebsd.org/changeset/base/237129 Log: Add the AMPDU BAR TX statistics to the "ampdu" tag. Modified: head/tools/tools/net80211/wlanstats/main.c Modified: head/tools/tools/net80211/wlanstats/main.c ============================================================================== --- head/tools/tools/net80211/wlanstats/main.c Fri Jun 15 08:10:14 2012 (r237128) +++ head/tools/tools/net80211/wlanstats/main.c Fri Jun 15 08:37:46 2012 (r237129) @@ -57,7 +57,8 @@ static struct { }, { "ampdu", "input,output,ampdu_reorder,ampdu_oor,rx_dup,ampdu_flush,ampdu_move," - "ampdu_drop,ampdu_bar,ampdu_baroow,ampdu_barmove,rssi,rate" + "ampdu_drop,ampdu_bar,ampdu_baroow,ampdu_barmove,ampdu_bartx," + "ampdu_bartxfail,ampdu_bartxretry,rssi,rate" }, }; From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 08:37:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 04A20106566C; Fri, 15 Jun 2012 08:37:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E2F248FC17; Fri, 15 Jun 2012 08:37:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F8boHt055850; Fri, 15 Jun 2012 08:37:50 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F8boYj055844; Fri, 15 Jun 2012 08:37:50 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206150837.q5F8boYj055844@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 08:37:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237130 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 08:37:51 -0000 Author: imp Date: Fri Jun 15 08:37:50 2012 New Revision: 237130 URL: http://svn.freebsd.org/changeset/base/237130 Log: Make it possible to link together a sam and an rm kernel. The results aren't very pretty yet, but this takes DELAY and cpu_reset and makes them pointers. # I worry that these are set too late in the boot, especially cpu_reset. Modified: head/sys/arm/at91/at91_machdep.c head/sys/arm/at91/at91_pit.c head/sys/arm/at91/at91_rst.c head/sys/arm/at91/at91_st.c head/sys/arm/at91/at91var.h Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Fri Jun 15 08:37:46 2012 (r237129) +++ head/sys/arm/at91/at91_machdep.c Fri Jun 15 08:37:50 2012 (r237130) @@ -201,11 +201,22 @@ const struct pmap_devmap at91_devmap[] = { 0, 0, 0, 0, 0, } }; +#ifdef LINUX_BOOT_ABI +extern int membanks; +extern int memstart[]; +extern int memsize[]; +#endif + long at91_ramsize(void) { uint32_t cr, mr; int banks, rows, cols, bw; +#ifdef LINUX_BOOT_ABI + // If we found any ATAGs that were for memory, return the first bank. + if (membanks > 0) + return memsize[0]; +#endif if (at91_is_rm92()) { uint32_t *SDRAMC = (uint32_t *)(AT91_BASE + AT91RM92_SDRAMC_BASE); @@ -593,3 +604,19 @@ cpu_initclocks(void) { } + +void +DELAY(int n) +{ + if (soc_data.delay) + soc_data.delay(n); +} + +void +cpu_reset(void) +{ + if (soc_data.reset) + soc_data.reset(); + while (1) + continue; +} Modified: head/sys/arm/at91/at91_pit.c ============================================================================== --- head/sys/arm/at91/at91_pit.c Fri Jun 15 08:37:46 2012 (r237129) +++ head/sys/arm/at91/at91_pit.c Fri Jun 15 08:37:50 2012 (r237130) @@ -48,6 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifndef PIT_PRESCALE +#define PIT_PRESCALE (16) +#endif + static struct pit_softc { struct resource *mem_res; /* Memory resource */ void *intrhand; /* Interrupt handle */ @@ -55,6 +59,8 @@ static struct pit_softc { } *sc; static uint32_t timecount = 0; +static unsigned at91pit_get_timecount(struct timecounter *tc); +static int pit_intr(void *arg); static inline uint32_t RD4(struct pit_softc *sc, bus_size_t off) @@ -70,12 +76,28 @@ WR4(struct pit_softc *sc, bus_size_t off bus_write_4(sc->mem_res, off, val); } -static unsigned at91pit_get_timecount(struct timecounter *tc); -static int pit_intr(void *arg); +static void +at91pit_delay(int us) +{ + int32_t cnt, last, piv; + uint64_t pit_freq; + const uint64_t mhz = 1E6; -#ifndef PIT_PRESCALE -#define PIT_PRESCALE (16) -#endif + last = PIT_PIV(RD4(sc, PIT_PIIR)); + + /* Max delay ~= 260s. @ 133Mhz */ + pit_freq = at91_master_clock / PIT_PRESCALE; + cnt = ((pit_freq * us) + (mhz -1)) / mhz; + cnt = (cnt <= 0) ? 1 : cnt; + + while (cnt > 0) { + piv = PIT_PIV(RD4(sc, PIT_PIIR)); + cnt -= piv - last ; + if (piv < last) + cnt -= PIT_PIV(~0u) - last; + last = piv; + } +} static struct timecounter at91pit_timecounter = { at91pit_get_timecount, /* get_timecount */ @@ -90,11 +112,8 @@ static int at91pit_probe(device_t dev) { - if (at91_is_sam9() || at91_is_sam9xe()) { - device_set_desc(dev, "AT91SAM9 PIT"); - return (0); - } - return (ENXIO); + device_set_desc(dev, "AT91SAM9 PIT"); + return (0); } static int @@ -135,6 +154,7 @@ at91pit_attach(device_t dev) /* Enable the PIT here. */ WR4(sc, PIT_MR, PIT_PIV(at91_master_clock / PIT_PRESCALE / hz) | PIT_EN | PIT_IEN); + soc_data.delay = at91pit_delay; out: return (err); } @@ -183,26 +203,3 @@ at91pit_get_timecount(struct timecounter icnt = piir >> 20; /* Overflows */ return (timecount + PIT_PIV(piir) + PIT_PIV(RD4(sc, PIT_MR)) * icnt); } - -void -DELAY(int us) -{ - int32_t cnt, last, piv; - uint64_t pit_freq; - const uint64_t mhz = 1E6; - - last = PIT_PIV(RD4(sc, PIT_PIIR)); - - /* Max delay ~= 260s. @ 133Mhz */ - pit_freq = at91_master_clock / PIT_PRESCALE; - cnt = ((pit_freq * us) + (mhz -1)) / mhz; - cnt = (cnt <= 0) ? 1 : cnt; - - while (cnt > 0) { - piv = PIT_PIV(RD4(sc, PIT_PIIR)); - cnt -= piv - last ; - if (piv < last) - cnt -= PIT_PIV(~0u) - last; - last = piv; - } -} Modified: head/sys/arm/at91/at91_rst.c ============================================================================== --- head/sys/arm/at91/at91_rst.c Fri Jun 15 08:37:46 2012 (r237129) +++ head/sys/arm/at91/at91_rst.c Fri Jun 15 08:37:50 2012 (r237130) @@ -42,50 +42,70 @@ __FBSDID("$FreeBSD$"); #define RST_TIMEOUT (5) /* Seconds to hold NRST for hard reset */ #define RST_TICK (20) /* sample NRST at hz/RST_TICK intervals */ -static int rst_intr(void *arg); +static int at91rst_intr(void *arg); -static struct rst_softc { +static struct at91rst_softc { struct resource *mem_res; /* Memory resource */ struct resource *irq_res; /* IRQ resource */ void *intrhand; /* Interrupt handle */ struct callout tick_ch; /* Tick callout */ device_t sc_dev; u_int shutdown; /* Shutdown in progress */ -} *rst_sc; +} *at91rst_sc; static inline uint32_t -RD4(struct rst_softc *sc, bus_size_t off) +RD4(struct at91rst_softc *sc, bus_size_t off) { return (bus_read_4(sc->mem_res, off)); } static inline void -WR4(struct rst_softc *sc, bus_size_t off, uint32_t val) +WR4(struct at91rst_softc *sc, bus_size_t off, uint32_t val) { bus_write_4(sc->mem_res, off, val); } -static int -at91_rst_probe(device_t dev) +void cpu_reset_sam9g20(void) __attribute__((weak)); +void cpu_reset_sam9g20(void) {} + +static void +at91rst_cpu_reset(void) { - if (at91_is_sam9() || at91_is_sam9xe()) { - device_set_desc(dev, "AT91SAM9 Reset Controller"); - return (0); + if (at91rst_sc) { + cpu_reset_sam9g20(); /* May be null */ + + WR4(at91rst_sc, RST_MR, + RST_MR_ERSTL(0xd) | RST_MR_URSTEN | RST_MR_KEY); + + WR4(at91rst_sc, RST_CR, + RST_CR_PROCRST | + RST_CR_PERRST | + RST_CR_EXTRST | + RST_CR_KEY); } - return (ENXIO); + while(1) + continue; +} + +static int +at91rst_probe(device_t dev) +{ + + device_set_desc(dev, "AT91SAM9 Reset Controller"); + return (0); } static int -at91_rst_attach(device_t dev) +at91rst_attach(device_t dev) { - struct rst_softc *sc; + struct at91rst_softc *sc; const char *cause; int rid, err; - rst_sc = sc = device_get_softc(dev); + at91rst_sc = sc = device_get_softc(dev); sc->sc_dev = dev; callout_init(&sc->tick_ch, 0); @@ -109,11 +129,11 @@ at91_rst_attach(device_t dev) /* Activate the interrupt. */ err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, - rst_intr, NULL, sc, &sc->intrhand); + at91rst_intr, NULL, sc, &sc->intrhand); if (err) device_printf(dev, "could not establish interrupt handler.\n"); - WR4(rst_sc, RST_MR, RST_MR_ERSTL(0xd) | RST_MR_URSIEN | RST_MR_KEY); + WR4(at91rst_sc, RST_MR, RST_MR_ERSTL(0xd) | RST_MR_URSIEN | RST_MR_KEY); switch (RD4(sc, RST_SR) & RST_SR_RST_MASK) { case RST_SR_RST_POW: @@ -137,16 +157,15 @@ at91_rst_attach(device_t dev) } device_printf(dev, "Reset cause: %s.\n", cause); - /* cpu_reset_addr = cpu_reset; */ - + soc_data.reset = at91rst_cpu_reset; out: return (err); } static void -rst_tick(void *argp) +at91rst_tick(void *argp) { - struct rst_softc *sc = argp; + struct at91rst_softc *sc = argp; if (sc->shutdown++ >= RST_TIMEOUT * RST_TICK) { /* User released the button in morre than RST_TIMEOUT */ @@ -157,60 +176,36 @@ rst_tick(void *argp) device_printf(sc->sc_dev, "shutting down...\n"); shutdown_nice(0); } else { - callout_reset(&sc->tick_ch, hz/RST_TICK, rst_tick, sc); + callout_reset(&sc->tick_ch, hz/RST_TICK, at91rst_tick, sc); } } static int -rst_intr(void *argp) +at91rst_intr(void *argp) { - struct rst_softc *sc = argp; + struct at91rst_softc *sc = argp; if (RD4(sc, RST_SR) & RST_SR_URSTS) { if (sc->shutdown == 0) - callout_reset(&sc->tick_ch, hz/RST_TICK, rst_tick, sc); + callout_reset(&sc->tick_ch, hz/RST_TICK, at91rst_tick, sc); return (FILTER_HANDLED); } return (FILTER_STRAY); } -static device_method_t at91_rst_methods[] = { - DEVMETHOD(device_probe, at91_rst_probe), - DEVMETHOD(device_attach, at91_rst_attach), +static device_method_t at91rst_methods[] = { + DEVMETHOD(device_probe, at91rst_probe), + DEVMETHOD(device_attach, at91rst_attach), DEVMETHOD_END }; -static driver_t at91_rst_driver = { +static driver_t at91rst_driver = { "at91_rst", - at91_rst_methods, - sizeof(struct rst_softc), + at91rst_methods, + sizeof(struct at91rst_softc), }; -static devclass_t at91_rst_devclass; +static devclass_t at91rst_devclass; -DRIVER_MODULE(at91_rst, atmelarm, at91_rst_driver, at91_rst_devclass, NULL, +DRIVER_MODULE(at91_rst, atmelarm, at91rst_driver, at91rst_devclass, NULL, NULL); - -void cpu_reset_sam9g20(void) __attribute__((weak)); -void cpu_reset_sam9g20(void) {} - -void -cpu_reset(void) -{ - - if (rst_sc) { - cpu_reset_sam9g20(); /* May be null */ - - WR4(rst_sc, RST_MR, - RST_MR_ERSTL(0xd) | RST_MR_URSTEN | RST_MR_KEY); - - WR4(rst_sc, RST_CR, - RST_CR_PROCRST | - RST_CR_PERRST | - RST_CR_EXTRST | - RST_CR_KEY); - } - - for(;;) - ; -} Modified: head/sys/arm/at91/at91_st.c ============================================================================== --- head/sys/arm/at91/at91_st.c Fri Jun 15 08:37:46 2012 (r237129) +++ head/sys/arm/at91/at91_st.c Fri Jun 15 08:37:50 2012 (r237130) @@ -84,6 +84,40 @@ static struct timecounter at91st_timecou 1000 /* quality */ }; +static void +at91st_delay(int n) +{ + uint32_t start, end, cur; + + start = st_crtr(); + n = (n * 1000) / 32768; + if (n <= 0) + n = 1; + end = (start + n) & ST_CRTR_MASK; + cur = start; + if (start > end) { + while (cur >= start || cur < end) + cur = st_crtr(); + } else { + while (cur < end) + cur = st_crtr(); + } +} + +static void +at91st_cpu_reset(void) +{ + /* + * Reset the CPU by programmig the watchdog timer to reset the + * CPU after 128 'slow' clocks, or about ~4ms. Loop until + * the reset happens for safety. + */ + WR4(ST_WDMR, ST_WDMR_RSTEN | 2); + WR4(ST_CR, ST_CR_WDRST); + while (1) + continue; +} + static int at91st_probe(device_t dev) { @@ -112,6 +146,8 @@ at91st_attach(device_t dev) WR4(ST_IDR, 0xffffffff); /* disable watchdog timer */ WR4(ST_WDMR, 0); + soc_data.delay = at91st_delay; + soc_data.reset = at91st_cpu_reset; // XXX kinda late to be setting this... timer_softc->sc_wet = EVENTHANDLER_REGISTER(watchdog_list, at91st_watchdog, dev, 0); @@ -221,37 +257,3 @@ at91st_initclocks(struct at91st_softc *s WR4(ST_IER, ST_SR_PITS); tc_init(&at91st_timecounter); } - -void -DELAY(int n) -{ - uint32_t start, end, cur; - - start = st_crtr(); - n = (n * 1000) / 32768; - if (n <= 0) - n = 1; - end = (start + n) & ST_CRTR_MASK; - cur = start; - if (start > end) { - while (cur >= start || cur < end) - cur = st_crtr(); - } else { - while (cur < end) - cur = st_crtr(); - } -} - -void -cpu_reset(void) -{ - /* - * Reset the CPU by programmig the watchdog timer to reset the - * CPU after 128 'slow' clocks, or about ~4ms. Loop until - * the reset happens for safety. - */ - WR4(ST_WDMR, ST_WDMR_RSTEN | 2); - WR4(ST_CR, ST_CR_WDRST); - while (1) - continue; -} Modified: head/sys/arm/at91/at91var.h ============================================================================== --- head/sys/arm/at91/at91var.h Fri Jun 15 08:37:46 2012 (r237129) +++ head/sys/arm/at91/at91var.h Fri Jun 15 08:37:50 2012 (r237130) @@ -102,6 +102,9 @@ enum at91_soc_family { #define AT91_SOC_NAME_MAX 50 +typedef void (*DELAY_t)(int); +typedef void (*cpu_reset_t)(void); + struct at91_soc_info { enum at91_soc_type type; enum at91_soc_subtype subtype; @@ -109,6 +112,8 @@ struct at91_soc_info { uint32_t cidr; uint32_t exid; char name[AT91_SOC_NAME_MAX]; + DELAY_t delay; + cpu_reset_t reset; }; extern struct at91_soc_info soc_data; From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 08:50:45 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6E7981065674; Fri, 15 Jun 2012 08:50:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 59C878FC25; Fri, 15 Jun 2012 08:50:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F8oj2V056807; Fri, 15 Jun 2012 08:50:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F8oj2s056805; Fri, 15 Jun 2012 08:50:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206150850.q5F8oj2s056805@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 Jun 2012 08:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237131 - head/sys/dev/drm2/i915 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 08:50:45 -0000 Author: kib Date: Fri Jun 15 08:50:44 2012 New Revision: 237131 URL: http://svn.freebsd.org/changeset/base/237131 Log: Use right size when freeing unneeded GTT mapping. MFC after: 3 days Modified: head/sys/dev/drm2/i915/i915_gem.c Modified: head/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem.c Fri Jun 15 08:37:50 2012 (r237130) +++ head/sys/dev/drm2/i915/i915_gem.c Fri Jun 15 08:50:44 2012 (r237131) @@ -1064,7 +1064,7 @@ i915_gem_gtt_write(struct drm_device *de IDX_TO_OFF(obj_pi), size, PAT_WRITE_COMBINING); ret = -copyin_nofault((void *)(uintptr_t)data_ptr, (char *)mkva + obj_po, size); - pmap_unmapdev(mkva, PAGE_SIZE); + pmap_unmapdev(mkva, size); return (ret); } From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 09:12:48 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04B0A1065674; Fri, 15 Jun 2012 09:12:48 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E4EDD8FC1B; Fri, 15 Jun 2012 09:12:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5F9ClhY058599; Fri, 15 Jun 2012 09:12:47 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5F9ClGk058596; Fri, 15 Jun 2012 09:12:47 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201206150912.q5F9ClGk058596@svn.freebsd.org> From: Ruslan Ermilov Date: Fri, 15 Jun 2012 09:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237132 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 09:12:48 -0000 Author: ru Date: Fri Jun 15 09:12:47 2012 New Revision: 237132 URL: http://svn.freebsd.org/changeset/base/237132 Log: Fixed an example that set IP_ONESBCAST socket option to actually work, and not return EINVAL. Modified: head/share/man/man4/ip.4 Modified: head/share/man/man4/ip.4 ============================================================================== --- head/share/man/man4/ip.4 Fri Jun 15 08:50:44 2012 (r237131) +++ head/share/man/man4/ip.4 Fri Jun 15 09:12:47 2012 (r237132) @@ -32,7 +32,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd June 12, 2012 +.Dd June 15, 2012 .Dt IP 4 .Os .Sh NAME @@ -227,7 +227,7 @@ configured with the broadcast address 19 .Bd -literal char msg[512]; struct sockaddr_in sin; -u_char onesbcast = 1; /* 0 = disable (default), 1 = enable */ +int onesbcast = 1; /* 0 = disable (default), 1 = enable */ setsockopt(s, IPPROTO_IP, IP_ONESBCAST, &onesbcast, sizeof(onesbcast)); sin.sin_addr.s_addr = inet_addr("192.168.2.255"); From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 10:00:30 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 223551065675; Fri, 15 Jun 2012 10:00:30 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id E8B908FC17; Fri, 15 Jun 2012 10:00:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FA0Tge061468; Fri, 15 Jun 2012 10:00:29 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FA0TQM061466; Fri, 15 Jun 2012 10:00:29 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206151000.q5FA0TQM061466@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 15 Jun 2012 10:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237133 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 10:00:30 -0000 Author: pjd Date: Fri Jun 15 10:00:29 2012 New Revision: 237133 URL: http://svn.freebsd.org/changeset/base/237133 Log: One more attempt to make prototypes formated according to style(9), which holefully recovers from the "worse than useless" state. Reported by: bde MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Jun 15 09:12:47 2012 (r237132) +++ head/sys/kern/kern_descrip.c Fri Jun 15 10:00:29 2012 (r237133) @@ -114,21 +114,22 @@ static uma_zone_t file_zone; #define DUP_FIXED 0x1 /* Force fixed allocation */ #define DUP_FCNTL 0x2 /* fcntl()-style errors */ -static int closefp(struct filedesc *fdp, int fd, struct file *fp, - struct thread *td, int holdleaders); -static int do_dup(struct thread *td, int flags, int old, int new, - register_t *retval); -static int fd_first_free(struct filedesc *fdp, int low, int size); -static int fd_last_used(struct filedesc *fdp, int size); -static void fdgrowtable(struct filedesc *fdp, int nfd); -static void fdunused(struct filedesc *fdp, int fd); -static void fdused(struct filedesc *fdp, int fd); -static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); -static int fill_procdesc_info(struct procdesc *pdp, struct kinfo_file *kif); -static int fill_pts_info(struct tty *tp, struct kinfo_file *kif); -static int fill_shm_info(struct file *fp, struct kinfo_file *kif); -static int fill_socket_info(struct socket *so, struct kinfo_file *kif); -static int fill_vnode_info(struct vnode *vp, struct kinfo_file *kif); +static int closefp(struct filedesc *fdp, int fd, struct file *fp, + struct thread *td, int holdleaders); +static int do_dup(struct thread *td, int flags, int old, int new, + register_t *retval); +static int fd_first_free(struct filedesc *fdp, int low, int size); +static int fd_last_used(struct filedesc *fdp, int size); +static void fdgrowtable(struct filedesc *fdp, int nfd); +static void fdunused(struct filedesc *fdp, int fd); +static void fdused(struct filedesc *fdp, int fd); +static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif); +static int fill_procdesc_info(struct procdesc *pdp, + struct kinfo_file *kif); +static int fill_pts_info(struct tty *tp, struct kinfo_file *kif); +static int fill_shm_info(struct file *fp, struct kinfo_file *kif); +static int fill_socket_info(struct socket *so, struct kinfo_file *kif); +static int fill_vnode_info(struct vnode *vp, struct kinfo_file *kif); /* * A process is initially started out with NDFILE descriptors stored within From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 10:38:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A6634106566B; Fri, 15 Jun 2012 10:38:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 906468FC17; Fri, 15 Jun 2012 10:38:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FAcFs2070572; Fri, 15 Jun 2012 10:38:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FAcFts070560; Fri, 15 Jun 2012 10:38:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206151038.q5FAcFts070560@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 Jun 2012 10:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237134 - in stable/9/sys: compat/freebsd32 kern sys vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 10:38:15 -0000 Author: kib Date: Fri Jun 15 10:38:14 2012 New Revision: 237134 URL: http://svn.freebsd.org/changeset/base/237134 Log: MFC r226342 (by marcel): In elf32_trans_prot() and when compiling for amd64 or ia64, add PROT_EXECUTE when PROT_READ is needed. By default i386 allows execution when reading is allowed and JDK 1.4.x depends on that. MFC r226343 (by marcel): In sys_obreak() and when compiling for amd64 or ia64, when the process is ILP32 (i.e. i386) grant execute permissions by default. The JDK 1.4.x depends on being able to execute from the heap on i386. MFC r226347 (by marcel): In freebsd32_mmap() and when compiling for amd64 or ia64, also ask for execute permissions when read permissions are wanted. This is needed for JDK 1.4.x on i386. MFC r226348 (by marcel): Wrap mprotect(2). MFC r226349 (by marcel): Wrap mprotect(2) so that we can add execute permissions when read permissions are requested. This is needed on amd64 and ia64 for JDK 1.4.x. MFC r226353 (by marcel): Use PTRIN(). MFC r226388: Control the execution permission of the readable segments for i386 binaries on the amd64 and ia64 with the sysctl, instead of unconditionally enabling it. MFC note: the syscall tables were regenerated in r226349 and committed together with changes to non-generated files. The merge includes syscall tables regenerated after the merge, for stable/9. Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c stable/9/sys/compat/freebsd32/freebsd32_proto.h stable/9/sys/compat/freebsd32/freebsd32_syscall.h stable/9/sys/compat/freebsd32/freebsd32_syscalls.c stable/9/sys/compat/freebsd32/freebsd32_sysent.c stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c stable/9/sys/compat/freebsd32/syscalls.master stable/9/sys/kern/imgact_elf.c stable/9/sys/sys/sysent.h stable/9/sys/vm/vm_unix.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_misc.c Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/compat/freebsd32/freebsd32_misc.c Fri Jun 15 10:38:14 2012 (r237134) @@ -437,6 +437,21 @@ freebsd32_mmap_partial(struct thread *td #endif int +freebsd32_mprotect(struct thread *td, struct freebsd32_mprotect_args *uap) +{ + struct mprotect_args ap; + + ap.addr = PTRIN(uap->addr); + ap.len = uap->len; + ap.prot = uap->prot; +#if defined(__amd64__) || defined(__ia64__) + if (i386_read_exec && (ap.prot & PROT_READ) != 0) + ap.prot |= PROT_EXEC; +#endif + return (sys_mprotect(td, &ap)); +} + +int freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap) { struct mmap_args ap; @@ -520,6 +535,11 @@ freebsd32_mmap(struct thread *td, struct } #endif +#if defined(__amd64__) || defined(__ia64__) + if (i386_read_exec && (prot & PROT_READ)) + prot |= PROT_EXEC; +#endif + ap.addr = (void *) addr; ap.len = len; ap.prot = prot; Modified: stable/9/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_proto.h Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/compat/freebsd32/freebsd32_proto.h Fri Jun 15 10:38:14 2012 (r237134) @@ -76,6 +76,11 @@ struct freebsd32_execve_args { char argv_l_[PADL_(u_int32_t *)]; u_int32_t * argv; char argv_r_[PADR_(u_int32_t *)]; char envv_l_[PADL_(u_int32_t *)]; u_int32_t * envv; char envv_r_[PADR_(u_int32_t *)]; }; +struct freebsd32_mprotect_args { + char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; +}; struct freebsd32_setitimer_args { char which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)]; char itv_l_[PADL_(struct itimerval32 *)]; struct itimerval32 * itv; char itv_r_[PADR_(struct itimerval32 *)]; @@ -593,6 +598,7 @@ int freebsd32_recvfrom(struct thread *, int freebsd32_sigaltstack(struct thread *, struct freebsd32_sigaltstack_args *); int freebsd32_ioctl(struct thread *, struct freebsd32_ioctl_args *); int freebsd32_execve(struct thread *, struct freebsd32_execve_args *); +int freebsd32_mprotect(struct thread *, struct freebsd32_mprotect_args *); int freebsd32_setitimer(struct thread *, struct freebsd32_setitimer_args *); int freebsd32_getitimer(struct thread *, struct freebsd32_getitimer_args *); int freebsd32_select(struct thread *, struct freebsd32_select_args *); @@ -952,6 +958,7 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_execve AUE_EXECVE #define FREEBSD32_SYS_AUE_ofreebsd32_fstat AUE_FSTAT #define FREEBSD32_SYS_AUE_ofreebsd32_getpagesize AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_mprotect AUE_MPROTECT #define FREEBSD32_SYS_AUE_freebsd32_setitimer AUE_SETITIMER #define FREEBSD32_SYS_AUE_freebsd32_getitimer AUE_GETITIMER #define FREEBSD32_SYS_AUE_freebsd32_select AUE_SELECT Modified: stable/9/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_syscall.h Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/compat/freebsd32/freebsd32_syscall.h Fri Jun 15 10:38:14 2012 (r237134) @@ -80,7 +80,7 @@ /* 71 is obsolete ommap */ #define FREEBSD32_SYS_vadvise 72 #define FREEBSD32_SYS_munmap 73 -#define FREEBSD32_SYS_mprotect 74 +#define FREEBSD32_SYS_freebsd32_mprotect 74 #define FREEBSD32_SYS_madvise 75 /* 76 is obsolete vhangup */ /* 77 is obsolete vlimit */ Modified: stable/9/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jun 15 10:38:14 2012 (r237134) @@ -84,7 +84,7 @@ const char *freebsd32_syscallnames[] = { "obs_ommap", /* 71 = obsolete ommap */ "vadvise", /* 72 = vadvise */ "munmap", /* 73 = munmap */ - "mprotect", /* 74 = mprotect */ + "freebsd32_mprotect", /* 74 = freebsd32_mprotect */ "madvise", /* 75 = madvise */ "obs_vhangup", /* 76 = obsolete vhangup */ "obs_vlimit", /* 77 = obsolete vlimit */ Modified: stable/9/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_sysent.c Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/compat/freebsd32/freebsd32_sysent.c Fri Jun 15 10:38:14 2012 (r237134) @@ -121,7 +121,7 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 71 = obsolete ommap */ { AS(ovadvise_args), (sy_call_t *)sys_ovadvise, AUE_O_VADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 72 = vadvise */ { AS(munmap_args), (sy_call_t *)sys_munmap, AUE_MUNMAP, NULL, 0, 0, 0, SY_THR_STATIC }, /* 73 = munmap */ - { AS(mprotect_args), (sy_call_t *)sys_mprotect, AUE_MPROTECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 74 = mprotect */ + { AS(freebsd32_mprotect_args), (sy_call_t *)freebsd32_mprotect, AUE_MPROTECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 74 = freebsd32_mprotect */ { AS(madvise_args), (sy_call_t *)sys_madvise, AUE_MADVISE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 75 = madvise */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 76 = obsolete vhangup */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 77 = obsolete vlimit */ Modified: stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jun 15 10:38:14 2012 (r237134) @@ -464,9 +464,9 @@ systrace_args(int sysnum, void *params, *n_args = 2; break; } - /* mprotect */ + /* freebsd32_mprotect */ case 74: { - struct mprotect_args *p = params; + struct freebsd32_mprotect_args *p = params; uarg[0] = (intptr_t) p->addr; /* const void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->prot; /* int */ @@ -3749,7 +3749,7 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; - /* mprotect */ + /* freebsd32_mprotect */ case 74: switch(ndx) { case 0: Modified: stable/9/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/9/sys/compat/freebsd32/syscalls.master Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/compat/freebsd32/syscalls.master Fri Jun 15 10:38:14 2012 (r237134) @@ -172,7 +172,7 @@ 72 AUE_O_VADVISE NOPROTO { int ovadvise(int anom); } vadvise \ ovadvise_args int 73 AUE_MUNMAP NOPROTO { int munmap(void *addr, size_t len); } -74 AUE_MPROTECT NOPROTO { int mprotect(const void *addr, \ +74 AUE_MPROTECT STD { int freebsd32_mprotect(const void *addr, \ size_t len, int prot); } 75 AUE_MADVISE NOPROTO { int madvise(void *addr, size_t len, \ int behav); } Modified: stable/9/sys/kern/imgact_elf.c ============================================================================== --- stable/9/sys/kern/imgact_elf.c Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/kern/imgact_elf.c Fri Jun 15 10:38:14 2012 (r237134) @@ -123,6 +123,14 @@ SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WOR nxstack, CTLFLAG_RW, &__elfN(nxstack), 0, __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable stack"); +#if __ELF_WORD_SIZE == 32 +#if defined(__amd64__) || defined(__ia64__) +int i386_read_exec = 0; +SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_RW, &i386_read_exec, 0, + "enable execution from readable segments"); +#endif +#endif + static Elf_Brandinfo *elf_brand_list[MAX_BRANDS]; #define trunc_page_ps(va, ps) ((va) & ~(ps - 1)) @@ -1671,6 +1679,12 @@ __elfN(trans_prot)(Elf_Word flags) prot |= VM_PROT_WRITE; if (flags & PF_R) prot |= VM_PROT_READ; +#if __ELF_WORD_SIZE == 32 +#if defined(__amd64__) || defined(__ia64__) + if (i386_read_exec && (flags & PF_R)) + prot |= VM_PROT_EXECUTE; +#endif +#endif return (prot); } Modified: stable/9/sys/sys/sysent.h ============================================================================== --- stable/9/sys/sys/sysent.h Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/sys/sysent.h Fri Jun 15 10:38:14 2012 (r237134) @@ -151,6 +151,10 @@ extern struct sysentvec null_sysvec; extern struct sysent sysent[]; extern const char *syscallnames[]; +#if defined(__amd64__) || defined(__ia64__) +extern int i386_read_exec; +#endif + #define NO_SYSCALL (-1) struct module; Modified: stable/9/sys/vm/vm_unix.c ============================================================================== --- stable/9/sys/vm/vm_unix.c Fri Jun 15 10:00:29 2012 (r237133) +++ stable/9/sys/vm/vm_unix.c Fri Jun 15 10:38:14 2012 (r237134) @@ -36,6 +36,8 @@ * @(#)vm_unix.c 8.1 (Berkeley) 6/11/93 */ +#include "opt_compat.h" + /* * Traditional sbrk/grow interface to VM */ @@ -49,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -75,7 +78,7 @@ sys_obreak(td, uap) struct vmspace *vm = td->td_proc->p_vmspace; vm_offset_t new, old, base; rlim_t datalim, vmemlim; - int rv; + int prot, rv; int error = 0; boolean_t do_map_wirefuture; @@ -135,8 +138,15 @@ sys_obreak(td, uap) } PROC_UNLOCK(td->td_proc); #endif + prot = VM_PROT_RW; +#ifdef COMPAT_FREEBSD32 +#if defined(__amd64__) || defined(__ia64__) + if (i386_read_exec && SV_PROC_FLAG(td->td_proc, SV_ILP32)) + prot |= VM_PROT_EXECUTE; +#endif +#endif rv = vm_map_insert(&vm->vm_map, NULL, 0, old, new, - VM_PROT_RW, VM_PROT_ALL, 0); + prot, VM_PROT_ALL, 0); if (rv != KERN_SUCCESS) { #ifdef RACCT PROC_LOCK(td->td_proc); From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 12:32:25 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5947106566B; Fri, 15 Jun 2012 12:32:25 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 228848FC08; Fri, 15 Jun 2012 12:32:24 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q5FCWFiu010570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 Jun 2012 22:32:17 +1000 Date: Fri, 15 Jun 2012 22:32:15 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <201206151000.q5FA0TQM061466@svn.freebsd.org> Message-ID: <20120615222251.T1609@besplex.bde.org> References: <201206151000.q5FA0TQM061466@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r237133 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 12:32:25 -0000 On Fri, 15 Jun 2012, Pawel Jakub Dawidek wrote: > Log: > One more attempt to make prototypes formated according to style(9), Thanks. The prototypes look OK now. > which > holefully recovers from the "worse than useless" state. Er, my "worse than useless" description wasn't about prototypes. It was about putting a tab in the middle of type a declaration. The tab lines up some identifier, but this is worse than useless since it makes things look like they are lined up, but when you look closer you see that the wrong things are lined up. Example: struct fstat_args { int fd; struct stat *sb; }; Bruce From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 15:28:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 651651065670; Fri, 15 Jun 2012 15:28:16 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 5095A8FC14; Fri, 15 Jun 2012 15:28:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FFSG3u089577; Fri, 15 Jun 2012 15:28:16 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FFSG8R089575; Fri, 15 Jun 2012 15:28:16 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201206151528.q5FFSG8R089575@svn.freebsd.org> From: Matt Jacob Date: Fri, 15 Jun 2012 15:28:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237135 - head/sys/dev/isp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 15:28:16 -0000 Author: mjacob Date: Fri Jun 15 15:28:15 2012 New Revision: 237135 URL: http://svn.freebsd.org/changeset/base/237135 Log: If debug values were set, the default from tval floated down and triggered an attempt to set multiple virtual ports whether you wanted them or not. MFC after: 3 days Modified: head/sys/dev/isp/isp_pci.c Modified: head/sys/dev/isp/isp_pci.c ============================================================================== --- head/sys/dev/isp/isp_pci.c Fri Jun 15 10:38:14 2012 (r237134) +++ head/sys/dev/isp/isp_pci.c Fri Jun 15 15:28:15 2012 (r237135) @@ -483,6 +483,7 @@ isp_get_generic_options(device_t dev, is if (bootverbose) { isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; } + tval = 0; (void) resource_int_value(device_get_name(dev), device_get_unit(dev), "vports", &tval); if (tval > 0 && tval < 127) { *nvp = tval; From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 15:32:17 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 14B4B1065670; Fri, 15 Jun 2012 15:32:17 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id F2DB68FC0C; Fri, 15 Jun 2012 15:32:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FFWGuW089806; Fri, 15 Jun 2012 15:32:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FFWGh0089802; Fri, 15 Jun 2012 15:32:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206151532.q5FFWGh0089802@svn.freebsd.org> From: Adrian Chadd Date: Fri, 15 Jun 2012 15:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237136 - in head/sys: amd64/conf i386/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 15:32:17 -0000 Author: adrian Date: Fri Jun 15 15:32:16 2012 New Revision: 237136 URL: http://svn.freebsd.org/changeset/base/237136 Log: Oops - use the actual 11n enable option. Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Fri Jun 15 15:28:15 2012 (r237135) +++ head/sys/amd64/conf/GENERIC Fri Jun 15 15:32:16 2012 (r237136) @@ -274,7 +274,7 @@ device ath_pci # Atheros pci/cardbus g device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors options AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation -options ATH_SUPPORT_11N # Enable 802.11n support for AR5416 and later +options ATH_ENABLE_11N # Enable 802.11n support for AR5416 and later device ath_rate_sample # SampleRate tx rate control for ath #device bwi # Broadcom BCM430x/BCM431x wireless NICs. #device bwn # Broadcom BCM43xx wireless NICs. Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Fri Jun 15 15:28:15 2012 (r237135) +++ head/sys/i386/conf/GENERIC Fri Jun 15 15:32:16 2012 (r237136) @@ -286,7 +286,7 @@ device ath_pci # Atheros pci/cardbus g device ath_hal # pci/cardbus chip support options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors options AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation -options ATH_SUPPORT_11N # Enable 802.11n support for AR5416 and later +options ATH_ENABLE_11N # Enable 802.11n support for AR5416 and later device ath_rate_sample # SampleRate tx rate control for ath #device bwi # Broadcom BCM430x/BCM431x wireless NICs. #device bwn # Broadcom BCM43xx wireless NICs. From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 16:35:10 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C20C5106567E; Fri, 15 Jun 2012 16:35:10 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from acme.spoerlein.net (acme.spoerlein.net [88.198.49.12]) by mx1.freebsd.org (Postfix) with ESMTP id D5B628FC08; Fri, 15 Jun 2012 16:35:05 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.5/8.14.5) with ESMTP id q5FGYwlv062995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 15 Jun 2012 18:34:59 +0200 (CEST) (envelope-from uqs@FreeBSD.org) Date: Fri, 15 Jun 2012 18:34:58 +0200 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: Sergey Kandaurov Message-ID: <20120615163458.GX10094@acme.spoerlein.net> Mail-Followup-To: Ulrich =?utf-8?B?U3DDtnJsZWlu?= , Sergey Kandaurov , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201202281106.q1SB6qR2067935@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201202281106.q1SB6qR2067935@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r232249 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 16:35:10 -0000 On Tue, 2012-02-28 at 11:06:52 +0000, Sergey Kandaurov wrote: > Author: pluknet > Date: Tue Feb 28 11:06:52 2012 > New Revision: 232249 > URL: http://svn.freebsd.org/changeset/base/232249 > > Log: > Add lib32 part after libarchive 3.0.3 update. > > Modified: > head/ObsoleteFiles.inc > > Modified: head/ObsoleteFiles.inc > ============================================================================== > --- head/ObsoleteFiles.inc Tue Feb 28 08:36:38 2012 (r232248) > +++ head/ObsoleteFiles.inc Tue Feb 28 11:06:52 2012 (r232249) > @@ -56,6 +56,9 @@ OLD_FILES+=man/man3/archive_read_data_in > man/man3/archive_write_set_compression_none.3.gz \ > man/man3/archive_write_set_compression_program.3.gz > OLD_LIBS+=usr/lib/libarchive.so.5 > +.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" > +OLD_LIBS+=usr/lib32/libarchive.so.5 > +.endif > # 20120113: removal of wtmpcvt(1) > OLD_FILES+=usr/bin/wtmpcvt > OLD_FILES+=usr/share/man/man1/wtmpcvt.1.gz Please don't add TARGET_ARCH checks unless they are really necessary. Here they aren't, they very rarely are. Thanks Uli From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 16:50:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1B56106564A; Fri, 15 Jun 2012 16:50:32 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8DE208FC14; Fri, 15 Jun 2012 16:50:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FGoW5d092918; Fri, 15 Jun 2012 16:50:32 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FGoWTC092916; Fri, 15 Jun 2012 16:50:32 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206151650.q5FGoWTC092916@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 16:50:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237137 - head/sys/arm/s3c2xx0 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 16:50:32 -0000 Author: imp Date: Fri Jun 15 16:50:32 2012 New Revision: 237137 URL: http://svn.freebsd.org/changeset/base/237137 Log: Remove stray line from merge. Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c ============================================================================== --- head/sys/arm/s3c2xx0/s3c24x0_machdep.c Fri Jun 15 15:32:16 2012 (r237136) +++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c Fri Jun 15 16:50:32 2012 (r237137) @@ -249,7 +249,6 @@ initarm(struct arm_boot_params *abp) i = 0; set_cpufuncs(); cpufuncs.cf_sleep = s3c24x0_sleep; - lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 17:01:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15A991065781; Fri, 15 Jun 2012 17:01:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id F2BD48FC0A; Fri, 15 Jun 2012 17:01:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FH1Cpa093390; Fri, 15 Jun 2012 17:01:12 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FH1C3n093388; Fri, 15 Jun 2012 17:01:12 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206151701.q5FH1C3n093388@svn.freebsd.org> From: Warner Losh Date: Fri, 15 Jun 2012 17:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237138 - stable/8/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 17:01:13 -0000 Author: imp Date: Fri Jun 15 17:01:12 2012 New Revision: 237138 URL: http://svn.freebsd.org/changeset/base/237138 Log: Add a band-aide for MFCs: at91_is_rm92 is always true in 8 until SAM9 support is MFC'd. The recent change to spi now references this, so bring it in as a forward compatability. Modified: stable/8/sys/arm/at91/at91var.h Modified: stable/8/sys/arm/at91/at91var.h ============================================================================== --- stable/8/sys/arm/at91/at91var.h Fri Jun 15 16:50:32 2012 (r237137) +++ stable/8/sys/arm/at91/at91var.h Fri Jun 15 17:01:12 2012 (r237138) @@ -45,4 +45,6 @@ struct at91_ivar { extern uint32_t at91_master_clock; +#define at91_is_rm92() (1) /* Only support AT91RM9200 atm -- helps with MFCs */ + #endif /* _AT91VAR_H_ */ From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 17:31:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52A9A106566C; Fri, 15 Jun 2012 17:31:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 3C9918FC1B; Fri, 15 Jun 2012 17:31:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FHVGb0094675; Fri, 15 Jun 2012 17:31:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FHVF8v094670; Fri, 15 Jun 2012 17:31:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206151731.q5FHVF8v094670@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 Jun 2012 17:31:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237140 - in stable/9/sys: i386/i386 kern powerpc/aim powerpc/booke X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 17:31:16 -0000 Author: kib Date: Fri Jun 15 17:31:15 2012 New Revision: 237140 URL: http://svn.freebsd.org/changeset/base/237140 Log: MFC r230767: Enable nxstacks where supported. Modified: stable/9/sys/i386/i386/initcpu.c stable/9/sys/kern/imgact_elf.c stable/9/sys/powerpc/aim/mmu_oea64.c stable/9/sys/powerpc/booke/machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/i386/initcpu.c ============================================================================== --- stable/9/sys/i386/i386/initcpu.c Fri Jun 15 17:16:41 2012 (r237139) +++ stable/9/sys/i386/i386/initcpu.c Fri Jun 15 17:31:15 2012 (r237140) @@ -649,6 +649,8 @@ enable_sse(void) #endif } +extern int elf32_nxstack; + void initializecpu(void) { @@ -738,6 +740,7 @@ initializecpu(void) msr = rdmsr(MSR_EFER) | EFER_NXE; wrmsr(MSR_EFER, msr); pg_nx = PG_NX; + elf32_nxstack = 1; } #endif break; Modified: stable/9/sys/kern/imgact_elf.c ============================================================================== --- stable/9/sys/kern/imgact_elf.c Fri Jun 15 17:16:41 2012 (r237139) +++ stable/9/sys/kern/imgact_elf.c Fri Jun 15 17:31:15 2012 (r237140) @@ -118,7 +118,12 @@ static int elf_legacy_coredump = 0; SYSCTL_INT(_debug, OID_AUTO, __elfN(legacy_coredump), CTLFLAG_RW, &elf_legacy_coredump, 0, ""); -static int __elfN(nxstack) = 0; +int __elfN(nxstack) = +#if defined(__amd64__) || defined(__powerpc64__) /* both 64 and 32 bit */ + 1; +#else + 0; +#endif SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, nxstack, CTLFLAG_RW, &__elfN(nxstack), 0, __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": enable non-executable stack"); Modified: stable/9/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/9/sys/powerpc/aim/mmu_oea64.c Fri Jun 15 17:16:41 2012 (r237139) +++ stable/9/sys/powerpc/aim/mmu_oea64.c Fri Jun 15 17:31:15 2012 (r237140) @@ -1448,6 +1448,8 @@ moea64_uma_page_alloc(uma_zone_t zone, i return (void *)va; } +extern int elf32_nxstack; + void moea64_init(mmu_t mmu) { @@ -1467,6 +1469,8 @@ moea64_init(mmu_t mmu) uma_zone_set_allocf(moea64_mpvo_zone,moea64_uma_page_alloc); } + elf32_nxstack = 1; + moea64_initialized = TRUE; } Modified: stable/9/sys/powerpc/booke/machdep.c ============================================================================== --- stable/9/sys/powerpc/booke/machdep.c Fri Jun 15 17:16:41 2012 (r237139) +++ stable/9/sys/powerpc/booke/machdep.c Fri Jun 15 17:31:15 2012 (r237140) @@ -192,6 +192,8 @@ void print_kernel_section_addr(void); void print_kenv(void); u_int booke_init(uint32_t, uint32_t); +extern int elf32_nxstack; + static void cpu_e500_startup(void *dummy) { @@ -227,6 +229,9 @@ cpu_e500_startup(void *dummy) /* Set up buffers, so they can be used to read disk labels. */ bufinit(); vm_pager_bufferinit(); + + /* Cpu supports execution permissions on the pages. */ + elf32_nxstack = 1; } static char * From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 19:41:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 82EF9106566B; Fri, 15 Jun 2012 19:41:00 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E8058FC0C; Fri, 15 Jun 2012 19:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FJf0D4099933; Fri, 15 Jun 2012 19:41:00 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FJf0cK099931; Fri, 15 Jun 2012 19:41:00 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201206151941.q5FJf0cK099931@svn.freebsd.org> From: Brooks Davis Date: Fri, 15 Jun 2012 19:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237141 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 19:41:00 -0000 Author: brooks Date: Fri Jun 15 19:40:59 2012 New Revision: 237141 URL: http://svn.freebsd.org/changeset/base/237141 Log: MFP4: 212854, 212854 Add a LOCAL_LIB_DIRS variable to complement the existing LOCAL_DIRS and LOCAL_TOOL_DIRS variables. Directories in LOCAL_LIB_DIRS are built at the end of the _generic_libs target. Reviewed by: imp (212854) Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jun 15 17:31:15 2012 (r237140) +++ head/Makefile.inc1 Fri Jun 15 19:40:59 2012 (r237141) @@ -15,6 +15,7 @@ # -DNO_WWWUPDATE do not update www in ${MAKE} update # -DNO_CTF do not run the DTrace CTF conversion tools on built objects # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list +# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools # list # TARGET="machine" to crossbuild world for a different machine type @@ -88,7 +89,7 @@ SUBDIR+=etc # These are last, since it is nice to at least get the base system # rebuilt before you do them. -.for _DIR in ${LOCAL_DIRS} +.for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS} .if exists(${.CURDIR}/${_DIR}/Makefile) SUBDIR+= ${_DIR} .endif @@ -1273,6 +1274,11 @@ _ofed_lib= contrib/ofed/usr.lib/ .endif _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} +.for _DIR in ${LOCAL_LIB_DIRS} +.if exists(${.CURDIR}/${_DIR}/Makefile) +_generic_libs+= ${_DIR} +.endif +.endfor lib/libopie__L lib/libtacplus__L: lib/libmd__L From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 19:42:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 344B31065673; Fri, 15 Jun 2012 19:42:50 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2006B8FC15; Fri, 15 Jun 2012 19:42:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FJgnh0000145; Fri, 15 Jun 2012 19:42:49 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FJgn8K000143; Fri, 15 Jun 2012 19:42:49 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201206151942.q5FJgn8K000143@svn.freebsd.org> From: Brooks Davis Date: Fri, 15 Jun 2012 19:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237142 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 19:42:50 -0000 Author: brooks Date: Fri Jun 15 19:42:49 2012 New Revision: 237142 URL: http://svn.freebsd.org/changeset/base/237142 Log: Minor wording change. The previous commit message should have included: Sponsored by: DARPA, AFRL Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jun 15 19:40:59 2012 (r237141) +++ head/Makefile.inc1 Fri Jun 15 19:42:49 2012 (r237142) @@ -15,7 +15,7 @@ # -DNO_WWWUPDATE do not update www in ${MAKE} update # -DNO_CTF do not run the DTrace CTF conversion tools on built objects # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list -# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries +# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools # list # TARGET="machine" to crossbuild world for a different machine type From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 20:08:14 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E7BE106564A; Fri, 15 Jun 2012 20:08:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29C4E8FC18; Fri, 15 Jun 2012 20:08:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FK8EAu001236; Fri, 15 Jun 2012 20:08:14 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FK8DP0001234; Fri, 15 Jun 2012 20:08:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206152008.q5FK8DP0001234@svn.freebsd.org> From: Adrian Chadd Date: Fri, 15 Jun 2012 20:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237143 - head/tools/tools/ath/athdebug X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 20:08:14 -0000 Author: adrian Date: Fri Jun 15 20:08:13 2012 New Revision: 237143 URL: http://svn.freebsd.org/changeset/base/237143 Log: Convert athdebug to use the 64 bit dev.ath.X.debug sysctl. Modified: head/tools/tools/ath/athdebug/athdebug.c Modified: head/tools/tools/ath/athdebug/athdebug.c ============================================================================== --- head/tools/tools/ath/athdebug/athdebug.c Fri Jun 15 19:42:49 2012 (r237142) +++ head/tools/tools/ath/athdebug/athdebug.c Fri Jun 15 20:08:13 2012 (r237143) @@ -51,6 +51,7 @@ const char *progname; +/* XXX TODO: include if_ath_debug.h */ enum { ATH_DEBUG_XMIT = 0x00000001, /* basic xmit operation */ ATH_DEBUG_XMIT_DESC = 0x00000002, /* xmit descriptors */ @@ -81,7 +82,7 @@ enum { static struct { const char *name; - u_int bit; + uint64_t bit; } flags[] = { { "xmit", ATH_DEBUG_XMIT }, { "xmit_desc", ATH_DEBUG_XMIT_DESC }, @@ -109,7 +110,7 @@ static struct { { "fatal", ATH_DEBUG_FATAL }, }; -static u_int +static uint64_t getflag(const char *name, int len) { int i; @@ -150,7 +151,7 @@ main(int argc, char *argv[]) const char *cp, *tp; const char *sep; int c, op, i; - u_int32_t debug, ndebug; + uint64_t debug, ndebug; size_t debuglen; char oid[256]; From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 20:25:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5CBC1065672; Fri, 15 Jun 2012 20:25:44 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6EF78FC16; Fri, 15 Jun 2012 20:25:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FKPikd002009; Fri, 15 Jun 2012 20:25:44 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FKPiKc002007; Fri, 15 Jun 2012 20:25:44 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201206152025.q5FKPiKc002007@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 15 Jun 2012 20:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237144 - stable/9/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 20:25:45 -0000 Author: trociny Date: Fri Jun 15 20:25:44 2012 New Revision: 237144 URL: http://svn.freebsd.org/changeset/base/237144 Log: MFC 236724, 236725: MFC 236724: Add VIMAGE support to if_tap. PR: kern/152047, kern/158686 Submitted by: Daan Vreeken MFC 236725: Sort includes. Submitted by: Daan Vreeken Modified: stable/9/sys/net/if_tap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/net/if_tap.c ============================================================================== --- stable/9/sys/net/if_tap.c Fri Jun 15 20:08:13 2012 (r237143) +++ stable/9/sys/net/if_tap.c Fri Jun 15 20:25:44 2012 (r237144) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -64,8 +65,9 @@ #include #include #include -#include #include +#include +#include #include @@ -214,6 +216,7 @@ tap_destroy(struct tap_softc *tp) KASSERT(!(tp->tap_flags & TAP_OPEN), ("%s flags is out of sync", ifp->if_xname)); + CURVNET_SET(ifp->if_vnet); seldrain(&tp->tap_rsel); knlist_destroy(&tp->tap_rsel.si_note); destroy_dev(tp->tap_dev); @@ -222,6 +225,7 @@ tap_destroy(struct tap_softc *tp) mtx_destroy(&tp->tap_mtx); free(tp, M_TAP); + CURVNET_RESTORE(); } static void @@ -363,6 +367,7 @@ tapclone(void *arg, struct ucred *cred, if (unit == -1) append_unit = 1; + CURVNET_SET(CRED_TO_VNET(cred)); /* find any existing device, or allocate new unit number */ i = clone_create(&tapclones, &tap_cdevsw, &unit, dev, extra); if (i) { @@ -381,6 +386,7 @@ tapclone(void *arg, struct ucred *cred, } if_clone_create(name, namelen, NULL); + CURVNET_RESTORE(); } /* tapclone */ @@ -521,6 +527,7 @@ tapclose(struct cdev *dev, int foo, int /* junk all pending output */ mtx_lock(&tp->tap_mtx); + CURVNET_SET(ifp->if_vnet); IF_DRAIN(&ifp->if_snd); /* @@ -544,6 +551,8 @@ tapclose(struct cdev *dev, int foo, int } if_link_state_change(ifp, LINK_STATE_DOWN); + CURVNET_RESTORE(); + funsetown(&tp->tap_sigio); selwakeuppri(&tp->tap_rsel, PZERO+1); KNOTE_LOCKED(&tp->tap_rsel.si_note, 0); @@ -945,7 +954,9 @@ tapwrite(struct cdev *dev, struct uio *u } /* Pass packet up to parent. */ + CURVNET_SET(ifp->if_vnet); (*ifp->if_input)(ifp, m); + CURVNET_RESTORE(); ifp->if_ipackets ++; /* ibytes are counted in parent */ return (0); From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 20:26:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B21EA10657F7; Fri, 15 Jun 2012 20:26:02 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-gg0-f182.google.com (mail-gg0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1B7238FC0C; Fri, 15 Jun 2012 20:26:02 +0000 (UTC) Received: by ggnm2 with SMTP id m2so3133380ggn.13 for ; Fri, 15 Jun 2012 13:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=k6pyZtGr1RE9t5y4lbxH3VZIWWEJRZMKbqrRVZmqK0Y=; b=pVaFRsmWdLnXfF9gTxus2sPPZNl3RglpDs/eUft6a0DXq78IeUfPNMqCVD8KNVunTm xAcueQWD4doTwn1swCfMbICwgycZSO8PAVXzY3yXStSIr3ckKUTcafnspcvv9zNFTX5P ElJWprfigfc+FKjJlk64ezNh0xJHT0Lu9fv+qNXbLcfR+bwqeca1Nmac2BaWmgFzZjUT xz7mrpGWjitNj+2p0MMSZ+WsOvSWT2Nw7Olw7eNBMnfxYMSj5nCW2kELp/b9MG+3HV9K gH+7NMkWvhnGMDHo7Ql/in1QFds79bEAqkSLLbxTWL7Hg4LWgHjBLEOxtFi3hqN0C2QW Fqnw== MIME-Version: 1.0 Received: by 10.50.160.202 with SMTP id xm10mr3279446igb.10.1339791961049; Fri, 15 Jun 2012 13:26:01 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.64.8.170 with HTTP; Fri, 15 Jun 2012 13:26:00 -0700 (PDT) In-Reply-To: <20120615163458.GX10094@acme.spoerlein.net> References: <201202281106.q1SB6qR2067935@svn.freebsd.org> <20120615163458.GX10094@acme.spoerlein.net> Date: Sat, 16 Jun 2012 00:26:00 +0400 X-Google-Sender-Auth: Ui4FzjZ0Bmul75tJEfgypBPVluk Message-ID: From: Sergey Kandaurov To: =?ISO-8859-1?Q?Ulrich_Sp=F6rlein?= , Sergey Kandaurov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r232249 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 20:26:02 -0000 On 15 June 2012 20:34, Ulrich Sp=F6rlein wrote: > On Tue, 2012-02-28 at 11:06:52 +0000, Sergey Kandaurov wrote: >> Author: pluknet >> Date: Tue Feb 28 11:06:52 2012 >> New Revision: 232249 >> URL: http://svn.freebsd.org/changeset/base/232249 >> >> Log: >> =A0 Add lib32 part after libarchive 3.0.3 update. >> >> Modified: >> =A0 head/ObsoleteFiles.inc >> >> Modified: head/ObsoleteFiles.inc >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/ObsoleteFiles.inc =A0 =A0Tue Feb 28 08:36:38 2012 =A0 =A0 =A0 = =A0(r232248) >> +++ head/ObsoleteFiles.inc =A0 =A0Tue Feb 28 11:06:52 2012 =A0 =A0 =A0 = =A0(r232249) >> @@ -56,6 +56,9 @@ OLD_FILES+=3Dman/man3/archive_read_data_in >> =A0 =A0 =A0 man/man3/archive_write_set_compression_none.3.gz \ >> =A0 =A0 =A0 man/man3/archive_write_set_compression_program.3.gz >> =A0OLD_LIBS+=3Dusr/lib/libarchive.so.5 >> +.if ${TARGET_ARCH} =3D=3D "amd64" || ${TARGET_ARCH} =3D=3D "powerpc64" >> +OLD_LIBS+=3Dusr/lib32/libarchive.so.5 >> +.endif >> =A0# 20120113: removal of wtmpcvt(1) >> =A0OLD_FILES+=3Dusr/bin/wtmpcvt >> =A0OLD_FILES+=3Dusr/share/man/man1/wtmpcvt.1.gz > > Please don't add TARGET_ARCH checks unless they are really necessary. > Here they aren't, they very rarely are. This is a quite old change. Please see http://svn.freebsd.org/changeset/base/233010 --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 20:27:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD3B51065670; Fri, 15 Jun 2012 20:27:16 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73E6B8FC14; Fri, 15 Jun 2012 20:27:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FKRG25002110; Fri, 15 Jun 2012 20:27:16 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FKRGXW002108; Fri, 15 Jun 2012 20:27:16 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201206152027.q5FKRGXW002108@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 15 Jun 2012 20:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237145 - stable/8/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 20:27:17 -0000 Author: trociny Date: Fri Jun 15 20:27:15 2012 New Revision: 237145 URL: http://svn.freebsd.org/changeset/base/237145 Log: MFC 236724, 236725: MFC 236724: Add VIMAGE support to if_tap. PR: kern/152047, kern/158686 Submitted by: Daan Vreeken MFC 236725: Sort includes. Submitted by: Daan Vreeken Modified: stable/8/sys/net/if_tap.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/net/if_tap.c ============================================================================== --- stable/8/sys/net/if_tap.c Fri Jun 15 20:25:44 2012 (r237144) +++ stable/8/sys/net/if_tap.c Fri Jun 15 20:27:15 2012 (r237145) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -64,8 +65,9 @@ #include #include #include -#include #include +#include +#include #include @@ -214,6 +216,7 @@ tap_destroy(struct tap_softc *tp) KASSERT(!(tp->tap_flags & TAP_OPEN), ("%s flags is out of sync", ifp->if_xname)); + CURVNET_SET(ifp->if_vnet); seldrain(&tp->tap_rsel); knlist_destroy(&tp->tap_rsel.si_note); destroy_dev(tp->tap_dev); @@ -222,6 +225,7 @@ tap_destroy(struct tap_softc *tp) mtx_destroy(&tp->tap_mtx); free(tp, M_TAP); + CURVNET_RESTORE(); } static void @@ -363,6 +367,7 @@ tapclone(void *arg, struct ucred *cred, if (unit == -1) append_unit = 1; + CURVNET_SET(CRED_TO_VNET(cred)); /* find any existing device, or allocate new unit number */ i = clone_create(&tapclones, &tap_cdevsw, &unit, dev, extra); if (i) { @@ -381,6 +386,7 @@ tapclone(void *arg, struct ucred *cred, } if_clone_create(name, namelen, NULL); + CURVNET_RESTORE(); } /* tapclone */ @@ -521,6 +527,7 @@ tapclose(struct cdev *dev, int foo, int /* junk all pending output */ mtx_lock(&tp->tap_mtx); + CURVNET_SET(ifp->if_vnet); IF_DRAIN(&ifp->if_snd); /* @@ -544,6 +551,8 @@ tapclose(struct cdev *dev, int foo, int } if_link_state_change(ifp, LINK_STATE_DOWN); + CURVNET_RESTORE(); + funsetown(&tp->tap_sigio); selwakeuppri(&tp->tap_rsel, PZERO+1); KNOTE_LOCKED(&tp->tap_rsel.si_note, 0); @@ -945,7 +954,9 @@ tapwrite(struct cdev *dev, struct uio *u } /* Pass packet up to parent. */ + CURVNET_SET(ifp->if_vnet); (*ifp->if_input)(ifp, m); + CURVNET_RESTORE(); ifp->if_ipackets ++; /* ibytes are counted in parent */ return (0); From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 21:27:05 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 809CD1065674; Fri, 15 Jun 2012 21:27:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id D26038FC1C; Fri, 15 Jun 2012 21:27:03 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5FLQq93064740; Sat, 16 Jun 2012 00:26:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5FLQqZL068859; Sat, 16 Jun 2012 00:26:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5FLQppg068858; Sat, 16 Jun 2012 00:26:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 16 Jun 2012 00:26:51 +0300 From: Konstantin Belousov To: Guy Helmer Message-ID: <20120615212651.GH2337@deviant.kiev.zoral.com.ua> References: <201206142148.q5ELmFul023002@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WFYXJKyHTUiGqOmp" Content-Disposition: inline In-Reply-To: <201206142148.q5ELmFul023002@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r237106 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 21:27:05 -0000 --WFYXJKyHTUiGqOmp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 14, 2012 at 09:48:15PM +0000, Guy Helmer wrote: > Author: ghelmer > Date: Thu Jun 14 21:48:14 2012 > New Revision: 237106 > URL: http://svn.freebsd.org/changeset/base/237106 >=20 > Log: > MFC 235739-235740,236402: > Apply style(9) to return and switch/case statements. > =20 > Add checks for memory allocation failures in appropriate places, and > avoid creating bad entries in the grp list as a result of memory alloca= tion > failures while building new entries. > =20 > Style(9) improvements: remove unnecessary parenthesis, improve order > of local variable declarations, remove bogus casts, and resolve long > lines. > =20 > PR: bin/83340 >=20 > Modified: > stable/9/lib/libc/gen/getnetgrent.c > Directory Properties: > stable/9/lib/libc/ (props changed) >=20 This broke mountd(8) for me. It dies with SIGSEGV on start. Autopsy has shown that this happen due to free(3) on an unallocated pointer. I have two netgroups in my /etc/netgroup: testboxes (solo.home, , ) (x.home, , ) (nv.home, , ) (sandy.home, , ) (tom.= home, ,) laptops (alf.home, , ) (alf.home-air, , ) (sirion.home, , ) (sirion.home-ai= r, , ) The http://people.freebsd.org/~kib/misc/netgr.c shows the issue. Run it as "netgr testboxes laptops". Your change below makes lp->l_lines pointer for already processed groups invalid because you reallocf(3) the memory pointed by it. Then 1. accessing the l_lines later causes undefined behaviour; 2. free(3) call in endnetgrent() dies because pointer is dandling. > @@ -595,15 +615,15 @@ read_for_group(const char *group) > } else > cont =3D 0; > if (len > 0) { > - linep =3D (char *)malloc(olen + len + 1); > - if (olen > 0) { > - bcopy(olinep, linep, olen); > - free(olinep); > + linep =3D reallocf(linep, olen + len + 1); > + if (linep =3D=3D NULL) { > + free(lp->l_groupname); > + free(lp); > + return (NULL); > } > bcopy(pos, linep + olen, len); > olen +=3D len; > *(linep + olen) =3D '\0'; > - olinep =3D linep; > } > if (cont) { > if (fgets(line, LINSIZ, netf)) { Below is partial revert of your changes that cures mountd for me. Also, the second patch does some further cleanup of the getnetgrent.c. Do you agree ? commit d5cb6720e8d12b281e89f2487561fe95addd0e34 Author: Konstantin Belousov Date: Sat Jun 16 00:21:11 2012 +0300 Partially revert r235740, namely, allocate separate blocks of memory for each group' l_line. Using the reallocf(3) invalidates l_line's of the previously read groups. diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 933a7d3..8cad6c4 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -538,7 +538,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep; + char *pos, *spos, *linep, *olinep; int len, olen; int cont; struct linelist *lp; @@ -615,15 +615,20 @@ read_for_group(const char *group) } else cont =3D 0; if (len > 0) { - linep =3D reallocf(linep, olen + len + 1); + linep =3D malloc(olen + len + 1); if (linep =3D=3D NULL) { free(lp->l_groupname); free(lp); return (NULL); } + if (olen > 0) { + bcopy(olinep, linep, olen); + free(olinep); + } bcopy(pos, linep + olen, len); olen +=3D len; *(linep + olen) =3D '\0'; + olinep =3D linep; } if (cont) { if (fgets(line, LINSIZ, netf)) { commit 5946753b4b094d5f7ac41792df64915434567fd8 Author: Konstantin Belousov Date: Sat Jun 16 00:23:01 2012 +0300 More style. diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 8cad6c4..d94fff7 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -161,8 +161,7 @@ setnetgrent(const char *group) if (group =3D=3D NULL || !strlen(group)) return; =20 - if (grouphead.gr =3D=3D (struct netgrp *)0 || - strcmp(group, grouphead.grname)) { + if (grouphead.gr =3D=3D NULL || strcmp(group, grouphead.grname)) { endnetgrent(); #ifdef YP /* Presumed guilty until proven innocent. */ @@ -172,7 +171,7 @@ setnetgrent(const char *group) * use NIS exclusively. */ if (((stat(_PATH_NETGROUP, &_yp_statp) < 0) && - errno =3D=3D ENOENT) || _yp_statp.st_size =3D=3D 0) + errno =3D=3D ENOENT) || _yp_statp.st_size =3D=3D 0) _use_only_yp =3D _netgr_yp_enabled =3D 1; if ((netf =3D fopen(_PATH_NETGROUP,"r")) !=3D NULL ||_use_only_yp){ /* @@ -247,27 +246,24 @@ endnetgrent(void) lp =3D lp->l_next; free(olp->l_groupname); free(olp->l_line); - free((char *)olp); + free(olp); } - linehead =3D (struct linelist *)0; + linehead =3D NULL; if (grouphead.grname) { free(grouphead.grname); - grouphead.grname =3D (char *)0; + grouphead.grname =3D NULL; } gp =3D grouphead.gr; while (gp) { ogp =3D gp; gp =3D gp->ng_next; - if (ogp->ng_str[NG_HOST]) - free(ogp->ng_str[NG_HOST]); - if (ogp->ng_str[NG_USER]) - free(ogp->ng_str[NG_USER]); - if (ogp->ng_str[NG_DOM]) - free(ogp->ng_str[NG_DOM]); - free((char *)ogp); + free(ogp->ng_str[NG_HOST]); + free(ogp->ng_str[NG_USER]); + free(ogp->ng_str[NG_DOM]); + free(ogp); } - grouphead.gr =3D (struct netgrp *)0; - nextgrp =3D (struct netgrp *)0; + grouphead.gr =3D NULL; + nextgrp =3D NULL; #ifdef YP _netgr_yp_enabled =3D 0; #endif @@ -282,7 +278,7 @@ _listmatch(const char *list, const char *group, int len) int glen =3D strlen(group); =20 /* skip possible leading whitespace */ - while(isspace((unsigned char)*ptr)) + while (isspace((unsigned char)*ptr)) ptr++; =20 while (ptr < list + len) { @@ -291,7 +287,7 @@ _listmatch(const char *list, const char *group, int len) ptr++; if (strncmp(cptr, group, glen) =3D=3D 0 && glen =3D=3D (ptr - cptr)) return (1); - while(*ptr =3D=3D ',' || isspace((unsigned char)*ptr)) + while (*ptr =3D=3D ',' || isspace((unsigned char)*ptr)) ptr++; } =20 @@ -436,8 +432,7 @@ parse_netgrp(const char *group) break; lp =3D lp->l_next; } - if (lp =3D=3D (struct linelist *)0 && - (lp =3D read_for_group(group)) =3D=3D (struct linelist *)0) + if (lp =3D=3D NULL && (lp =3D read_for_group(group)) =3D=3D NULL) return (1); if (lp->l_parsed) { #ifdef DEBUG --WFYXJKyHTUiGqOmp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/bqJsACgkQC3+MBN1Mb4g0OgCeICn8JafwTeuEFyX6W/832Vdo 5t8An0ruEzvPgjB1ESel21VkvL/cSyH0 =AIOB -----END PGP SIGNATURE----- --WFYXJKyHTUiGqOmp-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 22:49:19 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B67691065677; Fri, 15 Jun 2012 22:49:19 +0000 (UTC) (envelope-from ghelmer@palisadesystems.com) Received: from mail.palisadesystems.com (mail.palisadesystems.com [216.81.178.129]) by mx1.freebsd.org (Postfix) with ESMTP id 6CC988FC14; Fri, 15 Jun 2012 22:49:19 +0000 (UTC) Received: from [192.168.1.107] (173-25-206-151.client.mchsi.com [173.25.206.151]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q5FMXRLt036836 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 15 Jun 2012 17:33:27 -0500 (CDT) (envelope-from ghelmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q5FMXRLt036836 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1339799608; bh=yoBitkjwxK1TY+PxvpZnl1H4Zvpybj3K6cfAErUHLzM=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=iuSFZISkdLjkeRGyxcpFx8D4Gc3YWCsDraVTpT0hzW8XFvWXHiWe2NPIREXwpqF0Q xq7KVrg/XrZPo1M9tlPa6FPm9Jv9Jea0WqAYJdTvPsx201rn74gh9UMGHldxUocnUb 4iHtnbkIK0UtaoGFfE6svzQwx6ytF8hWDbSQReM8= Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=windows-1252 From: Guy Helmer In-Reply-To: <20120615212651.GH2337@deviant.kiev.zoral.com.ua> Date: Fri, 15 Jun 2012 17:33:27 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <880C698D-7620-48CB-B0EB-68BBC7FECDBB@palisadesystems.com> References: <201206142148.q5ELmFul023002@svn.freebsd.org> <20120615212651.GH2337@deviant.kiev.zoral.com.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1278) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Fri, 15 Jun 2012 17:33:28 -0500 (CDT) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q5FMXRLt036836 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam, SpamAssassin (score=2.084, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, J_CHICKENPOX_53 0.60, J_CHICKENPOX_56 0.60, J_CHICKENPOX_64 0.60, J_CHICKENPOX_65 0.60, J_CHICKENPOX_92 0.60, RP_8BIT 1.98) X-Palisade-MailScanner-SpamScore: ss X-Palisade-MailScanner-From: ghelmer@palisadesystems.com X-Spam-Status: No Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r237106 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 22:49:19 -0000 On Jun 15, 2012, at 4:26 PM, Konstantin Belousov wrote: > On Thu, Jun 14, 2012 at 09:48:15PM +0000, Guy Helmer wrote: >> Author: ghelmer >> Date: Thu Jun 14 21:48:14 2012 >> New Revision: 237106 >> URL: http://svn.freebsd.org/changeset/base/237106 >>=20 >> Log: >> MFC 235739-235740,236402: >> Apply style(9) to return and switch/case statements. >>=20 >> Add checks for memory allocation failures in appropriate places, and >> avoid creating bad entries in the grp list as a result of memory = allocation >> failures while building new entries. >>=20 >> Style(9) improvements: remove unnecessary parenthesis, improve order >> of local variable declarations, remove bogus casts, and resolve long >> lines. >>=20 >> PR: bin/83340 >>=20 >> Modified: >> stable/9/lib/libc/gen/getnetgrent.c >> Directory Properties: >> stable/9/lib/libc/ (props changed) >>=20 > This broke mountd(8) for me. It dies with SIGSEGV on start. Autopsy = has > shown that this happen due to free(3) on an unallocated pointer. >=20 > I have two netgroups in my /etc/netgroup: > testboxes (solo.home, , ) (x.home, , ) (nv.home, , ) (sandy.home, , ) = (tom.home, ,) > laptops (alf.home, , ) (alf.home-air, , ) (sirion.home, , ) = (sirion.home-air, , ) >=20 > The http://people.freebsd.org/~kib/misc/netgr.c shows the issue. Run = it > as "netgr testboxes laptops". >=20 > Your change below makes lp->l_lines pointer for already processed = groups > invalid because you reallocf(3) the memory pointed by it. Then > 1. accessing the l_lines later causes undefined behaviour; > 2. free(3) call in endnetgrent() dies because pointer is dandling. >=20 >> @@ -595,15 +615,15 @@ read_for_group(const char *group) >> } else >> cont =3D 0; >> if (len > 0) { >> - linep =3D (char *)malloc(olen + = len + 1); >> - if (olen > 0) { >> - bcopy(olinep, linep, = olen); >> - free(olinep); >> + linep =3D reallocf(linep, olen + = len + 1); >> + if (linep =3D=3D NULL) { >> + free(lp->l_groupname); >> + free(lp); >> + return (NULL); >> } >> bcopy(pos, linep + olen, len); >> olen +=3D len; >> *(linep + olen) =3D '\0'; >> - olinep =3D linep; >> } >> if (cont) { >> if (fgets(line, LINSIZ, netf)) { >=20 > Below is partial revert of your changes that cures mountd for me. = Also, > the second patch does some further cleanup of the getnetgrent.c. >=20 > Do you agree ? Sorry for the breakage. FWIW, I am having difficulty seeing how: linep =3D malloc(olen + len + = 1); =85 if (olen > 0) { bcopy(olinep, linep, = olen); free(olinep); } is different from: linep =3D reallocf(linep, olen + = len + 1); but if it fixes the issue, it is good. I would beware the disorder in = the sorting of the variables in the line: char *pos, *spos, *linep, *olinep;". Thank you for researching and resolving the issue. Guy >=20 > commit d5cb6720e8d12b281e89f2487561fe95addd0e34 > Author: Konstantin Belousov > Date: Sat Jun 16 00:21:11 2012 +0300 >=20 > Partially revert r235740, namely, allocate separate blocks of = memory > for each group' l_line. Using the reallocf(3) invalidates l_line's = of > the previously read groups. >=20 > diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c > index 933a7d3..8cad6c4 100644 > --- a/lib/libc/gen/getnetgrent.c > +++ b/lib/libc/gen/getnetgrent.c > @@ -538,7 +538,7 @@ parse_netgrp(const char *group) > static struct linelist * > read_for_group(const char *group) > { > - char *pos, *spos, *linep; > + char *pos, *spos, *linep, *olinep; > int len, olen; > int cont; > struct linelist *lp; > @@ -615,15 +615,20 @@ read_for_group(const char *group) > } else > cont =3D 0; > if (len > 0) { > - linep =3D reallocf(linep, olen + = len + 1); > + linep =3D malloc(olen + len + = 1); > if (linep =3D=3D NULL) { > free(lp->l_groupname); > free(lp); > return (NULL); > } > + if (olen > 0) { > + bcopy(olinep, linep, = olen); > + free(olinep); > + } > bcopy(pos, linep + olen, len); > olen +=3D len; > *(linep + olen) =3D '\0'; > + olinep =3D linep; > } > if (cont) { > if (fgets(line, LINSIZ, netf)) { >=20 >=20 > commit 5946753b4b094d5f7ac41792df64915434567fd8 > Author: Konstantin Belousov > Date: Sat Jun 16 00:23:01 2012 +0300 >=20 > More style. >=20 > diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c > index 8cad6c4..d94fff7 100644 > --- a/lib/libc/gen/getnetgrent.c > +++ b/lib/libc/gen/getnetgrent.c > @@ -161,8 +161,7 @@ setnetgrent(const char *group) > if (group =3D=3D NULL || !strlen(group)) > return; >=20 > - if (grouphead.gr =3D=3D (struct netgrp *)0 || > - strcmp(group, grouphead.grname)) { > + if (grouphead.gr =3D=3D NULL || strcmp(group, grouphead.grname)) = { > endnetgrent(); > #ifdef YP > /* Presumed guilty until proven innocent. */ > @@ -172,7 +171,7 @@ setnetgrent(const char *group) > * use NIS exclusively. > */ > if (((stat(_PATH_NETGROUP, &_yp_statp) < 0) && > - errno =3D=3D ENOENT) || _yp_statp.st_size =3D=3D = 0) > + errno =3D=3D ENOENT) || _yp_statp.st_size =3D=3D 0) > _use_only_yp =3D _netgr_yp_enabled =3D 1; > if ((netf =3D fopen(_PATH_NETGROUP,"r")) !=3D NULL = ||_use_only_yp){ > /* > @@ -247,27 +246,24 @@ endnetgrent(void) > lp =3D lp->l_next; > free(olp->l_groupname); > free(olp->l_line); > - free((char *)olp); > + free(olp); > } > - linehead =3D (struct linelist *)0; > + linehead =3D NULL; > if (grouphead.grname) { > free(grouphead.grname); > - grouphead.grname =3D (char *)0; > + grouphead.grname =3D NULL; > } > gp =3D grouphead.gr; > while (gp) { > ogp =3D gp; > gp =3D gp->ng_next; > - if (ogp->ng_str[NG_HOST]) > - free(ogp->ng_str[NG_HOST]); > - if (ogp->ng_str[NG_USER]) > - free(ogp->ng_str[NG_USER]); > - if (ogp->ng_str[NG_DOM]) > - free(ogp->ng_str[NG_DOM]); > - free((char *)ogp); > + free(ogp->ng_str[NG_HOST]); > + free(ogp->ng_str[NG_USER]); > + free(ogp->ng_str[NG_DOM]); > + free(ogp); > } > - grouphead.gr =3D (struct netgrp *)0; > - nextgrp =3D (struct netgrp *)0; > + grouphead.gr =3D NULL; > + nextgrp =3D NULL; > #ifdef YP > _netgr_yp_enabled =3D 0; > #endif > @@ -282,7 +278,7 @@ _listmatch(const char *list, const char *group, = int len) > int glen =3D strlen(group); >=20 > /* skip possible leading whitespace */ > - while(isspace((unsigned char)*ptr)) > + while (isspace((unsigned char)*ptr)) > ptr++; >=20 > while (ptr < list + len) { > @@ -291,7 +287,7 @@ _listmatch(const char *list, const char *group, = int len) > ptr++; > if (strncmp(cptr, group, glen) =3D=3D 0 && glen =3D=3D = (ptr - cptr)) > return (1); > - while(*ptr =3D=3D ',' || isspace((unsigned char)*ptr)) > + while (*ptr =3D=3D ',' || isspace((unsigned char)*ptr)) > ptr++; > } >=20 > @@ -436,8 +432,7 @@ parse_netgrp(const char *group) > break; > lp =3D lp->l_next; > } > - if (lp =3D=3D (struct linelist *)0 && > - (lp =3D read_for_group(group)) =3D=3D (struct linelist *)0) > + if (lp =3D=3D NULL && (lp =3D read_for_group(group)) =3D=3D = NULL) > return (1); > if (lp->l_parsed) { > #ifdef DEBUG From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 22:56:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4F6E7106566B; Fri, 15 Jun 2012 22:56:16 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 387E58FC0A; Fri, 15 Jun 2012 22:56:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FMuGlm008340; Fri, 15 Jun 2012 22:56:16 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FMuGFJ008338; Fri, 15 Jun 2012 22:56:16 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201206152256.q5FMuGFJ008338@svn.freebsd.org> From: Glen Barber Date: Fri, 15 Jun 2012 22:56:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237148 - stable/9/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 22:56:16 -0000 Author: gjb (doc committer) Date: Fri Jun 15 22:56:15 2012 New Revision: 237148 URL: http://svn.freebsd.org/changeset/base/237148 Log: MFC r236776, r236777: r236776: Fix a typo: s/deafult/default r236777: Clean up trailing whitespace. Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 21:48:17 2012 (r237147) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 22:56:15 2012 (r237148) @@ -189,7 +189,7 @@ for information on managing datasets. A .Qq virtual device .Pq No vdev -describes a single device or a collection of devices organized according to +describes a single device or a collection of devices organized according to certain performance and fault characteristics. The following virtual devices are supported: .Bl -tag @@ -237,7 +237,7 @@ A group can have single-, double- , or triple parity, meaning that the .No raidz group can sustain one, two, or three failures, respectively, without -losing any data. The +losing any data. The .Sy raidz1 No vdev type specifies a single-parity .No raidz @@ -287,7 +287,7 @@ writes are load-balanced between devices .No raidz .No vdev types are not supported for the intent log. For more information, -see the +see the .Qq Sx Intent Log section. .It Sy cache @@ -309,13 +309,13 @@ A pool can have any number of virtual de (known as .Qq root .No vdev Ns s). -Data is dynamically distributed across all top-level devices to balance data +Data is dynamically distributed across all top-level devices to balance data among devices. As new virtual devices are added, .Tn ZFS automatically places data on the newly available devices. .Pp Virtual devices are specified one at a time on the command line, separated by -whitespace. The keywords +whitespace. The keywords .Qq mirror and .Qq raidz @@ -428,7 +428,7 @@ allows devices to be associated with poo .Qq hot spares . These devices are not actively used in the pool, but when an active device fails, it is automatically replaced by a hot spare. To create a pool with hot -spares, specify a +spares, specify a .Qq spare .No vdev with any number of devices. For example, @@ -458,7 +458,7 @@ pools. .Pp Spares cannot replace log devices. .Ss Intent Log -The +The .Tn ZFS Intent Log .Pq Tn ZIL @@ -582,7 +582,7 @@ the typical paths are not valid. .Sy altroot is not a persistent property. It is valid only while the system is up. Setting -.Sy altroot +.Sy altroot defaults to using .Cm cachefile=none , though this may be overridden using an explicit setting. @@ -627,9 +627,9 @@ This property can also be referred to by .It Sy autoreplace Ns = Ns Cm on No | Cm off Controls automatic device replacement. If set to .Qq Cm off , -device replacement must be initiated by the administrator by using the +device replacement must be initiated by the administrator by using the .Qq Nm Cm replace -command. If set to +command. If set to .Qq Cm on , any new device, found in the same physical location as a device that previously belonged to the pool, is @@ -650,13 +650,13 @@ pool configuration in a different locati .Qq Nm Cm import Fl c . Setting it to the special value .Qq Cm none -creates a temporary pool that is never cached, and the special value +creates a temporary pool that is never cached, and the special value .Cm '' (empty string) uses the default location. .It Sy dedupditto Ns = Ns Ar number Threshold for the number of block ditto copies. If the reference count for a deduplicated block increases above this number, a new ditto copy of this block -is automatically stored. Deafult setting is +is automatically stored. Default setting is .Cm 0 . .It Sy delegation Ns = Ns Cm on No | Cm off Controls whether a non-privileged user is granted access based on the dataset @@ -861,7 +861,7 @@ root dataset cannot be mounted. This can option. .Bl -tag -width indent .It Fl f -Forces use of +Forces use of .Ar vdev Ns s, even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner. @@ -897,7 +897,7 @@ or .Qq Cm altroot Ns Pa /pool if .Sy altroot -is specified. The mount point must be an absolute path, +is specified. The mount point must be an absolute path, .Qq Cm legacy , or .Qq Cm none . @@ -1234,7 +1234,7 @@ seconds until .Sy Ctrl-C is pressed. If no .Ar pools -are specified, statistics for every pool in the system is shown. If +are specified, statistics for every pool in the system is shown. If .Ar count is specified, the command exits after .Ar count @@ -1292,7 +1292,7 @@ When given an interval, the output is pr .Ar interval seconds until .Sy Ctrl-C -is pressed. If +is pressed. If .Ar count is specified, the command exits after .Ar count @@ -1398,7 +1398,7 @@ This is equivalent to attaching waiting for it to resilver, and then detaching .Ar old_device . .Pp -The size of +The size of .Ar new_device must be greater than or equal to the minimum size of all the devices in a mirror or @@ -1409,7 +1409,7 @@ configuration. is required if the pool is not redundant. If .Ar new_device is not specified, it defaults to -.Ar old_device . +.Ar old_device . This form of replacement is useful after an existing disk has failed and has been physically replaced. In this case, the new disk may have the same .Pa /dev @@ -1496,12 +1496,12 @@ unless overridden by a device specificat .Pp When using a .Ar device -argument, +argument, .Cm split -includes the specified device(s) in a new pool and, should any devices remain +includes the specified device(s) in a new pool and, should any devices remain unspecified, assigns the last device in each mirror .No vdev -to that pool, as it does normally. If you are uncertain about the outcome of a +to that pool, as it does normally. If you are uncertain about the outcome of a .Cm split command, use the .Fl n @@ -1554,7 +1554,7 @@ When given an interval, the output is pr .Ar interval seconds until .Sy Ctrl-C -is pressed. If +is pressed. If .Ar count is specified, the command exits after .Ar count From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 22:56:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 466F01065694; Fri, 15 Jun 2012 22:56:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F6A38FC15; Fri, 15 Jun 2012 22:56:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FMuTa6008384; Fri, 15 Jun 2012 22:56:29 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FMuSsK008382; Fri, 15 Jun 2012 22:56:28 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201206152256.q5FMuSsK008382@svn.freebsd.org> From: Glen Barber Date: Fri, 15 Jun 2012 22:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237149 - stable/8/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 22:56:29 -0000 Author: gjb (doc committer) Date: Fri Jun 15 22:56:28 2012 New Revision: 237149 URL: http://svn.freebsd.org/changeset/base/237149 Log: MFC r236776, r236777: r236776: Fix a typo: s/deafult/default r236777: Clean up trailing whitespace. Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 22:56:15 2012 (r237148) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Fri Jun 15 22:56:28 2012 (r237149) @@ -189,7 +189,7 @@ for information on managing datasets. A .Qq virtual device .Pq No vdev -describes a single device or a collection of devices organized according to +describes a single device or a collection of devices organized according to certain performance and fault characteristics. The following virtual devices are supported: .Bl -tag @@ -237,7 +237,7 @@ A group can have single-, double- , or triple parity, meaning that the .No raidz group can sustain one, two, or three failures, respectively, without -losing any data. The +losing any data. The .Sy raidz1 No vdev type specifies a single-parity .No raidz @@ -287,7 +287,7 @@ writes are load-balanced between devices .No raidz .No vdev types are not supported for the intent log. For more information, -see the +see the .Qq Sx Intent Log section. .It Sy cache @@ -309,13 +309,13 @@ A pool can have any number of virtual de (known as .Qq root .No vdev Ns s). -Data is dynamically distributed across all top-level devices to balance data +Data is dynamically distributed across all top-level devices to balance data among devices. As new virtual devices are added, .Tn ZFS automatically places data on the newly available devices. .Pp Virtual devices are specified one at a time on the command line, separated by -whitespace. The keywords +whitespace. The keywords .Qq mirror and .Qq raidz @@ -428,7 +428,7 @@ allows devices to be associated with poo .Qq hot spares . These devices are not actively used in the pool, but when an active device fails, it is automatically replaced by a hot spare. To create a pool with hot -spares, specify a +spares, specify a .Qq spare .No vdev with any number of devices. For example, @@ -458,7 +458,7 @@ pools. .Pp Spares cannot replace log devices. .Ss Intent Log -The +The .Tn ZFS Intent Log .Pq Tn ZIL @@ -582,7 +582,7 @@ the typical paths are not valid. .Sy altroot is not a persistent property. It is valid only while the system is up. Setting -.Sy altroot +.Sy altroot defaults to using .Cm cachefile=none , though this may be overridden using an explicit setting. @@ -627,9 +627,9 @@ This property can also be referred to by .It Sy autoreplace Ns = Ns Cm on No | Cm off Controls automatic device replacement. If set to .Qq Cm off , -device replacement must be initiated by the administrator by using the +device replacement must be initiated by the administrator by using the .Qq Nm Cm replace -command. If set to +command. If set to .Qq Cm on , any new device, found in the same physical location as a device that previously belonged to the pool, is @@ -650,13 +650,13 @@ pool configuration in a different locati .Qq Nm Cm import Fl c . Setting it to the special value .Qq Cm none -creates a temporary pool that is never cached, and the special value +creates a temporary pool that is never cached, and the special value .Cm '' (empty string) uses the default location. .It Sy dedupditto Ns = Ns Ar number Threshold for the number of block ditto copies. If the reference count for a deduplicated block increases above this number, a new ditto copy of this block -is automatically stored. Deafult setting is +is automatically stored. Default setting is .Cm 0 . .It Sy delegation Ns = Ns Cm on No | Cm off Controls whether a non-privileged user is granted access based on the dataset @@ -861,7 +861,7 @@ root dataset cannot be mounted. This can option. .Bl -tag -width indent .It Fl f -Forces use of +Forces use of .Ar vdev Ns s, even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner. @@ -897,7 +897,7 @@ or .Qq Cm altroot Ns Pa /pool if .Sy altroot -is specified. The mount point must be an absolute path, +is specified. The mount point must be an absolute path, .Qq Cm legacy , or .Qq Cm none . @@ -1234,7 +1234,7 @@ seconds until .Sy Ctrl-C is pressed. If no .Ar pools -are specified, statistics for every pool in the system is shown. If +are specified, statistics for every pool in the system is shown. If .Ar count is specified, the command exits after .Ar count @@ -1292,7 +1292,7 @@ When given an interval, the output is pr .Ar interval seconds until .Sy Ctrl-C -is pressed. If +is pressed. If .Ar count is specified, the command exits after .Ar count @@ -1398,7 +1398,7 @@ This is equivalent to attaching waiting for it to resilver, and then detaching .Ar old_device . .Pp -The size of +The size of .Ar new_device must be greater than or equal to the minimum size of all the devices in a mirror or @@ -1409,7 +1409,7 @@ configuration. is required if the pool is not redundant. If .Ar new_device is not specified, it defaults to -.Ar old_device . +.Ar old_device . This form of replacement is useful after an existing disk has failed and has been physically replaced. In this case, the new disk may have the same .Pa /dev @@ -1496,12 +1496,12 @@ unless overridden by a device specificat .Pp When using a .Ar device -argument, +argument, .Cm split -includes the specified device(s) in a new pool and, should any devices remain +includes the specified device(s) in a new pool and, should any devices remain unspecified, assigns the last device in each mirror .No vdev -to that pool, as it does normally. If you are uncertain about the outcome of a +to that pool, as it does normally. If you are uncertain about the outcome of a .Cm split command, use the .Fl n @@ -1554,7 +1554,7 @@ When given an interval, the output is pr .Ar interval seconds until .Sy Ctrl-C -is pressed. If +is pressed. If .Ar count is specified, the command exits after .Ar count From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 23:02:39 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 465ED106566B; Fri, 15 Jun 2012 23:02:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id B6B248FC0A; Fri, 15 Jun 2012 23:02:38 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5FN2PFa086395; Sat, 16 Jun 2012 02:02:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5FN2Otj036027; Sat, 16 Jun 2012 02:02:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5FN2O3S036026; Sat, 16 Jun 2012 02:02:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 16 Jun 2012 02:02:24 +0300 From: Konstantin Belousov To: Guy Helmer Message-ID: <20120615230224.GI2337@deviant.kiev.zoral.com.ua> References: <201206142148.q5ELmFul023002@svn.freebsd.org> <20120615212651.GH2337@deviant.kiev.zoral.com.ua> <880C698D-7620-48CB-B0EB-68BBC7FECDBB@palisadesystems.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OtZJUqNUNrB9XA/T" Content-Disposition: inline In-Reply-To: <880C698D-7620-48CB-B0EB-68BBC7FECDBB@palisadesystems.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r237106 - stable/9/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 23:02:39 -0000 --OtZJUqNUNrB9XA/T Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 15, 2012 at 05:33:27PM -0500, Guy Helmer wrote: >=20 > On Jun 15, 2012, at 4:26 PM, Konstantin Belousov wrote: >=20 > > On Thu, Jun 14, 2012 at 09:48:15PM +0000, Guy Helmer wrote: > >> Author: ghelmer > >> Date: Thu Jun 14 21:48:14 2012 > >> New Revision: 237106 > >> URL: http://svn.freebsd.org/changeset/base/237106 > >>=20 > >> Log: > >> MFC 235739-235740,236402: > >> Apply style(9) to return and switch/case statements. > >>=20 > >> Add checks for memory allocation failures in appropriate places, and > >> avoid creating bad entries in the grp list as a result of memory allo= cation > >> failures while building new entries. > >>=20 > >> Style(9) improvements: remove unnecessary parenthesis, improve order > >> of local variable declarations, remove bogus casts, and resolve long > >> lines. > >>=20 > >> PR: bin/83340 > >>=20 > >> Modified: > >> stable/9/lib/libc/gen/getnetgrent.c > >> Directory Properties: > >> stable/9/lib/libc/ (props changed) > >>=20 > > This broke mountd(8) for me. It dies with SIGSEGV on start. Autopsy has > > shown that this happen due to free(3) on an unallocated pointer. > >=20 > > I have two netgroups in my /etc/netgroup: > > testboxes (solo.home, , ) (x.home, , ) (nv.home, , ) (sandy.home, , ) (= tom.home, ,) > > laptops (alf.home, , ) (alf.home-air, , ) (sirion.home, , ) (sirion.hom= e-air, , ) > >=20 > > The http://people.freebsd.org/~kib/misc/netgr.c shows the issue. Run it > > as "netgr testboxes laptops". > >=20 > > Your change below makes lp->l_lines pointer for already processed groups > > invalid because you reallocf(3) the memory pointed by it. Then > > 1. accessing the l_lines later causes undefined behaviour; > > 2. free(3) call in endnetgrent() dies because pointer is dandling. > >=20 > >> @@ -595,15 +615,15 @@ read_for_group(const char *group) > >> } else > >> cont =3D 0; > >> if (len > 0) { > >> - linep =3D (char *)malloc(olen + len + 1); > >> - if (olen > 0) { > >> - bcopy(olinep, linep, olen); > >> - free(olinep); > >> + linep =3D reallocf(linep, olen + len + 1); > >> + if (linep =3D=3D NULL) { > >> + free(lp->l_groupname); > >> + free(lp); > >> + return (NULL); > >> } > >> bcopy(pos, linep + olen, len); > >> olen +=3D len; > >> *(linep + olen) =3D '\0'; > >> - olinep =3D linep; > >> } > >> if (cont) { > >> if (fgets(line, LINSIZ, netf)) { > >=20 > > Below is partial revert of your changes that cures mountd for me. Also, > > the second patch does some further cleanup of the getnetgrent.c. > >=20 > > Do you agree ? >=20 > Sorry for the breakage. FWIW, I am having difficulty seeing how: >=20 > linep =3D malloc(olen + len + 1); > ? > if (olen > 0) { > bcopy(olinep, linep, olen); > free(olinep); > } >=20 > is different from: >=20 > linep =3D reallocf(linep, olen + len + 1); >=20 The old value of linep is invalid after the call to reallocf() and must be not used further. But it is saved as l_line value, so it gets free()d. You de-facto use very long line, containing lines for all groups, with l_line pointing in the middle of it. It is some luck that in my case reallocf() was able to extend original chunk, otherwise I would also get garbage in l_lines. >=20 > but if it fixes the issue, it is good. I would beware the disorder in the= sorting of the variables in the line: >=20 > char *pos, *spos, *linep, *olinep;". Fixed. --OtZJUqNUNrB9XA/T Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/bvwAACgkQC3+MBN1Mb4hrHwCfZuxLndQKUvjGXpuROMnTrxlg 9AoAn3Q7rGBlwe6Xkpk9hhancGAtFP4R =JoUY -----END PGP SIGNATURE----- --OtZJUqNUNrB9XA/T-- From owner-svn-src-all@FreeBSD.ORG Fri Jun 15 23:07:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EB900106566B; Fri, 15 Jun 2012 23:07:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5B368FC08; Fri, 15 Jun 2012 23:07:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5FN7pBu008902; Fri, 15 Jun 2012 23:07:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5FN7piK008900; Fri, 15 Jun 2012 23:07:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206152307.q5FN7piK008900@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 Jun 2012 23:07:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237150 - stable/9/sys/powerpc/aim X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2012 23:07:52 -0000 Author: kib Date: Fri Jun 15 23:07:51 2012 New Revision: 237150 URL: http://svn.freebsd.org/changeset/base/237150 Log: MFC r230779: Fix build for the case of powerpc64 kernel without COMPAT_FREEBSD32. Pointy hat to: kib Modified: stable/9/sys/powerpc/aim/mmu_oea64.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/9/sys/powerpc/aim/mmu_oea64.c Fri Jun 15 22:56:28 2012 (r237149) +++ stable/9/sys/powerpc/aim/mmu_oea64.c Fri Jun 15 23:07:51 2012 (r237150) @@ -114,6 +114,7 @@ __FBSDID("$FreeBSD$"); * correct. */ +#include "opt_compat.h" #include "opt_kstack_pages.h" #include @@ -1469,7 +1470,9 @@ moea64_init(mmu_t mmu) uma_zone_set_allocf(moea64_mpvo_zone,moea64_uma_page_alloc); } +#ifdef COMPAT_FREEBSD32 elf32_nxstack = 1; +#endif moea64_initialized = TRUE; } From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 04:34:47 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EDC3106564A; Sat, 16 Jun 2012 04:34:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A0108FC0A; Sat, 16 Jun 2012 04:34:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5G4Ylqk022383; Sat, 16 Jun 2012 04:34:47 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5G4Ylda022381; Sat, 16 Jun 2012 04:34:47 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201206160434.q5G4Ylda022381@svn.freebsd.org> From: Warner Losh Date: Sat, 16 Jun 2012 04:34:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237151 - head/sys/arm/at91 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 04:34:47 -0000 Author: imp Date: Sat Jun 16 04:34:46 2012 New Revision: 237151 URL: http://svn.freebsd.org/changeset/base/237151 Log: Throw this debug behind bootverbose. The information isn't all that exciting once the initial board bring up is over. Modified: head/sys/arm/at91/at91_pio.c Modified: head/sys/arm/at91/at91_pio.c ============================================================================== --- head/sys/arm/at91/at91_pio.c Fri Jun 15 23:07:51 2012 (r237150) +++ head/sys/arm/at91/at91_pio.c Sat Jun 16 04:34:46 2012 (r237151) @@ -143,9 +143,10 @@ at91_pio_attach(device_t dev) if (err) goto out; - device_printf(dev, "ABSR: %#x OSR: %#x PSR:%#x ODSR: %#x\n", - RD4(sc, PIO_ABSR), RD4(sc, PIO_OSR), RD4(sc, PIO_PSR), - RD4(sc, PIO_ODSR)); + if (bootverbose) + device_printf(dev, "ABSR: %#x OSR: %#x PSR:%#x ODSR: %#x\n", + RD4(sc, PIO_ABSR), RD4(sc, PIO_OSR), RD4(sc, PIO_PSR), + RD4(sc, PIO_ODSR)); AT91_PIO_LOCK_INIT(sc); /* From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 04:36:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53A211065745; Sat, 16 Jun 2012 04:36:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E33D8FC17; Sat, 16 Jun 2012 04:36:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5G4a9Fq022474; Sat, 16 Jun 2012 04:36:09 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5G4a9vt022472; Sat, 16 Jun 2012 04:36:09 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206160436.q5G4a9vt022472@svn.freebsd.org> From: Adrian Chadd Date: Sat, 16 Jun 2012 04:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237152 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 04:36:09 -0000 Author: adrian Date: Sat Jun 16 04:36:08 2012 New Revision: 237152 URL: http://svn.freebsd.org/changeset/base/237152 Log: Shave four (or eight) bytes off of ath_buf - this field isn't used. Modified: head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sat Jun 16 04:34:46 2012 (r237151) +++ head/sys/dev/ath/if_athvar.h Sat Jun 16 04:36:08 2012 (r237152) @@ -232,8 +232,6 @@ struct ath_buf { bfs_doprot:1, /* do RTS/CTS based protection */ bfs_doratelookup:1; /* do rate lookup before each TX */ - int bfs_nfl; /* next fragment length */ - /* * These fields are passed into the * descriptor setup functions. From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 04:41:36 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E471106564A; Sat, 16 Jun 2012 04:41:36 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F40B18FC14; Sat, 16 Jun 2012 04:41:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5G4fZNi022718; Sat, 16 Jun 2012 04:41:35 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5G4fZD5022714; Sat, 16 Jun 2012 04:41:35 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206160441.q5G4fZD5022714@svn.freebsd.org> From: Adrian Chadd Date: Sat, 16 Jun 2012 04:41:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237153 - in head/sys/dev/ath: . ath_hal X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 04:41:36 -0000 Author: adrian Date: Sat Jun 16 04:41:35 2012 New Revision: 237153 URL: http://svn.freebsd.org/changeset/base/237153 Log: Shuffle some more fields in ath_buf so it's not too big. This shaves off 20 bytes - from 288 bytes to 268 bytes. However, it's still too big. Modified: head/sys/dev/ath/ath_hal/ah_desc.h head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah_desc.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_desc.h Sat Jun 16 04:36:08 2012 (r237152) +++ head/sys/dev/ath/ath_hal/ah_desc.h Sat Jun 16 04:41:35 2012 (r237153) @@ -225,6 +225,7 @@ struct ath_desc_status { #define ds_rxstat ds_us.rx /* flags passed to tx descriptor setup methods */ +/* This is a uint16_t field in ath_buf, just be warned! */ #define HAL_TXDESC_CLRDMASK 0x0001 /* clear destination filter mask */ #define HAL_TXDESC_NOACK 0x0002 /* don't wait for ACK */ #define HAL_TXDESC_RTSENA 0x0004 /* enable RTS */ Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Jun 16 04:36:08 2012 (r237152) +++ head/sys/dev/ath/if_ath.c Sat Jun 16 04:41:35 2012 (r237153) @@ -662,6 +662,9 @@ ath_attach(u_int16_t devid, struct ath_s (void) ath_hal_settxchainmask(sc->sc_ah, tx_chainmask); } + device_printf(sc->sc_dev, "%s: sizeof(ath_buf) = %d bytes\n", + __func__, sizeof(struct ath_buf)); + #ifdef ATH_ENABLE_11N /* * Query HT capabilities Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sat Jun 16 04:36:08 2012 (r237152) +++ head/sys/dev/ath/if_athvar.h Sat Jun 16 04:41:35 2012 (r237153) @@ -236,20 +236,32 @@ struct ath_buf { * These fields are passed into the * descriptor setup functions. */ + + /* Make this an 8 bit value? */ HAL_PKT_TYPE bfs_atype; /* packet type */ - int bfs_pktlen; /* length of this packet */ - int bfs_hdrlen; /* length of this packet header */ + + uint32_t bfs_pktlen; /* length of this packet */ + + uint16_t bfs_hdrlen; /* length of this packet header */ uint16_t bfs_al; /* length of aggregate */ - int bfs_txflags; /* HAL (tx) descriptor flags */ - int bfs_txrate0; /* first TX rate */ - int bfs_try0; /* first try count */ + + uint16_t bfs_txflags; /* HAL (tx) descriptor flags */ + uint8_t bfs_txrate0; /* first TX rate */ + uint8_t bfs_try0; /* first try count */ + + uint16_t bfs_txpower; /* tx power */ uint8_t bfs_ctsrate0; /* Non-zero - use this as ctsrate */ - int bfs_keyix; /* crypto key index */ - int bfs_txpower; /* tx power */ - int bfs_txantenna; /* TX antenna config */ + uint8_t bfs_ctsrate; /* CTS rate */ + + /* 16 bit? */ + int32_t bfs_keyix; /* crypto key index */ + int32_t bfs_txantenna; /* TX antenna config */ + + /* Make this an 8 bit value? */ enum ieee80211_protmode bfs_protmode; - int bfs_ctsrate; /* CTS rate */ - int bfs_ctsduration; /* CTS duration (pre-11n NICs) */ + + /* 16 bit? */ + uint32_t bfs_ctsduration; /* CTS duration (pre-11n NICs) */ struct ath_rc_series bfs_rc[ATH_RC_NUM]; /* non-11n TX series */ } bf_state; }; From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 06:38:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E53D106566B; Sat, 16 Jun 2012 06:38:12 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 599588FC0C; Sat, 16 Jun 2012 06:38:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5G6cCfd027537; Sat, 16 Jun 2012 06:38:12 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5G6cCj2027535; Sat, 16 Jun 2012 06:38:12 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <201206160638.q5G6cCj2027535@svn.freebsd.org> From: Joel Dahl Date: Sat, 16 Jun 2012 06:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237156 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 06:38:12 -0000 Author: joel (doc committer) Date: Sat Jun 16 06:38:11 2012 New Revision: 237156 URL: http://svn.freebsd.org/changeset/base/237156 Log: mandoc fixes. Obtained from: OpenBSD Modified: head/lib/libc/gen/signal.3 Modified: head/lib/libc/gen/signal.3 ============================================================================== --- head/lib/libc/gen/signal.3 Sat Jun 16 06:24:05 2012 (r237155) +++ head/lib/libc/gen/signal.3 Sat Jun 16 06:38:11 2012 (r237156) @@ -38,20 +38,11 @@ .Lb libc .Sh SYNOPSIS .In signal.h -.\" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX -.\" The prototype for signal(3) cannot be cleanly marked up in -mdoc -.\" without the following lower-level tweak. -.nr in-synopsis-section 0 -.Pp -.Ft "void \*(lp*" Ns -.Fo signal -.Fa "int sig" -.Fa "void \*(lp*func\*(rp\*(lpint\*(rp" -.Fc Ns -.Ft "\*(rp\*(lpint\*(rp" ; +.\" The following is Quite Ugly, but syntactically correct. +.\" Don't try to fix it. +.Ft void +.Fn \*(lp*signal "int sig" "void \*(lp*func\*(rp\*(lpint\*(rp\*(rp\*(rp\*(lpint" .Pp -.nr in-synopsis-section 1 -.\" XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX or in .Fx Ap s equivalent but easier to read typedef'd version: @@ -98,7 +89,7 @@ an interrupt. These signals are defined in the file .In signal.h : .Bl -column No ".Dv SIGVTALRM" "create core image" -.It Sy "No Name Default Action Description" +.It Sy "Num" Ta Sy "Name" Ta Sy "Default Action" Ta Sy "Description" .It 1 Ta Dv SIGHUP Ta "terminate process" Ta "terminal line hangup" .It 2 Ta Dv SIGINT Ta "terminate process" Ta "interrupt program" .It 3 Ta Dv SIGQUIT Ta "create core image" Ta "quit program" From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 09:17:22 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6C79106564A; Sat, 16 Jun 2012 09:17:22 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EE108FC0C; Sat, 16 Jun 2012 09:17:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5G9HM2s034128; Sat, 16 Jun 2012 09:17:22 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5G9HMIo034112; Sat, 16 Jun 2012 09:17:22 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201206160917.q5G9HMIo034112@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sat, 16 Jun 2012 09:17:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237157 - in stable/7/lib: libcrypt libmd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 09:17:22 -0000 Author: des Date: Sat Jun 16 09:17:21 2012 New Revision: 237157 URL: http://svn.freebsd.org/changeset/base/237157 Log: Backport sha512 support. Added: stable/7/lib/libcrypt/crypt-sha256.c - copied, changed from r220498, head/lib/libcrypt/crypt-sha256.c stable/7/lib/libcrypt/crypt-sha512.c - copied, changed from r220498, head/lib/libcrypt/crypt-sha512.c stable/7/lib/libmd/sha512.3 - copied, changed from r220496, head/lib/libmd/sha512.3 stable/7/lib/libmd/sha512.h - copied unchanged from r220496, head/lib/libmd/sha512.h stable/7/lib/libmd/sha512c.c - copied unchanged from r220496, head/lib/libmd/sha512c.c Modified: stable/7/lib/libcrypt/Makefile stable/7/lib/libcrypt/crypt.3 stable/7/lib/libcrypt/crypt.c stable/7/lib/libcrypt/crypt.h stable/7/lib/libcrypt/misc.c stable/7/lib/libmd/Makefile stable/7/lib/libmd/mddriver.c stable/7/lib/libmd/rmddriver.c stable/7/lib/libmd/sha256.3 stable/7/lib/libmd/shadriver.c Directory Properties: stable/7/lib/libcrypt/ (props changed) stable/7/lib/libmd/ (props changed) Modified: stable/7/lib/libcrypt/Makefile ============================================================================== --- stable/7/lib/libcrypt/Makefile Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libcrypt/Makefile Sat Jun 16 09:17:21 2012 (r237157) @@ -12,7 +12,9 @@ LIB= crypt .PATH: ${.CURDIR}/../libmd SRCS= crypt.c misc.c \ crypt-md5.c md5c.c \ - crypt-nthash.c md4c.c + crypt-nthash.c md4c.c \ + crypt-sha256.c sha256c.c \ + crypt-sha512.c sha512c.c MAN= crypt.3 MLINKS= crypt.3 crypt_get_format.3 crypt.3 crypt_set_format.3 CFLAGS+= -I${.CURDIR}/../libmd -I${.CURDIR}/../libutil @@ -29,7 +31,9 @@ CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BL SRCS+= auth.c property.c .for sym in auth_getval property_find properties_read properties_free \ MD4Init MD4Final MD4Update MD4Pad \ - MD5Init MD5Final MD5Update MD5Pad + MD5Init MD5Final MD5Update MD5Pad \ + SHA256_Init SHA256_Final SHA256_Update \ + SHA512_Init SHA512_Final SHA512_Update CFLAGS+= -D${sym}=__${sym} .endfor Copied and modified: stable/7/lib/libcrypt/crypt-sha256.c (from r220498, head/lib/libcrypt/crypt-sha256.c) ============================================================================== --- head/lib/libcrypt/crypt-sha256.c Sat Apr 9 14:09:46 2011 (r220498, copy source) +++ stable/7/lib/libcrypt/crypt-sha256.c Sat Jun 16 09:17:21 2012 (r237157) @@ -60,7 +60,7 @@ static const char sha256_rounds_prefix[] #define ROUNDS_MAX 999999999 static char * -sha256_crypt_r(const char *key, const char *salt, char *buffer, int buflen) +crypt_sha256_r(const char *key, const char *salt, char *buffer, int buflen) { u_long srounds; int n; @@ -210,7 +210,9 @@ sha256_crypt_r(const char *key, const ch /* Now we can construct the result string. It consists of three * parts. */ - cp = stpncpy(buffer, sha256_salt_prefix, MAX(0, buflen)); + cp = buffer; + strncpy(buffer, sha256_salt_prefix, MAX(0, buflen)); + cp += sizeof(sha256_salt_prefix) - 1; buflen -= sizeof(sha256_salt_prefix) - 1; if (rounds_custom) { @@ -221,7 +223,8 @@ sha256_crypt_r(const char *key, const ch buflen -= n; } - cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len)); + strncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len)); + cp += MIN((size_t)MAX(0, buflen), salt_len); buflen -= MIN((size_t)MAX(0, buflen), salt_len); if (buflen > 0) { @@ -268,12 +271,12 @@ sha256_crypt_r(const char *key, const ch /* This entry point is equivalent to crypt(3). */ char * -sha256_crypt(const char *key, const char *salt) +crypt_sha256(const char *key, const char *salt) { /* We don't want to have an arbitrary limit in the size of the * password. We can compute an upper bound for the size of the * result in advance and so we can prepare the buffer we pass to - * `sha256_crypt_r'. */ + * `crypt_sha256_r'. */ static char *buffer; static int buflen; int needed; @@ -293,7 +296,7 @@ sha256_crypt(const char *key, const char buflen = needed; } - return sha256_crypt_r(key, salt, buffer, buflen); + return crypt_sha256_r(key, salt, buffer, buflen); } #ifdef TEST @@ -459,7 +462,7 @@ main(void) } for (cnt = 0; cnt < ntests2; ++cnt) { - char *cp = sha256_crypt(tests2[cnt].input, tests2[cnt].salt); + char *cp = crypt_sha256(tests2[cnt].input, tests2[cnt].salt); if (strcmp(cp, tests2[cnt].expected) != 0) { printf("test %d: expected \"%s\", got \"%s\"\n", Copied and modified: stable/7/lib/libcrypt/crypt-sha512.c (from r220498, head/lib/libcrypt/crypt-sha512.c) ============================================================================== --- head/lib/libcrypt/crypt-sha512.c Sat Apr 9 14:09:46 2011 (r220498, copy source) +++ stable/7/lib/libcrypt/crypt-sha512.c Sat Jun 16 09:17:21 2012 (r237157) @@ -60,7 +60,7 @@ static const char sha512_rounds_prefix[] #define ROUNDS_MAX 999999999 static char * -sha512_crypt_r(const char *key, const char *salt, char *buffer, int buflen) +crypt_sha512_r(const char *key, const char *salt, char *buffer, int buflen) { u_long srounds; int n; @@ -210,7 +210,9 @@ sha512_crypt_r(const char *key, const ch /* Now we can construct the result string. It consists of three * parts. */ - cp = stpncpy(buffer, sha512_salt_prefix, MAX(0, buflen)); + cp = buffer; + strncpy(buffer, sha512_salt_prefix, MAX(0, buflen)); + cp += sizeof(sha512_salt_prefix) - 1; buflen -= sizeof(sha512_salt_prefix) - 1; if (rounds_custom) { @@ -221,7 +223,8 @@ sha512_crypt_r(const char *key, const ch buflen -= n; } - cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len)); + strncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len)); + cp += MIN((size_t)MAX(0, buflen), salt_len); buflen -= MIN((size_t)MAX(0, buflen), salt_len); if (buflen > 0) { @@ -280,12 +283,12 @@ sha512_crypt_r(const char *key, const ch /* This entry point is equivalent to crypt(3). */ char * -sha512_crypt(const char *key, const char *salt) +crypt_sha512(const char *key, const char *salt) { /* We don't want to have an arbitrary limit in the size of the * password. We can compute an upper bound for the size of the * result in advance and so we can prepare the buffer we pass to - * `sha512_crypt_r'. */ + * `crypt_sha512_r'. */ static char *buffer; static int buflen; int needed; @@ -305,7 +308,7 @@ sha512_crypt(const char *key, const char buflen = needed; } - return sha512_crypt_r(key, salt, buffer, buflen); + return crypt_sha512_r(key, salt, buffer, buflen); } #ifdef TEST @@ -482,7 +485,7 @@ main(void) } for (cnt = 0; cnt < ntests2; ++cnt) { - char *cp = sha512_crypt(tests2[cnt].input, tests2[cnt].salt); + char *cp = crypt_sha512(tests2[cnt].input, tests2[cnt].salt); if (strcmp(cp, tests2[cnt].expected) != 0) { printf("test %d: expected \"%s\", got \"%s\"\n", Modified: stable/7/lib/libcrypt/crypt.3 ============================================================================== --- stable/7/lib/libcrypt/crypt.3 Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libcrypt/crypt.3 Sat Jun 16 09:17:21 2012 (r237157) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 19, 1997 +.Dd April 9, 2011 .Dt CRYPT 3 .Os .Sh NAME @@ -188,6 +188,12 @@ MD5 Blowfish .It NT-Hash +.It +(unused) +.It +SHA-256 +.It +SHA-512 .El .Pp Other crypt formats may be easily added. @@ -226,7 +232,9 @@ Valid values are .\" .Ql des , .Ql blf , -.Ql md5 +.Ql md5 , +.Ql sha256 , +.Ql sha512 and .Ql nth . .Pp Modified: stable/7/lib/libcrypt/crypt.c ============================================================================== --- stable/7/lib/libcrypt/crypt.c Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libcrypt/crypt.c Sat Jun 16 09:17:21 2012 (r237157) @@ -63,6 +63,16 @@ static const struct { "$3$" }, { + "sha256", + crypt_sha256, + "$5$" + }, + { + "sha512", + crypt_sha512, + "$6$" + }, + { NULL, NULL, NULL Modified: stable/7/lib/libcrypt/crypt.h ============================================================================== --- stable/7/lib/libcrypt/crypt.h Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libcrypt/crypt.h Sat Jun 16 09:17:21 2012 (r237157) @@ -36,5 +36,8 @@ char *crypt_des(const char *pw, const ch char *crypt_md5(const char *pw, const char *salt); char *crypt_nthash(const char *pw, const char *salt); char *crypt_blowfish(const char *pw, const char *salt); +char *crypt_sha256 (const char *pw, const char *salt); +char *crypt_sha512 (const char *pw, const char *salt); extern void _crypt_to64(char *s, u_long v, int n); +extern void b64_from_24bit(uint8_t B2, uint8_t B1, uint8_t B0, int n, int *buflen, char **cp); Modified: stable/7/lib/libcrypt/misc.c ============================================================================== --- stable/7/lib/libcrypt/misc.c Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libcrypt/misc.c Sat Jun 16 09:17:21 2012 (r237157) @@ -45,3 +45,19 @@ _crypt_to64(char *s, u_long v, int n) v >>= 6; } } + +void +b64_from_24bit(uint8_t B2, uint8_t B1, uint8_t B0, int n, int *buflen, char **cp) +{ + uint32_t w; + int i; + + w = (B2 << 16) | (B1 << 8) | B0; + for (i = 0; i < n; i++) { + **cp = itoa64[w&0x3f]; + (*cp)++; + if ((*buflen)-- < 0) + break; + w >>= 6; + } +} Modified: stable/7/lib/libmd/Makefile ============================================================================== --- stable/7/lib/libmd/Makefile Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libmd/Makefile Sat Jun 16 09:17:21 2012 (r237157) @@ -5,10 +5,11 @@ SHLIBDIR?= /lib SRCS= md2c.c md4c.c md5c.c md2hl.c md4hl.c md5hl.c \ rmd160c.c rmd160hl.c \ sha0c.c sha0hl.c sha1c.c sha1hl.c \ - sha256c.c sha256hl.c -INCS= md2.h md4.h md5.h ripemd.h sha.h sha256.h + sha256c.c sha256hl.c \ + sha512c.c sha512hl.c +INCS= md2.h md4.h md5.h ripemd.h sha.h sha256.h sha512.h -MAN+= md2.3 md4.3 md5.3 ripemd.3 sha.3 sha256.3 +MAN+= md2.3 md4.3 md5.3 ripemd.3 sha.3 sha256.3 sha512.3 MLINKS+=md2.3 MD2Init.3 md2.3 MD2Update.3 md2.3 MD2Final.3 MLINKS+=md2.3 MD2End.3 md2.3 MD2File.3 md2.3 MD2FileChunk.3 MLINKS+=md2.3 MD2Data.3 @@ -32,10 +33,15 @@ MLINKS+=sha256.3 SHA256_Init.3 sha256.3 MLINKS+=sha256.3 SHA256_Final.3 sha256.3 SHA256_End.3 MLINKS+=sha256.3 SHA256_File.3 sha256.3 SHA256_FileChunk.3 MLINKS+=sha256.3 SHA256_Data.3 +MLINKS+=sha512.3 SHA512_Init.3 sha512.3 SHA512_Update.3 +MLINKS+=sha512.3 SHA512_Final.3 sha512.3 SHA512_End.3 +MLINKS+=sha512.3 SHA512_File.3 sha512.3 SHA512_FileChunk.3 +MLINKS+=sha512.3 SHA512_Data.3 CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ rmd160.ref rmd160hl.c rmddriver \ sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \ - sha256.ref sha256hl.c + sha256.ref sha256hl.c sha512.ref sha512hl.c + CFLAGS+= -I${.CURDIR} .PATH: ${.CURDIR}/${MACHINE_ARCH} @@ -76,6 +82,12 @@ sha256hl.c: mdXhl.c -e 's/SHA256__/SHA256_/g' \ ${.ALLSRC}) > ${.TARGET} +sha512hl.c: mdXhl.c + (echo '#define LENGTH 64'; \ + sed -e 's/mdX/sha512/g' -e 's/MDX/SHA512_/g' \ + -e 's/SHA512__/SHA512_/g' \ + ${.ALLSRC}) > ${.TARGET} + rmd160hl.c: mdXhl.c (echo '#define LENGTH 20'; \ sed -e 's/mdX/ripemd/g' -e 's/MDX/RIPEMD160_/g' \ @@ -105,8 +117,10 @@ md4.ref: @echo 'MD4 ("abc") = a448017aaf21d8525fc10ae87aa6729d' >> ${.TARGET} @echo 'MD4 ("message digest") = d9130a8164549fe818874806e1c7014b' >> ${.TARGET} @echo 'MD4 ("abcdefghijklmnopqrstuvwxyz") = d79e1c308aa5bbcdeea8ed63df412da9' >> ${.TARGET} - @echo 'MD4 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 043f8582f241db351ce627e153e7f0e4' >> ${.TARGET} - @echo 'MD4 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = e33b4ddc9c38f2199c3e7b164fcc0536' >> ${.TARGET} + @echo 'MD4 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '043f8582f241db351ce627e153e7f0e4' >> ${.TARGET} + @echo 'MD4 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + 'e33b4ddc9c38f2199c3e7b164fcc0536' >> ${.TARGET} md5.ref: echo 'MD5 test suite:' > ${.TARGET} @@ -119,54 +133,74 @@ md5.ref: @echo 'MD5 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = 57edf4a22be3c955ac49da2e2107b67a' >> ${.TARGET} sha0.ref: - (echo 'SHA-0 test suite:'; \ - echo 'SHA-0 ("") = f96cea198ad1dd5617ac084a3d92c6107708c0ef'; \ - echo 'SHA-0 ("abc") = 0164b8a914cd2a5e74c4f7ff082c4d97f1edf880'; \ - echo 'SHA-0 ("message digest") =' \ - 'c1b0f222d150ebb9aa36a40cafdc8bcbed830b14'; \ - echo 'SHA-0 ("abcdefghijklmnopqrstuvwxyz") =' \ - 'b40ce07a430cfd3c033039b9fe9afec95dc1bdcd'; \ - echo 'SHA-0 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ - '79e966f7a3a990df33e40e3d7f8f18d2caebadfa'; \ - echo 'SHA-0 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ - '4aa29d14d171522ece47bee8957e35a41f3e9cff' ) > ${.TARGET} + echo 'SHA-0 test suite:' > ${.TARGET} + @echo 'SHA-0 ("") = f96cea198ad1dd5617ac084a3d92c6107708c0ef' >> ${.TARGET} + @echo 'SHA-0 ("abc") = 0164b8a914cd2a5e74c4f7ff082c4d97f1edf880' >> ${.TARGET} + @echo 'SHA-0 ("message digest") =' \ + 'c1b0f222d150ebb9aa36a40cafdc8bcbed830b14' >> ${.TARGET} + @echo 'SHA-0 ("abcdefghijklmnopqrstuvwxyz") =' \ + 'b40ce07a430cfd3c033039b9fe9afec95dc1bdcd' >> ${.TARGET} + @echo 'SHA-0 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '79e966f7a3a990df33e40e3d7f8f18d2caebadfa' >> ${.TARGET} + @echo 'SHA-0 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '4aa29d14d171522ece47bee8957e35a41f3e9cff' >> ${.TARGET} sha1.ref: - (echo 'SHA-1 test suite:'; \ - echo 'SHA-1 ("") = da39a3ee5e6b4b0d3255bfef95601890afd80709'; \ - echo 'SHA-1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d'; \ - echo 'SHA-1 ("message digest") =' \ - 'c12252ceda8be8994d5fa0290a47231c1d16aae3'; \ - echo 'SHA-1 ("abcdefghijklmnopqrstuvwxyz") =' \ - '32d10c7b8cf96570ca04ce37f2a19d84240d3a89'; \ - echo 'SHA-1 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ - '761c457bf73b14d27e9e9265c46f4b4dda11f940'; \ - echo 'SHA-1 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ - '50abf5706a150990a08b2c5ea40fa0e585554732' ) > ${.TARGET} + echo 'SHA-1 test suite:' > ${.TARGET} + @echo 'SHA-1 ("") = da39a3ee5e6b4b0d3255bfef95601890afd80709' >> ${.TARGET} + @echo 'SHA-1 ("abc") = a9993e364706816aba3e25717850c26c9cd0d89d' >> ${.TARGET} + @echo 'SHA-1 ("message digest") =' \ + 'c12252ceda8be8994d5fa0290a47231c1d16aae3' >> ${.TARGET} + @echo 'SHA-1 ("abcdefghijklmnopqrstuvwxyz") =' \ + '32d10c7b8cf96570ca04ce37f2a19d84240d3a89' >> ${.TARGET} + @echo 'SHA-1 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '761c457bf73b14d27e9e9265c46f4b4dda11f940' >> ${.TARGET} + @echo 'SHA-1 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '50abf5706a150990a08b2c5ea40fa0e585554732' >> ${.TARGET} sha256.ref: echo 'SHA-256 test suite:' > ${.TARGET} @echo 'SHA-256 ("") = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' >> ${.TARGET} - @echo 'SHA-256 ("abc") = ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' >> ${.TARGET} - @echo 'SHA-256 ("message digest") = f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650' >> ${.TARGET} - @echo 'SHA-256 ("abcdefghijklmnopqrstuvwxyz") = 71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73' >> ${.TARGET} - @echo 'SHA-256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0' >> ${.TARGET} - @echo 'SHA-256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e' >> ${.TARGET} + @echo 'SHA-256 ("abc") =' \ + 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' >> ${.TARGET} + @echo 'SHA-256 ("message digest") =' \ + 'f7846f55cf23e14eebeab5b4e1550cad5b509e3348fbc4efa3a1413d393cb650' >> ${.TARGET} + @echo 'SHA-256 ("abcdefghijklmnopqrstuvwxyz") =' \ + '71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73' >> ${.TARGET} + @echo 'SHA-256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + 'db4bfcbd4da0cd85a60c3c37d3fbd8805c77f15fc6b1fdfe614ee0a7c8fdb4c0' >> ${.TARGET} + @echo 'SHA-256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + 'f371bc4a311f2b009eef952dd83ca80e2b60026c8e935592d0f9c308453c813e' >> ${.TARGET} + +sha512.ref: + echo 'SHA-512 test suite:' > ${.TARGET} + @echo 'SHA-512 ("") =' \ + 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' >> ${.TARGET} + @echo 'SHA-512 ("abc") =' \ + 'ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f' >> ${.TARGET} + @echo 'SHA-512 ("message digest") =' \ + '107dbf389d9e9f71a3a95f6c055b9251bc5268c2be16d6c13492ea45b0199f3309e16455ab1e96118e8a905d5597b72038ddb372a89826046de66687bb420e7c' >> ${.TARGET} + @echo 'SHA-512 ("abcdefghijklmnopqrstuvwxyz") =' \ + '4dbff86cc2ca1bae1e16468a05cb9881c97f1753bce3619034898faa1aabe429955a1bf8ec483d7421fe3c1646613a59ed5441fb0f321389f77f48a879c7b1f1' >> ${.TARGET} + @echo 'SHA-512 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + '1e07be23c26a86ea37ea810c8ec7809352515a970e9253c26f536cfc7a9996c45c8370583e0a78fa4a90041d71a4ceab7423f19c71b9d5a3e01249f0bebd5894' >> ${.TARGET} + @echo 'SHA-512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843' >> ${.TARGET} rmd160.ref: - (echo 'RIPEMD160 test suite:'; \ - echo 'RIPEMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31'; \ - echo 'RIPEMD160 ("abc") = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc'; \ - echo 'RIPEMD160 ("message digest") =' \ - '5d0689ef49d2fae572b881b123a85ffa21595f36'; \ - echo 'RIPEMD160 ("abcdefghijklmnopqrstuvwxyz") =' \ - 'f71c27109c692c1b56bbdceb5b9d2865b3708dbc'; \ - echo 'RIPEMD160 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ - 'b0e20b6e3116640286ed3a87a5713079b21f5189'; \ - echo 'RIPEMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ - '9b752e45573d4b39f4dbd3323cab82bf63326bfb' ) > ${.TARGET} + echo 'RIPEMD160 test suite:' > ${.TARGET} + @echo 'RIPEMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31' >> ${.TARGET} + @echo 'RIPEMD160 ("abc") = 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc' >> ${.TARGET} + @echo 'RIPEMD160 ("message digest") =' \ + '5d0689ef49d2fae572b881b123a85ffa21595f36' >> ${.TARGET} + @echo 'RIPEMD160 ("abcdefghijklmnopqrstuvwxyz") =' \ + 'f71c27109c692c1b56bbdceb5b9d2865b3708dbc' >> ${.TARGET} + @echo 'RIPEMD160 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \ + 'b0e20b6e3116640286ed3a87a5713079b21f5189' >> ${.TARGET} + @echo 'RIPEMD160 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \ + '9b752e45573d4b39f4dbd3323cab82bf63326bfb' >> ${.TARGET} -test: md2.ref md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref +test: md2.ref md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha512.ref @${ECHO} if any of these test fail, the code produces wrong results @${ECHO} and should NOT be used. ${CC} ${CFLAGS} ${LDFLAGS} -DMD=2 -o mddriver ${.CURDIR}/mddriver.c -L. -lmd @@ -192,6 +226,9 @@ test: md2.ref md4.ref md5.ref sha0.ref r ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=256 -o shadriver ${.CURDIR}/shadriver.c -L. -lmd ./shadriver | cmp sha256.ref - @${ECHO} SHA-256 passed test + ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=512 -o shadriver ${.CURDIR}/shadriver.c libmd.a + ./shadriver | cmp sha512.ref - + @${ECHO} SHA-512 passed test -rm -f shadriver .include Modified: stable/7/lib/libmd/mddriver.c ============================================================================== --- stable/7/lib/libmd/mddriver.c Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libmd/mddriver.c Sat Jun 16 09:17:21 2012 (r237157) @@ -1,33 +1,31 @@ -/* MDDRIVER.C - test driver for MD2, MD4 and MD5 - */ +/* MDDRIVER.C - test driver for MD2, MD4 and MD5 */ + +/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All rights + * reserved. + * + * RSA Data Security, Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + * + * These notices must be retained in any copies of any part of this + * documentation and/or software. */ #include __FBSDID("$FreeBSD$"); -/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All - rights reserved. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -/* The following makes MD default to MD5 if it has not already been - defined with C compiler flags. - */ -#ifndef MD -#define MD 5 -#endif - #include #include #include #include + +/* The following makes MD default to MD5 if it has not already been defined + * with C compiler flags. */ +#ifndef MD +#define MD 5 +#endif + #if MD == 2 #include "md2.h" #define MDData MD2Data @@ -41,32 +39,31 @@ __FBSDID("$FreeBSD$"); #define MDData MD5Data #endif -/* Digests a string and prints the result. - */ -static void MDString (string) -char *string; +/* Digests a string and prints the result. */ +static void +MDString(char *string) { - char buf[33]; + char buf[33]; - printf ("MD%d (\"%s\") = %s\n", - MD, string, MDData(string,strlen(string),buf)); + printf("MD%d (\"%s\") = %s\n", + MD, string, MDData(string, strlen(string), buf)); } -/* Digests a reference suite of strings and prints the results. - */ -main() +/* Digests a reference suite of strings and prints the results. */ +int +main(void) { - printf ("MD%d test suite:\n", MD); + printf("MD%d test suite:\n", MD); + + MDString(""); + MDString("a"); + MDString("abc"); + MDString("message digest"); + MDString("abcdefghijklmnopqrstuvwxyz"); + MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz0123456789"); + MDString("1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890"); - MDString (""); - MDString ("a"); - MDString ("abc"); - MDString ("message digest"); - MDString ("abcdefghijklmnopqrstuvwxyz"); - MDString - ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); - MDString - ("1234567890123456789012345678901234567890\ -1234567890123456789012345678901234567890"); - return 0; + return 0; } Modified: stable/7/lib/libmd/rmddriver.c ============================================================================== --- stable/7/lib/libmd/rmddriver.c Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libmd/rmddriver.c Sat Jun 16 09:17:21 2012 (r237157) @@ -1,53 +1,51 @@ -/* RIPEMD160DRIVER.C - test driver for RIPEMD160 - */ +/* RIPEMD160DRIVER.C - test driver for RIPEMD160 */ + +/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All rights + * reserved. + * + * RSA Data Security, Inc. makes no representations concerning either the + * merchantability of this software or the suitability of this software for + * any particular purpose. It is provided "as is" without express or implied + * warranty of any kind. + * + * These notices must be retained in any copies of any part of this + * documentation and/or software. */ #include __FBSDID("$FreeBSD$"); -/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All - rights reserved. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - #include #include #include #include + #include "ripemd.h" -/* Digests a string and prints the result. - */ -static void RIPEMD160String (string) -char *string; +/* Digests a string and prints the result. */ +static void +RIPEMD160String(char *string) { - char buf[2*20+1]; + char buf[2*20 + 1]; - printf ("RIPEMD160 (\"%s\") = %s\n", - string, RIPEMD160_Data(string,strlen(string),buf)); + printf("RIPEMD160 (\"%s\") = %s\n", + string, RIPEMD160_Data(string, strlen(string), buf)); } -/* Digests a reference suite of strings and prints the results. - */ -main() +/* Digests a reference suite of strings and prints the results. */ +int +main(void) { - printf ("RIPEMD160 test suite:\n"); + printf("RIPEMD160 test suite:\n"); + + RIPEMD160String(""); + RIPEMD160String("abc"); + RIPEMD160String("message digest"); + RIPEMD160String("abcdefghijklmnopqrstuvwxyz"); + RIPEMD160String("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz0123456789"); + RIPEMD160String("1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890"); - RIPEMD160String (""); - RIPEMD160String ("abc"); - RIPEMD160String ("message digest"); - RIPEMD160String ("abcdefghijklmnopqrstuvwxyz"); - RIPEMD160String - ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); - RIPEMD160String - ("1234567890123456789012345678901234567890\ -1234567890123456789012345678901234567890"); - return 0; + return 0; } Modified: stable/7/lib/libmd/sha256.3 ============================================================================== --- stable/7/lib/libmd/sha256.3 Sat Jun 16 06:38:11 2012 (r237156) +++ stable/7/lib/libmd/sha256.3 Sat Jun 16 09:17:21 2012 (r237157) @@ -127,7 +127,7 @@ argument is non-null it must point to at .Xr sha 3 .Sh HISTORY These functions appeared in -.Fx 4.0 . +.Fx 6.0 . .Sh AUTHORS The core hash routines were implemented by Colin Percival based on the published Copied and modified: stable/7/lib/libmd/sha512.3 (from r220496, head/lib/libmd/sha512.3) ============================================================================== --- head/lib/libmd/sha512.3 Sat Apr 9 13:56:29 2011 (r220496, copy source) +++ stable/7/lib/libmd/sha512.3 Sat Jun 16 09:17:21 2012 (r237157) @@ -127,7 +127,7 @@ argument is non-null it must point to at .Xr sha 3 .Sh HISTORY These functions appeared in -.Fx 4.0 . +.Fx 9.0 . .Sh AUTHORS The core hash routines were implemented by Colin Percival based on the published Copied: stable/7/lib/libmd/sha512.h (from r220496, head/lib/libmd/sha512.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libmd/sha512.h Sat Jun 16 09:17:21 2012 (r237157, copy of r220496, head/lib/libmd/sha512.h) @@ -0,0 +1,50 @@ +/*- + * Copyright 2005 Colin Percival + * 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$ + */ + +#ifndef _SHA512_H_ +#define _SHA512_H_ + +#include + +typedef struct SHA512Context { + uint64_t state[8]; + uint64_t count[2]; + unsigned char buf[128]; +} SHA512_CTX; + +__BEGIN_DECLS +void SHA512_Init(SHA512_CTX *); +void SHA512_Update(SHA512_CTX *, const void *, size_t); +void SHA512_Final(unsigned char [64], SHA512_CTX *); +char *SHA512_End(SHA512_CTX *, char *); +char *SHA512_File(const char *, char *); +char *SHA512_FileChunk(const char *, char *, off_t, off_t); +char *SHA512_Data(const void *, unsigned int, char *); +__END_DECLS + +#endif /* !_SHA512_H_ */ Copied: stable/7/lib/libmd/sha512c.c (from r220496, head/lib/libmd/sha512c.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libmd/sha512c.c Sat Jun 16 09:17:21 2012 (r237157, copy of r220496, head/lib/libmd/sha512c.c) @@ -0,0 +1,320 @@ +/*- + * Copyright 2005 Colin Percival + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +#include "sha512.h" + +#if BYTE_ORDER == BIG_ENDIAN + +/* Copy a vector of big-endian uint64_t into a vector of bytes */ +#define be64enc_vect(dst, src, len) \ + memcpy((void *)dst, (const void *)src, (size_t)len) + +/* Copy a vector of bytes into a vector of big-endian uint64_t */ +#define be64dec_vect(dst, src, len) \ + memcpy((void *)dst, (const void *)src, (size_t)len) + +#else /* BYTE_ORDER != BIG_ENDIAN */ + +/* + * Encode a length len/4 vector of (uint64_t) into a length len vector of + * (unsigned char) in big-endian form. Assumes len is a multiple of 8. + */ +static void +be64enc_vect(unsigned char *dst, const uint64_t *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 8; i++) + be64enc(dst + i * 8, src[i]); +} + +/* + * Decode a big-endian length len vector of (unsigned char) into a length + * len/4 vector of (uint64_t). Assumes len is a multiple of 8. + */ +static void +be64dec_vect(uint64_t *dst, const unsigned char *src, size_t len) +{ + size_t i; + + for (i = 0; i < len / 8; i++) + dst[i] = be64dec(src + i * 8); +} + +#endif /* BYTE_ORDER != BIG_ENDIAN */ + +/* Elementary functions used by SHA512 */ +#define Ch(x, y, z) ((x & (y ^ z)) ^ z) +#define Maj(x, y, z) ((x & (y | z)) | (y & z)) +#define SHR(x, n) (x >> n) +#define ROTR(x, n) ((x >> n) | (x << (64 - n))) +#define S0(x) (ROTR(x, 28) ^ ROTR(x, 34) ^ ROTR(x, 39)) +#define S1(x) (ROTR(x, 14) ^ ROTR(x, 18) ^ ROTR(x, 41)) +#define s0(x) (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x, 7)) +#define s1(x) (ROTR(x, 19) ^ ROTR(x, 61) ^ SHR(x, 6)) + +/* SHA512 round function */ +#define RND(a, b, c, d, e, f, g, h, k) \ + t0 = h + S1(e) + Ch(e, f, g) + k; \ + t1 = S0(a) + Maj(a, b, c); \ + d += t0; \ + h = t0 + t1; + +/* Adjusted round function for rotating state */ +#define RNDr(S, W, i, k) \ + RND(S[(80 - i) % 8], S[(81 - i) % 8], \ + S[(82 - i) % 8], S[(83 - i) % 8], \ + S[(84 - i) % 8], S[(85 - i) % 8], \ + S[(86 - i) % 8], S[(87 - i) % 8], \ + W[i] + k) + +/* + * SHA512 block compression function. The 512-bit state is transformed via + * the 512-bit input block to produce a new state. + */ +static void +SHA512_Transform(uint64_t * state, const unsigned char block[128]) +{ + uint64_t W[80]; + uint64_t S[8]; + uint64_t t0, t1; + int i; + + /* 1. Prepare message schedule W. */ + be64dec_vect(W, block, 128); + for (i = 16; i < 80; i++) + W[i] = s1(W[i - 2]) + W[i - 7] + s0(W[i - 15]) + W[i - 16]; + + /* 2. Initialize working variables. */ + memcpy(S, state, 64); + + /* 3. Mix. */ + RNDr(S, W, 0, 0x428a2f98d728ae22ULL); + RNDr(S, W, 1, 0x7137449123ef65cdULL); + RNDr(S, W, 2, 0xb5c0fbcfec4d3b2fULL); + RNDr(S, W, 3, 0xe9b5dba58189dbbcULL); + RNDr(S, W, 4, 0x3956c25bf348b538ULL); + RNDr(S, W, 5, 0x59f111f1b605d019ULL); + RNDr(S, W, 6, 0x923f82a4af194f9bULL); + RNDr(S, W, 7, 0xab1c5ed5da6d8118ULL); + RNDr(S, W, 8, 0xd807aa98a3030242ULL); + RNDr(S, W, 9, 0x12835b0145706fbeULL); + RNDr(S, W, 10, 0x243185be4ee4b28cULL); + RNDr(S, W, 11, 0x550c7dc3d5ffb4e2ULL); + RNDr(S, W, 12, 0x72be5d74f27b896fULL); + RNDr(S, W, 13, 0x80deb1fe3b1696b1ULL); + RNDr(S, W, 14, 0x9bdc06a725c71235ULL); + RNDr(S, W, 15, 0xc19bf174cf692694ULL); + RNDr(S, W, 16, 0xe49b69c19ef14ad2ULL); + RNDr(S, W, 17, 0xefbe4786384f25e3ULL); + RNDr(S, W, 18, 0x0fc19dc68b8cd5b5ULL); + RNDr(S, W, 19, 0x240ca1cc77ac9c65ULL); + RNDr(S, W, 20, 0x2de92c6f592b0275ULL); + RNDr(S, W, 21, 0x4a7484aa6ea6e483ULL); + RNDr(S, W, 22, 0x5cb0a9dcbd41fbd4ULL); + RNDr(S, W, 23, 0x76f988da831153b5ULL); + RNDr(S, W, 24, 0x983e5152ee66dfabULL); + RNDr(S, W, 25, 0xa831c66d2db43210ULL); + RNDr(S, W, 26, 0xb00327c898fb213fULL); + RNDr(S, W, 27, 0xbf597fc7beef0ee4ULL); + RNDr(S, W, 28, 0xc6e00bf33da88fc2ULL); + RNDr(S, W, 29, 0xd5a79147930aa725ULL); + RNDr(S, W, 30, 0x06ca6351e003826fULL); + RNDr(S, W, 31, 0x142929670a0e6e70ULL); + RNDr(S, W, 32, 0x27b70a8546d22ffcULL); + RNDr(S, W, 33, 0x2e1b21385c26c926ULL); + RNDr(S, W, 34, 0x4d2c6dfc5ac42aedULL); + RNDr(S, W, 35, 0x53380d139d95b3dfULL); + RNDr(S, W, 36, 0x650a73548baf63deULL); + RNDr(S, W, 37, 0x766a0abb3c77b2a8ULL); + RNDr(S, W, 38, 0x81c2c92e47edaee6ULL); + RNDr(S, W, 39, 0x92722c851482353bULL); + RNDr(S, W, 40, 0xa2bfe8a14cf10364ULL); + RNDr(S, W, 41, 0xa81a664bbc423001ULL); + RNDr(S, W, 42, 0xc24b8b70d0f89791ULL); + RNDr(S, W, 43, 0xc76c51a30654be30ULL); + RNDr(S, W, 44, 0xd192e819d6ef5218ULL); + RNDr(S, W, 45, 0xd69906245565a910ULL); + RNDr(S, W, 46, 0xf40e35855771202aULL); + RNDr(S, W, 47, 0x106aa07032bbd1b8ULL); + RNDr(S, W, 48, 0x19a4c116b8d2d0c8ULL); + RNDr(S, W, 49, 0x1e376c085141ab53ULL); + RNDr(S, W, 50, 0x2748774cdf8eeb99ULL); + RNDr(S, W, 51, 0x34b0bcb5e19b48a8ULL); + RNDr(S, W, 52, 0x391c0cb3c5c95a63ULL); + RNDr(S, W, 53, 0x4ed8aa4ae3418acbULL); + RNDr(S, W, 54, 0x5b9cca4f7763e373ULL); + RNDr(S, W, 55, 0x682e6ff3d6b2b8a3ULL); + RNDr(S, W, 56, 0x748f82ee5defb2fcULL); + RNDr(S, W, 57, 0x78a5636f43172f60ULL); + RNDr(S, W, 58, 0x84c87814a1f0ab72ULL); + RNDr(S, W, 59, 0x8cc702081a6439ecULL); + RNDr(S, W, 60, 0x90befffa23631e28ULL); + RNDr(S, W, 61, 0xa4506cebde82bde9ULL); + RNDr(S, W, 62, 0xbef9a3f7b2c67915ULL); + RNDr(S, W, 63, 0xc67178f2e372532bULL); + RNDr(S, W, 64, 0xca273eceea26619cULL); + RNDr(S, W, 65, 0xd186b8c721c0c207ULL); + RNDr(S, W, 66, 0xeada7dd6cde0eb1eULL); + RNDr(S, W, 67, 0xf57d4f7fee6ed178ULL); + RNDr(S, W, 68, 0x06f067aa72176fbaULL); + RNDr(S, W, 69, 0x0a637dc5a2c898a6ULL); + RNDr(S, W, 70, 0x113f9804bef90daeULL); + RNDr(S, W, 71, 0x1b710b35131c471bULL); + RNDr(S, W, 72, 0x28db77f523047d84ULL); + RNDr(S, W, 73, 0x32caab7b40c72493ULL); + RNDr(S, W, 74, 0x3c9ebe0a15c9bebcULL); + RNDr(S, W, 75, 0x431d67c49c100d4cULL); + RNDr(S, W, 76, 0x4cc5d4becb3e42b6ULL); + RNDr(S, W, 77, 0x597f299cfc657e2aULL); + RNDr(S, W, 78, 0x5fcb6fab3ad6faecULL); + RNDr(S, W, 79, 0x6c44198c4a475817ULL); + + /* 4. Mix local working variables into global state */ + for (i = 0; i < 8; i++) + state[i] += S[i]; +} + +static unsigned char PAD[128] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* Add padding and terminating bit-count. */ +static void +SHA512_Pad(SHA512_CTX * ctx) +{ + unsigned char len[16]; + uint64_t r, plen; + + /* + * Convert length to a vector of bytes -- we do this now rather + * than later because the length will change after we pad. + */ + be64enc_vect(len, ctx->count, 16); + + /* Add 1--128 bytes so that the resulting length is 112 mod 128 */ + r = (ctx->count[1] >> 3) & 0x7f; + plen = (r < 112) ? (112 - r) : (240 - r); + SHA512_Update(ctx, PAD, (size_t)plen); + + /* Add the terminating bit-count */ + SHA512_Update(ctx, len, 16); +} + +/* SHA-512 initialization. Begins a SHA-512 operation. */ +void +SHA512_Init(SHA512_CTX * ctx) +{ + + /* Zero bits processed so far */ + ctx->count[0] = ctx->count[1] = 0; + + /* Magic initialization constants */ + ctx->state[0] = 0x6a09e667f3bcc908ULL; + ctx->state[1] = 0xbb67ae8584caa73bULL; + ctx->state[2] = 0x3c6ef372fe94f82bULL; + ctx->state[3] = 0xa54ff53a5f1d36f1ULL; + ctx->state[4] = 0x510e527fade682d1ULL; + ctx->state[5] = 0x9b05688c2b3e6c1fULL; + ctx->state[6] = 0x1f83d9abfb41bd6bULL; + ctx->state[7] = 0x5be0cd19137e2179ULL; +} + +/* Add bytes into the hash */ +void +SHA512_Update(SHA512_CTX * ctx, const void *in, size_t len) +{ + uint64_t bitlen[2]; + uint64_t r; + const unsigned char *src = in; + + /* Number of bytes left in the buffer from previous updates */ + r = (ctx->count[1] >> 3) & 0x7f; + + /* Convert the length into a number of bits */ + bitlen[1] = ((uint64_t)len) << 3; + bitlen[0] = ((uint64_t)len) >> 61; + + /* Update number of bits */ + if ((ctx->count[1] += bitlen[1]) < bitlen[1]) + ctx->count[0]++; + ctx->count[0] += bitlen[0]; + + /* Handle the case where we don't need to perform any transforms */ + if (len < 128 - r) { + memcpy(&ctx->buf[r], src, len); + return; + } + + /* Finish the current block */ + memcpy(&ctx->buf[r], src, 128 - r); + SHA512_Transform(ctx->state, ctx->buf); + src += 128 - r; + len -= 128 - r; + + /* Perform complete blocks */ + while (len >= 128) { + SHA512_Transform(ctx->state, src); + src += 128; + len -= 128; + } + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 09:42:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 21094106564A; Sat, 16 Jun 2012 09:42:42 +0000 (UTC) (envelope-from tijl@coosemans.org) Received: from mailrelay012.isp.belgacom.be (mailrelay012.isp.belgacom.be [195.238.6.179]) by mx1.freebsd.org (Postfix) with ESMTP id 1000B8FC0A; Sat, 16 Jun 2012 09:42:40 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAFAIlU3E9bsTjL/2dsb2JhbABFhVeve4EIghgBAQUjMyIBEAsOBgQCAgUWCwICCQMCAQIBJx4GDQEHAQEFiAYHpiqSQIEgihiFKYESA55IhlmCYg Received: from 203.56-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.56.203]) by relay.skynet.be with ESMTP; 16 Jun 2012 11:41:21 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q5G9fKGi011559; Sat, 16 Jun 2012 11:41:20 +0200 (CEST) (envelope-from tijl@coosemans.org) Message-ID: <4FDC54C0.3030105@coosemans.org> Date: Sat, 16 Jun 2012 11:41:20 +0200 From: Tijl Coosemans User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:13.0) Gecko/20120609 Thunderbird/13.0 MIME-Version: 1.0 To: Konstantin Belousov References: <201206122137.q5CLbReK077123@svn.freebsd.org> In-Reply-To: <201206122137.q5CLbReK077123@svn.freebsd.org> X-Enigmail-Version: 1.5pre Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r236976 - head/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 09:42:42 -0000 On 12-06-2012 23:37, Konstantin Belousov wrote: > Author: kib > Date: Tue Jun 12 21:37:27 2012 > New Revision: 236976 > URL: http://svn.freebsd.org/changeset/base/236976 > > Log: > For incompleted block allocations or frees, the inode block count usage > must be recalculated. The blk_check pass of suj checker explicitely marks > inodes which owned such blocks as needing block count adjustment. But > ino_adjblks() is only called by cg_trunc pass, which is performed before > blk_check. As result, the block use count for such inodes is left wrong. > This causes full fsck run after journaled run to still find inconsistencies > like 'INCORRECT BLOCK COUNT I=14557 (328 should be 0)' in phase 1. > > Fix this issue by running additional adj_blk pass after blk_check, which > updates the field. > > Reviewed by: jeff, mckusick > MFC after: 1 week Thanks! This probably fixes http://www.freebsd.org/cgi/query-pr.cgi?pr=165950 From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 11:27:40 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9DA8106564A; Sat, 16 Jun 2012 11:27:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 34CC28FC0A; Sat, 16 Jun 2012 11:27:40 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q5GBRWrP065995; Sat, 16 Jun 2012 14:27:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q5GBRWWF024730; Sat, 16 Jun 2012 14:27:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q5GBRWYq024729; Sat, 16 Jun 2012 14:27:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 16 Jun 2012 14:27:32 +0300 From: Konstantin Belousov To: Tijl Coosemans Message-ID: <20120616112732.GN2337@deviant.kiev.zoral.com.ua> References: <201206122137.q5CLbReK077123@svn.freebsd.org> <4FDC54C0.3030105@coosemans.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Zz8eIV9MTSc31S3o" Content-Disposition: inline In-Reply-To: <4FDC54C0.3030105@coosemans.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236976 - head/sbin/fsck_ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 11:27:40 -0000 --Zz8eIV9MTSc31S3o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 16, 2012 at 11:41:20AM +0200, Tijl Coosemans wrote: > On 12-06-2012 23:37, Konstantin Belousov wrote: > > Author: kib > > Date: Tue Jun 12 21:37:27 2012 > > New Revision: 236976 > > URL: http://svn.freebsd.org/changeset/base/236976 > >=20 > > Log: > > For incompleted block allocations or frees, the inode block count usa= ge > > must be recalculated. The blk_check pass of suj checker explicitely m= arks > > inodes which owned such blocks as needing block count adjustment. But > > ino_adjblks() is only called by cg_trunc pass, which is performed bef= ore > > blk_check. As result, the block use count for such inodes is left wro= ng. > > This causes full fsck run after journaled run to still find inconsist= encies > > like 'INCORRECT BLOCK COUNT I=3D14557 (328 should be 0)' in phase 1. > > =20 > > Fix this issue by running additional adj_blk pass after blk_check, wh= ich > > updates the field. > > =20 > > Reviewed by: jeff, mckusick > > MFC after: 1 week >=20 > Thanks! This probably fixes http://www.freebsd.org/cgi/query-pr.cgi?pr=3D= 165950 There is more in the PR then just 'INCORRECT BLOCK COUNT' inconsistency. Somebody will look at the remaining issues eventually. --Zz8eIV9MTSc31S3o Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk/cbaMACgkQC3+MBN1Mb4gY5gCfZsCq3bC+6Whj8T22ONc//89n k5EAoKFC8vXs8EB3q+rttRvjduX2ltHM =Nkbl -----END PGP SIGNATURE----- --Zz8eIV9MTSc31S3o-- From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 12:56:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ACAF9106564A; Sat, 16 Jun 2012 12:56:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 981CA8FC0C; Sat, 16 Jun 2012 12:56:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GCubAC045154; Sat, 16 Jun 2012 12:56:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GCubwO045152; Sat, 16 Jun 2012 12:56:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206161256.q5GCubwO045152@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 16 Jun 2012 12:56:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237158 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 12:56:37 -0000 Author: pjd Date: Sat Jun 16 12:56:36 2012 New Revision: 237158 URL: http://svn.freebsd.org/changeset/base/237158 Log: Revert r237073. 'td' can be NULL here. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Jun 16 09:17:21 2012 (r237157) +++ head/sys/kern/kern_descrip.c Sat Jun 16 12:56:36 2012 (r237158) @@ -2104,9 +2104,6 @@ closef(struct file *fp, struct thread *t struct filedesc *fdp; struct file *fp_object; - fdp = td->td_proc->p_fd; - FILEDESC_UNLOCK_ASSERT(fdp); - /* * POSIX record locking dictates that any close releases ALL * locks owned by this process. This is handled by setting @@ -2142,6 +2139,7 @@ closef(struct file *fp, struct thread *t * Handle special case where file descriptor table is * shared between multiple process leaders. */ + fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); for (fdtol = fdtol->fdl_next; fdtol != td->td_proc->p_fdtol; From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 13:10:23 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 281851065763; Sat, 16 Jun 2012 13:10:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08F8D8FC14; Sat, 16 Jun 2012 13:10:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GDAMBH045749; Sat, 16 Jun 2012 13:10:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GDAMlC045747; Sat, 16 Jun 2012 13:10:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206161310.q5GDAMlC045747@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 Jun 2012 13:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237159 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 13:10:23 -0000 Author: kib Date: Sat Jun 16 13:10:22 2012 New Revision: 237159 URL: http://svn.freebsd.org/changeset/base/237159 Log: Revert part of the r235740 which changed separate allocation of the string buffer for each linelist l_line into one large string. Since linelists parsed out during the previous passes store the pointers to previously allocated l_lines, the reallocation caused undefined behaviour on accessing the buffers, and quite deterministic fault on freeing them (in mountd(8) startup). This fixes reading of netgroup(5) file which contains more then one netgroup. Discussed with: ghelmer MFC after: 3 days Modified: head/lib/libc/gen/getnetgrent.c Modified: head/lib/libc/gen/getnetgrent.c ============================================================================== --- head/lib/libc/gen/getnetgrent.c Sat Jun 16 12:56:36 2012 (r237158) +++ head/lib/libc/gen/getnetgrent.c Sat Jun 16 13:10:22 2012 (r237159) @@ -538,7 +538,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep; + char *linep, *olinep, *pos, *spos; int len, olen; int cont; struct linelist *lp; @@ -615,15 +615,20 @@ read_for_group(const char *group) } else cont = 0; if (len > 0) { - linep = reallocf(linep, olen + len + 1); + linep = malloc(olen + len + 1); if (linep == NULL) { free(lp->l_groupname); free(lp); return (NULL); } + if (olen > 0) { + bcopy(olinep, linep, olen); + free(olinep); + } bcopy(pos, linep + olen, len); olen += len; *(linep + olen) = '\0'; + olinep = linep; } if (cont) { if (fgets(line, LINSIZ, netf)) { From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 13:11:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDD091065672; Sat, 16 Jun 2012 13:11:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C00E28FC1C; Sat, 16 Jun 2012 13:11:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GDBAa7045831; Sat, 16 Jun 2012 13:11:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GDBAf8045829; Sat, 16 Jun 2012 13:11:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206161311.q5GDBAf8045829@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 Jun 2012 13:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237160 - head/lib/libc/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 13:11:11 -0000 Author: kib Date: Sat Jun 16 13:11:10 2012 New Revision: 237160 URL: http://svn.freebsd.org/changeset/base/237160 Log: More style. MFC after: 3 days Modified: head/lib/libc/gen/getnetgrent.c Modified: head/lib/libc/gen/getnetgrent.c ============================================================================== --- head/lib/libc/gen/getnetgrent.c Sat Jun 16 13:10:22 2012 (r237159) +++ head/lib/libc/gen/getnetgrent.c Sat Jun 16 13:11:10 2012 (r237160) @@ -161,8 +161,7 @@ setnetgrent(const char *group) if (group == NULL || !strlen(group)) return; - if (grouphead.gr == (struct netgrp *)0 || - strcmp(group, grouphead.grname)) { + if (grouphead.gr == NULL || strcmp(group, grouphead.grname)) { endnetgrent(); #ifdef YP /* Presumed guilty until proven innocent. */ @@ -172,7 +171,7 @@ setnetgrent(const char *group) * use NIS exclusively. */ if (((stat(_PATH_NETGROUP, &_yp_statp) < 0) && - errno == ENOENT) || _yp_statp.st_size == 0) + errno == ENOENT) || _yp_statp.st_size == 0) _use_only_yp = _netgr_yp_enabled = 1; if ((netf = fopen(_PATH_NETGROUP,"r")) != NULL ||_use_only_yp){ /* @@ -247,27 +246,24 @@ endnetgrent(void) lp = lp->l_next; free(olp->l_groupname); free(olp->l_line); - free((char *)olp); + free(olp); } - linehead = (struct linelist *)0; + linehead = NULL; if (grouphead.grname) { free(grouphead.grname); - grouphead.grname = (char *)0; + grouphead.grname = NULL; } gp = grouphead.gr; while (gp) { ogp = gp; gp = gp->ng_next; - if (ogp->ng_str[NG_HOST]) - free(ogp->ng_str[NG_HOST]); - if (ogp->ng_str[NG_USER]) - free(ogp->ng_str[NG_USER]); - if (ogp->ng_str[NG_DOM]) - free(ogp->ng_str[NG_DOM]); - free((char *)ogp); + free(ogp->ng_str[NG_HOST]); + free(ogp->ng_str[NG_USER]); + free(ogp->ng_str[NG_DOM]); + free(ogp); } - grouphead.gr = (struct netgrp *)0; - nextgrp = (struct netgrp *)0; + grouphead.gr = NULL; + nextgrp = NULL; #ifdef YP _netgr_yp_enabled = 0; #endif @@ -282,7 +278,7 @@ _listmatch(const char *list, const char int glen = strlen(group); /* skip possible leading whitespace */ - while(isspace((unsigned char)*ptr)) + while (isspace((unsigned char)*ptr)) ptr++; while (ptr < list + len) { @@ -291,7 +287,7 @@ _listmatch(const char *list, const char ptr++; if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr)) return (1); - while(*ptr == ',' || isspace((unsigned char)*ptr)) + while (*ptr == ',' || isspace((unsigned char)*ptr)) ptr++; } @@ -436,8 +432,7 @@ parse_netgrp(const char *group) break; lp = lp->l_next; } - if (lp == (struct linelist *)0 && - (lp = read_for_group(group)) == (struct linelist *)0) + if (lp == NULL && (lp = read_for_group(group)) == NULL) return (1); if (lp->l_parsed) { #ifdef DEBUG From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 13:22:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BF1451065674; Sat, 16 Jun 2012 13:22:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A832B8FC12; Sat, 16 Jun 2012 13:22:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GDMt00046368; Sat, 16 Jun 2012 13:22:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GDMtee046365; Sat, 16 Jun 2012 13:22:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206161322.q5GDMtee046365@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 Jun 2012 13:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237161 - in stable/9/sys: amd64/include i386/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 13:22:55 -0000 Author: kib Date: Sat Jun 16 13:22:55 2012 New Revision: 237161 URL: http://svn.freebsd.org/changeset/base/237161 Log: MFC r236456: Use plain store for atomic_store_rel on x86, instead of implicitly locked xchg instruction. IA32 memory model guarantees that store has release semantic, since stores cannot pass loads or stores. Modified: stable/9/sys/amd64/include/atomic.h stable/9/sys/i386/include/atomic.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/include/atomic.h ============================================================================== --- stable/9/sys/amd64/include/atomic.h Sat Jun 16 13:11:10 2012 (r237160) +++ stable/9/sys/amd64/include/atomic.h Sat Jun 16 13:22:55 2012 (r237161) @@ -81,8 +81,9 @@ int atomic_cmpset_long(volatile u_long * u_int atomic_fetchadd_int(volatile u_int *p, u_int v); u_long atomic_fetchadd_long(volatile u_long *p, u_long v); -#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ -u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p); \ +#define ATOMIC_LOAD(TYPE, LOP) \ +u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p) +#define ATOMIC_STORE(TYPE) \ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) #else /* !KLD_MODULE && __GNUCLIKE_ASM */ @@ -210,37 +211,43 @@ atomic_fetchadd_long(volatile u_long *p, return (v); } -#if defined(_KERNEL) && !defined(SMP) - /* - * We assume that a = b will do atomic loads and stores. However, on a - * PentiumPro or higher, reads may pass writes, so for that case we have - * to use a serializing instruction (i.e. with LOCK) to do the load in - * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we only need to take care of compiler. + * We assume that a = b will do atomic loads and stores. Due to the + * IA32 memory model, a simple store guarantees release semantics. + * + * However, loads may pass stores, so for atomic_load_acq we have to + * ensure a Store/Load barrier to do the load in SMP kernels. We use + * "lock cmpxchg" as recommended by the AMD Software Optimization + * Guide, and not mfence. For UP kernels, however, the cache of the + * single processor is always consistent, so we only need to take care + * of the compiler. */ -#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ +#define ATOMIC_STORE(TYPE) \ +static __inline void \ +atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile("" : : : "memory"); \ + *p = v; \ +} \ +struct __hack + +#if defined(_KERNEL) && !defined(SMP) + +#define ATOMIC_LOAD(TYPE, LOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ u_##TYPE tmp; \ \ tmp = *p; \ - __asm __volatile ("" : : : "memory"); \ + __asm __volatile("" : : : "memory"); \ return (tmp); \ } \ - \ -static __inline void \ -atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - __asm __volatile ("" : : : "memory"); \ - *p = v; \ -} \ struct __hack #else /* !(_KERNEL && !SMP) */ -#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ +#define ATOMIC_LOAD(TYPE, LOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ @@ -254,19 +261,6 @@ atomic_load_acq_##TYPE(volatile u_##TYPE \ return (res); \ } \ - \ -/* \ - * The XCHG instruction asserts LOCK automagically. \ - */ \ -static __inline void \ -atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - __asm __volatile(SOP \ - : "=m" (*p), /* 0 */ \ - "+r" (v) /* 1 */ \ - : "m" (*p) /* 2 */ \ - : "memory"); \ -} \ struct __hack #endif /* _KERNEL && !SMP */ @@ -293,13 +287,19 @@ ATOMIC_ASM(clear, long, "andq %1,%0" ATOMIC_ASM(add, long, "addq %1,%0", "ir", v); ATOMIC_ASM(subtract, long, "subq %1,%0", "ir", v); -ATOMIC_STORE_LOAD(char, "cmpxchgb %b0,%1", "xchgb %b1,%0"); -ATOMIC_STORE_LOAD(short,"cmpxchgw %w0,%1", "xchgw %w1,%0"); -ATOMIC_STORE_LOAD(int, "cmpxchgl %0,%1", "xchgl %1,%0"); -ATOMIC_STORE_LOAD(long, "cmpxchgq %0,%1", "xchgq %1,%0"); +ATOMIC_LOAD(char, "cmpxchgb %b0,%1"); +ATOMIC_LOAD(short, "cmpxchgw %w0,%1"); +ATOMIC_LOAD(int, "cmpxchgl %0,%1"); +ATOMIC_LOAD(long, "cmpxchgq %0,%1"); + +ATOMIC_STORE(char); +ATOMIC_STORE(short); +ATOMIC_STORE(int); +ATOMIC_STORE(long); #undef ATOMIC_ASM -#undef ATOMIC_STORE_LOAD +#undef ATOMIC_LOAD +#undef ATOMIC_STORE #ifndef WANT_FUNCTIONS Modified: stable/9/sys/i386/include/atomic.h ============================================================================== --- stable/9/sys/i386/include/atomic.h Sat Jun 16 13:11:10 2012 (r237160) +++ stable/9/sys/i386/include/atomic.h Sat Jun 16 13:22:55 2012 (r237161) @@ -32,9 +32,9 @@ #error this file needs sys/cdefs.h as a prerequisite #endif -#define mb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") -#define wmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") -#define rmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory") +#define mb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") +#define wmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") +#define rmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") /* * Various simple operations on memory, each of which is atomic in the @@ -79,8 +79,9 @@ void atomic_##NAME##_barr_##TYPE(volatil int atomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src); u_int atomic_fetchadd_int(volatile u_int *p, u_int v); -#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ -u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p); \ +#define ATOMIC_LOAD(TYPE, LOP) \ +u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p) +#define ATOMIC_STORE(TYPE) \ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) #else /* !KLD_MODULE && __GNUCLIKE_ASM */ @@ -280,16 +281,29 @@ atomic_fetchadd_int(volatile u_int *p, u return (v); } -#if defined(_KERNEL) && !defined(SMP) - /* - * We assume that a = b will do atomic loads and stores. However, on a - * PentiumPro or higher, reads may pass writes, so for that case we have - * to use a serializing instruction (i.e. with LOCK) to do the load in - * SMP kernels. For UP kernels, however, the cache of the single processor - * is always consistent, so we only need to take care of compiler. + * We assume that a = b will do atomic loads and stores. Due to the + * IA32 memory model, a simple store guarantees release semantics. + * + * However, loads may pass stores, so for atomic_load_acq we have to + * ensure a Store/Load barrier to do the load in SMP kernels. We use + * "lock cmpxchg" as recommended by the AMD Software Optimization + * Guide, and not mfence. For UP kernels, however, the cache of the + * single processor is always consistent, so we only need to take care + * of the compiler. */ -#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ +#define ATOMIC_STORE(TYPE) \ +static __inline void \ +atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ +{ \ + __asm __volatile("" : : : "memory"); \ + *p = v; \ +} \ +struct __hack + +#if defined(_KERNEL) && !defined(SMP) + +#define ATOMIC_LOAD(TYPE, LOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ @@ -299,18 +313,11 @@ atomic_load_acq_##TYPE(volatile u_##TYPE __asm __volatile("" : : : "memory"); \ return (tmp); \ } \ - \ -static __inline void \ -atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - __asm __volatile("" : : : "memory"); \ - *p = v; \ -} \ struct __hack #else /* !(_KERNEL && !SMP) */ -#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ +#define ATOMIC_LOAD(TYPE, LOP) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ @@ -324,19 +331,6 @@ atomic_load_acq_##TYPE(volatile u_##TYPE \ return (res); \ } \ - \ -/* \ - * The XCHG instruction asserts LOCK automagically. \ - */ \ -static __inline void \ -atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ -{ \ - __asm __volatile(SOP \ - : "=m" (*p), /* 0 */ \ - "+r" (v) /* 1 */ \ - : "m" (*p) /* 2 */ \ - : "memory"); \ -} \ struct __hack #endif /* _KERNEL && !SMP */ @@ -363,13 +357,19 @@ ATOMIC_ASM(clear, long, "andl %1,%0" ATOMIC_ASM(add, long, "addl %1,%0", "ir", v); ATOMIC_ASM(subtract, long, "subl %1,%0", "ir", v); -ATOMIC_STORE_LOAD(char, "cmpxchgb %b0,%1", "xchgb %b1,%0"); -ATOMIC_STORE_LOAD(short,"cmpxchgw %w0,%1", "xchgw %w1,%0"); -ATOMIC_STORE_LOAD(int, "cmpxchgl %0,%1", "xchgl %1,%0"); -ATOMIC_STORE_LOAD(long, "cmpxchgl %0,%1", "xchgl %1,%0"); +ATOMIC_LOAD(char, "cmpxchgb %b0,%1"); +ATOMIC_LOAD(short, "cmpxchgw %w0,%1"); +ATOMIC_LOAD(int, "cmpxchgl %0,%1"); +ATOMIC_LOAD(long, "cmpxchgl %0,%1"); + +ATOMIC_STORE(char); +ATOMIC_STORE(short); +ATOMIC_STORE(int); +ATOMIC_STORE(long); #undef ATOMIC_ASM -#undef ATOMIC_STORE_LOAD +#undef ATOMIC_LOAD +#undef ATOMIC_STORE #ifndef WANT_FUNCTIONS From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 13:51:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56BB71065672; Sat, 16 Jun 2012 13:51:02 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41BF88FC1E; Sat, 16 Jun 2012 13:51:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GDp27n047549; Sat, 16 Jun 2012 13:51:02 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GDp2c9047547; Sat, 16 Jun 2012 13:51:02 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201206161351.q5GDp2c9047547@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 16 Jun 2012 13:51:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237162 - head/sys/netgraph/netflow X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 13:51:02 -0000 Author: melifaro Date: Sat Jun 16 13:51:01 2012 New Revision: 237162 URL: http://svn.freebsd.org/changeset/base/237162 Log: Fix improper L4 header handling for IPv6 packets passed via DLT_RAW. Reported by: Emil Muratov Reviewed by: glebius Approved by: ae(mentor) MFC after: 1 week Modified: head/sys/netgraph/netflow/ng_netflow.c Modified: head/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- head/sys/netgraph/netflow/ng_netflow.c Sat Jun 16 13:22:55 2012 (r237161) +++ head/sys/netgraph/netflow/ng_netflow.c Sat Jun 16 13:51:01 2012 (r237162) @@ -712,7 +712,7 @@ ng_netflow_rcvdata (hook_p hook, item_p if (ip->ip_v == IP6VERSION) { /* IPv6 packet */ ip = NULL; - M_CHECK(sizeof(struct ip6_hdr)); + M_CHECK(sizeof(struct ip6_hdr) - sizeof(struct ip)); ip6 = mtod(m, struct ip6_hdr *); } #endif From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 13:53:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AFCBB106566B; Sat, 16 Jun 2012 13:53:15 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A4968FC17; Sat, 16 Jun 2012 13:53:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GDrFfk047673; Sat, 16 Jun 2012 13:53:15 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GDrFu5047671; Sat, 16 Jun 2012 13:53:15 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201206161353.q5GDrFu5047671@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 16 Jun 2012 13:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237163 - head/sys/netgraph/netflow X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 13:53:15 -0000 Author: melifaro Date: Sat Jun 16 13:53:14 2012 New Revision: 237163 URL: http://svn.freebsd.org/changeset/base/237163 Log: Set netflow v9 observation domain value to fib number instead of node id. This fixes multi-fib netflow v9 export. Reviewed by: glebius Approved by: kib(mentor) MFC after: 1 week Modified: head/sys/netgraph/netflow/netflow_v9.c Modified: head/sys/netgraph/netflow/netflow_v9.c ============================================================================== --- head/sys/netgraph/netflow/netflow_v9.c Sat Jun 16 13:51:01 2012 (r237162) +++ head/sys/netgraph/netflow/netflow_v9.c Sat Jun 16 13:53:14 2012 (r237163) @@ -222,7 +222,7 @@ export9_send(priv_p priv, fib_export_p f header->unix_secs = htonl(ts.tv_sec); header->seq_num = htonl(atomic_fetchadd_32(&fe->flow9_seq, 1)); header->count = htons(t->count); - header->source_id = htonl(NG_NODE_ID(priv->node)); + header->source_id = htonl(fe->domain_id); if (priv->export9 != NULL) NG_FWD_ITEM_HOOK_FLAGS(error, item, priv->export9, flags); From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 13:55:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7992A106564A; Sat, 16 Jun 2012 13:55:32 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6482A8FC15; Sat, 16 Jun 2012 13:55:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GDtWpa047813; Sat, 16 Jun 2012 13:55:32 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GDtW7q047811; Sat, 16 Jun 2012 13:55:32 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201206161355.q5GDtW7q047811@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Sat, 16 Jun 2012 13:55:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237164 - head/sys/netgraph/netflow X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 13:55:32 -0000 Author: melifaro Date: Sat Jun 16 13:55:31 2012 New Revision: 237164 URL: http://svn.freebsd.org/changeset/base/237164 Log: Use time_uptime instead of getnanotime for accouting integer number of seconds. Reviewed by: glebius Approved by: ae(mentor) MFC after: 1 week Modified: head/sys/netgraph/netflow/netflow_v9.c Modified: head/sys/netgraph/netflow/netflow_v9.c ============================================================================== --- head/sys/netgraph/netflow/netflow_v9.c Sat Jun 16 13:53:14 2012 (r237163) +++ head/sys/netgraph/netflow/netflow_v9.c Sat Jun 16 13:55:31 2012 (r237164) @@ -416,16 +416,14 @@ get_export9_dgram(priv_p priv, fib_expor * Check if we need to insert templates into packet */ - struct timespec ts; struct netflow_v9_flowset_header *fl; - getnanotime(&ts); - if ((ts.tv_sec >= priv->templ_time + fe->templ_last_ts) || + if ((time_uptime >= priv->templ_time + fe->templ_last_ts) || (fe->sent_packets >= priv->templ_packets + fe->templ_last_pkt)) { - atomic_store_rel_32(&fe->templ_last_ts, ts.tv_sec); - atomic_store_rel_32(&fe->templ_last_pkt, fe->sent_packets); - + fe->templ_last_ts = time_uptime; + fe->templ_last_pkt = fe->sent_packets; + fl = priv->v9_flowsets[0]; m_append(m, ntohs(fl->length), (void *)fl); t->flow_header = m->m_len; From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 16:51:43 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40132106566B; Sat, 16 Jun 2012 16:51:43 +0000 (UTC) (envelope-from rmh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B13A8FC0C; Sat, 16 Jun 2012 16:51:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GGphME055301; Sat, 16 Jun 2012 16:51:43 GMT (envelope-from rmh@svn.freebsd.org) Received: (from rmh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GGpgX8055299; Sat, 16 Jun 2012 16:51:42 GMT (envelope-from rmh@svn.freebsd.org) Message-Id: <201206161651.q5GGpgX8055299@svn.freebsd.org> From: Robert Millan Date: Sat, 16 Jun 2012 16:51:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237165 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 16:51:43 -0000 Author: rmh Date: Sat Jun 16 16:51:42 2012 New Revision: 237165 URL: http://svn.freebsd.org/changeset/base/237165 Log: In CTFCONVERT_CMD initialization, check that ${MAKE_VERSION} is defined before using it. Bootstrap make (as built by usr.bin/make/Makefile.dist) does not define this variable, but it needs to parse bsd.own.mk in order to build a complete make. Modified: head/share/mk/bsd.own.mk Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Sat Jun 16 13:55:31 2012 (r237164) +++ head/share/mk/bsd.own.mk Sat Jun 16 16:51:42 2012 (r237165) @@ -639,7 +639,7 @@ MK_${vv:H}:= ${MK_${vv:T}} .if ${MK_CTF} != "no" CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} -.elif ${MAKE_VERSION} >= 5201111300 +.elif defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300 CTFCONVERT_CMD= .else CTFCONVERT_CMD= @: From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 18:37:55 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B88F106566C; Sat, 16 Jun 2012 18:37:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 751CA8FC08; Sat, 16 Jun 2012 18:37:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GIbt5E059666; Sat, 16 Jun 2012 18:37:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GIbtWo059664; Sat, 16 Jun 2012 18:37:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206161837.q5GIbtWo059664@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 Jun 2012 18:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237167 - stable/7/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 18:37:55 -0000 Author: kib Date: Sat Jun 16 18:37:54 2012 New Revision: 237167 URL: http://svn.freebsd.org/changeset/base/237167 Log: Move misplaced comment. Discussed with: bz Modified: stable/7/sys/amd64/amd64/trap.c Modified: stable/7/sys/amd64/amd64/trap.c ============================================================================== --- stable/7/sys/amd64/amd64/trap.c Sat Jun 16 17:05:09 2012 (r237166) +++ stable/7/sys/amd64/amd64/trap.c Sat Jun 16 18:37:54 2012 (r237167) @@ -970,10 +970,6 @@ syscall(struct trapframe *frame) } /* - * Traced syscall. - */ - - /* * If the user-supplied value of %rip is not a canonical * address, then some CPUs will trigger a ring 0 #GP during * the sysret instruction. However, the fault handler would @@ -989,6 +985,10 @@ syscall(struct trapframe *frame) ksi.ksi_addr = (void *)td->td_frame->tf_rip; trapsignal(td, &ksi); } + + /* + * Traced syscall. + */ if (orig_tf_rflags & PSL_T) { frame->tf_rflags &= ~PSL_T; ksiginfo_init_trap(&ksi); From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 18:56:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 474DB1065674; Sat, 16 Jun 2012 18:56:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3081A8FC0C; Sat, 16 Jun 2012 18:56:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GIuKFZ060439; Sat, 16 Jun 2012 18:56:20 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GIuJqv060425; Sat, 16 Jun 2012 18:56:19 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201206161856.q5GIuJqv060425@svn.freebsd.org> From: Alan Cox Date: Sat, 16 Jun 2012 18:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237168 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 18:56:20 -0000 Author: alc Date: Sat Jun 16 18:56:19 2012 New Revision: 237168 URL: http://svn.freebsd.org/changeset/base/237168 Log: The page flag PGA_WRITEABLE is set and cleared exclusively by the pmap layer, but it is read directly by the MI VM layer. This change introduces pmap_page_is_write_mapped() in order to completely encapsulate all direct access to PGA_WRITEABLE in the pmap layer. Aesthetics aside, I am making this change because amd64 will likely begin using an alternative method to track write mappings, and having pmap_page_is_write_mapped() in place allows me to make such a change without further modification to the MI VM layer. As an added bonus, tidy up some nearby comments concerning page flags. Reviewed by: kib MFC after: 6 weeks Modified: head/sys/amd64/include/pmap.h head/sys/arm/include/pmap.h head/sys/i386/include/pmap.h head/sys/ia64/include/pmap.h head/sys/mips/include/pmap.h head/sys/powerpc/include/pmap.h head/sys/sparc64/include/pmap.h head/sys/vm/pmap.h head/sys/vm/swap_pager.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vnode_pager.c Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/amd64/include/pmap.h Sat Jun 16 18:56:19 2012 (r237168) @@ -309,6 +309,7 @@ extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; #define pmap_page_get_memattr(m) ((vm_memattr_t)(m)->md.pat_mode) +#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) #define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) void pmap_bootstrap(vm_paddr_t *); Modified: head/sys/arm/include/pmap.h ============================================================================== --- head/sys/arm/include/pmap.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/arm/include/pmap.h Sat Jun 16 18:56:19 2012 (r237168) @@ -78,6 +78,7 @@ #define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) +#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) #define pmap_page_set_memattr(m, ma) (void)0 /* Modified: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/i386/include/pmap.h Sat Jun 16 18:56:19 2012 (r237168) @@ -498,6 +498,7 @@ extern vm_offset_t virtual_avail; extern vm_offset_t virtual_end; #define pmap_page_get_memattr(m) ((vm_memattr_t)(m)->md.pat_mode) +#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) #define pmap_unmapbios(va, sz) pmap_unmapdev((va), (sz)) /* Modified: head/sys/ia64/include/pmap.h ============================================================================== --- head/sys/ia64/include/pmap.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/ia64/include/pmap.h Sat Jun 16 18:56:19 2012 (r237168) @@ -118,6 +118,7 @@ extern int pmap_vhpt_log2size; #define pmap_page_get_memattr(m) ((m)->md.memattr) #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) +#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) #define pmap_mapbios(pa, sz) pmap_mapdev(pa, sz) #define pmap_unmapbios(va, sz) pmap_unmapdev(va, sz) Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/mips/include/pmap.h Sat Jun 16 18:56:19 2012 (r237168) @@ -151,6 +151,7 @@ extern vm_paddr_t dump_avail[PHYS_AVAIL_ #define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT #define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) +#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) #define pmap_page_set_memattr(m, ma) (void)0 void pmap_bootstrap(void); Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/powerpc/include/pmap.h Sat Jun 16 18:56:19 2012 (r237168) @@ -223,6 +223,8 @@ extern struct pmap kernel_pmap_store; #define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) #define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) +#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) + void pmap_bootstrap(vm_offset_t, vm_offset_t); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void pmap_kenter_attr(vm_offset_t va, vm_offset_t pa, vm_memattr_t); Modified: head/sys/sparc64/include/pmap.h ============================================================================== --- head/sys/sparc64/include/pmap.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/sparc64/include/pmap.h Sat Jun 16 18:56:19 2012 (r237168) @@ -80,6 +80,7 @@ struct pmap { #define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) #define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT +#define pmap_page_is_write_mapped(m) (((m)->aflags & PGA_WRITEABLE) != 0) #define pmap_page_set_memattr(m, ma) (void)0 void pmap_bootstrap(u_int cpu_impl); Modified: head/sys/vm/pmap.h ============================================================================== --- head/sys/vm/pmap.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/vm/pmap.h Sat Jun 16 18:56:19 2012 (r237168) @@ -80,10 +80,11 @@ struct pmap_statistics { typedef struct pmap_statistics *pmap_statistics_t; /* - * Each machine dependent implementation is expected to provide: + * Each machine-dependent implementation is required to provide: * * vm_memattr_t pmap_page_get_memattr(vm_page_t); * boolean_t pmap_page_is_mapped(vm_page_t); + * boolean_t pmap_page_is_write_mapped(vm_page_t); * void pmap_page_set_memattr(vm_page_t, vm_memattr_t); */ #include Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/vm/swap_pager.c Sat Jun 16 18:56:19 2012 (r237168) @@ -1593,7 +1593,7 @@ swp_pager_async_iodone(struct buf *bp) * status, then finish the I/O ( which decrements the * busy count and possibly wakes waiter's up ). */ - KASSERT((m->aflags & PGA_WRITEABLE) == 0, + KASSERT(!pmap_page_is_write_mapped(m), ("swp_pager_async_iodone: page %p is not write" " protected", m)); vm_page_undirty(m); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/vm/vm_page.c Sat Jun 16 18:56:19 2012 (r237168) @@ -930,7 +930,7 @@ vm_page_insert(vm_page_t m, vm_object_t * Since we are inserting a new and possibly dirty page, * update the object's OBJ_MIGHTBEDIRTY flag. */ - if (m->aflags & PGA_WRITEABLE) + if (pmap_page_is_write_mapped(m)) vm_object_set_writeable_dirty(object); } @@ -2675,11 +2675,11 @@ vm_page_clear_dirty_mask(vm_page_t m, vm /* * If the object is locked and the page is neither VPO_BUSY nor - * PGA_WRITEABLE, then the page's dirty field cannot possibly be + * write mapped, then the page's dirty field cannot possibly be * set by a concurrent pmap operation. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); - if ((m->oflags & VPO_BUSY) == 0 && (m->aflags & PGA_WRITEABLE) == 0) + if ((m->oflags & VPO_BUSY) == 0 && !pmap_page_is_write_mapped(m)) m->dirty &= ~pagebits; else { /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/vm/vm_page.h Sat Jun 16 18:56:19 2012 (r237168) @@ -237,20 +237,22 @@ extern struct vpglocks pa_lock[]; #endif #define vm_page_queue_free_mtx vm_page_queue_free_lock.data + /* * These are the flags defined for vm_page. * - * aflags are updated by atomic accesses. Use the vm_page_aflag_set() + * aflags are updated by atomic accesses. Use the vm_page_aflag_set() * and vm_page_aflag_clear() functions to set and clear the flags. * * PGA_REFERENCED may be cleared only if the object containing the page is - * locked. + * locked. It is set by both the MI and MD VM layers. * * PGA_WRITEABLE is set exclusively on managed pages by pmap_enter(). When it - * does so, the page must be VPO_BUSY. + * does so, the page must be VPO_BUSY. The MI VM layer must never access this + * flag directly. Instead, it should call pmap_page_is_write_mapped(). * * PGA_EXECUTABLE may be set by pmap routines, and indicates that a page has - * at least one executable mapping. It is not consumed by the VM layer. + * at least one executable mapping. It is not consumed by the MI VM layer. */ #define PGA_WRITEABLE 0x01 /* page may be mapped writeable */ #define PGA_REFERENCED 0x02 /* page has been referenced */ @@ -262,12 +264,12 @@ extern struct vpglocks pa_lock[]; */ #define PG_CACHED 0x01 /* page is cached */ #define PG_FREE 0x02 /* page is free */ -#define PG_FICTITIOUS 0x04 /* physical page doesn't exist (O) */ +#define PG_FICTITIOUS 0x04 /* physical page doesn't exist */ #define PG_ZERO 0x08 /* page is zeroed */ #define PG_MARKER 0x10 /* special queue marker page */ #define PG_SLAB 0x20 /* object pointer is actually a slab */ #define PG_WINATCFLS 0x40 /* flush dirty page on inactive q */ -#define PG_NODUMP 0x80 /* don't include this page in the dump */ +#define PG_NODUMP 0x80 /* don't include this page in a dump */ /* * Misc constants. Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/vm/vm_pageout.c Sat Jun 16 18:56:19 2012 (r237168) @@ -503,7 +503,7 @@ vm_pageout_flush(vm_page_t *mc, int coun vm_page_t mt = mc[i]; KASSERT(pageout_status[i] == VM_PAGER_PEND || - (mt->aflags & PGA_WRITEABLE) == 0, + !pmap_page_is_write_mapped(mt), ("vm_pageout_flush: page %p is not write protected", mt)); switch (pageout_status[i]) { case VM_PAGER_OK: @@ -899,7 +899,7 @@ rescan0: * be updated. */ if (m->dirty != VM_PAGE_BITS_ALL && - (m->aflags & PGA_WRITEABLE) != 0) { + pmap_page_is_write_mapped(m)) { /* * Avoid a race condition: Unless write access is * removed from the page, another processor could Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sat Jun 16 18:37:54 2012 (r237167) +++ head/sys/vm/vnode_pager.c Sat Jun 16 18:56:19 2012 (r237168) @@ -1146,7 +1146,7 @@ vnode_pager_generic_putpages(struct vnod m = ma[ncount - 1]; KASSERT(m->busy > 0, ("vnode_pager_generic_putpages: page %p is not busy", m)); - KASSERT((m->aflags & PGA_WRITEABLE) == 0, + KASSERT(!pmap_page_is_write_mapped(m), ("vnode_pager_generic_putpages: page %p is not read-only", m)); vm_page_clear_dirty(m, pgoff, PAGE_SIZE - pgoff); From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 20:49:09 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 550FC1065672; Sat, 16 Jun 2012 20:49:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4036C8FC08; Sat, 16 Jun 2012 20:49:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GKn97J065157; Sat, 16 Jun 2012 20:49:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GKn9U3065155; Sat, 16 Jun 2012 20:49:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201206162049.q5GKn9U3065155@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 Jun 2012 20:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237170 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 20:49:09 -0000 Author: kib Date: Sat Jun 16 20:49:08 2012 New Revision: 237170 URL: http://svn.freebsd.org/changeset/base/237170 Log: Fix build. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Jun 16 19:05:38 2012 (r237169) +++ head/sys/dev/ath/if_ath.c Sat Jun 16 20:49:08 2012 (r237170) @@ -663,7 +663,7 @@ ath_attach(u_int16_t devid, struct ath_s } device_printf(sc->sc_dev, "%s: sizeof(ath_buf) = %d bytes\n", - __func__, sizeof(struct ath_buf)); + __func__, (int)sizeof(struct ath_buf)); #ifdef ATH_ENABLE_11N /* From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 21:37:16 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4C6E1065677; Sat, 16 Jun 2012 21:37:16 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B61F88FC17; Sat, 16 Jun 2012 21:37:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GLbGCI067147; Sat, 16 Jun 2012 21:37:16 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GLbGfE067145; Sat, 16 Jun 2012 21:37:16 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206162137.q5GLbGfE067145@svn.freebsd.org> From: Adrian Chadd Date: Sat, 16 Jun 2012 21:37:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237171 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 21:37:16 -0000 Author: adrian Date: Sat Jun 16 21:37:15 2012 New Revision: 237171 URL: http://svn.freebsd.org/changeset/base/237171 Log: A few nitpicks: * Use ATH_RC_NUM instead of '4' when iterating over the ratecontrol series array. * A few style(9) fixes, hopefully no regressions here. * Add some comments that better describe what's going on. Modified: head/sys/dev/ath/if_ath_tx_ht.c Modified: head/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_ht.c Sat Jun 16 20:49:08 2012 (r237170) +++ head/sys/dev/ath/if_ath_tx_ht.c Sat Jun 16 21:37:15 2012 (r237171) @@ -96,9 +96,10 @@ __FBSDID("$FreeBSD$"); */ #define IEEE80211_AMPDU_SUBFRAME_DEFAULT 32 -#define ATH_AGGR_DELIM_SZ 4 /* delimiter size */ +#define ATH_AGGR_DELIM_SZ 4 /* delimiter size */ #define ATH_AGGR_MINPLEN 256 /* in bytes, minimum packet length */ -#define ATH_AGGR_ENCRYPTDELIM 10 /* number of delimiters for encryption padding */ +/* number of delimiters for encryption padding */ +#define ATH_AGGR_ENCRYPTDELIM 10 /* * returns delimiter padding required given the packet length @@ -414,7 +415,7 @@ ath_get_aggr_limit(struct ath_softc *sc, int amin = 65530; int i; - for (i = 0; i < 4; i++) { + for (i = 0; i < ATH_RC_NUM; i++) { if (bf->bf_state.bfs_rc[i].tries == 0) continue; amin = MIN(amin, bf->bf_state.bfs_rc[i].max4msframelen); @@ -465,7 +466,7 @@ ath_rateseries_setup(struct ath_softc *s * XXX fields. */ memset(series, 0, sizeof(HAL_11N_RATE_SERIES) * 4); - for (i = 0; i < 4; i++) { + for (i = 0; i < ATH_RC_NUM; i++) { /* Only set flags for actual TX attempts */ if (rc[i].tries == 0) continue; @@ -511,7 +512,10 @@ ath_rateseries_setup(struct ath_softc *s series[i].Rate = rt->info[rc[i].rix].rateCode; - /* PktDuration doesn't include slot, ACK, RTS, etc timing - it's just the packet duration */ + /* + * PktDuration doesn't include slot, ACK, RTS, etc timing - + * it's just the packet duration + */ if (series[i].Rate & IEEE80211_RATE_MCS) { series[i].PktDuration = ath_computedur_ht(pktlen @@ -531,11 +535,12 @@ ath_rateseries_setup(struct ath_softc *s #if 0 static void -ath_rateseries_print(HAL_11N_RATE_SERIES *series) +ath_rateseries_print(struct ath_softc *sc, HAL_11N_RATE_SERIES *series) { int i; - for (i = 0; i < 4; i++) { - printf("series %d: rate %x; tries %d; pktDuration %d; chSel %d; rateFlags %x\n", + for (i = 0; i < ATH_RC_NUM; i++) { + device_printf(sc->sc_dev ,"series %d: rate %x; tries %d; " + "pktDuration %d; chSel %d; rateFlags %x\n", i, series[i].Rate, series[i].Tries, @@ -580,19 +585,34 @@ ath_buf_set_rate(struct ath_softc *sc, s #if 0 printf("pktlen: %d; flags 0x%x\n", pktlen, flags); - ath_rateseries_print(series); + ath_rateseries_print(sc, series); #endif /* Set rate scenario */ + /* + * Note: Don't allow hardware to override the duration on + * ps-poll packets. + */ ath_hal_set11nratescenario(ah, ds, !is_pspoll, /* whether to override the duration or not */ - /* don't allow hardware to override the duration on ps-poll packets */ ctsrate, /* rts/cts rate */ series, /* 11n rate series */ 4, /* number of series */ flags); /* Setup the last descriptor in the chain */ + /* + * XXX Why is this done here, and not in the upper layer? + * The rate control code stores a copy of the RC info in + * the last descriptor as well as the first, then uses + * the shadow copy in the last descriptor to see what the RC + * decisions were. I'm not sure why; perhaps earlier hardware + * overwrote the first descriptor contents. + * + * In the 802.11n case, it also clears the moreaggr/delim + * fields. Again, this should be done by the caller of + * ath_buf_set_rate(). + */ ath_hal_setuplasttxdesc(ah, lastds, ds); /* Set burst duration */ @@ -628,8 +648,9 @@ ath_buf_set_rate(struct ath_softc *sc, s * descriptor setup, and ath_buf_set_rate() will configure the * rate control. * - * Note that the TID lock is only grabbed when dequeuing packets from - * the TID queue. If some code in another thread adds to the head of this + * The TID lock is required for the entirety of this function. + * + * If some code in another thread adds to the head of this * list, very strange behaviour will occur. Since retransmission is the * only reason this will occur, and this routine is designed to be called * from within the scheduler task, it won't ever clash with the completion @@ -639,8 +660,8 @@ ath_buf_set_rate(struct ath_softc *sc, s * dispatch aggregate frames to the hardware), please keep this in mind. */ ATH_AGGR_STATUS -ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an, struct ath_tid *tid, - ath_bufhead *bf_q) +ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an, + struct ath_tid *tid, ath_bufhead *bf_q) { //struct ieee80211_node *ni = &an->an_node; struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL; From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 21:39:01 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DE811065673; Sat, 16 Jun 2012 21:39:01 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26AAA8FC2B; Sat, 16 Jun 2012 21:39:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GLd1QO067247; Sat, 16 Jun 2012 21:39:01 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GLd0Ck067245; Sat, 16 Jun 2012 21:39:00 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201206162139.q5GLd0Ck067245@svn.freebsd.org> From: Attilio Rao Date: Sat, 16 Jun 2012 21:39:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237172 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 21:39:01 -0000 Author: attilio Date: Sat Jun 16 21:39:00 2012 New Revision: 237172 URL: http://svn.freebsd.org/changeset/base/237172 Log: Do a more targeted check on the page cache and avoid to check the cache pointer directly in vnode_pager_setsize() by using newly introduced vm_page_is_cached() function. Reviewed by: alc MFC after: 2 weeks X-MFC: r234039,234064 Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Sat Jun 16 21:37:15 2012 (r237171) +++ head/sys/vm/vnode_pager.c Sat Jun 16 21:39:00 2012 (r237172) @@ -440,7 +440,7 @@ vnode_pager_setsize(vp, nsize) */ vm_page_clear_dirty(m, base, PAGE_SIZE - base); } else if ((nsize & PAGE_MASK) && - __predict_false(object->cache != NULL)) { + vm_page_is_cached(object, OFF_TO_IDX(nsize))) { vm_page_cache_free(object, OFF_TO_IDX(nsize), nobjsize); } From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 22:26:46 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5FE4F106564A; Sat, 16 Jun 2012 22:26:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B0E48FC08; Sat, 16 Jun 2012 22:26:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GMQkS8069223; Sat, 16 Jun 2012 22:26:46 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GMQkQN069220; Sat, 16 Jun 2012 22:26:46 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206162226.q5GMQkQN069220@svn.freebsd.org> From: Adrian Chadd Date: Sat, 16 Jun 2012 22:26:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237173 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 22:26:46 -0000 Author: adrian Date: Sat Jun 16 22:26:45 2012 New Revision: 237173 URL: http://svn.freebsd.org/changeset/base/237173 Log: oops, remove this, it wasn't supposed to be committed. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_rx.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Jun 16 21:39:00 2012 (r237172) +++ head/sys/dev/ath/if_ath.c Sat Jun 16 22:26:45 2012 (r237173) @@ -662,9 +662,6 @@ ath_attach(u_int16_t devid, struct ath_s (void) ath_hal_settxchainmask(sc->sc_ah, tx_chainmask); } - device_printf(sc->sc_dev, "%s: sizeof(ath_buf) = %d bytes\n", - __func__, (int)sizeof(struct ath_buf)); - #ifdef ATH_ENABLE_11N /* * Query HT capabilities Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Sat Jun 16 21:39:00 2012 (r237172) +++ head/sys/dev/ath/if_ath_rx.c Sat Jun 16 22:26:45 2012 (r237173) @@ -637,6 +637,7 @@ rx_accept: } ifp->if_ipackets++; + ifp->if_ibytes += m->m_pkthdr.len; sc->sc_stats.ast_ant_rx[rs->rs_antenna]++; /* From owner-svn-src-all@FreeBSD.ORG Sat Jun 16 22:28:37 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8DBA01065674; Sat, 16 Jun 2012 22:28:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4C28FC12; Sat, 16 Jun 2012 22:28:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5GMSbjx069331; Sat, 16 Jun 2012 22:28:37 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5GMSbuc069329; Sat, 16 Jun 2012 22:28:37 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201206162228.q5GMSbuc069329@svn.freebsd.org> From: Adrian Chadd Date: Sat, 16 Jun 2012 22:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237174 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 22:28:37 -0000 Author: adrian Date: Sat Jun 16 22:28:36 2012 New Revision: 237174 URL: http://svn.freebsd.org/changeset/base/237174 Log: .. and this wasn't supposed to be in the previous commit either. Modified: head/sys/dev/ath/if_ath_rx.c Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Sat Jun 16 22:26:45 2012 (r237173) +++ head/sys/dev/ath/if_ath_rx.c Sat Jun 16 22:28:36 2012 (r237174) @@ -637,7 +637,6 @@ rx_accept: } ifp->if_ipackets++; - ifp->if_ibytes += m->m_pkthdr.len; sc->sc_stats.ast_ant_rx[rs->rs_antenna]++; /*