From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 02:12:50 2010 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 5A7D710656A8; Sun, 29 Aug 2010 02:12:50 +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 CFC0C8FC19; Sun, 29 Aug 2010 02:12:49 +0000 (UTC) Received: from c122-107-127-123.carlnfd1.nsw.optusnet.com.au (c122-107-127-123.carlnfd1.nsw.optusnet.com.au [122.107.127.123]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7T2Ckxh010528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 29 Aug 2010 12:12:47 +1000 Date: Sun, 29 Aug 2010 12:12:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Bruce Cran In-Reply-To: <201008281632.o7SGW18U036444@svn.freebsd.org> Message-ID: <20100829115717.G26978@delplex.bde.org> References: <201008281632.o7SGW18U036444@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: r211936 - in head: bin/test lib/libc/net lib/libc/stdio lib/libc/stdlib lib/libc/sys lib/libipx libexec/ypxfr sbin/ipfw secure/lib/libcrypto/man share/man/man4 share/man/man9 usr.sbin/I... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 02:12:50 -0000 On Sat, 28 Aug 2010, Bruce Cran wrote: > Log: > Fix incorrect usage of 'assure' and 'insure'. I think some of the `assure's are more correct than their replacement of `ensure'. The difference is subtle -- my small 1960's English dictionary starts by saying that both mean "make safe"; it gives the meaning "make certain to happen" only for `ensure', and this is usually the meaning that we want, but I read `assure' as saying a little more -- that we have done the ensuring and that clients cant trust us to have done it. At least in old drafts, both POSIX and C99 use both `assure' and `ensure', but never `insure'. C99 only has 3 `assure's so it is easier to analyze. I think 1 or 2 of them would be better as `ensure'. But C99 also uses `assuredly'. It would be strange if an assurance or satisfaction of an `assuredly' could not be done by `assure'ing it. Bruce From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 03:53:18 2010 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 6F39010656A5; Sun, 29 Aug 2010 03:53:18 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45C7D8FC1C; Sun, 29 Aug 2010 03:53:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7T3rIYE052010; Sun, 29 Aug 2010 03:53:18 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T3rIR5052008; Sun, 29 Aug 2010 03:53:18 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201008290353.o7T3rIR5052008@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 29 Aug 2010 03:53:18 +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: r211956 - stable/8/lib/libc/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: Sun, 29 Aug 2010 03:53:18 -0000 Author: ume Date: Sun Aug 29 03:53:17 2010 New Revision: 211956 URL: http://svn.freebsd.org/changeset/base/211956 Log: MFC r211340: Correct the return code from _dns_gethostby*() to correspond with h_errno. Modified: stable/8/lib/libc/net/gethostbydns.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/net/gethostbydns.c ============================================================================== --- stable/8/lib/libc/net/gethostbydns.c Sun Aug 29 02:51:17 2010 (r211955) +++ stable/8/lib/libc/net/gethostbydns.c Sun Aug 29 03:53:17 2010 (r211956) @@ -522,18 +522,26 @@ _dns_gethostbyname(void *rval, void *cb_ free(buf); dprintf("res_nsearch failed (%d)\n", n, statp); *h_errnop = statp->res_h_errno; - return (0); + return (NS_NOTFOUND); } else if (n > sizeof(buf->buf)) { free(buf); dprintf("static buffer is too small (%d)\n", n, statp); *h_errnop = statp->res_h_errno; - return (0); + return (NS_UNAVAIL); } error = gethostanswer(buf, n, name, type, &he, hed, statp); free(buf); if (error != 0) { *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + switch (statp->res_h_errno) { + case HOST_NOT_FOUND: + return (NS_NOTFOUND); + case TRY_AGAIN: + return (NS_TRYAGAIN); + default: + return (NS_UNAVAIL); + } + /*NOTREACHED*/ } if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { *errnop = errno; @@ -632,7 +640,15 @@ _dns_gethostbyaddr(void *rval, void *cb_ if (gethostanswer(buf, n, qbuf, T_PTR, &he, hed, statp) != 0) { free(buf); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); /* h_errno was set by gethostanswer() */ + switch (statp->res_h_errno) { + case HOST_NOT_FOUND: + return (NS_NOTFOUND); + case TRY_AGAIN: + return (NS_TRYAGAIN); + default: + return (NS_UNAVAIL); + } + /*NOTREACHED*/ } free(buf); #ifdef SUNSECURITY From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 03:55:39 2010 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 5CFBC10656B5; Sun, 29 Aug 2010 03:55:39 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DD3F8FC19; Sun, 29 Aug 2010 03:55:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7T3tdr0052116; Sun, 29 Aug 2010 03:55:39 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T3tdqn052114; Sun, 29 Aug 2010 03:55:39 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201008290355.o7T3tdqn052114@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 29 Aug 2010 03:55:39 +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: r211957 - stable/7/lib/libc/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: Sun, 29 Aug 2010 03:55:39 -0000 Author: ume Date: Sun Aug 29 03:55:39 2010 New Revision: 211957 URL: http://svn.freebsd.org/changeset/base/211957 Log: MFC r211340: Correct the return code from _dns_gethostby*() to correspond with h_errno. Modified: stable/7/lib/libc/net/gethostbydns.c Directory Properties: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/ (props changed) Modified: stable/7/lib/libc/net/gethostbydns.c ============================================================================== --- stable/7/lib/libc/net/gethostbydns.c Sun Aug 29 03:53:17 2010 (r211956) +++ stable/7/lib/libc/net/gethostbydns.c Sun Aug 29 03:55:39 2010 (r211957) @@ -522,18 +522,26 @@ _dns_gethostbyname(void *rval, void *cb_ free(buf); dprintf("res_nsearch failed (%d)\n", n, statp); *h_errnop = statp->res_h_errno; - return (0); + return (NS_NOTFOUND); } else if (n > sizeof(buf->buf)) { free(buf); dprintf("static buffer is too small (%d)\n", n, statp); *h_errnop = statp->res_h_errno; - return (0); + return (NS_UNAVAIL); } error = gethostanswer(buf, n, name, type, &he, hed, statp); free(buf); if (error != 0) { *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); + switch (statp->res_h_errno) { + case HOST_NOT_FOUND: + return (NS_NOTFOUND); + case TRY_AGAIN: + return (NS_TRYAGAIN); + default: + return (NS_UNAVAIL); + } + /*NOTREACHED*/ } if (__copy_hostent(&he, hptr, buffer, buflen) != 0) { *errnop = errno; @@ -632,7 +640,15 @@ _dns_gethostbyaddr(void *rval, void *cb_ if (gethostanswer(buf, n, qbuf, T_PTR, &he, hed, statp) != 0) { free(buf); *h_errnop = statp->res_h_errno; - return (NS_NOTFOUND); /* h_errno was set by gethostanswer() */ + switch (statp->res_h_errno) { + case HOST_NOT_FOUND: + return (NS_NOTFOUND); + case TRY_AGAIN: + return (NS_TRYAGAIN); + default: + return (NS_UNAVAIL); + } + /*NOTREACHED*/ } free(buf); #ifdef SUNSECURITY From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 05:39:21 2010 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 A1FE810656A3; Sun, 29 Aug 2010 05:39:21 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 922528FC14; Sun, 29 Aug 2010 05:39:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7T5dL1Y054119; Sun, 29 Aug 2010 05:39:21 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T5dL7T054116; Sun, 29 Aug 2010 05:39:21 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008290539.o7T5dL7T054116@svn.freebsd.org> From: "Jayachandran C." Date: Sun, 29 Aug 2010 05:39: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: r211958 - in head/sys/mips: include mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 05:39:21 -0000 Author: jchandra Date: Sun Aug 29 05:39:21 2010 New Revision: 211958 URL: http://svn.freebsd.org/changeset/base/211958 Log: Apply MIPS pmap clean up patch from alc@ (with minor change to KASSERT): PMAP_DIAGNOSTIC was eliminated from amd64/i386, and, in fact, the non-MIPS parts of the kernel, several years ago. Any of the interesting checks were turned into KASSERT()s. Basically, the motivation was that lots of people run with INVARIANTS but no one runs with DIAGNOSTIC. panic strings needn't and shouldn't have a terminating newline. Finally, there is one functional change. The sched_pin() in pmap_remove_pages() is an artifact of the way we temporarily map page table pages on i386. (The mappings are processor private. We don't do a system-wide shootdown.) It isn't needed by MIPS. Tested by: jchandra Submitted by: alc Modified: head/sys/mips/include/pmap.h head/sys/mips/mips/pmap.c Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Sun Aug 29 03:55:39 2010 (r211957) +++ head/sys/mips/include/pmap.h Sun Aug 29 05:39:21 2010 (r211958) @@ -126,11 +126,6 @@ typedef struct pv_entry { vm_page_t pv_ptem; /* VM page for pte */ } *pv_entry_t; - -#if defined(DIAGNOSTIC) -#define PMAP_DIAGNOSTIC -#endif - /* * physmem_desc[] is a superset of phys_avail[] and describes all the * memory present in the system. Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sun Aug 29 03:55:39 2010 (r211957) +++ head/sys/mips/mips/pmap.c Sun Aug 29 05:39:21 2010 (r211958) @@ -105,17 +105,13 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(DIAGNOSTIC) -#define PMAP_DIAGNOSTIC -#endif - #undef PMAP_DEBUG #ifndef PMAP_SHPGPERPROC #define PMAP_SHPGPERPROC 200 #endif -#if !defined(PMAP_DIAGNOSTIC) +#if !defined(DIAGNOSTIC) #define PMAP_INLINE __inline #else #define PMAP_INLINE @@ -635,22 +631,6 @@ pmap_init(void) * Low level helper routines..... ***************************************************/ -#if defined(PMAP_DIAGNOSTIC) - -/* - * This code checks for non-writeable/modified pages. - * This should be an invalid condition. - */ -static int -pmap_nw_modified(pt_entry_t pte) -{ - if ((pte & (PTE_D | PTE_RO)) == (PTE_D | PTE_RO)) - return (1); - else - return (0); -} -#endif - static __inline void pmap_invalidate_all_local(pmap_t pmap) { @@ -1598,13 +1578,9 @@ pmap_remove_pte(struct pmap *pmap, pt_en if (page_is_managed(pa)) { m = PHYS_TO_VM_PAGE(pa); if (pte_test(&oldpte, PTE_D)) { -#if defined(PMAP_DIAGNOSTIC) - if (pmap_nw_modified(oldpte)) { - printf( - "pmap_remove: modified page not writable: va: 0x%x, pte: 0x%x\n", - va, oldpte); - } -#endif + KASSERT(!pte_test(&oldpte, PTE_RO), + ("%s: modified page not writable: va: %p, pte: 0x%x", + __func__, (void *)va, oldpte)); vm_page_dirty(m); } if (m->md.pv_flags & PV_TABLE_REF) @@ -1761,13 +1737,9 @@ pmap_remove_all(vm_page_t m) * Update the vm_page_t clean and reference bits. */ if (pte_test(&tpte, PTE_D)) { -#if defined(PMAP_DIAGNOSTIC) - if (pmap_nw_modified(tpte)) { - printf( - "pmap_remove_all: modified page not writable: va: 0x%x, pte: 0x%x\n", - pv->pv_va, tpte); - } -#endif + KASSERT(!pte_test(&tpte, PTE_RO), + ("%s: modified page not writable: va: %p, pte: 0x%x", + __func__, (void *)pv->pv_va, tpte)); vm_page_dirty(m); } pmap_invalidate_page(pv->pv_pmap, pv->pv_va); @@ -1908,7 +1880,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, * Page Directory table entry not valid, we need a new PT page */ if (pte == NULL) { - panic("pmap_enter: invalid page directory, pdir=%p, va=%p\n", + panic("pmap_enter: invalid page directory, pdir=%p, va=%p", (void *)pmap->pm_segtab, (void *)va); } pa = VM_PAGE_TO_PHYS(m); @@ -1931,13 +1903,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, else if (!wired && pte_test(&origpte, PTE_W)) pmap->pm_stats.wired_count--; -#if defined(PMAP_DIAGNOSTIC) - if (pmap_nw_modified(origpte)) { - printf( - "pmap_enter: modified page not writable: va: 0x%x, pte: 0x%x\n", - va, origpte); - } -#endif + KASSERT(!pte_test(&origpte, PTE_D | PTE_RO), + ("%s: modified page not writable: va: %p, pte: 0x%x", + __func__, (void *)va, origpte)); /* * Remove extra pte reference @@ -2529,13 +2497,11 @@ pmap_remove_pages(pmap_t pmap) } vm_page_lock_queues(); PMAP_LOCK(pmap); - sched_pin(); - //XXX need to be TAILQ_FOREACH_SAFE ? - for (pv = TAILQ_FIRST(&pmap->pm_pvlist); pv; pv = npv) { + for (pv = TAILQ_FIRST(&pmap->pm_pvlist); pv != NULL; pv = npv) { pte = pmap_pte(pv->pv_pmap, pv->pv_va); if (!pte_test(pte, PTE_V)) - panic("pmap_remove_pages: page on pm_pvlist has no pte\n"); + panic("pmap_remove_pages: page on pm_pvlist has no pte"); tpte = *pte; /* @@ -2570,7 +2536,6 @@ pmap_remove_pages(pmap_t pmap) pmap_unuse_pt(pv->pv_pmap, pv->pv_va, pv->pv_ptem); free_pv_entry(pv); } - sched_unpin(); pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap); vm_page_unlock_queues(); @@ -2596,12 +2561,6 @@ pmap_testbit(vm_page_t m, int bit) mtx_assert(&vm_page_queue_mtx, MA_OWNED); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { -#if defined(PMAP_DIAGNOSTIC) - if (!pv->pv_pmap) { - printf("Null pmap (tb) at va: 0x%x\n", pv->pv_va); - continue; - } -#endif PMAP_LOCK(pv->pv_pmap); pte = pmap_pte(pv->pv_pmap, pv->pv_va); rv = pte_test(pte, bit); @@ -2630,13 +2589,6 @@ pmap_changebit(vm_page_t m, int bit, boo * setting RO do we need to clear the VAC? */ TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { -#if defined(PMAP_DIAGNOSTIC) - if (!pv->pv_pmap) { - printf("Null pmap (cb) at va: 0x%x\n", pv->pv_va); - continue; - } -#endif - PMAP_LOCK(pv->pv_pmap); pte = pmap_pte(pv->pv_pmap, pv->pv_va); if (setem) { @@ -2723,7 +2675,7 @@ pmap_remove_write(vm_page_t m) npv = TAILQ_NEXT(pv, pv_plist); pte = pmap_pte(pv->pv_pmap, pv->pv_va); if (pte == NULL || !pte_test(pte, PTE_V)) - panic("page on pm_pvlist has no pte\n"); + panic("page on pm_pvlist has no pte"); va = pv->pv_va; pmap_protect(pv->pv_pmap, va, va + PAGE_SIZE, From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 08:06:13 2010 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 6E71A10656A5; Sun, 29 Aug 2010 08:06:13 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (brucec-2-pt.tunnel.tserv5.lon1.ipv6.he.net [IPv6:2001:470:1f08:679::2]) by mx1.freebsd.org (Postfix) with ESMTP id 14ACA8FC0C; Sun, 29 Aug 2010 08:06:13 +0000 (UTC) Received: from unknown (client-82-31-24-1.midd.adsl.virginmedia.com [82.31.24.1]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA id 74A6E5F15; Sun, 29 Aug 2010 08:06:06 +0000 (UTC) Date: Sun, 29 Aug 2010 09:06:07 +0100 From: Bruce Cran To: Bruce Evans Message-ID: <20100829090607.00007cef@unknown> In-Reply-To: <20100829115717.G26978@delplex.bde.org> References: <201008281632.o7SGW18U036444@svn.freebsd.org> <20100829115717.G26978@delplex.bde.org> X-Mailer: Claws Mail 3.7.4cvs1 (GTK+ 2.16.0; i586-pc-mingw32msvc) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Cran Subject: Re: svn commit: r211936 - in head: bin/test lib/libc/net lib/libc/stdio lib/libc/stdlib lib/libc/sys lib/libipx libexec/ypxfr sbin/ipfw secure/lib/libcrypto/man share/man/man4 share/man/man9 usr.sbin/I... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 08:06:13 -0000 On Sun, 29 Aug 2010 12:12:46 +1000 (EST) Bruce Evans wrote: > On Sat, 28 Aug 2010, Bruce Cran wrote: > > > Log: > > Fix incorrect usage of 'assure' and 'insure'. > > I think some of the `assure's are more correct than their replacement > of `ensure'. The difference is subtle -- my small 1960's English > dictionary starts by saying that both mean "make safe"; it gives > the meaning "make certain to happen" only for `ensure', and this is > usually the meaning that we want, but I read `assure' as saying a > little more -- that we have done the ensuring and that clients cant > trust us to have done it. > > At least in old drafts, both POSIX and C99 use both `assure' and > `ensure', but never `insure'. C99 only has 3 `assure's so it is > easier to analyze. I think 1 or 2 of them would be better as > `ensure'. But C99 also uses `assuredly'. It would be strange if an > assurance or satisfaction of an `assuredly' could not be done by > `assure'ing it. After talking with other people I can see that quite a few probably were correct - for example "assure a degree of consistency". Should all the assure -> ensure changes be reverted? -- Bruce Cran From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 08:10:35 2010 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 DDAA41065695; Sun, 29 Aug 2010 08:10:34 +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 CE9468FC13; Sun, 29 Aug 2010 08:10:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7T8AYN3057192; Sun, 29 Aug 2010 08:10:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T8AY2p057190; Sun, 29 Aug 2010 08:10:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008290810.o7T8AY2p057190@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 29 Aug 2010 08:10:34 +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: r211959 - stable/8/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: Sun, 29 Aug 2010 08:10:35 -0000 Author: kib Date: Sun Aug 29 08:10:34 2010 New Revision: 211959 URL: http://svn.freebsd.org/changeset/base/211959 Log: MFC r211335: Add convenience defines for hidden and default/exported attributes. MFC r211741: Use preferred spelling for the __attribute__. MFC r211868: Use private namespace for visibility keyword. Modified: stable/8/sys/sys/cdefs.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/sys/cdefs.h ============================================================================== --- stable/8/sys/sys/cdefs.h Sun Aug 29 05:39:21 2010 (r211958) +++ stable/8/sys/sys/cdefs.h Sun Aug 29 08:10:34 2010 (r211959) @@ -311,6 +311,14 @@ #define __predict_false(exp) (exp) #endif +#if __GNUC_PREREQ__(4, 2) +#define __hidden __attribute__((__visibility__("hidden"))) +#define __exported __attribute__((__visibility__("default"))) +#else +#define __hidden +#define __exported +#endif + /* * We define this here since , , and * require it. From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 08:15:58 2010 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 25FB41065696; Sun, 29 Aug 2010 08:15:58 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1683F8FC08; Sun, 29 Aug 2010 08:15:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7T8FvZx057423; Sun, 29 Aug 2010 08:15:57 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T8FvCN057421; Sun, 29 Aug 2010 08:15:57 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201008290815.o7T8FvCN057421@svn.freebsd.org> From: David Xu Date: Sun, 29 Aug 2010 08:15:57 +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: r211960 - stable/8/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 08:15:58 -0000 Author: davidxu Date: Sun Aug 29 08:15:57 2010 New Revision: 211960 URL: http://svn.freebsd.org/changeset/base/211960 Log: MFC r211833: Decrease rdlock count only when thread unlocked a reader lock. Modified: stable/8/lib/libthr/thread/thr_rtld.c Modified: stable/8/lib/libthr/thread/thr_rtld.c ============================================================================== --- stable/8/lib/libthr/thread/thr_rtld.c Sun Aug 29 08:10:34 2010 (r211959) +++ stable/8/lib/libthr/thread/thr_rtld.c Sun Aug 29 08:15:57 2010 (r211960) @@ -149,8 +149,8 @@ _thr_rtld_lock_release(void *lock) state = l->lock.rw_state; if (_thr_rwlock_unlock(&l->lock) == 0) { - curthread->rdlock_count--; if ((state & URWLOCK_WRITE_OWNER) == 0) { + curthread->rdlock_count--; THR_CRITICAL_LEAVE(curthread); } else { _thr_signal_unblock(curthread); From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 08:19:08 2010 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 3AE5B10656AB; Sun, 29 Aug 2010 08:19:08 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BC2C8FC15; Sun, 29 Aug 2010 08:19:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7T8J8bO057521; Sun, 29 Aug 2010 08:19:08 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7T8J8Nx057520; Sun, 29 Aug 2010 08:19:08 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201008290819.o7T8J8Nx057520@svn.freebsd.org> From: David Xu Date: Sun, 29 Aug 2010 08:19:08 +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: r211961 - stable/8/lib/libthr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 08:19:08 -0000 Author: davidxu Date: Sun Aug 29 08:19:07 2010 New Revision: 211961 URL: http://svn.freebsd.org/changeset/base/211961 Log: Record merge info for r211960. -This line, and those below, will be ignored-- > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. _M libthr Modified: Directory Properties: stable/8/lib/libthr/ (props changed) From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 11:32:41 2010 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 741FC106567A; Sun, 29 Aug 2010 11:32:41 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A6A08FC12; Sun, 29 Aug 2010 11:32:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TBWfae062853; Sun, 29 Aug 2010 11:32:41 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TBWfih062851; Sun, 29 Aug 2010 11:32:41 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201008291132.o7TBWfih062851@svn.freebsd.org> From: Ulrich Spoerlein Date: Sun, 29 Aug 2010 11:32:41 +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: r211962 - head/sbin/geom/class/sched X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 11:32:41 -0000 Author: uqs Date: Sun Aug 29 11:32:41 2010 New Revision: 211962 URL: http://svn.freebsd.org/changeset/base/211962 Log: gsched(8): fix example usage, mdoc nits - ad0 was referred to as da0 - wrong parameter -s instead of -a in example - use double quotes consistently PR: docs/150082 Submitted by: N.J. Mann MFC after: 2 weeks Modified: head/sbin/geom/class/sched/gsched.8 Modified: head/sbin/geom/class/sched/gsched.8 ============================================================================== --- head/sbin/geom/class/sched/gsched.8 Sun Aug 29 08:19:07 2010 (r211961) +++ head/sbin/geom/class/sched/gsched.8 Sun Aug 29 11:32:41 2010 (r211962) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 12, 2010 +.Dd August 29, 2010 .Dt GSCHED 8 .Os .Sh NAME @@ -92,7 +92,7 @@ which in turn forwards requests to the e This operation allows one to start/stop a scheduling service on an already existing provider. .Pp -A subsequent 'destroy' will remove the newly created geom and +A subsequent "destroy" will remove the newly created geom and hook the provider back to the original geom. .It Cm configure Configure existing scheduling provider. It supports the same options @@ -135,16 +135,16 @@ maximum amount of debug information is p Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES The following example shows how to create a scheduling provider for disk -.Pa /dev/da0 -, and how to destroy it. +.Pa /dev/ad0 , +and how to destroy it. .Bd -literal -offset indent # Load the geom_sched module: kldload geom_sched # Load some scheduler classes used by geom_sched: kldload gsched_rr gsched_as -# Configure device ad0 to use scheduler 'rr': -geom sched insert -s rr ad0 -# Now provider ad0 uses the 'rr' algorithm; +# Configure device ad0 to use scheduler "rr": +geom sched insert -a rr ad0 +# Now provider ad0 uses the "rr" algorithm; # the new geom is ad0.sched. # Remove the scheduler on the device: geom sched destroy -v ad0.sched. From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 11:56:56 2010 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 A157C106566B; Sun, 29 Aug 2010 11:56:56 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 914018FC19; Sun, 29 Aug 2010 11:56:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TBuurk063402; Sun, 29 Aug 2010 11:56:56 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TBuu9B063397; Sun, 29 Aug 2010 11:56:56 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201008291156.o7TBuu9B063397@svn.freebsd.org> From: Brian Somers Date: Sun, 29 Aug 2010 11:56: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: r211963 - in head: bin/pax tools/regression/bin/pax X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 11:56:56 -0000 Author: brian Date: Sun Aug 29 11:56:56 2010 New Revision: 211963 URL: http://svn.freebsd.org/changeset/base/211963 Log: Correct an out-by-one error when earlying out ustar filenames that are too long. Filenames escaping this test are caught later on, so the bug doesn't cause any breakage. Document the correct ustar limitations in pax. As I have no access to the IEEE 1003.2 spec, I can only assume that the limitations imposed are in fact correct. Add regression tests for the filename limitations imposed by pax. MFC after: 3 weeks Added: head/tools/regression/bin/pax/ head/tools/regression/bin/pax/Makefile (contents, props changed) head/tools/regression/bin/pax/regress.t (contents, props changed) Modified: head/bin/pax/pax.1 head/bin/pax/tar.c Modified: head/bin/pax/pax.1 ============================================================================== --- head/bin/pax/pax.1 Sun Aug 29 11:32:41 2010 (r211962) +++ head/bin/pax/pax.1 Sun Aug 29 11:56:56 2010 (r211963) @@ -748,7 +748,9 @@ The extended tar interchange format spec .St -p1003.2 standard. The default blocksize for this format is 10240 bytes. -Pathnames stored by this format must be 250 characters or less in length. +Pathnames stored by this format must be 255 characters or less in length. +The directory part may be at most 155 characters and each path component +must be less than 100 characters. .El .Pp The Modified: head/bin/pax/tar.c ============================================================================== --- head/bin/pax/tar.c Sun Aug 29 11:32:41 2010 (r211962) +++ head/bin/pax/tar.c Sun Aug 29 11:56:56 2010 (r211963) @@ -1086,7 +1086,7 @@ name_split(char *name, int len) */ if (len <= TNMSZ) return(name); - if (len > (TPFSZ + TNMSZ + 1)) + if (len > TPFSZ + TNMSZ) return(NULL); /* Added: head/tools/regression/bin/pax/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/pax/Makefile Sun Aug 29 11:56:56 2010 (r211963) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +test: + prove -vmw regress.t + +clean: + rm -rf ustar-pathnames-[12] + rm -f ustar.ok ustar.fail* Added: head/tools/regression/bin/pax/regress.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/pax/regress.t Sun Aug 29 11:56:56 2010 (r211963) @@ -0,0 +1,91 @@ +#! /usr/bin/perl +# +# $FreeBSD$ + +use strict; +use warnings; + +use Test::More tests => 6; +use File::Path qw(rmtree mkpath); +use Cwd; + +my $n = 0; +sub create_file { + my $fn = shift; + + $n++; + (my $dir = $fn) =~ s,/[^/]+$,,; + mkpath $dir; + open my $fd, ">", $fn or die "$fn: $!"; + print $fd "file $n\n"; +} + + +ustar_pathnames: { SKIP: { + # Prove that pax breaks up ustar pathnames properly + + my $top = getcwd . "/ustar-pathnames-1"; + skip "Current path is too long", 6 if length $top > 92; + rmtree $top; + my $subdir = "x" . "x" x (92 - length $top); + my $work94 = "$top/$subdir"; + mkpath $work94; # $work is 94 characters long + + my $x49 = "x" x 49; + my $x50 = "x" x 50; + my $x60 = "x" x 60; + my $x95 = "x" x 95; + + my @paths = ( + "$work94/x099", # 99 chars + "$work94/xx100", # 100 chars + "$work94/xxx101", # 101 chars + "$work94/$x49/${x50}x199", # 199 chars + "$work94/$x49/${x50}xx200", # 200 chars + "$work94/$x49/${x50}xxx201", # 201 chars + "$work94/$x60/${x95}254", # 254 chars + "$work94/$x60/${x95}x255", # 255 chars + ); + + my @l = map { length } @paths; + + my $n = 0; + create_file $_ for @paths; + system "pax -wf ustar.ok $work94"; + ok($? == 0, "Wrote 'ustar.ok' containing files with lengths @l"); + + (my $orig = $top) =~ s,1$,2,; + rmtree $orig; + rename $top, $orig; + + system "pax -rf ustar.ok"; + ok($? == 0, "Restored 'ustar.ok' containing files with lengths @l"); + + system "diff -ru $orig $top"; + ok($? == 0, "Restored files are identical"); + + rmtree $top; + rename $orig, $top; + + # 256 chars (with components < 100 chars) should not work + push @paths, "$work94/x$x60/${x95}x256"; # 256 chars + push @l, length $paths[-1]; + create_file $paths[-1]; + system "pax -wf ustar.fail1 $work94"; + ok($?, "Failed to write 'ustar.fail1' containing files with lengths @l"); + + # Components with 100 chars shouldn't work + unlink $paths[-1]; + $paths[-1] = "$work94/${x95}xc100"; # 100 char filename + $l[-1] = length $paths[-1]; + create_file $paths[-1]; + system "pax -wf ustar.fail2 $work94"; + ok($?, "Failed to write 'ustar.fail2' with a 100 char filename"); + + unlink $paths[-1]; + $paths[-1] = "$work94/${x95}xc100/x"; # 100 char component + $l[-1] = length $paths[-1]; + create_file $paths[-1]; + system "pax -wf ustar.fail3 $work94"; + ok($?, "Failed to write 'ustar.fail3' with a 100 char component"); +}} From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 12:14:53 2010 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 EC4C51065693; Sun, 29 Aug 2010 12:14:53 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCFD08FC13; Sun, 29 Aug 2010 12:14:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TCErJJ063818; Sun, 29 Aug 2010 12:14:53 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TCEr5D063815; Sun, 29 Aug 2010 12:14:53 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201008291214.o7TCEr5D063815@svn.freebsd.org> From: Brian Somers Date: Sun, 29 Aug 2010 12: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: r211964 - in head/tools/regression/bin: . pax X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 12:14:54 -0000 Author: brian Date: Sun Aug 29 12:14:53 2010 New Revision: 211964 URL: http://svn.freebsd.org/changeset/base/211964 Log: Add a Makefile for tools/regression/bin and support 'all' in pax/Makefile. MFC after: 3 weeks Added: head/tools/regression/bin/Makefile (contents, props changed) Modified: head/tools/regression/bin/pax/Makefile Added: head/tools/regression/bin/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/Makefile Sun Aug 29 12:14:53 2010 (r211964) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= date mv pax sh + +.include Modified: head/tools/regression/bin/pax/Makefile ============================================================================== --- head/tools/regression/bin/pax/Makefile Sun Aug 29 11:56:56 2010 (r211963) +++ head/tools/regression/bin/pax/Makefile Sun Aug 29 12:14:53 2010 (r211964) @@ -1,6 +1,6 @@ # $FreeBSD$ -test: +all test: prove -vmw regress.t clean: From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 12:17:17 2010 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 39E34106566C; Sun, 29 Aug 2010 12:17:16 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAAAA8FC14; Sun, 29 Aug 2010 12:17:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TCHGGq063901; Sun, 29 Aug 2010 12:17:16 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TCHGYt063899; Sun, 29 Aug 2010 12:17:16 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201008291217.o7TCHGYt063899@svn.freebsd.org> From: Brian Somers Date: Sun, 29 Aug 2010 12:17: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: r211965 - head/bin/pax X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 12:17:17 -0000 Author: brian Date: Sun Aug 29 12:17:16 2010 New Revision: 211965 URL: http://svn.freebsd.org/changeset/base/211965 Log: Touch the man page date after updating the ustar limitations. MFC after: 3 weeks Modified: head/bin/pax/pax.1 Modified: head/bin/pax/pax.1 ============================================================================== --- head/bin/pax/pax.1 Sun Aug 29 12:14:53 2010 (r211964) +++ head/bin/pax/pax.1 Sun Aug 29 12:17:16 2010 (r211965) @@ -33,7 +33,7 @@ .\" @(#)pax.1 8.4 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd July 3, 2004 +.Dd August 29, 2010 .Dt PAX 1 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 16:38:08 2010 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 DC47010656A9; Sun, 29 Aug 2010 16:38:08 +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 CCF1B8FC1B; Sun, 29 Aug 2010 16:38:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TGc8Xe069134; Sun, 29 Aug 2010 16:38:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TGc8J9069132; Sun, 29 Aug 2010 16:38:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008291638.o7TGc8J9069132@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 29 Aug 2010 16:38: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: r211966 - 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, 29 Aug 2010 16:38:09 -0000 Author: kib Date: Sun Aug 29 16:38:08 2010 New Revision: 211966 URL: http://svn.freebsd.org/changeset/base/211966 Log: Use NULL instead of 0 for pointer in example. MFC after: 3 days Modified: head/lib/libc/sys/sigaltstack.2 Modified: head/lib/libc/sys/sigaltstack.2 ============================================================================== --- head/lib/libc/sys/sigaltstack.2 Sun Aug 29 12:17:16 2010 (r211965) +++ head/lib/libc/sys/sigaltstack.2 Sun Aug 29 16:38:08 2010 (r211966) @@ -104,7 +104,7 @@ if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == /* error return */ sigstk.ss_size = SIGSTKSZ; sigstk.ss_flags = 0; -if (sigaltstack(&sigstk,0) < 0) +if (sigaltstack(&sigstk, NULL) < 0) perror("sigaltstack"); .Ed An alternative approach is provided for programs with signal handlers From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 18:17:38 2010 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 6C4D510656B8; Sun, 29 Aug 2010 18:17:38 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C2E78FC15; Sun, 29 Aug 2010 18:17:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TIHccl070981; Sun, 29 Aug 2010 18:17:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TIHcT5070979; Sun, 29 Aug 2010 18:17:38 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008291817.o7TIHcT5070979@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 29 Aug 2010 18:17: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: r211967 - head/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: Sun, 29 Aug 2010 18:17:38 -0000 Author: nwhitehorn Date: Sun Aug 29 18:17:38 2010 New Revision: 211967 URL: http://svn.freebsd.org/changeset/base/211967 Log: Avoid a race in the allocation of new segment IDs that could result in memory corruption on heavily loaded SMP systems. MFC after: 2 weeks Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sun Aug 29 16:38:08 2010 (r211966) +++ head/sys/powerpc/aim/mmu_oea64.c Sun Aug 29 18:17:38 2010 (r211967) @@ -285,6 +285,7 @@ extern void bs_remap_earlyboot(void); * Lock for the pteg and pvo tables. */ struct mtx moea64_table_mutex; +struct mtx moea64_slb_mutex; /* * PTEG data. @@ -1068,6 +1069,7 @@ moea64_bootstrap(mmu_t mmup, vm_offset_t */ mtx_init(&moea64_table_mutex, "pmap table", NULL, MTX_DEF | MTX_RECURSE); + mtx_init(&moea64_slb_mutex, "SLB table", NULL, MTX_DEF); /* * Initialize the TLBIE lock. TLBIE can only be executed by one CPU. @@ -2054,6 +2056,7 @@ moea64_get_unique_vsid(void) { entropy = 0; __asm __volatile("mftb %0" : "=r"(entropy)); + mtx_lock(&moea64_slb_mutex); for (i = 0; i < NVSIDS; i += VSID_NBPW) { u_int n; @@ -2083,9 +2086,11 @@ moea64_get_unique_vsid(void) { hash |= i; } moea64_vsid_bitmap[n] |= mask; + mtx_unlock(&moea64_slb_mutex); return (hash); } + mtx_unlock(&moea64_slb_mutex); panic("%s: out of segments",__func__); } From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 18:50:30 2010 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 69A0110656A5; Sun, 29 Aug 2010 18:50:30 +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 5844A8FC08; Sun, 29 Aug 2010 18:50:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TIoUsU071683; Sun, 29 Aug 2010 18:50:30 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TIoUQt071674; Sun, 29 Aug 2010 18:50:30 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201008291850.o7TIoUQt071674@svn.freebsd.org> From: Michael Tuexen Date: Sun, 29 Aug 2010 18:50: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: r211969 - 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: Sun, 29 Aug 2010 18:50:30 -0000 Author: tuexen Date: Sun Aug 29 18:50:30 2010 New Revision: 211969 URL: http://svn.freebsd.org/changeset/base/211969 Log: Fix the the SCTP_WITH_NO_CSUM option when used in combination with interface supporting CRC offload. While at it, make use of the feature that the loopback interface provides CRC offloading. MFC after: 4 weeks Modified: head/sys/netinet/sctp_crc32.c head/sys/netinet/sctp_crc32.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_crc32.c ============================================================================== --- head/sys/netinet/sctp_crc32.c Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_crc32.c Sun Aug 29 18:50:30 2010 (r211969) @@ -115,20 +115,15 @@ sctp_calculate_cksum(struct mbuf *m, uin return (base); } -#else - -uint32_t -sctp_calculate_cksum(struct mbuf *m, uint32_t offset) -{ - return (0); -} - #endif /* !defined(SCTP_WITH_NO_CSUM) */ void sctp_delayed_cksum(struct mbuf *m, uint32_t offset) { +#if defined(SCTP_WITH_NO_CSUM) + panic("sctp_delayed_cksum() called when using no SCTP CRC."); +#else struct ip *ip; uint32_t checksum; @@ -149,4 +144,5 @@ sctp_delayed_cksum(struct mbuf *m, uint3 return; } *(uint32_t *) (m->m_data + offset) = checksum; +#endif } Modified: head/sys/netinet/sctp_crc32.h ============================================================================== --- head/sys/netinet/sctp_crc32.h Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_crc32.h Sun Aug 29 18:50:30 2010 (r211969) @@ -36,11 +36,12 @@ __FBSDID("$FreeBSD$"); #ifndef __crc32c_h__ #define __crc32c_h__ -#if defined(_KERNEL) || defined(__Userspace__) - +#if defined(_KERNEL) +#if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t); + +#endif void sctp_delayed_cksum(struct mbuf *, uint32_t offset); #endif /* _KERNEL */ - #endif /* __crc32c_h__ */ Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_input.c Sun Aug 29 18:50:30 2010 (r211969) @@ -3068,7 +3068,7 @@ process_chunk_drop(struct sctp_tcb *stcb struct sctp_nets *net, uint8_t flg) { switch (desc->chunk_type) { - case SCTP_DATA: + case SCTP_DATA: /* find the tsn to resend (possibly */ { uint32_t tsn; @@ -5717,14 +5717,17 @@ sctp_input_with_port(struct mbuf *i_pak, struct ip *ip; struct sctphdr *sh; struct sctp_inpcb *inp = NULL; - - uint32_t check, calc_check; struct sctp_nets *net; struct sctp_tcb *stcb = NULL; struct sctp_chunkhdr *ch; int refcount_up = 0; int length, mlen, offset; +#if !defined(SCTP_WITH_NO_CSUM) + uint32_t check, calc_check; + +#endif + if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) { SCTP_RELEASE_PKT(i_pak); return; @@ -5799,18 +5802,14 @@ sctp_input_with_port(struct mbuf *i_pak, m->m_pkthdr.len, if_name(m->m_pkthdr.rcvif), m->m_pkthdr.csum_flags); +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_recvnocrc); +#else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); goto sctp_skip_csum_4; } check = sh->checksum; /* save incoming checksum */ - if ((check == 0) && (SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback)) && - ((ip->ip_src.s_addr == ip->ip_dst.s_addr) || - (SCTP_IS_IT_LOOPBACK(m))) - ) { - SCTP_STAT_INCR(sctps_recvnocrc); - goto sctp_skip_csum_4; - } sh->checksum = 0; /* prepare for calc */ calc_check = sctp_calculate_cksum(m, iphlen); sh->checksum = check; @@ -5840,6 +5839,7 @@ sctp_input_with_port(struct mbuf *i_pak, goto bad; } sctp_skip_csum_4: +#endif /* destination port of 0 is illegal, based on RFC2960. */ if (sh->dest_port == 0) { SCTP_STAT_INCR(sctps_hdrops); Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_os_bsd.h Sun Aug 29 18:50:30 2010 (r211969) @@ -433,20 +433,21 @@ typedef struct rtentry sctp_rtentry_t; */ #define SCTP_IP_OUTPUT(result, o_pak, ro, stcb, vrf_id) \ { \ - int o_flgs = 0; \ - if (stcb && stcb->sctp_ep && stcb->sctp_ep->sctp_socket) { \ - o_flgs = IP_RAWOUTPUT | (stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE); \ - } else { \ - o_flgs = IP_RAWOUTPUT; \ - } \ + int o_flgs = IP_RAWOUTPUT; \ + struct sctp_tcb *local_stcb = stcb; \ + if (local_stcb && \ + local_stcb->sctp_ep && \ + local_stcb->sctp_ep->sctp_socket) \ + o_flgs |= local_stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE; \ result = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \ } #define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, stcb, vrf_id) \ { \ - if (stcb && stcb->sctp_ep) \ + struct sctp_tcb *local_stcb = stcb; \ + if (local_stcb && local_stcb->sctp_ep) \ result = ip6_output(o_pak, \ - ((struct in6pcb *)(stcb->sctp_ep))->in6p_outputopts, \ + ((struct in6pcb *)(local_stcb->sctp_ep))->in6p_outputopts, \ (ro), 0, 0, ifp, NULL); \ else \ result = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \ Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_output.c Sun Aug 29 18:50:30 2010 (r211969) @@ -3741,6 +3741,9 @@ sctp_lowlevel_chunk_output(struct sctp_i #endif SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && (stcb) && (stcb->asoc.loopback_scope))) { @@ -3749,17 +3752,16 @@ sctp_lowlevel_chunk_output(struct sctp_i } else { SCTP_STAT_INCR(sctps_sendnocrc); } +#endif SCTP_ENABLE_UDP_CSUM(o_pak); } else { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - m->m_pkthdr.csum_flags = CSUM_SCTP; - m->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else + m->m_pkthdr.csum_flags = CSUM_SCTP; + m->m_pkthdr.csum_data = 0; + SCTP_STAT_INCR(sctps_sendhwcrc); +#endif } /* send it out. table id is taken from stcb */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -4051,6 +4053,9 @@ sctp_lowlevel_chunk_output(struct sctp_i #endif SCTP_ATTACH_CHAIN(o_pak, m, packet_length); if (port) { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && (stcb) && (stcb->asoc.loopback_scope))) { @@ -4059,10 +4064,14 @@ sctp_lowlevel_chunk_output(struct sctp_i } else { SCTP_STAT_INCR(sctps_sendnocrc); } +#endif if ((udp->uh_sum = in6_cksum(o_pak, IPPROTO_UDP, sizeof(struct ip6_hdr), packet_length - sizeof(struct ip6_hdr))) == 0) { udp->uh_sum = 0xffff; } } else { +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_sendnocrc); +#else if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && (stcb) && (stcb->asoc.loopback_scope))) { @@ -4072,6 +4081,7 @@ sctp_lowlevel_chunk_output(struct sctp_i } else { SCTP_STAT_INCR(sctps_sendnocrc); } +#endif } /* send it out. table id is taken from stcb */ #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) @@ -10571,7 +10581,6 @@ sctp_send_shutdown_complete2(struct mbuf if (iph_out != NULL) { sctp_route_t ro; int ret; - struct sctp_tcb *stcb = NULL; mlen = SCTP_BUF_LEN(mout); bzero(&ro, sizeof ro); @@ -10582,17 +10591,25 @@ sctp_send_shutdown_complete2(struct mbuf sctp_packet_log(mout, mlen); #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); SCTP_STAT_INCR(sctps_sendswcrc); +#endif SCTP_ENABLE_UDP_CSUM(mout); } 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_ATTACH_CHAIN(o_pak, mout, mlen); /* out it goes */ - SCTP_IP_OUTPUT(ret, o_pak, &ro, stcb, vrf_id); + SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -10602,7 +10619,6 @@ sctp_send_shutdown_complete2(struct mbuf if (ip6_out != NULL) { struct route_in6 ro; int ret; - struct sctp_tcb *stcb = NULL; struct ifnet *ifp = NULL; bzero(&ro, sizeof(ro)); @@ -10613,29 +10629,25 @@ sctp_send_shutdown_complete2(struct mbuf #endif SCTP_ATTACH_CHAIN(o_pak, mout, mlen); if (port) { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - comp_cp->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#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)); + 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) { udp->uh_sum = 0xffff; } } else { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#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_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id); + SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -11632,7 +11644,6 @@ sctp_send_abort(struct mbuf *m, int iphl } if (iph_out != NULL) { sctp_route_t ro; - struct sctp_tcb *stcb = NULL; int ret; /* zap the stack pointer to the route */ @@ -11652,15 +11663,23 @@ sctp_send_abort(struct mbuf *m, int iphl #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 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, stcb, vrf_id); + SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -11670,7 +11689,6 @@ sctp_send_abort(struct mbuf *m, int iphl if (ip6_out != NULL) { struct route_in6 ro; int ret; - struct sctp_tcb *stcb = NULL; struct ifnet *ifp = NULL; /* zap the stack pointer to the route */ @@ -11687,29 +11705,25 @@ sctp_send_abort(struct mbuf *m, int iphl #endif SCTP_ATTACH_CHAIN(o_pak, mout, len); if (port) { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - abm->sh.checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#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 (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#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_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id); + SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -11872,7 +11886,6 @@ sctp_send_operr_to(struct mbuf *m, int i } if (iph_out != NULL) { sctp_route_t ro; - struct sctp_tcb *stcb = NULL; int ret; /* zap the stack pointer to the route */ @@ -11890,15 +11903,23 @@ sctp_send_operr_to(struct mbuf *m, int i #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 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, stcb, vrf_id); + SCTP_IP_OUTPUT(ret, o_pak, &ro, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) @@ -11908,7 +11929,6 @@ sctp_send_operr_to(struct mbuf *m, int i if (ip6_out != NULL) { struct route_in6 ro; int ret; - struct sctp_tcb *stcb = NULL; struct ifnet *ifp = NULL; /* zap the stack pointer to the route */ @@ -11923,29 +11943,25 @@ sctp_send_operr_to(struct mbuf *m, int i #endif SCTP_ATTACH_CHAIN(o_pak, mout, len); if (port) { - if (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - sh_out->checksum = sctp_calculate_cksum(mout, sizeof(struct ip6_hdr) + sizeof(struct udphdr)); - SCTP_STAT_INCR(sctps_sendswcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#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 (!(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) && - (stcb) && - (stcb->asoc.loopback_scope))) { - mout->m_pkthdr.csum_flags = CSUM_SCTP; - mout->m_pkthdr.csum_data = 0; - SCTP_STAT_INCR(sctps_sendhwcrc); - } else { - SCTP_STAT_INCR(sctps_sendnocrc); - } +#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_IP6_OUTPUT(ret, o_pak, &ro, &ifp, stcb, vrf_id); + SCTP_IP6_OUTPUT(ret, o_pak, &ro, &ifp, NULL, vrf_id); /* Free the route if we got one back */ if (ro.ro_rt) Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_sysctl.c Sun Aug 29 18:50:30 2010 (r211969) @@ -54,7 +54,9 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_ecn_enable) = SCTPCTL_ECN_ENABLE_DEFAULT; SCTP_BASE_SYSCTL(sctp_ecn_nonce) = SCTPCTL_ECN_NONCE_DEFAULT; SCTP_BASE_SYSCTL(sctp_strict_sacks) = SCTPCTL_STRICT_SACKS_DEFAULT; +#if !defined(SCTP_WITH_NO_CSUM) SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT; +#endif SCTP_BASE_SYSCTL(sctp_strict_init) = SCTPCTL_STRICT_INIT_DEFAULT; SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT; SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT; @@ -568,7 +570,9 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_enable), SCTPCTL_ECN_ENABLE_MIN, SCTPCTL_ECN_ENABLE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_ecn_nonce), SCTPCTL_ECN_NONCE_MIN, SCTPCTL_ECN_NONCE_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_sacks), SCTPCTL_STRICT_SACKS_MIN, SCTPCTL_STRICT_SACKS_MAX); +#if !defined(SCTP_WITH_NO_CSUM) RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX); +#endif RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_init), SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX); @@ -829,9 +833,11 @@ SYSCTL_PROC(_net_inet_sctp, OID_AUTO, st &SCTP_BASE_SYSCTL(sctp_strict_sacks), 0, sysctl_sctp_check, "IU", SCTPCTL_STRICT_SACKS_DESC); +#if !defined(SCTP_WITH_NO_CSUM) SYSCTL_PROC(_net_inet_sctp, OID_AUTO, loopback_nocsum, CTLTYPE_INT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), 0, sysctl_sctp_check, "IU", SCTPCTL_LOOPBACK_NOCSUM_DESC); +#endif SYSCTL_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_INT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_strict_init), 0, sysctl_sctp_check, "IU", Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet/sctp_sysctl.h Sun Aug 29 18:50:30 2010 (r211969) @@ -45,7 +45,9 @@ struct sctp_sysctl { uint32_t sctp_ecn_enable; uint32_t sctp_ecn_nonce; uint32_t sctp_strict_sacks; +#if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_no_csum_on_loopback; +#endif uint32_t sctp_strict_init; uint32_t sctp_peer_chunk_oh; uint32_t sctp_max_burst_default; Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Sun Aug 29 18:31:04 2010 (r211968) +++ head/sys/netinet6/sctp6_usrreq.c Sun Aug 29 18:50:30 2010 (r211969) @@ -72,7 +72,6 @@ sctp6_input(struct mbuf **i_pak, int *of struct sctp_inpcb *in6p = NULL; struct sctp_nets *net; int refcount_up = 0; - uint32_t check, calc_check; uint32_t vrf_id = 0; struct inpcb *in6p_ip; struct sctp_chunkhdr *ch; @@ -80,6 +79,11 @@ sctp6_input(struct mbuf **i_pak, int *of uint8_t ecn_bits; struct sctp_tcb *stcb = NULL; int pkt_len = 0; + +#if !defined(SCTP_WITH_NO_CSUM) + uint32_t check, calc_check; + +#endif int off = *offp; uint16_t port = 0; @@ -133,6 +137,9 @@ sctp6_input(struct mbuf **i_pak, int *of m->m_pkthdr.len, if_name(m->m_pkthdr.rcvif), m->m_pkthdr.csum_flags); +#if defined(SCTP_WITH_NO_CSUM) + SCTP_STAT_INCR(sctps_recvnocrc); +#else if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) { SCTP_STAT_INCR(sctps_recvhwcrc); goto sctp_skip_csum; @@ -171,6 +178,7 @@ sctp6_input(struct mbuf **i_pak, int *of sh->checksum = calc_check; sctp_skip_csum: +#endif net = NULL; /* * Locate pcb and tcb for datagram sctp_findassociation_addr() wants From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 20:18:06 2010 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 C30F91065674; Sun, 29 Aug 2010 20:18:06 +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 B2AD68FC08; Sun, 29 Aug 2010 20:18:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TKI6Xo073428; Sun, 29 Aug 2010 20:18:06 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TKI6u6073426; Sun, 29 Aug 2010 20:18:06 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292018.o7TKI6u6073426@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 20:18:06 +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: r211970 - head/cddl/contrib/opensolaris/lib/pyzfs/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, 29 Aug 2010 20:18:06 -0000 Author: pjd Date: Sun Aug 29 20:18:06 2010 New Revision: 211970 URL: http://svn.freebsd.org/changeset/base/211970 Log: Fix 'zfs allow' (maybe not only) returning: cannot access dataset system/usr/home: Operation not supported by including libzfs_impl.h. What libzfs_impl.h does is to redefine ioctl() to be compatible with OpenSolaris. More specifically OpenSolaris returns ENOMEM when buffer is too small and sets field zc_nvlist_dst_size to the size that will be big enough for the data. In FreeBSD case ioctl() doesn't copy data structure back in case of a failure. We work-around it in kernel and libzfs by returning 0 from ioctl() and always checking if zc_nvlist_dst_size hasn't changed. For this work-around to work in pyzfs we need this compatible ioctl() which is implemented in libzfs_impl.h. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/lib/pyzfs/common/ioctl.c Modified: head/cddl/contrib/opensolaris/lib/pyzfs/common/ioctl.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/pyzfs/common/ioctl.c Sun Aug 29 18:50:30 2010 (r211969) +++ head/cddl/contrib/opensolaris/lib/pyzfs/common/ioctl.c Sun Aug 29 20:18:06 2010 (r211970) @@ -33,6 +33,7 @@ #include #include #include +#include #include "zfs_prop.h" static PyObject *ZFSError; From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 20:21:11 2010 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 1189210656A3; Sun, 29 Aug 2010 20:21:11 +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 011078FC0A; Sun, 29 Aug 2010 20:21:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TKLApJ073519; Sun, 29 Aug 2010 20:21:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TKLAGW073517; Sun, 29 Aug 2010 20:21:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292021.o7TKLAGW073517@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 20:21: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: r211971 - head/cddl/contrib/opensolaris/cmd/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: Sun, 29 Aug 2010 20:21:11 -0000 Author: pjd Date: Sun Aug 29 20:21:10 2010 New Revision: 211971 URL: http://svn.freebsd.org/changeset/base/211971 Log: Print errors on stderr. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Aug 29 20:18:06 2010 (r211970) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Aug 29 20:21:10 2010 (r211971) @@ -1733,7 +1733,7 @@ zfs_do_userspace(int argc, char **argv) */ (void) execv(pypath, argv-1); - (void) printf("internal error: %s not found\n" + (void) fprintf(stderr, "internal error: %s not found\n" "falling back on built-in implementation, " "some features will not work\n", pypath); @@ -3797,7 +3797,7 @@ static int zfs_do_python(int argc, char **argv) { (void) execv(pypath, argv-1); - (void) printf("internal error: %s not found\n", pypath); + (void) fprintf(stderr, "internal error: %s not found\n", pypath); return (-1); } From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 20:25:25 2010 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 B6B25106564A; Sun, 29 Aug 2010 20:25: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 A69DD8FC14; Sun, 29 Aug 2010 20:25:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TKPP22073697; Sun, 29 Aug 2010 20:25:25 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TKPPtg073695; Sun, 29 Aug 2010 20:25:25 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292025.o7TKPPtg073695@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 20:25: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: r211972 - head/cddl/contrib/opensolaris/cmd/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: Sun, 29 Aug 2010 20:25:25 -0000 Author: pjd Date: Sun Aug 29 20:25:25 2010 New Revision: 211972 URL: http://svn.freebsd.org/changeset/base/211972 Log: Give user a hint what to do when /usr/lib/zfs/pyzfs.py is missing. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Aug 29 20:21:10 2010 (r211971) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Aug 29 20:25:25 2010 (r211972) @@ -1736,6 +1736,7 @@ zfs_do_userspace(int argc, char **argv) (void) fprintf(stderr, "internal error: %s not found\n" "falling back on built-in implementation, " "some features will not work\n", pypath); + (void) fprintf(stderr, " install sysutils/py-zfs port to correct this\n"); if ((zhp = zfs_open(g_zfs, argv[argc-1], ZFS_TYPE_DATASET)) == NULL) return (1); @@ -3798,6 +3799,7 @@ zfs_do_python(int argc, char **argv) { (void) execv(pypath, argv-1); (void) fprintf(stderr, "internal error: %s not found\n", pypath); + (void) fprintf(stderr, " install sysutils/py-zfs port to correct this\n"); return (-1); } From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 20:53:24 2010 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 ED3B310656AA; Sun, 29 Aug 2010 20:53:24 +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 DCCD38FC16; Sun, 29 Aug 2010 20:53:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TKrOqi074211; Sun, 29 Aug 2010 20:53:24 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TKrOUx074209; Sun, 29 Aug 2010 20:53:24 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008292053.o7TKrOUx074209@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 Aug 2010 20:53: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: r211973 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 29 Aug 2010 20:53:25 -0000 Author: jilles Date: Sun Aug 29 20:53:24 2010 New Revision: 211973 URL: http://svn.freebsd.org/changeset/base/211973 Log: sh: Weaken builtins/command4 test to only require a nonzero exit status. This matches what is in POSIX; various other shells use different exit statuses. Note that it is still required that there be no output. Added: head/tools/regression/bin/sh/builtins/command4.0 - copied, changed from r210462, head/tools/regression/bin/sh/builtins/command4.127 Deleted: head/tools/regression/bin/sh/builtins/command4.127 Copied and modified: head/tools/regression/bin/sh/builtins/command4.0 (from r210462, head/tools/regression/bin/sh/builtins/command4.127) ============================================================================== --- head/tools/regression/bin/sh/builtins/command4.127 Sun Jul 25 10:06:56 2010 (r210462, copy source) +++ head/tools/regression/bin/sh/builtins/command4.0 Sun Aug 29 20:53:24 2010 (r211973) @@ -1,2 +1,2 @@ # $FreeBSD$ -command -v nonexisting +! command -v nonexisting From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 21:37:22 2010 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 4C46F1065674; Sun, 29 Aug 2010 21:37: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 3C1468FC08; Sun, 29 Aug 2010 21:37:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TLbMSK075122; Sun, 29 Aug 2010 21:37:22 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TLbMks075120; Sun, 29 Aug 2010 21:37:22 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292137.o7TLbMks075120@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 21:37: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: r211975 - 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: Sun, 29 Aug 2010 21:37:22 -0000 Author: pjd Date: Sun Aug 29 21:37:21 2010 New Revision: 211975 URL: http://svn.freebsd.org/changeset/base/211975 Log: Implement mtx_destroy() and rw_destroy(). MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/synch.h Modified: head/sbin/hastd/synch.h ============================================================================== --- head/sbin/hastd/synch.h Sun Aug 29 21:05:34 2010 (r211974) +++ head/sbin/hastd/synch.h Sun Aug 29 21:37:21 2010 (r211975) @@ -48,6 +48,14 @@ mtx_init(pthread_mutex_t *lock) assert(error == 0); } static __inline void +mtx_destroy(pthread_mutex_t *lock) +{ + int error; + + error = pthread_mutex_destroy(lock); + assert(error == 0); +} +static __inline void mtx_lock(pthread_mutex_t *lock) { int error; @@ -88,6 +96,14 @@ rw_init(pthread_rwlock_t *lock) assert(error == 0); } static __inline void +rw_destroy(pthread_rwlock_t *lock) +{ + int error; + + error = pthread_rwlock_destroy(lock); + assert(error == 0); +} +static __inline void rw_rlock(pthread_rwlock_t *lock) { int error; From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 21:39:50 2010 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 3E8B610656B8; Sun, 29 Aug 2010 21:39: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 DDE0F8FC12; Sun, 29 Aug 2010 21:39:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TLdnJX075198; Sun, 29 Aug 2010 21:39:49 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TLdnfC075195; Sun, 29 Aug 2010 21:39:49 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292139.o7TLdnfC075195@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 21:39: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: r211976 - 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: Sun, 29 Aug 2010 21:39:50 -0000 Author: pjd Date: Sun Aug 29 21:39:49 2010 New Revision: 211976 URL: http://svn.freebsd.org/changeset/base/211976 Log: - Add hook_fini() which should be called after fork() from the main hastd process, once it start to use hooks. - Add hook_check_one() in case the caller expects different child processes and once it can recognize it, it will pass pid and status to hook_check_one(). MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/hooks.c head/sbin/hastd/hooks.h Modified: head/sbin/hastd/hooks.c ============================================================================== --- head/sbin/hastd/hooks.c Sun Aug 29 21:37:21 2010 (r211975) +++ head/sbin/hastd/hooks.c Sun Aug 29 21:39:49 2010 (r211976) @@ -82,6 +82,9 @@ struct hookproc { static TAILQ_HEAD(, hookproc) hookprocs; static pthread_mutex_t hookprocs_lock; +static void hook_remove(struct hookproc *hp); +static void hook_free(struct hookproc *hp); + static void descriptors(void) { @@ -147,11 +150,35 @@ void hook_init(void) { + assert(!hooks_initialized); + mtx_init(&hookprocs_lock); TAILQ_INIT(&hookprocs); hooks_initialized = true; } +void +hook_fini(void) +{ + struct hookproc *hp; + + assert(hooks_initialized); + + mtx_lock(&hookprocs_lock); + while ((hp = TAILQ_FIRST(&hookprocs)) != NULL) { + assert(hp->hp_magic == HOOKPROC_MAGIC_ONLIST); + assert(hp->hp_pid > 0); + + hook_remove(hp); + hook_free(hp); + } + mtx_unlock(&hookprocs_lock); + + mtx_destroy(&hookprocs_lock); + TAILQ_INIT(&hookprocs); + hooks_initialized = false; +} + static struct hookproc * hook_alloc(const char *path, char **args) { @@ -238,6 +265,34 @@ hook_find(pid_t pid) } void +hook_check_one(pid_t pid, int status) +{ + struct hookproc *hp; + + mtx_lock(&hookprocs_lock); + hp = hook_find(pid); + if (hp == NULL) { + mtx_unlock(&hookprocs_lock); + pjdlog_debug(1, "Unknown process pid=%u", pid); + return; + } + hook_remove(hp); + mtx_unlock(&hookprocs_lock); + if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { + pjdlog_debug(1, "Hook exited gracefully (pid=%u, cmd=[%s]).", + pid, hp->hp_comm); + } else if (WIFSIGNALED(status)) { + pjdlog_error("Hook was killed (pid=%u, signal=%d, cmd=[%s]).", + pid, WTERMSIG(status), hp->hp_comm); + } else { + pjdlog_error("Hook exited ungracefully (pid=%u, exitcode=%d, cmd=[%s]).", + pid, WIFEXITED(status) ? WEXITSTATUS(status) : -1, + hp->hp_comm); + } + hook_free(hp); +} + +void hook_check(bool sigchld) { struct hookproc *hp, *hp2; @@ -250,28 +305,9 @@ hook_check(bool sigchld) /* * If SIGCHLD was received, garbage collect finished processes. */ - while (sigchld && (pid = wait3(&status, WNOHANG, NULL)) > 0) { - mtx_lock(&hookprocs_lock); - hp = hook_find(pid); - if (hp == NULL) { - mtx_unlock(&hookprocs_lock); - pjdlog_warning("Unknown process pid=%u", pid); - continue; - } - hook_remove(hp); - mtx_unlock(&hookprocs_lock); - if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { - pjdlog_debug(1, "Hook exited gracefully (pid=%u, cmd=[%s]).", - pid, hp->hp_comm); - } else if (WIFSIGNALED(status)) { - pjdlog_error("Hook was killed (pid=%u, signal=%d, cmd=[%s]).", - pid, WTERMSIG(status), hp->hp_comm); - } else { - pjdlog_error("Hook exited ungracefully (pid=%u, exitcode=%d, cmd=[%s]).", - pid, WIFEXITED(status) ? WEXITSTATUS(status) : -1, - hp->hp_comm); - } - hook_free(hp); + if (sigchld) { + while ((pid = wait3(&status, WNOHANG, NULL)) > 0) + hook_check_one(pid, status); } /* Modified: head/sbin/hastd/hooks.h ============================================================================== --- head/sbin/hastd/hooks.h Sun Aug 29 21:37:21 2010 (r211975) +++ head/sbin/hastd/hooks.h Sun Aug 29 21:39:49 2010 (r211976) @@ -33,10 +33,14 @@ #ifndef _HOOKS_H_ #define _HOOKS_H_ +#include + #include #include void hook_init(void); +void hook_fini(void); +void hook_check_one(pid_t pid, int status); void hook_check(bool sigchld); void hook_exec(const char *path, ...); void hook_execv(const char *path, va_list ap); From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 21:41:53 2010 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 D11E510656B6; Sun, 29 Aug 2010 21:41:53 +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 B69838FC08; Sun, 29 Aug 2010 21:41:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TLfrxD075276; Sun, 29 Aug 2010 21:41:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TLfrRG075272; Sun, 29 Aug 2010 21:41:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292141.o7TLfrRG075272@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 21:41: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: r211977 - 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: Sun, 29 Aug 2010 21:41:53 -0000 Author: pjd Date: Sun Aug 29 21:41:53 2010 New Revision: 211977 URL: http://svn.freebsd.org/changeset/base/211977 Log: Allow to run hooks from the main hastd process. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/hastd.c head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Sun Aug 29 21:39:49 2010 (r211976) +++ head/sbin/hastd/hastd.c Sun Aug 29 21:41:53 2010 (r211977) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include "hast.h" #include "hast_proto.h" #include "hastd.h" +#include "hooks.h" #include "subr.h" /* Path to configuration file. */ @@ -70,6 +71,9 @@ bool sigexit_received = false; /* PID file handle. */ struct pidfh *pfh; +/* How often check for hooks running for too long. */ +#define REPORT_INTERVAL 10 + static void usage(void) { @@ -144,8 +148,10 @@ child_exit(void) if (res == NULL) { /* * This can happen when new connection arrives and we - * cancel child responsible for the old one. + * cancel child responsible for the old one or if this + * was hook which we executed. */ + hook_check_one(pid, status); continue; } pjdlog_prefix_set("[%s] (%s) ", res->hr_name, @@ -620,6 +626,10 @@ main_loop(void) { fd_set rfds, wfds; int cfd, lfd, maxfd, ret; + struct timeval timeout; + + timeout.tv_sec = REPORT_INTERVAL; + timeout.tv_usec = 0; for (;;) { if (sigexit_received) { @@ -648,8 +658,10 @@ main_loop(void) FD_SET(cfd, &wfds); FD_SET(lfd, &wfds); - ret = select(maxfd + 1, &rfds, &wfds, NULL, NULL); - if (ret == -1) { + ret = select(maxfd + 1, &rfds, &wfds, NULL, &timeout); + if (ret == 0) + hook_check(false); + else if (ret == -1) { if (errno == EINTR) continue; KEEP_ERRNO((void)pidfile_remove(pfh)); @@ -754,6 +766,8 @@ main(int argc, char *argv[]) } } + hook_init(); + main_loop(); exit(0); Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sun Aug 29 21:39:49 2010 (r211976) +++ head/sbin/hastd/primary.c Sun Aug 29 21:41:53 2010 (r211977) @@ -786,7 +786,9 @@ hastd_primary(struct hast_resource *res) res->hr_workerpid = pid; return; } + (void)pidfile_close(pfh); + hook_fini(); setproctitle("%s (primary)", res->hr_name); Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Sun Aug 29 21:39:49 2010 (r211976) +++ head/sbin/hastd/secondary.c Sun Aug 29 21:41:53 2010 (r211977) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include "hast.h" #include "hast_proto.h" #include "hastd.h" +#include "hooks.h" #include "metadata.h" #include "proto.h" #include "subr.h" @@ -357,7 +358,9 @@ hastd_secondary(struct hast_resource *re res->hr_workerpid = pid; return; } + (void)pidfile_close(pfh); + hook_fini(); setproctitle("%s (secondary)", res->hr_name); From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 21:42:45 2010 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 7CABD10656BA; Sun, 29 Aug 2010 21:42:45 +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 51ECE8FC12; Sun, 29 Aug 2010 21:42:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TLgj2w075327; Sun, 29 Aug 2010 21:42:45 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TLgjgo075324; Sun, 29 Aug 2010 21:42:45 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292142.o7TLgjgo075324@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 21:42: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: r211978 - 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: Sun, 29 Aug 2010 21:42:45 -0000 Author: pjd Date: Sun Aug 29 21:42:45 2010 New Revision: 211978 URL: http://svn.freebsd.org/changeset/base/211978 Log: - Call hook on role change. - Document new event. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/control.c head/sbin/hastd/hast.conf.5 Modified: head/sbin/hastd/control.c ============================================================================== --- head/sbin/hastd/control.c Sun Aug 29 21:41:53 2010 (r211977) +++ head/sbin/hastd/control.c Sun Aug 29 21:42:45 2010 (r211978) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include "hast.h" #include "hastd.h" #include "hast_proto.h" +#include "hooks.h" #include "nv.h" #include "pjdlog.h" #include "proto.h" @@ -54,6 +55,7 @@ static void control_set_role_common(struct hastd_config *cfg, struct nv *nvout, uint8_t role, struct hast_resource *res, const char *name, unsigned int no) { + int oldrole; /* Name is always needed. */ if (name != NULL) @@ -85,6 +87,7 @@ control_set_role_common(struct hastd_con pjdlog_info("Role changed to %s.", role2str(role)); /* Change role to the new one. */ + oldrole = res->hr_role; res->hr_role = role; pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); @@ -113,6 +116,8 @@ control_set_role_common(struct hastd_con if (role == HAST_ROLE_PRIMARY) hastd_primary(res); pjdlog_prefix_set("%s", ""); + hook_exec(res->hr_exec, "role", res->hr_name, role2str(oldrole), + role2str(res->hr_role), NULL); } void Modified: head/sbin/hastd/hast.conf.5 ============================================================================== --- head/sbin/hastd/hast.conf.5 Sun Aug 29 21:41:53 2010 (r211977) +++ head/sbin/hastd/hast.conf.5 Sun Aug 29 21:42:45 2010 (r211978) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 27, 2010 +.Dd August 29, 2010 .Dt HAST.CONF 5 .Os .Sh NAME @@ -228,6 +228,10 @@ Executed on primary node when synchroniz interrupted, most likely due to secondary node outage or connection failure between the nodes. .Pp +.It Ic " role " +.Pp +Executed on both primary and secondary nodes when resource role is changed. +.Pp .El The .Aq path @@ -241,6 +245,22 @@ The .Aq resource argument is resource name from the configuration file. .Pp +The +.Aq oldrole +argument is previous resource role (before the change). +It can be one of: +.Ar init , +.Ar secondary , +.Ar primary . +.Pp +The +.Aq newrole +argument is current resource role (after the change). +It can be one of: +.Ar init , +.Ar secondary , +.Ar primary . +.Pp .It Ic name Aq name .Pp GEOM provider name that will appear as From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 22:17:54 2010 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 04983106566B; Sun, 29 Aug 2010 22:17: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 E89EE8FC1C; Sun, 29 Aug 2010 22:17:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TMHrl4076003; Sun, 29 Aug 2010 22:17:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TMHrVW076001; Sun, 29 Aug 2010 22:17:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292217.o7TMHrVW076001@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 22:17: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: r211979 - 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: Sun, 29 Aug 2010 22:17:54 -0000 Author: pjd Date: Sun Aug 29 22:17:53 2010 New Revision: 211979 URL: http://svn.freebsd.org/changeset/base/211979 Log: Disconnect after logging errors. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sun Aug 29 21:42:45 2010 (r211978) +++ head/sbin/hastd/primary.c Sun Aug 29 22:17:53 2010 (r211979) @@ -1234,12 +1234,12 @@ remote_send_thread(void *arg) data != NULL ? length : 0) < 0) { hio->hio_errors[ncomp] = errno; rw_unlock(&hio_remote_lock[ncomp]); - remote_close(res, ncomp); pjdlog_debug(2, "remote_send: (%p) Unable to send request.", hio); reqlog(LOG_ERR, 0, ggio, "Unable to send request (%s): ", strerror(hio->hio_errors[ncomp])); + remote_close(res, ncomp); /* * Take request back from the receive queue and move * it immediately to the done queue. From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 22:22:16 2010 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 03F7310656B2; Sun, 29 Aug 2010 22:22:16 +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 E803F8FC14; Sun, 29 Aug 2010 22:22:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TMMFJN076129; Sun, 29 Aug 2010 22:22:15 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TMMFla076127; Sun, 29 Aug 2010 22:22:15 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201008292222.o7TMMFla076127@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 29 Aug 2010 22:22: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: r211980 - head/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: Sun, 29 Aug 2010 22:22:16 -0000 Author: jilles Date: Sun Aug 29 22:22:15 2010 New Revision: 211980 URL: http://svn.freebsd.org/changeset/base/211980 Log: Correct value for _POSIX_AIO_LISTIO_MAX in . All the "Minimum Values" (POSIX.1-2008 XBD 13 Headers ) are now correct. These should all be exactly as they are in the specification; the possibly higher values we support are announced differently. PR: standards/104743 Submitted by: gcooper MFC after: 2 weeks Modified: head/include/limits.h Modified: head/include/limits.h ============================================================================== --- head/include/limits.h Sun Aug 29 22:17:53 2010 (r211979) +++ head/include/limits.h Sun Aug 29 22:22:15 2010 (r211980) @@ -70,7 +70,7 @@ #endif #if __POSIX_VISIBLE >= 199309 -#define _POSIX_AIO_LISTIO_MAX 16 +#define _POSIX_AIO_LISTIO_MAX 2 #define _POSIX_AIO_MAX 1 #define _POSIX_DELAYTIMER_MAX 32 #define _POSIX_MQ_OPEN_MAX 8 From owner-svn-src-all@FreeBSD.ORG Sun Aug 29 22:55:22 2010 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 F29E810656BB; Sun, 29 Aug 2010 22:55: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 E21988FC22; Sun, 29 Aug 2010 22:55:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7TMtLrM076827; Sun, 29 Aug 2010 22:55:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7TMtLHY076825; Sun, 29 Aug 2010 22:55:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008292255.o7TMtLHY076825@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 29 Aug 2010 22:55: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: r211981 - 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: Sun, 29 Aug 2010 22:55:22 -0000 Author: pjd Date: Sun Aug 29 22:55:21 2010 New Revision: 211981 URL: http://svn.freebsd.org/changeset/base/211981 Log: - Move functionality responsible for checking one connection to separate function to make code more readable. - Be sure not to reconnect too often in case of signal delivery, etc. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sun Aug 29 22:22:15 2010 (r211980) +++ head/sbin/hastd/primary.c Sun Aug 29 22:55:21 2010 (r211981) @@ -1903,6 +1903,67 @@ keepalive_send(struct hast_resource *res pjdlog_debug(2, "keepalive_send: Request sent."); } +static void +guard_one(struct hast_resource *res, unsigned int ncomp) +{ + struct proto_conn *in, *out; + + if (!ISREMOTE(ncomp)) + return; + + rw_rlock(&hio_remote_lock[ncomp]); + + if (!real_remote(res)) { + rw_unlock(&hio_remote_lock[ncomp]); + return; + } + + if (ISCONNECTED(res, ncomp)) { + assert(res->hr_remotein != NULL); + assert(res->hr_remoteout != NULL); + keepalive_send(res, ncomp); + } + + if (ISCONNECTED(res, ncomp)) { + assert(res->hr_remotein != NULL); + assert(res->hr_remoteout != NULL); + rw_unlock(&hio_remote_lock[ncomp]); + pjdlog_debug(2, "remote_guard: Connection to %s is ok.", + res->hr_remoteaddr); + return; + } + + assert(res->hr_remotein == NULL); + assert(res->hr_remoteout == NULL); + /* + * Upgrade the lock. It doesn't have to be atomic as no other thread + * can change connection status from disconnected to connected. + */ + rw_unlock(&hio_remote_lock[ncomp]); + pjdlog_debug(2, "remote_guard: Reconnecting to %s.", + res->hr_remoteaddr); + in = out = NULL; + if (init_remote(res, &in, &out)) { + rw_wlock(&hio_remote_lock[ncomp]); + assert(res->hr_remotein == NULL); + assert(res->hr_remoteout == NULL); + assert(in != NULL && out != NULL); + res->hr_remotein = in; + res->hr_remoteout = out; + rw_unlock(&hio_remote_lock[ncomp]); + pjdlog_info("Successfully reconnected to %s.", + res->hr_remoteaddr); + sync_start(); + } else { + /* Both connections should be NULL. */ + assert(res->hr_remotein == NULL); + assert(res->hr_remoteout == NULL); + assert(in == NULL && out == NULL); + pjdlog_debug(2, "remote_guard: Reconnect to %s failed.", + res->hr_remoteaddr); + } +} + /* * Thread guards remote connections and reconnects when needed, handles * signals, etc. @@ -1911,11 +1972,12 @@ static void * guard_thread(void *arg) { struct hast_resource *res = arg; - struct proto_conn *in, *out; unsigned int ii, ncomps; + time_t lastcheck, now; int timeout; ncomps = HAST_NCOMPONENTS; + lastcheck = time(NULL); for (;;) { if (sigexit_received) { @@ -1930,63 +1992,24 @@ guard_thread(void *arg) if (sigchld_received) sigchld_received = false; - timeout = KEEPALIVE_SLEEP; pjdlog_debug(2, "remote_guard: Checking connections."); mtx_lock(&hio_guard_lock); + timeout = KEEPALIVE_SLEEP; for (ii = 0; ii < ncomps; ii++) { - if (!ISREMOTE(ii)) - continue; - rw_rlock(&hio_remote_lock[ii]); - if (ISCONNECTED(res, ii)) { - assert(res->hr_remotein != NULL); - assert(res->hr_remoteout != NULL); - keepalive_send(res, ii); + if (!ISCONNECTED(res, ii)) { + timeout = RECONNECT_SLEEP; + break; } - if (ISCONNECTED(res, ii)) { - assert(res->hr_remotein != NULL); - assert(res->hr_remoteout != NULL); - rw_unlock(&hio_remote_lock[ii]); - pjdlog_debug(2, - "remote_guard: Connection to %s is ok.", - res->hr_remoteaddr); - } else if (real_remote(res)) { - assert(res->hr_remotein == NULL); - assert(res->hr_remoteout == NULL); - /* - * Upgrade the lock. It doesn't have to be - * atomic as no other thread can change - * connection status from disconnected to - * connected. - */ - rw_unlock(&hio_remote_lock[ii]); - pjdlog_debug(2, - "remote_guard: Reconnecting to %s.", - res->hr_remoteaddr); - in = out = NULL; - if (init_remote(res, &in, &out)) { - rw_wlock(&hio_remote_lock[ii]); - assert(res->hr_remotein == NULL); - assert(res->hr_remoteout == NULL); - assert(in != NULL && out != NULL); - res->hr_remotein = in; - res->hr_remoteout = out; - rw_unlock(&hio_remote_lock[ii]); - pjdlog_info("Successfully reconnected to %s.", - res->hr_remoteaddr); - sync_start(); - } else { - /* Both connections should be NULL. */ - assert(res->hr_remotein == NULL); - assert(res->hr_remoteout == NULL); - assert(in == NULL && out == NULL); - pjdlog_debug(2, - "remote_guard: Reconnect to %s failed.", - res->hr_remoteaddr); + } + now = time(NULL); + if (lastcheck + timeout <= now) { + timeout = KEEPALIVE_SLEEP; + for (ii = 0; ii < ncomps; ii++) { + guard_one(res, ii); + if (!ISCONNECTED(res, ii)) timeout = RECONNECT_SLEEP; - } - } else { - rw_unlock(&hio_remote_lock[ii]); } + lastcheck = now; } /* Sleep only if a signal wasn't delivered in the meantime. */ if (!sigexit_received && !sighup_received && !sigchld_received) From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 00:06:05 2010 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 B57421065674; Mon, 30 Aug 2010 00:06:05 +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 A48498FC22; Mon, 30 Aug 2010 00:06:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U0658k078153; Mon, 30 Aug 2010 00:06:05 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U065Nu078151; Mon, 30 Aug 2010 00:06:05 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008300006.o7U065Nu078151@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 30 Aug 2010 00:06: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: r211982 - 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, 30 Aug 2010 00:06:05 -0000 Author: pjd Date: Mon Aug 30 00:06:05 2010 New Revision: 211982 URL: http://svn.freebsd.org/changeset/base/211982 Log: Use sigtimedwait(2) for signals handling in primary process. This fixes various races and eliminates use of pthread* API in signal handler. Pointed out by: kib With help from: jilles MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sun Aug 29 22:55:21 2010 (r211981) +++ head/sbin/hastd/primary.c Mon Aug 30 00:06:05 2010 (r211982) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -132,8 +133,6 @@ static pthread_cond_t sync_cond; * The lock below allows to synchornize access to remote connections. */ static pthread_rwlock_t *hio_remote_lock; -static pthread_mutex_t hio_guard_lock; -static pthread_cond_t hio_guard_cond; /* * Lock to synchronize metadata updates. Also synchronize access to @@ -152,13 +151,9 @@ static pthread_mutex_t metadata_lock; */ #define HAST_NCOMPONENTS 2 /* - * Number of seconds to sleep between keepalive packets. + * Number of seconds to sleep between reconnect retries or keepalive packets. */ -#define KEEPALIVE_SLEEP 10 -/* - * Number of seconds to sleep between reconnect retries. - */ -#define RECONNECT_SLEEP 5 +#define RETRY_SLEEP 10 #define ISCONNECTED(res, no) \ ((res)->hr_remotein != NULL && (res)->hr_remoteout != NULL) @@ -230,7 +225,11 @@ static void *ggate_send_thread(void *arg static void *sync_thread(void *arg); static void *guard_thread(void *arg); -static void sighandler(int sig); +static void +dummy_sighandler(int sig __unused) +{ + /* Nothing to do. */ +} static void cleanup(struct hast_resource *res) @@ -319,6 +318,7 @@ init_environment(struct hast_resource *r { struct hio *hio; unsigned int ii, ncomps; + sigset_t mask; /* * In the future it might be per-resource value. @@ -389,8 +389,6 @@ init_environment(struct hast_resource *r TAILQ_INIT(&hio_done_list); mtx_init(&hio_done_list_lock); cv_init(&hio_done_list_cond); - mtx_init(&hio_guard_lock); - cv_init(&hio_guard_cond); mtx_init(&metadata_lock); /* @@ -431,10 +429,10 @@ init_environment(struct hast_resource *r /* * Turn on signals handling. */ - signal(SIGINT, sighandler); - signal(SIGTERM, sighandler); - signal(SIGHUP, sighandler); - signal(SIGCHLD, sighandler); + /* Because SIGCHLD is ignored by default, setup dummy handler for it. */ + PJDLOG_VERIFY(signal(SIGCHLD, dummy_sighandler) != SIG_ERR); + PJDLOG_VERIFY(sigfillset(&mask) == 0); + PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); } static void @@ -893,16 +891,6 @@ remote_close(struct hast_resource *res, * Stop synchronization if in-progress. */ sync_stop(); - - /* - * Wake up guard thread (if we are not called from within guard thread), - * so it can immediately start reconnect. - */ - if (!mtx_owned(&hio_guard_lock)) { - mtx_lock(&hio_guard_lock); - cv_signal(&hio_guard_cond); - mtx_unlock(&hio_guard_lock); - } } /* @@ -1734,35 +1722,6 @@ free_queue: } static void -sighandler(int sig) -{ - bool unlock; - - switch (sig) { - case SIGINT: - case SIGTERM: - sigexit_received = true; - break; - case SIGHUP: - sighup_received = true; - break; - case SIGCHLD: - sigchld_received = true; - break; - default: - assert(!"invalid condition"); - } - /* - * Racy, but if we cannot obtain hio_guard_lock here, we don't - * want to risk deadlock. - */ - unlock = mtx_trylock(&hio_guard_lock); - cv_signal(&hio_guard_cond); - if (unlock) - mtx_unlock(&hio_guard_lock); -} - -static void config_reload(void) { struct hastd_config *newcfg; @@ -1973,48 +1932,48 @@ guard_thread(void *arg) { struct hast_resource *res = arg; unsigned int ii, ncomps; + struct timespec timeout; time_t lastcheck, now; - int timeout; + sigset_t mask; + int signo; ncomps = HAST_NCOMPONENTS; lastcheck = time(NULL); + PJDLOG_VERIFY(sigemptyset(&mask) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGTERM) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGCHLD) == 0); + + timeout.tv_nsec = 0; + signo = -1; + for (;;) { - if (sigexit_received) { + switch (signo) { + case SIGHUP: + config_reload(); + break; + case SIGINT: + case SIGTERM: + sigexit_received = true; primary_exitx(EX_OK, "Termination signal received, exiting."); + break; + default: + break; } - if (sighup_received) { - sighup_received = false; - config_reload(); - } - hook_check(sigchld_received); - if (sigchld_received) - sigchld_received = false; + hook_check(signo == SIGCHLD); pjdlog_debug(2, "remote_guard: Checking connections."); - mtx_lock(&hio_guard_lock); - timeout = KEEPALIVE_SLEEP; - for (ii = 0; ii < ncomps; ii++) { - if (!ISCONNECTED(res, ii)) { - timeout = RECONNECT_SLEEP; - break; - } - } now = time(NULL); - if (lastcheck + timeout <= now) { - timeout = KEEPALIVE_SLEEP; - for (ii = 0; ii < ncomps; ii++) { + if (lastcheck + RETRY_SLEEP <= now) { + for (ii = 0; ii < ncomps; ii++) guard_one(res, ii); - if (!ISCONNECTED(res, ii)) - timeout = RECONNECT_SLEEP; - } lastcheck = now; } - /* Sleep only if a signal wasn't delivered in the meantime. */ - if (!sigexit_received && !sighup_received && !sigchld_received) - cv_timedwait(&hio_guard_cond, &hio_guard_lock, timeout); - mtx_unlock(&hio_guard_lock); + timeout.tv_sec = RETRY_SLEEP; + signo = sigtimedwait(&mask, NULL, &timeout); } /* NOTREACHED */ return (NULL); From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 00:12:11 2010 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 6B20A1065696; Mon, 30 Aug 2010 00:12:11 +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 403EC8FC12; Mon, 30 Aug 2010 00:12:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U0CB6s078435; Mon, 30 Aug 2010 00:12:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U0CBoj078431; Mon, 30 Aug 2010 00:12:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008300012.o7U0CBoj078431@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 30 Aug 2010 00: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: r211983 - 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, 30 Aug 2010 00:12:11 -0000 Author: pjd Date: Mon Aug 30 00:12:10 2010 New Revision: 211983 URL: http://svn.freebsd.org/changeset/base/211983 Log: Execute hook when split-brain is detected. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/hast.conf.5 head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/hast.conf.5 ============================================================================== --- head/sbin/hastd/hast.conf.5 Mon Aug 30 00:06:05 2010 (r211982) +++ head/sbin/hastd/hast.conf.5 Mon Aug 30 00:12:10 2010 (r211983) @@ -232,6 +232,11 @@ between the nodes. .Pp Executed on both primary and secondary nodes when resource role is changed. .Pp +.It Ic " split-brain " +.Pp +Executed on both primary and secondary nodes when split-brain condition is +detected. +.Pp .El The .Aq path Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Mon Aug 30 00:06:05 2010 (r211982) +++ head/sbin/hastd/primary.c Mon Aug 30 00:12:10 2010 (r211983) @@ -498,6 +498,7 @@ init_remote(struct hast_resource *res, s assert(real_remote(res)); in = out = NULL; + errmsg = NULL; /* Prepare outgoing connection with remote node. */ if (proto_client(res->hr_remoteaddr, &out) < 0) { @@ -673,6 +674,8 @@ init_remote(struct hast_resource *res, s } return (true); close: + if (errmsg != NULL && strcmp(errmsg, "Split-brain condition!") == 0) + hook_exec(res->hr_exec, "split-brain", res->hr_name, NULL); proto_close(out); if (in != NULL) proto_close(in); Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Mon Aug 30 00:06:05 2010 (r211982) +++ head/sbin/hastd/secondary.c Mon Aug 30 00:12:10 2010 (r211983) @@ -323,6 +323,7 @@ init_remote(struct hast_resource *res, s if (res->hr_secondary_localcnt > res->hr_primary_remotecnt && res->hr_primary_localcnt > res->hr_secondary_remotecnt) { /* Exit on split-brain. */ + hook_exec(res->hr_exec, "split-brain", res->hr_name, NULL); exit(EX_CONFIG); } } @@ -373,6 +374,7 @@ hastd_secondary(struct hast_resource *re if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0) pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); + hook_init(); init_local(res); init_remote(res, nvin); init_environment(); From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 00:31:31 2010 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 3AE7A10656B2; Mon, 30 Aug 2010 00:31:31 +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 1FD818FC23; Mon, 30 Aug 2010 00:31:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U0VVjZ078939; Mon, 30 Aug 2010 00:31:31 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U0VUHn078935; Mon, 30 Aug 2010 00:31:30 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008300031.o7U0VUHn078935@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 30 Aug 2010 00:31: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: r211984 - 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, 30 Aug 2010 00:31:31 -0000 Author: pjd Date: Mon Aug 30 00:31:30 2010 New Revision: 211984 URL: http://svn.freebsd.org/changeset/base/211984 Log: Execute hook when connection between the nodes is established or lost. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/hast.conf.5 head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/hast.conf.5 ============================================================================== --- head/sbin/hastd/hast.conf.5 Mon Aug 30 00:12:10 2010 (r211983) +++ head/sbin/hastd/hast.conf.5 Mon Aug 30 00:31:30 2010 (r211984) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 29, 2010 +.Dd August 30, 2010 .Dt HAST.CONF 5 .Os .Sh NAME @@ -212,6 +212,20 @@ Execute the given program on various HAS Below is the list of currently implemented events and arguments the given program is executed with: .Bl -tag -width ".Ic xxxx" +.It Ic " role " +.Pp +Executed on both primary and secondary nodes when resource role is changed. +.Pp +.It Ic " connect " +.Pp +Executed on both primary and secondary nodes when connection for the given +resource between the nodes is established. +.Pp +.It Ic " disconnect " +.Pp +Executed on both primary and secondary nodes when connection for the given +resource between the nodes is lost. +.Pp .It Ic " syncstart " .Pp Executed on primary node when synchronization process of secondary node is @@ -228,10 +242,6 @@ Executed on primary node when synchroniz interrupted, most likely due to secondary node outage or connection failure between the nodes. .Pp -.It Ic " role " -.Pp -Executed on both primary and secondary nodes when resource role is changed. -.Pp .It Ic " split-brain " .Pp Executed on both primary and secondary nodes when split-brain condition is Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Mon Aug 30 00:12:10 2010 (r211983) +++ head/sbin/hastd/primary.c Mon Aug 30 00:31:30 2010 (r211984) @@ -672,6 +672,7 @@ init_remote(struct hast_resource *res, s res->hr_remotein = in; res->hr_remoteout = out; } + hook_exec(res->hr_exec, "connect", res->hr_name, NULL); return (true); close: if (errmsg != NULL && strcmp(errmsg, "Split-brain condition!") == 0) @@ -765,8 +766,6 @@ hastd_primary(struct hast_resource *res) pid_t pid; int error; - gres = res; - /* * Create communication channel between parent and child. */ @@ -788,6 +787,8 @@ hastd_primary(struct hast_resource *res) return; } + gres = res; + (void)pidfile_close(pfh); hook_fini(); @@ -894,6 +895,8 @@ remote_close(struct hast_resource *res, * Stop synchronization if in-progress. */ sync_stop(); + + hook_exec(res->hr_exec, "disconnect", res->hr_name, NULL); } /* Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Mon Aug 30 00:12:10 2010 (r211983) +++ head/sbin/hastd/secondary.c Mon Aug 30 00:31:30 2010 (r211984) @@ -74,6 +74,8 @@ struct hio { TAILQ_ENTRY(hio) hio_next; }; +static struct hast_resource *gres; + /* * Free list holds unused structures. When free list is empty, we have to wait * until some in-progress requests are freed. @@ -360,6 +362,8 @@ hastd_secondary(struct hast_resource *re return; } + gres = res; + (void)pidfile_close(pfh); hook_fini(); @@ -378,6 +382,7 @@ hastd_secondary(struct hast_resource *re init_local(res); init_remote(res, nvin); init_environment(); + hook_exec(res->hr_exec, "connect", res->hr_name, NULL); error = pthread_create(&td, NULL, recv_thread, res); assert(error == 0); @@ -501,6 +506,19 @@ end: return (hio->hio_error); } +static void +secondary_exit(int exitcode, const char *fmt, ...) +{ + va_list ap; + + assert(exitcode != EX_OK); + va_start(ap, fmt); + pjdlogv_errno(LOG_ERR, fmt, ap); + va_end(ap); + hook_exec(gres->hr_exec, "disconnect", gres->hr_name, NULL); + exit(exitcode); +} + /* * Thread receives requests from the primary node. */ @@ -515,7 +533,7 @@ recv_thread(void *arg) QUEUE_TAKE(free, hio); pjdlog_debug(2, "recv: (%p) Got request.", hio); if (hast_proto_recv_hdr(res->hr_remotein, &hio->hio_nv) < 0) { - pjdlog_exit(EX_TEMPFAIL, + secondary_exit(EX_TEMPFAIL, "Unable to receive request header"); } if (requnpack(res, hio) != 0) { @@ -537,7 +555,7 @@ recv_thread(void *arg) } else if (hio->hio_cmd == HIO_WRITE) { if (hast_proto_recv_data(res, res->hr_remotein, hio->hio_nv, hio->hio_data, MAXPHYS) < 0) { - pjdlog_exit(EX_TEMPFAIL, + secondary_exit(EX_TEMPFAIL, "Unable to receive reply data"); } } @@ -693,7 +711,7 @@ send_thread(void *arg) nv_add_int16(nvout, hio->hio_error, "error"); if (hast_proto_send(res, res->hr_remoteout, nvout, data, length) < 0) { - pjdlog_exit(EX_TEMPFAIL, "Unable to send reply."); + secondary_exit(EX_TEMPFAIL, "Unable to send reply."); } nv_free(nvout); pjdlog_debug(2, "send: (%p) Moving request to the free queue.", From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 00:45:45 2010 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 4D34510656B3; Mon, 30 Aug 2010 00:45:45 +0000 (UTC) (envelope-from pgollucci@p6m7g8.com) Received: from cell.p6m7g8.net (static-71-178-236-107.washdc.fios.verizon.net [71.178.236.107]) by mx1.freebsd.org (Postfix) with ESMTP id 016228FC15; Mon, 30 Aug 2010 00:45:44 +0000 (UTC) Received: from [192.168.1.4] (pool-173-66-132-185.washdc.fios.verizon.net [173.66.132.185]) (authenticated bits=0) by cell.p6m7g8.net (8.14.4/8.14.3) with ESMTP id o7U0KqRH095126 (version=TLSv1/SSLv3 cipher=DHE-DSS-CAMELLIA256-SHA bits=256 verify=NO); Mon, 30 Aug 2010 00:20:52 GMT (envelope-from pgollucci@p6m7g8.com) Message-ID: <4C7AF95F.40302@p6m7g8.com> Date: Sun, 29 Aug 2010 20:20:47 -0400 From: "Philip M. Gollucci" Organization: P6M7G8 Inc. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201008300012.o7U0CBoj078431@svn.freebsd.org> In-Reply-To: <201008300012.o7U0CBoj078431@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_00, FH_HOST_EQ_VERIZON_P, RCVD_IN_RP_RNBL, RCVD_IN_SORBS_DUL, RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cell.p6m7g8.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211983 - 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, 30 Aug 2010 00:45:45 -0000 On 8/29/2010 8:12 PM, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Aug 30 00:12:10 2010 > New Revision: 211983 > URL: http://svn.freebsd.org/changeset/base/211983 > > Log: > Execute hook when split-brain is detected. > > MFC after: 2 weeks > Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Do you work for them or something ? The site's not in english -- ------------------------------------------------------------------------ 1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C Philip M. Gollucci (pgollucci@p6m7g8.com) c: 703.336.9354 VP Apache Infrastructure; Member, Apache Software Foundation Committer, FreeBSD Foundation Consultant, P6M7G8 Inc. Sr. System Admin, Ridecharge Inc. Work like you don't need the money, love like you'll never get hurt, and dance like nobody's watching. From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 02:25:21 2010 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 94ED110656B1; Mon, 30 Aug 2010 02:25:21 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id B53158FC12; Mon, 30 Aug 2010 02:25:20 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id o7U21PUb052585 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 30 Aug 2010 11:31:31 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: multipart/signed; boundary=Apple-Mail-5--116193334; protocol="application/pkcs7-signature"; micalg=sha1 From: "Daniel O'Connor" In-Reply-To: <4C7AF95F.40302@p6m7g8.com> Date: Mon, 30 Aug 2010 11:31:24 +0930 Message-Id: <746DFDFE-E0BC-4D1A-9358-A194F71C66D2@gsoft.com.au> References: <201008300012.o7U0CBoj078431@svn.freebsd.org> <4C7AF95F.40302@p6m7g8.com> To: "Philip M. Gollucci" X-Mailer: Apple Mail (2.1081) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r211983 - 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, 30 Aug 2010 02:25:21 -0000 --Apple-Mail-5--116193334 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 30/08/2010, at 9:50, Philip M. Gollucci wrote: >> MFC after: 2 weeks >> Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com > Do you work for them or something ? > > The site's not in english It has an 'english version' link in the top right hand corner.. > > > -- > ------------------------------------------------------------------------ > 1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C > Philip M. Gollucci (pgollucci@p6m7g8.com) c: 703.336.9354 > VP Apache Infrastructure; Member, Apache Software Foundation > Committer, FreeBSD Foundation > Consultant, P6M7G8 Inc. > Sr. System Admin, Ridecharge Inc. > > Work like you don't need the money, > love like you'll never get hurt, > and dance like nobody's watching. > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C --Apple-Mail-5--116193334-- From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 06:10:05 2010 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 61C7B10656B0; Mon, 30 Aug 2010 06:10:05 +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 CED588FC18; Mon, 30 Aug 2010 06:10:04 +0000 (UTC) Received: from besplex.bde.org (c122-107-127-123.carlnfd1.nsw.optusnet.com.au [122.107.127.123]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o7U69sT3017083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 Aug 2010 16:09:56 +1000 Date: Mon, 30 Aug 2010 16:09:54 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Cran In-Reply-To: <20100829090607.00007cef@unknown> Message-ID: <20100830160829.U1510@besplex.bde.org> References: <201008281632.o7SGW18U036444@svn.freebsd.org> <20100829115717.G26978@delplex.bde.org> <20100829090607.00007cef@unknown> 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 , Bruce Cran Subject: Re: svn commit: r211936 - in head: bin/test lib/libc/net lib/libc/stdio lib/libc/stdlib lib/libc/sys lib/libipx libexec/ypxfr sbin/ipfw secure/lib/libcrypto/man share/man/man4 share/man/man9 usr.sbin/I... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 06:10:05 -0000 On Sun, 29 Aug 2010, Bruce Cran wrote: > On Sun, 29 Aug 2010 12:12:46 +1000 (EST) > Bruce Evans wrote: > >> On Sat, 28 Aug 2010, Bruce Cran wrote: >> >>> Log: >>> Fix incorrect usage of 'assure' and 'insure'. >> >> I think some of the `assure's are more correct than their replacement >> of `ensure'. The difference is subtle -- my small 1960's English >> ... > > After talking with other people I can see that quite a few probably > were correct - for example "assure a degree of consistency". > > Should all the assure -> ensure changes be reverted? Easier to revert them than to decide which are correct. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 07:02:47 2010 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 5D9D810656B8; Mon, 30 Aug 2010 07:02:47 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 076758FC19; Mon, 30 Aug 2010 07:02:46 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 6C69E45E13; Mon, 30 Aug 2010 09:02:45 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 6335445D8D; Mon, 30 Aug 2010 09:02:40 +0200 (CEST) Date: Mon, 30 Aug 2010 09:02:31 +0200 From: Pawel Jakub Dawidek To: "Philip M. Gollucci" Message-ID: <20100830070231.GA1462@garage.freebsd.pl> References: <201008300012.o7U0CBoj078431@svn.freebsd.org> <4C7AF95F.40302@p6m7g8.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline In-Reply-To: <4C7AF95F.40302@p6m7g8.com> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211983 - 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, 30 Aug 2010 07:02:47 -0000 --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 29, 2010 at 08:20:47PM -0400, Philip M. Gollucci wrote: > On 8/29/2010 8:12 PM, Pawel Jakub Dawidek wrote: > >Author: pjd > >Date: Mon Aug 30 00:12:10 2010 > >New Revision: 211983 > >URL: http://svn.freebsd.org/changeset/base/211983 > > > >Log: > > Execute hook when split-brain is detected. > > > > MFC after: 2 weeks > > Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com > Do you work for them or something ? Yes, I'm actually a co-founder. > The site's not in english Try "english version" in top right corner or ask:) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --UlVJffcvxoiEqYs2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkx7V4cACgkQForvXbEpPzROvgCfQ2U1NhFxd0hTvh/C4z0WZRvr /jEAnjXs6lPzM0KzUL5bGhlvSBdCoXPd =tmbD -----END PGP SIGNATURE----- --UlVJffcvxoiEqYs2-- From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 07:04:19 2010 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 DC61E106564A; Mon, 30 Aug 2010 07:04:19 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB4538FC13; Mon, 30 Aug 2010 07:04:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U74JJe086810; Mon, 30 Aug 2010 07:04:19 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U74JUD086808; Mon, 30 Aug 2010 07:04:19 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300704.o7U74JUD086808@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:04:19 +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: r211986 - stable/8/usr.sbin/mountd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 07:04:20 -0000 Author: maxim Date: Mon Aug 30 07:04:19 2010 New Revision: 211986 URL: http://svn.freebsd.org/changeset/base/211986 Log: MFC r209926: fix typo. Modified: stable/8/usr.sbin/mountd/exports.5 Directory Properties: stable/8/usr.sbin/mountd/ (props changed) Modified: stable/8/usr.sbin/mountd/exports.5 ============================================================================== --- stable/8/usr.sbin/mountd/exports.5 Mon Aug 30 06:50:33 2010 (r211985) +++ stable/8/usr.sbin/mountd/exports.5 Mon Aug 30 07:04:19 2010 (r211986) @@ -82,7 +82,7 @@ including regular files if the option is used on .Xr mountd 8 . The third form has the string ``V4:'' followed by a single absolute path -name, to sepcify the NFSv4 tree root. +name, to specify the NFSv4 tree root. The pathnames must not have any symbolic links in them and should not have any .Dq Pa \&. From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 07:06:27 2010 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 667BF106570A; Mon, 30 Aug 2010 07:06:27 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 557E78FC1B; Mon, 30 Aug 2010 07:06:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U76Ro3086907; Mon, 30 Aug 2010 07:06:27 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U76RfE086905; Mon, 30 Aug 2010 07:06:27 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300706.o7U76RfE086905@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:06: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: r211987 - stable/8/sbin/iscontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 07:06:27 -0000 Author: maxim Date: Mon Aug 30 07:06:27 2010 New Revision: 211987 URL: http://svn.freebsd.org/changeset/base/211987 Log: MFC r209972: restore missed flag in the synopsis. Modified: stable/8/sbin/iscontrol/iscontrol.8 Directory Properties: stable/8/sbin/iscontrol/ (props changed) Modified: stable/8/sbin/iscontrol/iscontrol.8 ============================================================================== --- stable/8/sbin/iscontrol/iscontrol.8 Mon Aug 30 07:04:19 2010 (r211986) +++ stable/8/sbin/iscontrol/iscontrol.8 Mon Aug 30 07:06:27 2010 (r211987) @@ -34,7 +34,7 @@ .Nm .Op Fl vd .Oo -.Op Fl Ar file +.Op Fl c Ar file .Op Fl n Ar nickname .Oc .Op Fl t Ar target From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 07:09:41 2010 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 40F7A106566C; Mon, 30 Aug 2010 07:09:41 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FF968FC1B; Mon, 30 Aug 2010 07:09:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U79f0R087011; Mon, 30 Aug 2010 07:09:41 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U79fvF087009; Mon, 30 Aug 2010 07:09:41 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300709.o7U79fvF087009@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:09:41 +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: r211988 - 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: Mon, 30 Aug 2010 07:09:41 -0000 Author: maxim Date: Mon Aug 30 07:09:40 2010 New Revision: 211988 URL: http://svn.freebsd.org/changeset/base/211988 Log: MFC r210000: correct path to include file. Modified: stable/8/share/man/man4/ath.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ath.4 ============================================================================== --- stable/8/share/man/man4/ath.4 Mon Aug 30 07:06:27 2010 (r211987) +++ stable/8/share/man/man4/ath.4 Mon Aug 30 07:09:40 2010 (r211988) @@ -207,7 +207,7 @@ ifconfig wlan0 create wlandev ath0 wlanm The Atheros Hardware Access Layer was unable to configure the hardware as requested. The status code is explained in the HAL include file -.Pa sys/contrib/dev/ath/ah.h . +.Pa sys/dev/ath/ath_hal/ah.h . .It "ath%d: failed to allocate descriptors: %d" The driver was unable to allocate contiguous memory for the transmit and receive descriptors. @@ -236,7 +236,7 @@ The driver will reset the hardware and c The Atheros Hardware Access Layer was unable to reset the hardware as requested. The status code is explained in the HAL include file -.Pa sys/contrib/dev/ath/ah.h . +.Pa sys/dev/ath/ath_hal/ah.h . This should not happen. .It "ath%d: unable to start recv logic" The driver was unable to restart frame reception. From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 07:11:13 2010 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 8B6B310656A9; Mon, 30 Aug 2010 07:11:13 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A5168FC14; Mon, 30 Aug 2010 07:11:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U7BDgu087114; Mon, 30 Aug 2010 07:11:13 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U7BDUU087112; Mon, 30 Aug 2010 07:11:13 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300711.o7U7BDUU087112@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:11: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: r211989 - 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: Mon, 30 Aug 2010 07:11:13 -0000 Author: maxim Date: Mon Aug 30 07:11:13 2010 New Revision: 211989 URL: http://svn.freebsd.org/changeset/base/211989 Log: MFC r210181: fix typo. Modified: stable/8/share/man/man4/u3g.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/u3g.4 ============================================================================== --- stable/8/share/man/man4/u3g.4 Mon Aug 30 07:09:40 2010 (r211988) +++ stable/8/share/man/man4/u3g.4 Mon Aug 30 07:11:13 2010 (r211989) @@ -93,7 +93,7 @@ device will attach temporarily to a 3G d force it to switch to modem mode, The attach and detach of .Xr u3gstub -and any driver disk device present on the 3G device is is hidden, unless the +and any driver disk device present on the 3G device is hidden, unless the machine was booted in verbose mode (see .Xr boot 8 ) . To temporarily unhide the device, set From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 07:29:27 2010 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 E922C1065698; Mon, 30 Aug 2010 07:29:27 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8A468FC17; Mon, 30 Aug 2010 07:29:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U7TRs2087491; Mon, 30 Aug 2010 07:29:27 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U7TRUU087488; Mon, 30 Aug 2010 07:29:27 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300729.o7U7TRUU087488@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 07:29: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: r211990 - head/sbin/kldload X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 07:29:28 -0000 Author: maxim Date: Mon Aug 30 07:29:27 2010 New Revision: 211990 URL: http://svn.freebsd.org/changeset/base/211990 Log: Make flags in usage() and SYNOPSYS more style(9)-ish. Suggested by: brian MFC after: 3 days Modified: head/sbin/kldload/kldload.8 head/sbin/kldload/kldload.c Modified: head/sbin/kldload/kldload.8 ============================================================================== --- head/sbin/kldload/kldload.8 Mon Aug 30 07:11:13 2010 (r211989) +++ head/sbin/kldload/kldload.8 Mon Aug 30 07:29:27 2010 (r211990) @@ -33,8 +33,7 @@ .Nd load a file into the kernel .Sh SYNOPSIS .Nm -.Op Fl v -.Op Fl q +.Op Fl qv .Ar .Sh DESCRIPTION The Modified: head/sbin/kldload/kldload.c ============================================================================== --- head/sbin/kldload/kldload.c Mon Aug 30 07:11:13 2010 (r211989) +++ head/sbin/kldload/kldload.c Mon Aug 30 07:29:27 2010 (r211990) @@ -129,7 +129,7 @@ path_check(const char *kldname, int quie static void usage(void) { - fprintf(stderr, "usage: kldload [-v] [-q] file ...\n"); + fprintf(stderr, "usage: kldload [-qv] file ...\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 08:01:16 2010 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 E316A10656AA; Mon, 30 Aug 2010 08:01:16 +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 5BB688FC19; Mon, 30 Aug 2010 08:01:15 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7U7xjX8023863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 Aug 2010 10:59:45 +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.4/8.14.4) with ESMTP id o7U7xjrF073778; Mon, 30 Aug 2010 10:59:45 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7U7xjaV073777; Mon, 30 Aug 2010 10:59:45 +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: Mon, 30 Aug 2010 10:59:45 +0300 From: Kostik Belousov To: Pawel Jakub Dawidek Message-ID: <20100830075945.GS2396@deviant.kiev.zoral.com.ua> References: <201008300006.o7U065Nu078151@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ijmMUc01C7g2hQX3" Content-Disposition: inline In-Reply-To: <201008300006.o7U065Nu078151@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=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_20, DNS_FROM_OPENWHOIS autolearn=no 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: r211982 - 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, 30 Aug 2010 08:01:17 -0000 --ijmMUc01C7g2hQX3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 30, 2010 at 12:06:05AM +0000, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Aug 30 00:06:05 2010 > New Revision: 211982 > URL: http://svn.freebsd.org/changeset/base/211982 >=20 > Log: > Use sigtimedwait(2) for signals handling in primary process. > This fixes various races and eliminates use of pthread* API in signal h= andler. Replying to the random commit. In the multithreaded process, after the fork in the child, you shall not call any not async-signal safe functions. I suppose that hook_execv() exposes the issue, calling into some stdio functions and sysconf(). --ijmMUc01C7g2hQX3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx7ZPEACgkQC3+MBN1Mb4jn1gCfV1x3LZxTn2tHTSLtTUc1hNa3 UB0Anj3R8XTolGSLCCP52gzqosFO+RUI =DUjF -----END PGP SIGNATURE----- --ijmMUc01C7g2hQX3-- From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 08:23:23 2010 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 0ADFF1065675; Mon, 30 Aug 2010 08:23:23 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE4168FC12; Mon, 30 Aug 2010 08:23:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U8NMMx088640; Mon, 30 Aug 2010 08:23:22 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U8NMLl088638; Mon, 30 Aug 2010 08:23:22 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008300823.o7U8NMLl088638@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 30 Aug 2010 08:23: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: r211991 - head/sys/mips/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: Mon, 30 Aug 2010 08:23:23 -0000 Author: jchandra Date: Mon Aug 30 08:23:22 2010 New Revision: 211991 URL: http://svn.freebsd.org/changeset/base/211991 Log: Remove misleading comment in pte.h. MIPS PTE entries are software managed and does not need atomics. Submitted by: alc Modified: head/sys/mips/include/pte.h Modified: head/sys/mips/include/pte.h ============================================================================== --- head/sys/mips/include/pte.h Mon Aug 30 07:29:27 2010 (r211990) +++ head/sys/mips/include/pte.h Mon Aug 30 08:23:22 2010 (r211991) @@ -130,9 +130,6 @@ typedef pt_entry_t *pd_entry_t; /* * PTE management functions for bits defined above. - * - * XXX Can make these atomics, but some users of them are using PTEs in local - * registers and such and don't need the overhead. */ #define pte_clear(pte, bit) (*(pte) &= ~(bit)) #define pte_set(pte, bit) (*(pte) |= (bit)) From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 09:29:52 2010 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 18CB610656AC; Mon, 30 Aug 2010 09:29:52 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 081668FC15; Mon, 30 Aug 2010 09:29:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7U9Tpah089947; Mon, 30 Aug 2010 09:29:51 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7U9Tp3H089945; Mon, 30 Aug 2010 09:29:51 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201008300929.o7U9Tp3H089945@svn.freebsd.org> From: Maxim Konovalov Date: Mon, 30 Aug 2010 09:29: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: r211992 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 09:29:52 -0000 Author: maxim Date: Mon Aug 30 09:29:51 2010 New Revision: 211992 URL: http://svn.freebsd.org/changeset/base/211992 Log: o Some programs could send broadcast/multicast traffic to ipfw pseudo-interface. This leads to a panic due to uninitialized if_broadcastaddr address. Initialize it and implement ip_output() method to prevent mbuf leak later. ipfw pseudo-interface should never send anything therefore call panic(9) in if_start() method. PR: kern/149807 Submitted by: Dmitrij Tejblum MFC after: 2 weeks Modified: head/sys/netinet/ipfw/ip_fw_log.c Modified: head/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_log.c Mon Aug 30 08:23:22 2010 (r211991) +++ head/sys/netinet/ipfw/ip_fw_log.c Mon Aug 30 09:29:51 2010 (r211992) @@ -103,6 +103,24 @@ log_dummy(struct ifnet *ifp, u_long cmd, return EINVAL; } +static int +ipfw_log_output(struct ifnet *ifp, struct mbuf *m, + struct sockaddr *dst, struct route *ro) +{ + if (m != NULL) + m_freem(m); + return EINVAL; +} + +static void +ipfw_log_start(struct ifnet* ifp) +{ + panic("ipfw_log_start() must not be called"); +} + +static const u_char ipfwbroadcastaddr[6] = + { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + void ipfw_log_bpf(int onoff) { @@ -119,11 +137,12 @@ ipfw_log_bpf(int onoff) ifp->if_flags = IFF_UP | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_init = (void *)log_dummy; ifp->if_ioctl = log_dummy; - ifp->if_start = (void *)log_dummy; - ifp->if_output = (void *)log_dummy; + ifp->if_start = ipfw_log_start; + ifp->if_output = ipfw_log_output; ifp->if_addrlen = 6; ifp->if_hdrlen = 14; if_attach(ifp); + ifp->if_broadcastaddr = ipfwbroadcastaddr; ifp->if_baudrate = IF_Mbps(10); bpfattach(ifp, DLT_EN10MB, 14); log_if = ifp; From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 10:30:35 2010 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 6237A10656B3; Mon, 30 Aug 2010 10:30:35 +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 509458FC16; Mon, 30 Aug 2010 10:30:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UAUZxD091129; Mon, 30 Aug 2010 10:30:35 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UAUZ55091126; Mon, 30 Aug 2010 10:30:35 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201008301030.o7UAUZ55091126@svn.freebsd.org> From: Attilio Rao Date: Mon, 30 Aug 2010 10:30: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: r211993 - stable/8/sys/cam X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 10:30:35 -0000 Author: attilio Date: Mon Aug 30 10:30:35 2010 New Revision: 211993 URL: http://svn.freebsd.org/changeset/base/211993 Log: MFC r208752, r209590: Protect periph drivers list and rearrange things to minimize the chance of stepping oneself during probing. Don't blindly decrement a periph probe count. Sponsored by: Sandvine Incorporated Modified: stable/8/sys/cam/cam_periph.c stable/8/sys/cam/cam_xpt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/cam_periph.c ============================================================================== --- stable/8/sys/cam/cam_periph.c Mon Aug 30 09:29:51 2010 (r211992) +++ stable/8/sys/cam/cam_periph.c Mon Aug 30 10:30:35 2010 (r211993) @@ -185,17 +185,6 @@ cam_periph_alloc(periph_ctor_t *periph_c init_level++; - xpt_lock_buses(); - for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { - if (strcmp((*p_drv)->driver_name, name) == 0) - break; - } - xpt_unlock_buses(); - if (*p_drv == NULL) { - printf("cam_periph_alloc: invalid periph name '%s'\n", name); - free(periph, M_CAMPERIPH); - return (CAM_REQ_INVALID); - } sim = xpt_path_sim(path); path_id = xpt_path_path_id(path); @@ -208,7 +197,6 @@ cam_periph_alloc(periph_ctor_t *periph_c periph->periph_oninval = periph_oninvalidate; periph->type = type; periph->periph_name = name; - periph->unit_number = camperiphunit(*p_drv, path_id, target_id, lun_id); periph->immediate_priority = CAM_PRIORITY_NONE; periph->refcount = 0; periph->sim = sim; @@ -216,26 +204,39 @@ cam_periph_alloc(periph_ctor_t *periph_c status = xpt_create_path(&path, periph, path_id, target_id, lun_id); if (status != CAM_REQ_CMP) goto failure; - periph->path = path; - init_level++; - - status = xpt_add_periph(periph); - - if (status != CAM_REQ_CMP) - goto failure; + xpt_lock_buses(); + for (p_drv = periph_drivers; *p_drv != NULL; p_drv++) { + if (strcmp((*p_drv)->driver_name, name) == 0) + break; + } + if (*p_drv == NULL) { + printf("cam_periph_alloc: invalid periph name '%s'\n", name); + xpt_free_path(periph->path); + free(periph, M_CAMPERIPH); + xpt_unlock_buses(); + return (CAM_REQ_INVALID); + } + periph->unit_number = camperiphunit(*p_drv, path_id, target_id, lun_id); cur_periph = TAILQ_FIRST(&(*p_drv)->units); while (cur_periph != NULL && cur_periph->unit_number < periph->unit_number) cur_periph = TAILQ_NEXT(cur_periph, unit_links); - - if (cur_periph != NULL) + if (cur_periph != NULL) { + KASSERT(cur_periph->unit_number != periph->unit_number, ("duplicate units on periph list")); TAILQ_INSERT_BEFORE(cur_periph, periph, unit_links); - else { + } else { TAILQ_INSERT_TAIL(&(*p_drv)->units, periph, unit_links); (*p_drv)->generation++; } + xpt_unlock_buses(); + + init_level++; + + status = xpt_add_periph(periph); + if (status != CAM_REQ_CMP) + goto failure; init_level++; @@ -250,10 +251,12 @@ failure: /* Initialized successfully */ break; case 3: - TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); xpt_remove_periph(periph); /* FALLTHROUGH */ case 2: + xpt_lock_buses(); + TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); + xpt_unlock_buses(); xpt_free_path(periph->path); /* FALLTHROUGH */ case 1: @@ -288,6 +291,7 @@ cam_periph_find(struct cam_path *path, c TAILQ_FOREACH(periph, &(*p_drv)->units, unit_links) { if (xpt_path_comp(periph->path, path) == 0) { xpt_unlock_buses(); + mtx_assert(periph->sim->mtx, MA_OWNED); return(periph); } } @@ -322,8 +326,13 @@ cam_periph_release_locked(struct cam_per return; xpt_lock_buses(); - if ((--periph->refcount == 0) - && (periph->flags & CAM_PERIPH_INVALID)) { + if (periph->refcount != 0) { + periph->refcount--; + } else { + xpt_print(periph->path, "%s: release %p when refcount is zero\n ", __func__, periph); + } + if (periph->refcount == 0 + && (periph->flags & CAM_PERIPH_INVALID)) { camperiphfree(periph); } xpt_unlock_buses(); Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Mon Aug 30 09:29:51 2010 (r211992) +++ stable/8/sys/cam/cam_xpt.c Mon Aug 30 10:30:35 2010 (r211993) @@ -2110,6 +2110,7 @@ xptpdperiphtraverse(struct periph_driver retval = 1; + xpt_lock_buses(); for (periph = (start_periph ? start_periph : TAILQ_FIRST(&(*pdrv)->units)); periph != NULL; periph = next_periph) { @@ -2117,9 +2118,12 @@ xptpdperiphtraverse(struct periph_driver next_periph = TAILQ_NEXT(periph, unit_links); retval = tr_func(periph, arg); - if (retval == 0) + if (retval == 0) { + xpt_unlock_buses(); return(retval); + } } + xpt_unlock_buses(); return(retval); } @@ -2295,7 +2299,6 @@ xpt_action_default(union ccb *start_ccb) CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action_default\n")); - switch (start_ccb->ccb_h.func_code) { case XPT_SCSI_IO: { From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 13:05:22 2010 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 30D751065670; Mon, 30 Aug 2010 13:05:22 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E6AC8FC13; Mon, 30 Aug 2010 13:05:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UD5MuF095545; Mon, 30 Aug 2010 13:05:22 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UD5LPV095529; Mon, 30 Aug 2010 13:05:21 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008301305.o7UD5LPV095529@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 30 Aug 2010 13:05: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: r211994 - in head/sys/mips/rmi: . dev/nlge dev/xlr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 13:05:22 -0000 Author: jchandra Date: Mon Aug 30 13:05:21 2010 New Revision: 211994 URL: http://svn.freebsd.org/changeset/base/211994 Log: Clean up header files in RMI platform code (sys/mips/rmi), and remove unused files. - remove clock.c and clock.h, these are not used after the new timer code was added. - remove duplicated include files, fix header file ordering, remove some unneeded includes. - rename mips/rmi/shared_structs.h which contains the RMI boot loader interface to mips/rmi/rmi_boot_info.h. Remove unused files mips/rmi/shared_structs_func.h and sys/mips/rmi/shared_structs_offsets.h - merge mips/rmi/xlrconfig.h and mips/rmi/rmi_mips_exts.h, and remove duplicated functions. - nlge - minor change to remove unneeded argument. - Add FreeBSD svn keyword for headers Added: head/sys/mips/rmi/rmi_boot_info.h - copied, changed from r211984, head/sys/mips/rmi/shared_structs.h Deleted: head/sys/mips/rmi/clock.c head/sys/mips/rmi/clock.h head/sys/mips/rmi/shared_structs.h head/sys/mips/rmi/shared_structs_func.h head/sys/mips/rmi/shared_structs_offsets.h head/sys/mips/rmi/xlrconfig.h Modified: head/sys/mips/rmi/board.c head/sys/mips/rmi/board.h head/sys/mips/rmi/debug.h head/sys/mips/rmi/dev/nlge/if_nlge.c head/sys/mips/rmi/dev/xlr/rge.c head/sys/mips/rmi/interrupt.h head/sys/mips/rmi/intr_machdep.c head/sys/mips/rmi/iodi.c head/sys/mips/rmi/iomap.h head/sys/mips/rmi/msgring.h head/sys/mips/rmi/pic.h head/sys/mips/rmi/rmi_mips_exts.h head/sys/mips/rmi/xlr_machdep.c head/sys/mips/rmi/xlr_pci.c Modified: head/sys/mips/rmi/board.c ============================================================================== --- head/sys/mips/rmi/board.c Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/board.c Mon Aug 30 13:05:21 2010 (r211994) @@ -38,9 +38,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include -#include static int xlr_rxstn_to_txstn_map[128] = { [0 ... 7] = TX_STN_CPU_0, Modified: head/sys/mips/rmi/board.h ============================================================================== --- head/sys/mips/rmi/board.h Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/board.h Mon Aug 30 13:05:21 2010 (r211994) @@ -104,10 +104,10 @@ xlr_processor_id(void) * These should come up in PCI device mode (not yet) */ static __inline__ int -xlr_board_pci(void) +xlr_board_pci(int board_major) { - return ((xlr_boot1_info.board_major_version == RMI_XLR_BOARD_ARIZONA_III) || - (xlr_boot1_info.board_major_version == RMI_XLR_BOARD_ARIZONA_V)); + return ((board_major == RMI_XLR_BOARD_ARIZONA_III) || + (board_major == RMI_XLR_BOARD_ARIZONA_V)); } static __inline__ int Modified: head/sys/mips/rmi/debug.h ============================================================================== --- head/sys/mips/rmi/debug.h Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/debug.h Mon Aug 30 13:05:21 2010 (r211994) @@ -26,7 +26,9 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * RMI_BSD */ + * RMI_BSD + * $FreeBSD$ + */ #ifndef _RMI_DEBUG_H_ #define _RMI_DEBUG_H_ Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Mon Aug 30 13:05:21 2010 (r211994) @@ -104,10 +104,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include +#include #include #include @@ -209,7 +208,7 @@ static int prepare_fmn_message(struct nl uint64_t fr_stid, struct nlge_tx_desc **tx_desc); static void release_mbuf(uint64_t phy_addr); -static void release_tx_desc(struct msgrng_msg *msg, int rel_buf); +static void release_tx_desc(struct msgrng_msg *msg); static int send_fmn_msg_tx(struct nlge_softc *, struct msgrng_msg *, uint32_t n_entries); @@ -679,7 +678,7 @@ nlge_msgring_handler(int bucket, int siz if (ctrl == CTRL_REG_FREE || ctrl == CTRL_JUMBO_FREE) { if (is_p2p) - release_tx_desc(msg, 1); + release_tx_desc(msg); else { release_mbuf(msg->msg0 & 0xffffffffffULL); } @@ -725,7 +724,7 @@ nlge_start_locked(struct ifnet *ifp, str cpu = xlr_core_id(); tid = xlr_thr_id(); - fr_stid = (cpu << 3) + tid + 4; /* Each CPU has 8 buckets. */ + fr_stid = cpu * 8 + tid + 4; if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { return; @@ -1909,9 +1908,9 @@ prepare_fmn_message(struct nlge_softc *s while (len) { if (msg_sz == (FMN_SZ - 1)) { - p2p = uma_zalloc(nl_tx_desc_zone, M_NOWAIT); - if (p2p == NULL) - return 2; + p2p = uma_zalloc(nl_tx_desc_zone, M_WAITOK); + if (p2p == NULL) + return 2; /* * As we currently use xlr_paddr_lw on a 32-bit * OS, both the pointers are laid out in one @@ -1929,7 +1928,7 @@ prepare_fmn_message(struct nlge_softc *s return 1; } paddr = vtophys(buf); - frag_sz = PAGE_SIZE - (buf & PAGE_MASK) ; + frag_sz = PAGE_SIZE - (buf & PAGE_MASK); if (len < frag_sz) frag_sz = len; *cur_p2d++ = (127ULL << 54) | ((uint64_t)frag_sz << 40) @@ -1993,7 +1992,7 @@ release_mbuf(uint64_t phy_addr) } static void -release_tx_desc(struct msgrng_msg *msg, int rel_buf) +release_tx_desc(struct msgrng_msg *msg) { vm_paddr_t paddr; uint64_t temp; @@ -2005,17 +2004,12 @@ release_tx_desc(struct msgrng_msg *msg, paddr += (XLR_MAX_TX_FRAGS * sizeof(uint64_t)); sr = xlr_enable_kx(); temp = xlr_paddr_lw(paddr); - mips_wr_status(sr); tx_desc = (struct nlge_tx_desc*)((intptr_t) temp); - - if (rel_buf) { - paddr += sizeof(void *); - sr = xlr_enable_kx(); - temp = xlr_paddr_lw(paddr); - mips_wr_status(sr); - m = (struct mbuf *)((intptr_t) temp); - m_freem(m); - } + paddr += sizeof(void *); + temp = xlr_paddr_lw(paddr); + mips_wr_status(sr); + m = (struct mbuf *)((intptr_t) temp); + m_freem(m); uma_zfree(nl_tx_desc_zone, tx_desc); } Modified: head/sys/mips/rmi/dev/xlr/rge.c ============================================================================== --- head/sys/mips/rmi/dev/xlr/rge.c Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/dev/xlr/rge.c Mon Aug 30 13:05:21 2010 (r211994) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -63,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include - #include #include @@ -87,27 +87,23 @@ __FBSDID("$FreeBSD$"); #include #include /* */ #include + +#include +#include +#include + #include #include #include #include #include -#include -#include +#include +#include #include - #include #include - -#include -#include -#include - -#include #include -/* #include "opt_rge.h" */ - #include "miibus_if.h" MODULE_DEPEND(rge, ether, 1, 1, 1); Modified: head/sys/mips/rmi/interrupt.h ============================================================================== --- head/sys/mips/rmi/interrupt.h Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/interrupt.h Mon Aug 30 13:05:21 2010 (r211994) @@ -25,8 +25,10 @@ * 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. - *__FBSDID("$FreeBSD$") - * RMI_BSD */ + * + * RMI_BSD + * $FreeBSD$ + */ #ifndef _RMI_INTERRUPT_H_ #define _RMI_INTERRUPT_H_ Modified: head/sys/mips/rmi/intr_machdep.c ============================================================================== --- head/sys/mips/rmi/intr_machdep.c Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/intr_machdep.c Mon Aug 30 13:05:21 2010 (r211994) @@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #include -#include #include struct xlr_intrsrc { Modified: head/sys/mips/rmi/iodi.c ============================================================================== --- head/sys/mips/rmi/iodi.c Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/iodi.c Mon Aug 30 13:05:21 2010 (r211994) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -48,28 +49,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include -#include -#include - - #include #include #include /* for DELAY */ -#include #include + +#include +#include #include #include #include -#include -#include -#include -#include -#include +#include #include #include Modified: head/sys/mips/rmi/iomap.h ============================================================================== --- head/sys/mips/rmi/iomap.h Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/iomap.h Mon Aug 30 13:05:21 2010 (r211994) @@ -26,7 +26,9 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * RMI_BSD */ + * RMI_BSD + * $FreeBSD$ + */ #ifndef _RMI_IOMAP_H_ #define _RMI_IOMAP_H_ Modified: head/sys/mips/rmi/msgring.h ============================================================================== --- head/sys/mips/rmi/msgring.h Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/msgring.h Mon Aug 30 13:05:21 2010 (r211994) @@ -25,13 +25,15 @@ * 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$ * - * RMI_BSD */ + * RMI_BSD + * $FreeBSD$ + */ #ifndef _RMI_MSGRING_H_ #define _RMI_MSGRING_H_ -#include +#include +#include #define MSGRNG_TX_BUF_REG 0 #define MSGRNG_RX_BUF_REG 1 @@ -368,9 +370,6 @@ message_send(unsigned int size, unsigned dest = ((size - 1) << 16) | (code << 8) | (stid); - //dbg_msg("Sending msg<%Lx,%Lx,%Lx,%Lx> to dest = %x\n", - //msg->msg0, msg->msg1, msg->msg2, msg->msg3, dest); - msgrng_send(dest); for (i = 0; i < 16; i++) { Modified: head/sys/mips/rmi/pic.h ============================================================================== --- head/sys/mips/rmi/pic.h Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/pic.h Mon Aug 30 13:05:21 2010 (r211994) @@ -25,9 +25,10 @@ * 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. - * __FBSDID("$FreeBSD$"); * - * RMI_BSD */ + * RMI_BSD + * $FreeBSD$ + */ #ifndef _RMI_PIC_H_ #define _RMI_PIC_H_ Copied and modified: head/sys/mips/rmi/rmi_boot_info.h (from r211984, head/sys/mips/rmi/shared_structs.h) ============================================================================== --- head/sys/mips/rmi/shared_structs.h Mon Aug 30 00:31:30 2010 (r211984, copy source) +++ head/sys/mips/rmi/rmi_boot_info.h Mon Aug 30 13:05:21 2010 (r211994) @@ -26,13 +26,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * RMI_BSD */ + * RMI_BSD + * $FreeBSD$ + */ #ifndef _SHARED_STRUCTS_H #define _SHARED_STRUCTS_H -/* If you make any changes to the below structs, shared_structs_offsets.h - * should be regenerated - */ #define BOOT1_INFO_VERSION 0x0001 struct boot1_info { Modified: head/sys/mips/rmi/rmi_mips_exts.h ============================================================================== --- head/sys/mips/rmi/rmi_mips_exts.h Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/rmi_mips_exts.h Mon Aug 30 13:05:21 2010 (r211994) @@ -26,27 +26,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * RMI_BSD */ + * RMI_BSD + * $FreeBSD$ + */ #ifndef __MIPS_EXTS_H__ #define __MIPS_EXTS_H__ -#define enable_KX(flags) __asm__ __volatile__ ( \ - ".set push\n" \ - ".set noat\n" \ - ".set noreorder\n" \ - "mfc0 %0, $12\n\t" \ - "ori $1, %0, 0x81\n\t" \ - "xori $1, 1\n\t" \ - "mtc0 $1, $12\n" \ - ".set pop\n" \ - : "=r"(flags) ) - -#define disable_KX(flags) __asm__ __volatile__ ( \ - ".set push\n" \ - "mtc0 %0, $12\n" \ - ".set pop\n" \ - : : "r"(flags) ) - #define CPU_BLOCKID_IFU 0 #define CPU_BLOCKID_ICU 1 #define CPU_BLOCKID_IEU 2 @@ -140,5 +125,327 @@ static __inline__ void write_64bit_phnx_ ); } +#define read_c0_register32(reg, sel) \ +({ unsigned int __rv; \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ + ".set mips32\n\t" \ + "mfc0\t%0,$%1,%2\n\t" \ + ".set\tpop" \ + : "=r" (__rv) : "i" (reg), "i" (sel) ); \ + __rv;}) + +#define write_c0_register32(reg, sel, value) \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ + ".set mips32\n\t" \ + "mtc0\t%0,$%1,%2\n\t" \ + ".set\tpop" \ + : : "r" (value), "i" (reg), "i" (sel) ); + +#define read_c0_register64(reg, sel) \ + ({ unsigned int __high, __low; \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ + ".set mips64\n\t" \ + "dmfc0\t $8, $%2, %3\n\t" \ + "dsrl32\t%0, $8, 0\n\t" \ + "dsll32\t$8, $8, 0\n\t" \ + "dsrl32\t%1, $8, 0\n\t" \ + ".set\tpop" \ + : "=r"(__high), "=r"(__low): "i"(reg), "i"(sel): "$8" );\ + (((unsigned long long)__high << 32) | __low);}) + +#define write_c0_register64(reg, sel, value) \ + do{ \ + unsigned int __high = val>>32; \ + unsigned int __low = val & 0xffffffff; \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ + ".set mips64\n\t" \ + "dsll32\t$8, %1, 0\n\t" \ + "dsll32\t$9, %0, 0\n\t" \ + "or\t $8, $8, $9\n\t" \ + "dmtc0\t $8, $%2, %3\n\t" \ + ".set\tpop" \ + :: "r"(high), "r"(low), "i"(reg), "i"(sel):"$8", "$9");\ + } while(0) + +#define read_c2_register32(reg, sel) \ +({ unsigned int __rv; \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ + ".set mips32\n\t" \ + "mfc2\t%0,$%1,%2\n\t" \ + ".set\tpop" \ + : "=r" (__rv) : "i" (reg), "i" (sel) ); \ + __rv;}) + +#define write_c2_register32(reg, sel, value) \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ + ".set mips32\n\t" \ + "mtc2\t%0,$%1,%2\n\t" \ + ".set\tpop" \ + : : "r" (value), "i" (reg), "i" (sel) ); + +#define read_c2_register64(reg, sel) \ + ({ unsigned int __high, __low; \ + __asm__ __volatile__( \ + ".set mips64\n\t" \ + "dmfc2\t $8, $%2, %3\n\t" \ + "dsrl32\t%0, $8, 0\n\t" \ + "dsll32\t$8, $8, 0\n\t" \ + "dsrl32\t%1, $8, 0\n\t" \ + ".set\tmips0" \ + : "=r"(__high), "=r"(__low): "i"(reg), "i"(sel): "$8" );\ + (((unsigned long long)__high << 32) | __low);}) + +#define write_c2_register64(reg, sel, value) \ + do{ \ + unsigned int __high = value>>32; \ + unsigned int __low = value & 0xffffffff; \ + __asm__ __volatile__( \ + ".set mips64\n\t" \ + "dsll32\t$8, %1, 0\n\t" \ + "dsll32\t$9, %0, 0\n\t" \ + "dsrl32\t$8, $8, 0\n\t" \ + "or\t $8, $8, $9\n\t" \ + "dmtc2\t $8, $%2, %3\n\t" \ + ".set\tmips0" \ + :: "r"(__high), "r"(__low), \ + "i"(reg), "i"(sel) \ + :"$8", "$9"); \ + } while(0) + +#define xlr_cpu_id() \ +({int __id; \ + __asm__ __volatile__ ( \ + ".set push\n" \ + ".set noreorder\n" \ + "mfc0 $8, $15, 1\n" \ + "andi %0, $8, 0x1f\n" \ + ".set pop\n" \ + : "=r" (__id) : : "$8"); \ + __id;}) + +#define xlr_core_id() \ +({int __id; \ + __asm__ __volatile__ ( \ + ".set push\n" \ + ".set noreorder\n" \ + "mfc0 $8, $15, 1\n" \ + "andi %0, $8, 0x1f\n" \ + ".set pop\n" \ + : "=r" (__id) : : "$8"); \ + __id/4;}) + +#define xlr_thr_id() \ +({int __id; \ + __asm__ __volatile__ ( \ + ".set push\n" \ + ".set noreorder\n" \ + "mfc0 $8, $15, 1\n" \ + "andi %0, $8, 0x3\n" \ + ".set pop\n" \ + : "=r" (__id) : : "$8"); \ + __id;}) + + +/* Additional registers on the XLR */ +#define MIPS_COP_0_OSSCRATCH 22 + +#define XLR_CACHELINE_SIZE 32 + +#define XLR_MAX_CORES 8 + +/* functions to write to and read from the extended + * cp0 registers. + * EIRR : Extended Interrupt Request Register + * cp0 register 9 sel 6 + * bits 0...7 are same as cause register 8...15 + * EIMR : Extended Interrupt Mask Register + * cp0 register 9 sel 7 + * bits 0...7 are same as status register 8...15 + */ + +static inline uint64_t +read_c0_eirr64(void) +{ + __uint32_t high, low; + + __asm__ __volatile__( + ".set push\n" + ".set noreorder\n" + ".set noat\n" + ".set mips4\n" + + ".word 0x40214806 \n\t" + "nop \n\t" + "dsra32 %0, $1, 0 \n\t" + "sll %1, $1, 0 \n\t" + + ".set pop\n" + + : "=r"(high), "=r"(low) + ); + + return (((__uint64_t) high) << 32) | low; +} + +static inline __uint64_t +read_c0_eimr64(void) +{ + __uint32_t high, low; + + __asm__ __volatile__( + ".set push\n" + ".set noreorder\n" + ".set noat\n" + ".set mips4\n" + + ".word 0x40214807 \n\t" + "nop \n\t" + "dsra32 %0, $1, 0 \n\t" + "sll %1, $1, 0 \n\t" + + ".set pop\n" + + : "=r"(high), "=r"(low) + ); + + return (((__uint64_t) high) << 32) | low; +} + +static inline void +write_c0_eirr64(__uint64_t value) +{ + __uint32_t low, high; + + high = value >> 32; + low = value & 0xffffffff; + + __asm__ __volatile__( + ".set push\n" + ".set noreorder\n" + ".set noat\n" + ".set mips4\n\t" + + "dsll32 $2, %1, 0 \n\t" + "dsll32 $1, %0, 0 \n\t" + "dsrl32 $2, $2, 0 \n\t" + "or $1, $1, $2 \n\t" + ".word 0x40a14806 \n\t" + "nop \n\t" + + ".set pop\n" + + : + : "r"(high), "r"(low) + : "$1", "$2"); +} + +static inline void +write_c0_eimr64(__uint64_t value) +{ + __uint32_t low, high; + + high = value >> 32; + low = value & 0xffffffff; + + __asm__ __volatile__( + ".set push\n" + ".set noreorder\n" + ".set noat\n" + ".set mips4\n\t" + + "dsll32 $2, %1, 0 \n\t" + "dsll32 $1, %0, 0 \n\t" + "dsrl32 $2, $2, 0 \n\t" + "or $1, $1, $2 \n\t" + ".word 0x40a14807 \n\t" + "nop \n\t" + + ".set pop\n" + + : + : "r"(high), "r"(low) + : "$1", "$2"); +} + +static __inline__ int +xlr_test_and_set(int *lock) +{ + int oldval = 0; + + __asm__ __volatile__(".set push\n" + ".set noreorder\n" + "move $9, %2\n" + "li $8, 1\n" + // "swapw $8, $9\n" + ".word 0x71280014\n" + "move %1, $8\n" + ".set pop\n" + : "+m"(*lock), "=r"(oldval) + : "r"((unsigned long)lock) + : "$8", "$9" + ); + + return (oldval == 0 ? 1 /* success */ : 0 /* failure */ ); +} + +static __inline__ uint32_t +xlr_mfcr(uint32_t reg) +{ + uint32_t val; + + __asm__ __volatile__( + "move $8, %1\n" + ".word 0x71090018\n" + "move %0, $9\n" + : "=r"(val) + : "r"(reg):"$8", "$9"); + + return val; +} + +static __inline__ void +xlr_mtcr(uint32_t reg, uint32_t val) +{ + __asm__ __volatile__( + "move $8, %1\n" + "move $9, %0\n" + ".word 0x71090019\n" + :: "r"(val), "r"(reg) + : "$8", "$9"); +} + +static __inline__ uint32_t +xlr_paddr_lw(uint64_t paddr) +{ + uint32_t high, low, tmp; + + high = 0x98000000 | (paddr >> 32); + low = paddr & 0xffffffff; + + __asm__ __volatile__( + ".set push \n\t" + ".set mips64 \n\t" + "dsll32 %1, %1, 0 \n\t" + "dsll32 %2, %2, 0 \n\t" /* get rid of the */ + "dsrl32 %2, %2, 0 \n\t" /* sign extend */ + "or %1, %1, %2 \n\t" + "lw %0, 0(%1) \n\t" + ".set pop \n" + : "=r"(tmp) + : "r"(high), "r"(low)); + + return tmp; +} + +/* for cpuid to hardware thread id mapping */ +extern uint32_t xlr_hw_thread_mask; +extern int xlr_cpuid_to_hwtid[]; +extern int xlr_hwtid_to_cpuid[]; #endif Modified: head/sys/mips/rmi/xlr_machdep.c ============================================================================== --- head/sys/mips/rmi/xlr_machdep.c Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/xlr_machdep.c Mon Aug 30 13:05:21 2010 (r211994) @@ -66,15 +66,14 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include #include -#include #include #include #include +#include +#include void mpwait(void); unsigned long xlr_io_base = (unsigned long)(DEFAULT_XLR_IO_BASE); Modified: head/sys/mips/rmi/xlr_pci.c ============================================================================== --- head/sys/mips/rmi/xlr_pci.c Mon Aug 30 10:30:35 2010 (r211993) +++ head/sys/mips/rmi/xlr_pci.c Mon Aug 30 13:05:21 2010 (r211994) @@ -38,23 +38,24 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include -#include -#include +#include + #include #include #include -#include #include #include +#include +#include +#include +#include + +#include +#include #include #include -#include #include #include From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 13:08:13 2010 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 EA0C71065672; Mon, 30 Aug 2010 13:08:13 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D930D8FC08; Mon, 30 Aug 2010 13:08:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UD8Dc1095626; Mon, 30 Aug 2010 13:08:13 GMT (envelope-from tijl@svn.freebsd.org) Received: (from tijl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UD8D3g095624; Mon, 30 Aug 2010 13:08:13 GMT (envelope-from tijl@svn.freebsd.org) Message-Id: <201008301308.o7UD8D3g095624@svn.freebsd.org> From: Tijl Coosemans Date: Mon, 30 Aug 2010 13:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211995 - stable/6/sys/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: Mon, 30 Aug 2010 13:08:14 -0000 Author: tijl Date: Mon Aug 30 13:08:13 2010 New Revision: 211995 URL: http://svn.freebsd.org/changeset/base/211995 Log: MFC r182959: Remove warning about static LDT segment allocation. Applications continue using it after ~7 years since warning was introduced, and there is no reason to discourage them. PR: kern/124111 Approved by: kib (mentor) Modified: stable/6/sys/i386/i386/sys_machdep.c Directory Properties: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/i386/i386/sys_machdep.c ============================================================================== --- stable/6/sys/i386/i386/sys_machdep.c Mon Aug 30 13:05:21 2010 (r211994) +++ stable/6/sys/i386/i386/sys_machdep.c Mon Aug 30 13:08:13 2010 (r211995) @@ -500,9 +500,6 @@ i386_get_ldt(td, uap) return(error); } -static int ldt_warnings; -#define NUM_LDT_WARNINGS 10 - int i386_set_ldt(td, uap, descs) struct thread *td; @@ -549,12 +546,6 @@ i386_set_ldt(td, uap, descs) } if (!(uap->start == LDT_AUTO_ALLOC && uap->num == 1)) { - /* complain a for a while if using old methods */ - if (ldt_warnings++ < NUM_LDT_WARNINGS) { - printf("Warning: pid %d used static ldt allocation.\n", - td->td_proc->p_pid); - printf("See the i386_set_ldt man page for more info\n"); - } /* verify range of descriptors to modify */ largest_ld = uap->start + uap->num; if (uap->start >= MAX_LD || From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 13:26:07 2010 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 BBF811065675; Mon, 30 Aug 2010 13:26:07 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA56F8FC12; Mon, 30 Aug 2010 13:26:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UDQ7oH096033; Mon, 30 Aug 2010 13:26:07 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UDQ70Z096028; Mon, 30 Aug 2010 13:26:07 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008301326.o7UDQ70Z096028@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 30 Aug 2010 13:26: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: r211996 - in head/sys/mips/rmi: . dev/nlge dev/xlr X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 13:26:07 -0000 Author: jchandra Date: Mon Aug 30 13:26:07 2010 New Revision: 211996 URL: http://svn.freebsd.org/changeset/base/211996 Log: Move debug.h to the the rge driver directory. rge.c is the only user of debug.h. Remove debug.h references from other files. Added: head/sys/mips/rmi/dev/xlr/debug.h - copied unchanged from r211994, head/sys/mips/rmi/debug.h Deleted: head/sys/mips/rmi/debug.h Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c head/sys/mips/rmi/dev/xlr/rge.c head/sys/mips/rmi/msgring.h Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Mon Aug 30 13:08:13 2010 (r211995) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Mon Aug 30 13:26:07 2010 (r211996) @@ -102,7 +102,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Copied: head/sys/mips/rmi/dev/xlr/debug.h (from r211994, head/sys/mips/rmi/debug.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/rmi/dev/xlr/debug.h Mon Aug 30 13:26:07 2010 (r211996, copy of r211994, head/sys/mips/rmi/debug.h) @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 2003-2009 RMI 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: + * 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. + * 3. Neither the name of RMI 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 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. + * + * RMI_BSD + * $FreeBSD$ + */ +#ifndef _RMI_DEBUG_H_ +#define _RMI_DEBUG_H_ + +#include + +enum { + //cacheline 0 + MSGRNG_INT, + MSGRNG_PIC_INT, + MSGRNG_MSG, + MSGRNG_EXIT_STATUS, + MSGRNG_MSG_CYCLES, + //cacheline 1 + NETIF_TX = 8, + NETIF_RX, + NETIF_TX_COMPLETE, + NETIF_TX_COMPLETE_TX, + NETIF_RX_CYCLES, + NETIF_TX_COMPLETE_CYCLES, + NETIF_TX_CYCLES, + NETIF_TIMER_START_Q, + //NETIF_REG_FRIN, + //NETIF_INT_REG, + //cacheline 2 + REPLENISH_ENTER = 16, + REPLENISH_ENTER_COUNT, + REPLENISH_CPU, + REPLENISH_FRIN, + REPLENISH_CYCLES, + NETIF_STACK_TX, + NETIF_START_Q, + NETIF_STOP_Q, + //cacheline 3 + USER_MAC_START = 24, + USER_MAC_INT = 24, + USER_MAC_TX_COMPLETE, + USER_MAC_RX, + USER_MAC_POLL, + USER_MAC_TX, + USER_MAC_TX_FAIL, + USER_MAC_TX_COUNT, + USER_MAC_FRIN, + //cacheline 4 + USER_MAC_TX_FAIL_GMAC_CREDITS = 32, + USER_MAC_DO_PAGE_FAULT, + USER_MAC_UPDATE_TLB, + USER_MAC_UPDATE_BIGTLB, + USER_MAC_UPDATE_TLB_PFN0, + USER_MAC_UPDATE_TLB_PFN1, + + XLR_MAX_COUNTERS = 40 +}; +extern int xlr_counters[MAXCPU][XLR_MAX_COUNTERS]; +extern __uint32_t msgrng_msg_cycles; + +#ifdef ENABLE_DEBUG +#define xlr_inc_counter(x) atomic_add_int(&xlr_counters[PCPU_GET(cpuid)][(x)], 1) +#define xlr_dec_counter(x) atomic_subtract_int(&xlr_counters[PCPU_GET(cpuid)][(x)], 1) +#define xlr_set_counter(x, value) atomic_set_int(&xlr_counters[PCPU_GET(cpuid)][(x)], (value)) +#define xlr_get_counter(x) (&xlr_counters[0][(x)]) + +#else /* default mode */ + +#define xlr_inc_counter(x) +#define xlr_dec_counter(x) +#define xlr_set_counter(x, value) +#define xlr_get_counter(x) + +#endif + +#define dbg_msg(fmt, args...) printf(fmt, ##args) +#define dbg_panic(fmt, args...) panic(fmt, ##args) + +#endif Modified: head/sys/mips/rmi/dev/xlr/rge.c ============================================================================== --- head/sys/mips/rmi/dev/xlr/rge.c Mon Aug 30 13:08:13 2010 (r211995) +++ head/sys/mips/rmi/dev/xlr/rge.c Mon Aug 30 13:26:07 2010 (r211996) @@ -95,11 +95,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include #include + +#include #include #include #include Modified: head/sys/mips/rmi/msgring.h ============================================================================== --- head/sys/mips/rmi/msgring.h Mon Aug 30 13:08:13 2010 (r211995) +++ head/sys/mips/rmi/msgring.h Mon Aug 30 13:26:07 2010 (r211996) @@ -374,18 +374,12 @@ message_send(unsigned int size, unsigned for (i = 0; i < 16; i++) { status = msgrng_read_status(); - //dbg_msg("status = %Lx\n", status); if (status & 0x6) { continue; } else break; } - if (i == 16) { - if (dest == 0x61) - //dbg_msg("Processor %x: Unable to send msg to %llx\n", processor_id(), dest); - return status & 0x6; - } return msgrng_read_status() & 0x06; } @@ -417,16 +411,10 @@ static __inline__ int message_receive(int pri, int *size, int *code, int *src_id, struct msgrng_msg *msg) { - int res = message_receive_fast(pri, *size, *code, *src_id, msg->msg0, msg->msg1, msg->msg2, msg->msg3); - -#ifdef MSGRING_DUMP_MESSAGES - if (!res) { - dbg_msg("Received msg <%llx, %llx, %llx, %llx> <%d,%d,%d>\n", - msg->msg0, msg->msg1, msg->msg2, msg->msg3, - *size, *code, *src_id); - } -#endif - + int res; + + res = message_receive_fast(pri, *size, *code, *src_id, + msg->msg0, msg->msg1, msg->msg2, msg->msg3); return res; } From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 14:24:44 2010 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 EE25E10656A5; Mon, 30 Aug 2010 14:24:44 +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 DE1E28FC1F; Mon, 30 Aug 2010 14:24:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UEOivh097376; Mon, 30 Aug 2010 14:24:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UEOiCC097374; Mon, 30 Aug 2010 14:24:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008301424.o7UEOiCC097374@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 30 Aug 2010 14:24: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: r211998 - 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, 30 Aug 2010 14:24:45 -0000 Author: kib Date: Mon Aug 30 14:24:44 2010 New Revision: 211998 URL: http://svn.freebsd.org/changeset/base/211998 Log: Make the syscalls reserved for AFS usable by OpenAFS port. Submitted by: Benjamin Kaduk MFC after: 2 weeks Modified: head/sys/kern/syscalls.master Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Mon Aug 30 14:04:29 2010 (r211997) +++ head/sys/kern/syscalls.master Mon Aug 30 14:24:44 2010 (r211998) @@ -594,7 +594,9 @@ 337 AUE_NULL STD { int kldsym(int fileid, int cmd, \ void *data); } 338 AUE_JAIL STD { int jail(struct jail *jail); } -339 AUE_NULL UNIMPL pioctl +339 AUE_NULL NOSTD|NOTSTATIC { int nnpfs_syscall(int operation, \ + char *a_pathP, int a_opcode, \ + void *a_paramsP, int a_followSymlinks); } 340 AUE_SIGPROCMASK STD { int sigprocmask(int how, \ const sigset_t *set, sigset_t *oset); } 341 AUE_SIGSUSPEND STD { int sigsuspend(const sigset_t *sigmask); } @@ -670,7 +672,9 @@ 374 AUE_NULL STD { int __setugid(int flag); } 375 AUE_NULL UNIMPL nfsclnt 376 AUE_EACCESS STD { int eaccess(char *path, int flags); } -377 AUE_NULL UNIMPL afs_syscall +377 AUE_NULL NOSTD|NOTSTATIC { int afs3_syscall(long syscall, \ + long parm1, long parm2, long parm3, \ + long parm4, long parm5, long parm6); } 378 AUE_NMOUNT STD { int nmount(struct iovec *iovp, \ unsigned int iovcnt, int flags); } 379 AUE_NULL UNIMPL kse_exit From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 14:26:02 2010 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 A132010656A6; Mon, 30 Aug 2010 14:26:02 +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 8FEC48FC23; Mon, 30 Aug 2010 14:26:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UEQ2RT097445; Mon, 30 Aug 2010 14:26:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UEQ2Q7097438; Mon, 30 Aug 2010 14:26:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201008301426.o7UEQ2Q7097438@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 30 Aug 2010 14:26: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: r211999 - 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: Mon, 30 Aug 2010 14:26:02 -0000 Author: kib Date: Mon Aug 30 14:26:02 2010 New Revision: 211999 URL: http://svn.freebsd.org/changeset/base/211999 Log: Regen Modified: head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Mon Aug 30 14:24:44 2010 (r211998) +++ head/sys/kern/init_sysent.c Mon Aug 30 14:26:02 2010 (r211999) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 209579 2010-06-28 18:06:46Z kib + * created from FreeBSD: head/sys/kern/syscalls.master 211998 2010-08-30 14:24:44Z kib */ #include "opt_compat.h" @@ -373,7 +373,7 @@ struct sysent sysent[] = { { compat4(AS(freebsd4_sendfile_args),sendfile), AUE_SENDFILE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 336 = freebsd4 sendfile */ { AS(kldsym_args), (sy_call_t *)kldsym, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 337 = kldsym */ { AS(jail_args), (sy_call_t *)jail, AUE_JAIL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 338 = jail */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 339 = pioctl */ + { AS(nnpfs_syscall_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 339 = nnpfs_syscall */ { AS(sigprocmask_args), (sy_call_t *)sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 340 = sigprocmask */ { AS(sigsuspend_args), (sy_call_t *)sigsuspend, AUE_SIGSUSPEND, NULL, 0, 0, 0, SY_THR_STATIC }, /* 341 = sigsuspend */ { compat4(AS(freebsd4_sigaction_args),sigaction), AUE_SIGACTION, NULL, 0, 0, 0, SY_THR_STATIC }, /* 342 = freebsd4 sigaction */ @@ -411,7 +411,7 @@ struct sysent sysent[] = { { AS(__setugid_args), (sy_call_t *)__setugid, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 374 = __setugid */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 375 = nfsclnt */ { AS(eaccess_args), (sy_call_t *)eaccess, AUE_EACCESS, NULL, 0, 0, 0, SY_THR_STATIC }, /* 376 = eaccess */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 377 = afs_syscall */ + { AS(afs3_syscall_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 377 = afs3_syscall */ { AS(nmount_args), (sy_call_t *)nmount, AUE_NMOUNT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 378 = nmount */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 379 = kse_exit */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 380 = kse_wakeup */ Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Mon Aug 30 14:24:44 2010 (r211998) +++ head/sys/kern/syscalls.c Mon Aug 30 14:26:02 2010 (r211999) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 209579 2010-06-28 18:06:46Z kib + * created from FreeBSD: head/sys/kern/syscalls.master 211998 2010-08-30 14:24:44Z kib */ const char *syscallnames[] = { @@ -346,7 +346,7 @@ const char *syscallnames[] = { "compat4.sendfile", /* 336 = freebsd4 sendfile */ "kldsym", /* 337 = kldsym */ "jail", /* 338 = jail */ - "#339", /* 339 = pioctl */ + "nnpfs_syscall", /* 339 = nnpfs_syscall */ "sigprocmask", /* 340 = sigprocmask */ "sigsuspend", /* 341 = sigsuspend */ "compat4.sigaction", /* 342 = freebsd4 sigaction */ @@ -384,7 +384,7 @@ const char *syscallnames[] = { "__setugid", /* 374 = __setugid */ "#375", /* 375 = nfsclnt */ "eaccess", /* 376 = eaccess */ - "#377", /* 377 = afs_syscall */ + "afs3_syscall", /* 377 = afs3_syscall */ "nmount", /* 378 = nmount */ "#379", /* 379 = kse_exit */ "#380", /* 380 = kse_wakeup */ Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Mon Aug 30 14:24:44 2010 (r211998) +++ head/sys/kern/systrace_args.c Mon Aug 30 14:26:02 2010 (r211999) @@ -1770,6 +1770,17 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } + /* nnpfs_syscall */ + case 339: { + struct nnpfs_syscall_args *p = params; + iarg[0] = p->operation; /* int */ + uarg[1] = (intptr_t) p->a_pathP; /* char * */ + iarg[2] = p->a_opcode; /* int */ + uarg[3] = (intptr_t) p->a_paramsP; /* void * */ + iarg[4] = p->a_followSymlinks; /* int */ + *n_args = 5; + break; + } /* sigprocmask */ case 340: { struct sigprocmask_args *p = params; @@ -2011,6 +2022,19 @@ systrace_args(int sysnum, void *params, *n_args = 2; break; } + /* afs3_syscall */ + case 377: { + struct afs3_syscall_args *p = params; + iarg[0] = p->syscall; /* long */ + iarg[1] = p->parm1; /* long */ + iarg[2] = p->parm2; /* long */ + iarg[3] = p->parm3; /* long */ + iarg[4] = p->parm4; /* long */ + iarg[5] = p->parm5; /* long */ + iarg[6] = p->parm6; /* long */ + *n_args = 7; + break; + } /* nmount */ case 378: { struct nmount_args *p = params; @@ -5900,6 +5924,28 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* nnpfs_syscall */ + case 339: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "char *"; + break; + case 2: + p = "int"; + break; + case 3: + p = "void *"; + break; + case 4: + p = "int"; + break; + default: + break; + }; + break; /* sigprocmask */ case 340: switch(ndx) { @@ -6325,6 +6371,34 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* afs3_syscall */ + case 377: + switch(ndx) { + case 0: + p = "long"; + break; + case 1: + p = "long"; + break; + case 2: + p = "long"; + break; + case 3: + p = "long"; + break; + case 4: + p = "long"; + break; + case 5: + p = "long"; + break; + case 6: + p = "long"; + break; + default: + break; + }; + break; /* nmount */ case 378: switch(ndx) { Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Mon Aug 30 14:24:44 2010 (r211998) +++ head/sys/sys/syscall.h Mon Aug 30 14:26:02 2010 (r211999) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 209579 2010-06-28 18:06:46Z kib + * created from FreeBSD: head/sys/kern/syscalls.master 211998 2010-08-30 14:24:44Z kib */ #define SYS_syscall 0 @@ -277,6 +277,7 @@ #define SYS_freebsd4_sendfile 336 #define SYS_kldsym 337 #define SYS_jail 338 +#define SYS_nnpfs_syscall 339 #define SYS_sigprocmask 340 #define SYS_sigsuspend 341 #define SYS_freebsd4_sigaction 342 @@ -306,6 +307,7 @@ #define SYS_extattr_delete_fd 373 #define SYS___setugid 374 #define SYS_eaccess 376 +#define SYS_afs3_syscall 377 #define SYS_nmount 378 #define SYS___mac_get_proc 384 #define SYS___mac_set_proc 385 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Mon Aug 30 14:24:44 2010 (r211998) +++ head/sys/sys/syscall.mk Mon Aug 30 14:26:02 2010 (r211999) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 209579 2010-06-28 18:06:46Z kib +# created from FreeBSD: head/sys/kern/syscalls.master 211998 2010-08-30 14:24:44Z kib MIASM = \ syscall.o \ exit.o \ @@ -226,6 +226,7 @@ MIASM = \ freebsd4_sendfile.o \ kldsym.o \ jail.o \ + nnpfs_syscall.o \ sigprocmask.o \ sigsuspend.o \ freebsd4_sigaction.o \ @@ -255,6 +256,7 @@ MIASM = \ extattr_delete_fd.o \ __setugid.o \ eaccess.o \ + afs3_syscall.o \ nmount.o \ __mac_get_proc.o \ __mac_set_proc.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Mon Aug 30 14:24:44 2010 (r211998) +++ head/sys/sys/sysproto.h Mon Aug 30 14:26:02 2010 (r211999) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 209579 2010-06-28 18:06:46Z kib + * created from FreeBSD: head/sys/kern/syscalls.master 211998 2010-08-30 14:24:44Z kib */ #ifndef _SYS_SYSPROTO_H_ @@ -933,6 +933,13 @@ struct kldsym_args { struct jail_args { char jail_l_[PADL_(struct jail *)]; struct jail * jail; char jail_r_[PADR_(struct jail *)]; }; +struct nnpfs_syscall_args { + char operation_l_[PADL_(int)]; int operation; char operation_r_[PADR_(int)]; + char a_pathP_l_[PADL_(char *)]; char * a_pathP; char a_pathP_r_[PADR_(char *)]; + char a_opcode_l_[PADL_(int)]; int a_opcode; char a_opcode_r_[PADR_(int)]; + char a_paramsP_l_[PADL_(void *)]; void * a_paramsP; char a_paramsP_r_[PADR_(void *)]; + char a_followSymlinks_l_[PADL_(int)]; int a_followSymlinks; char a_followSymlinks_r_[PADR_(int)]; +}; struct sigprocmask_args { char how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)]; char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)]; @@ -1068,6 +1075,15 @@ struct eaccess_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; }; +struct afs3_syscall_args { + char syscall_l_[PADL_(long)]; long syscall; char syscall_r_[PADR_(long)]; + char parm1_l_[PADL_(long)]; long parm1; char parm1_r_[PADR_(long)]; + char parm2_l_[PADL_(long)]; long parm2; char parm2_r_[PADR_(long)]; + char parm3_l_[PADL_(long)]; long parm3; char parm3_r_[PADR_(long)]; + char parm4_l_[PADL_(long)]; long parm4; char parm4_r_[PADR_(long)]; + char parm5_l_[PADL_(long)]; long parm5; char parm5_r_[PADR_(long)]; + char parm6_l_[PADL_(long)]; long parm6; char parm6_r_[PADR_(long)]; +}; struct nmount_args { char iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)]; char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)]; @@ -1858,6 +1874,7 @@ int sched_rr_get_interval(struct thread int utrace(struct thread *, struct utrace_args *); int kldsym(struct thread *, struct kldsym_args *); int jail(struct thread *, struct jail_args *); +int nnpfs_syscall(struct thread *, struct nnpfs_syscall_args *); int sigprocmask(struct thread *, struct sigprocmask_args *); int sigsuspend(struct thread *, struct sigsuspend_args *); int sigpending(struct thread *, struct sigpending_args *); @@ -1885,6 +1902,7 @@ int extattr_get_fd(struct thread *, stru int extattr_delete_fd(struct thread *, struct extattr_delete_fd_args *); int __setugid(struct thread *, struct __setugid_args *); int eaccess(struct thread *, struct eaccess_args *); +int afs3_syscall(struct thread *, struct afs3_syscall_args *); int nmount(struct thread *, struct nmount_args *); int __mac_get_proc(struct thread *, struct __mac_get_proc_args *); int __mac_set_proc(struct thread *, struct __mac_set_proc_args *); @@ -2529,6 +2547,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_freebsd4_sendfile AUE_SENDFILE #define SYS_AUE_kldsym AUE_NULL #define SYS_AUE_jail AUE_JAIL +#define SYS_AUE_nnpfs_syscall AUE_NULL #define SYS_AUE_sigprocmask AUE_SIGPROCMASK #define SYS_AUE_sigsuspend AUE_SIGSUSPEND #define SYS_AUE_freebsd4_sigaction AUE_SIGACTION @@ -2558,6 +2577,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_extattr_delete_fd AUE_EXTATTR_DELETE_FD #define SYS_AUE___setugid AUE_NULL #define SYS_AUE_eaccess AUE_EACCESS +#define SYS_AUE_afs3_syscall AUE_NULL #define SYS_AUE_nmount AUE_NMOUNT #define SYS_AUE___mac_get_proc AUE_NULL #define SYS_AUE___mac_set_proc AUE_NULL From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 14:44:23 2010 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 0E104106564A; Mon, 30 Aug 2010 14:44:23 +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 F12ED8FC1D; Mon, 30 Aug 2010 14:44:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UEiMOW097895; Mon, 30 Aug 2010 14:44:22 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UEiM46097893; Mon, 30 Aug 2010 14:44:22 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201008301444.o7UEiM46097893@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 30 Aug 2010 14:44: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: r212000 - stable/8/sbin/bsdlabel X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 14:44:23 -0000 Author: jh Date: Mon Aug 30 14:44:22 2010 New Revision: 212000 URL: http://svn.freebsd.org/changeset/base/212000 Log: MFC r211342: - Check that strtoul(3) succeeds to convert the entire string in a few places. - In getasciilabel(), set the disk type only when a valid type is given. PR: bin/86765 Modified: stable/8/sbin/bsdlabel/bsdlabel.c Directory Properties: stable/8/sbin/bsdlabel/ (props changed) Modified: stable/8/sbin/bsdlabel/bsdlabel.c ============================================================================== --- stable/8/sbin/bsdlabel/bsdlabel.c Mon Aug 30 14:26:02 2010 (r211999) +++ stable/8/sbin/bsdlabel/bsdlabel.c Mon Aug 30 14:44:22 2010 (r212000) @@ -749,7 +749,7 @@ word(char *cp) static int getasciilabel(FILE *f, struct disklabel *lp) { - char *cp; + char *cp, *endp; const char **cpp; u_int part; char *tp, line[BUFSIZ]; @@ -788,11 +788,15 @@ getasciilabel(FILE *f, struct disklabel } if (cpp < &dktypenames[DKMAXTYPES]) continue; - v = strtoul(tp, NULL, 10); + errno = 0; + v = strtoul(tp, &endp, 10); + if (errno != 0 || *endp != '\0') + v = DKMAXTYPES; if (v >= DKMAXTYPES) fprintf(stderr, "line %d:%s %lu\n", lineno, "Warning, unknown disk type", v); - lp->d_type = v; + else + lp->d_type = v; continue; } if (!strcmp(cp, "flags")) { @@ -1017,7 +1021,7 @@ static int getasciipartspec(char *tp, struct disklabel *lp, int part, int lineno) { struct partition *pp; - char *cp; + char *cp, *endp; const char **cpp; u_long v; @@ -1053,9 +1057,12 @@ getasciipartspec(char *tp, struct diskla if (*cpp != NULL) { pp->p_fstype = cpp - fstypenames; } else { - if (isdigit(*cp)) - v = strtoul(cp, NULL, 10); - else + if (isdigit(*cp)) { + errno = 0; + v = strtoul(cp, &endp, 10); + if (errno != 0 || *endp != '\0') + v = FSMAXTYPES; + } else v = FSMAXTYPES; if (v >= FSMAXTYPES) { fprintf(stderr, From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 16:30:18 2010 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 97F17106564A; Mon, 30 Aug 2010 16:30:18 +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 868678FC17; Mon, 30 Aug 2010 16:30:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UGUIoD000762; Mon, 30 Aug 2010 16:30:18 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UGUIK9000756; Mon, 30 Aug 2010 16:30:18 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201008301630.o7UGUIK9000756@svn.freebsd.org> From: Jaakko Heinonen Date: Mon, 30 Aug 2010 16:30: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: r212002 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs 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, 30 Aug 2010 16:30:18 -0000 Author: jh Date: Mon Aug 30 16:30:18 2010 New Revision: 212002 URL: http://svn.freebsd.org/changeset/base/212002 Log: execve(2) has a special check for file permissions: a file must have at least one execute bit set, otherwise execve(2) will return EACCES even for an user with PRIV_VFS_EXEC privilege. Add the check also to vaccess(9), vaccess_acl_nfs4(9) and vaccess_acl_posix1e(9). This makes access(2) to better agree with execve(2). Because ZFS doesn't use vaccess(9) for VEXEC, add the check to zfs_freebsd_access() too. There may be other file systems which are not using vaccess*() functions and need to be handled separately. PR: kern/125009 Reviewed by: bde, trasz Approved by: pjd (ZFS part) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/kern/kern_exec.c head/sys/kern/subr_acl_nfs4.c head/sys/kern/subr_acl_posix1e.c head/sys/kern/vfs_subr.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 30 15:06:55 2010 (r212001) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Aug 30 16:30:18 2010 (r212002) @@ -4247,6 +4247,9 @@ zfs_freebsd_access(ap) struct thread *a_td; } */ *ap; { + vnode_t *vp = ap->a_vp; + znode_t *zp = VTOZ(vp); + znode_phys_t *zphys = zp->z_phys; accmode_t accmode; int error = 0; @@ -4263,16 +4266,20 @@ zfs_freebsd_access(ap) if (error == 0) { accmode = ap->a_accmode & ~(VREAD|VWRITE|VEXEC|VAPPEND); if (accmode != 0) { - vnode_t *vp = ap->a_vp; - znode_t *zp = VTOZ(vp); - znode_phys_t *zphys = zp->z_phys; - error = vaccess(vp->v_type, zphys->zp_mode, zphys->zp_uid, zphys->zp_gid, accmode, ap->a_cred, NULL); } } + /* + * For VEXEC, ensure that at least one execute bit is set for + * non-directories. + */ + if (error == 0 && (ap->a_accmode & VEXEC) != 0 && vp->v_type != VDIR && + (zphys->zp_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) + error = EACCES; + return (error); } Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Aug 30 15:06:55 2010 (r212001) +++ head/sys/kern/kern_exec.c Mon Aug 30 16:30:18 2010 (r212002) @@ -1363,17 +1363,17 @@ exec_check_permissions(imgp) if (error) return (error); #endif - + /* - * 1) Check if file execution is disabled for the filesystem that this - * file resides on. - * 2) Insure that at least one execute bit is on - otherwise root - * will always succeed, and we don't want to happen unless the - * file really is executable. - * 3) Insure that the file is a regular file. + * 1) Check if file execution is disabled for the filesystem that + * this file resides on. + * 2) Ensure that at least one execute bit is on. Otherwise, a + * privileged user will always succeed, and we don't want this + * to happen unless the file really is executable. + * 3) Ensure that the file is a regular file. */ if ((vp->v_mount->mnt_flag & MNT_NOEXEC) || - ((attr->va_mode & 0111) == 0) || + (attr->va_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0 || (attr->va_type != VREG)) return (EACCES); Modified: head/sys/kern/subr_acl_nfs4.c ============================================================================== --- head/sys/kern/subr_acl_nfs4.c Mon Aug 30 15:06:55 2010 (r212001) +++ head/sys/kern/subr_acl_nfs4.c Mon Aug 30 16:30:18 2010 (r212002) @@ -162,6 +162,7 @@ vaccess_acl_nfs4(enum vtype type, uid_t accmode_t priv_granted = 0; int denied, explicitly_denied, access_mask, is_directory, must_be_owner = 0; + mode_t file_mode; KASSERT((accmode & ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND | VEXPLICIT_DENY | VREAD_NAMED_ATTRS | VWRITE_NAMED_ATTRS | @@ -216,6 +217,17 @@ vaccess_acl_nfs4(enum vtype type, uid_t denied = EPERM; } + /* + * For VEXEC, ensure that at least one execute bit is set for + * non-directories. We have to check the mode here to stay + * consistent with execve(2). See the test in + * exec_check_permissions(). + */ + acl_nfs4_sync_mode_from_acl(&file_mode, aclp); + if (!denied && !is_directory && (accmode & VEXEC) && + (file_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0) + denied = EACCES; + if (!denied) return (0); @@ -236,8 +248,14 @@ vaccess_acl_nfs4(enum vtype type, uid_t PRIV_VFS_LOOKUP, 0)) priv_granted |= VEXEC; } else { - if ((accmode & VEXEC) && !priv_check_cred(cred, - PRIV_VFS_EXEC, 0)) + /* + * Ensure that at least one execute bit is on. Otherwise, + * a privileged user will always succeed, and we don't want + * this to happen unless the file really is executable. + */ + if ((accmode & VEXEC) && (file_mode & + (S_IXUSR | S_IXGRP | S_IXOTH)) != 0 && + !priv_check_cred(cred, PRIV_VFS_EXEC, 0)) priv_granted |= VEXEC; } Modified: head/sys/kern/subr_acl_posix1e.c ============================================================================== --- head/sys/kern/subr_acl_posix1e.c Mon Aug 30 15:06:55 2010 (r212001) +++ head/sys/kern/subr_acl_posix1e.c Mon Aug 30 16:30:18 2010 (r212002) @@ -90,8 +90,14 @@ vaccess_acl_posix1e(enum vtype type, uid PRIV_VFS_LOOKUP, 0)) priv_granted |= VEXEC; } else { - if ((accmode & VEXEC) && !priv_check_cred(cred, - PRIV_VFS_EXEC, 0)) + /* + * Ensure that at least one execute bit is on. Otherwise, + * a privileged user will always succeed, and we don't want + * this to happen unless the file really is executable. + */ + if ((accmode & VEXEC) && (acl_posix1e_acl_to_mode(acl) & + (S_IXUSR | S_IXGRP | S_IXOTH)) != 0 && + !priv_check_cred(cred, PRIV_VFS_EXEC, 0)) priv_granted |= VEXEC; } Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Mon Aug 30 15:06:55 2010 (r212001) +++ head/sys/kern/vfs_subr.c Mon Aug 30 16:30:18 2010 (r212002) @@ -3619,7 +3619,13 @@ privcheck: !priv_check_cred(cred, PRIV_VFS_LOOKUP, 0)) priv_granted |= VEXEC; } else { + /* + * Ensure that at least one execute bit is on. Otherwise, + * a privileged user will always succeed, and we don't want + * this to happen unless the file really is executable. + */ if ((accmode & VEXEC) && ((dac_granted & VEXEC) == 0) && + (file_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0 && !priv_check_cred(cred, PRIV_VFS_EXEC, 0)) priv_granted |= VEXEC; } From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 17:34:59 2010 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 DBA0D1065670; Mon, 30 Aug 2010 17:34:59 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAE598FC17; Mon, 30 Aug 2010 17:34:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UHYxqq002154; Mon, 30 Aug 2010 17:34:59 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UHYxlL002152; Mon, 30 Aug 2010 17:34:59 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008301734.o7UHYxlL002152@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 30 Aug 2010 17:34:59 +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: r212003 - stable/8/sys/compat/x86bios X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 17:35:00 -0000 Author: jkim Date: Mon Aug 30 17:34:59 2010 New Revision: 212003 URL: http://svn.freebsd.org/changeset/base/212003 Log: MFC: r211823 Check opcode for short jump as well. Some option ROMs do short jumps (e.g., some NVIDIA video cards) and we were not able to do POST while resuming because we only honored long jump. Modified: stable/8/sys/compat/x86bios/x86bios.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/compat/x86bios/x86bios.c ============================================================================== --- stable/8/sys/compat/x86bios/x86bios.c Mon Aug 30 16:30:18 2010 (r212002) +++ stable/8/sys/compat/x86bios/x86bios.c Mon Aug 30 17:34:59 2010 (r212003) @@ -446,7 +446,8 @@ x86bios_get_orm(uint32_t offset) /* Does the shadow ROM contain BIOS POST code for x86? */ p = x86bios_offset(offset); - if (p == NULL || p[0] != 0x55 || p[1] != 0xaa || p[3] != 0xe9) + if (p == NULL || p[0] != 0x55 || p[1] != 0xaa || + (p[3] != 0xe9 && p[3] != 0xeb)) return (NULL); return (p); From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 18:12:21 2010 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 6A5A61065670; Mon, 30 Aug 2010 18:12:21 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 500618FC17; Mon, 30 Aug 2010 18:12:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UICLtq002930; Mon, 30 Aug 2010 18:12:21 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UICLsq002928; Mon, 30 Aug 2010 18:12:21 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201008301812.o7UICLsq002928@svn.freebsd.org> From: Rui Paulo Date: Mon, 30 Aug 2010 18:12: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: r212004 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 18:12:21 -0000 Author: rpaulo Date: Mon Aug 30 18:12:21 2010 New Revision: 212004 URL: http://svn.freebsd.org/changeset/base/212004 Log: When DTrace is enabled, make sure we don't overwrite the IDT_DTRACE_RET entry with an IRQ for some hardware component. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Mon Aug 30 17:34:59 2010 (r212003) +++ head/sys/x86/x86/local_apic.c Mon Aug 30 18:12:21 2010 (r212004) @@ -89,6 +89,7 @@ CTASSERT(IPI_STOP < APIC_SPURIOUS_INT); /* Magic IRQ values for the timer and syscalls. */ #define IRQ_TIMER (NUM_IO_INTS + 1) #define IRQ_SYSCALL (NUM_IO_INTS + 2) +#define IRQ_DTRACE_RET (NUM_IO_INTS + 3) /* * Support for local APICs. Local APICs manage interrupts on each @@ -307,6 +308,10 @@ lapic_create(u_int apic_id, int boot_cpu lapics[apic_id].la_ioint_irqs[IDT_SYSCALL - APIC_IO_INTS] = IRQ_SYSCALL; lapics[apic_id].la_ioint_irqs[APIC_TIMER_INT - APIC_IO_INTS] = IRQ_TIMER; +#ifdef KDTRACE_HOOKS + lapics[apic_id].la_ioint_irqs[IDT_DTRACE_RET - APIC_IO_INTS] = IRQ_DTRACE_RET; +#endif + #ifdef SMP cpu_add(apic_id, boot_cpu); @@ -1028,6 +1033,10 @@ apic_enable_vector(u_int apic_id, u_int KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry")); KASSERT(ioint_handlers[vector / 32] != NULL, ("No ISR handler for vector %u", vector)); +#ifdef KDTRACE_HOOKS + KASSERT(vector != IDT_DTRACE_RET, + ("Attempt to overwrite DTrace entry")); +#endif setidt(vector, ioint_handlers[vector / 32], SDT_APIC, SEL_KPL, GSEL_APIC); } @@ -1037,6 +1046,10 @@ apic_disable_vector(u_int apic_id, u_int { KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry")); +#ifdef KDTRACE_HOOKS + KASSERT(vector != IDT_DTRACE_RET, + ("Attempt to overwrite DTrace entry")); +#endif KASSERT(ioint_handlers[vector / 32] != NULL, ("No ISR handler for vector %u", vector)); #ifdef notyet @@ -1060,6 +1073,10 @@ apic_free_vector(u_int apic_id, u_int ve KASSERT(irq < NUM_IO_INTS, ("Invalid IRQ %u", irq)); KASSERT(lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS] == irq, ("IRQ mismatch")); +#ifdef KDTRACE_HOOKS + KASSERT(vector != IDT_DTRACE_RET, + ("Attempt to overwrite DTrace entry")); +#endif /* * Bind us to the cpu that owned the vector before freeing it so @@ -1092,6 +1109,10 @@ apic_idt_to_irq(u_int apic_id, u_int vec KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, ("Vector %u does not map to an IRQ line", vector)); +#ifdef KDTRACE_HOOKS + KASSERT(vector != IDT_DTRACE_RET, + ("Attempt to overwrite DTrace entry")); +#endif irq = lapics[apic_id].la_ioint_irqs[vector - APIC_IO_INTS]; if (irq < 0) irq = 0; @@ -1123,6 +1144,10 @@ DB_SHOW_COMMAND(apic, db_show_apic) irq = lapics[apic_id].la_ioint_irqs[i]; if (irq == -1 || irq == IRQ_SYSCALL) continue; +#ifdef KDTRACE_HOOKS + if (irq == IRQ_DTRACE_RET) + continue; +#endif db_printf("vec 0x%2x -> ", i + APIC_IO_INTS); if (irq == IRQ_TIMER) db_printf("lapic timer\n"); From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 18:23:48 2010 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 CF834106566B; Mon, 30 Aug 2010 18:23:48 +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 BECAA8FC0A; Mon, 30 Aug 2010 18:23:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UINmZI003208; Mon, 30 Aug 2010 18:23:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UINmhw003206; Mon, 30 Aug 2010 18:23:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008301823.o7UINmhw003206@svn.freebsd.org> From: Xin LI Date: Mon, 30 Aug 2010 18:23:48 +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: r212005 - stable/8/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, 30 Aug 2010 18:23:48 -0000 Author: delphij Date: Mon Aug 30 18:23:48 2010 New Revision: 212005 URL: http://svn.freebsd.org/changeset/base/212005 Log: MFC r210665: In rdmsr_safe, use zero extend (by doing a 32-bit movl over eax to itself) instead of a sign extend. Discussed with: stas Modified: stable/8/sys/amd64/amd64/support.S Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/support.S ============================================================================== --- stable/8/sys/amd64/amd64/support.S Mon Aug 30 18:12:21 2010 (r212004) +++ stable/8/sys/amd64/amd64/support.S Mon Aug 30 18:23:48 2010 (r212005) @@ -729,7 +729,7 @@ ENTRY(rdmsr_safe) rdmsr /* Read MSR pointed by %ecx. Returns hi byte in edx, lo in %eax */ salq $32,%rdx /* sign-shift %rdx left */ - cltq /* sign-extend %eax -> %rax */ + movl %eax,%eax /* zero-extend %eax -> %rax */ orq %rdx,%rax movq %rax,(%rsi) xorq %rax,%rax From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 18:50:19 2010 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 0E81F10656A4; Mon, 30 Aug 2010 18:50:19 +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 F1D168FC16; Mon, 30 Aug 2010 18:50:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UIoIto003835; Mon, 30 Aug 2010 18:50:18 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UIoIJQ003833; Mon, 30 Aug 2010 18:50:18 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008301850.o7UIoIJQ003833@svn.freebsd.org> From: Xin LI Date: Mon, 30 Aug 2010 18:50:18 +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: r212006 - 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: Mon, 30 Aug 2010 18:50:19 -0000 Author: delphij Date: Mon Aug 30 18:50:18 2010 New Revision: 212006 URL: http://svn.freebsd.org/changeset/base/212006 Log: MFC r210665: In rdmsr_safe, use zero extend (by doing a 32-bit movl over eax to itself) instead of a sign extend. Discussed with: stas Modified: stable/7/sys/amd64/amd64/support.S Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/amd64/support.S ============================================================================== --- stable/7/sys/amd64/amd64/support.S Mon Aug 30 18:23:48 2010 (r212005) +++ stable/7/sys/amd64/amd64/support.S Mon Aug 30 18:50:18 2010 (r212006) @@ -729,7 +729,7 @@ ENTRY(rdmsr_safe) rdmsr /* Read MSR pointed by %ecx. Returns hi byte in edx, lo in %eax */ salq $32,%rdx /* sign-shift %rdx left */ - cltq /* sign-extend %eax -> %rax */ + movl %eax,%eax /* zero-extend %eax -> %rax */ orq %rdx,%rax movq %rax,(%rsi) xorq %rax,%rax From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 18:53:12 2010 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 618A0106564A; Mon, 30 Aug 2010 18:53:12 +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 4FF478FC0C; Mon, 30 Aug 2010 18:53:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UIrCSn003951; Mon, 30 Aug 2010 18:53:12 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UIrC8r003947; Mon, 30 Aug 2010 18:53:12 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008301853.o7UIrC8r003947@svn.freebsd.org> From: Xin LI Date: Mon, 30 Aug 2010 18:53:12 +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: r212007 - in stable/7/sys: amd64/include dev/coretemp 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: Mon, 30 Aug 2010 18:53:12 -0000 Author: delphij Date: Mon Aug 30 18:53:12 2010 New Revision: 212007 URL: http://svn.freebsd.org/changeset/base/212007 Log: MFC r210624 and r210833: Improve cputemp(4) driver wrt newer Intel processors, especially Xeon 5500/5600 series: - Utilize IA32_TEMPERATURE_TARGET, a.k.a. Tj(target) in place of Tj(max) when a sane value is available, as documented in Intel whitepaper "CPU Monitoring With DTS/PECI"; (By sane value we mean 70C - 100C for now); - Print the probe results when booting verbose; - Replace cpu_mask with cpu_stepping; - Use CPUID_* macros instead of rolling our own. Catch known CPUs before using IA32_TEMPERATURE_TARGET. This way we would have an opportunity to hide the Tj(target) value doesn't seem right stuff if we know it's not working there. Add temperature value for Core2 Duo Extreme Mobile that I have access to. Modified: stable/7/sys/amd64/include/specialreg.h stable/7/sys/dev/coretemp/coretemp.c stable/7/sys/i386/include/specialreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/amd64/include/specialreg.h ============================================================================== --- stable/7/sys/amd64/include/specialreg.h Mon Aug 30 18:50:18 2010 (r212006) +++ stable/7/sys/amd64/include/specialreg.h Mon Aug 30 18:53:12 2010 (r212007) @@ -249,6 +249,7 @@ #define MSR_THERM_INTERRUPT 0x19b #define MSR_THERM_STATUS 0x19c #define MSR_IA32_MISC_ENABLE 0x1a0 +#define MSR_IA32_TEMPERATURE_TARGET 0x1a2 #define MSR_DEBUGCTLMSR 0x1d9 #define MSR_LASTBRANCHFROMIP 0x1db #define MSR_LASTBRANCHTOIP 0x1dc Modified: stable/7/sys/dev/coretemp/coretemp.c ============================================================================== --- stable/7/sys/dev/coretemp/coretemp.c Mon Aug 30 18:50:18 2010 (r212006) +++ stable/7/sys/dev/coretemp/coretemp.c Mon Aug 30 18:53:12 2010 (r212007) @@ -131,15 +131,13 @@ coretemp_attach(device_t dev) struct coretemp_softc *sc = device_get_softc(dev); device_t pdev; uint64_t msr; - int cpu_model; - int cpu_mask; + int cpu_model, cpu_stepping; + int ret, tjtarget; sc->sc_dev = dev; pdev = device_get_parent(dev); - cpu_model = (cpu_id >> 4) & 15; - /* extended model */ - cpu_model += ((cpu_id >> 16) & 0xf) << 4; - cpu_mask = cpu_id & 15; + cpu_model = CPUID_TO_MODEL(cpu_id); + cpu_stepping = cpu_id & CPUID_STEPPING; /* * Some CPUs, namely the PIII, don't have thermal sensors, but @@ -157,7 +155,7 @@ coretemp_attach(device_t dev) * * Adapted from the Linux coretemp driver. */ - if (cpu_model == 0xe && cpu_mask < 0xc) { + if (cpu_model == 0xe && cpu_stepping < 0xc) { msr = rdmsr(MSR_BIOS_SIGN); msr = msr >> 32; if (msr < 0x39) { @@ -166,20 +164,68 @@ coretemp_attach(device_t dev) return (ENXIO); } } + /* - * On some Core 2 CPUs, there's an undocumented MSR that - * can tell us if Tj(max) is 100 or 85. - * - * The if-clause for CPUs having the MSR_IA32_EXT_CONFIG was adapted - * from the Linux coretemp driver. + * Use 100C as the initial value. */ sc->sc_tjmax = 100; - if ((cpu_model == 0xf && cpu_mask >= 2) || cpu_model == 0xe) { + + if ((cpu_model == 0xf && cpu_stepping >= 2) || cpu_model == 0xe) { + /* + * On some Core 2 CPUs, there's an undocumented MSR that + * can tell us if Tj(max) is 100 or 85. + * + * The if-clause for CPUs having the MSR_IA32_EXT_CONFIG was adapted + * from the Linux coretemp driver. + */ msr = rdmsr(MSR_IA32_EXT_CONFIG); if (msr & (1 << 30)) sc->sc_tjmax = 85; + } else if (cpu_model == 0x17) { + switch (cpu_stepping) { + case 0x6: /* Mobile Core 2 Duo */ + sc->sc_tjmax = 104; + break; + default: /* Unknown stepping */ + break; + } + } else { + /* + * Attempt to get Tj(max) from MSR IA32_TEMPERATURE_TARGET. + * + * This method is described in Intel white paper "CPU + * Monitoring With DTS/PECI". (#322683) + */ + ret = rdmsr_safe(MSR_IA32_TEMPERATURE_TARGET, &msr); + if (ret == 0) { + tjtarget = (msr >> 16) & 0xff; + + /* + * On earlier generation of processors, the value + * obtained from IA32_TEMPERATURE_TARGET register is + * an offset that needs to be summed with a model + * specific base. It is however not clear what + * these numbers are, with the publicly available + * documents from Intel. + * + * For now, we consider [70, 100]C range, as + * described in #322683, as "reasonable" and accept + * these values whenever the MSR is available for + * read, regardless the CPU model. + */ + if (tjtarget >= 70 && tjtarget <= 100) + sc->sc_tjmax = tjtarget; + else + device_printf(dev, "Tj(target) value %d " + "does not seem right.\n", tjtarget); + } else + device_printf(dev, "Can not get Tj(target) " + "from your CPU, using 100C.\n"); } + if (bootverbose) + device_printf(dev, "Setting TjMax=%d\n", sc->sc_tjmax); + /* * Add the "temperature" MIB to dev.cpu.N. */ Modified: stable/7/sys/i386/include/specialreg.h ============================================================================== --- stable/7/sys/i386/include/specialreg.h Mon Aug 30 18:50:18 2010 (r212006) +++ stable/7/sys/i386/include/specialreg.h Mon Aug 30 18:53:12 2010 (r212007) @@ -255,6 +255,7 @@ #define MSR_THERM_INTERRUPT 0x19b #define MSR_THERM_STATUS 0x19c #define MSR_IA32_MISC_ENABLE 0x1a0 +#define MSR_IA32_TEMPERATURE_TARGET 0x1a2 #define MSR_DEBUGCTLMSR 0x1d9 #define MSR_LASTBRANCHFROMIP 0x1db #define MSR_LASTBRANCHTOIP 0x1dc From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 19:15:04 2010 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 60C5010656AC; Mon, 30 Aug 2010 19:15:04 +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 4FAC08FC19; Mon, 30 Aug 2010 19:15:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UJF4sf004473; Mon, 30 Aug 2010 19:15:04 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UJF4vE004461; Mon, 30 Aug 2010 19:15:04 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008301915.o7UJF4vE004461@svn.freebsd.org> From: Xin LI Date: Mon, 30 Aug 2010 19:15: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: r212008 - head/sys/dev/twa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 19:15:04 -0000 Author: delphij Date: Mon Aug 30 19:15:04 2010 New Revision: 212008 URL: http://svn.freebsd.org/changeset/base/212008 Log: Vendor update to version 3.80.06.003 to fix a panic with ZFS when under heavy I/O load. Many thanks to LSI for continuing to support FreeBSD. PR: kern/149968 Submitted by: LSI (Tom Couch) Reported by: Kai Kockro Tested by: Kai Kockro, jpaetzel MFC after: 7 days Modified: head/sys/dev/twa/tw_cl.h head/sys/dev/twa/tw_cl_externs.h head/sys/dev/twa/tw_cl_fwif.h head/sys/dev/twa/tw_cl_init.c head/sys/dev/twa/tw_cl_intr.c head/sys/dev/twa/tw_cl_io.c head/sys/dev/twa/tw_cl_misc.c head/sys/dev/twa/tw_cl_share.h head/sys/dev/twa/tw_osl.h head/sys/dev/twa/tw_osl_cam.c head/sys/dev/twa/tw_osl_freebsd.c head/sys/dev/twa/tw_osl_share.h Modified: head/sys/dev/twa/tw_cl.h ============================================================================== --- head/sys/dev/twa/tw_cl.h Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_cl.h Mon Aug 30 19:15:04 2010 (r212008) @@ -88,7 +88,8 @@ struct tw_cli_q_stats { #define TW_CLI_BUSY_Q 1 /* q of reqs submitted to fw */ #define TW_CLI_PENDING_Q 2 /* q of reqs deferred due to 'q full' */ #define TW_CLI_COMPLETE_Q 3 /* q of reqs completed by fw */ -#define TW_CLI_Q_COUNT 4 /* total number of queues */ +#define TW_CLI_RESET_Q 4 /* q of reqs reset by timeout */ +#define TW_CLI_Q_COUNT 5 /* total number of queues */ /* CL's internal request context. */ @@ -133,6 +134,7 @@ struct tw_cli_ctlr_context { TW_UINT8 interrupts_enabled; /* Interrupts on controller enabled. */ TW_UINT8 internal_req_busy; /* Data buffer for internal requests in use. */ TW_UINT8 get_more_aens; /* More AEN's need to be retrieved. */ + TW_UINT8 reset_needed; /* Controller needs a soft reset. */ TW_UINT8 reset_in_progress; /* Controller is being reset. */ TW_UINT8 reset_phase1_in_progress; /* In 'phase 1' of reset. */ TW_UINT32 flags; /* controller settings */ Modified: head/sys/dev/twa/tw_cl_externs.h ============================================================================== --- head/sys/dev/twa/tw_cl_externs.h Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_cl_externs.h Mon Aug 30 19:15:04 2010 (r212008) @@ -86,6 +86,8 @@ extern TW_INT32 tw_cli_submit_and_poll_r /* Soft reset the controller. */ extern TW_INT32 tw_cli_soft_reset(struct tw_cli_ctlr_context *ctlr); +extern int twa_setup_intr(struct twa_softc *sc); +extern int twa_teardown_intr(struct twa_softc *sc); /* Send down a SCSI command to the firmware (usually, an internal Req Sense. */ extern TW_INT32 tw_cli_send_scsi_cmd(struct tw_cli_req_context *req, Modified: head/sys/dev/twa/tw_cl_fwif.h ============================================================================== --- head/sys/dev/twa/tw_cl_fwif.h Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_cl_fwif.h Mon Aug 30 19:15:04 2010 (r212008) @@ -89,7 +89,7 @@ #define TWA_STATUS_MINOR_VERSION_MASK 0x0F000000 #define TWA_STATUS_MAJOR_VERSION_MASK 0xF0000000 -#define TWA_STATUS_UNEXPECTED_BITS 0x00F00000 +#define TWA_STATUS_UNEXPECTED_BITS 0x00D00000 /* PCI related defines. */ Modified: head/sys/dev/twa/tw_cl_init.c ============================================================================== --- head/sys/dev/twa/tw_cl_init.c Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_cl_init.c Mon Aug 30 19:15:04 2010 (r212008) @@ -315,6 +315,7 @@ tw_cl_init_ctlr(struct tw_cl_ctlr_handle tw_cli_req_q_init(ctlr, TW_CLI_BUSY_Q); tw_cli_req_q_init(ctlr, TW_CLI_PENDING_Q); tw_cli_req_q_init(ctlr, TW_CLI_COMPLETE_Q); + tw_cli_req_q_init(ctlr, TW_CLI_RESET_Q); /* Initialize all locks used by CL. */ ctlr->gen_lock = &(ctlr->gen_lock_handle); @@ -675,15 +676,14 @@ tw_cli_init_connection(struct tw_cli_ctl /* Submit the command, and wait for it to complete. */ error = tw_cli_submit_and_poll_request(req, TW_CLI_REQUEST_TIMEOUT_PERIOD); - if (error == TW_OSL_ETIMEDOUT) - /* Clean-up done by tw_cli_submit_and_poll_request. */ - return(error); if (error) goto out; if ((error = init_connect->status)) { +#if 0 tw_cli_create_ctlr_event(ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, &(req->cmd_pkt->cmd_hdr)); +#endif // 0 goto out; } if (set_features & TWA_EXTENDED_INIT_CONNECT) { Modified: head/sys/dev/twa/tw_cl_intr.c ============================================================================== --- head/sys/dev/twa/tw_cl_intr.c Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_cl_intr.c Mon Aug 30 19:15:04 2010 (r212008) @@ -248,8 +248,7 @@ tw_cli_process_resp_intr(struct tw_cli_c #ifdef TW_OSL_DEBUG tw_cl_print_ctlr_stats(ctlr->ctlr_handle); #endif /* TW_OSL_DEBUG */ - tw_cl_reset_ctlr(ctlr->ctlr_handle); - return(TW_OSL_EIO); + continue; } /* @@ -402,9 +401,7 @@ tw_cli_complete_io(struct tw_cli_req_con #ifdef TW_OSL_DEBUG tw_cl_print_ctlr_stats(ctlr->ctlr_handle); #endif /* TW_OSL_DEBUG */ - tw_cl_reset_ctlr(ctlr->ctlr_handle); - req_pkt->status = TW_CL_ERR_REQ_BUS_RESET; - goto out; + return; } if (req->flags & TW_CLI_REQ_FLAGS_PASSTHRU) { @@ -483,6 +480,7 @@ tw_cli_scsi_complete(struct tw_cli_req_c cdb[8], cdb[9], cdb[10], cdb[11], cdb[12], cdb[13], cdb[14], cdb[15]); +#if 0 /* * Print the error. Firmware doesn't yet support * the 'Mode Sense' cmd. Don't print if the cmd @@ -493,6 +491,7 @@ tw_cli_scsi_complete(struct tw_cli_req_c tw_cli_create_ctlr_event(req->ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, cmd_hdr); +#endif // 0 } if (scsi_req->sense_data) { @@ -530,9 +529,11 @@ tw_cli_param_callback(struct tw_cli_req_ */ if (! req->error_code) if (cmd->param.status) { +#if 0 tw_cli_create_ctlr_event(ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, &(req->cmd_pkt->cmd_hdr)); +#endif // 0 tw_cl_create_event(ctlr->ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1204, 0x1, TW_CL_SEVERITY_ERROR_STRING, @@ -590,9 +591,11 @@ tw_cli_aen_callback(struct tw_cli_req_co if ((error = cmd->status)) { cmd_hdr = (struct tw_cl_command_header *) (&(req->cmd_pkt->cmd_hdr)); +#if 0 tw_cli_create_ctlr_event(ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, cmd_hdr); +#endif // 0 tw_cl_create_event(ctlr->ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1206, 0x1, TW_CL_SEVERITY_ERROR_STRING, Modified: head/sys/dev/twa/tw_cl_io.c ============================================================================== --- head/sys/dev/twa/tw_cl_io.c Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_cl_io.c Mon Aug 30 19:15:04 2010 (r212008) @@ -74,18 +74,12 @@ tw_cl_start_io(struct tw_cl_ctlr_handle struct tw_cli_req_context *req; struct tw_cl_command_9k *cmd; struct tw_cl_scsi_req_packet *scsi_req; - TW_INT32 error; + TW_INT32 error = TW_CL_ERR_REQ_SUCCESS; tw_cli_dbg_printf(10, ctlr_handle, tw_osl_cur_func(), "entered"); ctlr = (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); - if (ctlr->reset_in_progress) { - tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), - "I/O during reset: returning busy."); - return(TW_OSL_EBUSY); - } - /* * If working with a firmware version that does not support multiple * luns, and this request is directed at a non-zero lun, error it @@ -145,7 +139,12 @@ tw_cl_start_io(struct tw_cl_ctlr_handle cmd->sg_list, scsi_req->sgl_entries); } - if ((error = tw_cli_submit_cmd(req))) { + if (((TW_CL_Q_FIRST_ITEM(&(ctlr->req_q_head[TW_CLI_PENDING_Q]))) != TW_CL_NULL) || + (ctlr->reset_in_progress)) { + tw_cli_req_q_insert_tail(req, TW_CLI_PENDING_Q); + TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, + TWA_CONTROL_UNMASK_COMMAND_INTERRUPT); + } else if ((error = tw_cli_submit_cmd(req))) { tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), "Could not start request. request = %p, error = %d", req, error); @@ -171,7 +170,7 @@ tw_cli_submit_cmd(struct tw_cli_req_cont struct tw_cli_ctlr_context *ctlr = req->ctlr; struct tw_cl_ctlr_handle *ctlr_handle = ctlr->ctlr_handle; TW_UINT32 status_reg; - TW_INT32 error; + TW_INT32 error = 0; tw_cli_dbg_printf(10, ctlr_handle, tw_osl_cur_func(), "entered"); @@ -185,11 +184,7 @@ tw_cli_submit_cmd(struct tw_cli_req_cont TWA_COMMAND_QUEUE_OFFSET_LOW, (TW_UINT32)(req->cmd_pkt_phys + sizeof(struct tw_cl_command_header)), 4); - /* Check to see if we can post a command. */ status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr_handle); - if ((error = tw_cli_check_ctlr_state(ctlr, status_reg))) - goto out; - if (status_reg & TWA_STATUS_COMMAND_QUEUE_FULL) { struct tw_cl_req_packet *req_pkt = (struct tw_cl_req_packet *)(req->orig_req); @@ -207,14 +202,12 @@ tw_cli_submit_cmd(struct tw_cli_req_cont "pending internal/ioctl request"); req->state = TW_CLI_REQ_STATE_PENDING; tw_cli_req_q_insert_tail(req, TW_CLI_PENDING_Q); - error = 0; /* Unmask command interrupt. */ TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, TWA_CONTROL_UNMASK_COMMAND_INTERRUPT); } else error = TW_OSL_EBUSY; } else { - tw_osl_ctlr_busy(ctlr_handle, req->req_handle); error = TW_OSL_EBUSY; } } else { @@ -246,7 +239,7 @@ tw_cli_submit_cmd(struct tw_cli_req_cont (TW_UINT32)(req->cmd_pkt_phys + sizeof(struct tw_cl_command_header)), 4); } } -out: + tw_osl_free_lock(ctlr_handle, ctlr->io_lock); return(error); @@ -277,18 +270,12 @@ tw_cl_fw_passthru(struct tw_cl_ctlr_hand TW_UINT8 opcode; TW_UINT8 sgl_offset; TW_VOID *sgl = TW_CL_NULL; - TW_INT32 error; + TW_INT32 error = TW_CL_ERR_REQ_SUCCESS; tw_cli_dbg_printf(5, ctlr_handle, tw_osl_cur_func(), "entered"); ctlr = (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); - if (ctlr->reset_in_progress) { - tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), - "Passthru request during reset: returning busy."); - return(TW_OSL_EBUSY); - } - if ((req = tw_cli_get_request(ctlr )) == TW_CL_NULL) { tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), @@ -301,7 +288,7 @@ tw_cl_fw_passthru(struct tw_cl_ctlr_hand req->orig_req = req_pkt; req->tw_cli_callback = tw_cli_complete_io; - req->flags |= (TW_CLI_REQ_FLAGS_EXTERNAL | TW_CLI_REQ_FLAGS_PASSTHRU); + req->flags |= TW_CLI_REQ_FLAGS_PASSTHRU; pt_req = &(req_pkt->gen_req_pkt.pt_req); @@ -348,7 +335,12 @@ tw_cl_fw_passthru(struct tw_cl_ctlr_hand tw_cli_fill_sg_list(ctlr, pt_req->sg_list, sgl, pt_req->sgl_entries); - if ((error = tw_cli_submit_cmd(req))) { + if (((TW_CL_Q_FIRST_ITEM(&(ctlr->req_q_head[TW_CLI_PENDING_Q]))) != TW_CL_NULL) || + (ctlr->reset_in_progress)) { + tw_cli_req_q_insert_tail(req, TW_CLI_PENDING_Q); + TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, + TWA_CONTROL_UNMASK_COMMAND_INTERRUPT); + } else if ((error = tw_cli_submit_cmd(req))) { tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_ERROR, 0x1100, 0x1, TW_CL_SEVERITY_ERROR_STRING, @@ -760,8 +752,7 @@ tw_cli_get_param(struct tw_cli_ctlr_cont cmd->param.sgl_off__opcode = BUILD_SGL_OFF__OPCODE(2, TWA_FW_CMD_GET_PARAM); - cmd->param.request_id = - (TW_UINT8)(TW_CL_SWAP16(req->request_id)); + cmd->param.request_id = (TW_UINT8)(TW_CL_SWAP16(req->request_id)); cmd->param.host_id__unit = BUILD_HOST_ID__UNIT(0, 0); cmd->param.param_count = TW_CL_SWAP16(1); @@ -789,15 +780,14 @@ tw_cli_get_param(struct tw_cli_ctlr_cont /* There's no call back; wait till the command completes. */ error = tw_cli_submit_and_poll_request(req, TW_CLI_REQUEST_TIMEOUT_PERIOD); - if (error == TW_OSL_ETIMEDOUT) - /* Clean-up done by tw_cli_submit_and_poll_request. */ - return(error); if (error) goto out; if ((error = cmd->param.status)) { +#if 0 tw_cli_create_ctlr_event(ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, &(req->cmd_pkt->cmd_hdr)); +#endif // 0 goto out; } tw_osl_memcpy(param_data, param->data, param_size); @@ -905,18 +895,17 @@ tw_cli_set_param(struct tw_cli_ctlr_cont /* Submit the command. */ if (callback == TW_CL_NULL) { - /* There's no call back; wait till the command completes. */ + /* There's no call back; wait till the command completes. */ error = tw_cli_submit_and_poll_request(req, - TW_CLI_REQUEST_TIMEOUT_PERIOD); - if (error == TW_OSL_ETIMEDOUT) - /* Clean-up done by tw_cli_submit_and_poll_request. */ - return(error); + TW_CLI_REQUEST_TIMEOUT_PERIOD); if (error) goto out; if ((error = cmd->param.status)) { +#if 0 tw_cli_create_ctlr_event(ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, &(req->cmd_pkt->cmd_hdr)); +#endif // 0 goto out; } ctlr->internal_req_busy = TW_CL_FALSE; @@ -1022,9 +1011,7 @@ tw_cli_submit_and_poll_request(struct tw * tw_cli_submit_pending_queue. There could be a race in that case. * Need to revisit. */ - if (req->state != TW_CLI_REQ_STATE_PENDING) - tw_cl_reset_ctlr(ctlr->ctlr_handle); - else { + if (req->state == TW_CLI_REQ_STATE_PENDING) { tw_cli_dbg_printf(3, ctlr->ctlr_handle, tw_osl_cur_func(), "Removing request from pending queue"); /* @@ -1053,6 +1040,7 @@ tw_cli_submit_and_poll_request(struct tw * drains any incomplete requests. * * Input: ctlr -- ptr to per ctlr structure + * req_handle -- ptr to request handle * Output: None * Return value: 0 -- success * non-zero-- failure @@ -1063,15 +1051,15 @@ tw_cl_reset_ctlr(struct tw_cl_ctlr_handl struct tw_cli_ctlr_context *ctlr = (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); struct twa_softc *sc = ctlr_handle->osl_ctlr_ctxt; + struct tw_cli_req_context *req; TW_INT32 reset_attempt = 1; - TW_INT32 error; + TW_INT32 error = 0; tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), "entered"); ctlr->reset_in_progress = TW_CL_TRUE; - xpt_freeze_simq(sc->sim, 1); + twa_teardown_intr(sc); - tw_cli_disable_interrupts(ctlr); /* * Error back all requests in the complete, busy, and pending queues. @@ -1080,8 +1068,6 @@ tw_cl_reset_ctlr(struct tw_cl_ctlr_handl * will continue its course and get submitted to the controller after * the reset is done (and io_lock is released). */ - tw_cli_dbg_printf(2, ctlr_handle, tw_osl_cur_func(), - "Draining all queues following reset"); tw_cli_drain_complete_queue(ctlr); tw_cli_drain_busy_queue(ctlr); tw_cli_drain_pending_queue(ctlr); @@ -1089,53 +1075,88 @@ tw_cl_reset_ctlr(struct tw_cl_ctlr_handl ctlr->get_more_aens = TW_CL_FALSE; /* Soft reset the controller. */ -try_reset: - if ((error = tw_cli_soft_reset(ctlr))) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, - TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, - 0x1105, 0x1, TW_CL_SEVERITY_ERROR_STRING, - "Controller reset failed", - "error = %d; attempt %d", error, reset_attempt++); - if (reset_attempt <= TW_CLI_MAX_RESET_ATTEMPTS) - goto try_reset; - else - goto out; - } + while (reset_attempt <= TW_CLI_MAX_RESET_ATTEMPTS) { + if ((error = tw_cli_soft_reset(ctlr))) { + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, + TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, + 0x1105, 0x1, TW_CL_SEVERITY_ERROR_STRING, + "Controller reset failed", + "error = %d; attempt %d", error, reset_attempt++); + reset_attempt++; + continue; + } - /* Re-establish logical connection with the controller. */ - if ((error = tw_cli_init_connection(ctlr, - (TW_UINT16)(ctlr->max_simult_reqs), - 0, 0, 0, 0, 0, TW_CL_NULL, TW_CL_NULL, TW_CL_NULL, - TW_CL_NULL, TW_CL_NULL))) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + /* Re-establish logical connection with the controller. */ + if ((error = tw_cli_init_connection(ctlr, + (TW_UINT16)(ctlr->max_simult_reqs), + 0, 0, 0, 0, 0, TW_CL_NULL, TW_CL_NULL, TW_CL_NULL, + TW_CL_NULL, TW_CL_NULL))) { + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, + TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, + 0x1106, 0x1, TW_CL_SEVERITY_ERROR_STRING, + "Can't initialize connection after reset", + "error = %d", error); + reset_attempt++; + continue; + } + +#ifdef TW_OSL_DEBUG + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, - 0x1106, 0x1, TW_CL_SEVERITY_ERROR_STRING, - "Can't initialize connection after reset", - "error = %d", error); - goto out; - } + 0x1107, 0x3, TW_CL_SEVERITY_INFO_STRING, + "Controller reset done!", " "); +#endif /* TW_OSL_DEBUG */ + break; + } /* End of while */ - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, - TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, - 0x1107, 0x3, TW_CL_SEVERITY_INFO_STRING, - "Controller reset done!", - " "); + /* Move commands from the reset queue to the pending queue. */ + while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_RESET_Q)) != TW_CL_NULL) { + tw_osl_timeout(req->req_handle); + tw_cli_req_q_insert_tail(req, TW_CLI_PENDING_Q); + } -out: + twa_setup_intr(sc); + tw_cli_enable_interrupts(ctlr); + if ((TW_CL_Q_FIRST_ITEM(&(ctlr->req_q_head[TW_CLI_PENDING_Q]))) != TW_CL_NULL) + TW_CLI_WRITE_CONTROL_REGISTER(ctlr_handle, + TWA_CONTROL_UNMASK_COMMAND_INTERRUPT); ctlr->reset_in_progress = TW_CL_FALSE; - xpt_release_simq(sc->sim, 1); + ctlr->reset_needed = TW_CL_FALSE; - /* - * Enable interrupts, and also clear attention and response interrupts. - */ - tw_cli_enable_interrupts(ctlr); - /* Request for a bus re-scan. */ - if (!error) - tw_osl_scan_bus(ctlr_handle); + tw_osl_scan_bus(ctlr_handle); + return(error); } +TW_VOID +tw_cl_set_reset_needed(struct tw_cl_ctlr_handle *ctlr_handle) +{ + struct tw_cli_ctlr_context *ctlr = + (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); + + ctlr->reset_needed = TW_CL_TRUE; +} + +TW_INT32 +tw_cl_is_reset_needed(struct tw_cl_ctlr_handle *ctlr_handle) +{ + struct tw_cli_ctlr_context *ctlr = + (struct tw_cli_ctlr_context *)(ctlr_handle->cl_ctlr_ctxt); + + return(ctlr->reset_needed); +} + +TW_INT32 +tw_cl_is_active(struct tw_cl_ctlr_handle *ctlr_handle) +{ + struct tw_cli_ctlr_context *ctlr = + (struct tw_cli_ctlr_context *) + (ctlr_handle->cl_ctlr_ctxt); + + return(ctlr->active); +} + /* @@ -1151,14 +1172,13 @@ TW_INT32 tw_cli_soft_reset(struct tw_cli_ctlr_context *ctlr) { struct tw_cl_ctlr_handle *ctlr_handle = ctlr->ctlr_handle; - TW_UINT32 status_reg; int found; int loop_count; TW_UINT32 error; tw_cli_dbg_printf(1, ctlr_handle, tw_osl_cur_func(), "entered"); - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x1108, 0x3, TW_CL_SEVERITY_INFO_STRING, "Resetting controller...", @@ -1193,7 +1213,7 @@ tw_cli_soft_reset(struct tw_cli_ctlr_con } while (!found && (loop_count < 6000000)); /* Loop for no more than 60 seconds */ if (!found) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x1109, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Missed firmware handshake after soft-reset", @@ -1210,7 +1230,7 @@ tw_cli_soft_reset(struct tw_cli_ctlr_con TWA_STATUS_MICROCONTROLLER_READY | TWA_STATUS_ATTENTION_INTERRUPT, TW_CLI_RESET_TIMEOUT_PERIOD))) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x1109, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Micro-ctlr not ready/No attn intr after reset", @@ -1244,26 +1264,14 @@ tw_cli_soft_reset(struct tw_cli_ctlr_con } if ((error = tw_cli_find_aen(ctlr, TWA_AEN_SOFT_RESET))) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x110C, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Reset not reported by controller", "error = %d", error); return(error); } - - status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr_handle); - - if ((error = TW_CLI_STATUS_ERRORS(status_reg)) || - (error = tw_cli_check_ctlr_state(ctlr, status_reg))) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, - TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, - 0x110D, 0x1, TW_CL_SEVERITY_ERROR_STRING, - "Controller errors detected after reset", - "error = %d", error); - return(error); - } - + return(TW_OSL_ESUCCESS); } Modified: head/sys/dev/twa/tw_cl_misc.c ============================================================================== --- head/sys/dev/twa/tw_cl_misc.c Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_cl_misc.c Mon Aug 30 19:15:04 2010 (r212008) @@ -83,7 +83,8 @@ tw_cli_drain_complete_queue(struct tw_cl tw_cli_dbg_printf(3, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); /* Walk the busy queue. */ - while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_COMPLETE_Q))) { + while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_COMPLETE_Q)) != + TW_CL_NULL) { if (req->flags & TW_CLI_REQ_FLAGS_INTERNAL) { /* * It's an internal request. Set the appropriate @@ -97,20 +98,21 @@ tw_cli_drain_complete_queue(struct tw_cl req->error_code = TW_CL_ERR_REQ_BUS_RESET; if (req->tw_cli_callback) req->tw_cli_callback(req); - } else { - if ((req_pkt = req->orig_req)) { - /* It's a SCSI request. Complete it. */ - tw_cli_dbg_printf(2, ctlr->ctlr_handle, - tw_osl_cur_func(), - "Completing complete request %p " - "on reset", - req); + } else if (req->flags & TW_CLI_REQ_FLAGS_PASSTHRU) { + /* It's a passthru request. Complete it. */ + if ((req_pkt = req->orig_req) != TW_CL_NULL) { req_pkt->status = TW_CL_ERR_REQ_BUS_RESET; - req_pkt->tw_osl_callback(req->req_handle); + + if (req_pkt->tw_osl_callback) + req_pkt->tw_osl_callback(req->req_handle); } tw_cli_req_q_insert_tail(req, TW_CLI_FREE_Q); + } else { + /* It's an external (SCSI) request. Add it to the reset queue. */ + tw_osl_untimeout(req->req_handle); + tw_cli_req_q_insert_tail(req, TW_CLI_RESET_Q); } - } + } /* End of while loop */ } @@ -135,7 +137,8 @@ tw_cli_drain_busy_queue(struct tw_cli_ct tw_cli_dbg_printf(3, ctlr->ctlr_handle, tw_osl_cur_func(), "entered"); /* Walk the busy queue. */ - while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_BUSY_Q))) { + while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_BUSY_Q)) != + TW_CL_NULL) { if (req->flags & TW_CLI_REQ_FLAGS_INTERNAL) { /* * It's an internal request. Set the appropriate @@ -149,19 +152,21 @@ tw_cli_drain_busy_queue(struct tw_cli_ct req->error_code = TW_CL_ERR_REQ_BUS_RESET; if (req->tw_cli_callback) req->tw_cli_callback(req); - } else { - if ((req_pkt = req->orig_req)) { - /* It's a SCSI request. Complete it. */ - tw_cli_dbg_printf(2, ctlr->ctlr_handle, - tw_osl_cur_func(), - "Completing busy request %p on reset", - req); + } else if (req->flags & TW_CLI_REQ_FLAGS_PASSTHRU) { + /* It's a passthru request. Complete it. */ + if ((req_pkt = req->orig_req) != TW_CL_NULL) { req_pkt->status = TW_CL_ERR_REQ_BUS_RESET; - req_pkt->tw_osl_callback(req->req_handle); + + if (req_pkt->tw_osl_callback) + req_pkt->tw_osl_callback(req->req_handle); } tw_cli_req_q_insert_tail(req, TW_CLI_FREE_Q); + } else { + /* It's an external (SCSI) request. Add it to the reset queue. */ + tw_osl_untimeout(req->req_handle); + tw_cli_req_q_insert_tail(req, TW_CLI_RESET_Q); } - } + } /* End of while loop */ } @@ -188,7 +193,8 @@ tw_cli_drain_pending_queue(struct tw_cli /* * Pull requests off the pending queue, and complete them. */ - while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_PENDING_Q))) { + while ((req = tw_cli_req_q_remove_head(ctlr, TW_CLI_PENDING_Q)) != + TW_CL_NULL) { if (req->flags & TW_CLI_REQ_FLAGS_INTERNAL) { /* * It's an internal request. Set the appropriate @@ -202,19 +208,21 @@ tw_cli_drain_pending_queue(struct tw_cli req->error_code = TW_CL_ERR_REQ_BUS_RESET; if (req->tw_cli_callback) req->tw_cli_callback(req); - } else { - if ((req_pkt = req->orig_req)) { - /* It's an external request. Complete it. */ - tw_cli_dbg_printf(2, ctlr->ctlr_handle, - tw_osl_cur_func(), - "Completing pending request %p " - "on reset", req); + } else if (req->flags & TW_CLI_REQ_FLAGS_PASSTHRU) { + /* It's a passthru request. Complete it. */ + if ((req_pkt = req->orig_req) != TW_CL_NULL) { req_pkt->status = TW_CL_ERR_REQ_BUS_RESET; - req_pkt->tw_osl_callback(req->req_handle); + + if (req_pkt->tw_osl_callback) + req_pkt->tw_osl_callback(req->req_handle); } tw_cli_req_q_insert_tail(req, TW_CLI_FREE_Q); + } else { + /* It's an external (SCSI) request. Add it to the reset queue. */ + tw_osl_untimeout(req->req_handle); + tw_cli_req_q_insert_tail(req, TW_CLI_RESET_Q); } - } + } /* End of while loop */ } @@ -239,9 +247,6 @@ tw_cli_drain_response_queue(struct tw_cl for (;;) { status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr->ctlr_handle); - if (tw_cli_check_ctlr_state(ctlr, status_reg)) - return(TW_OSL_EGENFAILURE); - if (status_reg & TWA_STATUS_RESPONSE_QUEUE_EMPTY) return(TW_OSL_ESUCCESS); /* no more response queue entries */ @@ -273,9 +278,6 @@ tw_cli_find_response(struct tw_cli_ctlr_ for (;;) { status_reg = TW_CLI_READ_STATUS_REGISTER(ctlr->ctlr_handle); - if (tw_cli_check_ctlr_state(ctlr, status_reg)) - return(TW_OSL_EGENFAILURE); - if (status_reg & TWA_STATUS_RESPONSE_QUEUE_EMPTY) return(TW_OSL_ENOTTY); /* no more response queue entries */ @@ -356,9 +358,11 @@ tw_cli_drain_aen_queue(struct tw_cli_ctl if ((error = req->cmd_pkt->command.cmd_pkt_9k.status)) { cmd_hdr = &req->cmd_pkt->cmd_hdr; +#if 0 tw_cli_create_ctlr_event(ctlr, TW_CL_MESSAGE_SOURCE_CONTROLLER_ERROR, cmd_hdr); +#endif // 0 break; } @@ -714,7 +718,7 @@ tw_cli_check_ctlr_state(struct tw_cli_ct tw_osl_memzero(desc, 200); if (!(ctlr->reset_phase1_in_progress)) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x1301, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Missing expected status bit(s)", @@ -738,7 +742,7 @@ tw_cli_check_ctlr_state(struct tw_cli_ct (ctlr->device_id != TW_CL_DEVICE_ID_9K_SA)) || (!(ctlr->reset_in_progress)) || ((status_reg & TWA_STATUS_QUEUE_ERROR_INTERRUPT) == 0)) - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x1302, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Unexpected status bit(s)", @@ -748,7 +752,7 @@ tw_cli_check_ctlr_state(struct tw_cli_ct TWA_STATUS_UNEXPECTED_BITS, desc)); if (status_reg & TWA_STATUS_PCI_PARITY_ERROR_INTERRUPT) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x1303, 0x1, TW_CL_SEVERITY_ERROR_STRING, "PCI parity error: clearing... " @@ -768,7 +772,7 @@ tw_cli_check_ctlr_state(struct tw_cli_ct } if (status_reg & TWA_STATUS_PCI_ABORT_INTERRUPT) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x1304, 0x1, TW_CL_SEVERITY_ERROR_STRING, "PCI abort: clearing... ", @@ -791,7 +795,7 @@ tw_cli_check_ctlr_state(struct tw_cli_ct if (((ctlr->device_id != TW_CL_DEVICE_ID_9K_E) && (ctlr->device_id != TW_CL_DEVICE_ID_9K_SA)) || (!(ctlr->reset_in_progress))) - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, + tw_cl_create_event(ctlr_handle, TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, 0x1305, 0x1, TW_CL_SEVERITY_ERROR_STRING, "Controller queue error: clearing... ", @@ -801,17 +805,6 @@ tw_cli_check_ctlr_state(struct tw_cli_ct TW_CLI_WRITE_CONTROL_REGISTER(ctlr->ctlr_handle, TWA_CONTROL_CLEAR_QUEUE_ERROR); } - - if (status_reg & TWA_STATUS_MICROCONTROLLER_ERROR) { - tw_cl_create_event(ctlr_handle, TW_CL_TRUE, - TW_CL_MESSAGE_SOURCE_COMMON_LAYER_EVENT, - 0x1307, 0x1, TW_CL_SEVERITY_ERROR_STRING, - "Micro-controller error! ", - "status reg = 0x%x %s", - status_reg, - tw_cli_describe_bits(status_reg, desc)); - error = TW_OSL_EGENFAILURE; - } } return(error); } @@ -850,8 +843,6 @@ tw_cli_describe_bits(TW_UINT32 reg, TW_I tw_osl_strcpy(&str[tw_osl_strlen(str)], "HOST_INTR,"); if (reg & TWA_STATUS_PCI_ABORT_INTERRUPT) tw_osl_strcpy(&str[tw_osl_strlen(str)], "PCI_ABRT,"); - if (reg & TWA_STATUS_MICROCONTROLLER_ERROR) - tw_osl_strcpy(&str[tw_osl_strlen(str)], "MC_ERR,"); if (reg & TWA_STATUS_QUEUE_ERROR_INTERRUPT) tw_osl_strcpy(&str[tw_osl_strlen(str)], "Q_ERR,"); if (reg & TWA_STATUS_PCI_PARITY_ERROR_INTERRUPT) Modified: head/sys/dev/twa/tw_cl_share.h ============================================================================== --- head/sys/dev/twa/tw_cl_share.h Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_cl_share.h Mon Aug 30 19:15:04 2010 (r212008) @@ -349,10 +349,14 @@ extern TW_VOID tw_osl_breakpoint(TW_VOID #endif -#ifndef tw_osl_ctlr_busy -/* Called when CL is too busy to accept new requests. */ -extern TW_VOID tw_osl_ctlr_busy(struct tw_cl_ctlr_handle *ctlr_handle, - struct tw_cl_req_handle *req_handle); +#ifndef tw_osl_timeout +/* Start OS timeout() routine after controller reset sequence */ +extern TW_VOID tw_osl_timeout(struct tw_cl_req_handle *req_handle); +#endif + +#ifndef tw_osl_untimeout +/* Stop OS timeout() routine during controller reset sequence */ +extern TW_VOID tw_osl_untimeout(struct tw_cl_req_handle *req_handle); #endif @@ -552,6 +556,10 @@ extern TW_INT32 tw_cl_init_ctlr(struct t ); +extern TW_VOID tw_cl_set_reset_needed(struct tw_cl_ctlr_handle *ctlr_handle); +extern TW_INT32 tw_cl_is_reset_needed(struct tw_cl_ctlr_handle *ctlr_handle); +extern TW_INT32 tw_cl_is_active(struct tw_cl_ctlr_handle *ctlr_handle); + /* CL's interrupt handler. */ extern TW_INT32 tw_cl_interrupt(struct tw_cl_ctlr_handle *ctlr_handle); Modified: head/sys/dev/twa/tw_osl.h ============================================================================== --- head/sys/dev/twa/tw_osl.h Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_osl.h Mon Aug 30 19:15:04 2010 (r212008) @@ -77,6 +77,7 @@ EINPROGRESS */ #define TW_OSLI_REQ_FLAGS_PASSTHRU (1<<5) /* pass through request */ #define TW_OSLI_REQ_FLAGS_SLEEPING (1<<6) /* owner sleeping on this cmd */ +#define TW_OSLI_REQ_FLAGS_FAILED (1<<7) /* bus_dmamap_load() failed */ #ifdef TW_OSL_DEBUG @@ -100,6 +101,7 @@ struct tw_osli_req_context { struct twa_softc *ctlr; /* ptr to OSL's controller context */ TW_VOID *data; /* ptr to data being passed to CL */ TW_UINT32 length; /* length of buf being passed to CL */ + TW_UINT64 deadline;/* request timeout (in absolute time) */ /* * ptr to, and length of data passed to us from above, in case a buffer @@ -151,6 +153,9 @@ struct twa_softc { struct mtx sim_lock_handle;/* sim lock shared with cam */ struct mtx *sim_lock;/* ptr to sim lock */ + struct callout watchdog_callout[2]; /* For command timout */ + TW_UINT32 watchdog_index; + #ifdef TW_OSL_DEBUG struct tw_osli_q_stats q_stats[TW_OSLI_Q_COUNT];/* queue statistics */ #endif /* TW_OSL_DEBUG */ Modified: head/sys/dev/twa/tw_osl_cam.c ============================================================================== --- head/sys/dev/twa/tw_osl_cam.c Mon Aug 30 18:53:12 2010 (r212007) +++ head/sys/dev/twa/tw_osl_cam.c Mon Aug 30 19:15:04 2010 (r212008) @@ -55,7 +55,6 @@ static TW_VOID twa_action(struct cam_sim *sim, union ccb *ccb); static TW_VOID twa_poll(struct cam_sim *sim); -static TW_VOID twa_timeout(TW_VOID *arg); static TW_INT32 tw_osli_execute_scsi(struct tw_osli_req_context *req, union ccb *ccb); @@ -81,7 +80,7 @@ tw_osli_cam_attach(struct twa_softc *sc) /* * Create the device queue for our SIM. */ - if ((devq = cam_simq_alloc(TW_OSLI_MAX_NUM_REQUESTS)) == NULL) { + if ((devq = cam_simq_alloc(TW_OSLI_MAX_NUM_IOS)) == NULL) { tw_osli_printf(sc, "error = %d", TW_CL_SEVERITY_ERROR_STRING, TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, @@ -275,6 +274,7 @@ tw_osli_execute_scsi(struct tw_osli_req_ "I/O size too big", csio->dxfer_len); ccb_h->status = CAM_REQ_TOO_BIG; + ccb_h->status &= ~CAM_SIM_QUEUED; xpt_done(ccb); return(1); } @@ -290,6 +290,7 @@ tw_osli_execute_scsi(struct tw_osli_req_ 0x2107, "XPT_SCSI_IO: Got SGList"); ccb_h->status = CAM_REQ_INVALID; + ccb_h->status &= ~CAM_SIM_QUEUED; xpt_done(ccb); return(1); } @@ -306,13 +307,20 @@ tw_osli_execute_scsi(struct tw_osli_req_ return(1); } - ccb_h->timeout_ch = timeout(twa_timeout, req, - (ccb_h->timeout * hz) / 1000); + req->deadline = tw_osl_get_local_time() + (ccb_h->timeout / 1000); + + /* * twa_map_load_data_callback will fill in the SGL, * and submit the I/O. */ error = tw_osli_map_request(req); + if ((error) && (req->flags & TW_OSLI_REQ_FLAGS_FAILED)) { + req->deadline = 0; + ccb_h->status = CAM_REQ_CMP_ERR; + ccb_h->status &= ~CAM_SIM_QUEUED; + xpt_done(ccb); + } return(error); } @@ -345,10 +353,20 @@ twa_action(struct cam_sim *sim, union cc * Freeze the simq to maintain ccb ordering. The next * ccb that gets completed will unfreeze the simq. */ + ccb_h->status &= ~CAM_SIM_QUEUED; + ccb_h->status |= CAM_REQUEUE_REQ; + xpt_done(ccb); + break; + } + + if ((tw_cl_is_reset_needed(&(req->ctlr->ctlr_handle)))) { + ccb_h->status &= ~CAM_SIM_QUEUED; ccb_h->status |= CAM_REQUEUE_REQ; xpt_done(ccb); + tw_osli_req_q_insert_tail(req, TW_OSLI_FREE_Q); break; } + req->req_handle.osl_req_ctxt = req; req->req_handle.is_io = TW_CL_TRUE; req->orig_req = ccb; @@ -364,25 +382,14 @@ twa_action(struct cam_sim *sim, union cc break; case XPT_RESET_BUS: - tw_cl_create_event(&(sc->ctlr_handle), TW_CL_TRUE, + tw_cl_create_event(&(sc->ctlr_handle), TW_CL_FALSE, TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, 0x2108, 0x3, TW_CL_SEVERITY_INFO_STRING, "Received Reset Bus request from CAM", " "); - mtx_unlock(sc->sim_lock); - if (tw_cl_reset_ctlr(&sc->ctlr_handle)) { - tw_cl_create_event(&(sc->ctlr_handle), TW_CL_TRUE, - TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, - 0x2109, 0x1, TW_CL_SEVERITY_ERROR_STRING, - "Failed to reset bus", - " "); - ccb_h->status = CAM_REQ_CMP_ERR; - } - else - ccb_h->status = CAM_REQ_CMP; - - mtx_lock(sc->sim_lock); + tw_cl_set_reset_needed(&(sc->ctlr_handle)); + ccb_h->status = CAM_REQ_CMP; xpt_done(ccb); break; @@ -450,6 +457,7 @@ twa_action(struct cam_sim *sim, union cc path_inq->transport_version = 2; path_inq->protocol = PROTO_SCSI; path_inq->protocol_version = SCSI_REV_2; + path_inq->maxio = TW_CL_MAX_IO_SIZE; ccb_h->status = CAM_REQ_CMP; xpt_done(ccb); break; @@ -487,31 +495,6 @@ twa_poll(struct cam_sim *sim) /* - * Function name: twa_timeout - * Description: Driver entry point for being alerted on a request - * timing out. - * - * Input: arg -- ptr to timed out request - * Output: None - * Return value: None - */ -static TW_VOID -twa_timeout(TW_VOID *arg) -{ - struct tw_osli_req_context *req = - (struct tw_osli_req_context *)arg; - - tw_cl_create_event(&(req->ctlr->ctlr_handle), TW_CL_TRUE, - TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER, - 0x210B, 0x1, TW_CL_SEVERITY_ERROR_STRING, - "Request timed out!", - "request = %p", req); - tw_cl_reset_ctlr(&(req->ctlr->ctlr_handle)); -} - - - -/* * Function name: tw_osli_request_bus_scan * Description: Requests CAM for a scan of the bus. * @@ -574,20 +557,39 @@ tw_osli_disallow_new_requests(struct twa /* - * Function name: tw_osl_ctlr_busy - * Description: CL calls this function on cmd queue full or otherwise, - * when it is too busy to accept new requests. + * Function name: tw_osl_timeout + * Description: Call to timeout(). * - * Input: ctlr_handle -- ptr to controller handle - * req_handle -- ptr to request handle sent by OSL. + * Input: req_handle -- ptr to request handle sent by OSL. * Output: None * Return value: None */ TW_VOID -tw_osl_ctlr_busy(struct tw_cl_ctlr_handle *ctlr_handle, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:11:12 2010 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 3A7511065673; Mon, 30 Aug 2010 20:11:12 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0D80D8FC1A; Mon, 30 Aug 2010 20:11:12 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id B867C46B8E; Mon, 30 Aug 2010 16:11:11 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 991878A03C; Mon, 30 Aug 2010 16:10:58 -0400 (EDT) From: John Baldwin To: Xin LI Date: Mon, 30 Aug 2010 16:10:57 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201008301915.o7UJF4vE004461@svn.freebsd.org> In-Reply-To: <201008301915.o7UJF4vE004461@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201008301610.58047.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 30 Aug 2010 16:10:58 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212008 - head/sys/dev/twa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 20:11:12 -0000 On Monday, August 30, 2010 3:15:04 pm Xin LI wrote: > Author: delphij > Date: Mon Aug 30 19:15:04 2010 > New Revision: 212008 > URL: http://svn.freebsd.org/changeset/base/212008 > > Log: > Vendor update to version 3.80.06.003 to fix a panic with ZFS when under > heavy I/O load. > > Many thanks to LSI for continuing to support FreeBSD. > > PR: kern/149968 > Submitted by: LSI (Tom Couch) > Reported by: Kai Kockro > Tested by: Kai Kockro, jpaetzel > MFC after: 7 days Would you be able to provide more details of the changes? It seems that at least part of the changes might deal with how failures from bus_dmamap_load() are handled, but this commit message isn't very informative (which means it won't be very useful in the future when looking through commit history). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:30:49 2010 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 6DBB11065696; Mon, 30 Aug 2010 20:30:49 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43B3C8FC15; Mon, 30 Aug 2010 20:30:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UKUnZ4005969; Mon, 30 Aug 2010 20:30:49 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKUnur005967; Mon, 30 Aug 2010 20:30:49 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201008302030.o7UKUnur005967@svn.freebsd.org> From: Rui Paulo Date: Mon, 30 Aug 2010 20:30:49 +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: r212009 - 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: Mon, 30 Aug 2010 20:30:49 -0000 Author: rpaulo Date: Mon Aug 30 20:30:48 2010 New Revision: 212009 URL: http://svn.freebsd.org/changeset/base/212009 Log: Please welcome Dimitry Andric (dim@) as a src committer. Dimitry will be work on Clang for now. ed@ is a co-mentor. Approved by: core Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Mon Aug 30 19:15:04 2010 (r212008) +++ svnadmin/conf/access Mon Aug 30 20:30:48 2010 (r212009) @@ -63,6 +63,7 @@ delphij des dfr dg +dim dougb dumbbell dwhite From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:39:07 2010 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 6DE511065670; Mon, 30 Aug 2010 20:39:07 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43E008FC14; Mon, 30 Aug 2010 20:39:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UKd7NR006162; Mon, 30 Aug 2010 20:39:07 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKd72S006160; Mon, 30 Aug 2010 20:39:07 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201008302039.o7UKd72S006160@svn.freebsd.org> From: Rui Paulo Date: Mon, 30 Aug 2010 20:39:07 +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: r212010 - 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: Mon, 30 Aug 2010 20:39:07 -0000 Author: rpaulo Date: Mon Aug 30 20:39:06 2010 New Revision: 212010 URL: http://svn.freebsd.org/changeset/base/212010 Log: Add dim. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Aug 30 20:30:48 2010 (r212009) +++ svnadmin/conf/mentors Mon Aug 30 20:39:06 2010 (r212010) @@ -15,6 +15,7 @@ anchie bz andrew imp brucec rrs dchagin kib +dim rpaulo Co-mentor: ed eri mlaier Co-mentor: thompsa gabor delphij jinmei gnn From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:49:52 2010 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 41B481065674; Mon, 30 Aug 2010 20:49:52 +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 30C508FC1A; Mon, 30 Aug 2010 20:49:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UKnqlR006474; Mon, 30 Aug 2010 20:49:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKnqEa006472; Mon, 30 Aug 2010 20:49:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302049.o7UKnqEa006472@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 20:49:52 +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: r212011 - stable/8/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 20:49:52 -0000 Author: yongari Date: Mon Aug 30 20:49:51 2010 New Revision: 212011 URL: http://svn.freebsd.org/changeset/base/212011 Log: MFC r210904: Reduce Tx interrupt moderation timer from 50ms to 1ms. The default value resulted in poor performance for UDP packets. With this change, UDP bulk transfer performance is more than 940Mbps. While I'm here fix a wrong register definition. Modified: stable/8/sys/dev/alc/if_alcreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/8/sys/dev/alc/if_alcreg.h Mon Aug 30 20:39:06 2010 (r212010) +++ stable/8/sys/dev/alc/if_alcreg.h Mon Aug 30 20:49:51 2010 (r212011) @@ -106,8 +106,8 @@ #define ALC_MASTER_CFG 0x1400 #define MASTER_RESET 0x00000001 +#define MASTER_TEST_MODE_MASK 0x0000000C #define MASTER_BERT_START 0x00000010 -#define MASTER_TEST_MODE_MASK 0x000000C0 #define MASTER_MTIMER_ENB 0x00000100 #define MASTER_MANUAL_INTR_ENB 0x00000200 #define MASTER_IM_TX_TIMER_ENB 0x00000400 @@ -144,7 +144,7 @@ * alc(4) does not rely on Tx completion interrupts, so set it * somewhat large value to reduce Tx completion interrupts. */ -#define ALC_IM_TX_TIMER_DEFAULT 50000 /* 50ms */ +#define ALC_IM_TX_TIMER_DEFAULT 1000 /* 1ms */ #define ALC_GPHY_CFG 0x140C /* 16bits */ #define GPHY_CFG_EXT_RESET 0x0001 From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:52:29 2010 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 4C85510656AA; Mon, 30 Aug 2010 20:52:29 +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 3BA128FC17; Mon, 30 Aug 2010 20:52:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UKqT6W006574; Mon, 30 Aug 2010 20:52:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKqTgT006572; Mon, 30 Aug 2010 20:52:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302052.o7UKqTgT006572@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 20:52:29 +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: r212012 - stable/7/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 20:52:29 -0000 Author: yongari Date: Mon Aug 30 20:52:28 2010 New Revision: 212012 URL: http://svn.freebsd.org/changeset/base/212012 Log: MFC r210904: Reduce Tx interrupt moderation timer from 50ms to 1ms. The default value resulted in poor performance for UDP packets. With this change, UDP bulk transfer performance is more than 940Mbps. While I'm here fix a wrong register definition. Modified: stable/7/sys/dev/alc/if_alcreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/7/sys/dev/alc/if_alcreg.h Mon Aug 30 20:49:51 2010 (r212011) +++ stable/7/sys/dev/alc/if_alcreg.h Mon Aug 30 20:52:28 2010 (r212012) @@ -106,8 +106,8 @@ #define ALC_MASTER_CFG 0x1400 #define MASTER_RESET 0x00000001 +#define MASTER_TEST_MODE_MASK 0x0000000C #define MASTER_BERT_START 0x00000010 -#define MASTER_TEST_MODE_MASK 0x000000C0 #define MASTER_MTIMER_ENB 0x00000100 #define MASTER_MANUAL_INTR_ENB 0x00000200 #define MASTER_IM_TX_TIMER_ENB 0x00000400 @@ -144,7 +144,7 @@ * alc(4) does not rely on Tx completion interrupts, so set it * somewhat large value to reduce Tx completion interrupts. */ -#define ALC_IM_TX_TIMER_DEFAULT 50000 /* 50ms */ +#define ALC_IM_TX_TIMER_DEFAULT 1000 /* 1ms */ #define ALC_GPHY_CFG 0x140C /* 16bits */ #define GPHY_CFG_EXT_RESET 0x0001 From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:56:12 2010 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 7DFF91065675; Mon, 30 Aug 2010 20:56:12 +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 6D62C8FC12; Mon, 30 Aug 2010 20:56:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UKuCfY006699; Mon, 30 Aug 2010 20:56:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKuCfI006697; Mon, 30 Aug 2010 20:56:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302056.o7UKuCfI006697@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 20:56: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: r212013 - 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: Mon, 30 Aug 2010 20:56:12 -0000 Author: yongari Date: Mon Aug 30 20:56:12 2010 New Revision: 212013 URL: http://svn.freebsd.org/changeset/base/212013 Log: MFC r210905: Reflect default Tx interrupt moderation timer value change(50ms -> 1ms). Modified: stable/8/share/man/man4/alc.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/alc.4 ============================================================================== --- stable/8/share/man/man4/alc.4 Mon Aug 30 20:52:28 2010 (r212012) +++ stable/8/share/man/man4/alc.4 Mon Aug 30 20:56:12 2010 (r212013) @@ -133,7 +133,7 @@ Value 0 completely disables the interrup .It Va dev.alc.%d.int_tx_mod Maximum amount of time to delay transmit interrupt processing in units of 1us. -The accepted range is 0 to 130000, the default is 50000(50ms). +The accepted range is 0 to 130000, the default is 1000(1ms). Value 0 completely disables the interrupt moderation. .It Va dev.alc.%d.process_limit Maximum amount of Rx frames to be processed in the event loop before From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:56:59 2010 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 8FF5410656B1; Mon, 30 Aug 2010 20:56:59 +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 7F3C48FC18; Mon, 30 Aug 2010 20:56:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UKuxES006756; Mon, 30 Aug 2010 20:56:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKuxjv006754; Mon, 30 Aug 2010 20:56:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302056.o7UKuxjv006754@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 20:56:59 +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: r212014 - stable/7/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: Mon, 30 Aug 2010 20:56:59 -0000 Author: yongari Date: Mon Aug 30 20:56:59 2010 New Revision: 212014 URL: http://svn.freebsd.org/changeset/base/212014 Log: MFC r210905: Reflect default Tx interrupt moderation timer value change(50ms -> 1ms). Modified: stable/7/share/man/man4/alc.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/alc.4 ============================================================================== --- stable/7/share/man/man4/alc.4 Mon Aug 30 20:56:12 2010 (r212013) +++ stable/7/share/man/man4/alc.4 Mon Aug 30 20:56:59 2010 (r212014) @@ -133,7 +133,7 @@ Value 0 completely disables the interrup .It Va dev.alc.%d.int_tx_mod Maximum amount of time to delay transmit interrupt processing in units of 1us. -The accepted range is 0 to 130000, the default is 50000(50ms). +The accepted range is 0 to 130000, the default is 1000(1ms). Value 0 completely disables the interrupt moderation. .It Va dev.alc.%d.process_limit Maximum amount of Rx frames to be processed in the event loop before From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:58:30 2010 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 BF43410656A6; Mon, 30 Aug 2010 20:58:30 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 5A7398FC18; Mon, 30 Aug 2010 20:58:29 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 1D08645E87; Mon, 30 Aug 2010 22:58:28 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 023B245DD8; Mon, 30 Aug 2010 22:58:21 +0200 (CEST) Date: Mon, 30 Aug 2010 22:58:14 +0200 From: Pawel Jakub Dawidek To: "M. Warner Losh" Message-ID: <20100830205814.GF1871@garage.freebsd.pl> References: <201008232204.o7NM4UPA054870@svn.freebsd.org> <20100823.173600.180924398998066421.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/Zw+/jwnNHcBRYYu" Content-Disposition: inline In-Reply-To: <20100823.173600.180924398998066421.imp@bsdimp.com> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@FreeBSD.org, marius@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r211722 - head/cddl/lib/libzpool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 20:58:30 -0000 --/Zw+/jwnNHcBRYYu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 23, 2010 at 05:36:00PM -0600, M. Warner Losh wrote: > In message: <201008232204.o7NM4UPA054870@svn.freebsd.org> > Marius Strobl writes: > : Author: marius > : Date: Mon Aug 23 22:04:30 2010 > : New Revision: 211722 > : URL: http://svn.freebsd.org/changeset/base/211722 > :=20 > : Log: > : Use real atomic operations for sparc64. > : =20 > : MFC after: 1 week > :=20 > : Modified: > : head/cddl/lib/libzpool/Makefile > :=20 > : Modified: head/cddl/lib/libzpool/Makefile > : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=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/cddl/lib/libzpool/Makefile Mon Aug 23 21:40:03 2010 (r211721) > : +++ head/cddl/lib/libzpool/Makefile Mon Aug 23 22:04:30 2010 (r211722) > : @@ -11,7 +11,7 @@ > : # LIST_SRCS > : .PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/os > : # ATOMIC_SRCS > : -.if ${MACHINE_ARCH} =3D=3D "i386" || ${MACHINE_ARCH} =3D=3D "amd64" ||= ${MACHINE_ARCH} =3D=3D "ia64" || ${MACHINE_ARCH} =3D=3D "powerpc64" > : +.if ${MACHINE_ARCH} =3D=3D "i386" || ${MACHINE_ARCH} =3D=3D "amd64" ||= ${MACHINE_ARCH} =3D=3D "ia64" || ${MACHINE_ARCH} =3D=3D "sparc64" || ${MAC= HINE_ARCH} =3D=3D "powerpc64" > : .PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/= ${MACHINE_ARCH} > : ATOMIC_SRCS=3D opensolaris_atomic.S > : .else >=20 > I find it disturbing that we have 3 or 4 copies of this code in our > Makefiles... Then you will like @183089 :) --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --/Zw+/jwnNHcBRYYu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkx8G2UACgkQForvXbEpPzR/YgCgxV1kqM98hk1vULOaYj7WD6t9 FrMAoKximnj9Mgpxj3EYO4OMWJlAmeIY =i/NF -----END PGP SIGNATURE----- --/Zw+/jwnNHcBRYYu-- From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 20:59:14 2010 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 436091065693; Mon, 30 Aug 2010 20:59:14 +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 326EF8FC1D; Mon, 30 Aug 2010 20:59:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UKxEj8006847; Mon, 30 Aug 2010 20:59:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UKxEKo006844; Mon, 30 Aug 2010 20:59:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302059.o7UKxEKo006844@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 20:59: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: r212015 - stable/8/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 20:59:14 -0000 Author: yongari Date: Mon Aug 30 20:59:13 2010 New Revision: 212015 URL: http://svn.freebsd.org/changeset/base/212015 Log: MFC r211046: Marvell model number 0x06 is 88E1101 PHY. Modified: stable/8/sys/dev/mii/e1000phy.c stable/8/sys/dev/mii/miidevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/e1000phy.c ============================================================================== --- stable/8/sys/dev/mii/e1000phy.c Mon Aug 30 20:56:59 2010 (r212014) +++ stable/8/sys/dev/mii/e1000phy.c Mon Aug 30 20:59:13 2010 (r212015) @@ -103,7 +103,7 @@ static const struct mii_phydesc e1000phy MII_PHY_DESC(MARVELL, E1000_3), MII_PHY_DESC(MARVELL, E1000S), MII_PHY_DESC(MARVELL, E1000_5), - MII_PHY_DESC(MARVELL, E1000_6), + MII_PHY_DESC(MARVELL, E1101), MII_PHY_DESC(MARVELL, E3082), MII_PHY_DESC(MARVELL, E1112), MII_PHY_DESC(MARVELL, E1149), Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Mon Aug 30 20:56:59 2010 (r212014) +++ stable/8/sys/dev/mii/miidevs Mon Aug 30 20:59:13 2010 (r212015) @@ -245,7 +245,7 @@ model MARVELL E1011 0x0002 Marvell 88E1 model MARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY model MARVELL E1000S 0x0004 Marvell 88E1000S Gigabit PHY model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY -model MARVELL E1000_6 0x0006 Marvell 88E1000 Gigabit PHY +model MARVELL E1101 0x0006 Marvell 88E1101 Gigabit PHY model MARVELL E3082 0x0008 Marvell 88E3082 10/100 Fast Ethernet PHY model MARVELL E1112 0x0009 Marvell 88E1112 Gigabit PHY model MARVELL E1149 0x000b Marvell 88E1149 Gigabit PHY From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:00:38 2010 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 EEE8E1065783; Mon, 30 Aug 2010 21:00:37 +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 DE3778FC26; Mon, 30 Aug 2010 21:00:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UL0bl6006956; Mon, 30 Aug 2010 21:00:37 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UL0bFR006953; Mon, 30 Aug 2010 21:00:37 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302100.o7UL0bFR006953@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:00:37 +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: r212016 - stable/7/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:00:38 -0000 Author: yongari Date: Mon Aug 30 21:00:37 2010 New Revision: 212016 URL: http://svn.freebsd.org/changeset/base/212016 Log: MFC r211046: Marvell model number 0x06 is 88E1101 PHY. Modified: stable/7/sys/dev/mii/e1000phy.c stable/7/sys/dev/mii/miidevs Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mii/e1000phy.c ============================================================================== --- stable/7/sys/dev/mii/e1000phy.c Mon Aug 30 20:59:13 2010 (r212015) +++ stable/7/sys/dev/mii/e1000phy.c Mon Aug 30 21:00:37 2010 (r212016) @@ -103,7 +103,7 @@ static const struct mii_phydesc e1000phy MII_PHY_DESC(MARVELL, E1000_3), MII_PHY_DESC(MARVELL, E1000S), MII_PHY_DESC(MARVELL, E1000_5), - MII_PHY_DESC(MARVELL, E1000_6), + MII_PHY_DESC(MARVELL, E1101), MII_PHY_DESC(MARVELL, E3082), MII_PHY_DESC(MARVELL, E1112), MII_PHY_DESC(MARVELL, E1149), Modified: stable/7/sys/dev/mii/miidevs ============================================================================== --- stable/7/sys/dev/mii/miidevs Mon Aug 30 20:59:13 2010 (r212015) +++ stable/7/sys/dev/mii/miidevs Mon Aug 30 21:00:37 2010 (r212016) @@ -235,7 +235,7 @@ model MARVELL E1011 0x0002 Marvell 88E1 model MARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY model MARVELL E1000S 0x0004 Marvell 88E1000S Gigabit PHY model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY -model MARVELL E1000_6 0x0006 Marvell 88E1000 Gigabit PHY +model MARVELL E1101 0x0006 Marvell 88E1101 Gigabit PHY model MARVELL E3082 0x0008 Marvell 88E3082 10/100 Fast Ethernet PHY model MARVELL E1112 0x0009 Marvell 88E1112 Gigabit PHY model MARVELL E1149 0x000b Marvell 88E1149 Gigabit PHY From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:07:26 2010 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 BD93D106566C; Mon, 30 Aug 2010 21:07:26 +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 ABC148FC0A; Mon, 30 Aug 2010 21:07:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UL7Q4V007199; Mon, 30 Aug 2010 21:07:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UL7QHW007196; Mon, 30 Aug 2010 21:07:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302107.o7UL7QHW007196@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:07:26 +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: r212017 - stable/8/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:07:26 -0000 Author: yongari Date: Mon Aug 30 21:07:26 2010 New Revision: 212017 URL: http://svn.freebsd.org/changeset/base/212017 Log: MFC r211047-211048,211051-211053,211285: r211047: Controller does not seem to support more than 1024 bytes DMA burst. Limit DMA burst size to be less than or equal to 1024 bytes. r211048: Do not touch CMB TX threshold register when CMB is not used. Note, alc(4) does not use CMB at all due to silicon bug. r211051: Always disable ASPM L0s and enable L1 before entering into WOL suspend state. Also disable master clock after PHY power down, this is supposed to save more power. The master clock should be enabled if WOL is active. r211052: Remove unnecessary assignment. r211053: Cache PCIY_PMG and PCIY_EXPRESS capability pointer to softc and use it instead of calling pci_find_extcap(). r211285: Make sure to disable RX MAC in alc_stop_mac(). Previously there was a logic error which it always enabled RX MAC. Modified: stable/8/sys/dev/alc/if_alc.c stable/8/sys/dev/alc/if_alcvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Mon Aug 30 21:00:37 2010 (r212016) +++ stable/8/sys/dev/alc/if_alc.c Mon Aug 30 21:07:26 2010 (r212017) @@ -569,7 +569,7 @@ alc_attach(device_t dev) struct ifnet *ifp; char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/l1" }; uint16_t burst; - int base, error, i, msic, msixc, pmc, state; + int base, error, i, msic, msixc, state; uint32_t cap, ctl, val; error = 0; @@ -600,6 +600,7 @@ alc_attach(device_t dev) sc->alc_rcb = DMA_CFG_RCB_64; if (pci_find_extcap(dev, PCIY_EXPRESS, &base) == 0) { sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; burst = CSR_READ_2(sc, base + PCIR_EXPRESS_DEVICE_CTL); sc->alc_dma_rd_burst = (burst & PCIM_EXP_CTL_MAX_READ_REQUEST) >> 12; @@ -610,6 +611,10 @@ alc_attach(device_t dev) device_printf(dev, "TLP payload size : %u bytes.\n", alc_dma_burst[sc->alc_dma_wr_burst]); } + if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) + sc->alc_dma_rd_burst = 3; + if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) + sc->alc_dma_wr_burst = 3; /* Clear data link and flow-control protocol error. */ val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); @@ -739,8 +744,11 @@ alc_attach(device_t dev) IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_TSO4; ifp->if_hwassist = ALC_CSUM_FEATURES | CSUM_TSO; - if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0) + if (pci_find_extcap(dev, PCIY_PMG, &base) == 0) { ifp->if_capabilities |= IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST; + sc->alc_flags |= ALC_FLAG_PM; + sc->alc_pmcap = base; + } ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ @@ -1669,20 +1677,14 @@ static void alc_setwol(struct alc_softc *sc) { struct ifnet *ifp; - uint32_t cap, reg, pmcs; + uint32_t reg, pmcs; uint16_t pmstat; - int base, pmc; ALC_LOCK_ASSERT(sc); - if (pci_find_extcap(sc->alc_dev, PCIY_EXPRESS, &base) == 0) { - cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CAP); - if ((cap & PCIM_LINK_CAP_ASPM) != 0) { - cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CTL); - alc_disable_l0s_l1(sc); - } - } - if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) != 0) { + alc_disable_l0s_l1(sc); + ifp = sc->alc_ifp; + if ((sc->alc_flags & ALC_FLAG_PM) == 0) { /* Disable WOL. */ CSR_WRITE_4(sc, ALC_WOL_CFG, 0); reg = CSR_READ_4(sc, ALC_PCIE_PHYMISC); @@ -1690,16 +1692,16 @@ alc_setwol(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, reg); /* Force PHY power down. */ alc_phy_down(sc); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); return; } - ifp = sc->alc_ifp; if ((ifp->if_capenable & IFCAP_WOL) != 0) { if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0) alc_setlinkspeed(sc); - reg = CSR_READ_4(sc, ALC_MASTER_CFG); - reg &= ~MASTER_CLK_SEL_DIS; - CSR_WRITE_4(sc, ALC_MASTER_CFG, reg); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) & ~MASTER_CLK_SEL_DIS); } pmcs = 0; @@ -1721,13 +1723,17 @@ alc_setwol(struct alc_softc *sc) if ((ifp->if_capenable & IFCAP_WOL) == 0) { /* WOL disabled, PHY power down. */ alc_phy_down(sc); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); } /* Request PME. */ - pmstat = pci_read_config(sc->alc_dev, pmc + PCIR_POWER_STATUS, 2); + pmstat = pci_read_config(sc->alc_dev, + sc->alc_pmcap + 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->alc_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + pci_write_config(sc->alc_dev, + sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2); } static int @@ -1750,20 +1756,19 @@ alc_resume(device_t dev) { struct alc_softc *sc; struct ifnet *ifp; - int pmc; uint16_t pmstat; sc = device_get_softc(dev); ALC_LOCK(sc); - if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) == 0) { + if ((sc->alc_flags & ALC_FLAG_PM) != 0) { /* Disable PME and clear PME status. */ pmstat = pci_read_config(sc->alc_dev, - pmc + PCIR_POWER_STATUS, 2); + sc->alc_pmcap + PCIR_POWER_STATUS, 2); if ((pmstat & PCIM_PSTAT_PMEENABLE) != 0) { pmstat &= ~PCIM_PSTAT_PMEENABLE; pci_write_config(sc->alc_dev, - pmc + PCIR_POWER_STATUS, pmstat, 2); + sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2); } } /* Reset PHY. */ @@ -2986,10 +2991,10 @@ alc_init_locked(struct alc_softc *sc) */ CSR_WRITE_4(sc, ALC_INTR_RETRIG_TIMER, ALC_USECS(0)); /* Configure CMB. */ - CSR_WRITE_4(sc, ALC_CMB_TD_THRESH, 4); - if ((sc->alc_flags & ALC_FLAG_CMB_BUG) == 0) + if ((sc->alc_flags & ALC_FLAG_CMB_BUG) == 0) { + CSR_WRITE_4(sc, ALC_CMB_TD_THRESH, 4); CSR_WRITE_4(sc, ALC_CMB_TX_TIMER, ALC_USECS(5000)); - else + } else CSR_WRITE_4(sc, ALC_CMB_TX_TIMER, ALC_USECS(0)); /* * Hardware can be configured to issue SMB interrupt based @@ -3226,7 +3231,7 @@ alc_stop_mac(struct alc_softc *sc) /* Disable Rx/Tx MAC. */ reg = CSR_READ_4(sc, ALC_MAC_CFG); if ((reg & (MAC_CFG_TX_ENB | MAC_CFG_RX_ENB)) != 0) { - reg &= ~MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; + reg &= ~(MAC_CFG_TX_ENB | MAC_CFG_RX_ENB); CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } for (i = ALC_TIMEOUT; i > 0; i--) { Modified: stable/8/sys/dev/alc/if_alcvar.h ============================================================================== --- stable/8/sys/dev/alc/if_alcvar.h Mon Aug 30 21:00:37 2010 (r212016) +++ stable/8/sys/dev/alc/if_alcvar.h Mon Aug 30 21:07:26 2010 (r212017) @@ -211,11 +211,14 @@ struct alc_softc { uint32_t alc_dma_rd_burst; uint32_t alc_dma_wr_burst; uint32_t alc_rcb; + int alc_expcap; + int alc_pmcap; int alc_flags; #define ALC_FLAG_PCIE 0x0001 #define ALC_FLAG_PCIX 0x0002 #define ALC_FLAG_MSI 0x0004 #define ALC_FLAG_MSIX 0x0008 +#define ALC_FLAG_PM 0x0010 #define ALC_FLAG_FASTETHER 0x0020 #define ALC_FLAG_JUMBO 0x0040 #define ALC_FLAG_ASPM_MON 0x0080 From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:09:37 2010 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 9A78110656B6; Mon, 30 Aug 2010 21:09:37 +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 88C628FC14; Mon, 30 Aug 2010 21:09:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UL9bVR007344; Mon, 30 Aug 2010 21:09:37 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UL9bln007341; Mon, 30 Aug 2010 21:09:37 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302109.o7UL9bln007341@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:09:37 +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: r212018 - stable/7/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:09:37 -0000 Author: yongari Date: Mon Aug 30 21:09:37 2010 New Revision: 212018 URL: http://svn.freebsd.org/changeset/base/212018 Log: MFC r211047-211048,211051-211053,211285: r211047: Controller does not seem to support more than 1024 bytes DMA burst. Limit DMA burst size to be less than or equal to 1024 bytes. r211048: Do not touch CMB TX threshold register when CMB is not used. Note, alc(4) does not use CMB at all due to silicon bug. r211051: Always disable ASPM L0s and enable L1 before entering into WOL suspend state. Also disable master clock after PHY power down, this is supposed to save more power. The master clock should be enabled if WOL is active. r211052: Remove unnecessary assignment. r211053: Cache PCIY_PMG and PCIY_EXPRESS capability pointer to softc and use it instead of calling pci_find_extcap(). r211285: Make sure to disable RX MAC in alc_stop_mac(). Previously there was a logic error which it always enabled RX MAC. Modified: stable/7/sys/dev/alc/if_alc.c stable/7/sys/dev/alc/if_alcvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Mon Aug 30 21:07:26 2010 (r212017) +++ stable/7/sys/dev/alc/if_alc.c Mon Aug 30 21:09:37 2010 (r212018) @@ -569,7 +569,7 @@ alc_attach(device_t dev) struct ifnet *ifp; char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/l1" }; uint16_t burst; - int base, error, i, msic, msixc, pmc, state; + int base, error, i, msic, msixc, state; uint32_t cap, ctl, val; error = 0; @@ -600,6 +600,7 @@ alc_attach(device_t dev) sc->alc_rcb = DMA_CFG_RCB_64; if (pci_find_extcap(dev, PCIY_EXPRESS, &base) == 0) { sc->alc_flags |= ALC_FLAG_PCIE; + sc->alc_expcap = base; burst = CSR_READ_2(sc, base + PCIR_EXPRESS_DEVICE_CTL); sc->alc_dma_rd_burst = (burst & PCIM_EXP_CTL_MAX_READ_REQUEST) >> 12; @@ -610,6 +611,10 @@ alc_attach(device_t dev) device_printf(dev, "TLP payload size : %u bytes.\n", alc_dma_burst[sc->alc_dma_wr_burst]); } + if (alc_dma_burst[sc->alc_dma_rd_burst] > 1024) + sc->alc_dma_rd_burst = 3; + if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024) + sc->alc_dma_wr_burst = 3; /* Clear data link and flow-control protocol error. */ val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); @@ -739,8 +744,11 @@ alc_attach(device_t dev) IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_TSO4; ifp->if_hwassist = ALC_CSUM_FEATURES | CSUM_TSO; - if (pci_find_extcap(dev, PCIY_PMG, &pmc) == 0) + if (pci_find_extcap(dev, PCIY_PMG, &base) == 0) { ifp->if_capabilities |= IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST; + sc->alc_flags |= ALC_FLAG_PM; + sc->alc_pmcap = base; + } ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ @@ -1669,20 +1677,14 @@ static void alc_setwol(struct alc_softc *sc) { struct ifnet *ifp; - uint32_t cap, reg, pmcs; + uint32_t reg, pmcs; uint16_t pmstat; - int base, pmc; ALC_LOCK_ASSERT(sc); - if (pci_find_extcap(sc->alc_dev, PCIY_EXPRESS, &base) == 0) { - cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CAP); - if ((cap & PCIM_LINK_CAP_ASPM) != 0) { - cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CTL); - alc_disable_l0s_l1(sc); - } - } - if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) != 0) { + alc_disable_l0s_l1(sc); + ifp = sc->alc_ifp; + if ((sc->alc_flags & ALC_FLAG_PM) == 0) { /* Disable WOL. */ CSR_WRITE_4(sc, ALC_WOL_CFG, 0); reg = CSR_READ_4(sc, ALC_PCIE_PHYMISC); @@ -1690,16 +1692,16 @@ alc_setwol(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, reg); /* Force PHY power down. */ alc_phy_down(sc); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); return; } - ifp = sc->alc_ifp; if ((ifp->if_capenable & IFCAP_WOL) != 0) { if ((sc->alc_flags & ALC_FLAG_FASTETHER) == 0) alc_setlinkspeed(sc); - reg = CSR_READ_4(sc, ALC_MASTER_CFG); - reg &= ~MASTER_CLK_SEL_DIS; - CSR_WRITE_4(sc, ALC_MASTER_CFG, reg); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) & ~MASTER_CLK_SEL_DIS); } pmcs = 0; @@ -1721,13 +1723,17 @@ alc_setwol(struct alc_softc *sc) if ((ifp->if_capenable & IFCAP_WOL) == 0) { /* WOL disabled, PHY power down. */ alc_phy_down(sc); + CSR_WRITE_4(sc, ALC_MASTER_CFG, + CSR_READ_4(sc, ALC_MASTER_CFG) | MASTER_CLK_SEL_DIS); } /* Request PME. */ - pmstat = pci_read_config(sc->alc_dev, pmc + PCIR_POWER_STATUS, 2); + pmstat = pci_read_config(sc->alc_dev, + sc->alc_pmcap + 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->alc_dev, pmc + PCIR_POWER_STATUS, pmstat, 2); + pci_write_config(sc->alc_dev, + sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2); } static int @@ -1750,20 +1756,19 @@ alc_resume(device_t dev) { struct alc_softc *sc; struct ifnet *ifp; - int pmc; uint16_t pmstat; sc = device_get_softc(dev); ALC_LOCK(sc); - if (pci_find_extcap(sc->alc_dev, PCIY_PMG, &pmc) == 0) { + if ((sc->alc_flags & ALC_FLAG_PM) != 0) { /* Disable PME and clear PME status. */ pmstat = pci_read_config(sc->alc_dev, - pmc + PCIR_POWER_STATUS, 2); + sc->alc_pmcap + PCIR_POWER_STATUS, 2); if ((pmstat & PCIM_PSTAT_PMEENABLE) != 0) { pmstat &= ~PCIM_PSTAT_PMEENABLE; pci_write_config(sc->alc_dev, - pmc + PCIR_POWER_STATUS, pmstat, 2); + sc->alc_pmcap + PCIR_POWER_STATUS, pmstat, 2); } } /* Reset PHY. */ @@ -2986,10 +2991,10 @@ alc_init_locked(struct alc_softc *sc) */ CSR_WRITE_4(sc, ALC_INTR_RETRIG_TIMER, ALC_USECS(0)); /* Configure CMB. */ - CSR_WRITE_4(sc, ALC_CMB_TD_THRESH, 4); - if ((sc->alc_flags & ALC_FLAG_CMB_BUG) == 0) + if ((sc->alc_flags & ALC_FLAG_CMB_BUG) == 0) { + CSR_WRITE_4(sc, ALC_CMB_TD_THRESH, 4); CSR_WRITE_4(sc, ALC_CMB_TX_TIMER, ALC_USECS(5000)); - else + } else CSR_WRITE_4(sc, ALC_CMB_TX_TIMER, ALC_USECS(0)); /* * Hardware can be configured to issue SMB interrupt based @@ -3226,7 +3231,7 @@ alc_stop_mac(struct alc_softc *sc) /* Disable Rx/Tx MAC. */ reg = CSR_READ_4(sc, ALC_MAC_CFG); if ((reg & (MAC_CFG_TX_ENB | MAC_CFG_RX_ENB)) != 0) { - reg &= ~MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; + reg &= ~(MAC_CFG_TX_ENB | MAC_CFG_RX_ENB); CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } for (i = ALC_TIMEOUT; i > 0; i--) { Modified: stable/7/sys/dev/alc/if_alcvar.h ============================================================================== --- stable/7/sys/dev/alc/if_alcvar.h Mon Aug 30 21:07:26 2010 (r212017) +++ stable/7/sys/dev/alc/if_alcvar.h Mon Aug 30 21:09:37 2010 (r212018) @@ -211,11 +211,14 @@ struct alc_softc { uint32_t alc_dma_rd_burst; uint32_t alc_dma_wr_burst; uint32_t alc_rcb; + int alc_expcap; + int alc_pmcap; int alc_flags; #define ALC_FLAG_PCIE 0x0001 #define ALC_FLAG_PCIX 0x0002 #define ALC_FLAG_MSI 0x0004 #define ALC_FLAG_MSIX 0x0008 +#define ALC_FLAG_PM 0x0010 #define ALC_FLAG_FASTETHER 0x0020 #define ALC_FLAG_JUMBO 0x0040 #define ALC_FLAG_ASPM_MON 0x0080 From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:11:45 2010 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 B86A8106566C; Mon, 30 Aug 2010 21:11:45 +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 A78FE8FC1C; Mon, 30 Aug 2010 21:11:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULBjU3007454; Mon, 30 Aug 2010 21:11:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULBj38007451; Mon, 30 Aug 2010 21:11:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302111.o7ULBj38007451@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:11: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: r212019 - stable/8/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:11:45 -0000 Author: yongari Date: Mon Aug 30 21:11:45 2010 New Revision: 212019 URL: http://svn.freebsd.org/changeset/base/212019 Log: MFC r211103: Add F1 PHY found on Atheros AR8151 v2.0 PCIe gigabit ethernet controller. Modified: stable/8/sys/dev/mii/atphy.c stable/8/sys/dev/mii/miidevs Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/mii/atphy.c ============================================================================== --- stable/8/sys/dev/mii/atphy.c Mon Aug 30 21:09:37 2010 (r212018) +++ stable/8/sys/dev/mii/atphy.c Mon Aug 30 21:11:45 2010 (r212019) @@ -86,6 +86,7 @@ static int atphy_auto(struct mii_softc * static const struct mii_phydesc atphys[] = { MII_PHY_DESC(ATHEROS, F1), + MII_PHY_DESC(ATHEROS, F1_7), MII_PHY_DESC(ATHEROS, F2), MII_PHY_END }; Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Mon Aug 30 21:09:37 2010 (r212018) +++ stable/8/sys/dev/mii/miidevs Mon Aug 30 21:11:45 2010 (r212019) @@ -128,6 +128,7 @@ model ASIX AX88X9X 0x0031 Ax88x9x inter /* Atheros Communications/Attansic PHYs. */ model ATHEROS F1 0x0001 Atheros F1 10/100/1000 PHY model ATHEROS F2 0x0002 Atheros F2 10/100 PHY +model ATHEROS F1_7 0x0007 Atheros F1 10/100/1000 PHY /* Broadcom Corp. PHYs. */ model BROADCOM 3C905B 0x0012 3c905B 10/100 internal PHY From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:13:09 2010 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 36D5310656B1; Mon, 30 Aug 2010 21:13:09 +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 260098FC18; Mon, 30 Aug 2010 21:13:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULD9iP007532; Mon, 30 Aug 2010 21:13:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULD9Ij007529; Mon, 30 Aug 2010 21:13:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302113.o7ULD9Ij007529@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:13:09 +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: r212020 - stable/7/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:13:09 -0000 Author: yongari Date: Mon Aug 30 21:13:08 2010 New Revision: 212020 URL: http://svn.freebsd.org/changeset/base/212020 Log: MFC r211103: Add F1 PHY found on Atheros AR8151 v2.0 PCIe gigabit ethernet controller. Modified: stable/7/sys/dev/mii/atphy.c stable/7/sys/dev/mii/miidevs Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mii/atphy.c ============================================================================== --- stable/7/sys/dev/mii/atphy.c Mon Aug 30 21:11:45 2010 (r212019) +++ stable/7/sys/dev/mii/atphy.c Mon Aug 30 21:13:08 2010 (r212020) @@ -86,6 +86,7 @@ static int atphy_auto(struct mii_softc * static const struct mii_phydesc atphys[] = { MII_PHY_DESC(ATHEROS, F1), + MII_PHY_DESC(ATHEROS, F1_7), MII_PHY_DESC(ATHEROS, F2), MII_PHY_END }; Modified: stable/7/sys/dev/mii/miidevs ============================================================================== --- stable/7/sys/dev/mii/miidevs Mon Aug 30 21:11:45 2010 (r212019) +++ stable/7/sys/dev/mii/miidevs Mon Aug 30 21:13:08 2010 (r212020) @@ -123,6 +123,7 @@ model xxAMD 79C873 0x0000 Am79C873/DM91 /* Atheros Communications/Attansic PHYs. */ model ATHEROS F1 0x0001 Atheros F1 10/100/1000 PHY model ATHEROS F2 0x0002 Atheros F2 10/100 PHY +model ATHEROS F1_7 0x0007 Atheros F1 10/100/1000 PHY /* Broadcom Corp. PHYs. */ model BROADCOM 3C905B 0x0012 3c905B 10/100 internal PHY From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:13:09 2010 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 6CFEA10656B2; Mon, 30 Aug 2010 21:13:09 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 2B4678FC1C; Mon, 30 Aug 2010 21:13:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o7UL5gEp074786; Mon, 30 Aug 2010 15:05:42 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 30 Aug 2010 15:05:43 -0600 (MDT) Message-Id: <20100830.150543.994771096126846682.imp@bsdimp.com> To: pjd@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20100830205814.GF1871@garage.freebsd.pl> References: <201008232204.o7NM4UPA054870@svn.freebsd.org> <20100823.173600.180924398998066421.imp@bsdimp.com> <20100830205814.GF1871@garage.freebsd.pl> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, marius@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org Subject: Re: svn commit: r211722 - head/cddl/lib/libzpool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:13:09 -0000 In message: <20100830205814.GF1871@garage.freebsd.pl> Pawel Jakub Dawidek writes: : On Mon, Aug 23, 2010 at 05:36:00PM -0600, M. Warner Losh wrote: : > In message: <201008232204.o7NM4UPA054870@svn.freebsd.org> : > Marius Strobl writes: : > : Author: marius : > : Date: Mon Aug 23 22:04:30 2010 : > : New Revision: 211722 : > : URL: http://svn.freebsd.org/changeset/base/211722 : > : : > : Log: : > : Use real atomic operations for sparc64. : > : : > : MFC after: 1 week : > : : > : Modified: : > : head/cddl/lib/libzpool/Makefile : > : : > : Modified: head/cddl/lib/libzpool/Makefile : > : ============================================================================== : > : --- head/cddl/lib/libzpool/Makefile Mon Aug 23 21:40:03 2010 (r211721) : > : +++ head/cddl/lib/libzpool/Makefile Mon Aug 23 22:04:30 2010 (r211722) : > : @@ -11,7 +11,7 @@ : > : # LIST_SRCS : > : .PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/os : > : # ATOMIC_SRCS : > : -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "powerpc64" : > : +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "powerpc64" : > : .PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH} : > : ATOMIC_SRCS= opensolaris_atomic.S : > : .else : > : > I find it disturbing that we have 3 or 4 copies of this code in our : > Makefiles... : : Then you will like @183089 :) Yea, I have something very similar in my TBEMD branch... :) Warner From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:15:40 2010 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 50DB910656A9; Mon, 30 Aug 2010 21:15:40 +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 3E8888FC21; Mon, 30 Aug 2010 21:15:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULFesQ007677; Mon, 30 Aug 2010 21:15:40 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULFeCf007673; Mon, 30 Aug 2010 21:15:40 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302115.o7ULFeCf007673@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:15:40 +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: r212021 - stable/8/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:15:40 -0000 Author: yongari Date: Mon Aug 30 21:15:40 2010 New Revision: 212021 URL: http://svn.freebsd.org/changeset/base/212021 Log: MFC r211105: Add support for Atheros AR8151/AR8152 PCIe gigabit/fast ethernet controller. These controllers are known as L1D(AR8151) and L2CB/B2(AR8152). This change adds supports for the following controllers. o AR8151 v1.0(L1D) gigabit ethernet controller o AR8151 v2.0(L1D) gigabit ethernet controller o AR8152 v1.1(L2CB) fast ethernet controller o AR8152 v2.0(L2CB2) fast ethernet controller These controllers have the same feature of AR8131/AR8132 and support improved power saving control. The user visible change at this moment is reduced jumbo frame size from 9KB to 6KB. Many thanks to Atheros for continuing to support FreeBSD. HW donated by: Atheros Communications, Inc. Modified: stable/8/sys/dev/alc/if_alc.c stable/8/sys/dev/alc/if_alcreg.h stable/8/sys/dev/alc/if_alcvar.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/alc/if_alc.c ============================================================================== --- stable/8/sys/dev/alc/if_alc.c Mon Aug 30 21:13:08 2010 (r212020) +++ stable/8/sys/dev/alc/if_alc.c Mon Aug 30 21:15:40 2010 (r212021) @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -/* Driver for Atheros AR8131/AR8132 PCIe Ethernet. */ +/* Driver for Atheros AR813x/AR815x PCIe Ethernet. */ #include __FBSDID("$FreeBSD$"); @@ -98,18 +98,23 @@ TUNABLE_INT("hw.alc.msix_disable", &msix /* * Devices supported by this driver. */ -static struct alc_dev { - uint16_t alc_vendorid; - uint16_t alc_deviceid; - const char *alc_name; -} alc_devs[] = { - { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, +static struct alc_ident alc_ident_table[] = { + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, 9 * 1024, "Atheros AR8131 PCIe Gigabit Ethernet" }, - { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, - "Atheros AR8132 PCIe Fast Ethernet" } + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, 9 * 1024, + "Atheros AR8132 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151, 6 * 1024, + "Atheros AR8151 v1.0 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151_V2, 6 * 1024, + "Atheros AR8151 v2.0 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B, 6 * 1024, + "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, + "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *); +static void alc_aspm(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); static int alc_detach(device_t); @@ -118,6 +123,8 @@ static int alc_dma_alloc(struct alc_soft static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); static int alc_encap(struct alc_softc *, struct mbuf **); +static struct alc_ident * + alc_find_ident(device_t); #ifndef __NO_STRICT_ALIGNMENT static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); @@ -331,7 +338,7 @@ alc_miibus_statchg(device_t dev) reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } - alc_aspm(sc); + alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } static void @@ -375,23 +382,31 @@ alc_mediachange(struct ifnet *ifp) return (error); } -static int -alc_probe(device_t dev) +static struct alc_ident * +alc_find_ident(device_t dev) { - struct alc_dev *sp; - int i; + struct alc_ident *ident; uint16_t vendor, devid; vendor = pci_get_vendor(dev); devid = pci_get_device(dev); - sp = alc_devs; - for (i = 0; i < sizeof(alc_devs) / sizeof(alc_devs[0]); i++) { - if (vendor == sp->alc_vendorid && - devid == sp->alc_deviceid) { - device_set_desc(dev, sp->alc_name); - return (BUS_PROBE_DEFAULT); - } - sp++; + for (ident = alc_ident_table; ident->name != NULL; ident++) { + if (vendor == ident->vendorid && devid == ident->deviceid) + return (ident); + } + + return (NULL); +} + +static int +alc_probe(device_t dev) +{ + struct alc_ident *ident; + + ident = alc_find_ident(dev); + if (ident != NULL) { + device_set_desc(dev, ident->name); + return (BUS_PROBE_DEFAULT); } return (ENXIO); @@ -401,20 +416,53 @@ static void alc_get_macaddr(struct alc_softc *sc) { uint32_t ea[2], opt; - int i; + uint16_t val; + int eeprom, i; + eeprom = 0; opt = CSR_READ_4(sc, ALC_OPT_CFG); - if ((CSR_READ_4(sc, ALC_TWSI_DEBUG) & TWSI_DEBUG_DEV_EXIST) != 0) { + if ((CSR_READ_4(sc, ALC_MASTER_CFG) & MASTER_OTP_SEL) != 0 && + (CSR_READ_4(sc, ALC_TWSI_DEBUG) & TWSI_DEBUG_DEV_EXIST) != 0) { /* * EEPROM found, let TWSI reload EEPROM configuration. * This will set ethernet address of controller. */ - if ((opt & OPT_CFG_CLK_ENB) == 0) { - opt |= OPT_CFG_CLK_ENB; - CSR_WRITE_4(sc, ALC_OPT_CFG, opt); - CSR_READ_4(sc, ALC_OPT_CFG); - DELAY(1000); + eeprom++; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8131: + case DEVICEID_ATHEROS_AR8132: + if ((opt & OPT_CFG_CLK_ENB) == 0) { + opt |= OPT_CFG_CLK_ENB; + CSR_WRITE_4(sc, ALC_OPT_CFG, opt); + CSR_READ_4(sc, ALC_OPT_CFG); + DELAY(1000); + } + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x00); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val & 0xFF7F); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x3B); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val | 0x0008); + DELAY(20); + break; } + + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_WOL_CFG, 0); + CSR_READ_4(sc, ALC_WOL_CFG); + CSR_WRITE_4(sc, ALC_TWSI_CFG, CSR_READ_4(sc, ALC_TWSI_CFG) | TWSI_CFG_SW_LD_START); for (i = 100; i > 0; i--) { @@ -430,11 +478,36 @@ alc_get_macaddr(struct alc_softc *sc) if (bootverbose) device_printf(sc->alc_dev, "EEPROM not found!\n"); } - if ((opt & OPT_CFG_CLK_ENB) != 0) { - opt &= ~OPT_CFG_CLK_ENB; - CSR_WRITE_4(sc, ALC_OPT_CFG, opt); - CSR_READ_4(sc, ALC_OPT_CFG); - DELAY(1000); + if (eeprom != 0) { + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8131: + case DEVICEID_ATHEROS_AR8132: + if ((opt & OPT_CFG_CLK_ENB) != 0) { + opt &= ~OPT_CFG_CLK_ENB; + CSR_WRITE_4(sc, ALC_OPT_CFG, opt); + CSR_READ_4(sc, ALC_OPT_CFG); + DELAY(1000); + } + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x00); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val | 0x0080); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x3B); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val & 0xFFF7); + DELAY(20); + break; + } } ea[0] = CSR_READ_4(sc, ALC_PAR0); @@ -479,6 +552,43 @@ alc_phy_reset(struct alc_softc *sc) CSR_READ_2(sc, ALC_GPHY_CFG); DELAY(10 * 1000); + /* DSP fixup, Vendor magic. */ + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x000A); + data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, data & 0xDFFF); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x003B); + data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, data & 0xFFF7); + DELAY(20 * 1000); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x0029); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, 0x929D); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8131 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8132 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x0029); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, 0xB6DD); + } + /* Load DSP codes, vendor magic. */ data = ANA_LOOP_SEL_10BT | ANA_EN_MASK_TB | ANA_EN_10BT_IDLE | ((1 << ANA_INTERVAL_SEL_TIMER_SHIFT) & ANA_INTERVAL_SEL_TIMER_MASK); @@ -528,36 +638,117 @@ static void alc_phy_down(struct alc_softc *sc) { - /* Force PHY down. */ - CSR_WRITE_2(sc, ALC_GPHY_CFG, - GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | - GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW); - DELAY(1000); + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + /* + * GPHY power down caused more problems on AR8151 v2.0. + * When driver is reloaded after GPHY power down, + * accesses to PHY/MAC registers hung the system. Only + * cold boot recovered from it. I'm not sure whether + * AR8151 v1.0 also requires this one though. I don't + * have AR8151 v1.0 controller in hand. + * The only option left is to isolate the PHY and + * initiates power down the PHY which in turn saves + * more power when driver is unloaded. + */ + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + MII_BMCR, BMCR_ISO | BMCR_PDOWN); + break; + default: + /* Force PHY down. */ + CSR_WRITE_2(sc, ALC_GPHY_CFG, + GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ | + GPHY_CFG_PWDOWN_HW); + DELAY(1000); + break; + } } static void -alc_aspm(struct alc_softc *sc) +alc_aspm(struct alc_softc *sc, int media) { uint32_t pmcfg; + uint16_t linkcfg; ALC_LOCK_ASSERT(sc); pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == + (ALC_FLAG_APS | ALC_FLAG_PCIE)) + linkcfg = CSR_READ_2(sc, sc->alc_expcap + + PCIR_EXPRESS_LINK_CTL); + else + linkcfg = 0; pmcfg &= ~PM_CFG_SERDES_PD_EX_L1; - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB; - pmcfg |= PM_CFG_SERDES_L1_ENB; - pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_MASK; + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_LCKDET_TIMER_MASK); pmcfg |= PM_CFG_MAC_ASPM_CHK; + pmcfg |= PM_CFG_SERDES_ENB | PM_CFG_RBER_ENB; + pmcfg &= ~(PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB); + + if ((sc->alc_flags & ALC_FLAG_APS) != 0) { + /* Disable extended sync except AR8152 B v1.0 */ + linkcfg &= ~0x80; + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && + sc->alc_rev == ATHEROS_AR8152_B_V10) + linkcfg |= 0x80; + CSR_WRITE_2(sc, sc->alc_expcap + PCIR_EXPRESS_LINK_CTL, + linkcfg); + pmcfg &= ~(PM_CFG_EN_BUFS_RX_L0S | PM_CFG_SA_DLY_ENB | + PM_CFG_HOTRST); + pmcfg |= (PM_CFG_L1_ENTRY_TIMER_DEFAULT << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= (PM_CFG_PM_REQ_TIMER_DEFAULT << + PM_CFG_PM_REQ_TIMER_SHIFT); + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_PCIE_RECV; + } + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { - pmcfg |= PM_CFG_SERDES_PLL_L1_ENB; - pmcfg &= ~PM_CFG_CLK_SWH_L1; - pmcfg &= ~PM_CFG_ASPM_L1_ENB; - pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L0S) != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L1S) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_APS) != 0) { + if (sc->alc_ident->deviceid == + DEVICEID_ATHEROS_AR8152_B) + pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + pmcfg &= ~(PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB); + pmcfg |= PM_CFG_CLK_SWH_L1; + if (media == IFM_100_TX || media == IFM_1000_T) { + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_MASK; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8152_B: + pmcfg |= (7 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + case DEVICEID_ATHEROS_AR8152_B2: + case DEVICEID_ATHEROS_AR8151_V2: + pmcfg |= (4 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + default: + pmcfg |= (15 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + } + } + } else { + pmcfg |= PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB; + pmcfg &= ~(PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB); + } } else { - pmcfg &= ~PM_CFG_SERDES_PLL_L1_ENB; + pmcfg &= ~(PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB); pmcfg |= PM_CFG_CLK_SWH_L1; - pmcfg &= ~PM_CFG_ASPM_L1_ENB; - pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L1S) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB; } CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } @@ -567,7 +758,7 @@ alc_attach(device_t dev) { struct alc_softc *sc; struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/l1" }; + char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; uint16_t burst; int base, error, i, msic, msixc, state; uint32_t cap, ctl, val; @@ -580,6 +771,7 @@ alc_attach(device_t dev) MTX_DEF); callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); /* Map the device. */ pci_enable_busmaster(dev); @@ -619,6 +811,20 @@ alc_attach(device_t dev) val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, + CSR_READ_4(sc, ALC_PCIE_PHYMISC) | + PCIE_PHYMISC_FORCE_RCV_DET); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && + sc->alc_rev == ATHEROS_AR8152_B_V10) { + val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); + val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | + PCIE_PHYMISC2_SERDES_TH_MASK); + val |= 3 << PCIE_PHYMISC2_SERDES_CDR_SHIFT; + val |= 3 << PCIE_PHYMISC2_SERDES_TH_SHIFT; + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); + } /* Disable ASPM L0S and L1. */ cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CAP); if ((cap & PCIM_LINK_CAP_ASPM) != 0) { @@ -629,12 +835,19 @@ alc_attach(device_t dev) device_printf(dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & 0x03; + if (state & 0x01) + sc->alc_flags |= ALC_FLAG_L0S; + if (state & 0x02) + sc->alc_flags |= ALC_FLAG_L1S; if (bootverbose) device_printf(sc->alc_dev, "ASPM %s %s\n", aspm_state[state], state == 0 ? "disabled" : "enabled"); - if (state != 0) - alc_disable_l0s_l1(sc); + alc_disable_l0s_l1(sc); + } else { + if (bootverbose) + device_printf(sc->alc_dev, + "no ASPM support\n"); } } @@ -651,12 +864,25 @@ alc_attach(device_t dev) * used in AR8132 can't establish gigabit link even if it * shows the same PHY model/revision number of AR8131. */ - if (pci_get_device(dev) == DEVICEID_ATHEROS_AR8132) - sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_JUMBO; - else - sc->alc_flags |= ALC_FLAG_JUMBO | ALC_FLAG_ASPM_MON; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + sc->alc_flags |= ALC_FLAG_APS; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_AR8132: + sc->alc_flags |= ALC_FLAG_FASTETHER; + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + sc->alc_flags |= ALC_FLAG_APS; + /* FALLTHROUGH */ + default: + break; + } + sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + /* - * It seems that AR8131/AR8132 has silicon bug for SMB. In + * It seems that AR813x/AR815x has silicon bug for SMB. In * addition, Atheros said that enabling SMB wouldn't improve * performance. However I think it's bad to access lots of * registers to extract MAC statistics. @@ -1369,7 +1595,7 @@ again: /* * Create Tx buffer parent tag. - * AR8131/AR8132 allows 64bit DMA addressing of Tx/Rx buffers + * AR813x/AR815x allows 64bit DMA addressing of Tx/Rx buffers * so it needs separate parent DMA tag as parent DMA address * space could be restricted to be within 32bit address space * by 4GB boundary crossing. @@ -1806,7 +2032,7 @@ alc_encap(struct alc_softc *sc, struct m poff = 0; if ((m->m_pkthdr.csum_flags & (ALC_CSUM_FEATURES | CSUM_TSO)) != 0) { /* - * AR8131/AR8132 requires offset of TCP/UDP header in its + * AR813x/AR815x requires offset of TCP/UDP header in its * Tx descriptor to perform Tx checksum offloading. TSO * also requires TCP header offset and modification of * IP/TCP header. This kind of operation takes many CPU @@ -1826,12 +2052,14 @@ alc_encap(struct alc_softc *sc, struct m *m_head = m; } - m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip)); + m = m_pullup(m, sizeof(struct ether_header) + + sizeof(struct ip)); if (m == NULL) { *m_head = NULL; return (ENOBUFS); } - ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); + ip = (struct ip *)(mtod(m, char *) + + sizeof(struct ether_header)); poff = sizeof(struct ether_header) + (ip->ip_hl << 2); if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { m = m_pullup(m, poff + sizeof(struct tcphdr)); @@ -1922,7 +2150,7 @@ alc_encap(struct alc_softc *sc, struct m cflags |= (poff << TD_TCPHDR_OFFSET_SHIFT) & TD_TCPHDR_OFFSET_MASK; /* - * AR8131/AR8132 requires the first buffer should + * AR813x/AR815x requires the first buffer should * only hold IP/TCP header data. Payload should * be handled in other descriptors. */ @@ -2103,14 +2331,16 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, error = 0; switch (cmd) { case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ALC_JUMBO_MTU || + if (ifr->ifr_mtu < ETHERMIN || + ifr->ifr_mtu > (sc->alc_ident->max_framelen - + sizeof(struct ether_vlan_header) - ETHER_CRC_LEN) || ((sc->alc_flags & ALC_FLAG_JUMBO) == 0 && ifr->ifr_mtu > ETHERMTU)) error = EINVAL; else if (ifp->if_mtu != ifr->ifr_mtu) { ALC_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; - /* AR8131/AR8132 has 13 bits MSS field. */ + /* AR813x/AR815x has 13 bits MSS field. */ if (ifp->if_mtu > ALC_TSO_MTU && (ifp->if_capenable & IFCAP_TSO4) != 0) { ifp->if_capenable &= ~IFCAP_TSO4; @@ -2161,7 +2391,7 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, (ifp->if_capabilities & IFCAP_TSO4) != 0) { ifp->if_capenable ^= IFCAP_TSO4; if ((ifp->if_capenable & IFCAP_TSO4) != 0) { - /* AR8131/AR8132 has 13 bits MSS field. */ + /* AR813x/AR815x has 13 bits MSS field. */ if (ifp->if_mtu > ALC_TSO_MTU) { ifp->if_capenable &= ~IFCAP_TSO4; ifp->if_hwassist &= ~CSUM_TSO; @@ -2213,6 +2443,10 @@ alc_mac_config(struct alc_softc *sc) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg &= ~(MAC_CFG_FULL_DUPLEX | MAC_CFG_TX_FC | MAC_CFG_RX_FC | MAC_CFG_SPEED_MASK); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg |= MAC_CFG_HASH_ALG_CRC32 | MAC_CFG_SPEED_MODE_SW; /* Reprogram MAC with resolved speed/duplex. */ switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: @@ -2834,7 +3068,9 @@ alc_reset(struct alc_softc *sc) uint32_t reg; int i; - CSR_WRITE_4(sc, ALC_MASTER_CFG, MASTER_RESET); + reg = CSR_READ_4(sc, ALC_MASTER_CFG) & 0xFFFF; + reg |= MASTER_OOB_DIS_OFF | MASTER_RESET; + CSR_WRITE_4(sc, ALC_MASTER_CFG, reg); for (i = ALC_RESET_TIMEOUT; i > 0; i--) { DELAY(10); if ((CSR_READ_4(sc, ALC_MASTER_CFG) & MASTER_RESET) == 0) @@ -2965,6 +3201,18 @@ alc_init_locked(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_SMB_BASE_ADDR_HI, ALC_ADDR_HI(paddr)); CSR_WRITE_4(sc, ALC_SMB_BASE_ADDR_LO, ALC_ADDR_LO(paddr)); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B) { + /* Reconfigure SRAM - Vendor magic. */ + CSR_WRITE_4(sc, ALC_SRAM_RX_FIFO_LEN, 0x000002A0); + CSR_WRITE_4(sc, ALC_SRAM_TX_FIFO_LEN, 0x00000100); + CSR_WRITE_4(sc, ALC_SRAM_RX_FIFO_ADDR, 0x029F0000); + CSR_WRITE_4(sc, ALC_SRAM_RD0_ADDR, 0x02BF02A0); + CSR_WRITE_4(sc, ALC_SRAM_TX_FIFO_ADDR, 0x03BF02C0); + CSR_WRITE_4(sc, ALC_SRAM_TD_ADDR, 0x03DF03C0); + CSR_WRITE_4(sc, ALC_TXF_WATER_MARK, 0x00000000); + CSR_WRITE_4(sc, ALC_RD_DMA_CFG, 0x00000000); + } + /* Tell hardware that we're ready to load DMA blocks. */ CSR_WRITE_4(sc, ALC_DMA_BLOCK, DMA_BLOCK_LOAD); @@ -2972,14 +3220,11 @@ alc_init_locked(struct alc_softc *sc) reg = ALC_USECS(sc->alc_int_rx_mod) << IM_TIMER_RX_SHIFT; reg |= ALC_USECS(sc->alc_int_tx_mod) << IM_TIMER_TX_SHIFT; CSR_WRITE_4(sc, ALC_IM_TIMER, reg); - reg = CSR_READ_4(sc, ALC_MASTER_CFG); - reg &= ~(MASTER_CHIP_REV_MASK | MASTER_CHIP_ID_MASK); /* * We don't want to automatic interrupt clear as task queue * for the interrupt should know interrupt status. */ - reg &= ~MASTER_INTR_RD_CLR; - reg &= ~(MASTER_IM_RX_TIMER_ENB | MASTER_IM_TX_TIMER_ENB); + reg = MASTER_SA_TIMER_ENB; if (ALC_USECS(sc->alc_int_rx_mod) != 0) reg |= MASTER_IM_RX_TIMER_ENB; if (ALC_USECS(sc->alc_int_tx_mod) != 0) @@ -3020,7 +3265,7 @@ alc_init_locked(struct alc_softc *sc) * Be conservative in what you do, be liberal in what you * accept from others - RFC 793. */ - CSR_WRITE_4(sc, ALC_FRAME_SIZE, ALC_JUMBO_FRAMELEN); + CSR_WRITE_4(sc, ALC_FRAME_SIZE, sc->alc_ident->max_framelen); /* Disable header split(?) */ CSR_WRITE_4(sc, ALC_HDS_CFG, 0); @@ -3047,11 +3292,14 @@ alc_init_locked(struct alc_softc *sc) * TSO/checksum offloading. */ CSR_WRITE_4(sc, ALC_TSO_OFFLOAD_THRESH, - (ALC_JUMBO_FRAMELEN >> TSO_OFFLOAD_THRESH_UNIT_SHIFT) & + (sc->alc_ident->max_framelen >> TSO_OFFLOAD_THRESH_UNIT_SHIFT) & TSO_OFFLOAD_THRESH_MASK); /* Configure TxQ. */ reg = (alc_dma_burst[sc->alc_dma_rd_burst] << TXQ_CFG_TX_FIFO_BURST_SHIFT) & TXQ_CFG_TX_FIFO_BURST_MASK; + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg >>= 1; reg |= (TXQ_CFG_TD_BURST_DEFAULT << TXQ_CFG_TD_BURST_SHIFT) & TXQ_CFG_TD_BURST_MASK; CSR_WRITE_4(sc, ALC_TXQ_CFG, reg | TXQ_CFG_ENHANCED_MODE); @@ -3068,14 +3316,23 @@ alc_init_locked(struct alc_softc *sc) * XON : 80% of Rx FIFO * XOFF : 30% of Rx FIFO */ - reg = CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN); - rxf_hi = (reg * 8) / 10; - rxf_lo = (reg * 3)/ 10; - CSR_WRITE_4(sc, ALC_RX_FIFO_PAUSE_THRESH, - ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & - RX_FIFO_PAUSE_THRESH_LO_MASK) | - ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & - RX_FIFO_PAUSE_THRESH_HI_MASK)); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8131 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8132) { + reg = CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN); + rxf_hi = (reg * 8) / 10; + rxf_lo = (reg * 3) / 10; + CSR_WRITE_4(sc, ALC_RX_FIFO_PAUSE_THRESH, + ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & + RX_FIFO_PAUSE_THRESH_LO_MASK) | + ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & + RX_FIFO_PAUSE_THRESH_HI_MASK)); + } + + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2) + CSR_WRITE_4(sc, ALC_SERDES_LOCK, + CSR_READ_4(sc, ALC_SERDES_LOCK) | SERDES_MAC_CLK_SLOWDOWN | + SERDES_PHY_CLK_SLOWDOWN); /* Disable RSS until I understand L1C/L2C's RSS logic. */ CSR_WRITE_4(sc, ALC_RSS_IDT_TABLE0, 0); @@ -3086,15 +3343,9 @@ alc_init_locked(struct alc_softc *sc) RXQ_CFG_RD_BURST_MASK; reg |= RXQ_CFG_RSS_MODE_DIS; if ((sc->alc_flags & ALC_FLAG_ASPM_MON) != 0) - reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_100M; + reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_1M; CSR_WRITE_4(sc, ALC_RXQ_CFG, reg); - /* Configure Rx DMAW request thresold. */ - CSR_WRITE_4(sc, ALC_RD_DMA_CFG, - ((RD_DMA_CFG_THRESH_DEFAULT << RD_DMA_CFG_THRESH_SHIFT) & - RD_DMA_CFG_THRESH_MASK) | - ((ALC_RD_DMA_CFG_USECS(0) << RD_DMA_CFG_TIMER_SHIFT) & - RD_DMA_CFG_TIMER_MASK)); /* Configure DMA parameters. */ reg = DMA_CFG_OUT_ORDER | DMA_CFG_RD_REQ_PRI; reg |= sc->alc_rcb; @@ -3120,7 +3371,7 @@ alc_init_locked(struct alc_softc *sc) * - Enable CRC generation. * Actual reconfiguration of MAC for resolved speed/duplex * is followed after detection of link establishment. - * AR8131/AR8132 always does checksum computation regardless + * AR813x/AR815x always does checksum computation regardless * of MAC_CFG_RXCSUM_ENB bit. Also the controller is known to * have bug in protocol field in Rx return structure so * these controllers can't handle fragmented frames. Disable @@ -3130,6 +3381,10 @@ alc_init_locked(struct alc_softc *sc) reg = MAC_CFG_TX_CRC_ENB | MAC_CFG_TX_AUTO_PAD | MAC_CFG_FULL_DUPLEX | ((MAC_CFG_PREAMBLE_DEFAULT << MAC_CFG_PREAMBLE_SHIFT) & MAC_CFG_PREAMBLE_MASK); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg |= MAC_CFG_HASH_ALG_CRC32 | MAC_CFG_SPEED_MODE_SW; if ((sc->alc_flags & ALC_FLAG_FASTETHER) != 0) reg |= MAC_CFG_SPEED_10_100; else Modified: stable/8/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/8/sys/dev/alc/if_alcreg.h Mon Aug 30 21:13:08 2010 (r212020) +++ stable/8/sys/dev/alc/if_alcreg.h Mon Aug 30 21:15:40 2010 (r212021) @@ -36,10 +36,17 @@ #define VENDORID_ATHEROS 0x1969 /* - * Atheros AR8131/AR8132 device ID + * Atheros AR813x/AR815x device ID */ #define DEVICEID_ATHEROS_AR8131 0x1063 /* L1C */ #define DEVICEID_ATHEROS_AR8132 0x1062 /* L2C */ +#define DEVICEID_ATHEROS_AR8151 0x1073 /* L1D V1.0 */ +#define DEVICEID_ATHEROS_AR8151_V2 0x1083 /* L1D V2.0 */ +#define DEVICEID_ATHEROS_AR8152_B 0x2060 /* L2C V1.1 */ +#define DEVICEID_ATHEROS_AR8152_B2 0x2062 /* L2C V2.0 */ + +#define ATHEROS_AR8152_B_V10 0xC0 +#define ATHEROS_AR8152_B_V11 0xC1 /* 0x0000 - 0x02FF : PCIe configuration space */ @@ -64,6 +71,12 @@ #define ALC_PCIE_PHYMISC 0x1000 #define PCIE_PHYMISC_FORCE_RCV_DET 0x00000004 +#define ALC_PCIE_PHYMISC2 0x1004 +#define PCIE_PHYMISC2_SERDES_CDR_MASK 0x00030000 +#define PCIE_PHYMISC2_SERDES_TH_MASK 0x000C0000 +#define PCIE_PHYMISC2_SERDES_CDR_SHIFT 16 +#define PCIE_PHYMISC2_SERDES_TH_SHIFT 18 + #define ALC_TWSI_DEBUG 0x1108 #define TWSI_DEBUG_DEV_EXIST 0x20000000 @@ -97,6 +110,8 @@ #define PM_CFG_L1_ENTRY_TIMER_MASK 0x000F0000 #define PM_CFG_PM_REQ_TIMER_MASK 0x00F00000 #define PM_CFG_LCKDET_TIMER_MASK 0x3F000000 +#define PM_CFG_EN_BUFS_RX_L0S 0x10000000 +#define PM_CFG_SA_DLY_ENB 0x20000000 #define PM_CFG_MAC_ASPM_CHK 0x40000000 #define PM_CFG_HOTRST 0x80000000 #define PM_CFG_L0S_ENTRY_TIMER_SHIFT 8 @@ -104,10 +119,19 @@ #define PM_CFG_PM_REQ_TIMER_SHIFT 20 #define PM_CFG_LCKDET_TIMER_SHIFT 24 +#define PM_CFG_L0S_ENTRY_TIMER_DEFAULT 6 +#define PM_CFG_L1_ENTRY_TIMER_DEFAULT 12 +#define PM_CFG_PM_REQ_TIMER_DEFAULT 1 + +#define ALC_LTSSM_ID_CFG 0x12FC +#define LTSSM_ID_WRO_ENB 0x00001000 + #define ALC_MASTER_CFG 0x1400 #define MASTER_RESET 0x00000001 #define MASTER_TEST_MODE_MASK 0x0000000C #define MASTER_BERT_START 0x00000010 +#define MASTER_OOB_DIS_OFF 0x00000040 +#define MASTER_SA_TIMER_ENB 0x00000080 #define MASTER_MTIMER_ENB 0x00000100 #define MASTER_MANUAL_INTR_ENB 0x00000200 #define MASTER_IM_TX_TIMER_ENB 0x00000400 @@ -122,7 +146,7 @@ #define MASTER_CHIP_REV_SHIFT 16 #define MASTER_CHIP_ID_SHIFT 24 -/* Number of ticks per usec for AR8131/AR8132. */ +/* Number of ticks per usec for AR813x/AR815x. */ #define ALC_TICK_USECS 2 #define ALC_USECS(x) ((x) / ALC_TICK_USECS) @@ -220,6 +244,8 @@ #define ALC_SERDES_LOCK 0x1424 #define SERDES_LOCK_DET 0x00000001 #define SERDES_LOCK_DET_ENB 0x00000002 +#define SERDES_MAC_CLK_SLOWDOWN 0x00020000 +#define SERDES_PHY_CLK_SLOWDOWN 0x00040000 #define ALC_MAC_CFG 0x1480 #define MAC_CFG_TX_ENB 0x00000001 @@ -249,6 +275,8 @@ #define MAC_CFG_BCAST 0x04000000 #define MAC_CFG_DBG 0x08000000 #define MAC_CFG_SINGLE_PAUSE_ENB 0x10000000 +#define MAC_CFG_HASH_ALG_CRC32 0x20000000 +#define MAC_CFG_SPEED_MODE_SW 0x40000000 #define MAC_CFG_PREAMBLE_SHIFT 10 #define MAC_CFG_PREAMBLE_DEFAULT 7 @@ -691,7 +719,7 @@ #define HDS_CFG_BACKFILLSIZE_SHIFT 8 #define HDS_CFG_MAX_HDRSIZE_SHIFT 20 -/* AR8131/AR8132 registers for MAC statistics */ +/* AR813x/AR815x registers for MAC statistics */ #define ALC_RX_MIB_BASE 0x1700 #define ALC_TX_MIB_BASE 0x1760 Modified: stable/8/sys/dev/alc/if_alcvar.h ============================================================================== --- stable/8/sys/dev/alc/if_alcvar.h Mon Aug 30 21:13:08 2010 (r212020) +++ stable/8/sys/dev/alc/if_alcvar.h Mon Aug 30 21:15:40 2010 (r212021) @@ -68,13 +68,8 @@ #define ALC_PROC_MAX (ALC_RX_RING_CNT - 1) #define ALC_PROC_DEFAULT (ALC_RX_RING_CNT / 4) -#define ALC_JUMBO_FRAMELEN (9 * 1024) -#define ALC_JUMBO_MTU \ - (ALC_JUMBO_FRAMELEN - sizeof(struct ether_vlan_header) - ETHER_CRC_LEN) -#define ALC_MAX_FRAMELEN (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) - /* - * The number of bits reserved for MSS in AR8121/AR8132 controllers + * The number of bits reserved for MSS in AR813x/AR815x controllers * are 13 bits. This limits the maximum interface MTU size in TSO * case(8191 + sizeof(struct ip) + sizeof(struct tcphdr)) as upper * stack should not generate TCP segments with MSS greater than the @@ -192,6 +187,13 @@ struct alc_hw_stats { uint64_t tx_mcast_bytes; }; +struct alc_ident { + uint16_t vendorid; + uint16_t deviceid; + uint32_t max_framelen; + const char *name; +}; + /* * Software state per device. */ @@ -204,6 +206,7 @@ struct alc_softc { struct resource *alc_irq[ALC_MSI_MESSAGES]; struct resource_spec *alc_irq_spec; void *alc_intrhand[ALC_MSI_MESSAGES]; + struct alc_ident *alc_ident; int alc_rev; int alc_chip_rev; int alc_phyaddr; @@ -224,6 +227,9 @@ struct alc_softc { #define ALC_FLAG_ASPM_MON 0x0080 #define ALC_FLAG_CMB_BUG 0x0100 #define ALC_FLAG_SMB_BUG 0x0200 +#define ALC_FLAG_L0S 0x0400 +#define ALC_FLAG_L1S 0x0800 +#define ALC_FLAG_APS 0x1000 #define ALC_FLAG_DETACH 0x4000 #define ALC_FLAG_LINK 0x8000 From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:17:12 2010 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 380B410656A3; Mon, 30 Aug 2010 21:17:12 +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 25BEA8FC16; Mon, 30 Aug 2010 21:17:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULHCqc007753; Mon, 30 Aug 2010 21:17:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULHCUo007749; Mon, 30 Aug 2010 21:17:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302117.o7ULHCUo007749@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:17:12 +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: r212022 - stable/7/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:17:12 -0000 Author: yongari Date: Mon Aug 30 21:17:11 2010 New Revision: 212022 URL: http://svn.freebsd.org/changeset/base/212022 Log: MFC r211105: Add support for Atheros AR8151/AR8152 PCIe gigabit/fast ethernet controller. These controllers are known as L1D(AR8151) and L2CB/B2(AR8152). This change adds supports for the following controllers. o AR8151 v1.0(L1D) gigabit ethernet controller o AR8151 v2.0(L1D) gigabit ethernet controller o AR8152 v1.1(L2CB) fast ethernet controller o AR8152 v2.0(L2CB2) fast ethernet controller These controllers have the same feature of AR8131/AR8132 and support improved power saving control. The user visible change at this moment is reduced jumbo frame size from 9KB to 6KB. Many thanks to Atheros for continuing to support FreeBSD. HW donated by: Atheros Communications, Inc. Modified: stable/7/sys/dev/alc/if_alc.c stable/7/sys/dev/alc/if_alcreg.h stable/7/sys/dev/alc/if_alcvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Mon Aug 30 21:15:40 2010 (r212021) +++ stable/7/sys/dev/alc/if_alc.c Mon Aug 30 21:17:11 2010 (r212022) @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -/* Driver for Atheros AR8131/AR8132 PCIe Ethernet. */ +/* Driver for Atheros AR813x/AR815x PCIe Ethernet. */ #include __FBSDID("$FreeBSD$"); @@ -98,18 +98,23 @@ TUNABLE_INT("hw.alc.msix_disable", &msix /* * Devices supported by this driver. */ -static struct alc_dev { - uint16_t alc_vendorid; - uint16_t alc_deviceid; - const char *alc_name; -} alc_devs[] = { - { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, +static struct alc_ident alc_ident_table[] = { + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8131, 9 * 1024, "Atheros AR8131 PCIe Gigabit Ethernet" }, - { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, - "Atheros AR8132 PCIe Fast Ethernet" } + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8132, 9 * 1024, + "Atheros AR8132 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151, 6 * 1024, + "Atheros AR8151 v1.0 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8151_V2, 6 * 1024, + "Atheros AR8151 v2.0 PCIe Gigabit Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B, 6 * 1024, + "Atheros AR8152 v1.1 PCIe Fast Ethernet" }, + { VENDORID_ATHEROS, DEVICEID_ATHEROS_AR8152_B2, 6 * 1024, + "Atheros AR8152 v2.0 PCIe Fast Ethernet" }, + { 0, 0, 0, NULL} }; -static void alc_aspm(struct alc_softc *); +static void alc_aspm(struct alc_softc *, int); static int alc_attach(device_t); static int alc_check_boundary(struct alc_softc *); static int alc_detach(device_t); @@ -118,6 +123,8 @@ static int alc_dma_alloc(struct alc_soft static void alc_dma_free(struct alc_softc *); static void alc_dmamap_cb(void *, bus_dma_segment_t *, int, int); static int alc_encap(struct alc_softc *, struct mbuf **); +static struct alc_ident * + alc_find_ident(device_t); #ifndef __NO_STRICT_ALIGNMENT static struct mbuf * alc_fixup_rx(struct ifnet *, struct mbuf *); @@ -331,7 +338,7 @@ alc_miibus_statchg(device_t dev) reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } - alc_aspm(sc); + alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } static void @@ -375,23 +382,31 @@ alc_mediachange(struct ifnet *ifp) return (error); } -static int -alc_probe(device_t dev) +static struct alc_ident * +alc_find_ident(device_t dev) { - struct alc_dev *sp; - int i; + struct alc_ident *ident; uint16_t vendor, devid; vendor = pci_get_vendor(dev); devid = pci_get_device(dev); - sp = alc_devs; - for (i = 0; i < sizeof(alc_devs) / sizeof(alc_devs[0]); i++) { - if (vendor == sp->alc_vendorid && - devid == sp->alc_deviceid) { - device_set_desc(dev, sp->alc_name); - return (BUS_PROBE_DEFAULT); - } - sp++; + for (ident = alc_ident_table; ident->name != NULL; ident++) { + if (vendor == ident->vendorid && devid == ident->deviceid) + return (ident); + } + + return (NULL); +} + +static int +alc_probe(device_t dev) +{ + struct alc_ident *ident; + + ident = alc_find_ident(dev); + if (ident != NULL) { + device_set_desc(dev, ident->name); + return (BUS_PROBE_DEFAULT); } return (ENXIO); @@ -401,20 +416,53 @@ static void alc_get_macaddr(struct alc_softc *sc) { uint32_t ea[2], opt; - int i; + uint16_t val; + int eeprom, i; + eeprom = 0; opt = CSR_READ_4(sc, ALC_OPT_CFG); - if ((CSR_READ_4(sc, ALC_TWSI_DEBUG) & TWSI_DEBUG_DEV_EXIST) != 0) { + if ((CSR_READ_4(sc, ALC_MASTER_CFG) & MASTER_OTP_SEL) != 0 && + (CSR_READ_4(sc, ALC_TWSI_DEBUG) & TWSI_DEBUG_DEV_EXIST) != 0) { /* * EEPROM found, let TWSI reload EEPROM configuration. * This will set ethernet address of controller. */ - if ((opt & OPT_CFG_CLK_ENB) == 0) { - opt |= OPT_CFG_CLK_ENB; - CSR_WRITE_4(sc, ALC_OPT_CFG, opt); - CSR_READ_4(sc, ALC_OPT_CFG); - DELAY(1000); + eeprom++; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8131: + case DEVICEID_ATHEROS_AR8132: + if ((opt & OPT_CFG_CLK_ENB) == 0) { + opt |= OPT_CFG_CLK_ENB; + CSR_WRITE_4(sc, ALC_OPT_CFG, opt); + CSR_READ_4(sc, ALC_OPT_CFG); + DELAY(1000); + } + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x00); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val & 0xFF7F); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x3B); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val | 0x0008); + DELAY(20); + break; } + + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_WOL_CFG, 0); + CSR_READ_4(sc, ALC_WOL_CFG); + CSR_WRITE_4(sc, ALC_TWSI_CFG, CSR_READ_4(sc, ALC_TWSI_CFG) | TWSI_CFG_SW_LD_START); for (i = 100; i > 0; i--) { @@ -430,11 +478,36 @@ alc_get_macaddr(struct alc_softc *sc) if (bootverbose) device_printf(sc->alc_dev, "EEPROM not found!\n"); } - if ((opt & OPT_CFG_CLK_ENB) != 0) { - opt &= ~OPT_CFG_CLK_ENB; - CSR_WRITE_4(sc, ALC_OPT_CFG, opt); - CSR_READ_4(sc, ALC_OPT_CFG); - DELAY(1000); + if (eeprom != 0) { + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8131: + case DEVICEID_ATHEROS_AR8132: + if ((opt & OPT_CFG_CLK_ENB) != 0) { + opt &= ~OPT_CFG_CLK_ENB; + CSR_WRITE_4(sc, ALC_OPT_CFG, opt); + CSR_READ_4(sc, ALC_OPT_CFG); + DELAY(1000); + } + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x00); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val | 0x0080); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x3B); + val = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, val & 0xFFF7); + DELAY(20); + break; + } } ea[0] = CSR_READ_4(sc, ALC_PAR0); @@ -479,6 +552,43 @@ alc_phy_reset(struct alc_softc *sc) CSR_READ_2(sc, ALC_GPHY_CFG); DELAY(10 * 1000); + /* DSP fixup, Vendor magic. */ + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x000A); + data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, data & 0xDFFF); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x003B); + data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, data & 0xFFF7); + DELAY(20 * 1000); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x0029); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, 0x929D); + } + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8131 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8132 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) { + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_ADDR, 0x0029); + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + ALC_MII_DBG_DATA, 0xB6DD); + } + /* Load DSP codes, vendor magic. */ data = ANA_LOOP_SEL_10BT | ANA_EN_MASK_TB | ANA_EN_10BT_IDLE | ((1 << ANA_INTERVAL_SEL_TIMER_SHIFT) & ANA_INTERVAL_SEL_TIMER_MASK); @@ -528,36 +638,117 @@ static void alc_phy_down(struct alc_softc *sc) { - /* Force PHY down. */ - CSR_WRITE_2(sc, ALC_GPHY_CFG, - GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | - GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ | GPHY_CFG_PWDOWN_HW); - DELAY(1000); + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + /* + * GPHY power down caused more problems on AR8151 v2.0. + * When driver is reloaded after GPHY power down, + * accesses to PHY/MAC registers hung the system. Only + * cold boot recovered from it. I'm not sure whether + * AR8151 v1.0 also requires this one though. I don't + * have AR8151 v1.0 controller in hand. + * The only option left is to isolate the PHY and + * initiates power down the PHY which in turn saves + * more power when driver is unloaded. + */ + alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, + MII_BMCR, BMCR_ISO | BMCR_PDOWN); + break; + default: + /* Force PHY down. */ + CSR_WRITE_2(sc, ALC_GPHY_CFG, + GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | + GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ | + GPHY_CFG_PWDOWN_HW); + DELAY(1000); + break; + } } static void -alc_aspm(struct alc_softc *sc) +alc_aspm(struct alc_softc *sc, int media) { uint32_t pmcfg; + uint16_t linkcfg; ALC_LOCK_ASSERT(sc); pmcfg = CSR_READ_4(sc, ALC_PM_CFG); + if ((sc->alc_flags & (ALC_FLAG_APS | ALC_FLAG_PCIE)) == + (ALC_FLAG_APS | ALC_FLAG_PCIE)) + linkcfg = CSR_READ_2(sc, sc->alc_expcap + + PCIR_EXPRESS_LINK_CTL); + else + linkcfg = 0; pmcfg &= ~PM_CFG_SERDES_PD_EX_L1; - pmcfg |= PM_CFG_SERDES_BUDS_RX_L1_ENB; - pmcfg |= PM_CFG_SERDES_L1_ENB; - pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_MASK; + pmcfg &= ~(PM_CFG_L1_ENTRY_TIMER_MASK | PM_CFG_LCKDET_TIMER_MASK); pmcfg |= PM_CFG_MAC_ASPM_CHK; + pmcfg |= PM_CFG_SERDES_ENB | PM_CFG_RBER_ENB; + pmcfg &= ~(PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB); + + if ((sc->alc_flags & ALC_FLAG_APS) != 0) { + /* Disable extended sync except AR8152 B v1.0 */ + linkcfg &= ~0x80; + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && + sc->alc_rev == ATHEROS_AR8152_B_V10) + linkcfg |= 0x80; + CSR_WRITE_2(sc, sc->alc_expcap + PCIR_EXPRESS_LINK_CTL, + linkcfg); + pmcfg &= ~(PM_CFG_EN_BUFS_RX_L0S | PM_CFG_SA_DLY_ENB | + PM_CFG_HOTRST); + pmcfg |= (PM_CFG_L1_ENTRY_TIMER_DEFAULT << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + pmcfg &= ~PM_CFG_PM_REQ_TIMER_MASK; + pmcfg |= (PM_CFG_PM_REQ_TIMER_DEFAULT << + PM_CFG_PM_REQ_TIMER_SHIFT); + pmcfg |= PM_CFG_SERDES_PD_EX_L1 | PM_CFG_PCIE_RECV; + } + if ((sc->alc_flags & ALC_FLAG_LINK) != 0) { - pmcfg |= PM_CFG_SERDES_PLL_L1_ENB; - pmcfg &= ~PM_CFG_CLK_SWH_L1; - pmcfg &= ~PM_CFG_ASPM_L1_ENB; - pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L0S) != 0) + pmcfg |= PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L1S) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB; + if ((sc->alc_flags & ALC_FLAG_APS) != 0) { + if (sc->alc_ident->deviceid == + DEVICEID_ATHEROS_AR8152_B) + pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + pmcfg &= ~(PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB); + pmcfg |= PM_CFG_CLK_SWH_L1; + if (media == IFM_100_TX || media == IFM_1000_T) { + pmcfg &= ~PM_CFG_L1_ENTRY_TIMER_MASK; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8152_B: + pmcfg |= (7 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + case DEVICEID_ATHEROS_AR8152_B2: + case DEVICEID_ATHEROS_AR8151_V2: + pmcfg |= (4 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + default: + pmcfg |= (15 << + PM_CFG_L1_ENTRY_TIMER_SHIFT); + break; + } + } + } else { + pmcfg |= PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB | + PM_CFG_SERDES_BUDS_RX_L1_ENB; + pmcfg &= ~(PM_CFG_CLK_SWH_L1 | + PM_CFG_ASPM_L1_ENB | PM_CFG_ASPM_L0S_ENB); + } } else { - pmcfg &= ~PM_CFG_SERDES_PLL_L1_ENB; + pmcfg &= ~(PM_CFG_SERDES_BUDS_RX_L1_ENB | PM_CFG_SERDES_L1_ENB | + PM_CFG_SERDES_PLL_L1_ENB); pmcfg |= PM_CFG_CLK_SWH_L1; - pmcfg &= ~PM_CFG_ASPM_L1_ENB; - pmcfg &= ~PM_CFG_ASPM_L0S_ENB; + if ((sc->alc_flags & ALC_FLAG_L1S) != 0) + pmcfg |= PM_CFG_ASPM_L1_ENB; } CSR_WRITE_4(sc, ALC_PM_CFG, pmcfg); } @@ -567,7 +758,7 @@ alc_attach(device_t dev) { struct alc_softc *sc; struct ifnet *ifp; - char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/l1" }; + char *aspm_state[] = { "L0s/L1", "L0s", "L1", "L0s/L1" }; uint16_t burst; int base, error, i, msic, msixc, state; uint32_t cap, ctl, val; @@ -580,6 +771,7 @@ alc_attach(device_t dev) MTX_DEF); callout_init_mtx(&sc->alc_tick_ch, &sc->alc_mtx, 0); TASK_INIT(&sc->alc_int_task, 0, alc_int_task, sc); + sc->alc_ident = alc_find_ident(dev); /* Map the device. */ pci_enable_busmaster(dev); @@ -619,6 +811,20 @@ alc_attach(device_t dev) val = CSR_READ_4(sc, ALC_PEX_UNC_ERR_SEV); val &= ~(PEX_UNC_ERR_SEV_DLP | PEX_UNC_ERR_SEV_FCP); CSR_WRITE_4(sc, ALC_PEX_UNC_ERR_SEV, val); + CSR_WRITE_4(sc, ALC_LTSSM_ID_CFG, + CSR_READ_4(sc, ALC_LTSSM_ID_CFG) & ~LTSSM_ID_WRO_ENB); + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC, + CSR_READ_4(sc, ALC_PCIE_PHYMISC) | + PCIE_PHYMISC_FORCE_RCV_DET); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B && + sc->alc_rev == ATHEROS_AR8152_B_V10) { + val = CSR_READ_4(sc, ALC_PCIE_PHYMISC2); + val &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK | + PCIE_PHYMISC2_SERDES_TH_MASK); + val |= 3 << PCIE_PHYMISC2_SERDES_CDR_SHIFT; + val |= 3 << PCIE_PHYMISC2_SERDES_TH_SHIFT; + CSR_WRITE_4(sc, ALC_PCIE_PHYMISC2, val); + } /* Disable ASPM L0S and L1. */ cap = CSR_READ_2(sc, base + PCIR_EXPRESS_LINK_CAP); if ((cap & PCIM_LINK_CAP_ASPM) != 0) { @@ -629,12 +835,19 @@ alc_attach(device_t dev) device_printf(dev, "RCB %u bytes\n", sc->alc_rcb == DMA_CFG_RCB_64 ? 64 : 128); state = ctl & 0x03; + if (state & 0x01) + sc->alc_flags |= ALC_FLAG_L0S; + if (state & 0x02) + sc->alc_flags |= ALC_FLAG_L1S; if (bootverbose) device_printf(sc->alc_dev, "ASPM %s %s\n", aspm_state[state], state == 0 ? "disabled" : "enabled"); - if (state != 0) - alc_disable_l0s_l1(sc); + alc_disable_l0s_l1(sc); + } else { + if (bootverbose) + device_printf(sc->alc_dev, + "no ASPM support\n"); } } @@ -651,12 +864,25 @@ alc_attach(device_t dev) * used in AR8132 can't establish gigabit link even if it * shows the same PHY model/revision number of AR8131. */ - if (pci_get_device(dev) == DEVICEID_ATHEROS_AR8132) - sc->alc_flags |= ALC_FLAG_FASTETHER | ALC_FLAG_JUMBO; - else - sc->alc_flags |= ALC_FLAG_JUMBO | ALC_FLAG_ASPM_MON; + switch (sc->alc_ident->deviceid) { + case DEVICEID_ATHEROS_AR8152_B: + case DEVICEID_ATHEROS_AR8152_B2: + sc->alc_flags |= ALC_FLAG_APS; + /* FALLTHROUGH */ + case DEVICEID_ATHEROS_AR8132: + sc->alc_flags |= ALC_FLAG_FASTETHER; + break; + case DEVICEID_ATHEROS_AR8151: + case DEVICEID_ATHEROS_AR8151_V2: + sc->alc_flags |= ALC_FLAG_APS; + /* FALLTHROUGH */ + default: + break; + } + sc->alc_flags |= ALC_FLAG_ASPM_MON | ALC_FLAG_JUMBO; + /* - * It seems that AR8131/AR8132 has silicon bug for SMB. In + * It seems that AR813x/AR815x has silicon bug for SMB. In * addition, Atheros said that enabling SMB wouldn't improve * performance. However I think it's bad to access lots of * registers to extract MAC statistics. @@ -1369,7 +1595,7 @@ again: /* * Create Tx buffer parent tag. - * AR8131/AR8132 allows 64bit DMA addressing of Tx/Rx buffers + * AR813x/AR815x allows 64bit DMA addressing of Tx/Rx buffers * so it needs separate parent DMA tag as parent DMA address * space could be restricted to be within 32bit address space * by 4GB boundary crossing. @@ -1806,7 +2032,7 @@ alc_encap(struct alc_softc *sc, struct m poff = 0; if ((m->m_pkthdr.csum_flags & (ALC_CSUM_FEATURES | CSUM_TSO)) != 0) { /* - * AR8131/AR8132 requires offset of TCP/UDP header in its + * AR813x/AR815x requires offset of TCP/UDP header in its * Tx descriptor to perform Tx checksum offloading. TSO * also requires TCP header offset and modification of * IP/TCP header. This kind of operation takes many CPU @@ -1826,12 +2052,14 @@ alc_encap(struct alc_softc *sc, struct m *m_head = m; } - m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip)); + m = m_pullup(m, sizeof(struct ether_header) + + sizeof(struct ip)); if (m == NULL) { *m_head = NULL; return (ENOBUFS); } - ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header)); + ip = (struct ip *)(mtod(m, char *) + + sizeof(struct ether_header)); poff = sizeof(struct ether_header) + (ip->ip_hl << 2); if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { m = m_pullup(m, poff + sizeof(struct tcphdr)); @@ -1922,7 +2150,7 @@ alc_encap(struct alc_softc *sc, struct m cflags |= (poff << TD_TCPHDR_OFFSET_SHIFT) & TD_TCPHDR_OFFSET_MASK; /* - * AR8131/AR8132 requires the first buffer should + * AR813x/AR815x requires the first buffer should * only hold IP/TCP header data. Payload should * be handled in other descriptors. */ @@ -2103,14 +2331,16 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, error = 0; switch (cmd) { case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ALC_JUMBO_MTU || + if (ifr->ifr_mtu < ETHERMIN || + ifr->ifr_mtu > (sc->alc_ident->max_framelen - + sizeof(struct ether_vlan_header) - ETHER_CRC_LEN) || ((sc->alc_flags & ALC_FLAG_JUMBO) == 0 && ifr->ifr_mtu > ETHERMTU)) error = EINVAL; else if (ifp->if_mtu != ifr->ifr_mtu) { ALC_LOCK(sc); ifp->if_mtu = ifr->ifr_mtu; - /* AR8131/AR8132 has 13 bits MSS field. */ + /* AR813x/AR815x has 13 bits MSS field. */ if (ifp->if_mtu > ALC_TSO_MTU && (ifp->if_capenable & IFCAP_TSO4) != 0) { ifp->if_capenable &= ~IFCAP_TSO4; @@ -2161,7 +2391,7 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, (ifp->if_capabilities & IFCAP_TSO4) != 0) { ifp->if_capenable ^= IFCAP_TSO4; if ((ifp->if_capenable & IFCAP_TSO4) != 0) { - /* AR8131/AR8132 has 13 bits MSS field. */ + /* AR813x/AR815x has 13 bits MSS field. */ if (ifp->if_mtu > ALC_TSO_MTU) { ifp->if_capenable &= ~IFCAP_TSO4; ifp->if_hwassist &= ~CSUM_TSO; @@ -2213,6 +2443,10 @@ alc_mac_config(struct alc_softc *sc) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg &= ~(MAC_CFG_FULL_DUPLEX | MAC_CFG_TX_FC | MAC_CFG_RX_FC | MAC_CFG_SPEED_MASK); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg |= MAC_CFG_HASH_ALG_CRC32 | MAC_CFG_SPEED_MODE_SW; /* Reprogram MAC with resolved speed/duplex. */ switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: @@ -2834,7 +3068,9 @@ alc_reset(struct alc_softc *sc) uint32_t reg; int i; - CSR_WRITE_4(sc, ALC_MASTER_CFG, MASTER_RESET); + reg = CSR_READ_4(sc, ALC_MASTER_CFG) & 0xFFFF; + reg |= MASTER_OOB_DIS_OFF | MASTER_RESET; + CSR_WRITE_4(sc, ALC_MASTER_CFG, reg); for (i = ALC_RESET_TIMEOUT; i > 0; i--) { DELAY(10); if ((CSR_READ_4(sc, ALC_MASTER_CFG) & MASTER_RESET) == 0) @@ -2965,6 +3201,18 @@ alc_init_locked(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_SMB_BASE_ADDR_HI, ALC_ADDR_HI(paddr)); CSR_WRITE_4(sc, ALC_SMB_BASE_ADDR_LO, ALC_ADDR_LO(paddr)); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B) { + /* Reconfigure SRAM - Vendor magic. */ + CSR_WRITE_4(sc, ALC_SRAM_RX_FIFO_LEN, 0x000002A0); + CSR_WRITE_4(sc, ALC_SRAM_TX_FIFO_LEN, 0x00000100); + CSR_WRITE_4(sc, ALC_SRAM_RX_FIFO_ADDR, 0x029F0000); + CSR_WRITE_4(sc, ALC_SRAM_RD0_ADDR, 0x02BF02A0); + CSR_WRITE_4(sc, ALC_SRAM_TX_FIFO_ADDR, 0x03BF02C0); + CSR_WRITE_4(sc, ALC_SRAM_TD_ADDR, 0x03DF03C0); + CSR_WRITE_4(sc, ALC_TXF_WATER_MARK, 0x00000000); + CSR_WRITE_4(sc, ALC_RD_DMA_CFG, 0x00000000); + } + /* Tell hardware that we're ready to load DMA blocks. */ CSR_WRITE_4(sc, ALC_DMA_BLOCK, DMA_BLOCK_LOAD); @@ -2972,14 +3220,11 @@ alc_init_locked(struct alc_softc *sc) reg = ALC_USECS(sc->alc_int_rx_mod) << IM_TIMER_RX_SHIFT; reg |= ALC_USECS(sc->alc_int_tx_mod) << IM_TIMER_TX_SHIFT; CSR_WRITE_4(sc, ALC_IM_TIMER, reg); - reg = CSR_READ_4(sc, ALC_MASTER_CFG); - reg &= ~(MASTER_CHIP_REV_MASK | MASTER_CHIP_ID_MASK); /* * We don't want to automatic interrupt clear as task queue * for the interrupt should know interrupt status. */ - reg &= ~MASTER_INTR_RD_CLR; - reg &= ~(MASTER_IM_RX_TIMER_ENB | MASTER_IM_TX_TIMER_ENB); + reg = MASTER_SA_TIMER_ENB; if (ALC_USECS(sc->alc_int_rx_mod) != 0) reg |= MASTER_IM_RX_TIMER_ENB; if (ALC_USECS(sc->alc_int_tx_mod) != 0) @@ -3020,7 +3265,7 @@ alc_init_locked(struct alc_softc *sc) * Be conservative in what you do, be liberal in what you * accept from others - RFC 793. */ - CSR_WRITE_4(sc, ALC_FRAME_SIZE, ALC_JUMBO_FRAMELEN); + CSR_WRITE_4(sc, ALC_FRAME_SIZE, sc->alc_ident->max_framelen); /* Disable header split(?) */ CSR_WRITE_4(sc, ALC_HDS_CFG, 0); @@ -3047,11 +3292,14 @@ alc_init_locked(struct alc_softc *sc) * TSO/checksum offloading. */ CSR_WRITE_4(sc, ALC_TSO_OFFLOAD_THRESH, - (ALC_JUMBO_FRAMELEN >> TSO_OFFLOAD_THRESH_UNIT_SHIFT) & + (sc->alc_ident->max_framelen >> TSO_OFFLOAD_THRESH_UNIT_SHIFT) & TSO_OFFLOAD_THRESH_MASK); /* Configure TxQ. */ reg = (alc_dma_burst[sc->alc_dma_rd_burst] << TXQ_CFG_TX_FIFO_BURST_SHIFT) & TXQ_CFG_TX_FIFO_BURST_MASK; + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg >>= 1; reg |= (TXQ_CFG_TD_BURST_DEFAULT << TXQ_CFG_TD_BURST_SHIFT) & TXQ_CFG_TD_BURST_MASK; CSR_WRITE_4(sc, ALC_TXQ_CFG, reg | TXQ_CFG_ENHANCED_MODE); @@ -3068,14 +3316,23 @@ alc_init_locked(struct alc_softc *sc) * XON : 80% of Rx FIFO * XOFF : 30% of Rx FIFO */ - reg = CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN); - rxf_hi = (reg * 8) / 10; - rxf_lo = (reg * 3)/ 10; - CSR_WRITE_4(sc, ALC_RX_FIFO_PAUSE_THRESH, - ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & - RX_FIFO_PAUSE_THRESH_LO_MASK) | - ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & - RX_FIFO_PAUSE_THRESH_HI_MASK)); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8131 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8132) { + reg = CSR_READ_4(sc, ALC_SRAM_RX_FIFO_LEN); + rxf_hi = (reg * 8) / 10; + rxf_lo = (reg * 3) / 10; + CSR_WRITE_4(sc, ALC_RX_FIFO_PAUSE_THRESH, + ((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) & + RX_FIFO_PAUSE_THRESH_LO_MASK) | + ((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) & + RX_FIFO_PAUSE_THRESH_HI_MASK)); + } + + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2) + CSR_WRITE_4(sc, ALC_SERDES_LOCK, + CSR_READ_4(sc, ALC_SERDES_LOCK) | SERDES_MAC_CLK_SLOWDOWN | + SERDES_PHY_CLK_SLOWDOWN); /* Disable RSS until I understand L1C/L2C's RSS logic. */ CSR_WRITE_4(sc, ALC_RSS_IDT_TABLE0, 0); @@ -3086,15 +3343,9 @@ alc_init_locked(struct alc_softc *sc) RXQ_CFG_RD_BURST_MASK; reg |= RXQ_CFG_RSS_MODE_DIS; if ((sc->alc_flags & ALC_FLAG_ASPM_MON) != 0) - reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_100M; + reg |= RXQ_CFG_ASPM_THROUGHPUT_LIMIT_1M; CSR_WRITE_4(sc, ALC_RXQ_CFG, reg); - /* Configure Rx DMAW request thresold. */ - CSR_WRITE_4(sc, ALC_RD_DMA_CFG, - ((RD_DMA_CFG_THRESH_DEFAULT << RD_DMA_CFG_THRESH_SHIFT) & - RD_DMA_CFG_THRESH_MASK) | - ((ALC_RD_DMA_CFG_USECS(0) << RD_DMA_CFG_TIMER_SHIFT) & - RD_DMA_CFG_TIMER_MASK)); /* Configure DMA parameters. */ reg = DMA_CFG_OUT_ORDER | DMA_CFG_RD_REQ_PRI; reg |= sc->alc_rcb; @@ -3120,7 +3371,7 @@ alc_init_locked(struct alc_softc *sc) * - Enable CRC generation. * Actual reconfiguration of MAC for resolved speed/duplex * is followed after detection of link establishment. - * AR8131/AR8132 always does checksum computation regardless + * AR813x/AR815x always does checksum computation regardless * of MAC_CFG_RXCSUM_ENB bit. Also the controller is known to * have bug in protocol field in Rx return structure so * these controllers can't handle fragmented frames. Disable @@ -3130,6 +3381,10 @@ alc_init_locked(struct alc_softc *sc) reg = MAC_CFG_TX_CRC_ENB | MAC_CFG_TX_AUTO_PAD | MAC_CFG_FULL_DUPLEX | ((MAC_CFG_PREAMBLE_DEFAULT << MAC_CFG_PREAMBLE_SHIFT) & MAC_CFG_PREAMBLE_MASK); + if (sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8151_V2 || + sc->alc_ident->deviceid == DEVICEID_ATHEROS_AR8152_B2) + reg |= MAC_CFG_HASH_ALG_CRC32 | MAC_CFG_SPEED_MODE_SW; if ((sc->alc_flags & ALC_FLAG_FASTETHER) != 0) reg |= MAC_CFG_SPEED_10_100; else Modified: stable/7/sys/dev/alc/if_alcreg.h ============================================================================== --- stable/7/sys/dev/alc/if_alcreg.h Mon Aug 30 21:15:40 2010 (r212021) +++ stable/7/sys/dev/alc/if_alcreg.h Mon Aug 30 21:17:11 2010 (r212022) @@ -36,10 +36,17 @@ #define VENDORID_ATHEROS 0x1969 /* - * Atheros AR8131/AR8132 device ID + * Atheros AR813x/AR815x device ID */ #define DEVICEID_ATHEROS_AR8131 0x1063 /* L1C */ #define DEVICEID_ATHEROS_AR8132 0x1062 /* L2C */ +#define DEVICEID_ATHEROS_AR8151 0x1073 /* L1D V1.0 */ +#define DEVICEID_ATHEROS_AR8151_V2 0x1083 /* L1D V2.0 */ +#define DEVICEID_ATHEROS_AR8152_B 0x2060 /* L2C V1.1 */ +#define DEVICEID_ATHEROS_AR8152_B2 0x2062 /* L2C V2.0 */ + +#define ATHEROS_AR8152_B_V10 0xC0 +#define ATHEROS_AR8152_B_V11 0xC1 /* 0x0000 - 0x02FF : PCIe configuration space */ @@ -64,6 +71,12 @@ #define ALC_PCIE_PHYMISC 0x1000 #define PCIE_PHYMISC_FORCE_RCV_DET 0x00000004 +#define ALC_PCIE_PHYMISC2 0x1004 +#define PCIE_PHYMISC2_SERDES_CDR_MASK 0x00030000 +#define PCIE_PHYMISC2_SERDES_TH_MASK 0x000C0000 +#define PCIE_PHYMISC2_SERDES_CDR_SHIFT 16 +#define PCIE_PHYMISC2_SERDES_TH_SHIFT 18 + #define ALC_TWSI_DEBUG 0x1108 #define TWSI_DEBUG_DEV_EXIST 0x20000000 @@ -97,6 +110,8 @@ #define PM_CFG_L1_ENTRY_TIMER_MASK 0x000F0000 #define PM_CFG_PM_REQ_TIMER_MASK 0x00F00000 #define PM_CFG_LCKDET_TIMER_MASK 0x3F000000 +#define PM_CFG_EN_BUFS_RX_L0S 0x10000000 +#define PM_CFG_SA_DLY_ENB 0x20000000 #define PM_CFG_MAC_ASPM_CHK 0x40000000 #define PM_CFG_HOTRST 0x80000000 #define PM_CFG_L0S_ENTRY_TIMER_SHIFT 8 @@ -104,10 +119,19 @@ #define PM_CFG_PM_REQ_TIMER_SHIFT 20 #define PM_CFG_LCKDET_TIMER_SHIFT 24 +#define PM_CFG_L0S_ENTRY_TIMER_DEFAULT 6 +#define PM_CFG_L1_ENTRY_TIMER_DEFAULT 12 +#define PM_CFG_PM_REQ_TIMER_DEFAULT 1 + +#define ALC_LTSSM_ID_CFG 0x12FC +#define LTSSM_ID_WRO_ENB 0x00001000 + #define ALC_MASTER_CFG 0x1400 #define MASTER_RESET 0x00000001 #define MASTER_TEST_MODE_MASK 0x0000000C #define MASTER_BERT_START 0x00000010 +#define MASTER_OOB_DIS_OFF 0x00000040 +#define MASTER_SA_TIMER_ENB 0x00000080 #define MASTER_MTIMER_ENB 0x00000100 #define MASTER_MANUAL_INTR_ENB 0x00000200 #define MASTER_IM_TX_TIMER_ENB 0x00000400 @@ -122,7 +146,7 @@ #define MASTER_CHIP_REV_SHIFT 16 #define MASTER_CHIP_ID_SHIFT 24 -/* Number of ticks per usec for AR8131/AR8132. */ +/* Number of ticks per usec for AR813x/AR815x. */ #define ALC_TICK_USECS 2 #define ALC_USECS(x) ((x) / ALC_TICK_USECS) @@ -220,6 +244,8 @@ #define ALC_SERDES_LOCK 0x1424 #define SERDES_LOCK_DET 0x00000001 #define SERDES_LOCK_DET_ENB 0x00000002 +#define SERDES_MAC_CLK_SLOWDOWN 0x00020000 +#define SERDES_PHY_CLK_SLOWDOWN 0x00040000 #define ALC_MAC_CFG 0x1480 #define MAC_CFG_TX_ENB 0x00000001 @@ -249,6 +275,8 @@ #define MAC_CFG_BCAST 0x04000000 #define MAC_CFG_DBG 0x08000000 #define MAC_CFG_SINGLE_PAUSE_ENB 0x10000000 +#define MAC_CFG_HASH_ALG_CRC32 0x20000000 +#define MAC_CFG_SPEED_MODE_SW 0x40000000 #define MAC_CFG_PREAMBLE_SHIFT 10 #define MAC_CFG_PREAMBLE_DEFAULT 7 @@ -691,7 +719,7 @@ #define HDS_CFG_BACKFILLSIZE_SHIFT 8 #define HDS_CFG_MAX_HDRSIZE_SHIFT 20 -/* AR8131/AR8132 registers for MAC statistics */ +/* AR813x/AR815x registers for MAC statistics */ #define ALC_RX_MIB_BASE 0x1700 #define ALC_TX_MIB_BASE 0x1760 Modified: stable/7/sys/dev/alc/if_alcvar.h ============================================================================== --- stable/7/sys/dev/alc/if_alcvar.h Mon Aug 30 21:15:40 2010 (r212021) +++ stable/7/sys/dev/alc/if_alcvar.h Mon Aug 30 21:17:11 2010 (r212022) @@ -68,13 +68,8 @@ #define ALC_PROC_MAX (ALC_RX_RING_CNT - 1) #define ALC_PROC_DEFAULT (ALC_RX_RING_CNT / 4) -#define ALC_JUMBO_FRAMELEN (9 * 1024) -#define ALC_JUMBO_MTU \ - (ALC_JUMBO_FRAMELEN - sizeof(struct ether_vlan_header) - ETHER_CRC_LEN) -#define ALC_MAX_FRAMELEN (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) - /* - * The number of bits reserved for MSS in AR8121/AR8132 controllers + * The number of bits reserved for MSS in AR813x/AR815x controllers * are 13 bits. This limits the maximum interface MTU size in TSO * case(8191 + sizeof(struct ip) + sizeof(struct tcphdr)) as upper * stack should not generate TCP segments with MSS greater than the @@ -192,6 +187,13 @@ struct alc_hw_stats { uint64_t tx_mcast_bytes; }; +struct alc_ident { + uint16_t vendorid; + uint16_t deviceid; + uint32_t max_framelen; + const char *name; +}; + /* * Software state per device. */ @@ -204,6 +206,7 @@ struct alc_softc { struct resource *alc_irq[ALC_MSI_MESSAGES]; struct resource_spec *alc_irq_spec; void *alc_intrhand[ALC_MSI_MESSAGES]; + struct alc_ident *alc_ident; int alc_rev; int alc_chip_rev; int alc_phyaddr; @@ -224,6 +227,9 @@ struct alc_softc { #define ALC_FLAG_ASPM_MON 0x0080 #define ALC_FLAG_CMB_BUG 0x0100 #define ALC_FLAG_SMB_BUG 0x0200 +#define ALC_FLAG_L0S 0x0400 +#define ALC_FLAG_L1S 0x0800 +#define ALC_FLAG_APS 0x1000 #define ALC_FLAG_DETACH 0x4000 #define ALC_FLAG_LINK 0x8000 From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:18:28 2010 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 4753F10656B7; Mon, 30 Aug 2010 21:18:28 +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 1C0228FC0C; Mon, 30 Aug 2010 21:18:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULIShd007851; Mon, 30 Aug 2010 21:18:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULIRiI007849; Mon, 30 Aug 2010 21:18:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302118.o7ULIRiI007849@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:18: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: r212023 - 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: Mon, 30 Aug 2010 21:18:28 -0000 Author: yongari Date: Mon Aug 30 21:18:27 2010 New Revision: 212023 URL: http://svn.freebsd.org/changeset/base/212023 Log: MFC r211106: Document newly added controller AR8151 and AR8152. Modified: stable/8/share/man/man4/alc.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/alc.4 ============================================================================== --- stable/8/share/man/man4/alc.4 Mon Aug 30 21:17:11 2010 (r212022) +++ stable/8/share/man/man4/alc.4 Mon Aug 30 21:18:27 2010 (r212023) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 10, 2009 +.Dd August 9, 2010 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR8131/AR8132 Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,9 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR8131 PCI Express -Gigabit Ethernet controllers and Atheros AR8132 PCI Express -Fast Ethernet controllers. +device driver provides support for Atheros AR813x and AR815x PCI +Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -59,8 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR8131/AR8132 supports Jumbo Frames (up to 9216 bytes), which can -be configured via the interface MTU setting. +The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 +bytes, respectively), which can be configured via the interface +MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -104,6 +104,14 @@ device driver provides support for the f Atheros AR8131 PCI Express Gigabit Ethernet controller .It Atheros AR8132 PCI Express Fast Ethernet controller +.It +Atheros AR8151 v1.0 PCI Express Gigabit Ethernet controller +.It +Atheros AR8151 v2.0 PCI Express Gigabit Ethernet controller +.It +Atheros AR8152 v1.1 PCI Express Fast Ethernet controller +.It +Atheros AR8152 v2.0 PCI Express Fast Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:18:57 2010 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 8617110656C8; Mon, 30 Aug 2010 21:18:57 +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 577278FC14; Mon, 30 Aug 2010 21:18:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULIvKA007912; Mon, 30 Aug 2010 21:18:57 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULIvGe007910; Mon, 30 Aug 2010 21:18:57 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302118.o7ULIvGe007910@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 21:18: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: r212024 - stable/7/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: Mon, 30 Aug 2010 21:18:57 -0000 Author: yongari Date: Mon Aug 30 21:18:57 2010 New Revision: 212024 URL: http://svn.freebsd.org/changeset/base/212024 Log: MFC r211106: Document newly added controller AR8151 and AR8152. Modified: stable/7/share/man/man4/alc.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/alc.4 ============================================================================== --- stable/7/share/man/man4/alc.4 Mon Aug 30 21:18:27 2010 (r212023) +++ stable/7/share/man/man4/alc.4 Mon Aug 30 21:18:57 2010 (r212024) @@ -24,12 +24,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 10, 2009 +.Dd August 9, 2010 .Dt ALC 4 .Os .Sh NAME .Nm alc -.Nd Atheros AR8131/AR8132 Gigabit/Fast Ethernet driver +.Nd Atheros AR813x/AR815x Gigabit/Fast Ethernet driver .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -48,9 +48,8 @@ if_alc_load="YES" .Sh DESCRIPTION The .Nm -device driver provides support for Atheros AR8131 PCI Express -Gigabit Ethernet controllers and Atheros AR8132 PCI Express -Fast Ethernet controllers. +device driver provides support for Atheros AR813x and AR815x PCI +Express Gigabit/Fast Ethernet controllers. .Pp All LOMs supported by the .Nm @@ -59,8 +58,9 @@ segmentation offload (TSO), hardware VLA features, Wake On Lan (WOL) and an interrupt moderation mechanism as well as a 64-bit multicast hash filter. .Pp -The AR8131/AR8132 supports Jumbo Frames (up to 9216 bytes), which can -be configured via the interface MTU setting. +The AR813x and AR815x supports Jumbo Frames (up to 9216 and 6144 +bytes, respectively), which can be configured via the interface +MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit Jumbo Frames. @@ -104,6 +104,14 @@ device driver provides support for the f Atheros AR8131 PCI Express Gigabit Ethernet controller .It Atheros AR8132 PCI Express Fast Ethernet controller +.It +Atheros AR8151 v1.0 PCI Express Gigabit Ethernet controller +.It +Atheros AR8151 v2.0 PCI Express Gigabit Ethernet controller +.It +Atheros AR8152 v1.1 PCI Express Fast Ethernet controller +.It +Atheros AR8152 v2.0 PCI Express Fast Ethernet controller .El .Sh LOADER TUNABLES Tunables can be set at the From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:18:59 2010 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 5D65B1065675; Mon, 30 Aug 2010 21:18:59 +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 4D8FB8FC18; Mon, 30 Aug 2010 21:18:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULIxYj007947; Mon, 30 Aug 2010 21:18:59 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULIxV9007945; Mon, 30 Aug 2010 21:18:59 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201008302118.o7ULIxV9007945@svn.freebsd.org> From: Dimitry Andric Date: Mon, 30 Aug 2010 21:18: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: r212025 - 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: Mon, 30 Aug 2010 21:18:59 -0000 Author: dim Date: Mon Aug 30 21:18:59 2010 New Revision: 212025 URL: http://svn.freebsd.org/changeset/base/212025 Log: Add myself to committers-src.dot. Approved by: rpaulo (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Mon Aug 30 21:18:57 2010 (r212024) +++ head/share/misc/committers-src.dot Mon Aug 30 21:18:59 2010 (r212025) @@ -85,6 +85,7 @@ delphij [label="Xin Li\ndelphij@FreeBSD. des [label="Dag-Erling Smorgrav\ndes@FreeBSD.org\n1998/04/03"] dg [label="David Greenman\ndg@FreeBSD.org\n1993/06/14"] dhartmei [label="Daniel Hartmeier\ndhartmei@FreeBSD.org\n2004/04/06"] +dim [label="Dimitry Andric\ndim@FreeBSD.org\n2010/08/30"] dmlb [label="Duncan Barclay\ndmlb@FreeBSD.org\n2001/12/14"] dwmalone [label="David Malone\ndwmalone@FreeBSD.org\n2000/07/11"] ed [label="Ed Schouten\ned@FreeBSD.org\n2008/05/22"] @@ -271,6 +272,7 @@ dwmalone -> fanf dwmalone -> peadar dwmalone -> snb +ed -> dim ed -> gavin ed -> jilles ed -> rdivacky @@ -430,6 +432,7 @@ rgrimes -> markm rpaulo -> avg rpaulo -> bschmidt +rpaulo -> dim rrs -> brucec rrs -> jchandra From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:19:42 2010 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 E574210656A3; Mon, 30 Aug 2010 21:19:42 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5AD28FC17; Mon, 30 Aug 2010 21:19:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULJg7W008008; Mon, 30 Aug 2010 21:19:42 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULJgHl008006; Mon, 30 Aug 2010 21:19:42 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008302119.o7ULJgHl008006@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 30 Aug 2010 21:19: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: r212026 - 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, 30 Aug 2010 21:19:43 -0000 Author: jkim Date: Mon Aug 30 21:19:42 2010 New Revision: 212026 URL: http://svn.freebsd.org/changeset/base/212026 Log: Save MSR_FSBASE, MSR_GSBASE and MSR_KGSBASE directly to PCB as we do not use these values in the function. Modified: head/sys/amd64/amd64/cpu_switch.S Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Mon Aug 30 21:18:59 2010 (r212025) +++ head/sys/amd64/amd64/cpu_switch.S Mon Aug 30 21:19:42 2010 (r212026) @@ -338,19 +338,16 @@ ENTRY(savectx) movl $MSR_FSBASE,%ecx rdmsr - shlq $32,%rdx - leaq (%rax,%rdx),%rax - movq %rax,PCB_FSBASE(%rdi) + movl %eax,PCB_FSBASE(%rdi) + movl %edx,PCB_FSBASE+4(%rdi) movl $MSR_GSBASE,%ecx rdmsr - shlq $32,%rdx - leaq (%rax,%rdx),%rax - movq %rax,PCB_GSBASE(%rdi) + movl %eax,PCB_GSBASE(%rdi) + movl %edx,PCB_GSBASE+4(%rdi) movl $MSR_KGSBASE,%ecx rdmsr - shlq $32,%rdx - leaq (%rax,%rdx),%rax - movq %rax,PCB_KGSBASE(%rdi) + movl %eax,PCB_KGSBASE(%rdi) + movl %edx,PCB_KGSBASE+4(%rdi) sgdt PCB_GDT(%rdi) sidt PCB_IDT(%rdi) From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:20:25 2010 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 4A84710656AA; Mon, 30 Aug 2010 21:20: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 3A5858FC1D; Mon, 30 Aug 2010 21:20:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULKPuK008069; Mon, 30 Aug 2010 21:20:25 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULKPjk008066; Mon, 30 Aug 2010 21:20:25 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201008302120.o7ULKPjk008066@svn.freebsd.org> From: Dimitry Andric Date: Mon, 30 Aug 2010 21:20: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: r212027 - head/usr.bin/calendar/calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:20:25 -0000 Author: dim Date: Mon Aug 30 21:20:24 2010 New Revision: 212027 URL: http://svn.freebsd.org/changeset/base/212027 Log: Add myself to calendars.freebsd. Approved by: rpaulo (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Mon Aug 30 21:19:42 2010 (r212026) +++ head/usr.bin/calendar/calendars/calendar.freebsd Mon Aug 30 21:20:24 2010 (r212027) @@ -8,6 +8,7 @@ #define _calendar_freebsd_ 01/01 Alexander Langer born in Duesseldorf, Nordrhein-Westfalen, Germany, 1981 +01/01 Dimitry Andric born in Utrecht, the Netherlands, 1969 01/02 Ion-Mihai "IOnut" Tetcu born in Bucharest, Romania, 1980 01/02 Patrick Li born in Beijing, People's Republic of China, 1985 01/03 Tetsurou Okazaki born in Mobara, Chiba, Japan, 1972 From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:33:33 2010 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 C4E5310656A6; Mon, 30 Aug 2010 21:33:33 +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 B4D758FC13; Mon, 30 Aug 2010 21:33:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULXXvF008429; Mon, 30 Aug 2010 21:33:33 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULXXH8008427; Mon, 30 Aug 2010 21:33:33 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008302133.o7ULXXH8008427@svn.freebsd.org> From: Xin LI Date: Mon, 30 Aug 2010 21:33: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: r212028 - head/sys/dev/twa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:33:33 -0000 Author: delphij Date: Mon Aug 30 21:33:33 2010 New Revision: 212028 URL: http://svn.freebsd.org/changeset/base/212028 Log: Drain watchdog callouts before detaching. This prevents a panic while unloading the kernel module. Submitted by: Tom Cough Modified: head/sys/dev/twa/tw_osl_freebsd.c Modified: head/sys/dev/twa/tw_osl_freebsd.c ============================================================================== --- head/sys/dev/twa/tw_osl_freebsd.c Mon Aug 30 21:20:24 2010 (r212027) +++ head/sys/dev/twa/tw_osl_freebsd.c Mon Aug 30 21:33:33 2010 (r212028) @@ -903,6 +903,10 @@ twa_shutdown(device_t dev) /* Disconnect interrupts. */ error = twa_teardown_intr(sc); + /* Stop watchdog task. */ + callout_drain(&(sc->watchdog_callout[0])); + callout_drain(&(sc->watchdog_callout[1])); + /* Disconnect from the controller. */ if ((error = tw_cl_shutdown_ctlr(&(sc->ctlr_handle), 0))) { tw_osli_printf(sc, "error = %d", From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 21:58:53 2010 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 5094C1065694; Mon, 30 Aug 2010 21:58:53 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FEC28FC22; Mon, 30 Aug 2010 21:58:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7ULwr5F008916; Mon, 30 Aug 2010 21:58:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7ULwrgl008914; Mon, 30 Aug 2010 21:58:53 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008302158.o7ULwrgl008914@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 30 Aug 2010 21:58: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: r212029 - head/usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 21:58:53 -0000 Author: nwhitehorn Date: Mon Aug 30 21:58:52 2010 New Revision: 212029 URL: http://svn.freebsd.org/changeset/base/212029 Log: Use MACHINE_ARCH instead of MACHINE as the directory to fetch packages from. Packages are architecture dependent, not machine dependent. Modified: head/usr.sbin/pkg_install/add/main.c Modified: head/usr.sbin/pkg_install/add/main.c ============================================================================== --- head/usr.sbin/pkg_install/add/main.c Mon Aug 30 21:33:33 2010 (r212028) +++ head/usr.sbin/pkg_install/add/main.c Mon Aug 30 21:58:52 2010 (r212029) @@ -22,7 +22,7 @@ __FBSDID("$FreeBSD$"); #include -#include +#include #include #include @@ -301,7 +301,9 @@ getpackagesite(void) { int reldate, i; static char sitepath[MAXPATHLEN]; - struct utsname u; + int archmib[] = { CTL_HW, HW_MACHINE_ARCH }; + char arch[64]; + size_t archlen = sizeof(arch); if (getenv("PACKAGESITE")) { if (strlcpy(sitepath, getenv("PACKAGESITE"), sizeof(sitepath)) @@ -324,8 +326,10 @@ getpackagesite(void) >= sizeof(sitepath)) return NULL; - uname(&u); - if (strlcat(sitepath, u.machine, sizeof(sitepath)) >= sizeof(sitepath)) + if (sysctl(archmib, 2, arch, &archlen, NULL, 0) == -1) + return NULL; + arch[archlen-1] = 0; + if (strlcat(sitepath, arch, sizeof(sitepath)) >= sizeof(sitepath)) return NULL; reldate = getosreldate(); From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 22:16:31 2010 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 3D0B310656A3; Mon, 30 Aug 2010 22:16:31 +0000 (UTC) (envelope-from pgollucci@p6m7g8.com) Received: from cell.p6m7g8.net (static-71-178-236-107.washdc.fios.verizon.net [71.178.236.107]) by mx1.freebsd.org (Postfix) with ESMTP id C935A8FC14; Mon, 30 Aug 2010 22:16:30 +0000 (UTC) Received: from philip.hq.rws (wsip-174-79-184-239.dc.dc.cox.net [174.79.184.239]) (authenticated bits=0) by cell.p6m7g8.net (8.14.4/8.14.3) with ESMTP id o7UMGPXf022164 (version=TLSv1/SSLv3 cipher=DHE-DSS-CAMELLIA256-SHA bits=256 verify=NO); Mon, 30 Aug 2010 22:16:26 GMT (envelope-from pgollucci@p6m7g8.com) Message-ID: <4C7C2DBA.6040705@p6m7g8.com> Date: Mon, 30 Aug 2010 22:16:26 +0000 From: "Philip M. Gollucci" Organization: P6M7G8 Inc. User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.9) Gecko/20100607 Thunderbird/3.0.4 MIME-Version: 1.0 To: Nathan Whitehorn References: <201008302158.o7ULwrgl008914@svn.freebsd.org> In-Reply-To: <201008302158.o7ULwrgl008914@svn.freebsd.org> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cell.p6m7g8.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212029 - head/usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 22:16:31 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/30/10 21:58, Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Mon Aug 30 21:58:52 2010 > New Revision: 212029 > URL: http://svn.freebsd.org/changeset/base/212029 > > Log: > Use MACHINE_ARCH instead of MACHINE as the directory to fetch packages > from. Packages are architecture dependent, not machine dependent. > > Modified: > head/usr.sbin/pkg_install/add/main.c > > Modified: head/usr.sbin/pkg_install/add/main.c > ============================================================================== > --- head/usr.sbin/pkg_install/add/main.c Mon Aug 30 21:33:33 2010 (r212028) > +++ head/usr.sbin/pkg_install/add/main.c Mon Aug 30 21:58:52 2010 (r212029) > @@ -22,7 +22,7 @@ > __FBSDID("$FreeBSD$"); > > #include > -#include > +#include > #include > #include > > @@ -301,7 +301,9 @@ getpackagesite(void) > { > int reldate, i; > static char sitepath[MAXPATHLEN]; > - struct utsname u; > + int archmib[] = { CTL_HW, HW_MACHINE_ARCH }; > + char arch[64]; > + size_t archlen = sizeof(arch); > > if (getenv("PACKAGESITE")) { > if (strlcpy(sitepath, getenv("PACKAGESITE"), sizeof(sitepath)) > @@ -324,8 +326,10 @@ getpackagesite(void) > >= sizeof(sitepath)) > return NULL; > > - uname(&u); > - if (strlcat(sitepath, u.machine, sizeof(sitepath)) >= sizeof(sitepath)) > + if (sysctl(archmib, 2, arch, &archlen, NULL, 0) == -1) > + return NULL; > + arch[archlen-1] = 0; ^^^^^^ '\0' ? - -- - ------------------------------------------------------------------------ 1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C Philip M. Gollucci (pgollucci@p6m7g8.com) c: 703.336.9354 VP Apache Infrastructure; Member, Apache Software Foundation Committer, FreeBSD Foundation Consultant, P6M7G8 Inc. Sr. System Admin, Ridecharge Inc. Work like you don't need the money, love like you'll never get hurt, and dance like nobody's watching. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iD8DBQFMfC26dbiP+9ubjBwRAn19AJ9oulCApJvsi2b+LeLAIrPiDr3lHQCeMH4n gokbmMFiWv/cgkJpuH2ZfOI= =uEbc -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 22:17:06 2010 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 9F47B1065693; Mon, 30 Aug 2010 22:17:06 +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 8D2898FC12; Mon, 30 Aug 2010 22:17:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UMH69f009339; Mon, 30 Aug 2010 22:17:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UMH6ci009336; Mon, 30 Aug 2010 22:17:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302217.o7UMH6ci009336@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 22:17:06 +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: r212030 - stable/7/sys/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, 30 Aug 2010 22:17:06 -0000 Author: yongari Date: Mon Aug 30 22:17:06 2010 New Revision: 212030 URL: http://svn.freebsd.org/changeset/base/212030 Log: MFC r184515,184524,184559: r184515: Add RL_TWISTER_ENABLE option. This enables the magic bits to do long cable tuning. This has helped in some installations for hardware deployed by a former employer. Made optional because the lists aren't full of complaints about these cards... even when they were wildly popular. r184524: Fix a few typos/spelling errors in my comments from the last commit, plus a few others that had lingered in this driver... Submitted by: "b." bf2006a att yahoo KIBO com r184559: Make RL_TWISTER_ENABLE a tunable/sysctl. Eliminate it as an option. Fix module build. Modified: stable/7/sys/pci/if_rl.c stable/7/sys/pci/if_rlreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_rl.c ============================================================================== --- stable/7/sys/pci/if_rl.c Mon Aug 30 21:58:52 2010 (r212029) +++ stable/7/sys/pci/if_rl.c Mon Aug 30 22:17:06 2010 (r212030) @@ -96,6 +96,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -155,7 +156,7 @@ static struct rl_type rl_devs[] = { { DELTA_VENDORID, DELTA_DEVICEID_8139, RL_8139, "Delta Electronics 8139 10/100BaseTX" }, { ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, RL_8139, - "Addtron Technolgy 8139 10/100BaseTX" }, + "Addtron Technology 8139 10/100BaseTX" }, { DLINK_VENDORID, DLINK_DEVICEID_530TXPLUS, RL_8139, "D-Link DFE-530TX+ 10/100BaseTX" }, { DLINK_VENDORID, DLINK_DEVICEID_690TXD, RL_8139, @@ -802,14 +803,25 @@ rl_attach(device_t dev) struct ifnet *ifp; struct rl_softc *sc; struct rl_type *t; + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *children; int error = 0, hwrev, i, pmc, rid; int unit; uint16_t rl_did = 0; + char tn[32]; sc = device_get_softc(dev); unit = device_get_unit(dev); sc->rl_dev = dev; + sc->rl_twister_enable = 0; + snprintf(tn, sizeof(tn), "dev.rl.%d.twister_enable", unit); + TUNABLE_INT_FETCH(tn, &sc->rl_twister_enable); + ctx = device_get_sysctl_ctx(sc->rl_dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->rl_dev)); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "twister_enable", CTLFLAG_RD, + &sc->rl_twister_enable, 0, ""); + mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); callout_init_mtx(&sc->rl_stat_callout, &sc->rl_mtx, 0); @@ -1342,7 +1354,7 @@ rl_rxeof(struct rl_softc *sc) RL_LOCK(sc); } - /* No need to sync Rx memory block as we didn't mofify it. */ + /* No need to sync Rx memory block as we didn't modify it. */ } /* @@ -1408,20 +1420,142 @@ rl_txeof(struct rl_softc *sc) } static void +rl_twister_update(struct rl_softc *sc) +{ + uint16_t linktest; + /* + * Table provided by RealTek (Kinston ) for + * Linux driver. Values undocumented otherwise. + */ + static const uint32_t param[4][4] = { + {0xcb39de43, 0xcb39ce43, 0xfb38de03, 0xcb38de43}, + {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83}, + {0xcb39de43, 0xcb39ce43, 0xcb39ce83, 0xcb39ce83}, + {0xbb39de43, 0xbb39ce43, 0xbb39ce83, 0xbb39ce83} + }; + + /* + * Tune the so-called twister registers of the RTL8139. These + * are used to compensate for impedance mismatches. The + * method for tuning these registers is undocumented and the + * following procedure is collected from public sources. + */ + switch (sc->rl_twister) + { + case CHK_LINK: + /* + * If we have a sufficient link, then we can proceed in + * the state machine to the next stage. If not, then + * disable further tuning after writing sane defaults. + */ + if (CSR_READ_2(sc, RL_CSCFG) & RL_CSCFG_LINK_OK) { + CSR_WRITE_2(sc, RL_CSCFG, RL_CSCFG_LINK_DOWN_OFF_CMD); + sc->rl_twister = FIND_ROW; + } else { + CSR_WRITE_2(sc, RL_CSCFG, RL_CSCFG_LINK_DOWN_CMD); + CSR_WRITE_4(sc, RL_NWAYTST, RL_NWAYTST_CBL_TEST); + CSR_WRITE_4(sc, RL_PARA78, RL_PARA78_DEF); + CSR_WRITE_4(sc, RL_PARA7C, RL_PARA7C_DEF); + sc->rl_twister = DONE; + } + break; + case FIND_ROW: + /* + * Read how long it took to see the echo to find the tuning + * row to use. + */ + linktest = CSR_READ_2(sc, RL_CSCFG) & RL_CSCFG_STATUS; + if (linktest == RL_CSCFG_ROW3) + sc->rl_twist_row = 3; + else if (linktest == RL_CSCFG_ROW2) + sc->rl_twist_row = 2; + else if (linktest == RL_CSCFG_ROW1) + sc->rl_twist_row = 1; + else + sc->rl_twist_row = 0; + sc->rl_twist_col = 0; + sc->rl_twister = SET_PARAM; + break; + case SET_PARAM: + if (sc->rl_twist_col == 0) + CSR_WRITE_4(sc, RL_NWAYTST, RL_NWAYTST_RESET); + CSR_WRITE_4(sc, RL_PARA7C, + param[sc->rl_twist_row][sc->rl_twist_col]); + if (++sc->rl_twist_col == 4) { + if (sc->rl_twist_row == 3) + sc->rl_twister = RECHK_LONG; + else + sc->rl_twister = DONE; + } + break; + case RECHK_LONG: + /* + * For long cables, we have to double check to make sure we + * don't mistune. + */ + linktest = CSR_READ_2(sc, RL_CSCFG) & RL_CSCFG_STATUS; + if (linktest == RL_CSCFG_ROW3) + sc->rl_twister = DONE; + else { + CSR_WRITE_4(sc, RL_PARA7C, RL_PARA7C_RETUNE); + sc->rl_twister = RETUNE; + } + break; + case RETUNE: + /* Retune for a shorter cable (try column 2) */ + CSR_WRITE_4(sc, RL_NWAYTST, RL_NWAYTST_CBL_TEST); + CSR_WRITE_4(sc, RL_PARA78, RL_PARA78_DEF); + CSR_WRITE_4(sc, RL_PARA7C, RL_PARA7C_DEF); + CSR_WRITE_4(sc, RL_NWAYTST, RL_NWAYTST_RESET); + sc->rl_twist_row--; + sc->rl_twist_col = 0; + sc->rl_twister = SET_PARAM; + break; + + case DONE: + break; + } + +} + +static void rl_tick(void *xsc) { struct rl_softc *sc = xsc; struct mii_data *mii; + int ticks; RL_LOCK_ASSERT(sc); + /* + * If we're doing the twister cable calibration, then we need to defer + * watchdog timeouts. This is a no-op in normal operations, but + * can falsely trigger when the cable calibration takes a while and + * there was traffic ready to go when rl was started. + * + * We don't defer mii_tick since that updates the mii status, which + * helps the twister process, at least according to similar patches + * for the Linux driver I found online while doing the fixes. Worst + * case is a few extra mii reads during calibration. + */ mii = device_get_softc(sc->rl_miibus); mii_tick(mii); if ((sc->rl_flags & RL_FLAG_LINK) == 0) rl_miibus_statchg(sc->rl_dev); + if (sc->rl_twister_enable) { + if (sc->rl_twister == DONE) + rl_watchdog(sc); + else + rl_twister_update(sc); + if (sc->rl_twister == DONE) + ticks = hz; + else + ticks = hz / 10; + } else { + rl_watchdog(sc); + ticks = hz; + } - rl_watchdog(sc); - - callout_reset(&sc->rl_stat_callout, hz, rl_tick, sc); + callout_reset(&sc->rl_stat_callout, ticks, rl_tick, sc); } #ifdef DEVICE_POLLING @@ -1550,7 +1684,7 @@ rl_encap(struct rl_softc *sc, struct mbu if (padlen > 0) { /* - * Make security concious people happy: zero out the + * Make security-conscious people happy: zero out the * bytes in the pad area, since we don't know what * this mbuf cluster buffer's previous user might * have left in it. @@ -1669,6 +1803,15 @@ rl_init_locked(struct rl_softc *sc) rl_stop(sc); rl_reset(sc); + if (sc->rl_twister_enable) { + /* + * Reset twister register tuning state. The twister + * registers and their tuning are undocumented, but + * are necessary to cope with bad links. rl_twister = + * DONE here will disable this entirely. + */ + sc->rl_twister = CHK_LINK; + } /* * Init our MAC address. Even though the chipset Modified: stable/7/sys/pci/if_rlreg.h ============================================================================== --- stable/7/sys/pci/if_rlreg.h Mon Aug 30 21:58:52 2010 (r212029) +++ stable/7/sys/pci/if_rlreg.h Mon Aug 30 22:17:06 2010 (r212030) @@ -319,6 +319,27 @@ #define RL_CMD_STOPREQ 0x0080 /* + * Twister register values. These are completely undocumented and derived + * from public sources. + */ +#define RL_CSCFG_LINK_OK 0x0400 +#define RL_CSCFG_CHANGE 0x0800 +#define RL_CSCFG_STATUS 0xf000 +#define RL_CSCFG_ROW3 0x7000 +#define RL_CSCFG_ROW2 0x3000 +#define RL_CSCFG_ROW1 0x1000 +#define RL_CSCFG_LINK_DOWN_OFF_CMD 0x03c0 +#define RL_CSCFG_LINK_DOWN_CMD 0xf3c0 + +#define RL_NWAYTST_RESET 0 +#define RL_NWAYTST_CBL_TEST 0x20 + +#define RL_PARA78 0x78 +#define RL_PARA78_DEF 0x78fa8388 +#define RL_PARA7C 0x7C +#define RL_PARA7C_DEF 0xcb38de43 +#define RL_PARA7C_RETUNE 0xfb38de03 +/* * EEPROM control register */ #define RL_EE_DATAOUT 0x01 /* Data out */ @@ -819,6 +840,8 @@ struct rl_list_data { bus_addr_t rl_tx_list_addr; }; +enum rl_twist { DONE, CHK_LINK, FIND_ROW, SET_PARAM, RECHK_LONG, RETUNE }; + struct rl_softc { struct ifnet *rl_ifp; /* interface info */ bus_space_handle_t rl_bhandle; /* bus space handle */ @@ -847,6 +870,10 @@ struct rl_softc { uint32_t rl_rxlenmask; int rl_testmode; int rl_if_flags; + int rl_twister_enable; + enum rl_twist rl_twister; + int rl_twist_row; + int rl_twist_col; int suspended; /* 0 = normal 1 = suspended */ #ifdef DEVICE_POLLING int rxcycles; From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 22:19:41 2010 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 DE1671065697; Mon, 30 Aug 2010 22:19:41 +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 CD39D8FC20; Mon, 30 Aug 2010 22:19:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UMJfLl009480; Mon, 30 Aug 2010 22:19:41 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UMJf2k009478; Mon, 30 Aug 2010 22:19:41 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008302219.o7UMJf2k009478@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 30 Aug 2010 22:19:41 +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: r212031 - stable/7/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: Mon, 30 Aug 2010 22:19:42 -0000 Author: yongari Date: Mon Aug 30 22:19:41 2010 New Revision: 212031 URL: http://svn.freebsd.org/changeset/base/212031 Log: MFC r184560: Document dev.rl.%unit.twister_enable sysctl/tunable. Modified: stable/7/share/man/man4/rl.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/rl.4 ============================================================================== --- stable/7/share/man/man4/rl.4 Mon Aug 30 22:17:06 2010 (r212030) +++ stable/7/share/man/man4/rl.4 Mon Aug 30 22:19:41 2010 (r212031) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 28, 2007 +.Dd November 1, 2008 .Dt RL 4 .Os .Sh NAME @@ -201,6 +201,12 @@ SMC EZ Card 10/100 PCI 1211-TX .It SOHO (PRAGMATIC) UE-1211C .El +.Sh LOADER TUNABLES +.Bl -tag -width indent +.It Va dev.rl.%unit.twister_enable +Non-zero value enables the long cable tuning on the specified device. +Disabled by default. +.El .Sh DIAGNOSTICS .Bl -diag .It "rl%d: couldn't map memory" From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 22:24:26 2010 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 7588B10656A9; Mon, 30 Aug 2010 22:24:26 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6550D8FC1A; Mon, 30 Aug 2010 22:24:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UMOQfY009612; Mon, 30 Aug 2010 22:24:26 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UMOQCi009610; Mon, 30 Aug 2010 22:24:26 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201008302224.o7UMOQCi009610@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 30 Aug 2010 22:24: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: r212032 - head/usr.bin/ncal X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 22:24:26 -0000 Author: edwin Date: Mon Aug 30 22:24:26 2010 New Revision: 212032 URL: http://svn.freebsd.org/changeset/base/212032 Log: Use basename(3) to determine the name of the program. Submitted by: Alexander Best Modified: head/usr.bin/ncal/ncal.c Modified: head/usr.bin/ncal/ncal.c ============================================================================== --- head/usr.bin/ncal/ncal.c Mon Aug 30 22:19:41 2010 (r212031) +++ head/usr.bin/ncal/ncal.c Mon Aug 30 22:24:26 2010 (r212032) @@ -33,6 +33,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -245,9 +246,7 @@ main(int argc, char *argv[]) * Get the filename portion of argv[0] and set flag_backward if * this program is called "cal". */ - cp = strrchr(argv[0], '/'); - cp = (cp == NULL) ? argv[0] : cp + 1; - if (strcmp("cal", cp) == 0) + if (strncmp(basename(argv[0]), "cal", strlen("cal")) == 0) flag_backward = 1; /* Set the switch date to United Kingdom if backwards compatible */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 22:26:42 2010 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 B5C401065679; Mon, 30 Aug 2010 22:26: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 A490D8FC1C; Mon, 30 Aug 2010 22:26:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UMQgxs009692; Mon, 30 Aug 2010 22:26:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UMQgv2009687; Mon, 30 Aug 2010 22:26:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008302226.o7UMQgv2009687@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 30 Aug 2010 22:26: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: r212033 - 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, 30 Aug 2010 22:26:42 -0000 Author: pjd Date: Mon Aug 30 22:26:42 2010 New Revision: 212033 URL: http://svn.freebsd.org/changeset/base/212033 Log: Constify arguments we can constify. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/hast_proto.c head/sbin/hastd/hast_proto.h head/sbin/hastd/proto.c head/sbin/hastd/proto.h Modified: head/sbin/hastd/hast_proto.c ============================================================================== --- head/sbin/hastd/hast_proto.c Mon Aug 30 22:24:26 2010 (r212032) +++ head/sbin/hastd/hast_proto.c Mon Aug 30 22:26:42 2010 (r212033) @@ -56,8 +56,10 @@ struct hast_main_header { uint32_t size; } __packed; -typedef int hps_send_t(struct hast_resource *, struct nv *nv, void **, size_t *, bool *); -typedef int hps_recv_t(struct hast_resource *, struct nv *nv, void **, size_t *, bool *); +typedef int hps_send_t(const struct hast_resource *, struct nv *nv, void **, + size_t *, bool *); +typedef int hps_recv_t(const struct hast_resource *, struct nv *nv, void **, + size_t *, bool *); struct hast_pipe_stage { const char *hps_name; @@ -65,14 +67,14 @@ struct hast_pipe_stage { hps_recv_t *hps_recv; }; -static int compression_send(struct hast_resource *res, struct nv *nv, +static int compression_send(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap); -static int compression_recv(struct hast_resource *res, struct nv *nv, +static int compression_recv(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap); #ifdef HAVE_CRYPTO -static int checksum_send(struct hast_resource *res, struct nv *nv, +static int checksum_send(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap); -static int checksum_recv(struct hast_resource *res, struct nv *nv, +static int checksum_recv(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap); #endif @@ -84,7 +86,7 @@ static struct hast_pipe_stage pipeline[] }; static int -compression_send(struct hast_resource *res, struct nv *nv, void **datap, +compression_send(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap) { unsigned char *newbuf; @@ -132,7 +134,7 @@ compression_send(struct hast_resource *r } static int -compression_recv(struct hast_resource *res, struct nv *nv, void **datap, +compression_recv(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap) { unsigned char *newbuf; @@ -169,7 +171,7 @@ compression_recv(struct hast_resource *r #ifdef HAVE_CRYPTO static int -checksum_send(struct hast_resource *res, struct nv *nv, void **datap, +checksum_send(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap __unused) { unsigned char hash[SHA256_DIGEST_LENGTH]; @@ -188,7 +190,7 @@ checksum_send(struct hast_resource *res, } static int -checksum_recv(struct hast_resource *res, struct nv *nv, void **datap, +checksum_recv(const struct hast_resource *res, struct nv *nv, void **datap, size_t *sizep, bool *freedatap __unused) { unsigned char chash[SHA256_DIGEST_LENGTH]; @@ -236,7 +238,7 @@ checksum_recv(struct hast_resource *res, * There can be no data at all (data is NULL then). */ int -hast_proto_send(struct hast_resource *res, struct proto_conn *conn, +hast_proto_send(const struct hast_resource *res, struct proto_conn *conn, struct nv *nv, const void *data, size_t size) { struct hast_main_header hdr; @@ -293,7 +295,7 @@ end: } int -hast_proto_recv_hdr(struct proto_conn *conn, struct nv **nvp) +hast_proto_recv_hdr(const struct proto_conn *conn, struct nv **nvp) { struct hast_main_header hdr; struct nv *nv; @@ -335,7 +337,7 @@ fail: } int -hast_proto_recv_data(struct hast_resource *res, struct proto_conn *conn, +hast_proto_recv_data(const struct hast_resource *res, struct proto_conn *conn, struct nv *nv, void *data, size_t size) { unsigned int ii; @@ -384,7 +386,7 @@ if (ret < 0) printf("%s:%u %s\n", __func } int -hast_proto_recv(struct hast_resource *res, struct proto_conn *conn, +hast_proto_recv(const struct hast_resource *res, struct proto_conn *conn, struct nv **nvp, void *data, size_t size) { struct nv *nv; Modified: head/sbin/hastd/hast_proto.h ============================================================================== --- head/sbin/hastd/hast_proto.h Mon Aug 30 22:24:26 2010 (r212032) +++ head/sbin/hastd/hast_proto.h Mon Aug 30 22:26:42 2010 (r212033) @@ -37,12 +37,12 @@ #include #include -int hast_proto_send(struct hast_resource *res, struct proto_conn *conn, +int hast_proto_send(const struct hast_resource *res, struct proto_conn *conn, struct nv *nv, const void *data, size_t size); -int hast_proto_recv(struct hast_resource *res, struct proto_conn *conn, +int hast_proto_recv(const struct hast_resource *res, struct proto_conn *conn, struct nv **nvp, void *data, size_t size); -int hast_proto_recv_hdr(struct proto_conn *conn, struct nv **nvp); -int hast_proto_recv_data(struct hast_resource *res, struct proto_conn *conn, - struct nv *nv, void *data, size_t size); +int hast_proto_recv_hdr(const struct proto_conn *conn, struct nv **nvp); +int hast_proto_recv_data(const struct hast_resource *res, + struct proto_conn *conn, struct nv *nv, void *data, size_t size); #endif /* !_HAST_PROTO_H_ */ Modified: head/sbin/hastd/proto.c ============================================================================== --- head/sbin/hastd/proto.c Mon Aug 30 22:24:26 2010 (r212032) +++ head/sbin/hastd/proto.c Mon Aug 30 22:26:42 2010 (r212033) @@ -179,7 +179,7 @@ proto_accept(struct proto_conn *conn, st } int -proto_send(struct proto_conn *conn, const void *data, size_t size) +proto_send(const struct proto_conn *conn, const void *data, size_t size) { int ret; @@ -196,7 +196,7 @@ proto_send(struct proto_conn *conn, cons } int -proto_recv(struct proto_conn *conn, void *data, size_t size) +proto_recv(const struct proto_conn *conn, void *data, size_t size) { int ret; Modified: head/sbin/hastd/proto.h ============================================================================== --- head/sbin/hastd/proto.h Mon Aug 30 22:24:26 2010 (r212032) +++ head/sbin/hastd/proto.h Mon Aug 30 22:26:42 2010 (r212033) @@ -41,8 +41,8 @@ int proto_client(const char *addr, struc int proto_connect(struct proto_conn *conn); int proto_server(const char *addr, struct proto_conn **connp); int proto_accept(struct proto_conn *conn, struct proto_conn **newconnp); -int proto_send(struct proto_conn *conn, const void *data, size_t size); -int proto_recv(struct proto_conn *conn, void *data, size_t size); +int proto_send(const struct proto_conn *conn, const void *data, size_t size); +int proto_recv(const struct proto_conn *conn, void *data, size_t size); int proto_descriptor(const struct proto_conn *conn); bool proto_address_match(const struct proto_conn *conn, const char *addr); void proto_local_address(const struct proto_conn *conn, char *addr, From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 22:28:05 2010 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 0E5B11065672; Mon, 30 Aug 2010 22:28:05 +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 F26E08FC0A; Mon, 30 Aug 2010 22:28:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UMS40W009804; Mon, 30 Aug 2010 22:28:04 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UMS4tb009802; Mon, 30 Aug 2010 22:28:04 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008302228.o7UMS4tb009802@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 30 Aug 2010 22:28: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: r212034 - 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, 30 Aug 2010 22:28:05 -0000 Author: pjd Date: Mon Aug 30 22:28:04 2010 New Revision: 212034 URL: http://svn.freebsd.org/changeset/base/212034 Log: Use pjdlog_exit() before fork(). MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Mon Aug 30 22:26:42 2010 (r212033) +++ head/sbin/hastd/primary.c Mon Aug 30 22:28:04 2010 (r212034) @@ -771,14 +771,14 @@ hastd_primary(struct hast_resource *res) */ if (proto_client("socketpair://", &res->hr_ctrl) < 0) { KEEP_ERRNO((void)pidfile_remove(pfh)); - primary_exit(EX_OSERR, + pjdlog_exit(EX_OSERR, "Unable to create control sockets between parent and child"); } pid = fork(); if (pid < 0) { KEEP_ERRNO((void)pidfile_remove(pfh)); - primary_exit(EX_TEMPFAIL, "Unable to fork"); + pjdlog_exit(EX_TEMPFAIL, "Unable to fork"); } if (pid > 0) { From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 22:45:32 2010 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 8BE5C10656E3; Mon, 30 Aug 2010 22:45:32 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AB5D8FC16; Mon, 30 Aug 2010 22:45:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UMjWNJ010286; Mon, 30 Aug 2010 22:45:32 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UMjWGI010281; Mon, 30 Aug 2010 22:45:32 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201008302245.o7UMjWGI010281@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 30 Aug 2010 22:45: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: r212035 - in head/usr.bin/calendar: . calendars X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 30 Aug 2010 22:45:32 -0000 Author: edwin Date: Mon Aug 30 22:45:32 2010 New Revision: 212035 URL: http://svn.freebsd.org/changeset/base/212035 Log: For calendars which don't match the solar-based Gregorian calendar, be able to specify a year string in an entry. Modified: head/usr.bin/calendar/calendar.1 head/usr.bin/calendar/calendar.h head/usr.bin/calendar/calendars/calendar.judaic head/usr.bin/calendar/parsedata.c Directory Properties: head/usr.bin/calendar/ (props changed) Modified: head/usr.bin/calendar/calendar.1 ============================================================================== --- head/usr.bin/calendar/calendar.1 Mon Aug 30 22:28:04 2010 (r212034) +++ head/usr.bin/calendar/calendar.1 Mon Aug 30 22:45:32 2010 (r212035) @@ -103,6 +103,7 @@ Print lines from today and the next days (forward, future). Ignore weekends when calculating the number of days. .El +.Sh FILE FORMAT .Pp To handle calendars in your national code table you can specify .Dq LANG= @@ -196,6 +197,7 @@ Jun. 15\fB\et\fRJune 15. Thursday\fB\et\fREvery Thursday. June\fB\et\fREvery June 1st. 15 *\fB\et\fR15th of every month. +2010/4/15\fB\et\fR15 April 2010 May Sun+2\fB\et\fRsecond Sunday in May (Muttertag) 04/SunLast\fB\et\fRlast Sunday in April, Modified: head/usr.bin/calendar/calendar.h ============================================================================== --- head/usr.bin/calendar/calendar.h Mon Aug 30 22:28:04 2010 (r212034) +++ head/usr.bin/calendar/calendar.h Mon Aug 30 22:45:32 2010 (r212035) @@ -80,6 +80,7 @@ extern int EastLongitude; #define F_SEPEQUINOX 0x08000 #define F_JUNSOLSTICE 0x10000 #define F_DECSOLSTICE 0x20000 +#define F_YEAR 0x40000 #define STRING_EASTER "Easter" #define STRING_PASKHA "Paskha" Modified: head/usr.bin/calendar/calendars/calendar.judaic ============================================================================== --- head/usr.bin/calendar/calendars/calendar.judaic Mon Aug 30 22:28:04 2010 (r212034) +++ head/usr.bin/calendar/calendars/calendar.judaic Mon Aug 30 22:45:32 2010 (r212035) @@ -13,10 +13,477 @@ #define _calendar_judaic_ /* - * Jewish calendar for the CE year 2007 - * 11 Tevet 5767 - 22 tevet 5768 + * The calendar below has gotten from the port deskutils/hebcal for + * the year of 2010 and for the city of New York. + * This should be updated every year! */ +2010/Jan/16* Rosh Chodesh Sh'vat +2010/Jan/30* Tu B'Shvat +2010/Feb/13* Shabbat Shekalim +2010/Feb/14* Rosh Chodesh Adar +2010/Feb/15* Rosh Chodesh Adar +2010/Feb/25* Ta'anit Esther +2010/Feb/27* Shabbat Zachor +2010/Feb/28* Purim +2010/Mar/1* Shushan Purim +2010/Mar/6* Shabbat Parah +2010/Mar/13* Shabbat HaChodesh +2010/Mar/16* Rosh Chodesh Nisan +2010/Mar/27* Shabbat HaGadol +2010/Mar/29* Ta'anit Bechorot +2010/Mar/29* Erev Pesach +2010/Mar/30* Pesach I +2010/Mar/31* Pesach II +2010/Apr/1* Pesach III (CH''M) +2010/Apr/2* Pesach IV (CH''M) +2010/Apr/3* Pesach V (CH''M) +2010/Apr/4* Pesach VI (CH''M) +2010/Apr/5* Pesach VII +2010/Apr/6* Pesach VIII +2010/Apr/11* Yom HaShoah +2010/Apr/14* Rosh Chodesh Iyyar +2010/Apr/15* Rosh Chodesh Iyyar +2010/Apr/19* Yom HaZikaron +2010/Apr/20* Yom HaAtzma'ut +2010/May/2* Lag B'Omer +2010/May/Dec* Yom Yerushalayim +2010/May/14* Rosh Chodesh Sivan +2010/May/18* Erev Shavuot +2010/May/19* Shavuot I +2010/May/20* Shavuot II +2010/Jun/Dec* Rosh Chodesh Tamuz +2010/Jun/13* Rosh Chodesh Tamuz +2010/Jun/29* Tzom Tammuz +2010/Jul/Dec* Rosh Chodesh Av +2010/Jul/17* Shabbat Hazon +2010/Jul/20* Tish'a B'Av +2010/Jul/24* Shabbat Nachamu +2010/Aug/Oct* Rosh Chodesh Elul +2010/Aug/11* Rosh Chodesh Elul +2010/Sep/8* Erev Rosh Hashana +2010/Sep/9* Rosh Hashana 5771 +2010/Sep/Oct* Rosh Hashana II +2010/Sep/11* Shabbat Shuva +2010/Sep/Dec* Tzom Gedaliah +2010/Sep/17* Erev Yom Kippur +2010/Sep/18* Yom Kippur +2010/Sep/22* Erev Sukkot +2010/Sep/23* Sukkot I +2010/Sep/24* Sukkot II +2010/Sep/25* Sukkot III (CH''M) +2010/Sep/26* Sukkot IV (CH''M) +2010/Sep/27* Sukkot V (CH''M) +2010/Sep/28* Sukkot VI (CH''M) +2010/Sep/29* Sukkot VII (Hoshana Raba) +2010/Sep/30* Shmini Atzeret +2010/Oct/1* Simchat Torah +2010/Oct/8* Rosh Chodesh Cheshvan +2010/Oct/9* Rosh Chodesh Cheshvan +2010/Nov/7* Rosh Chodesh Kislev +2010/Nov/8* Rosh Chodesh Kislev +2010/Dec/1* Chanukah: 1 Candle +2010/Dec/2* Chanukah: 2 Candles +2010/Dec/3* Chanukah: 3 Candles +2010/Dec/4* Chanukah: 4 Candles +2010/Dec/5* Chanukah: 5 Candles +2010/Dec/6* Chanukah: 6 Candles +2010/Dec/7* Rosh Chodesh Tevet +2010/Dec/7* Chanukah: 7 Candles +2010/Dec/8* Rosh Chodesh Tevet +2010/Dec/8* Chanukah: 8 Candles +2010/Dec/9* Chanukah: 8th Day +2010/Dec/16* Asara B'Tevet +2011/1/6* Rosh Chodesh Sh'vat +2011/1/20* Tu B'Shvat +2011/2/4* Rosh Chodesh Adar I +2011/2/5* Rosh Chodesh Adar I +2011/2/18* Purim Katan +2011/3/5* Shabbat Shekalim +2011/3/6* Rosh Chodesh Adar II +2011/3/7* Rosh Chodesh Adar II +2011/3/17* Ta'anit Esther +2011/3/19* Shabbat Zachor +2011/3/20* Purim +2011/3/21* Shushan Purim +2011/3/26* Shabbat Parah +2011/4/2* Shabbat HaChodesh +2011/4/5* Rosh Chodesh Nisan +2011/4/16* Shabbat HaGadol +2011/4/18* Ta'anit Bechorot +2011/4/18* Erev Pesach +2011/4/19* Pesach I +2011/4/20* Pesach II +2011/4/21* Pesach III (CH''M) +2011/4/22* Pesach IV (CH''M) +2011/4/23* Pesach V (CH''M) +2011/4/24* Pesach VI (CH''M) +2011/4/25* Pesach VII +2011/4/26* Pesach VIII +2011/5/1* Yom HaShoah +2011/5/4* Rosh Chodesh Iyyar +2011/5/5* Rosh Chodesh Iyyar +2011/5/9* Yom HaZikaron +2011/5/10* Yom HaAtzma'ut +2011/5/22* Lag B'Omer +2011/6/1* Yom Yerushalayim +2011/6/3* Rosh Chodesh Sivan +2011/6/7* Erev Shavuot +2011/6/8* Shavuot I +2011/6/9* Shavuot II +2011/7/2* Rosh Chodesh Tamuz +2011/7/3* Rosh Chodesh Tamuz +2011/7/19* Tzom Tammuz +2011/8/1* Rosh Chodesh Av +2011/8/6* Shabbat Hazon +2011/8/9* Tish'a B'Av +2011/8/13* Shabbat Nachamu +2011/8/30* Rosh Chodesh Elul +2011/8/31* Rosh Chodesh Elul +2011/9/28* Erev Rosh Hashana +2011/9/29* Rosh Hashana 5772 +2011/9/30* Rosh Hashana II +2011/10/1* Shabbat Shuva +2011/10/2* Tzom Gedaliah +2011/10/7* Erev Yom Kippur +2011/10/8* Yom Kippur +2011/10/12* Erev Sukkot +2011/10/13* Sukkot I +2011/10/14* Sukkot II +2011/10/15* Sukkot III (CH''M) +2011/10/16* Sukkot IV (CH''M) +2011/10/17* Sukkot V (CH''M) +2011/10/18* Sukkot VI (CH''M) +2011/10/19* Sukkot VII (Hoshana Raba) +2011/10/20* Shmini Atzeret +2011/10/21* Simchat Torah +2011/10/28* Rosh Chodesh Cheshvan +2011/10/29* Rosh Chodesh Cheshvan +2011/11/27* Rosh Chodesh Kislev +2011/12/20* Chanukah: 1 Candle +2011/12/21* Chanukah: 2 Candles +2011/12/22* Chanukah: 3 Candles +2011/12/23* Chanukah: 4 Candles +2011/12/24* Chanukah: 5 Candles +2011/12/25* Chanukah: 6 Candles +2011/12/26* Rosh Chodesh Tevet +2011/12/26* Chanukah: 7 Candles +2011/12/27* Rosh Chodesh Tevet +2011/12/27* Chanukah: 8 Candles +2011/12/28* Chanukah: 8th Day +2012/1/5* Asara B'Tevet +2012/1/25* Rosh Chodesh Sh'vat +2012/2/8* Tu B'Shvat +2012/2/18* Shabbat Shekalim +2012/2/23* Rosh Chodesh Adar +2012/2/24* Rosh Chodesh Adar +2012/3/3* Shabbat Zachor +2012/3/7* Ta'anit Esther +2012/3/8* Purim +2012/3/9* Shushan Purim +2012/3/17* Shabbat Parah +2012/3/24* Rosh Chodesh Nisan +2012/3/24* Shabbat HaChodesh +2012/3/31* Shabbat HaGadol +2012/4/5* Ta'anit Bechorot +2012/4/6* Erev Pesach +2012/4/7* Pesach I +2012/4/8* Pesach II +2012/4/9* Pesach III (CH''M) +2012/4/10* Pesach IV (CH''M) +2012/4/11* Pesach V (CH''M) +2012/4/12* Pesach VI (CH''M) +2012/4/13* Pesach VII +2012/4/14* Pesach VIII +2012/4/19* Yom HaShoah +2012/4/22* Rosh Chodesh Iyyar +2012/4/23* Rosh Chodesh Iyyar +2012/4/25* Yom HaZikaron +2012/4/26* Yom HaAtzma'ut +2012/5/10* Lag B'Omer +2012/5/20* Yom Yerushalayim +2012/5/22* Rosh Chodesh Sivan +2012/5/26* Erev Shavuot +2012/5/27* Shavuot I +2012/5/28* Shavuot II +2012/6/20* Rosh Chodesh Tamuz +2012/6/21* Rosh Chodesh Tamuz +2012/7/8* Tzom Tammuz +2012/7/20* Rosh Chodesh Av +2012/7/28* Shabbat Hazon +2012/7/29* Tish'a B'Av +2012/8/4* Shabbat Nachamu +2012/8/18* Rosh Chodesh Elul +2012/8/19* Rosh Chodesh Elul +2012/9/16* Erev Rosh Hashana +2012/9/17* Rosh Hashana 5773 +2012/9/18* Rosh Hashana II +2012/9/19* Tzom Gedaliah +2012/9/22* Shabbat Shuva +2012/9/25* Erev Yom Kippur +2012/9/26* Yom Kippur +2012/9/30* Erev Sukkot +2012/10/1* Sukkot I +2012/10/2* Sukkot II +2012/10/3* Sukkot III (CH''M) +2012/10/4* Sukkot IV (CH''M) +2012/10/5* Sukkot V (CH''M) +2012/10/6* Sukkot VI (CH''M) +2012/10/7* Sukkot VII (Hoshana Raba) +2012/10/8* Shmini Atzeret +2012/10/9* Simchat Torah +2012/10/16* Rosh Chodesh Cheshvan +2012/10/17* Rosh Chodesh Cheshvan +2012/11/15* Rosh Chodesh Kislev +2012/12/8* Chanukah: 1 Candle +2012/12/9* Chanukah: 2 Candles +2012/12/10* Chanukah: 3 Candles +2012/12/11* Chanukah: 4 Candles +2012/12/12* Chanukah: 5 Candles +2012/12/13* Chanukah: 6 Candles +2012/12/14* Rosh Chodesh Tevet +2012/12/14* Chanukah: 7 Candles +2012/12/15* Chanukah: 8 Candles +2012/12/16* Chanukah: 8th Day +2012/12/23* Asara B'Tevet +2013/1/12* Rosh Chodesh Sh'vat +2013/1/26* Tu B'Shvat +2013/2/9* Shabbat Shekalim +2013/2/10* Rosh Chodesh Adar +2013/2/11* Rosh Chodesh Adar +2013/2/21* Ta'anit Esther +2013/2/23* Shabbat Zachor +2013/2/24* Purim +2013/2/25* Shushan Purim +2013/3/2* Shabbat Parah +2013/3/9* Shabbat HaChodesh +2013/3/12* Rosh Chodesh Nisan +2013/3/23* Shabbat HaGadol +2013/3/25* Ta'anit Bechorot +2013/3/25* Erev Pesach +2013/3/26* Pesach I +2013/3/27* Pesach II +2013/3/28* Pesach III (CH''M) +2013/3/29* Pesach IV (CH''M) +2013/3/30* Pesach V (CH''M) +2013/3/31* Pesach VI (CH''M) +2013/4/1* Pesach VII +2013/4/2* Pesach VIII +2013/4/7* Yom HaShoah +2013/4/10* Rosh Chodesh Iyyar +2013/4/11* Rosh Chodesh Iyyar +2013/4/15* Yom HaZikaron +2013/4/16* Yom HaAtzma'ut +2013/4/28* Lag B'Omer +2013/5/8* Yom Yerushalayim +2013/5/10* Rosh Chodesh Sivan +2013/5/14* Erev Shavuot +2013/5/15* Shavuot I +2013/5/16* Shavuot II +2013/6/8* Rosh Chodesh Tamuz +2013/6/9* Rosh Chodesh Tamuz +2013/6/25* Tzom Tammuz +2013/7/8* Rosh Chodesh Av +2013/7/13* Shabbat Hazon +2013/7/16* Tish'a B'Av +2013/7/20* Shabbat Nachamu +2013/8/6* Rosh Chodesh Elul +2013/8/7* Rosh Chodesh Elul +2013/9/4* Erev Rosh Hashana +2013/9/5* Rosh Hashana 5774 +2013/9/6* Rosh Hashana II +2013/9/7* Shabbat Shuva +2013/9/8* Tzom Gedaliah +2013/9/13* Erev Yom Kippur +2013/9/14* Yom Kippur +2013/9/18* Erev Sukkot +2013/9/19* Sukkot I +2013/9/20* Sukkot II +2013/9/21* Sukkot III (CH''M) +2013/9/22* Sukkot IV (CH''M) +2013/9/23* Sukkot V (CH''M) +2013/9/24* Sukkot VI (CH''M) +2013/9/25* Sukkot VII (Hoshana Raba) +2013/9/26* Shmini Atzeret +2013/9/27* Simchat Torah +2013/10/4* Rosh Chodesh Cheshvan +2013/10/5* Rosh Chodesh Cheshvan +2013/11/3* Rosh Chodesh Kislev +2013/11/4* Rosh Chodesh Kislev +2013/11/27* Chanukah: 1 Candle +2013/11/28* Chanukah: 2 Candles +2013/11/29* Chanukah: 3 Candles +2013/11/30* Chanukah: 4 Candles +2013/12/1* Chanukah: 5 Candles +2013/12/2* Chanukah: 6 Candles +2013/12/3* Rosh Chodesh Tevet +2013/12/3* Chanukah: 7 Candles +2013/12/4* Rosh Chodesh Tevet +2013/12/4* Chanukah: 8 Candles +2013/12/5* Chanukah: 8th Day +2013/12/12* Asara B'Tevet +2014/1/2* Rosh Chodesh Sh'vat +2014/1/16* Tu B'Shvat +2014/1/31* Rosh Chodesh Adar I +2014/2/1* Rosh Chodesh Adar I +2014/2/14* Purim Katan +2014/3/1* Shabbat Shekalim +2014/3/2* Rosh Chodesh Adar II +2014/3/3* Rosh Chodesh Adar II +2014/3/13* Ta'anit Esther +2014/3/15* Shabbat Zachor +2014/3/16* Purim +2014/3/17* Shushan Purim +2014/3/22* Shabbat Parah +2014/3/29* Shabbat HaChodesh +2014/4/1* Rosh Chodesh Nisan +2014/4/12* Shabbat HaGadol +2014/4/14* Ta'anit Bechorot +2014/4/14* Erev Pesach +2014/4/15* Pesach I +2014/4/16* Pesach II +2014/4/17* Pesach III (CH''M) +2014/4/18* Pesach IV (CH''M) +2014/4/19* Pesach V (CH''M) +2014/4/20* Pesach VI (CH''M) +2014/4/21* Pesach VII +2014/4/22* Pesach VIII +2014/4/27* Yom HaShoah +2014/4/30* Rosh Chodesh Iyyar +2014/5/1* Rosh Chodesh Iyyar +2014/5/5* Yom HaZikaron +2014/5/6* Yom HaAtzma'ut +2014/5/18* Lag B'Omer +2014/5/28* Yom Yerushalayim +2014/5/30* Rosh Chodesh Sivan +2014/6/3* Erev Shavuot +2014/6/4* Shavuot I +2014/6/5* Shavuot II +2014/6/28* Rosh Chodesh Tamuz +2014/6/29* Rosh Chodesh Tamuz +2014/7/15* Tzom Tammuz +2014/7/28* Rosh Chodesh Av +2014/8/2* Shabbat Hazon +2014/8/5* Tish'a B'Av +2014/8/9* Shabbat Nachamu +2014/8/26* Rosh Chodesh Elul +2014/8/27* Rosh Chodesh Elul +2014/9/24* Erev Rosh Hashana +2014/9/25* Rosh Hashana 5775 +2014/9/26* Rosh Hashana II +2014/9/27* Shabbat Shuva +2014/9/28* Tzom Gedaliah +2014/10/3* Erev Yom Kippur +2014/10/4* Yom Kippur +2014/10/8* Erev Sukkot +2014/10/9* Sukkot I +2014/10/10* Sukkot II +2014/10/11* Sukkot III (CH''M) +2014/10/12* Sukkot IV (CH''M) +2014/10/13* Sukkot V (CH''M) +2014/10/14* Sukkot VI (CH''M) +2014/10/15* Sukkot VII (Hoshana Raba) +2014/10/16* Shmini Atzeret +2014/10/17* Simchat Torah +2014/10/24* Rosh Chodesh Cheshvan +2014/10/25* Rosh Chodesh Cheshvan +2014/11/23* Rosh Chodesh Kislev +2014/12/16* Chanukah: 1 Candle +2014/12/17* Chanukah: 2 Candles +2014/12/18* Chanukah: 3 Candles +2014/12/19* Chanukah: 4 Candles +2014/12/20* Chanukah: 5 Candles +2014/12/21* Chanukah: 6 Candles +2014/12/22* Rosh Chodesh Tevet +2014/12/22* Chanukah: 7 Candles +2014/12/23* Rosh Chodesh Tevet +2014/12/23* Chanukah: 8 Candles +2014/12/24* Chanukah: 8th Day +2015/1/1* Asara B'Tevet +2015/1/21* Rosh Chodesh Sh'vat +2015/2/4* Tu B'Shvat +2015/2/14* Shabbat Shekalim +2015/2/19* Rosh Chodesh Adar +2015/2/20* Rosh Chodesh Adar +2015/2/28* Shabbat Zachor +2015/3/4* Ta'anit Esther +2015/3/5* Purim +2015/3/6* Shushan Purim +2015/3/14* Shabbat Parah +2015/3/21* Rosh Chodesh Nisan +2015/3/21* Shabbat HaChodesh +2015/3/28* Shabbat HaGadol +2015/4/2* Ta'anit Bechorot +2015/4/3* Erev Pesach +2015/4/4* Pesach I +2015/4/5* Pesach II +2015/4/6* Pesach III (CH''M) +2015/4/7* Pesach IV (CH''M) +2015/4/8* Pesach V (CH''M) +2015/4/9* Pesach VI (CH''M) +2015/4/10* Pesach VII +2015/4/11* Pesach VIII +2015/4/16* Yom HaShoah +2015/4/19* Rosh Chodesh Iyyar +2015/4/20* Rosh Chodesh Iyyar +2015/4/22* Yom HaZikaron +2015/4/23* Yom HaAtzma'ut +2015/5/7* Lag B'Omer +2015/5/17* Yom Yerushalayim +2015/5/19* Rosh Chodesh Sivan +2015/5/23* Erev Shavuot +2015/5/24* Shavuot I +2015/5/25* Shavuot II +2015/6/17* Rosh Chodesh Tamuz +2015/6/18* Rosh Chodesh Tamuz +2015/7/5* Tzom Tammuz +2015/7/17* Rosh Chodesh Av +2015/7/25* Shabbat Hazon +2015/7/26* Tish'a B'Av +2015/8/1* Shabbat Nachamu +2015/8/15* Rosh Chodesh Elul +2015/8/16* Rosh Chodesh Elul +2015/9/13* Erev Rosh Hashana +2015/9/14* Rosh Hashana 5776 +2015/9/15* Rosh Hashana II +2015/9/16* Tzom Gedaliah +2015/9/19* Shabbat Shuva +2015/9/22* Erev Yom Kippur +2015/9/23* Yom Kippur +2015/9/27* Erev Sukkot +2015/9/28* Sukkot I +2015/9/29* Sukkot II +2015/9/30* Sukkot III (CH''M) +2015/10/1* Sukkot IV (CH''M) +2015/10/2* Sukkot V (CH''M) +2015/10/3* Sukkot VI (CH''M) +2015/10/4* Sukkot VII (Hoshana Raba) +2015/10/5* Shmini Atzeret +2015/10/6* Simchat Torah +2015/10/13* Rosh Chodesh Cheshvan +2015/10/14* Rosh Chodesh Cheshvan +2015/11/12* Rosh Chodesh Kislev +2015/11/13* Rosh Chodesh Kislev +2015/12/6* Chanukah: 1 Candle +2015/12/7* Chanukah: 2 Candles +2015/12/8* Chanukah: 3 Candles +2015/12/9* Chanukah: 4 Candles +2015/12/10* Chanukah: 5 Candles +2015/12/11* Chanukah: 6 Candles +2015/12/12* Rosh Chodesh Tevet +2015/12/12* Chanukah: 7 Candles +2015/12/13* Rosh Chodesh Tevet +2015/12/13* Chanukah: 8 Candles +2015/12/14* Chanukah: 8th Day +2015/12/22* Asara B'Tevet + +/* + * The calendar data below was for 2007, so it is commented out. + */ + +/* + * Jewish calendar for the CE year 2007 + * 11 Tevet 5767 - 22 tevet 5768 01/06* Parshas Vayechi 01/13* Parshas Shemos @@ -223,5 +690,6 @@ 12/22* Parshas Vayechi 12/29* Parshas Shemos +*/ #endif /* !_calendar_judaic_ */ Modified: head/usr.bin/calendar/parsedata.c ============================================================================== --- head/usr.bin/calendar/parsedata.c Mon Aug 30 22:28:04 2010 (r212034) +++ head/usr.bin/calendar/parsedata.c Mon Aug 30 22:45:32 2010 (r212035) @@ -87,9 +87,9 @@ static int determinestyle(char *date, int *flags, char *month, int *imonth, char *dayofmonth, int *idayofmonth, char *dayofweek, int *idayofweek, char *modifieroffset, - char *modifierindex, char *specialday) + char *modifierindex, char *specialday, char *year, int *iyear) { - char *p, *p1, *p2; + char *p, *p1, *p2, *py; const char *dow, *pmonth; char pold; size_t len, offset; @@ -97,6 +97,8 @@ determinestyle(char *date, int *flags, *flags = F_NONE; *month = '\0'; *imonth = 0; + *year = '\0'; + *iyear = 0; *dayofmonth = '\0'; *idayofmonth = 0; *dayofweek = '\0'; @@ -191,6 +193,22 @@ determinestyle(char *date, int *flags, p2 = p + 1; /* Now p2 points to the next field and p1 to the first field */ + if ((py = strchr(p2, '/')) != NULL) { + /* We have a year in the string. Now this is getting tricky */ + strcpy(year, p1); + *iyear = (int)strtol(year, NULL, 10); + p1 = p2; + p2 = py + 1; + *py = 0; + *flags |= F_YEAR; + } + + /* + printf("p1: %s\n", p1); + printf("p2: %s\n", p2); + printf("year: %s\n", year); + */ + /* Check if there is a month-string in the date */ if ((checkmonth(p1, &len, &offset, &pmonth) != 0) || (checkmonth(p2, &len, &offset, &pmonth) != 0 && (p2 = p1))) { @@ -323,7 +341,8 @@ remember(int *rememberindex, int *y, int static void debug_determinestyle(int dateonly, char *date, int flags, char *month, int imonth, char *dayofmonth, int idayofmonth, char *dayofweek, - int idayofweek, char *modifieroffset, char *modifierindex, char *specialday) + int idayofweek, char *modifieroffset, char *modifierindex, char *specialday, + char *year, int iyear) { if (dateonly != 0) { @@ -336,6 +355,8 @@ debug_determinestyle(int dateonly, char printf("modifieroffset: |%s|\n", modifieroffset); if (modifierindex[0] != '\0') printf("modifierindex: |%s|\n", modifierindex); + if (year[0] != '\0') + printf("year: |%s| (%d)\n", year, iyear); if (month[0] != '\0') printf("month: |%s| (%d)\n", month, imonth); if (dayofmonth[0] != '\0') @@ -371,8 +392,10 @@ parsedaymonth(char *date, int *yearp, in char **edp) { char month[100], dayofmonth[100], dayofweek[100], modifieroffset[100]; + char syear[100]; char modifierindex[100], specialday[100]; - int idayofweek = -1, imonth = -1, idayofmonth = -1, year, remindex; + int idayofweek = -1, imonth = -1, idayofmonth = -1, iyear = -1; + int year, remindex; int d, m, dow, rm, rd, offset; char *ed; int retvalsign = 1; @@ -394,10 +417,10 @@ parsedaymonth(char *date, int *yearp, in if (debug) debug_determinestyle(1, date, *flags, month, imonth, dayofmonth, idayofmonth, dayofweek, idayofweek, - modifieroffset, modifierindex, specialday); + modifieroffset, modifierindex, specialday, syear, iyear); if (determinestyle(date, flags, month, &imonth, dayofmonth, &idayofmonth, dayofweek, &idayofweek, modifieroffset, - modifierindex, specialday) == 0) { + modifierindex, specialday, syear, &iyear) == 0) { if (debug) printf("Failed!\n"); return (0); @@ -406,10 +429,18 @@ parsedaymonth(char *date, int *yearp, in if (debug) debug_determinestyle(0, date, *flags, month, imonth, dayofmonth, idayofmonth, dayofweek, idayofweek, - modifieroffset, modifierindex, specialday); + modifieroffset, modifierindex, specialday, syear, iyear); remindex = 0; for (year = year1; year <= year2; year++) { + + int lflags = *flags; + /* If the year is specified, only do it if it is this year! */ + if ((lflags & F_YEAR) != 0) + if (iyear != year) + continue; + lflags &= ~F_YEAR; + /* Get important dates for this year */ yearinfo = years; while (yearinfo != NULL) { @@ -452,7 +483,7 @@ parsedaymonth(char *date, int *yearp, in } /* Same day every year */ - if (*flags == (F_MONTH | F_DAYOFMONTH)) { + if (lflags == (F_MONTH | F_DAYOFMONTH)) { if (!remember_ymd(year, imonth, idayofmonth)) continue; remember(&remindex, yearp, monthp, dayp, edp, @@ -461,7 +492,7 @@ parsedaymonth(char *date, int *yearp, in } /* XXX Same day every year, but variable */ - if (*flags == (F_MONTH | F_DAYOFMONTH | F_VARIABLE)) { + if (lflags == (F_MONTH | F_DAYOFMONTH | F_VARIABLE)) { if (!remember_ymd(year, imonth, idayofmonth)) continue; remember(&remindex, yearp, monthp, dayp, edp, @@ -470,7 +501,7 @@ parsedaymonth(char *date, int *yearp, in } /* Same day every month */ - if (*flags == (F_ALLMONTH | F_DAYOFMONTH)) { + if (lflags == (F_ALLMONTH | F_DAYOFMONTH)) { for (m = 1; m <= 12; m++) { if (!remember_ymd(year, m, idayofmonth)) continue; @@ -481,7 +512,7 @@ parsedaymonth(char *date, int *yearp, in } /* Every day of a month */ - if (*flags == (F_ALLDAY | F_MONTH)) { + if (lflags == (F_ALLDAY | F_MONTH)) { for (d = 1; d <= yearinfo->mondays[imonth]; d++) { if (!remember_ymd(year, imonth, d)) continue; @@ -492,7 +523,7 @@ parsedaymonth(char *date, int *yearp, in } /* One day of every month */ - if (*flags == (F_ALLMONTH | F_DAYOFWEEK)) { + if (lflags == (F_ALLMONTH | F_DAYOFWEEK)) { for (m = 1; m <= 12; m++) { if (!remember_ymd(year, m, idayofmonth)) continue; @@ -503,7 +534,7 @@ parsedaymonth(char *date, int *yearp, in } /* Every dayofweek of the year */ - if (*flags == (F_DAYOFWEEK | F_VARIABLE)) { + if (lflags == (F_DAYOFWEEK | F_VARIABLE)) { dow = first_dayofweek_of_year(year); d = (idayofweek - dow + 8) % 7; while (d <= 366) { @@ -517,7 +548,7 @@ parsedaymonth(char *date, int *yearp, in } /* A certain dayofweek of a month */ - if (*flags == + if (lflags == (F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) { offset = indextooffset(modifierindex); dow = first_dayofweek_of_month(year, imonth); @@ -553,7 +584,7 @@ parsedaymonth(char *date, int *yearp, in } /* Every dayofweek of the month */ - if (*flags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { + if (lflags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { dow = first_dayofweek_of_month(year, imonth); d = (idayofweek - dow + 8) % 7; while (d <= yearinfo->mondays[imonth]) { @@ -567,10 +598,10 @@ parsedaymonth(char *date, int *yearp, in } /* Easter */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_EASTER)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->ieaster + offset, &rm, &rd)) @@ -580,10 +611,10 @@ parsedaymonth(char *date, int *yearp, in } /* Paskha */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_PASKHA)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->ipaskha + offset, &rm, &rd)) @@ -593,10 +624,10 @@ parsedaymonth(char *date, int *yearp, in } /* Chinese New Year */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_CNY)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->firstcnyday + offset, &rm, &rd)) @@ -606,12 +637,12 @@ parsedaymonth(char *date, int *yearp, in } /* FullMoon */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_FULLMOON)) { int i; offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); for (i = 0; yearinfo->ffullmoon[i] > 0; i++) { if (remember_yd(year, @@ -628,12 +659,12 @@ parsedaymonth(char *date, int *yearp, in } /* NewMoon */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_NEWMOON)) { int i; offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); for (i = 0; yearinfo->ffullmoon[i] > 0; i++) { if (remember_yd(year, @@ -649,10 +680,10 @@ parsedaymonth(char *date, int *yearp, in } /* (Mar|Sep)Equinox */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_MAREQUINOX)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->equinoxdays[0] + offset, &rm, &rd)) { @@ -662,10 +693,10 @@ parsedaymonth(char *date, int *yearp, in } continue; } - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_SEPEQUINOX)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->equinoxdays[1] + offset, &rm, &rd)) { @@ -677,10 +708,10 @@ parsedaymonth(char *date, int *yearp, in } /* (Jun|Dec)Solstice */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_JUNSOLSTICE)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->solsticedays[0] + offset, &rm, &rd)) { @@ -690,10 +721,10 @@ parsedaymonth(char *date, int *yearp, in } continue; } - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_DECSOLSTICE)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->solsticedays[1] + offset, &rm, &rd)) { @@ -705,9 +736,9 @@ parsedaymonth(char *date, int *yearp, in } printf("Unprocessed:\n"); - debug_determinestyle(2, date, *flags, month, imonth, + debug_determinestyle(2, date, lflags, month, imonth, dayofmonth, idayofmonth, dayofweek, idayofweek, - modifieroffset, modifierindex, specialday); + modifieroffset, modifierindex, specialday, syear, iyear); retvalsign = -1; } @@ -723,6 +754,8 @@ showflags(int flags) static char s[1000]; s[0] = '\0'; + if ((flags & F_YEAR) != 0) + strcat(s, "year "); if ((flags & F_MONTH) != 0) strcat(s, "month "); if ((flags & F_DAYOFWEEK) != 0) From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 23:16:45 2010 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 C14DF10656A3; Mon, 30 Aug 2010 23:16:45 +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 B0FEB8FC1B; Mon, 30 Aug 2010 23:16:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UNGjL4011068; Mon, 30 Aug 2010 23:16:45 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UNGjYd011066; Mon, 30 Aug 2010 23:16:45 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008302316.o7UNGjYd011066@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 30 Aug 2010 23:16: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: r212036 - 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, 30 Aug 2010 23:16:45 -0000 Author: pjd Date: Mon Aug 30 23:16:45 2010 New Revision: 212036 URL: http://svn.freebsd.org/changeset/base/212036 Log: When someone gives NULL as data, assume this is because he want to declare connection side only. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/proto_socketpair.c Modified: head/sbin/hastd/proto_socketpair.c ============================================================================== --- head/sbin/hastd/proto_socketpair.c Mon Aug 30 22:45:32 2010 (r212035) +++ head/sbin/hastd/proto_socketpair.c Mon Aug 30 23:16:45 2010 (r212036) @@ -140,6 +140,10 @@ sp_send(void *ctx, const unsigned char * abort(); } + /* Someone is just trying to decide about side. */ + if (data == NULL) + return (0); + return (proto_common_send(fd, data, size)); } @@ -174,6 +178,10 @@ sp_recv(void *ctx, unsigned char *data, abort(); } + /* Someone is just trying to decide about side. */ + if (data == NULL) + return (0); + return (proto_common_recv(fd, data, size)); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 23:19:21 2010 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 C7EAD10656B7; Mon, 30 Aug 2010 23:19: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 B79F08FC0A; Mon, 30 Aug 2010 23:19:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UNJLuM011151; Mon, 30 Aug 2010 23:19:21 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UNJLAN011149; Mon, 30 Aug 2010 23:19:21 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008302319.o7UNJLAN011149@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 30 Aug 2010 23:19: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: r212037 - 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, 30 Aug 2010 23:19:21 -0000 Author: pjd Date: Mon Aug 30 23:19:21 2010 New Revision: 212037 URL: http://svn.freebsd.org/changeset/base/212037 Log: We only want to know if descriptors are ready for reading. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Mon Aug 30 23:16:45 2010 (r212036) +++ head/sbin/hastd/hastd.c Mon Aug 30 23:19:21 2010 (r212037) @@ -624,7 +624,7 @@ close: static void main_loop(void) { - fd_set rfds, wfds; + fd_set rfds; int cfd, lfd, maxfd, ret; struct timeval timeout; @@ -654,11 +654,8 @@ main_loop(void) FD_ZERO(&rfds); FD_SET(cfd, &rfds); FD_SET(lfd, &rfds); - FD_ZERO(&wfds); - FD_SET(cfd, &wfds); - FD_SET(lfd, &wfds); - ret = select(maxfd + 1, &rfds, &wfds, NULL, &timeout); + ret = select(maxfd + 1, &rfds, NULL, NULL, &timeout); if (ret == 0) hook_check(false); else if (ret == -1) { @@ -668,9 +665,9 @@ main_loop(void) pjdlog_exit(EX_OSERR, "select() failed"); } - if (FD_ISSET(cfd, &rfds) || FD_ISSET(cfd, &wfds)) + if (FD_ISSET(cfd, &rfds)) control_handle(cfg); - if (FD_ISSET(lfd, &rfds) || FD_ISSET(lfd, &wfds)) + if (FD_ISSET(lfd, &rfds)) listen_accept(); } } From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 23:26:11 2010 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 2940C10656A4; Mon, 30 Aug 2010 23:26:11 +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 17DBC8FC1F; Mon, 30 Aug 2010 23:26:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7UNQAq8011329; Mon, 30 Aug 2010 23:26:10 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7UNQAsK011323; Mon, 30 Aug 2010 23:26:10 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008302326.o7UNQAsK011323@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 30 Aug 2010 23:26: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: r212038 - 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, 30 Aug 2010 23:26:11 -0000 Author: pjd Date: Mon Aug 30 23:26:10 2010 New Revision: 212038 URL: http://svn.freebsd.org/changeset/base/212038 Log: Because it is very hard to make fork(2) from threaded process safe (we are limited to async-signal safe functions in the child process), move all hooks execution to the main (non-threaded) process. Do it by maintaining connection (socketpair) between child and parent and sending events from the child to parent, so it can execute the hook. This is step in right direction for others reasons too. For example there is one less problem to drop privs in worker processes. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/Makefile head/sbin/hastd/hast.h head/sbin/hastd/hastd.c head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/Makefile ============================================================================== --- head/sbin/hastd/Makefile Mon Aug 30 23:19:21 2010 (r212037) +++ head/sbin/hastd/Makefile Mon Aug 30 23:26:10 2010 (r212038) @@ -5,7 +5,7 @@ PROG= hastd SRCS= activemap.c SRCS+= control.c -SRCS+= ebuf.c +SRCS+= ebuf.c event.c SRCS+= hast_proto.c hastd.c hooks.c SRCS+= metadata.c SRCS+= nv.c Modified: head/sbin/hastd/hast.h ============================================================================== --- head/sbin/hastd/hast.h Mon Aug 30 23:19:21 2010 (r212037) +++ head/sbin/hastd/hast.h Mon Aug 30 23:26:10 2010 (r212038) @@ -181,6 +181,8 @@ struct hast_resource { pid_t hr_workerpid; /* Control connection between parent and child. */ struct proto_conn *hr_ctrl; + /* Events from child to parent. */ + struct proto_conn *hr_event; /* Activemap structure. */ struct activemap *hr_amp; Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Mon Aug 30 23:19:21 2010 (r212037) +++ head/sbin/hastd/hastd.c Mon Aug 30 23:26:10 2010 (r212038) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include "control.h" +#include "event.h" #include "hast.h" #include "hast_proto.h" #include "hastd.h" @@ -158,6 +159,11 @@ child_exit(void) role2str(res->hr_role)); child_exit_log(pid, status); proto_close(res->hr_ctrl); + res->hr_ctrl = NULL; + if (res->hr_event != NULL) { + proto_close(res->hr_event); + res->hr_event = NULL; + } res->hr_workerpid = 0; if (res->hr_role == HAST_ROLE_PRIMARY) { /* @@ -624,9 +630,10 @@ close: static void main_loop(void) { - fd_set rfds; - int cfd, lfd, maxfd, ret; + struct hast_resource *res; struct timeval timeout; + int fd, maxfd, ret; + fd_set rfds; timeout.tv_sec = REPORT_INTERVAL; timeout.tv_usec = 0; @@ -646,14 +653,20 @@ main_loop(void) hastd_reload(); } - cfd = proto_descriptor(cfg->hc_controlconn); - lfd = proto_descriptor(cfg->hc_listenconn); - maxfd = cfd > lfd ? cfd : lfd; - /* Setup descriptors for select(2). */ FD_ZERO(&rfds); - FD_SET(cfd, &rfds); - FD_SET(lfd, &rfds); + maxfd = fd = proto_descriptor(cfg->hc_controlconn); + FD_SET(fd, &rfds); + fd = proto_descriptor(cfg->hc_listenconn); + FD_SET(fd, &rfds); + maxfd = fd > maxfd ? fd : maxfd; + TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { + if (res->hr_event == NULL) + continue; + fd = proto_descriptor(res->hr_event); + FD_SET(fd, &rfds); + maxfd = fd > maxfd ? fd : maxfd; + } ret = select(maxfd + 1, &rfds, NULL, NULL, &timeout); if (ret == 0) @@ -665,10 +678,21 @@ main_loop(void) pjdlog_exit(EX_OSERR, "select() failed"); } - if (FD_ISSET(cfd, &rfds)) + if (FD_ISSET(proto_descriptor(cfg->hc_controlconn), &rfds)) control_handle(cfg); - if (FD_ISSET(lfd, &rfds)) + if (FD_ISSET(proto_descriptor(cfg->hc_listenconn), &rfds)) listen_accept(); + TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { + if (res->hr_event == NULL) + continue; + if (FD_ISSET(proto_descriptor(res->hr_event), &rfds)) { + if (event_recv(res) == 0) + continue; + /* The worker process exited? */ + proto_close(res->hr_event); + res->hr_event = NULL; + } + } } } Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Mon Aug 30 23:19:21 2010 (r212037) +++ head/sbin/hastd/primary.c Mon Aug 30 23:26:10 2010 (r212038) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include "control.h" +#include "event.h" #include "hast.h" #include "hast_proto.h" #include "hastd.h" @@ -226,12 +227,6 @@ static void *sync_thread(void *arg); static void *guard_thread(void *arg); static void -dummy_sighandler(int sig __unused) -{ - /* Nothing to do. */ -} - -static void cleanup(struct hast_resource *res) { int rerrno; @@ -429,8 +424,6 @@ init_environment(struct hast_resource *r /* * Turn on signals handling. */ - /* Because SIGCHLD is ignored by default, setup dummy handler for it. */ - PJDLOG_VERIFY(signal(SIGCHLD, dummy_sighandler) != SIG_ERR); PJDLOG_VERIFY(sigfillset(&mask) == 0); PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); } @@ -672,11 +665,11 @@ init_remote(struct hast_resource *res, s res->hr_remotein = in; res->hr_remoteout = out; } - hook_exec(res->hr_exec, "connect", res->hr_name, NULL); + event_send(res, EVENT_CONNECT); return (true); close: if (errmsg != NULL && strcmp(errmsg, "Split-brain condition!") == 0) - hook_exec(res->hr_exec, "split-brain", res->hr_name, NULL); + event_send(res, EVENT_SPLITBRAIN); proto_close(out); if (in != NULL) proto_close(in); @@ -774,6 +767,14 @@ hastd_primary(struct hast_resource *res) pjdlog_exit(EX_OSERR, "Unable to create control sockets between parent and child"); } + /* + * Create communication channel between child and parent. + */ + if (proto_client("socketpair://", &res->hr_event) < 0) { + KEEP_ERRNO((void)pidfile_remove(pfh)); + pjdlog_exit(EX_OSERR, + "Unable to create event sockets between child and parent"); + } pid = fork(); if (pid < 0) { @@ -783,6 +784,8 @@ hastd_primary(struct hast_resource *res) if (pid > 0) { /* This is parent. */ + /* Declare that we are receiver. */ + proto_recv(res->hr_event, NULL, 0); res->hr_workerpid = pid; return; } @@ -797,7 +800,9 @@ hastd_primary(struct hast_resource *res) signal(SIGHUP, SIG_DFL); signal(SIGCHLD, SIG_DFL); - hook_init(); + /* Declare that we are sender. */ + proto_send(res->hr_event, NULL, 0); + init_local(res); if (real_remote(res) && init_remote(res, NULL, NULL)) sync_start(); @@ -896,7 +901,7 @@ remote_close(struct hast_resource *res, */ sync_stop(); - hook_exec(res->hr_exec, "disconnect", res->hr_name, NULL); + event_send(res, EVENT_DISCONNECT); } /* @@ -1512,7 +1517,7 @@ sync_thread(void *arg __unused) pjdlog_info("Synchronization interrupted. " "%jd bytes synchronized so far.", (intmax_t)synced); - hook_exec(res->hr_exec, "syncintr", res->hr_name, NULL); + event_send(res, EVENT_SYNCINTR); } while (!sync_inprogress) { dorewind = true; @@ -1545,8 +1550,7 @@ sync_thread(void *arg __unused) pjdlog_info("Synchronization started. %ju bytes to go.", (uintmax_t)(res->hr_extentsize * activemap_ndirty(res->hr_amp))); - hook_exec(res->hr_exec, "syncstart", - res->hr_name, NULL); + event_send(res, EVENT_SYNCSTART); } } if (offset < 0) { @@ -1563,8 +1567,7 @@ sync_thread(void *arg __unused) pjdlog_info("Synchronization complete. " "%jd bytes synchronized.", (intmax_t)synced); - hook_exec(res->hr_exec, "syncdone", - res->hr_name, NULL); + event_send(res, EVENT_SYNCDONE); } mtx_lock(&metadata_lock); res->hr_syncsrc = HAST_SYNCSRC_UNDEF; @@ -1950,7 +1953,6 @@ guard_thread(void *arg) PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0); PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0); PJDLOG_VERIFY(sigaddset(&mask, SIGTERM) == 0); - PJDLOG_VERIFY(sigaddset(&mask, SIGCHLD) == 0); timeout.tv_nsec = 0; signo = -1; @@ -1969,7 +1971,6 @@ guard_thread(void *arg) default: break; } - hook_check(signo == SIGCHLD); pjdlog_debug(2, "remote_guard: Checking connections."); now = time(NULL); Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Mon Aug 30 23:19:21 2010 (r212037) +++ head/sbin/hastd/secondary.c Mon Aug 30 23:26:10 2010 (r212038) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include "control.h" +#include "event.h" #include "hast.h" #include "hast_proto.h" #include "hastd.h" @@ -325,7 +326,7 @@ init_remote(struct hast_resource *res, s if (res->hr_secondary_localcnt > res->hr_primary_remotecnt && res->hr_primary_localcnt > res->hr_secondary_remotecnt) { /* Exit on split-brain. */ - hook_exec(res->hr_exec, "split-brain", res->hr_name, NULL); + event_send(res, EVENT_SPLITBRAIN); exit(EX_CONFIG); } } @@ -345,6 +346,14 @@ hastd_secondary(struct hast_resource *re pjdlog_exit(EX_OSERR, "Unable to create control sockets between parent and child"); } + /* + * Create communication channel between child and parent. + */ + if (proto_client("socketpair://", &res->hr_event) < 0) { + KEEP_ERRNO((void)pidfile_remove(pfh)); + pjdlog_exit(EX_OSERR, + "Unable to create event sockets between child and parent"); + } pid = fork(); if (pid < 0) { @@ -358,6 +367,8 @@ hastd_secondary(struct hast_resource *re res->hr_remotein = NULL; proto_close(res->hr_remoteout); res->hr_remoteout = NULL; + /* Declare that we are receiver. */ + proto_recv(res->hr_event, NULL, 0); res->hr_workerpid = pid; return; } @@ -372,17 +383,19 @@ hastd_secondary(struct hast_resource *re signal(SIGHUP, SIG_DFL); signal(SIGCHLD, SIG_DFL); + /* Declare that we are sender. */ + proto_send(res->hr_event, NULL, 0); + /* Error in setting timeout is not critical, but why should it fail? */ if (proto_timeout(res->hr_remotein, 0) < 0) pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0) pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); - hook_init(); init_local(res); init_remote(res, nvin); init_environment(); - hook_exec(res->hr_exec, "connect", res->hr_name, NULL); + event_send(res, EVENT_CONNECT); error = pthread_create(&td, NULL, recv_thread, res); assert(error == 0); @@ -515,7 +528,7 @@ secondary_exit(int exitcode, const char va_start(ap, fmt); pjdlogv_errno(LOG_ERR, fmt, ap); va_end(ap); - hook_exec(gres->hr_exec, "disconnect", gres->hr_name, NULL); + event_send(gres, EVENT_DISCONNECT); exit(exitcode); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 30 23:28:29 2010 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 DE37B1065697; Mon, 30 Aug 2010 23:28:29 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 41DD48FC0C; Mon, 30 Aug 2010 23:28:18 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 0298045E5C; Tue, 31 Aug 2010 01:28:16 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 977BD45CBA; Tue, 31 Aug 2010 01:28:11 +0200 (CEST) Date: Tue, 31 Aug 2010 01:28:03 +0200 From: Pawel Jakub Dawidek To: Kostik Belousov Message-ID: <20100830232803.GH1871@garage.freebsd.pl> References: <201008300006.o7U065Nu078151@svn.freebsd.org> <20100830075945.GS2396@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GlnCQLZWzqLRJED8" Content-Disposition: inline In-Reply-To: <20100830075945.GS2396@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211982 - 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, 30 Aug 2010 23:28:30 -0000 --GlnCQLZWzqLRJED8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 30, 2010 at 10:59:45AM +0300, Kostik Belousov wrote: > On Mon, Aug 30, 2010 at 12:06:05AM +0000, Pawel Jakub Dawidek wrote: > > Author: pjd > > Date: Mon Aug 30 00:06:05 2010 > > New Revision: 211982 > > URL: http://svn.freebsd.org/changeset/base/211982 > >=20 > > Log: > > Use sigtimedwait(2) for signals handling in primary process. > > This fixes various races and eliminates use of pthread* API in signal= handler. >=20 > Replying to the random commit. >=20 > In the multithreaded process, after the fork in the child, you shall > not call any not async-signal safe functions. I suppose that hook_execv() > exposes the issue, calling into some stdio functions and sysconf(). Right. It should be fixed it in r212038. Now all the hooks are executed from the main (non-threaded) process. This also makes it easier to drop privs in the worker processes in the future, now that we don't execute anything from them. Thanks for pointing that out. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --GlnCQLZWzqLRJED8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkx8PoIACgkQForvXbEpPzRgjACgxouY3EPKScws4IQGPMSPuagc vlQAoNlTU0Hkcaunc+Le6y3yr9jhGqgo =g1Ws -----END PGP SIGNATURE----- --GlnCQLZWzqLRJED8-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 00:15:20 2010 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 AF94B1065675; Tue, 31 Aug 2010 00:15:20 +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 9DE838FC18; Tue, 31 Aug 2010 00:15:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V0FK1b012483; Tue, 31 Aug 2010 00:15:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V0FKXL012481; Tue, 31 Aug 2010 00:15:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008310015.o7V0FKXL012481@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 00:15:20 +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: r212039 - stable/8/sys/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: Tue, 31 Aug 2010 00:15:20 -0000 Author: yongari Date: Tue Aug 31 00:15:20 2010 New Revision: 212039 URL: http://svn.freebsd.org/changeset/base/212039 Log: MFC r211648: It seems some newer RTL8139 controllers provides only memory space register mapping. I'm not sure whether it comes from the fact that controllers live behind certain PCI brdge(PLX PCI 6152 33BC) and the bridge has some issues in handling I/O space register mapping. Unfortunately it's not possible to narrow down to an exact controller that shows this issue because RealTek used the same PCI device/revision id again. In theory, it's possible to check parent PCI bridge device and change rl(4) to use memory space register mapping if the parent PCI bridge is PLX PCI 6152. But I didn't try to do that and we wouldn't get much benefit with added complexity. Blindly switching to use memory space register mapping for rl(4) may make most old controllers not to work. At least, I don't want to take potential risk from such change. So use I/O space register mapping by default but give users chance to override it via a tunable. The tunable to use memory space register mapping would be given by adding the following line to /boot/loader.conf file. dev.rl.%d.prefer_iomap="0" This change makes P811B quad-port work with this tunable. Modified: stable/8/sys/pci/if_rl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/pci/if_rl.c ============================================================================== --- stable/8/sys/pci/if_rl.c Mon Aug 30 23:26:10 2010 (r212038) +++ stable/8/sys/pci/if_rl.c Tue Aug 31 00:15:20 2010 (r212039) @@ -125,16 +125,6 @@ MODULE_DEPEND(rl, miibus, 1, 1, 1); /* "device miibus" required. See GENERIC if you get errors here. */ #include "miibus_if.h" -/* - * Default to using PIO access for this driver. On SMP systems, - * there appear to be problems with memory mapped mode: it looks like - * doing too many memory mapped access back to back in rapid succession - * can hang the bus. I'm inclined to blame this on crummy design/construction - * on the part of RealTek. Memory mapped mode does appear to work on - * uniprocessor systems though. - */ -#define RL_USEIOSPACE - #include /* @@ -225,14 +215,6 @@ static void rl_watchdog(struct rl_softc static void rl_setwol(struct rl_softc *); static void rl_clrwol(struct rl_softc *); -#ifdef RL_USEIOSPACE -#define RL_RES SYS_RES_IOPORT -#define RL_RID RL_PCI_LOIO -#else -#define RL_RES SYS_RES_MEMORY -#define RL_RID RL_PCI_LOMEM -#endif - static device_method_t rl_methods[] = { /* Device interface */ DEVMETHOD(device_probe, rl_probe), @@ -806,7 +788,7 @@ rl_attach(device_t dev) struct sysctl_ctx_list *ctx; struct sysctl_oid_list *children; int error = 0, hwrev, i, pmc, rid; - int unit; + int prefer_iomap, unit; uint16_t rl_did = 0; char tn[32]; @@ -828,10 +810,31 @@ rl_attach(device_t dev) pci_enable_busmaster(dev); - /* Map control/status registers. */ - rid = RL_RID; - sc->rl_res = bus_alloc_resource_any(dev, RL_RES, &rid, RF_ACTIVE); + /* + * Map control/status registers. + * Default to using PIO access for this driver. On SMP systems, + * there appear to be problems with memory mapped mode: it looks + * like doing too many memory mapped access back to back in rapid + * succession can hang the bus. I'm inclined to blame this on + * crummy design/construction on the part of RealTek. Memory + * mapped mode does appear to work on uniprocessor systems though. + */ + prefer_iomap = 1; + snprintf(tn, sizeof(tn), "dev.rl.%d.prefer_iomap", unit); + TUNABLE_INT_FETCH(tn, &prefer_iomap); + if (prefer_iomap) { + sc->rl_res_id = PCIR_BAR(0); + sc->rl_res_type = SYS_RES_IOPORT; + sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, + &sc->rl_res_id, RF_ACTIVE); + } + if (prefer_iomap == 0 || sc->rl_res == NULL) { + sc->rl_res_id = PCIR_BAR(1); + sc->rl_res_type = SYS_RES_MEMORY; + sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, + &sc->rl_res_id, RF_ACTIVE); + } if (sc->rl_res == NULL) { device_printf(dev, "couldn't map ports/memory\n"); error = ENXIO; @@ -1029,7 +1032,8 @@ rl_detach(device_t dev) if (sc->rl_irq[0]) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->rl_irq[0]); if (sc->rl_res) - bus_release_resource(dev, RL_RES, RL_RID, sc->rl_res); + bus_release_resource(dev, sc->rl_res_type, sc->rl_res_id, + sc->rl_res); if (ifp) if_free(ifp); From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 00:16:31 2010 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 5790610656B1; Tue, 31 Aug 2010 00:16:31 +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 45FCA8FC0C; Tue, 31 Aug 2010 00:16:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V0GVHJ012549; Tue, 31 Aug 2010 00:16:31 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V0GVEf012547; Tue, 31 Aug 2010 00:16:31 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008310016.o7V0GVEf012547@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 00:16:31 +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: r212040 - stable/7/sys/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: Tue, 31 Aug 2010 00:16:31 -0000 Author: yongari Date: Tue Aug 31 00:16:30 2010 New Revision: 212040 URL: http://svn.freebsd.org/changeset/base/212040 Log: MFC r211648: It seems some newer RTL8139 controllers provides only memory space register mapping. I'm not sure whether it comes from the fact that controllers live behind certain PCI brdge(PLX PCI 6152 33BC) and the bridge has some issues in handling I/O space register mapping. Unfortunately it's not possible to narrow down to an exact controller that shows this issue because RealTek used the same PCI device/revision id again. In theory, it's possible to check parent PCI bridge device and change rl(4) to use memory space register mapping if the parent PCI bridge is PLX PCI 6152. But I didn't try to do that and we wouldn't get much benefit with added complexity. Blindly switching to use memory space register mapping for rl(4) may make most old controllers not to work. At least, I don't want to take potential risk from such change. So use I/O space register mapping by default but give users chance to override it via a tunable. The tunable to use memory space register mapping would be given by adding the following line to /boot/loader.conf file. dev.rl.%d.prefer_iomap="0" This change makes P811B quad-port work with this tunable. Modified: stable/7/sys/pci/if_rl.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/pci/if_rl.c ============================================================================== --- stable/7/sys/pci/if_rl.c Tue Aug 31 00:15:20 2010 (r212039) +++ stable/7/sys/pci/if_rl.c Tue Aug 31 00:16:30 2010 (r212040) @@ -125,16 +125,6 @@ MODULE_DEPEND(rl, miibus, 1, 1, 1); /* "device miibus" required. See GENERIC if you get errors here. */ #include "miibus_if.h" -/* - * Default to using PIO access for this driver. On SMP systems, - * there appear to be problems with memory mapped mode: it looks like - * doing too many memory mapped access back to back in rapid succession - * can hang the bus. I'm inclined to blame this on crummy design/construction - * on the part of RealTek. Memory mapped mode does appear to work on - * uniprocessor systems though. - */ -#define RL_USEIOSPACE - #include /* @@ -225,14 +215,6 @@ static void rl_watchdog(struct rl_softc static void rl_setwol(struct rl_softc *); static void rl_clrwol(struct rl_softc *); -#ifdef RL_USEIOSPACE -#define RL_RES SYS_RES_IOPORT -#define RL_RID RL_PCI_LOIO -#else -#define RL_RES SYS_RES_MEMORY -#define RL_RID RL_PCI_LOMEM -#endif - static device_method_t rl_methods[] = { /* Device interface */ DEVMETHOD(device_probe, rl_probe), @@ -806,7 +788,7 @@ rl_attach(device_t dev) struct sysctl_ctx_list *ctx; struct sysctl_oid_list *children; int error = 0, hwrev, i, pmc, rid; - int unit; + int prefer_iomap, unit; uint16_t rl_did = 0; char tn[32]; @@ -828,10 +810,31 @@ rl_attach(device_t dev) pci_enable_busmaster(dev); - /* Map control/status registers. */ - rid = RL_RID; - sc->rl_res = bus_alloc_resource_any(dev, RL_RES, &rid, RF_ACTIVE); + /* + * Map control/status registers. + * Default to using PIO access for this driver. On SMP systems, + * there appear to be problems with memory mapped mode: it looks + * like doing too many memory mapped access back to back in rapid + * succession can hang the bus. I'm inclined to blame this on + * crummy design/construction on the part of RealTek. Memory + * mapped mode does appear to work on uniprocessor systems though. + */ + prefer_iomap = 1; + snprintf(tn, sizeof(tn), "dev.rl.%d.prefer_iomap", unit); + TUNABLE_INT_FETCH(tn, &prefer_iomap); + if (prefer_iomap) { + sc->rl_res_id = PCIR_BAR(0); + sc->rl_res_type = SYS_RES_IOPORT; + sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, + &sc->rl_res_id, RF_ACTIVE); + } + if (prefer_iomap == 0 || sc->rl_res == NULL) { + sc->rl_res_id = PCIR_BAR(1); + sc->rl_res_type = SYS_RES_MEMORY; + sc->rl_res = bus_alloc_resource_any(dev, sc->rl_res_type, + &sc->rl_res_id, RF_ACTIVE); + } if (sc->rl_res == NULL) { device_printf(dev, "couldn't map ports/memory\n"); error = ENXIO; @@ -1029,7 +1032,8 @@ rl_detach(device_t dev) if (sc->rl_irq[0]) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->rl_irq[0]); if (sc->rl_res) - bus_release_resource(dev, RL_RES, RL_RID, sc->rl_res); + bus_release_resource(dev, sc->rl_res_type, sc->rl_res_id, + sc->rl_res); if (ifp) if_free(ifp); From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 00:19:04 2010 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 0BE2B106564A; Tue, 31 Aug 2010 00:19:04 +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 EED218FC16; Tue, 31 Aug 2010 00:19:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V0J3FZ012650; Tue, 31 Aug 2010 00:19:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V0J39f012648; Tue, 31 Aug 2010 00:19:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008310019.o7V0J39f012648@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 00:19:03 +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: r212041 - 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: Tue, 31 Aug 2010 00:19:04 -0000 Author: yongari Date: Tue Aug 31 00:19:03 2010 New Revision: 212041 URL: http://svn.freebsd.org/changeset/base/212041 Log: MFC r211650,211667: r211650: Document tunable dev.rl.%unit.prefer_iomap r211667: Better wording and fix wrong explanation. Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) Modified: stable/8/share/man/man4/rl.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/rl.4 ============================================================================== --- stable/8/share/man/man4/rl.4 Tue Aug 31 00:16:30 2010 (r212040) +++ stable/8/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2008 +.Dd August 22, 2010 .Dt RL 4 .Os .Sh NAME @@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C .El .Sh LOADER TUNABLES .Bl -tag -width indent +.It Va dev.rl.%unit.prefer_iomap +This tunable controls which register mapping should be used on the +specified device. +A non-zero value enables I/O space register mapping. +For controllers that have no I/O space register mapping this tunable +should be set to 0 to use memory space register mapping. +The default value is 1 to use I/O space register mapping. .It Va dev.rl.%unit.twister_enable Non-zero value enables the long cable tuning on the specified device. Disabled by default. From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 00:20:10 2010 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 9EE331065670; Tue, 31 Aug 2010 00:20:10 +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 8DC0D8FC1B; Tue, 31 Aug 2010 00:20:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V0KAn4012739; Tue, 31 Aug 2010 00:20:10 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V0KAwL012737; Tue, 31 Aug 2010 00:20:10 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008310020.o7V0KAwL012737@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 00:20:10 +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: r212042 - stable/7/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: Tue, 31 Aug 2010 00:20:10 -0000 Author: yongari Date: Tue Aug 31 00:20:10 2010 New Revision: 212042 URL: http://svn.freebsd.org/changeset/base/212042 Log: MFC r211650,211667: r211650: Document tunable dev.rl.%unit.prefer_iomap r211667: Better wording and fix wrong explanation. Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) Modified: stable/7/share/man/man4/rl.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/rl.4 ============================================================================== --- stable/7/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) +++ stable/7/share/man/man4/rl.4 Tue Aug 31 00:20:10 2010 (r212042) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2008 +.Dd August 22, 2010 .Dt RL 4 .Os .Sh NAME @@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C .El .Sh LOADER TUNABLES .Bl -tag -width indent +.It Va dev.rl.%unit.prefer_iomap +This tunable controls which register mapping should be used on the +specified device. +A non-zero value enables I/O space register mapping. +For controllers that have no I/O space register mapping this tunable +should be set to 0 to use memory space register mapping. +The default value is 1 to use I/O space register mapping. .It Va dev.rl.%unit.twister_enable Non-zero value enables the long cable tuning on the specified device. Disabled by default. From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 01:16:46 2010 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 600E210656B0; Tue, 31 Aug 2010 01:16:46 +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 34E328FC0A; Tue, 31 Aug 2010 01:16:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V1GkNp013984; Tue, 31 Aug 2010 01:16:46 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V1GkM6013982; Tue, 31 Aug 2010 01:16:46 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201008310116.o7V1GkM6013982@svn.freebsd.org> From: Rick Macklem Date: Tue, 31 Aug 2010 01:16: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: r212043 - head/sys/fs/nullfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 01:16:46 -0000 Author: rmacklem Date: Tue Aug 31 01:16:45 2010 New Revision: 212043 URL: http://svn.freebsd.org/changeset/base/212043 Log: Add a null_remove() function to nullfs, so that the v_usecount of the lower level vnode is incremented to greater than 1 when the upper level vnode's v_usecount is greater than one. This is necessary for the NFS clients, so that they will do a silly rename of the file instead of actually removing it when the file is still in use. It is "racy", since the v_usecount is incremented in many places in the kernel with minimal synchronization, but an extraneous silly rename is preferred to not doing a silly rename when it is required. The only other file systems that currently check the value of v_usecount in their VOP_REMOVE() functions are nwfs and smbfs. These file systems choose to fail a remove when the v_usecount is greater than 1 and I believe will function more correctly with this patch, as well. Tested by: to.my.trociny at gmail.com Submitted by: to.my.trociny at gmail.com (earlier version) Reviewed by: kib MFC after: 2 weeks Modified: head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Tue Aug 31 00:20:10 2010 (r212042) +++ head/sys/fs/nullfs/null_vnops.c Tue Aug 31 01:16:45 2010 (r212043) @@ -499,6 +499,32 @@ null_accessx(struct vop_accessx_args *ap } /* + * Increasing refcount of lower vnode is needed at least for the case + * when lower FS is NFS to do sillyrename if the file is in use. + * Unfortunately v_usecount is incremented in many places in + * the kernel and, as such, there may be races that result in + * the NFS client doing an extraneous silly rename, but that seems + * preferable to not doing a silly rename when it is needed. + */ +static int +null_remove(struct vop_remove_args *ap) +{ + int retval, vreleit; + struct vnode *lvp; + + if (vrefcnt(ap->a_vp) > 1) { + lvp = NULLVPTOLOWERVP(ap->a_vp); + VREF(lvp); + vreleit = 1; + } else + vreleit = 0; + retval = null_bypass(&ap->a_gen); + if (vreleit != 0) + vrele(lvp); + return (retval); +} + +/* * We handle this to eliminate null FS to lower FS * file moving. Don't know why we don't allow this, * possibly we should. @@ -809,6 +835,7 @@ struct vop_vector null_vnodeops = { .vop_open = null_open, .vop_print = null_print, .vop_reclaim = null_reclaim, + .vop_remove = null_remove, .vop_rename = null_rename, .vop_setattr = null_setattr, .vop_strategy = VOP_EOPNOTSUPP, From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 02:07:13 2010 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 960EF106564A; Tue, 31 Aug 2010 02:07:13 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 857038FC13; Tue, 31 Aug 2010 02:07:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V27Dh1015004; Tue, 31 Aug 2010 02:07:13 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V27DjC015002; Tue, 31 Aug 2010 02:07:13 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008310207.o7V27DjC015002@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 31 Aug 2010 02:07: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: r212044 - head/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: Tue, 31 Aug 2010 02:07:13 -0000 Author: nwhitehorn Date: Tue Aug 31 02:07:13 2010 New Revision: 212044 URL: http://svn.freebsd.org/changeset/base/212044 Log: Missed one place the SLB lock should be held in r211967. Modified: head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Tue Aug 31 01:16:45 2010 (r212043) +++ head/sys/powerpc/aim/mmu_oea64.c Tue Aug 31 02:07:13 2010 (r212044) @@ -2232,12 +2232,14 @@ moea64_qremove(mmu_t mmu, vm_offset_t va void moea64_release_vsid(uint64_t vsid) { - int idx, mask; + int idx, mask; - idx = vsid & (NVSIDS-1); - mask = 1 << (idx % VSID_NBPW); - idx /= VSID_NBPW; - moea64_vsid_bitmap[idx] &= ~mask; + mtx_lock(&moea64_slb_mutex); + idx = vsid & (NVSIDS-1); + mask = 1 << (idx % VSID_NBPW); + idx /= VSID_NBPW; + moea64_vsid_bitmap[idx] &= ~mask; + mtx_unlock(&moea64_slb_mutex); } @@ -2253,7 +2255,7 @@ moea64_release(mmu_t mmu, pmap_t pmap) slb_free_user_cache(pmap->pm_slb); #else if (pmap->pm_sr[0] == 0) - panic("moea64_release"); + panic("moea64_release: pm_sr[0] = 0"); moea64_release_vsid(pmap->pm_sr[0]); #endif From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 02:23:06 2010 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 1B34F10656A8; Tue, 31 Aug 2010 02:23:06 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 0A64E8FC1E; Tue, 31 Aug 2010 02:23:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o7V2N4UF019437; Tue, 31 Aug 2010 02:23:05 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C7CD808.3060903@freebsd.org> Date: Tue, 31 Aug 2010 10:23:04 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201008300006.o7U065Nu078151@svn.freebsd.org> In-Reply-To: <201008300006.o7U065Nu078151@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: r211982 - 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, 31 Aug 2010 02:23:06 -0000 Pawel Jakub Dawidek wrote: > Author: pjd > Date: Mon Aug 30 00:06:05 2010 > New Revision: 211982 > URL: http://svn.freebsd.org/changeset/base/211982 > > Log: > Use sigtimedwait(2) for signals handling in primary process. > This fixes various races and eliminates use of pthread* API in signal handler. > > Pointed out by: kib > With help from: jilles > MFC after: 2 weeks > Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com > > Modified: > head/sbin/hastd/primary.c > Note that if you are sigwaiting signals, these signals should be masked, otherwise, there is a race condition. I have not read the code, maybe this is not a problem. Regards, David Xu From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 04:18:47 2010 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 E06DC10656A9; Tue, 31 Aug 2010 04:18:47 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D02F98FC15; Tue, 31 Aug 2010 04:18:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V4IlU8017880; Tue, 31 Aug 2010 04:18:47 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V4IlsR017878; Tue, 31 Aug 2010 04:18:47 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201008310418.o7V4IlsR017878@svn.freebsd.org> From: "Jayachandran C." Date: Tue, 31 Aug 2010 04:18: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: r212045 - 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, 31 Aug 2010 04:18:48 -0000 Author: jchandra Date: Tue Aug 31 04:18:47 2010 New Revision: 212045 URL: http://svn.freebsd.org/changeset/base/212045 Log: Add the workaround for 4xx lite boards after it was lost in the last board.c update. Modified: head/sys/mips/rmi/board.c Modified: head/sys/mips/rmi/board.c ============================================================================== --- head/sys/mips/rmi/board.c Tue Aug 31 02:07:13 2010 (r212044) +++ head/sys/mips/rmi/board.c Tue Aug 31 04:18:47 2010 (r212045) @@ -188,6 +188,23 @@ xls_board_specific_overrides(struct xlr_ blk1->gmac_port[1].mdint_id = 0; blk1->gmac_port[2].mdint_id = 0; blk1->gmac_port[3].mdint_id = 0; + + /* If we have a 4xx lite chip, don't enable the + * GMACs which are disabled in hardware */ + if (xlr_is_xls4xx_lite()) { + xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_GPIO_OFFSET); + uint32_t tmp; + + /* Port 6 & 7 are not enabled on the condor 4xx, figure + * this out from the GPIO fuse bank */ + tmp = xlr_read_reg(mmio, 35); + if ((tmp & (3 << 28)) != 0) { + blk1->enabled = 0x3; + blk1->gmac_port[2].valid = 0; + blk1->gmac_port[3].valid = 0; + blk1->num_ports = 2; + } + } break; case RMI_XLR_BOARD_ARIZONA_VIII: From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 06:22:03 2010 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 D1F0B1065679; Tue, 31 Aug 2010 06:22:03 +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 C26EA8FC1C; Tue, 31 Aug 2010 06:22:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V6M3ru020365; Tue, 31 Aug 2010 06:22:03 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V6M3Cx020363; Tue, 31 Aug 2010 06:22:03 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008310622.o7V6M3Cx020363@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 31 Aug 2010 06:22: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: r212046 - 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, 31 Aug 2010 06:22:03 -0000 Author: pjd Date: Tue Aug 31 06:22:03 2010 New Revision: 212046 URL: http://svn.freebsd.org/changeset/base/212046 Log: Mask only those signals that we want to handle. Suggested by: jilles MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Tue Aug 31 04:18:47 2010 (r212045) +++ head/sbin/hastd/primary.c Tue Aug 31 06:22:03 2010 (r212046) @@ -424,7 +424,10 @@ init_environment(struct hast_resource *r /* * Turn on signals handling. */ - PJDLOG_VERIFY(sigfillset(&mask) == 0); + PJDLOG_VERIFY(sigemptyset(&mask) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0); + PJDLOG_VERIFY(sigaddset(&mask, SIGTERM) == 0); PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); } From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 06:24:35 2010 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 832921065694; Tue, 31 Aug 2010 06:24:35 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 2D00F8FC15; Tue, 31 Aug 2010 06:24:34 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 8D0A945EE5; Tue, 31 Aug 2010 08:24:33 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 853C745B36; Tue, 31 Aug 2010 08:24:28 +0200 (CEST) Date: Tue, 31 Aug 2010 08:24:19 +0200 From: Pawel Jakub Dawidek To: David Xu Message-ID: <20100831062419.GK1871@garage.freebsd.pl> References: <201008300006.o7U065Nu078151@svn.freebsd.org> <4C7CD808.3060903@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RNRUMt0ZF5Yaq/Aq" Content-Disposition: inline In-Reply-To: <4C7CD808.3060903@freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211982 - 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, 31 Aug 2010 06:24:35 -0000 --RNRUMt0ZF5Yaq/Aq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 31, 2010 at 10:23:04AM +0000, David Xu wrote: > Pawel Jakub Dawidek wrote: > >Author: pjd > >Date: Mon Aug 30 00:06:05 2010 > >New Revision: 211982 > >URL: http://svn.freebsd.org/changeset/base/211982 > > > >Log: > > Use sigtimedwait(2) for signals handling in primary process. > > This fixes various races and eliminates use of pthread* API in signal= =20 > > handler. > > =20 > > Pointed out by: kib > > With help from: jilles > > MFC after: 2 weeks > > Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com > > > >Modified: > > head/sbin/hastd/primary.c > > > Note that if you are sigwaiting signals, these signals should be masked, > otherwise, there is a race condition. I have not read the code, maybe > this is not a problem. I do that, yes. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --RNRUMt0ZF5Yaq/Aq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkx8oBMACgkQForvXbEpPzS1/gCg6dqLqInRQu1WkpwQ3K2Isldl uroAmgKX5gTmUKhsE09g6kjSihSOZwxg =8k36 -----END PGP SIGNATURE----- --RNRUMt0ZF5Yaq/Aq-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 06:56:34 2010 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 4E1FB106564A; Tue, 31 Aug 2010 06:56:34 +0000 (UTC) (envelope-from freebsd@nagilum.org) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mx1.freebsd.org (Postfix) with ESMTP id E7EBD8FC13; Tue, 31 Aug 2010 06:56:33 +0000 (UTC) Received: from cakebox.homeunix.net (p50813BAB.dip0.t-ipconnect.de [80.129.59.171]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MWOFC-1OJwfv40N8-00X55w; Tue, 31 Aug 2010 08:43:58 +0200 Received: from cakebox.homeunix.net (localhost [127.0.0.1]) by cakebox.homeunix.net (Postfix) with ESMTP id C651367804; Tue, 31 Aug 2010 08:43:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cakebox.tis X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.7 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: by cakebox.homeunix.net (Postfix, from userid 80) id 301C767803; Tue, 31 Aug 2010 08:43:49 +0200 (CEST) Received: from p50813BAB.dip0.t-ipconnect.de (p50813BAB.dip0.t-ipconnect.de [80.129.59.171]) by cakebox.homeunix.net (Horde Framework) with HTTP; Tue, 31 Aug 2010 08:43:48 +0200 Message-ID: <20100831084348.1791378cih2dfssg@cakebox.homeunix.net> Date: Tue, 31 Aug 2010 08:43:48 +0200 From: Alexander To: Pyun YongHyeon References: <201008310019.o7V0J39f012648@svn.freebsd.org> In-Reply-To: <201008310019.o7V0J39f012648@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-Provags-ID: V02:K0:4yN6+R+LoJIHXrV/r7XvWCfeNpq2uKDMoRFOUdJTbE7 xkleU+8sOHN+0aXWILi0XF+d5G21Cby0TDsMcKOpBaD9LuuA4e cgxAspr87lSnZcULyEQT+/34ZhiistK9aesca+FtCkgDBdZgp2 geHS36sk0eVmbRqhCCP2LPJ/0TlGpuxZ8QiUI/FtCoZmTv28CF Ze52WQ4SnOFUbuwOsX3doF79+tuhz+GQFhctRccsZc= 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: r212041 - 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: Tue, 31 Aug 2010 06:56:34 -0000 Can we name the known examples somewhere? ----- Message from yongari@FreeBSD.org --------- Date: Tue, 31 Aug 2010 00:19:03 +0000 (UTC) From: Pyun YongHyeon Subject: svn commit: r212041 - stable/8/share/man/man4 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org > Author: yongari > Date: Tue Aug 31 00:19:03 2010 > New Revision: 212041 > URL: http://svn.freebsd.org/changeset/base/212041 > > Log: > MFC r211650,211667: > r211650: > Document tunable dev.rl.%unit.prefer_iomap > > r211667: > Better wording and fix wrong explanation. > > Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) > > Modified: > stable/8/share/man/man4/rl.4 > Directory Properties: > stable/8/share/man/man4/ (props changed) > > Modified: stable/8/share/man/man4/rl.4 > ============================================================================== > --- stable/8/share/man/man4/rl.4 Tue Aug 31 00:16:30 2010 (r212040) > +++ stable/8/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd November 1, 2008 > +.Dd August 22, 2010 > .Dt RL 4 > .Os > .Sh NAME > @@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C > .El > .Sh LOADER TUNABLES > .Bl -tag -width indent > +.It Va dev.rl.%unit.prefer_iomap > +This tunable controls which register mapping should be used on the > +specified device. > +A non-zero value enables I/O space register mapping. > +For controllers that have no I/O space register mapping this tunable > +should be set to 0 to use memory space register mapping. > +The default value is 1 to use I/O space register mapping. > .It Va dev.rl.%unit.twister_enable > Non-zero value enables the long cable tuning on the specified device. > Disabled by default. > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" > ----- End message from yongari@FreeBSD.org ----- ======================================================================== # _ __ _ __ http://www.nagilum.org/ \n icq://69646724 # # / |/ /__ ____ _(_) /_ ____ _ nagilum@nagilum.org \n +491776461165 # # / / _ `/ _ `/ / / // / ' \ Amiga (68k/PPC): AOS/NetBSD/Linux # # /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/ Mac (PPC): MacOS-X / Linux / MacOS-X # # /___/ x86: FreeBSD/Linux/Solaris/Win2k ARM9: EPOC EV6 # ======================================================================== ---------------------------------------------------------------- cakebox.homeunix.net - all the machine one needs.. From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 07:15:51 2010 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 E4E6310656B2; Tue, 31 Aug 2010 07:15:50 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D569F8FC1B; Tue, 31 Aug 2010 07:15:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V7FoQI021424; Tue, 31 Aug 2010 07:15:50 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V7FoSI021421; Tue, 31 Aug 2010 07:15:50 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201008310715.o7V7FoSI021421@svn.freebsd.org> From: David Xu Date: Tue, 31 Aug 2010 07:15: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: r212047 - 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, 31 Aug 2010 07:15:51 -0000 Author: davidxu Date: Tue Aug 31 07:15:50 2010 New Revision: 212047 URL: http://svn.freebsd.org/changeset/base/212047 Log: If a process is being debugged, skips job control caused by SIGSTOP/SIGCONT signals, because it is managed by debugger, however a normal signal sent to a interruptibly sleeping thread wakes up the thread so it will handle the signal when the process leaves the stopped state. PR: 150138 MFC after: 1 week Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Aug 31 06:22:03 2010 (r212046) +++ head/sys/kern/kern_sig.c Tue Aug 31 07:15:50 2010 (r212047) @@ -2139,20 +2139,9 @@ tdsendsignal(struct proc *p, struct thre * We try do the per-process part here. */ if (P_SHOULDSTOP(p)) { - /* - * The process is in stopped mode. All the threads should be - * either winding down or already on the suspended queue. - */ - if (p->p_flag & P_TRACED) { - /* - * The traced process is already stopped, - * so no further action is necessary. - * No signal can restart us. - */ - goto out; - } - if (sig == SIGKILL) { + if (p->p_flag & P_TRACED) + goto out; /* * SIGKILL sets process running. * It will die elsewhere. @@ -2163,6 +2152,8 @@ tdsendsignal(struct proc *p, struct thre } if (prop & SA_CONT) { + if (p->p_flag & P_TRACED) + goto out; /* * If SIGCONT is default (or ignored), we continue the * process but don't leave the signal in sigqueue as @@ -2207,6 +2198,8 @@ tdsendsignal(struct proc *p, struct thre } if (prop & SA_STOP) { + if (p->p_flag & P_TRACED) + goto out; /* * Already stopped, don't need to stop again * (If we did the shell could get confused). From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 07:19:10 2010 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 8EA931065674; Tue, 31 Aug 2010 07:19:10 +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 7E9C58FC16; Tue, 31 Aug 2010 07:19:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V7JAk3021511; Tue, 31 Aug 2010 07:19:10 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V7JA7X021508; Tue, 31 Aug 2010 07:19:10 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201008310719.o7V7JA7X021508@svn.freebsd.org> From: Kevin Lo Date: Tue, 31 Aug 2010 07:19: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: r212048 - in head: usr.bin/usbhidaction 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: Tue, 31 Aug 2010 07:19:10 -0000 Author: kevlo Date: Tue Aug 31 07:19:10 2010 New Revision: 212048 URL: http://svn.freebsd.org/changeset/base/212048 Log: For consistency, cast result of getpid() to long Modified: head/usr.bin/usbhidaction/usbhidaction.c head/usr.sbin/apmd/apmd.c Modified: head/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- head/usr.bin/usbhidaction/usbhidaction.c Tue Aug 31 07:15:50 2010 (r212047) +++ head/usr.bin/usbhidaction/usbhidaction.c Tue Aug 31 07:19:10 2010 (r212048) @@ -165,7 +165,8 @@ main(int argc, char **argv) if (demon) { fp = open(pidfile, O_WRONLY|O_CREAT, S_IRUSR|S_IRGRP|S_IROTH); if (fp >= 0) { - sz1 = snprintf(buf, sizeof buf, "%d\n", getpid()); + sz1 = snprintf(buf, sizeof buf, "%ld\n", + (long)getpid()); if (sz1 > sizeof buf) sz1 = sizeof buf; write(fp, buf, sz1); Modified: head/usr.sbin/apmd/apmd.c ============================================================================== --- head/usr.sbin/apmd/apmd.c Tue Aug 31 07:15:50 2010 (r212047) +++ head/usr.sbin/apmd/apmd.c Tue Aug 31 07:19:10 2010 (r212048) @@ -435,7 +435,7 @@ write_pid(void) FILE *fp = fopen(apmd_pidfile, "w"); if (fp) { - fprintf(fp, "%d\n", getpid()); + fprintf(fp, "%ld\n", (long)getpid()); fclose(fp); } } From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 09:38:44 2010 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 1F2CF10656AB; Tue, 31 Aug 2010 09:38: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 0E2AC8FC08; Tue, 31 Aug 2010 09:38:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7V9chcL024431; Tue, 31 Aug 2010 09:38:43 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7V9chxu024428; Tue, 31 Aug 2010 09:38:43 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008310938.o7V9chxu024428@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 31 Aug 2010 09:38:43 +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: r212049 - 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, 31 Aug 2010 09:38:44 -0000 Author: pjd Date: Tue Aug 31 09:38:43 2010 New Revision: 212049 URL: http://svn.freebsd.org/changeset/base/212049 Log: Forgot to add event.c and event.h in r212038. Pointed out by: pluknet MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Added: head/sbin/hastd/event.c (contents, props changed) head/sbin/hastd/event.h (contents, props changed) Added: head/sbin/hastd/event.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/hastd/event.c Tue Aug 31 09:38:43 2010 (r212049) @@ -0,0 +1,162 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include "hast.h" +#include "hast_proto.h" +#include "hooks.h" +#include "nv.h" +#include "pjdlog.h" +#include "proto.h" +#include "subr.h" + +#include "event.h" + +void +event_send(const struct hast_resource *res, int event) +{ + struct nv *nvin, *nvout; + int error; + + assert(res != NULL); + assert(event >= EVENT_MIN && event <= EVENT_MAX); + + nvin = nvout = NULL; + + /* + * Prepare and send event to parent process. + */ + nvout = nv_alloc(); + nv_add_uint8(nvout, (uint8_t)event, "event"); + error = nv_error(nvout); + if (error != 0) { + pjdlog_common(LOG_ERR, 0, error, + "Unable to prepare event header"); + goto done; + } + if (hast_proto_send(res, res->hr_event, nvout, NULL, 0) < 0) { + pjdlog_errno(LOG_ERR, "Unable to send event header"); + goto done; + } + if (hast_proto_recv_hdr(res->hr_event, &nvin) < 0) { + pjdlog_errno(LOG_ERR, "Unable to receive event header"); + goto done; + } + /* + * Do nothing with the answer. We only wait for it to be sure not + * to exit too quickly after sending an event and exiting immediately. + */ +done: + if (nvin != NULL) + nv_free(nvin); + if (nvout != NULL) + nv_free(nvout); +} + +int +event_recv(const struct hast_resource *res) +{ + struct nv *nvin, *nvout; + const char *evstr; + uint8_t event; + int error; + + assert(res != NULL); + + nvin = nvout = NULL; + + if (hast_proto_recv_hdr(res->hr_event, &nvin) < 0) { + /* + * First error log as debug. This is because worker process + * most likely exited. + */ + pjdlog_common(LOG_DEBUG, 1, errno, + "Unable to receive event header"); + goto fail; + } + + event = nv_get_uint8(nvin, "event"); + if (event == EVENT_NONE) { + pjdlog_error("Event header is missing 'event' field."); + goto fail; + } + + switch (event) { + case EVENT_CONNECT: + evstr = "connect"; + break; + case EVENT_DISCONNECT: + evstr = "disconnect"; + break; + case EVENT_SYNCSTART: + evstr = "syncstart"; + break; + case EVENT_SYNCDONE: + evstr = "syncdone"; + break; + case EVENT_SYNCINTR: + evstr = "syncintr"; + break; + case EVENT_SPLITBRAIN: + evstr = "split-brain"; + break; + default: + pjdlog_error("Event header contain invalid event number (%hhu).", + event); + goto fail; + } + + pjdlog_prefix_set("[%s] (%s) ", res->hr_name, role2str(res->hr_role)); + hook_exec(res->hr_exec, evstr, res->hr_name, NULL); + pjdlog_prefix_set("%s", ""); + + nvout = nv_alloc(); + nv_add_int16(nvout, 0, "error"); + error = nv_error(nvout); + if (error != 0) { + pjdlog_common(LOG_ERR, 0, error, + "Unable to prepare event header"); + goto fail; + } + if (hast_proto_send(res, res->hr_event, nvout, NULL, 0) < 0) { + pjdlog_errno(LOG_ERR, "Unable to send event header"); + goto fail; + } + nv_free(nvin); + nv_free(nvout); + return (0); +fail: + if (nvin != NULL) + nv_free(nvin); + if (nvout != NULL) + nv_free(nvout); + return (-1); +} Added: head/sbin/hastd/event.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/hastd/event.h Tue Aug 31 09:38:43 2010 (r212049) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _EVENT_H_ +#define _EVENT_H_ + +#define EVENT_NONE 0 +#define EVENT_CONNECT 1 +#define EVENT_DISCONNECT 2 +#define EVENT_SYNCSTART 3 +#define EVENT_SYNCDONE 4 +#define EVENT_SYNCINTR 5 +#define EVENT_SPLITBRAIN 6 + +#define EVENT_MIN EVENT_CONNECT +#define EVENT_MAX EVENT_SPLITBRAIN + +void event_send(const struct hast_resource *res, int event); +int event_recv(const struct hast_resource *res); + +#endif /* !_EVENT_H_ */ From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 10:41:53 2010 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 B40741065679; Tue, 31 Aug 2010 10:41:53 +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 8958B8FC17; Tue, 31 Aug 2010 10:41:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VAfrOX028014; Tue, 31 Aug 2010 10:41:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VAfrAF028012; Tue, 31 Aug 2010 10:41:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008311041.o7VAfrAF028012@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 31 Aug 2010 10:41: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: r212050 - 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, 31 Aug 2010 10:41:53 -0000 Author: pjd Date: Tue Aug 31 10:41:53 2010 New Revision: 212050 URL: http://svn.freebsd.org/changeset/base/212050 Log: When upgrading a pool which contain root file system, give user a hint that he should update boot code. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 09:38:43 2010 (r212049) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 10:41:53 2010 (r212050) @@ -3333,12 +3333,39 @@ typedef struct upgrade_cbdata { int cb_all; int cb_first; int cb_newer; + char cb_poolname[ZPOOL_MAXNAMELEN]; int cb_argc; uint64_t cb_version; char **cb_argv; } upgrade_cbdata_t; static int +is_root_pool(zpool_handle_t *zhp) +{ + static struct statfs sfs; + static char *poolname = NULL; + static boolean_t stated = B_FALSE; + char *slash; + + while (!stated) { + stated = B_TRUE; + if (statfs("/", &sfs) == -1) { + (void) fprintf(stderr, + "Unable to stat root file system: %s.\n", + strerror(errno)); + break; + } + if (strcmp(sfs.f_fstypename, "zfs") != 0) + break; + poolname = sfs.f_mntfromname; + if ((slash = strchr(poolname, '/')) != NULL) + *slash = '\0'; + break; + } + return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0); +} + +static int upgrade_cb(zpool_handle_t *zhp, void *arg) { upgrade_cbdata_t *cbp = arg; @@ -3371,6 +3398,12 @@ upgrade_cb(zpool_handle_t *zhp, void *ar if (!ret) { (void) printf(gettext("Successfully upgraded " "'%s'\n\n"), zpool_get_name(zhp)); + if (cbp->cb_poolname[0] == '\0' && + is_root_pool(zhp)) { + (void) strlcpy(cbp->cb_poolname, + zpool_get_name(zhp), + sizeof(cbp->cb_poolname)); + } } } } else if (cbp->cb_newer && version > SPA_VERSION) { @@ -3428,6 +3461,10 @@ upgrade_one(zpool_handle_t *zhp, void *d "from version %llu to version %llu\n\n"), zpool_get_name(zhp), (u_longlong_t)cur_version, (u_longlong_t)cbp->cb_version); + if (cbp->cb_poolname[0] == '\0' && is_root_pool(zhp)) { + (void) strlcpy(cbp->cb_poolname, zpool_get_name(zhp), + sizeof(cbp->cb_poolname)); + } } return (ret != 0); @@ -3569,6 +3606,16 @@ zpool_do_upgrade(int argc, char **argv) upgrade_one, &cb); } + if (cb.cb_poolname[0] != '\0') { + (void) printf( + "If you boot from pool '%s', don't forget to update boot code.\n" + "Assuming you use GPT partitioning and da0 is your boot disk\n" + "the following command will do it:\n" + "\n" + "\tgpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0\n\n", + cb.cb_poolname); + } + return (ret); } From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 12:03:29 2010 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 6932D10656A9; Tue, 31 Aug 2010 12:03:29 +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 599928FC1C; Tue, 31 Aug 2010 12:03:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VC3TM0029626; Tue, 31 Aug 2010 12:03:29 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VC3TH1029624; Tue, 31 Aug 2010 12:03:29 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008311203.o7VC3TH1029624@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 31 Aug 2010 12:03: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: r212051 - 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, 31 Aug 2010 12:03:29 -0000 Author: pjd Date: Tue Aug 31 12:03:29 2010 New Revision: 212051 URL: http://svn.freebsd.org/changeset/base/212051 Log: Correct error message. Submitted by: Mikolaj Golub MFC after: 2 weeks Modified: head/sbin/hastd/secondary.c Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Tue Aug 31 10:41:53 2010 (r212050) +++ head/sbin/hastd/secondary.c Tue Aug 31 12:03:29 2010 (r212051) @@ -569,7 +569,7 @@ recv_thread(void *arg) if (hast_proto_recv_data(res, res->hr_remotein, hio->hio_nv, hio->hio_data, MAXPHYS) < 0) { secondary_exit(EX_TEMPFAIL, - "Unable to receive reply data"); + "Unable to receive request data"); } } pjdlog_debug(2, "recv: (%p) Moving request to the disk queue.", From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 12:05:13 2010 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 B19251065679; Tue, 31 Aug 2010 12:05:13 +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 A1CD18FC21; Tue, 31 Aug 2010 12:05:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VC5DCd029695; Tue, 31 Aug 2010 12:05:13 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VC5D0m029693; Tue, 31 Aug 2010 12:05:13 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008311205.o7VC5D0m029693@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 31 Aug 2010 12:05: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: r212052 - 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, 31 Aug 2010 12:05:13 -0000 Author: pjd Date: Tue Aug 31 12:05:13 2010 New Revision: 212052 URL: http://svn.freebsd.org/changeset/base/212052 Log: Include process PID in log messages. Submitted by: Mikolaj Golub MFC after: 2 weeks Modified: head/sbin/hastd/pjdlog.c Modified: head/sbin/hastd/pjdlog.c ============================================================================== --- head/sbin/hastd/pjdlog.c Tue Aug 31 12:03:29 2010 (r212051) +++ head/sbin/hastd/pjdlog.c Tue Aug 31 12:05:13 2010 (r212052) @@ -57,6 +57,9 @@ pjdlog_mode_set(int mode) assert(mode == PJDLOG_MODE_STD || mode == PJDLOG_MODE_SYSLOG); pjdlog_mode = mode; + + if (mode == PJDLOG_MODE_SYSLOG) + openlog(NULL, LOG_PID, LOG_DAEMON); } /* From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 15:22:10 2010 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 4022210656B0; Tue, 31 Aug 2010 15:22:10 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 153BA8FC22; Tue, 31 Aug 2010 15:22:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VFM9xI033919; Tue, 31 Aug 2010 15:22:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VFM95X033918; Tue, 31 Aug 2010 15:22:09 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008311522.o7VFM95X033918@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 31 Aug 2010 15:22: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: r212053 - head/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: Tue, 31 Aug 2010 15:22:10 -0000 Author: nwhitehorn Date: Tue Aug 31 15:22:09 2010 New Revision: 212053 URL: http://svn.freebsd.org/changeset/base/212053 Log: Remove some code made obsolete by the powerpc64 import. Deleted: head/sys/powerpc/aim/trap_subr.S From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 15:27:47 2010 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 40C2C1065672; Tue, 31 Aug 2010 15:27:47 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D37F8FC0C; Tue, 31 Aug 2010 15:27:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VFRlTW034076; Tue, 31 Aug 2010 15:27:47 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VFRlCZ034062; Tue, 31 Aug 2010 15:27:47 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201008311527.o7VFRlCZ034062@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 31 Aug 2010 15:27: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: r212054 - in head/sys: conf powerpc/aim powerpc/booke powerpc/include powerpc/mpc85xx powerpc/powermac powerpc/powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 15:27:47 -0000 Author: nwhitehorn Date: Tue Aug 31 15:27:46 2010 New Revision: 212054 URL: http://svn.freebsd.org/changeset/base/212054 Log: Restructure how reset and poweroff are handled on PowerPC systems, since the existing code was very platform specific, and broken for SMP systems trying to reboot from KDB. - Add a new PLATFORM_RESET() method to the platform KOBJ interface, and migrate existing reset functions into platform modules. - Modify the OF_reboot() routine to submit the request by hand to avoid the IPIs involved in the regular openfirmware() routine. This fixes reboot from KDB on SMP machines. - Move non-KDB reset and poweroff functions on the Powermac platform into the relevant power control drivers (cuda, pmu, smu), instead of using them through the Open Firmware backdoor. - Rename platform_chrp to platform_powermac since it has become increasingly Powermac specific. When we gain support for IBM systems, we will grow a new platform_chrp. Added: head/sys/powerpc/powermac/platform_powermac.c - copied, changed from r212043, head/sys/powerpc/aim/platform_chrp.c Deleted: head/sys/powerpc/aim/platform_chrp.c Modified: head/sys/conf/files.powerpc head/sys/powerpc/aim/machdep.c head/sys/powerpc/aim/ofw_machdep.c head/sys/powerpc/aim/vm_machdep.c head/sys/powerpc/booke/platform_bare.c head/sys/powerpc/include/ofw_machdep.h head/sys/powerpc/mpc85xx/mpc85xx.c head/sys/powerpc/powermac/cuda.c head/sys/powerpc/powermac/pmu.c head/sys/powerpc/powermac/smu.c head/sys/powerpc/powerpc/platform.c head/sys/powerpc/powerpc/platform_if.m Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/conf/files.powerpc Tue Aug 31 15:27:46 2010 (r212054) @@ -82,7 +82,6 @@ powerpc/aim/mp_cpudep.c optional aim sm powerpc/aim/nexus.c optional aim powerpc/aim/ofw_machdep.c optional aim powerpc/aim/ofwmagic.S optional aim -powerpc/aim/platform_chrp.c optional aim powerpc/aim/slb.c optional aim powerpc64 powerpc/aim/swtch32.S optional aim powerpc powerpc/aim/swtch64.S optional aim powerpc64 @@ -143,6 +142,7 @@ powerpc/powermac/kiic.c optional powerm powerpc/powermac/macgpio.c optional powermac pci powerpc/powermac/macio.c optional powermac pci powerpc/powermac/openpic_macio.c optional powermac pci +powerpc/powermac/platform_powermac.c optional powermac powerpc/powermac/pswitch.c optional powermac pswitch powerpc/powermac/pmu.c optional powermac pmu powerpc/powermac/smu.c optional powermac smu Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/aim/machdep.c Tue Aug 31 15:27:46 2010 (r212054) @@ -168,15 +168,6 @@ struct bat battable[16]; struct kva_md_info kmi; static void -powerpc_ofw_shutdown(void *junk, int howto) -{ - if (howto & RB_HALT) { - OF_halt(); - } - OF_reboot(); -} - -static void cpu_startup(void *dummy) { @@ -233,9 +224,6 @@ cpu_startup(void *dummy) */ bufinit(); vm_pager_bufferinit(); - - EVENTHANDLER_REGISTER(shutdown_final, powerpc_ofw_shutdown, 0, - SHUTDOWN_PRI_LAST); } extern char kernel_text[], _end[]; Modified: head/sys/powerpc/aim/ofw_machdep.c ============================================================================== --- head/sys/powerpc/aim/ofw_machdep.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/aim/ofw_machdep.c Tue Aug 31 15:27:46 2010 (r212054) @@ -527,20 +527,21 @@ openfirmware(void *args) } void -OF_halt() -{ - int retval; /* dummy, this may not be needed */ - - OF_interpret("shut-down", 1, &retval); - for (;;); /* just in case */ -} - -void OF_reboot() { - int retval; /* dummy, this may not be needed */ + struct { + cell_t name; + cell_t nargs; + cell_t nreturns; + cell_t arg; + } args; + + args.name = (cell_t)(uintptr_t)"interpret"; + args.nargs = 1; + args.nreturns = 0; + args.arg = (cell_t)(uintptr_t)"reset-all"; + openfirmware_core(&args); /* Don't do rendezvous! */ - OF_interpret("reset-all", 1, &retval); for (;;); /* just in case */ } Modified: head/sys/powerpc/aim/vm_machdep.c ============================================================================== --- head/sys/powerpc/aim/vm_machdep.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/aim/vm_machdep.c Tue Aug 31 15:27:46 2010 (r212054) @@ -238,15 +238,6 @@ cpu_exit(td) } /* - * Reset back to firmware. - */ -void -cpu_reset() -{ - OF_reboot(); -} - -/* * Allocate a pool of sf_bufs (sendfile(2) or "super-fast" if you prefer. :-)) */ static void Modified: head/sys/powerpc/booke/platform_bare.c ============================================================================== --- head/sys/powerpc/booke/platform_bare.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/booke/platform_bare.c Tue Aug 31 15:27:46 2010 (r212054) @@ -70,6 +70,8 @@ static int bare_smp_next_cpu(platform_t, static int bare_smp_get_bsp(platform_t, struct cpuref *cpuref); static int bare_smp_start_cpu(platform_t, struct pcpu *cpu); +static void e500_reset(platform_t); + static platform_method_t bare_methods[] = { PLATFORMMETHOD(platform_probe, bare_probe), PLATFORMMETHOD(platform_mem_regions, bare_mem_regions), @@ -80,6 +82,8 @@ static platform_method_t bare_methods[] PLATFORMMETHOD(platform_smp_get_bsp, bare_smp_get_bsp), PLATFORMMETHOD(platform_smp_start_cpu, bare_smp_start_cpu), + PLATFORMMETHOD(platform_reset, e500_reset); + { 0, 0 } }; @@ -260,3 +264,30 @@ bare_smp_start_cpu(platform_t plat, stru return (ENXIO); #endif } + +static void +e500_reset(platform_t plat) +{ + uint32_t ver = SVR_VER(mfspr(SPR_SVR)); + + if (ver == SVR_MPC8572E || ver == SVR_MPC8572 || + ver == SVR_MPC8548E || ver == SVR_MPC8548) + /* Systems with dedicated reset register */ + ccsr_write4(OCP85XX_RSTCR, 2); + else { + /* Clear DBCR0, disables debug interrupts and events. */ + mtspr(SPR_DBCR0, 0); + __asm __volatile("isync"); + + /* Enable Debug Interrupts in MSR. */ + mtmsr(mfmsr() | PSL_DE); + + /* Enable debug interrupts and issue reset. */ + mtspr(SPR_DBCR0, mfspr(SPR_DBCR0) | DBCR0_IDM | + DBCR0_RST_SYSTEM); + } + + printf("Reset failed...\n"); + while (1); +} + Modified: head/sys/powerpc/include/ofw_machdep.h ============================================================================== --- head/sys/powerpc/include/ofw_machdep.h Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/include/ofw_machdep.h Tue Aug 31 15:27:46 2010 (r212054) @@ -43,7 +43,6 @@ void OF_getetheraddr(device_t dev, u_cha void OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *)); boolean_t OF_bootstrap(void); -void OF_halt(void); void OF_reboot(void); void ofw_mem_regions(struct mem_region **, int *, struct mem_region **, int *); Modified: head/sys/powerpc/mpc85xx/mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/mpc85xx.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/mpc85xx/mpc85xx.c Tue Aug 31 15:27:46 2010 (r212054) @@ -164,28 +164,3 @@ law_pci_target(struct resource *res, int return (rv); } -void -cpu_reset(void) -{ - uint32_t ver = SVR_VER(mfspr(SPR_SVR)); - - if (ver == SVR_MPC8572E || ver == SVR_MPC8572 || - ver == SVR_MPC8548E || ver == SVR_MPC8548) - /* Systems with dedicated reset register */ - ccsr_write4(OCP85XX_RSTCR, 2); - else { - /* Clear DBCR0, disables debug interrupts and events. */ - mtspr(SPR_DBCR0, 0); - __asm __volatile("isync"); - - /* Enable Debug Interrupts in MSR. */ - mtmsr(mfmsr() | PSL_DE); - - /* Enable debug interrupts and issue reset. */ - mtspr(SPR_DBCR0, mfspr(SPR_DBCR0) | DBCR0_IDM | - DBCR0_RST_SYSTEM); - } - - printf("Reset failed...\n"); - while (1); -} Modified: head/sys/powerpc/powermac/cuda.c ============================================================================== --- head/sys/powerpc/powermac/cuda.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/powermac/cuda.c Tue Aug 31 15:27:46 2010 (r212054) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -72,6 +73,7 @@ static u_int cuda_adb_autopoll(device_t static u_int cuda_poll(device_t dev); static void cuda_send_inbound(struct cuda_softc *sc); static void cuda_send_outbound(struct cuda_softc *sc); +static void cuda_shutdown(void *xsc, int howto); /* * Clock interface @@ -249,6 +251,8 @@ cuda_attach(device_t dev) } clock_register(dev, 1000); + EVENTHANDLER_REGISTER(shutdown_final, cuda_shutdown, sc, + SHUTDOWN_PRI_LAST); return (bus_generic_attach(dev)); } @@ -739,6 +743,20 @@ cuda_adb_autopoll(device_t dev, uint16_t return (0); } +static void +cuda_shutdown(void *xsc, int howto) +{ + struct cuda_softc *sc = xsc; + uint8_t cmd[] = {CUDA_PSEUDO, 0}; + + cmd[1] = (howto & RB_HALT) ? CMD_POWEROFF : CMD_RESET; + cuda_poll(sc->sc_dev); + cuda_send(sc, 1, 2, cmd); + + while (1) + cuda_poll(sc->sc_dev); +} + #define DIFF19041970 2082844800 static int Copied and modified: head/sys/powerpc/powermac/platform_powermac.c (from r212043, head/sys/powerpc/aim/platform_chrp.c) ============================================================================== --- head/sys/powerpc/aim/platform_chrp.c Tue Aug 31 01:16:45 2010 (r212043, copy source) +++ head/sys/powerpc/powermac/platform_powermac.c Tue Aug 31 15:27:46 2010 (r212054) @@ -55,38 +55,41 @@ __FBSDID("$FreeBSD$"); extern void *ap_pcpu; #endif -static int chrp_probe(platform_t); -void chrp_mem_regions(platform_t, struct mem_region **phys, int *physsz, +static int powermac_probe(platform_t); +void powermac_mem_regions(platform_t, struct mem_region **phys, int *physsz, struct mem_region **avail, int *availsz); -static u_long chrp_timebase_freq(platform_t, struct cpuref *cpuref); -static int chrp_smp_first_cpu(platform_t, struct cpuref *cpuref); -static int chrp_smp_next_cpu(platform_t, struct cpuref *cpuref); -static int chrp_smp_get_bsp(platform_t, struct cpuref *cpuref); -static int chrp_smp_start_cpu(platform_t, struct pcpu *cpu); - -static platform_method_t chrp_methods[] = { - PLATFORMMETHOD(platform_probe, chrp_probe), - PLATFORMMETHOD(platform_mem_regions, chrp_mem_regions), - PLATFORMMETHOD(platform_timebase_freq, chrp_timebase_freq), +static u_long powermac_timebase_freq(platform_t, struct cpuref *cpuref); +static int powermac_smp_first_cpu(platform_t, struct cpuref *cpuref); +static int powermac_smp_next_cpu(platform_t, struct cpuref *cpuref); +static int powermac_smp_get_bsp(platform_t, struct cpuref *cpuref); +static int powermac_smp_start_cpu(platform_t, struct pcpu *cpu); +static void powermac_reset(platform_t); + +static platform_method_t powermac_methods[] = { + PLATFORMMETHOD(platform_probe, powermac_probe), + PLATFORMMETHOD(platform_mem_regions, powermac_mem_regions), + PLATFORMMETHOD(platform_timebase_freq, powermac_timebase_freq), - PLATFORMMETHOD(platform_smp_first_cpu, chrp_smp_first_cpu), - PLATFORMMETHOD(platform_smp_next_cpu, chrp_smp_next_cpu), - PLATFORMMETHOD(platform_smp_get_bsp, chrp_smp_get_bsp), - PLATFORMMETHOD(platform_smp_start_cpu, chrp_smp_start_cpu), + PLATFORMMETHOD(platform_smp_first_cpu, powermac_smp_first_cpu), + PLATFORMMETHOD(platform_smp_next_cpu, powermac_smp_next_cpu), + PLATFORMMETHOD(platform_smp_get_bsp, powermac_smp_get_bsp), + PLATFORMMETHOD(platform_smp_start_cpu, powermac_smp_start_cpu), + + PLATFORMMETHOD(platform_reset, powermac_reset), { 0, 0 } }; -static platform_def_t chrp_platform = { - "chrp", - chrp_methods, +static platform_def_t powermac_platform = { + "powermac", + powermac_methods, 0 }; -PLATFORM_DEF(chrp_platform); +PLATFORM_DEF(powermac_platform); static int -chrp_probe(platform_t plat) +powermac_probe(platform_t plat) { if (OF_finddevice("/memory") != -1 || OF_finddevice("/memory@0") != -1) return (BUS_PROBE_GENERIC); @@ -95,14 +98,14 @@ chrp_probe(platform_t plat) } void -chrp_mem_regions(platform_t plat, struct mem_region **phys, int *physsz, +powermac_mem_regions(platform_t plat, struct mem_region **phys, int *physsz, struct mem_region **avail, int *availsz) { ofw_mem_regions(phys,physsz,avail,availsz); } static u_long -chrp_timebase_freq(platform_t plat, struct cpuref *cpuref) +powermac_timebase_freq(platform_t plat, struct cpuref *cpuref) { phandle_t phandle; int32_t ticks = -1; @@ -119,7 +122,7 @@ chrp_timebase_freq(platform_t plat, stru static int -chrp_smp_fill_cpuref(struct cpuref *cpuref, phandle_t cpu) +powermac_smp_fill_cpuref(struct cpuref *cpuref, phandle_t cpu) { cell_t cpuid, res; @@ -139,7 +142,7 @@ chrp_smp_fill_cpuref(struct cpuref *cpur } static int -chrp_smp_first_cpu(platform_t plat, struct cpuref *cpuref) +powermac_smp_first_cpu(platform_t plat, struct cpuref *cpuref) { char buf[8]; phandle_t cpu, dev, root; @@ -175,11 +178,11 @@ chrp_smp_first_cpu(platform_t plat, stru if (cpu == 0) return (ENOENT); - return (chrp_smp_fill_cpuref(cpuref, cpu)); + return (powermac_smp_fill_cpuref(cpuref, cpu)); } static int -chrp_smp_next_cpu(platform_t plat, struct cpuref *cpuref) +powermac_smp_next_cpu(platform_t plat, struct cpuref *cpuref) { char buf[8]; phandle_t cpu; @@ -195,11 +198,11 @@ chrp_smp_next_cpu(platform_t plat, struc if (cpu == 0) return (ENOENT); - return (chrp_smp_fill_cpuref(cpuref, cpu)); + return (powermac_smp_fill_cpuref(cpuref, cpu)); } static int -chrp_smp_get_bsp(platform_t plat, struct cpuref *cpuref) +powermac_smp_get_bsp(platform_t plat, struct cpuref *cpuref) { ihandle_t inst; phandle_t bsp, chosen; @@ -214,11 +217,11 @@ chrp_smp_get_bsp(platform_t plat, struct return (ENXIO); bsp = OF_instance_to_package(inst); - return (chrp_smp_fill_cpuref(cpuref, bsp)); + return (powermac_smp_fill_cpuref(cpuref, bsp)); } static int -chrp_smp_start_cpu(platform_t plat, struct pcpu *pc) +powermac_smp_start_cpu(platform_t plat, struct pcpu *pc) { #ifdef SMP phandle_t cpu; @@ -277,3 +280,9 @@ chrp_smp_start_cpu(platform_t plat, stru #endif } +static void +powermac_reset(platform_t platform) +{ + OF_reboot(); +} + Modified: head/sys/powerpc/powermac/pmu.c ============================================================================== --- head/sys/powerpc/powermac/pmu.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/powermac/pmu.c Tue Aug 31 15:27:46 2010 (r212054) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -81,6 +82,11 @@ static u_int pmu_adb_send(device_t dev, static u_int pmu_adb_autopoll(device_t dev, uint16_t mask); static u_int pmu_poll(device_t dev); +/* + * Power interface + */ + +static void pmu_shutdown(void *xsc, int howto); static void pmu_set_sleepled(void *xsc, int onoff); static int pmu_server_mode(SYSCTL_HANDLER_ARGS); static int pmu_acline_state(SYSCTL_HANDLER_ARGS); @@ -474,6 +480,12 @@ pmu_attach(device_t dev) clock_register(dev, 1000); + /* + * Register power control handler + */ + EVENTHANDLER_REGISTER(shutdown_final, pmu_shutdown, sc, + SHUTDOWN_PRI_LAST); + return (bus_generic_attach(dev)); } @@ -751,6 +763,20 @@ pmu_adb_autopoll(device_t dev, uint16_t } static void +pmu_shutdown(void *xsc, int howto) +{ + struct pmu_softc *sc = xsc; + uint8_t cmd[] = {'M', 'A', 'T', 'T'}; + + if (howto & RB_HALT) + pmu_send(sc, PMU_POWER_OFF, 4, cmd, 0, NULL); + else + pmu_send(sc, PMU_RESET_CPU, 0, NULL, 0, NULL); + + for (;;); +} + +static void pmu_set_sleepled(void *xsc, int onoff) { struct pmu_softc *sc = xsc; Modified: head/sys/powerpc/powermac/smu.c ============================================================================== --- head/sys/powerpc/powermac/smu.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/powermac/smu.c Tue Aug 31 15:27:46 2010 (r212054) @@ -165,6 +165,7 @@ static void smu_manage_fans(device_t smu static void smu_set_sleepled(void *xdev, int onoff); static int smu_server_mode(SYSCTL_HANDLER_ARGS); static void smu_doorbell_intr(void *xdev); +static void smu_shutdown(void *xdev, int howto); /* where to find the doorbell GPIO */ @@ -391,6 +392,12 @@ smu_attach(device_t dev) */ clock_register(dev, 1000); + /* + * Learn about shutdown events + */ + EVENTHANDLER_REGISTER(shutdown_final, smu_shutdown, dev, + SHUTDOWN_PRI_LAST); + return (bus_generic_attach(dev)); } @@ -1115,6 +1122,25 @@ smu_server_mode(SYSCTL_HANDLER_ARGS) return (smu_run_cmd(smu, &cmd, 1)); } +static void +smu_shutdown(void *xdev, int howto) +{ + device_t smu = xdev; + struct smu_cmd cmd; + + cmd.cmd = SMU_POWER; + if (howto & RB_HALT) + strcpy(cmd.data, "SHUTDOWN"); + else + strcpy(cmd.data, "RESTART"); + + cmd.len = strlen(cmd.data); + + smu_run_cmd(smu, &cmd, 1); + + for (;;); +} + static int smu_gettime(device_t dev, struct timespec *ts) { Modified: head/sys/powerpc/powerpc/platform.c ============================================================================== --- head/sys/powerpc/powerpc/platform.c Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/powerpc/platform.c Tue Aug 31 15:27:46 2010 (r212054) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -105,6 +106,15 @@ platform_smp_start_cpu(struct pcpu *cpu) } /* + * Reset back to firmware. + */ +void +cpu_reset() +{ + PLATFORM_RESET(plat_obj); +} + +/* * Platform install routines. Highest priority wins, using the same * algorithm as bus attachment. */ Modified: head/sys/powerpc/powerpc/platform_if.m ============================================================================== --- head/sys/powerpc/powerpc/platform_if.m Tue Aug 31 15:22:09 2010 (r212053) +++ head/sys/powerpc/powerpc/platform_if.m Tue Aug 31 15:27:46 2010 (r212054) @@ -161,3 +161,10 @@ METHOD int smp_start_cpu { struct pcpu *_cpu; }; +/** + * @brief Reset system + */ +METHOD void reset { + platform_t _plat; +}; + From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 15:52:12 2010 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 D10421065694; Tue, 31 Aug 2010 15:52:12 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFF158FC14; Tue, 31 Aug 2010 15:52:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VFqCgQ034663; Tue, 31 Aug 2010 15:52:12 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VFqCkZ034661; Tue, 31 Aug 2010 15:52:12 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201008311552.o7VFqCkZ034661@svn.freebsd.org> From: Hajimu UMEMOTO Date: Tue, 31 Aug 2010 15:52: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: r212056 - stable/8/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, 31 Aug 2010 15:52:12 -0000 Author: ume Date: Tue Aug 31 15:52:12 2010 New Revision: 212056 URL: http://svn.freebsd.org/changeset/base/212056 Log: MFC r211435, r211530: Make `ping6 -I' work with net.inet6.ip6.use_defaultzone=1. Modified: stable/8/sys/netinet6/raw_ip6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/netinet6/raw_ip6.c ============================================================================== --- stable/8/sys/netinet6/raw_ip6.c Tue Aug 31 15:49:41 2010 (r212055) +++ stable/8/sys/netinet6/raw_ip6.c Tue Aug 31 15:52:12 2010 (r212056) @@ -401,6 +401,7 @@ rip6_output(m, va_alist) struct ifnet *oifp = NULL; int type = 0, code = 0; /* for ICMPv6 output statistics only */ int scope_ambiguous = 0; + int use_defzone = 0; struct in6_addr in6a; va_list ap; @@ -430,9 +431,12 @@ rip6_output(m, va_alist) * XXX: we may still need to determine the zone later. */ if (!(so->so_state & SS_ISCONNECTED)) { - if (dstsock->sin6_scope_id == 0 && !V_ip6_use_defzone) + if (!optp || !optp->ip6po_pktinfo || + !optp->ip6po_pktinfo->ipi6_ifindex) + use_defzone = V_ip6_use_defzone; + if (dstsock->sin6_scope_id == 0 && !use_defzone) scope_ambiguous = 1; - if ((error = sa6_embedscope(dstsock, V_ip6_use_defzone)) != 0) + if ((error = sa6_embedscope(dstsock, use_defzone)) != 0) goto bad; } From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 16:57:59 2010 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 4905C1065720; Tue, 31 Aug 2010 16:57:59 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2C7988FC16; Tue, 31 Aug 2010 16:57:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VGvxIe036069; Tue, 31 Aug 2010 16:57:59 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VGvxTP036065; Tue, 31 Aug 2010 16:57:59 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201008311657.o7VGvxTP036065@svn.freebsd.org> From: Matthew D Fleming Date: Tue, 31 Aug 2010 16:57: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: r212058 - in head/sys: kern 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: Tue, 31 Aug 2010 16:57:59 -0000 Author: mdf Date: Tue Aug 31 16:57:58 2010 New Revision: 212058 URL: http://svn.freebsd.org/changeset/base/212058 Log: The realloc case for memguard(9) will copy too many bytes when reallocating to a smaller-sized allocation. Fix this issue. Noticed by: alc Reviewed by: alc Approved by: zml (mentor) MFC after: 3 weeks Modified: head/sys/kern/kern_malloc.c head/sys/vm/memguard.c head/sys/vm/memguard.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Tue Aug 31 15:58:15 2010 (r212057) +++ head/sys/kern/kern_malloc.c Tue Aug 31 16:57:58 2010 (r212058) @@ -566,11 +566,8 @@ realloc(void *addr, unsigned long size, */ #ifdef DEBUG_MEMGUARD - if (is_memguard_addr(addr)) { - slab = NULL; - alloc = size; - goto remalloc; - } + if (is_memguard_addr(addr)) + return (memguard_realloc(addr, size, mtp, flags)); #endif #ifdef DEBUG_REDZONE @@ -595,10 +592,6 @@ realloc(void *addr, unsigned long size, return (addr); #endif /* !DEBUG_REDZONE */ -#ifdef DEBUG_MEMGUARD -remalloc: -#endif - /* Allocate a new, bigger (or smaller) block */ if ((newaddr = malloc(size, mtp, flags)) == NULL) return (NULL); Modified: head/sys/vm/memguard.c ============================================================================== --- head/sys/vm/memguard.c Tue Aug 31 15:58:15 2010 (r212057) +++ head/sys/vm/memguard.c Tue Aug 31 16:57:58 2010 (r212058) @@ -399,6 +399,31 @@ memguard_free(void *ptr) vm_map_unlock(memguard_map); } +/* + * Re-allocate an allocation that was originally guarded. + */ +void * +memguard_realloc(void *addr, unsigned long size, struct malloc_type *mtp, + int flags) +{ + void *newaddr; + u_long old_size; + + /* + * Allocate the new block. Force the allocation to be guarded + * as the original may have been guarded through random + * chance, and that should be preserved. + */ + if ((newaddr = memguard_alloc(size, flags)) == NULL) + return (NULL); + + /* Copy over original contents. */ + old_size = *v2sizep(trunc_page((uintptr_t)addr)); + bcopy(addr, newaddr, min(size, old_size)); + memguard_free(addr); + return (newaddr); +} + int memguard_cmp(struct malloc_type *mtp, unsigned long size) { Modified: head/sys/vm/memguard.h ============================================================================== --- head/sys/vm/memguard.h Tue Aug 31 15:58:15 2010 (r212057) +++ head/sys/vm/memguard.h Tue Aug 31 16:57:58 2010 (r212058) @@ -38,6 +38,7 @@ struct vm_map; unsigned long memguard_fudge(unsigned long, unsigned long); void memguard_init(struct vm_map *); void *memguard_alloc(unsigned long, int); +void *memguard_realloc(void *, unsigned long, struct malloc_type *, int); void memguard_free(void *); int memguard_cmp(struct malloc_type *, unsigned long); int is_memguard_addr(void *); @@ -45,6 +46,7 @@ int is_memguard_addr(void *); #define memguard_fudge(size, xxx) (size) #define memguard_init(map) do { } while (0) #define memguard_alloc(size, flags) NULL +#define memguard_realloc(a, s, mtp, f) NULL #define memguard_free(addr) do { } while (0) #define memguard_cmp(mtp, size) 0 #define is_memguard_addr(addr) 0 From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 17:22:59 2010 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 A2D6810656C3; Tue, 31 Aug 2010 17:22:59 +0000 (UTC) (envelope-from zml@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 438E18FC14; Tue, 31 Aug 2010 17:22:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VHMw4D036690; Tue, 31 Aug 2010 17:22:58 GMT (envelope-from zml@svn.freebsd.org) Received: (from zml@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VHMw17036688; Tue, 31 Aug 2010 17:22:58 GMT (envelope-from zml@svn.freebsd.org) Message-Id: <201008311722.o7VHMw17036688@svn.freebsd.org> From: Zachary Loafman Date: Tue, 31 Aug 2010 17:22:58 +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: r212059 - 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, 31 Aug 2010 17:22:59 -0000 Author: zml Date: Tue Aug 31 17:22:57 2010 New Revision: 212059 URL: http://svn.freebsd.org/changeset/base/212059 Log: Release mdf@ from mentorship. He's already way more active than I am! Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Tue Aug 31 16:57:58 2010 (r212058) +++ svnadmin/conf/mentors Tue Aug 31 17:22:57 2010 (r212059) @@ -19,7 +19,6 @@ dim rpaulo Co-mentor: ed eri mlaier Co-mentor: thompsa gabor delphij jinmei gnn -mdf zml mm delphij nork imp randi cperciva From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 17:33:29 2010 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 EF6B710656AD; Tue, 31 Aug 2010 17:33:29 +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 DE8E38FC14; Tue, 31 Aug 2010 17:33:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VHXT2E036973; Tue, 31 Aug 2010 17:33:29 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VHXTsf036970; Tue, 31 Aug 2010 17:33:29 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201008311733.o7VHXTsf036970@svn.freebsd.org> From: Dimitry Andric Date: Tue, 31 Aug 2010 17:33: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: r212060 - in head: gnu/lib/libobjc sys/boot/i386/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 17:33:30 -0000 Author: dim Date: Tue Aug 31 17:33:29 2010 New Revision: 212060 URL: http://svn.freebsd.org/changeset/base/212060 Log: Use a more robust way to substitute gcc for clang, when compiling gnu/lib/libobjc and sys/boot/i386/boot2, so it also works when using absolute paths and/or options, as in CC="/absolute/path/clang -foo". Approved by: rpaulo (mentor) Modified: head/gnu/lib/libobjc/Makefile head/sys/boot/i386/boot2/Makefile Modified: head/gnu/lib/libobjc/Makefile ============================================================================== --- head/gnu/lib/libobjc/Makefile Tue Aug 31 17:22:57 2010 (r212059) +++ head/gnu/lib/libobjc/Makefile Tue Aug 31 17:33:29 2010 (r212060) @@ -16,7 +16,9 @@ SRCS= archive.c class.c encoding.c gc.c selector.c sendmsg.c thr.c thr-objc.c exception.c # XXX: clang cannot compile libobjc yet -CC:=${CC:C/^cc|^clang/gcc/} +.if ${CC:T:Mclang} == "clang" +CC=gcc +.endif INCS= encoding.h hash.h objc-api.h objc-decls.h objc-list.h objc.h runtime.h \ sarray.h thr.h typedstream.h NXConstStr.h Object.h Protocol.h Modified: head/sys/boot/i386/boot2/Makefile ============================================================================== --- head/sys/boot/i386/boot2/Makefile Tue Aug 31 17:22:57 2010 (r212059) +++ head/sys/boot/i386/boot2/Makefile Tue Aug 31 17:33:29 2010 (r212060) @@ -3,7 +3,9 @@ .include # XXX: clang can compile the boot code just fine, but boot2 gets too big -CC:=${CC:C/^cc|^clang/gcc/} +.if ${CC:T:Mclang} == "clang" +CC=gcc +.endif FILES= boot boot1 boot2 From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 17:33:49 2010 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 018AF10656A8; Tue, 31 Aug 2010 17:33:49 +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 E37FF8FC15; Tue, 31 Aug 2010 17:33:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VHXm4Q037016; Tue, 31 Aug 2010 17:33:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VHXmxX037013; Tue, 31 Aug 2010 17:33:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008311733.o7VHXmxX037013@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 17:33: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: r212061 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 17:33:49 -0000 Author: yongari Date: Tue Aug 31 17:33:48 2010 New Revision: 212061 URL: http://svn.freebsd.org/changeset/base/212061 Log: Split common parent DMA tag into ring DMA tag and TX/RX mbuf DMA tag. All controllers that are not BCM5755 or higher have 4GB boundary DMA bug. Previously bge(4) used 32bit DMA address to workaround the bug(r199670). However this caused the use of bounce buffers such that it resulted in poor performance for systems which have more than 4GB memory. Because bus_dma(9) honors boundary restriction requirement of DMA tag for dynamic buffers, having a separate TX/RX mbuf DMA tag will greatly reduce the possibility of using bounce buffers. For DMA buffers allocated with bus_dmamem_alloc(9), now bge(4) explicitly checks whether the requested memory region crossed the boundary or not. With this change, only the DMA buffer that crossed the boundary will use 32bit DMA address. Other DMA buffers are not affected as separate DMA tag is created for each DMA buffer. Even if 32bit DMA address space is used for a buffer, the chance to use bounce buffer is still very low as the size of buffer is small. This change should eliminate most usage of bounce buffers on systems that have more than 4GB memory. More correct fix would be teaching bus_dma(9) to honor boundary restriction for buffers created with bus_dmamem_alloc(9) but it seems that is not easy. While I'm here cleanup bge_dma_map_addr() and remove unnecessary member variables in bge_dmamap_arg structure. Tested by: marcel Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Aug 31 17:33:29 2010 (r212060) +++ head/sys/dev/bge/if_bge.c Tue Aug 31 17:33:48 2010 (r212061) @@ -355,8 +355,10 @@ static int bge_suspend(device_t); static int bge_resume(device_t); static void bge_release_resources(struct bge_softc *); static void bge_dma_map_addr(void *, bus_dma_segment_t *, int, int); -static int bge_dma_alloc(device_t); +static int bge_dma_alloc(struct bge_softc *); static void bge_dma_free(struct bge_softc *); +static int bge_dma_ring_alloc(struct bge_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]); static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]); @@ -614,13 +616,9 @@ bge_dma_map_addr(void *arg, bus_dma_segm if (error) return; - ctx = arg; - - if (nseg > ctx->bge_maxsegs) { - ctx->bge_maxsegs = 0; - return; - } + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + ctx = arg; ctx->bge_busaddr = segs->ds_addr; } @@ -2122,27 +2120,84 @@ bge_dma_free(struct bge_softc *sc) if (sc->bge_cdata.bge_stats_tag) bus_dma_tag_destroy(sc->bge_cdata.bge_stats_tag); + if (sc->bge_cdata.bge_buffer_tag) + bus_dma_tag_destroy(sc->bge_cdata.bge_buffer_tag); + /* Destroy the parent tag. */ if (sc->bge_cdata.bge_parent_tag) bus_dma_tag_destroy(sc->bge_cdata.bge_parent_tag); } static int -bge_dma_alloc(device_t dev) +bge_dma_ring_alloc(struct bge_softc *sc, bus_size_t alignment, + bus_size_t maxsize, bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, + bus_addr_t *paddr, const char *msg) { struct bge_dmamap_arg ctx; - struct bge_softc *sc; bus_addr_t lowaddr; - bus_size_t sbsz, txsegsz, txmaxsegsz; - int i, error; + bus_size_t ring_end; + int error; - sc = device_get_softc(dev); + lowaddr = BUS_SPACE_MAXADDR; +again: + error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, + alignment, 0, lowaddr, BUS_SPACE_MAXADDR, NULL, + NULL, maxsize, 1, maxsize, 0, NULL, NULL, tag); + if (error != 0) { + device_printf(sc->bge_dev, + "could not create %s dma tag\n", msg); + return (ENOMEM); + } + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->bge_dev, + "could not allocate DMA'able memory for %s\n", msg); + return (ENOMEM); + } + /* Load the address of the ring. */ + ctx.bge_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, bge_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->bge_dev, + "could not load DMA'able memory for %s\n", msg); + return (ENOMEM); + } + *paddr = ctx.bge_busaddr; + ring_end = *paddr + maxsize; + if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0 && + BGE_ADDR_HI(*paddr) != BGE_ADDR_HI(ring_end)) { + /* + * 4GB boundary crossed. Limit maximum allowable DMA + * address space to 32bit and try again. + */ + bus_dmamap_unload(*tag, *map); + bus_dmamem_free(*tag, *ring, *map); + bus_dma_tag_destroy(*tag); + if (bootverbose) + device_printf(sc->bge_dev, "4GB boundary crossed, " + "limit DMA address space to 32bit for %s\n", msg); + *ring = NULL; + *tag = NULL; + *map = NULL; + lowaddr = BUS_SPACE_MAXADDR_32BIT; + goto again; + } + return (0); +} + +static int +bge_dma_alloc(struct bge_softc *sc) +{ + bus_addr_t lowaddr; + bus_size_t boundary, sbsz, txsegsz, txmaxsegsz; + int i, error; lowaddr = BUS_SPACE_MAXADDR; if ((sc->bge_flags & BGE_FLAG_40BIT_BUG) != 0) lowaddr = BGE_DMA_MAXADDR; - if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0) - lowaddr = BUS_SPACE_MAXADDR_32BIT; /* * Allocate the parent bus DMA tag appropriate for PCI. */ @@ -2150,16 +2205,84 @@ bge_dma_alloc(device_t dev) 1, 0, lowaddr, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->bge_cdata.bge_parent_tag); - if (error != 0) { device_printf(sc->bge_dev, "could not allocate parent dma tag\n"); return (ENOMEM); } + /* Create tag for standard RX ring. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_STD_RX_RING_SZ, + &sc->bge_cdata.bge_rx_std_ring_tag, + (uint8_t **)&sc->bge_ldata.bge_rx_std_ring, + &sc->bge_cdata.bge_rx_std_ring_map, + &sc->bge_ldata.bge_rx_std_ring_paddr, "RX ring"); + if (error) + return (error); + + /* Create tag for RX return ring. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_RX_RTN_RING_SZ(sc), + &sc->bge_cdata.bge_rx_return_ring_tag, + (uint8_t **)&sc->bge_ldata.bge_rx_return_ring, + &sc->bge_cdata.bge_rx_return_ring_map, + &sc->bge_ldata.bge_rx_return_ring_paddr, "RX return ring"); + if (error) + return (error); + + /* Create tag for TX ring. */ + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_TX_RING_SZ, + &sc->bge_cdata.bge_tx_ring_tag, + (uint8_t **)&sc->bge_ldata.bge_tx_ring, + &sc->bge_cdata.bge_tx_ring_map, + &sc->bge_ldata.bge_tx_ring_paddr, "TX ring"); + if (error) + return (error); + /* - * Create tag for Tx mbufs. + * Create tag for status block. + * Because we only use single Tx/Rx/Rx return ring, use + * minimum status block size except BCM5700 AX/BX which + * seems to want to see full status block size regardless + * of configured number of ring. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && + sc->bge_chipid != BGE_CHIPID_BCM5700_C0) + sbsz = BGE_STATUS_BLK_SZ; + else + sbsz = 32; + error = bge_dma_ring_alloc(sc, PAGE_SIZE, sbsz, + &sc->bge_cdata.bge_status_tag, + (uint8_t **)&sc->bge_ldata.bge_status_block, + &sc->bge_cdata.bge_status_map, + &sc->bge_ldata.bge_status_block_paddr, "status block"); + if (error) + return (error); + + /* Create tag for jumbo RX ring. */ + if (BGE_IS_JUMBO_CAPABLE(sc)) { + error = bge_dma_ring_alloc(sc, PAGE_SIZE, BGE_JUMBO_RX_RING_SZ, + &sc->bge_cdata.bge_rx_jumbo_ring_tag, + (uint8_t **)&sc->bge_ldata.bge_rx_jumbo_ring, + &sc->bge_cdata.bge_rx_jumbo_ring_map, + &sc->bge_ldata.bge_rx_jumbo_ring_paddr, "jumbo RX ring"); + if (error) + return (error); + } + + /* Create parent tag for buffers. */ + boundary = 0; + if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0) + boundary = BGE_DMA_4G_BNDRY; + error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), + 1, boundary, lowaddr, BUS_SPACE_MAXADDR, NULL, + NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, + 0, NULL, NULL, &sc->bge_cdata.bge_buffer_tag); + if (error != 0) { + device_printf(sc->bge_dev, + "could not allocate buffer dma tag\n"); + return (ENOMEM); + } + /* Create tag for Tx mbufs. */ if (sc->bge_flags & BGE_FLAG_TSO) { txsegsz = BGE_TSOSEG_SZ; txmaxsegsz = 65535 + sizeof(struct ether_vlan_header); @@ -2167,7 +2290,7 @@ bge_dma_alloc(device_t dev) txsegsz = MCLBYTES; txmaxsegsz = MCLBYTES * BGE_NSEG_NEW; } - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1, + error = bus_dma_tag_create(sc->bge_cdata.bge_buffer_tag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, txmaxsegsz, BGE_NSEG_NEW, txsegsz, 0, NULL, NULL, &sc->bge_cdata.bge_tx_mtag); @@ -2177,10 +2300,8 @@ bge_dma_alloc(device_t dev) return (ENOMEM); } - /* - * Create tag for Rx mbufs. - */ - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1, 0, + /* Create tag for Rx mbufs. */ + error = bus_dma_tag_create(sc->bge_cdata.bge_buffer_tag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, MCLBYTES, 0, NULL, NULL, &sc->bge_cdata.bge_rx_mtag); @@ -2218,42 +2339,9 @@ bge_dma_alloc(device_t dev) } } - /* Create tag for standard RX ring. */ - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, - PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, - NULL, BGE_STD_RX_RING_SZ, 1, BGE_STD_RX_RING_SZ, 0, - NULL, NULL, &sc->bge_cdata.bge_rx_std_ring_tag); - - if (error) { - device_printf(sc->bge_dev, "could not allocate dma tag\n"); - return (ENOMEM); - } - - /* Allocate DMA'able memory for standard RX ring. */ - error = bus_dmamem_alloc(sc->bge_cdata.bge_rx_std_ring_tag, - (void **)&sc->bge_ldata.bge_rx_std_ring, BUS_DMA_NOWAIT, - &sc->bge_cdata.bge_rx_std_ring_map); - if (error) - return (ENOMEM); - - bzero((char *)sc->bge_ldata.bge_rx_std_ring, BGE_STD_RX_RING_SZ); - - /* Load the address of the standard RX ring. */ - ctx.bge_maxsegs = 1; - ctx.sc = sc; - - error = bus_dmamap_load(sc->bge_cdata.bge_rx_std_ring_tag, - sc->bge_cdata.bge_rx_std_ring_map, sc->bge_ldata.bge_rx_std_ring, - BGE_STD_RX_RING_SZ, bge_dma_map_addr, &ctx, BUS_DMA_NOWAIT); - - if (error) - return (ENOMEM); - - sc->bge_ldata.bge_rx_std_ring_paddr = ctx.bge_busaddr; - - /* Create tags for jumbo mbufs. */ + /* Create tags for jumbo RX buffers. */ if (BGE_IS_JUMBO_CAPABLE(sc)) { - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, + error = bus_dma_tag_create(sc->bge_cdata.bge_buffer_tag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, BGE_NSEG_JUMBO, PAGE_SIZE, 0, NULL, NULL, &sc->bge_cdata.bge_mtag_jumbo); @@ -2262,41 +2350,6 @@ bge_dma_alloc(device_t dev) "could not allocate jumbo dma tag\n"); return (ENOMEM); } - - /* Create tag for jumbo RX ring. */ - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, - PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, - NULL, BGE_JUMBO_RX_RING_SZ, 1, BGE_JUMBO_RX_RING_SZ, 0, - NULL, NULL, &sc->bge_cdata.bge_rx_jumbo_ring_tag); - - if (error) { - device_printf(sc->bge_dev, - "could not allocate jumbo ring dma tag\n"); - return (ENOMEM); - } - - /* Allocate DMA'able memory for jumbo RX ring. */ - error = bus_dmamem_alloc(sc->bge_cdata.bge_rx_jumbo_ring_tag, - (void **)&sc->bge_ldata.bge_rx_jumbo_ring, - BUS_DMA_NOWAIT | BUS_DMA_ZERO, - &sc->bge_cdata.bge_rx_jumbo_ring_map); - if (error) - return (ENOMEM); - - /* Load the address of the jumbo RX ring. */ - ctx.bge_maxsegs = 1; - ctx.sc = sc; - - error = bus_dmamap_load(sc->bge_cdata.bge_rx_jumbo_ring_tag, - sc->bge_cdata.bge_rx_jumbo_ring_map, - sc->bge_ldata.bge_rx_jumbo_ring, BGE_JUMBO_RX_RING_SZ, - bge_dma_map_addr, &ctx, BUS_DMA_NOWAIT); - - if (error) - return (ENOMEM); - - sc->bge_ldata.bge_rx_jumbo_ring_paddr = ctx.bge_busaddr; - /* Create DMA maps for jumbo RX buffers. */ error = bus_dmamap_create(sc->bge_cdata.bge_mtag_jumbo, 0, &sc->bge_cdata.bge_rx_jumbo_sparemap); @@ -2314,154 +2367,8 @@ bge_dma_alloc(device_t dev) return (ENOMEM); } } - - } - - /* Create tag for RX return ring. */ - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, - PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, - NULL, BGE_RX_RTN_RING_SZ(sc), 1, BGE_RX_RTN_RING_SZ(sc), 0, - NULL, NULL, &sc->bge_cdata.bge_rx_return_ring_tag); - - if (error) { - device_printf(sc->bge_dev, "could not allocate dma tag\n"); - return (ENOMEM); - } - - /* Allocate DMA'able memory for RX return ring. */ - error = bus_dmamem_alloc(sc->bge_cdata.bge_rx_return_ring_tag, - (void **)&sc->bge_ldata.bge_rx_return_ring, BUS_DMA_NOWAIT, - &sc->bge_cdata.bge_rx_return_ring_map); - if (error) - return (ENOMEM); - - bzero((char *)sc->bge_ldata.bge_rx_return_ring, - BGE_RX_RTN_RING_SZ(sc)); - - /* Load the address of the RX return ring. */ - ctx.bge_maxsegs = 1; - ctx.sc = sc; - - error = bus_dmamap_load(sc->bge_cdata.bge_rx_return_ring_tag, - sc->bge_cdata.bge_rx_return_ring_map, - sc->bge_ldata.bge_rx_return_ring, BGE_RX_RTN_RING_SZ(sc), - bge_dma_map_addr, &ctx, BUS_DMA_NOWAIT); - - if (error) - return (ENOMEM); - - sc->bge_ldata.bge_rx_return_ring_paddr = ctx.bge_busaddr; - - /* Create tag for TX ring. */ - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, - PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, - NULL, BGE_TX_RING_SZ, 1, BGE_TX_RING_SZ, 0, NULL, NULL, - &sc->bge_cdata.bge_tx_ring_tag); - - if (error) { - device_printf(sc->bge_dev, "could not allocate dma tag\n"); - return (ENOMEM); - } - - /* Allocate DMA'able memory for TX ring. */ - error = bus_dmamem_alloc(sc->bge_cdata.bge_tx_ring_tag, - (void **)&sc->bge_ldata.bge_tx_ring, BUS_DMA_NOWAIT, - &sc->bge_cdata.bge_tx_ring_map); - if (error) - return (ENOMEM); - - bzero((char *)sc->bge_ldata.bge_tx_ring, BGE_TX_RING_SZ); - - /* Load the address of the TX ring. */ - ctx.bge_maxsegs = 1; - ctx.sc = sc; - - error = bus_dmamap_load(sc->bge_cdata.bge_tx_ring_tag, - sc->bge_cdata.bge_tx_ring_map, sc->bge_ldata.bge_tx_ring, - BGE_TX_RING_SZ, bge_dma_map_addr, &ctx, BUS_DMA_NOWAIT); - - if (error) - return (ENOMEM); - - sc->bge_ldata.bge_tx_ring_paddr = ctx.bge_busaddr; - - /* - * Create tag for status block. - * Because we only use single Tx/Rx/Rx return ring, use - * minimum status block size except BCM5700 AX/BX which - * seems to want to see full status block size regardless - * of configured number of ring. - */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && - sc->bge_chipid != BGE_CHIPID_BCM5700_C0) - sbsz = BGE_STATUS_BLK_SZ; - else - sbsz = 32; - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, - PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, - NULL, sbsz, 1, sbsz, 0, NULL, NULL, &sc->bge_cdata.bge_status_tag); - - if (error) { - device_printf(sc->bge_dev, - "could not allocate status dma tag\n"); - return (ENOMEM); } - /* Allocate DMA'able memory for status block. */ - error = bus_dmamem_alloc(sc->bge_cdata.bge_status_tag, - (void **)&sc->bge_ldata.bge_status_block, BUS_DMA_NOWAIT, - &sc->bge_cdata.bge_status_map); - if (error) - return (ENOMEM); - - bzero((char *)sc->bge_ldata.bge_status_block, sbsz); - - /* Load the address of the status block. */ - ctx.sc = sc; - ctx.bge_maxsegs = 1; - - error = bus_dmamap_load(sc->bge_cdata.bge_status_tag, - sc->bge_cdata.bge_status_map, sc->bge_ldata.bge_status_block, - sbsz, bge_dma_map_addr, &ctx, BUS_DMA_NOWAIT); - - if (error) - return (ENOMEM); - - sc->bge_ldata.bge_status_block_paddr = ctx.bge_busaddr; - - /* Create tag for statistics block. */ - error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, - PAGE_SIZE, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, - NULL, BGE_STATS_SZ, 1, BGE_STATS_SZ, 0, NULL, NULL, - &sc->bge_cdata.bge_stats_tag); - - if (error) { - device_printf(sc->bge_dev, "could not allocate dma tag\n"); - return (ENOMEM); - } - - /* Allocate DMA'able memory for statistics block. */ - error = bus_dmamem_alloc(sc->bge_cdata.bge_stats_tag, - (void **)&sc->bge_ldata.bge_stats, BUS_DMA_NOWAIT, - &sc->bge_cdata.bge_stats_map); - if (error) - return (ENOMEM); - - bzero((char *)sc->bge_ldata.bge_stats, BGE_STATS_SZ); - - /* Load the address of the statstics block. */ - ctx.sc = sc; - ctx.bge_maxsegs = 1; - - error = bus_dmamap_load(sc->bge_cdata.bge_stats_tag, - sc->bge_cdata.bge_stats_map, sc->bge_ldata.bge_stats, - BGE_STATS_SZ, bge_dma_map_addr, &ctx, BUS_DMA_NOWAIT); - - if (error) - return (ENOMEM); - - sc->bge_ldata.bge_stats_paddr = ctx.bge_busaddr; - return (0); } @@ -2788,7 +2695,7 @@ bge_attach(device_t dev) else sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; - if (bge_dma_alloc(dev)) { + if (bge_dma_alloc(sc)) { device_printf(sc->bge_dev, "failed to allocate DMA resources\n"); error = ENXIO; Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Tue Aug 31 17:33:29 2010 (r212060) +++ head/sys/dev/bge/if_bgereg.h Tue Aug 31 17:33:48 2010 (r212061) @@ -2487,6 +2487,12 @@ struct bge_gib { #define BGE_DMA_MAXADDR 0xFFFFFFFFFF #endif +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#define BGE_DMA_4G_BNDRY 0x100000000 +#else +#define BGE_DMA_4G_BNDRY 0 +#endif + /* * Ring structures. Most of these reside in host memory and we tell * the NIC where they are via the ring control blocks. The exceptions @@ -2530,6 +2536,7 @@ struct bge_ring_data { */ struct bge_chain_data { bus_dma_tag_t bge_parent_tag; + bus_dma_tag_t bge_buffer_tag; bus_dma_tag_t bge_rx_std_ring_tag; bus_dma_tag_t bge_rx_jumbo_ring_tag; bus_dma_tag_t bge_rx_return_ring_tag; @@ -2558,12 +2565,7 @@ struct bge_chain_data { }; struct bge_dmamap_arg { - struct bge_softc *sc; bus_addr_t bge_busaddr; - uint16_t bge_flags; - int bge_idx; - int bge_maxsegs; - struct bge_tx_bd *bge_ring; }; #define BGE_HWREV_TIGON 0x01 From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 17:38:20 2010 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 E92BB10656B2; Tue, 31 Aug 2010 17:38:20 +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 D8EF38FC12; Tue, 31 Aug 2010 17:38:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VHcK4j037147; Tue, 31 Aug 2010 17:38:20 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VHcKjA037145; Tue, 31 Aug 2010 17:38:20 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201008311738.o7VHcKjA037145@svn.freebsd.org> From: Dimitry Andric Date: Tue, 31 Aug 2010 17:38: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: r212062 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 17:38:21 -0000 Author: dim Date: Tue Aug 31 17:38:20 2010 New Revision: 212062 URL: http://svn.freebsd.org/changeset/base/212062 Log: Always compile pc98 boot2 with gcc instead of clang, just as with i386 boot2. Unfortunately both still are too big when compiled with clang. Reviewed by: nyan Approved by: rpaulo (mentor) Modified: head/sys/boot/pc98/boot2/Makefile Modified: head/sys/boot/pc98/boot2/Makefile ============================================================================== --- head/sys/boot/pc98/boot2/Makefile Tue Aug 31 17:33:48 2010 (r212061) +++ head/sys/boot/pc98/boot2/Makefile Tue Aug 31 17:38:20 2010 (r212062) @@ -1,5 +1,12 @@ # $FreeBSD$ +.include + +# XXX: clang can compile the boot code just fine, but boot2 gets too big +.if ${CC:T:Mclang} == "clang" +CC=gcc +.endif + FILES= boot boot1 boot2 NM?= nm From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 17:43:47 2010 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 A77AE10656B7; Tue, 31 Aug 2010 17:43:47 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 974D98FC15; Tue, 31 Aug 2010 17:43:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VHhlBP037282; Tue, 31 Aug 2010 17:43:47 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VHhl1a037280; Tue, 31 Aug 2010 17:43:47 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201008311743.o7VHhl1a037280@svn.freebsd.org> From: Matthew D Fleming Date: Tue, 31 Aug 2010 17:43: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: r212063 - 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: Tue, 31 Aug 2010 17:43:47 -0000 Author: mdf Date: Tue Aug 31 17:43:47 2010 New Revision: 212063 URL: http://svn.freebsd.org/changeset/base/212063 Log: Have memguard(9) crash with an easier-to-debug message on double-free. Reviewed by: zml MFC after: 3 weeks Modified: head/sys/vm/memguard.c Modified: head/sys/vm/memguard.c ============================================================================== --- head/sys/vm/memguard.c Tue Aug 31 17:38:20 2010 (r212062) +++ head/sys/vm/memguard.c Tue Aug 31 17:43:47 2010 (r212063) @@ -247,9 +247,13 @@ SYSINIT(memguard, SI_SUB_KLD, SI_ORDER_A static u_long * v2sizep(vm_offset_t va) { + vm_paddr_t pa; struct vm_page *p; - p = PHYS_TO_VM_PAGE(pmap_kextract(va)); + pa = pmap_kextract(va); + if (pa == 0) + panic("MemGuard detected double-free of %p", (void *)va); + p = PHYS_TO_VM_PAGE(pa); KASSERT(p->wire_count != 0 && p->queue == PQ_NONE, ("MEMGUARD: Expected wired page %p in vtomgfifo!", p)); return ((u_long *)&p->pageq.tqe_next); From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 17:51:03 2010 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 4A62910656A6; Tue, 31 Aug 2010 17:51:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 18E778FC0C; Tue, 31 Aug 2010 17:51:03 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 9E67A46B38; Tue, 31 Aug 2010 13:51:02 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 011F08A04E; Tue, 31 Aug 2010 13:50:57 -0400 (EDT) From: John Baldwin To: Pyun YongHyeon Date: Tue, 31 Aug 2010 13:50:16 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201008311733.o7VHXmxX037013@svn.freebsd.org> In-Reply-To: <201008311733.o7VHXmxX037013@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201008311350.17175.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 31 Aug 2010 13:50:57 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212061 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 17:51:03 -0000 On Tuesday, August 31, 2010 1:33:48 pm Pyun YongHyeon wrote: > Author: yongari > Date: Tue Aug 31 17:33:48 2010 > New Revision: 212061 > URL: http://svn.freebsd.org/changeset/base/212061 > > Log: > Split common parent DMA tag into ring DMA tag and TX/RX mbuf DMA > tag. All controllers that are not BCM5755 or higher have 4GB > boundary DMA bug. Previously bge(4) used 32bit DMA address to > workaround the bug(r199670). However this caused the use of bounce > buffers such that it resulted in poor performance for systems which > have more than 4GB memory. Because bus_dma(9) honors boundary > restriction requirement of DMA tag for dynamic buffers, having a > separate TX/RX mbuf DMA tag will greatly reduce the possibility of > using bounce buffers. For DMA buffers allocated with > bus_dmamem_alloc(9), now bge(4) explicitly checks whether the > requested memory region crossed the boundary or not. > With this change, only the DMA buffer that crossed the boundary > will use 32bit DMA address. Other DMA buffers are not affected as > separate DMA tag is created for each DMA buffer. > Even if 32bit DMA address space is used for a buffer, the chance to > use bounce buffer is still very low as the size of buffer is small. > This change should eliminate most usage of bounce buffers on > systems that have more than 4GB memory. > > More correct fix would be teaching bus_dma(9) to honor boundary > restriction for buffers created with bus_dmamem_alloc(9) but it > seems that is not easy. > > While I'm here cleanup bge_dma_map_addr() and remove unnecessary > member variables in bge_dmamap_arg structure. Keep in mind the PAE case where you cannot effectively specify a 4GB boundary. I used a 2GB boundary for twa(4) in the PAE case to deal with the boundary issue. Probably though, bus_dma should just always enforce a 4GB boundary, at least on x86. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 17:54:55 2010 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 948F010656B5; Tue, 31 Aug 2010 17:54:55 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id 5BD838FC08; Tue, 31 Aug 2010 17:54:55 +0000 (UTC) Received: from [192.168.221.2] (remotevpn [192.168.221.2]) by ns1.feral.com (8.14.3/8.14.3) with ESMTP id o7VHsrxV024348 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 31 Aug 2010 10:54:54 -0700 (PDT) (envelope-from mj@feral.com) Message-ID: <4C7D41E9.7060907@feral.com> Date: Tue, 31 Aug 2010 10:54:49 -0700 From: Matthew Jacob Organization: Feral Software User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 To: John Baldwin References: <201008311733.o7VHXmxX037013@svn.freebsd.org> <201008311350.17175.jhb@freebsd.org> In-Reply-To: <201008311350.17175.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.2.6 (ns1.feral.com [192.168.221.1]); Tue, 31 Aug 2010 10:54:54 -0700 (PDT) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pyun YongHyeon Subject: Re: svn commit: r212061 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 17:54:55 -0000 But not amd64 please. > Keep in mind the PAE case where you cannot effectively specify a 4GB > boundary. I used a 2GB boundary for twa(4) in the PAE case to deal > with the boundary issue. Probably though, bus_dma should just always > enforce a 4GB boundary, at least on x86. > From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 18:11:50 2010 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 80CBD10656AA; Tue, 31 Aug 2010 18:11:50 +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 706DC8FC0C; Tue, 31 Aug 2010 18:11:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VIBoPU037896; Tue, 31 Aug 2010 18:11:50 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VIBoC5037894; Tue, 31 Aug 2010 18:11:50 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201008311811.o7VIBoC5037894@svn.freebsd.org> From: Dimitry Andric Date: Tue, 31 Aug 2010 18:11: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: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 18:11:50 -0000 Author: dim Date: Tue Aug 31 18:11:50 2010 New Revision: 212064 URL: http://svn.freebsd.org/changeset/base/212064 Log: Avoid directly manipulating a NULL pointer (which could result in undefined behaviour) in sys/boot/pc98/boot2/boot2.c. Reviewed by: nyan Approved by: rpaulo (mentor) Modified: head/sys/boot/pc98/boot2/boot2.c Modified: head/sys/boot/pc98/boot2/boot2.c ============================================================================== --- head/sys/boot/pc98/boot2/boot2.c Tue Aug 31 17:43:47 2010 (r212063) +++ head/sys/boot/pc98/boot2/boot2.c Tue Aug 31 18:11:50 2010 (r212064) @@ -187,9 +187,9 @@ xfsread(ino_t inode, void *buf, size_t n static inline uint32_t memsize(void) { - u_char *p = (u_char *)PTOV(0); + u_char *p = (u_char *)PTOV(0x401); - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; } static inline void From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 18:16:32 2010 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 D1F5810656C3; Tue, 31 Aug 2010 18:16:32 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 985A88FC08; Tue, 31 Aug 2010 18:16:32 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 08B9435A860; Tue, 31 Aug 2010 20:16:32 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id E5E6C1732B; Tue, 31 Aug 2010 20:16:31 +0200 (CEST) Date: Tue, 31 Aug 2010 20:16:31 +0200 From: Jilles Tjoelker To: David Xu Message-ID: <20100831181631.GA31653@stack.nl> References: <201008310715.o7V7FoSI021421@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201008310715.o7V7FoSI021421@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212047 - 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, 31 Aug 2010 18:16:32 -0000 On Tue, Aug 31, 2010 at 07:15:50AM +0000, David Xu wrote: > Author: davidxu > Date: Tue Aug 31 07:15:50 2010 > New Revision: 212047 > URL: http://svn.freebsd.org/changeset/base/212047 > Log: > If a process is being debugged, skips job control caused by SIGSTOP/SIGCONT > signals, because it is managed by debugger, however a normal signal sent to > a interruptibly sleeping thread wakes up the thread so it will handle the > signal when the process leaves the stopped state. > PR: 150138 > MFC after: 1 week > Modified: > head/sys/kern/kern_sig.c > Modified: head/sys/kern/kern_sig.c > ============================================================================== > --- head/sys/kern/kern_sig.c Tue Aug 31 06:22:03 2010 (r212046) > +++ head/sys/kern/kern_sig.c Tue Aug 31 07:15:50 2010 (r212047) > if (sig == SIGKILL) { > + if (p->p_flag & P_TRACED) > + goto out; > /* > * SIGKILL sets process running. > * It will die elsewhere. Hmm, shouldn't SIGKILL kill right away regardless of debuggers? -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 18:48:09 2010 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 68D9E10656B3; Tue, 31 Aug 2010 18:48:09 +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 586478FC18; Tue, 31 Aug 2010 18:48:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VIm9l0038602; Tue, 31 Aug 2010 18:48:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VIm9SV038599; Tue, 31 Aug 2010 18:48:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008311848.o7VIm9SV038599@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 18:48: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: r212065 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 18:48:09 -0000 Author: yongari Date: Tue Aug 31 18:48:09 2010 New Revision: 212065 URL: http://svn.freebsd.org/changeset/base/212065 Log: Handle PAE case correctly. You cannot effectively specify a 4GB boundary in PAE case so use a 2GB boundary for PAE as suggested by jhb. Pointed out by: jhb Reviewed by: jhb Modified: head/sys/dev/bge/if_bge.c head/sys/dev/bge/if_bgereg.h Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Aug 31 18:11:50 2010 (r212064) +++ head/sys/dev/bge/if_bge.c Tue Aug 31 18:48:09 2010 (r212065) @@ -2272,7 +2272,7 @@ bge_dma_alloc(struct bge_softc *sc) /* Create parent tag for buffers. */ boundary = 0; if ((sc->bge_flags & BGE_FLAG_4G_BNDRY_BUG) != 0) - boundary = BGE_DMA_4G_BNDRY; + boundary = BGE_DMA_BNDRY; error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), 1, boundary, lowaddr, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Tue Aug 31 18:11:50 2010 (r212064) +++ head/sys/dev/bge/if_bgereg.h Tue Aug 31 18:48:09 2010 (r212065) @@ -2487,10 +2487,14 @@ struct bge_gib { #define BGE_DMA_MAXADDR 0xFFFFFFFFFF #endif +#ifdef PAE +#define BGE_DMA_BNDRY 0x80000000 +#else #if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) -#define BGE_DMA_4G_BNDRY 0x100000000 +#define BGE_DMA_BNDRY 0x100000000 #else -#define BGE_DMA_4G_BNDRY 0 +#define BGE_DMA_BNDRY 0 +#endif #endif /* From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 18:56:22 2010 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 A179C10656B0 for ; Tue, 31 Aug 2010 18:56:22 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay01.ispgateway.de (smtprelay01.ispgateway.de [80.67.18.13]) by mx1.freebsd.org (Postfix) with ESMTP id 356BA8FC1C for ; Tue, 31 Aug 2010 18:56:22 +0000 (UTC) Received: from [78.34.172.129] (helo=r500.local) by smtprelay01.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1OqVol-0006xB-HU; Tue, 31 Aug 2010 20:44:23 +0200 Date: Tue, 31 Aug 2010 20:44:21 +0200 From: Fabian Keil To: Pawel Jakub Dawidek Message-ID: <20100831204421.4ad0a99a@r500.local> In-Reply-To: <201008311041.o7VAfrAF028012@svn.freebsd.org> References: <201008311041.o7VAfrAF028012@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) X-PGP-KEY-URL: http://www.fabiankeil.de/gpg-keys/freebsd-listen-2008-08-18.asc Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_//lmLcAq/u5XAtOsQj94cpsB"; protocol="application/pgp-signature" X-Df-Sender: 775067 Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r212050 - 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, 31 Aug 2010 18:56:22 -0000 --Sig_//lmLcAq/u5XAtOsQj94cpsB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Pawel Jakub Dawidek wrote: > Author: pjd > Date: Tue Aug 31 10:41:53 2010 > New Revision: 212050 > URL: http://svn.freebsd.org/changeset/base/212050 >=20 > Log: > When upgrading a pool which contain root file system, give user a hint = that > he should update boot code. > =20 > MFC after: 2 weeks >=20 > Modified: > head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c >=20 > Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.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/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 09:38= :43 2010 (r212049) > +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 10:41= :53 2010 (r212050) > @@ -3333,12 +3333,39 @@ typedef struct upgrade_cbdata { > int cb_all; > int cb_first; > int cb_newer; > + char cb_poolname[ZPOOL_MAXNAMELEN]; > int cb_argc; > uint64_t cb_version; > char **cb_argv; > } upgrade_cbdata_t; > =20 > static int > +is_root_pool(zpool_handle_t *zhp) > +{ > + static struct statfs sfs; > + static char *poolname =3D NULL; > + static boolean_t stated =3D B_FALSE; Why are those variables static? They all seem to be (re)initialized before first-use in the function. > + char *slash; > + > + while (!stated) { > + stated =3D B_TRUE; > + if (statfs("/", &sfs) =3D=3D -1) { > + (void) fprintf(stderr, > + "Unable to stat root file system: %s.\n", > + strerror(errno)); > + break; > + } > + if (strcmp(sfs.f_fstypename, "zfs") !=3D 0) > + break; > + poolname =3D sfs.f_mntfromname; > + if ((slash =3D strchr(poolname, '/')) !=3D NULL) > + *slash =3D '\0'; > + break; > + } > + return (poolname !=3D NULL && strcmp(poolname, zpool_get_name(zhp)) =3D= =3D 0); > +} This while "loop" doesn't seem to loop at all, is this intended? Fabian --Sig_//lmLcAq/u5XAtOsQj94cpsB Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkx9TYwACgkQBYqIVf93VJ3t0ACffnTnGOAGMyFhLSG06Lct4Z2/ 8KwAn2JyMGLXF9hfZhST4laE4U217h3a =kffu -----END PGP SIGNATURE----- --Sig_//lmLcAq/u5XAtOsQj94cpsB-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 18:58:11 2010 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 03AB61065696 for ; Tue, 31 Aug 2010 18:58:11 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id A0BFB8FC31 for ; Tue, 31 Aug 2010 18:58:10 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 7F21245C9B; Tue, 31 Aug 2010 20:58:08 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 458E545D8D; Tue, 31 Aug 2010 20:58:01 +0200 (CEST) Date: Tue, 31 Aug 2010 20:57:52 +0200 From: Pawel Jakub Dawidek To: Fabian Keil Message-ID: <20100831185752.GA1932@garage.freebsd.pl> References: <201008311041.o7VAfrAF028012@svn.freebsd.org> <20100831204421.4ad0a99a@r500.local> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline In-Reply-To: <20100831204421.4ad0a99a@r500.local> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r212050 - 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, 31 Aug 2010 18:58:11 -0000 --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 31, 2010 at 08:44:21PM +0200, Fabian Keil wrote: > Pawel Jakub Dawidek wrote: > > static int > > +is_root_pool(zpool_handle_t *zhp) > > +{ > > + static struct statfs sfs; > > + static char *poolname =3D NULL; > > + static boolean_t stated =3D B_FALSE; >=20 > Why are those variables static? They all seem to be (re)initialized > before first-use in the function. Not really. We enter while () loop only if stated is false and it will be false only for the first call. By having those variables static we statfs(2) the root file system only once. > > + while (!stated) { > > + stated =3D B_TRUE; > > + if (statfs("/", &sfs) =3D=3D -1) { > > + (void) fprintf(stderr, > > + "Unable to stat root file system: %s.\n", > > + strerror(errno)); > > + break; > > + } > > + if (strcmp(sfs.f_fstypename, "zfs") !=3D 0) > > + break; > > + poolname =3D sfs.f_mntfromname; > > + if ((slash =3D strchr(poolname, '/')) !=3D NULL) > > + *slash =3D '\0'; > > + break; > > + } > > + return (poolname !=3D NULL && strcmp(poolname, zpool_get_name(zhp)) = =3D=3D 0); > > +} >=20 > This while "loop" doesn't seem to loop at all, is this intended? Yes. This is a trick to avoid goto. I don't like tricks in code in general, but I hope the code is readable. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --17pEHd4RhPHOinZp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkx9UK8ACgkQForvXbEpPzS7dQCdFIZ6wn6CO5YwpH7oBq1qQ7j1 j3AAnRKDz8NOiea4PBltE+8JpIvjSzqs =jP5a -----END PGP SIGNATURE----- --17pEHd4RhPHOinZp-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:01:12 2010 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 D10D210656BD; Tue, 31 Aug 2010 19:01:12 +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 63C768FC21; Tue, 31 Aug 2010 19:01:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VJ1CnP038984; Tue, 31 Aug 2010 19:01:12 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VJ1CKx038980; Tue, 31 Aug 2010 19:01:12 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201008311901.o7VJ1CKx038980@svn.freebsd.org> From: Xin LI Date: Tue, 31 Aug 2010 19:01: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: r212066 - in head/sys/boot/i386: efi loader zfsloader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 19:01:13 -0000 Author: delphij Date: Tue Aug 31 19:01:12 2010 New Revision: 212066 URL: http://svn.freebsd.org/changeset/base/212066 Log: For consistency, change all 'i386' and MACHINE_ARCH to x86. Reviewed by: jhb MFC after: 1 week Modified: head/sys/boot/i386/efi/Makefile head/sys/boot/i386/loader/Makefile head/sys/boot/i386/zfsloader/Makefile Modified: head/sys/boot/i386/efi/Makefile ============================================================================== --- head/sys/boot/i386/efi/Makefile Tue Aug 31 18:48:09 2010 (r212065) +++ head/sys/boot/i386/efi/Makefile Tue Aug 31 19:01:12 2010 (r212066) @@ -42,7 +42,7 @@ ${PROG}: ${LDSCRIPT} CLEANFILES= vers.c loader.efi -NEWVERSWHAT= "EFI loader" ${MACHINE_ARCH} +NEWVERSWHAT= "EFI loader" x86 vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Tue Aug 31 18:48:09 2010 (r212065) +++ head/sys/boot/i386/loader/Makefile Tue Aug 31 19:01:12 2010 (r212066) @@ -6,7 +6,7 @@ MK_SSP= no LOADER?= loader PROG= ${LOADER}.sym INTERNALPROG= -NEWVERSWHAT?= "bootstrap loader" i386 +NEWVERSWHAT?= "bootstrap loader" x86 # architecture-specific loader code SRCS= main.c conf.c vers.c Modified: head/sys/boot/i386/zfsloader/Makefile ============================================================================== --- head/sys/boot/i386/zfsloader/Makefile Tue Aug 31 18:48:09 2010 (r212065) +++ head/sys/boot/i386/zfsloader/Makefile Tue Aug 31 19:01:12 2010 (r212066) @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../loader LOADER= zfsloader -NEWVERSWHAT= "ZFS enabled bootstrap loader" i386 +NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 LOADER_ZFS_SUPPORT=yes LOADER_ONLY= yes NO_MAN= yes From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:01:46 2010 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 5FA1F10656A4; Tue, 31 Aug 2010 19:01:46 +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 4EF358FC1E; Tue, 31 Aug 2010 19:01:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VJ1kR7039027; Tue, 31 Aug 2010 19:01:46 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VJ1kGQ039025; Tue, 31 Aug 2010 19:01:46 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008311901.o7VJ1kGQ039025@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 31 Aug 2010 19:01: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: r212067 - 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, 31 Aug 2010 19:01:46 -0000 Author: pjd Date: Tue Aug 31 19:01:46 2010 New Revision: 212067 URL: http://svn.freebsd.org/changeset/base/212067 Log: Eliminate confusing while () loop. In the first version of the code it was there to avoid gotos, but in the current version it serves no purpose. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 19:01:12 2010 (r212066) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 19:01:46 2010 (r212067) @@ -3347,20 +3347,19 @@ is_root_pool(zpool_handle_t *zhp) static boolean_t stated = B_FALSE; char *slash; - while (!stated) { + if (!stated) { stated = B_TRUE; if (statfs("/", &sfs) == -1) { (void) fprintf(stderr, "Unable to stat root file system: %s.\n", strerror(errno)); - break; + return (0); } if (strcmp(sfs.f_fstypename, "zfs") != 0) - break; + return (0); poolname = sfs.f_mntfromname; if ((slash = strchr(poolname, '/')) != NULL) *slash = '\0'; - break; } return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0); } From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:03:05 2010 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 5A1B3106564A for ; Tue, 31 Aug 2010 19:03:05 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 046B58FC19 for ; Tue, 31 Aug 2010 19:03:04 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id C66B045D8D; Tue, 31 Aug 2010 21:03:03 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 9827345CA6; Tue, 31 Aug 2010 21:02:58 +0200 (CEST) Date: Tue, 31 Aug 2010 21:02:50 +0200 From: Pawel Jakub Dawidek To: Fabian Keil Message-ID: <20100831190250.GB1932@garage.freebsd.pl> References: <201008311041.o7VAfrAF028012@svn.freebsd.org> <20100831204421.4ad0a99a@r500.local> <20100831185752.GA1932@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="K8nIJk4ghYZn606h" Content-Disposition: inline In-Reply-To: <20100831185752.GA1932@garage.freebsd.pl> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r212050 - 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, 31 Aug 2010 19:03:05 -0000 --K8nIJk4ghYZn606h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 31, 2010 at 08:57:52PM +0200, Pawel Jakub Dawidek wrote: > On Tue, Aug 31, 2010 at 08:44:21PM +0200, Fabian Keil wrote: > > > + while (!stated) { > > > + stated =3D B_TRUE; > > > + if (statfs("/", &sfs) =3D=3D -1) { > > > + (void) fprintf(stderr, > > > + "Unable to stat root file system: %s.\n", > > > + strerror(errno)); > > > + break; > > > + } > > > + if (strcmp(sfs.f_fstypename, "zfs") !=3D 0) > > > + break; > > > + poolname =3D sfs.f_mntfromname; > > > + if ((slash =3D strchr(poolname, '/')) !=3D NULL) > > > + *slash =3D '\0'; > > > + break; > > > + } > > > + return (poolname !=3D NULL && strcmp(poolname, zpool_get_name(zhp))= =3D=3D 0); > > > +} > >=20 > > This while "loop" doesn't seem to loop at all, is this intended? >=20 > Yes. This is a trick to avoid goto. I don't like tricks in code in > general, but I hope the code is readable. Actually it was there to avoid goto in the first version of the code. In the committed version we don't need goto, so the loop can go away. I eliminated it in r212067. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --K8nIJk4ghYZn606h Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkx9UdkACgkQForvXbEpPzS30ACgliLFgYZYpwru9aOOi5mSiPOO mFkAnRX0Q8C+pOYddHwT6ZggvIJ79QWv =tFx5 -----END PGP SIGNATURE----- --K8nIJk4ghYZn606h-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:05:48 2010 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 A75C610656AD; Tue, 31 Aug 2010 19:05:48 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [80.67.31.36]) by mx1.freebsd.org (Postfix) with ESMTP id 39A2C8FC1A; Tue, 31 Aug 2010 19:05:48 +0000 (UTC) Received: from [78.34.172.129] (helo=r500.local) by smtprelay02.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1OqW9R-0003kt-Jn; Tue, 31 Aug 2010 21:05:45 +0200 Date: Tue, 31 Aug 2010 21:05:47 +0200 From: Fabian Keil To: Pawel Jakub Dawidek Message-ID: <20100831210547.52711617@r500.local> In-Reply-To: <20100831185752.GA1932@garage.freebsd.pl> References: <201008311041.o7VAfrAF028012@svn.freebsd.org> <20100831204421.4ad0a99a@r500.local> <20100831185752.GA1932@garage.freebsd.pl> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) X-PGP-KEY-URL: http://www.fabiankeil.de/gpg-keys/freebsd-listen-2008-08-18.asc Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/YFRJOkttmOWamA47vagVa23"; protocol="application/pgp-signature" X-Df-Sender: 775067 Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r212050 - 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, 31 Aug 2010 19:05:48 -0000 --Sig_/YFRJOkttmOWamA47vagVa23 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Pawel Jakub Dawidek wrote: > On Tue, Aug 31, 2010 at 08:44:21PM +0200, Fabian Keil wrote: > > Pawel Jakub Dawidek wrote: > > > static int > > > +is_root_pool(zpool_handle_t *zhp) > > > +{ > > > + static struct statfs sfs; > > > + static char *poolname =3D NULL; > > > + static boolean_t stated =3D B_FALSE; > >=20 > > Why are those variables static? They all seem to be (re)initialized > > before first-use in the function. >=20 > Not really. We enter while () loop only if stated is false and it will > be false only for the first call. By having those variables static we > statfs(2) the root file system only once. Right, I missed that. Thanks. Fabian --Sig_/YFRJOkttmOWamA47vagVa23 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkx9Uo8ACgkQBYqIVf93VJ3ccACgnB1DUhy8ohoxxN5PL4fk5U0g MzgAoJjgiOCuaCrEsdTvR20flzhzWy1o =qe5q -----END PGP SIGNATURE----- --Sig_/YFRJOkttmOWamA47vagVa23-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:26:29 2010 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 9544D10656A8; Tue, 31 Aug 2010 19:26:29 +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 82E5C8FC16; Tue, 31 Aug 2010 19:26:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VJQT4J039596; Tue, 31 Aug 2010 19:26:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VJQTF3039592; Tue, 31 Aug 2010 19:26:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201008311926.o7VJQTF3039592@svn.freebsd.org> From: John Baldwin Date: Tue, 31 Aug 2010 19:26:29 +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: r212068 - stable/7/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 19:26:29 -0000 Author: jhb Date: Tue Aug 31 19:26:29 2010 New Revision: 212068 URL: http://svn.freebsd.org/changeset/base/212068 Log: MFC 206429: Sync em(4) and igb(4) drivers with 8 except for VF support: - Remove unneeded rxtx handler, make que handler generic in igb. - Do not allocate header mbufs in rx ring if not doing hdr split in igb. - Release the lock in rxeof call to stack. - Change rxeof api for poll friendliness, and eliminate unnecessary link tasklet use. - Move statistics for em into sysctl tree. - Reenable hardware checksum offload for VLAN frames in igb. - Fix for a panic when TX checksum offload is done and a packet has only a header in the first mbuf in em. Approved by: jfv Modified: stable/7/sys/dev/e1000/if_em.c stable/7/sys/dev/e1000/if_igb.c stable/7/sys/dev/e1000/if_igb.h stable/7/sys/dev/e1000/if_lem.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/e1000/if_em.c ============================================================================== --- stable/7/sys/dev/e1000/if_em.c Tue Aug 31 19:01:46 2010 (r212067) +++ stable/7/sys/dev/e1000/if_em.c Tue Aug 31 19:26:29 2010 (r212068) @@ -230,8 +230,9 @@ static void em_free_receive_buffers(stru static void em_enable_intr(struct adapter *); static void em_disable_intr(struct adapter *); static void em_update_stats_counters(struct adapter *); +static void em_add_hw_stats(struct adapter *adapter); static bool em_txeof(struct tx_ring *); -static int em_rxeof(struct rx_ring *, int); +static bool em_rxeof(struct rx_ring *, int, int *); #ifndef __NO_STRICT_ALIGNMENT static int em_fixup_rx(struct rx_ring *); #endif @@ -242,7 +243,6 @@ static bool em_tso_setup(struct tx_ring static void em_set_promisc(struct adapter *); static void em_disable_promisc(struct adapter *); static void em_set_multi(struct adapter *); -static void em_print_hw_stats(struct adapter *); static void em_update_link_status(struct adapter *); static void em_refresh_mbufs(struct rx_ring *, int); static void em_register_vlan(void *, struct ifnet *, u16); @@ -252,11 +252,9 @@ static int em_xmit(struct tx_ring *, str static int em_dma_malloc(struct adapter *, bus_size_t, struct em_dma_alloc *, int); static void em_dma_free(struct adapter *, struct em_dma_alloc *); -static void em_print_debug_info(struct adapter *); +static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS); static void em_print_nvm_info(struct adapter *); static int em_is_valid_ether_addr(u8 *); -static int em_sysctl_stats(SYSCTL_HANDLER_ARGS); -static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS); static int em_sysctl_int_delay(SYSCTL_HANDLER_ARGS); static void em_add_int_delay_sysctl(struct adapter *, const char *, const char *, struct em_int_delay_info *, int, int); @@ -347,8 +345,13 @@ static int em_debug_sbp = FALSE; TUNABLE_INT("hw.em.sbp", &em_debug_sbp); /* Local controls for MSI/MSIX */ +#ifdef EM_MULTIQUEUE static int em_enable_msix = TRUE; static int em_msix_queues = 2; /* for 82574, can be 1 or 2 */ +#else +static int em_enable_msix = FALSE; +static int em_msix_queues = 0; /* disable */ +#endif TUNABLE_INT("hw.em.enable_msix", &em_enable_msix); TUNABLE_INT("hw.em.msix_queues", &em_msix_queues); @@ -447,13 +450,8 @@ em_attach(device_t dev) /* SYSCTL stuff */ SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, - em_sysctl_debug_info, "I", "Debug Information"); - - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, - em_sysctl_stats, "I", "Statistics"); + OID_AUTO, "nvm", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + em_sysctl_nvm_info, "I", "NVM Information"); callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); @@ -651,6 +649,8 @@ em_attach(device_t dev) adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, em_unregister_vlan, adapter, EVENTHANDLER_PRI_FIRST); + em_add_hw_stats(adapter); + /* Non-AMT based hardware can now take control from firmware */ if (adapter->has_manage && !adapter->has_amt) em_get_hw_control(adapter); @@ -1345,18 +1345,19 @@ em_init(void *arg) * Legacy polling routine: note this only works with single queue * *********************************************************************/ -static void +static int em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { struct adapter *adapter = ifp->if_softc; struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; - u32 reg_icr, rx_done = 0; + u32 reg_icr; + int rx_done; EM_CORE_LOCK(adapter); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { EM_CORE_UNLOCK(adapter); - return; + return (0); } if (cmd == POLL_AND_CHECK_STATUS) { @@ -1371,9 +1372,7 @@ em_poll(struct ifnet *ifp, enum poll_cmd } EM_CORE_UNLOCK(adapter); - EM_RX_LOCK(rxr); - rx_done = em_rxeof(rxr, count); - EM_RX_UNLOCK(rxr); + em_rxeof(rxr, count, &rx_done); EM_TX_LOCK(txr); em_txeof(txr); @@ -1386,7 +1385,7 @@ em_poll(struct ifnet *ifp, enum poll_cmd #endif EM_TX_UNLOCK(txr); - return; + return (rx_done); } #endif /* DEVICE_POLLING */ @@ -1445,16 +1444,15 @@ em_handle_que(void *context, int pending struct ifnet *ifp = adapter->ifp; struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; - bool more_rx; + bool more; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - EM_RX_LOCK(rxr); - more_rx = em_rxeof(rxr, adapter->rx_process_limit); - EM_RX_UNLOCK(rxr); + more = em_rxeof(rxr, adapter->rx_process_limit, NULL); EM_TX_LOCK(txr); - em_txeof(txr); + if (em_txeof(txr)) + more = TRUE; #ifdef EM_MULTIQUEUE if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr, NULL); @@ -1463,7 +1461,7 @@ em_handle_que(void *context, int pending em_start_locked(ifp, txr); #endif EM_TX_UNLOCK(txr); - if (more_rx) { + if (more) { taskqueue_enqueue(adapter->tq, &adapter->que_task); return; } @@ -1511,10 +1509,8 @@ em_msix_rx(void *arg) struct adapter *adapter = rxr->adapter; bool more; - EM_RX_LOCK(rxr); ++rxr->rx_irq; - more = em_rxeof(rxr, adapter->rx_process_limit); - EM_RX_UNLOCK(rxr); + more = em_rxeof(rxr, adapter->rx_process_limit, NULL); if (more) taskqueue_enqueue(rxr->tq, &rxr->rx_task); else @@ -1539,7 +1535,7 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { adapter->hw.mac.get_link_status = 1; - taskqueue_enqueue(taskqueue_fast, &adapter->link_task); + em_handle_link(adapter, 0); } else E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC); @@ -1553,9 +1549,7 @@ em_handle_rx(void *context, int pending) struct adapter *adapter = rxr->adapter; bool more; - EM_RX_LOCK(rxr); - more = em_rxeof(rxr, adapter->rx_process_limit); - EM_RX_UNLOCK(rxr); + more = em_rxeof(rxr, adapter->rx_process_limit, NULL); if (more) taskqueue_enqueue(rxr->tq, &rxr->rx_task); else @@ -1744,6 +1738,19 @@ em_xmit(struct tx_ring *txr, struct mbuf do_tso = ((m_head->m_pkthdr.csum_flags & CSUM_TSO) != 0); /* + ** When doing checksum offload, it is critical to + ** make sure the first mbuf has more than header, + ** because that routine expects data to be present. + */ + if ((m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) && + (m_head->m_len < ETHER_HDR_LEN + sizeof(struct ip))) { + m_head = m_pullup(m_head, ETHER_HDR_LEN + sizeof(struct ip)); + *m_headp = m_head; + if (m_head == NULL) + return (ENOBUFS); + } + + /* * TSO workaround: * If an mbuf is only header we need * to pull 4 bytes of data into it. @@ -2069,9 +2076,6 @@ em_local_timer(void *arg) if (e1000_get_laa_state_82571(&adapter->hw) == TRUE) e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); - if (em_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING) - em_print_hw_stats(adapter); - /* ** Check for time since any descriptor was cleaned */ @@ -2431,11 +2435,6 @@ em_allocate_msix(struct adapter *adapter adapter->linkvec = vector; adapter->ivars |= (8 | vector) << 16; adapter->ivars |= 0x80000000; - TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); - adapter->tq = taskqueue_create_fast("em_link", M_NOWAIT, - taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s linkq", - device_get_nameunit(adapter->dev)); return (0); } @@ -3276,6 +3275,7 @@ em_transmit_checksum_setup(struct tx_rin cmd = hdr_len = ipproto = 0; + *txd_upper = *txd_lower = 0; cur = txr->next_avail_desc; /* @@ -3319,29 +3319,21 @@ em_transmit_checksum_setup(struct tx_rin *txd_upper |= E1000_TXD_POPTS_IXSM << 8; } - if (mp->m_len < ehdrlen + ip_hlen) - return; /* failure */ - hdr_len = ehdrlen + ip_hlen; ipproto = ip->ip_p; - break; + case ETHERTYPE_IPV6: ip6 = (struct ip6_hdr *)(mp->m_data + ehdrlen); ip_hlen = sizeof(struct ip6_hdr); /* XXX: No header stacking. */ - if (mp->m_len < ehdrlen + ip_hlen) - return; /* failure */ - /* IPv6 doesn't have a header checksum. */ hdr_len = ehdrlen + ip_hlen; ipproto = ip6->ip6_nxt; - break; + default: - *txd_upper = 0; - *txd_lower = 0; return; } @@ -3395,6 +3387,8 @@ em_transmit_checksum_setup(struct tx_rin break; } + if (TXD == NULL) + return; TXD->tcp_seg_setup.data = htole32(0); TXD->cmd_and_length = htole32(adapter->txd_cmd | E1000_TXD_CMD_DEXT | cmd); @@ -4090,8 +4084,8 @@ em_initialize_receive_unit(struct adapte * * For polling we also now return the number of cleaned packets *********************************************************************/ -static int -em_rxeof(struct rx_ring *rxr, int count) +static bool +em_rxeof(struct rx_ring *rxr, int count, int *done) { struct adapter *adapter = rxr->adapter; struct ifnet *ifp = adapter->ifp; @@ -4102,7 +4096,7 @@ em_rxeof(struct rx_ring *rxr, int count) bool eop; struct e1000_rx_desc *cur; - EM_RX_LOCK_ASSERT(rxr); + EM_RX_LOCK(rxr); for (i = rxr->next_to_check, processed = 0; count != 0;) { @@ -4196,8 +4190,13 @@ skip: i = 0; /* Send to the stack */ - if (sendmp != NULL) + if (sendmp != NULL) { + rxr->next_to_check = i; + EM_RX_UNLOCK(rxr); (*ifp->if_input)(ifp, sendmp); + EM_RX_LOCK(rxr); + i = rxr->next_to_check; + } /* Only refresh mbufs every 8 descriptors */ if (processed == 8) { @@ -4213,12 +4212,11 @@ skip: } rxr->next_to_check = i; + if (done != NULL) + *done = rxdone; + EM_RX_UNLOCK(rxr); -#ifdef DEVICE_POLLING - return (rxdone); -#else return ((status & E1000_RXD_STAT_DD) ? TRUE : FALSE); -#endif } #ifndef __NO_STRICT_ALIGNMENT @@ -4869,114 +4867,285 @@ em_update_stats_counters(struct adapter } -/********************************************************************** - * - * This routine is called only when em_display_debug_stats is enabled. - * This routine provides a way to take a look at important statistics - * maintained by the driver and hardware. - * - **********************************************************************/ +/* + * Add sysctl variables, one per statistic, to the system. + */ static void -em_print_debug_info(struct adapter *adapter) +em_add_hw_stats(struct adapter *adapter) { + device_t dev = adapter->dev; - u8 *hw_addr = adapter->hw.hw_addr; - struct rx_ring *rxr = adapter->rx_rings; - struct tx_ring *txr = adapter->tx_rings; - device_printf(dev, "Adapter hardware address = %p \n", hw_addr); - device_printf(dev, "CTRL = 0x%x RCTL = 0x%x \n", - E1000_READ_REG(&adapter->hw, E1000_CTRL), - E1000_READ_REG(&adapter->hw, E1000_RCTL)); - device_printf(dev, "Packet buffer = Tx=%dk Rx=%dk \n", - ((E1000_READ_REG(&adapter->hw, E1000_PBA) & 0xffff0000) >> 16),\ - (E1000_READ_REG(&adapter->hw, E1000_PBA) & 0xffff) ); - device_printf(dev, "Flow control watermarks high = %d low = %d\n", - adapter->hw.fc.high_water, - adapter->hw.fc.low_water); - device_printf(dev, "tx_int_delay = %d, tx_abs_int_delay = %d\n", - E1000_READ_REG(&adapter->hw, E1000_TIDV), - E1000_READ_REG(&adapter->hw, E1000_TADV)); - device_printf(dev, "rx_int_delay = %d, rx_abs_int_delay = %d\n", - E1000_READ_REG(&adapter->hw, E1000_RDTR), - E1000_READ_REG(&adapter->hw, E1000_RADV)); + struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev); + struct sysctl_oid *tree = device_get_sysctl_tree(dev); + struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree); + struct e1000_hw_stats *stats = &adapter->stats; + + struct sysctl_oid *stat_node, *int_node, *host_node; + struct sysctl_oid_list *stat_list, *int_list, *host_list; + + /* Driver Statistics */ + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "link_irq", + CTLFLAG_RD, &adapter->link_irq, 0, + "Link MSIX IRQ Handled"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_alloc_fail", + CTLFLAG_RD, &adapter->mbuf_alloc_failed, + "Std mbuf failed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "cluster_alloc_fail", + CTLFLAG_RD, &adapter->mbuf_cluster_failed, + "Std mbuf cluster failed"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", + CTLFLAG_RD, &adapter->dropped_pkts, + "Driver dropped packets"); + SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", + CTLFLAG_RD, &adapter->no_tx_dma_setup, + "Driver tx dma failure in xmit"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_high_water", + CTLFLAG_RD, &adapter->hw.fc.high_water, 0, + "Flow Control High Watermark"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "fc_low_water", + CTLFLAG_RD, &adapter->hw.fc.low_water, 0, + "Flow Control Low Watermark"); + + /* MAC stats get the own sub node */ + + stat_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "mac_stats", + CTLFLAG_RD, NULL, "Statistics"); + stat_list = SYSCTL_CHILDREN(stat_node); + + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "excess_coll", + CTLFLAG_RD, &stats->ecol, + "Excessive collisions"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "symbol_errors", + CTLFLAG_RD, &adapter->stats.symerrs, + "Symbol Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "sequence_errors", + CTLFLAG_RD, &adapter->stats.sec, + "Sequence Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "defer_count", + CTLFLAG_RD, &adapter->stats.dc, + "Defer Count"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "missed_packets", + CTLFLAG_RD, &adapter->stats.mpc, + "Missed Packets"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_no_buff", + CTLFLAG_RD, &adapter->stats.rnbc, + "Receive No Buffers"); + /* RLEC is inaccurate on some hardware, calculate our own. */ +/* SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_len_errs", */ +/* CTLFLAG_RD, adapter->stats.roc + adapter->stats.ruc, */ +/* "Receive Length Errors"); */ + + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "recv_errs", + CTLFLAG_RD, &adapter->stats.rxerrc, + "Receive Errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "crc_errs", + CTLFLAG_RD, &adapter->stats.crcerrs, + "CRC errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "alignment_errs", + CTLFLAG_RD, &adapter->stats.algnerrc, + "Alignment Errors"); + /* On 82575 these are collision counts */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "coll_ext_errs", + CTLFLAG_RD, &adapter->stats.cexterr, + "Collision/Carrier extension errors"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_overruns", + CTLFLAG_RD, &adapter->rx_overruns, + "RX overruns"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "watchdog_timeouts", + CTLFLAG_RD, &adapter->watchdog_events, + "Watchdog timeouts"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_recvd", + CTLFLAG_RD, &adapter->stats.xonrxc, + "XON Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xon_txd", + CTLFLAG_RD, &adapter->stats.xontxc, + "XON Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_recvd", + CTLFLAG_RD, &adapter->stats.xoffrxc, + "XOFF Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "xoff_txd", + CTLFLAG_RD, &adapter->stats.xofftxc, + "XOFF Transmitted"); + + /* Packet Reception Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_recvd", + CTLFLAG_RD, &adapter->stats.tpr, + "Total Packets Received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_recvd", + CTLFLAG_RD, &adapter->stats.gprc, + "Good Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_recvd", + CTLFLAG_RD, &adapter->stats.bprc, + "Broadcast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_recvd", + CTLFLAG_RD, &adapter->stats.mprc, + "Multicast Packets Received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_64", + CTLFLAG_RD, &adapter->stats.prc64, + "64 byte frames received "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_65_127", + CTLFLAG_RD, &adapter->stats.prc127, + "65-127 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_128_255", + CTLFLAG_RD, &adapter->stats.prc255, + "128-255 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_256_511", + CTLFLAG_RD, &adapter->stats.prc511, + "256-511 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_512_1023", + CTLFLAG_RD, &adapter->stats.prc1023, + "512-1023 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "rx_frames_1024_1522", + CTLFLAG_RD, &adapter->stats.prc1522, + "1023-1522 byte frames received"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octets_recvd", + CTLFLAG_RD, &adapter->stats.gorc, + "Good Octets Received"); + + /* Packet Transmission Stats */ + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_octest_txd", + CTLFLAG_RD, &adapter->stats.gotc, + "Good Octest Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "total_pkts_txd", + CTLFLAG_RD, &adapter->stats.tpt, + "Total Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "good_pkts_txd", + CTLFLAG_RD, &adapter->stats.gptc, + "Good Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "bcast_pkts_txd", + CTLFLAG_RD, &adapter->stats.bptc, + "Broadcast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "mcast_pkts_txd", + CTLFLAG_RD, &adapter->stats.mptc, + "Multicast Packets Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_64", + CTLFLAG_RD, &adapter->stats.ptc64, + "64 byte frames transmitted "); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_65_127", + CTLFLAG_RD, &adapter->stats.ptc127, + "65-127 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_128_255", + CTLFLAG_RD, &adapter->stats.ptc255, + "128-255 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_256_511", + CTLFLAG_RD, &adapter->stats.ptc511, + "256-511 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_512_1023", + CTLFLAG_RD, &adapter->stats.ptc1023, + "512-1023 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tx_frames_1024_1522", + CTLFLAG_RD, &adapter->stats.ptc1522, + "1024-1522 byte frames transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_txd", + CTLFLAG_RD, &adapter->stats.tsctc, + "TSO Contexts Transmitted"); + SYSCTL_ADD_QUAD(ctx, stat_list, OID_AUTO, "tso_ctx_fail", + CTLFLAG_RD, &adapter->stats.tsctfc, + "TSO Contexts Failed"); + + + /* Interrupt Stats */ + + int_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "interrupts", + CTLFLAG_RD, NULL, "Interrupt Statistics"); + int_list = SYSCTL_CHILDREN(int_node); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "asserts", + CTLFLAG_RD, &adapter->stats.iac, + "Interrupt Assertion Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_pkt_timer", + CTLFLAG_RD, &adapter->stats.icrxptc, + "Interrupt Cause Rx Pkt Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_abs_timer", + CTLFLAG_RD, &adapter->stats.icrxatc, + "Interrupt Cause Rx Abs Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_pkt_timer", + CTLFLAG_RD, &adapter->stats.ictxptc, + "Interrupt Cause Tx Pkt Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_abs_timer", + CTLFLAG_RD, &adapter->stats.ictxatc, + "Interrupt Cause Tx Abs Timer Expire Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_queue_empty", + CTLFLAG_RD, &adapter->stats.ictxqec, + "Interrupt Cause Tx Queue Empty Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "tx_queue_min_thresh", + CTLFLAG_RD, &adapter->stats.ictxqmtc, + "Interrupt Cause Tx Queue Min Thresh Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_desc_min_thresh", + CTLFLAG_RD, &adapter->stats.icrxdmtc, + "Interrupt Cause Rx Desc Min Thresh Count"); + + SYSCTL_ADD_QUAD(ctx, int_list, OID_AUTO, "rx_overrun", + CTLFLAG_RD, &adapter->stats.icrxoc, + "Interrupt Cause Receiver Overrun Count"); + + /* Host to Card Stats */ + + host_node = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "host", + CTLFLAG_RD, NULL, + "Host to Card Statistics"); + + host_list = SYSCTL_CHILDREN(host_node); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_tx_pkt", + CTLFLAG_RD, &adapter->stats.cbtmpc, + "Circuit Breaker Tx Packet Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "host_tx_pkt_discard", + CTLFLAG_RD, &adapter->stats.htdpmc, + "Host Transmit Discarded Packets"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "rx_pkt", + CTLFLAG_RD, &adapter->stats.rpthc, + "Rx Packets To Host"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_rx_pkts", + CTLFLAG_RD, &adapter->stats.cbrmpc, + "Circuit Breaker Rx Packet Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_rx_pkt_drop", + CTLFLAG_RD, &adapter->stats.cbrdpc, + "Circuit Breaker Rx Dropped Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "tx_good_pkt", + CTLFLAG_RD, &adapter->stats.hgptc, + "Host Good Packets Tx Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "breaker_tx_pkt_drop", + CTLFLAG_RD, &adapter->stats.htcbdpc, + "Host Tx Circuit Breaker Dropped Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "rx_good_bytes", + CTLFLAG_RD, &adapter->stats.hgorc, + "Host Good Octets Received Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "tx_good_bytes", + CTLFLAG_RD, &adapter->stats.hgotc, + "Host Good Octets Transmit Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "length_errors", + CTLFLAG_RD, &adapter->stats.lenerrs, + "Length Errors"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "serdes_violation_pkt", + CTLFLAG_RD, &adapter->stats.scvpc, + "SerDes/SGMII Code Violation Pkt Count"); + + SYSCTL_ADD_QUAD(ctx, host_list, OID_AUTO, "header_redir_missed", + CTLFLAG_RD, &adapter->stats.hrmpc, + "Header Redirection Missed Packet Count"); - for (int i = 0; i < adapter->num_queues; i++, txr++) { - device_printf(dev, "Queue(%d) tdh = %d, tdt = %d\n", i, - E1000_READ_REG(&adapter->hw, E1000_TDH(i)), - E1000_READ_REG(&adapter->hw, E1000_TDT(i))); - device_printf(dev, "TX(%d) no descriptors avail event = %ld\n", - txr->me, txr->no_desc_avail); - device_printf(dev, "TX(%d) MSIX IRQ Handled = %ld\n", - txr->me, txr->tx_irq); - device_printf(dev, "Num Tx descriptors avail = %d\n", - txr->tx_avail); - device_printf(dev, "Tx Descriptors not avail1 = %ld\n", - txr->no_desc_avail); - } - for (int i = 0; i < adapter->num_queues; i++, rxr++) { - device_printf(dev, "RX(%d) MSIX IRQ Handled = %ld\n", - rxr->me, rxr->rx_irq); - device_printf(dev, "hw rdh = %d, hw rdt = %d\n", - E1000_READ_REG(&adapter->hw, E1000_RDH(i)), - E1000_READ_REG(&adapter->hw, E1000_RDT(i))); - } - device_printf(dev, "Std mbuf failed = %ld\n", - adapter->mbuf_alloc_failed); - device_printf(dev, "Std mbuf cluster failed = %ld\n", - adapter->mbuf_cluster_failed); - device_printf(dev, "Driver dropped packets = %ld\n", - adapter->dropped_pkts); -} -static void -em_print_hw_stats(struct adapter *adapter) -{ - device_t dev = adapter->dev; - device_printf(dev, "Excessive collisions = %lld\n", - (long long)adapter->stats.ecol); -#if (DEBUG_HW > 0) /* Dont output these errors normally */ - device_printf(dev, "Symbol errors = %lld\n", - (long long)adapter->stats.symerrs); -#endif - device_printf(dev, "Sequence errors = %lld\n", - (long long)adapter->stats.sec); - device_printf(dev, "Defer count = %lld\n", - (long long)adapter->stats.dc); - device_printf(dev, "Missed Packets = %lld\n", - (long long)adapter->stats.mpc); - device_printf(dev, "Receive No Buffers = %lld\n", - (long long)adapter->stats.rnbc); - /* RLEC is inaccurate on some hardware, calculate our own. */ - device_printf(dev, "Receive Length Errors = %lld\n", - ((long long)adapter->stats.roc + (long long)adapter->stats.ruc)); - device_printf(dev, "Receive errors = %lld\n", - (long long)adapter->stats.rxerrc); - device_printf(dev, "Crc errors = %lld\n", - (long long)adapter->stats.crcerrs); - device_printf(dev, "Alignment errors = %lld\n", - (long long)adapter->stats.algnerrc); - device_printf(dev, "Collision/Carrier extension errors = %lld\n", - (long long)adapter->stats.cexterr); - device_printf(dev, "watchdog timeouts = %ld\n", - adapter->watchdog_events); - device_printf(dev, "XON Rcvd = %lld\n", - (long long)adapter->stats.xonrxc); - device_printf(dev, "XON Xmtd = %lld\n", - (long long)adapter->stats.xontxc); - device_printf(dev, "XOFF Rcvd = %lld\n", - (long long)adapter->stats.xoffrxc); - device_printf(dev, "XOFF Xmtd = %lld\n", - (long long)adapter->stats.xofftxc); - device_printf(dev, "Good Packets Rcvd = %lld\n", - (long long)adapter->stats.gprc); - device_printf(dev, "Good Packets Xmtd = %lld\n", - (long long)adapter->stats.gptc); - device_printf(dev, "TSO Contexts Xmtd = %lld\n", - (long long)adapter->stats.tsctc); - device_printf(dev, "TSO Contexts Failed = %lld\n", - (long long)adapter->stats.tsctfc); } /********************************************************************** @@ -4986,28 +5155,9 @@ em_print_hw_stats(struct adapter *adapte * 32 words, stuff that matters is in that extent. * **********************************************************************/ -static void -em_print_nvm_info(struct adapter *adapter) -{ - u16 eeprom_data; - int i, j, row = 0; - - /* Its a bit crude, but it gets the job done */ - printf("\nInterface EEPROM Dump:\n"); - printf("Offset\n0x0000 "); - for (i = 0, j = 0; i < 32; i++, j++) { - if (j == 8) { /* Make the offset block */ - j = 0; ++row; - printf("\n0x00%x0 ",row); - } - e1000_read_nvm(&adapter->hw, i, 1, &eeprom_data); - printf("%04x ", eeprom_data); - } - printf("\n"); -} static int -em_sysctl_debug_info(SYSCTL_HANDLER_ARGS) +em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) { struct adapter *adapter; int error; @@ -5019,16 +5169,12 @@ em_sysctl_debug_info(SYSCTL_HANDLER_ARGS if (error || !req->newptr) return (error); - if (result == 1) { - adapter = (struct adapter *)arg1; - em_print_debug_info(adapter); - } /* * This value will cause a hex dump of the * first 32 16-bit words of the EEPROM to * the screen. */ - if (result == 2) { + if (result == 1) { adapter = (struct adapter *)arg1; em_print_nvm_info(adapter); } @@ -5036,26 +5182,24 @@ em_sysctl_debug_info(SYSCTL_HANDLER_ARGS return (error); } - -static int -em_sysctl_stats(SYSCTL_HANDLER_ARGS) +static void +em_print_nvm_info(struct adapter *adapter) { - struct adapter *adapter; - int error; - int result; - - result = -1; - error = sysctl_handle_int(oidp, &result, 0, req); - - if (error || !req->newptr) - return (error); + u16 eeprom_data; + int i, j, row = 0; - if (result == 1) { - adapter = (struct adapter *)arg1; - em_print_hw_stats(adapter); + /* Its a bit crude, but it gets the job done */ + printf("\nInterface EEPROM Dump:\n"); + printf("Offset\n0x0000 "); + for (i = 0, j = 0; i < 32; i++, j++) { + if (j == 8) { /* Make the offset block */ + j = 0; ++row; + printf("\n0x00%x0 ",row); + } + e1000_read_nvm(&adapter->hw, i, 1, &eeprom_data); + printf("%04x ", eeprom_data); } - - return (error); + printf("\n"); } static int Modified: stable/7/sys/dev/e1000/if_igb.c ============================================================================== --- stable/7/sys/dev/e1000/if_igb.c Tue Aug 31 19:01:46 2010 (r212067) +++ stable/7/sys/dev/e1000/if_igb.c Tue Aug 31 19:26:29 2010 (r212068) @@ -99,7 +99,7 @@ int igb_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char igb_driver_version[] = "version - 1.9.5"; +char igb_driver_version[] = "version - 1.9.6"; /********************************************************************* @@ -205,7 +205,7 @@ static __inline void igb_rx_discard(stru static __inline void igb_rx_input(struct rx_ring *, struct ifnet *, struct mbuf *, u32); -static bool igb_rxeof(struct igb_queue *, int); +static bool igb_rxeof(struct igb_queue *, int, int *); static void igb_rx_checksum(u32, struct mbuf *, u32); static int igb_tx_ctx_setup(struct tx_ring *, struct mbuf *); static bool igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *); @@ -238,7 +238,6 @@ static void igb_led_func(void *, int static int igb_irq_fast(void *); static void igb_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); -static void igb_handle_rxtx(void *context, int pending); static void igb_handle_que(void *context, int pending); static void igb_handle_link(void *context, int pending); @@ -813,21 +812,25 @@ igb_start(struct ifnet *ifp) static int igb_mq_start(struct ifnet *ifp, struct mbuf *m) { - struct adapter *adapter = ifp->if_softc; - struct tx_ring *txr; - int i = 0, err = 0; + struct adapter *adapter = ifp->if_softc; + struct igb_queue *que; + struct tx_ring *txr; + int i = 0, err = 0; /* Which queue to use */ if ((m->m_flags & M_FLOWID) != 0) i = m->m_pkthdr.flowid % adapter->num_queues; txr = &adapter->tx_rings[i]; + que = &adapter->queues[i]; if (IGB_TX_TRYLOCK(txr)) { err = igb_mq_start_locked(ifp, txr, m); IGB_TX_UNLOCK(txr); - } else + } else { err = drbr_enqueue(ifp, txr->br, m); + taskqueue_enqueue(que->tq, &que->que_task); + } return (err); } @@ -1220,50 +1223,24 @@ igb_init(void *arg) static void -igb_handle_rxtx(void *context, int pending) -{ - struct igb_queue *que = context; - struct adapter *adapter = que->adapter; - struct tx_ring *txr = adapter->tx_rings; - struct ifnet *ifp; - - ifp = adapter->ifp; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (igb_rxeof(que, adapter->rx_process_limit)) - taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); - IGB_TX_LOCK(txr); - igb_txeof(txr); - -#if __FreeBSD_version >= 800000 - if (!drbr_empty(ifp, txr->br)) - igb_mq_start_locked(ifp, txr, NULL); -#else - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - igb_start_locked(txr, ifp); -#endif - IGB_TX_UNLOCK(txr); - } - - igb_enable_intr(adapter); -} - -static void igb_handle_que(void *context, int pending) { struct igb_queue *que = context; struct adapter *adapter = que->adapter; struct tx_ring *txr = que->txr; struct ifnet *ifp = adapter->ifp; - bool more; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - more = igb_rxeof(que, -1); + bool more; + + more = igb_rxeof(que, -1, NULL); IGB_TX_LOCK(txr); - igb_txeof(txr); + if (igb_txeof(txr)) + more = TRUE; #if __FreeBSD_version >= 800000 - igb_mq_start_locked(ifp, txr, NULL); + if (!drbr_empty(ifp, txr->br)) + igb_mq_start_locked(ifp, txr, NULL); #else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); @@ -1275,11 +1252,15 @@ igb_handle_que(void *context, int pendin } } - /* Reenable this interrupt */ #ifdef DEVICE_POLLING - if (!(ifp->if_capenable & IFCAP_POLLING)) + if (ifp->if_capenable & IFCAP_POLLING) + return; #endif - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, que->eims); + /* Reenable this interrupt */ + if (que->eims) + E1000_WRITE_REG(&adapter->hw, E1000_EIMS, que->eims); + else + igb_enable_intr(adapter); } /* Deal with link in a sleepable context */ @@ -1301,8 +1282,9 @@ igb_handle_link(void *context, int pendi static int igb_irq_fast(void *arg) { - struct adapter *adapter = arg; - uint32_t reg_icr; + struct adapter *adapter = arg; + struct igb_queue *que = adapter->queues; + u32 reg_icr; reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); @@ -1324,11 +1306,11 @@ igb_irq_fast(void *arg) * MSI message reordering errata on certain systems. */ igb_disable_intr(adapter); - taskqueue_enqueue(adapter->tq, &adapter->rxtx_task); + taskqueue_enqueue(que->tq, &que->que_task); /* Link status change */ if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) - taskqueue_enqueue(adapter->tq, &adapter->link_task); + taskqueue_enqueue(que->tq, &adapter->link_task); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; @@ -1368,15 +1350,14 @@ igb_poll(struct ifnet *ifp, enum poll_cm reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); /* Link status change */ if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) - taskqueue_enqueue(adapter->tq, &adapter->link_task); + igb_handle_link(adapter, 0); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; } IGB_CORE_UNLOCK(adapter); - /* TODO: rx_count */ - rx_done = igb_rxeof(que, count) ? 1 : 0; + igb_rxeof(que, count, &rx_done); IGB_TX_LOCK(txr); do { @@ -1416,7 +1397,7 @@ igb_msix_que(void *arg) more_tx = igb_txeof(txr); IGB_TX_UNLOCK(txr); - more_rx = igb_rxeof(que, adapter->rx_process_limit); + more_rx = igb_rxeof(que, adapter->rx_process_limit, NULL); if (igb_enable_aim == FALSE) goto no_calc; @@ -1496,7 +1477,7 @@ igb_msix_link(void *arg) icr = E1000_READ_REG(&adapter->hw, E1000_ICR); if (!(icr & E1000_ICR_LSC)) goto spurious; - taskqueue_enqueue(adapter->tq, &adapter->link_task); + igb_handle_link(adapter, 0); spurious: /* Rearm */ @@ -1914,11 +1895,6 @@ igb_local_timer(void *arg) goto timeout; } - /* Trigger an RX interrupt on all queues */ -#ifdef DEVICE_POLLING *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:34:37 2010 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 BF1E510656C5; Tue, 31 Aug 2010 19:34:37 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 703AE8FC18; Tue, 31 Aug 2010 19:34:37 +0000 (UTC) Received: by pvg4 with SMTP id 4so3051516pvg.13 for ; Tue, 31 Aug 2010 12:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=nc5Z+fI6KDgIHtT9rtzIK+OdGH5ebVRmagpP1WKgLw0=; b=VMfR8ahI5IgSWaXgue8lvpAfOUECqAzp3oYSPR/9vahirxcEncYUyKHTuY/ZumyHnS nAKOAr37MoCcrC7uTlrc7F1P91+vo4tiHCnJrDmom1Zzurlm6duSobAj7Ka0g2BFAgHp T+sy2nQJysDwsiaJXWil6AdTYss5IeduYkd6c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=QAa5JusUCj082o+qSC/prGc9nKqwsC+VK26nLhqGhAflZ7L7XPK5EkN88ihlWYoZ0c bozN5irL2iGFWO3tesUqgA9VV/xwk0N4pehiN376kP/GYZzEJ2Qr7HjUvh8Ykz0RzCqu 3hN1UPGqC0uC5DjoA1wiRtaLuIsuRpvgzbWAk= Received: by 10.114.111.5 with SMTP id j5mr3238274wac.28.1283283276241; Tue, 31 Aug 2010 12:34:36 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id o17sm10779474wal.21.2010.08.31.12.34.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 31 Aug 2010 12:34:34 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Tue, 31 Aug 2010 12:34:09 -0700 From: Pyun YongHyeon Date: Tue, 31 Aug 2010 12:34:09 -0700 To: Alexander Message-ID: <20100831193409.GB9903@michelle.cdnetworks.com> References: <201008310019.o7V0J39f012648@svn.freebsd.org> <20100831084348.1791378cih2dfssg@cakebox.homeunix.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100831084348.1791378cih2dfssg@cakebox.homeunix.net> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org, Pyun YongHyeon Subject: Re: svn commit: r212041 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: "SVN commit messages 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, 31 Aug 2010 19:34:37 -0000 On Tue, Aug 31, 2010 at 08:43:48AM +0200, Alexander wrote: > Can we name the known examples somewhere? > Do you have suggestion for somewhere? Personally I think man page is one of best place to put these kind of knobs. > ----- Message from yongari@FreeBSD.org --------- > Date: Tue, 31 Aug 2010 00:19:03 +0000 (UTC) > From: Pyun YongHyeon > Subject: svn commit: r212041 - stable/8/share/man/man4 > To: src-committers@freebsd.org, svn-src-all@freebsd.org, > svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org > > > >Author: yongari > >Date: Tue Aug 31 00:19:03 2010 > >New Revision: 212041 > >URL: http://svn.freebsd.org/changeset/base/212041 > > > >Log: > > MFC r211650,211667: > > r211650: > > Document tunable dev.rl.%unit.prefer_iomap > > > > r211667: > > Better wording and fix wrong explanation. > > > > Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) > > > >Modified: > > stable/8/share/man/man4/rl.4 > >Directory Properties: > > stable/8/share/man/man4/ (props changed) > > > >Modified: stable/8/share/man/man4/rl.4 > >============================================================================== > >--- stable/8/share/man/man4/rl.4 Tue Aug 31 00:16:30 2010 (r212040) > >+++ stable/8/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) > >@@ -30,7 +30,7 @@ > > .\" > > .\" $FreeBSD$ > > .\" > >-.Dd November 1, 2008 > >+.Dd August 22, 2010 > > .Dt RL 4 > > .Os > > .Sh NAME > >@@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C > > .El > > .Sh LOADER TUNABLES > > .Bl -tag -width indent > >+.It Va dev.rl.%unit.prefer_iomap > >+This tunable controls which register mapping should be used on the > >+specified device. > >+A non-zero value enables I/O space register mapping. > >+For controllers that have no I/O space register mapping this tunable > >+should be set to 0 to use memory space register mapping. > >+The default value is 1 to use I/O space register mapping. > > .It Va dev.rl.%unit.twister_enable > > Non-zero value enables the long cable tuning on the specified device. > > Disabled by default. > >_______________________________________________ > >svn-src-stable-8@freebsd.org mailing list > >http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > >To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.org" > > > > > ----- End message from yongari@FreeBSD.org ----- > > > > ======================================================================== > # _ __ _ __ http://www.nagilum.org/ \n icq://69646724 # > # / |/ /__ ____ _(_) /_ ____ _ nagilum@nagilum.org \n +491776461165 # > # / / _ `/ _ `/ / / // / ' \ Amiga (68k/PPC): AOS/NetBSD/Linux # > # /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/ Mac (PPC): MacOS-X / Linux / MacOS-X # > # /___/ x86: FreeBSD/Linux/Solaris/Win2k ARM9: EPOC EV6 # > ======================================================================== > > > ---------------------------------------------------------------- > cakebox.homeunix.net - all the machine one needs.. From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:40:23 2010 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 0F1ED10656B4; Tue, 31 Aug 2010 19:40:23 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D25A48FC12; Tue, 31 Aug 2010 19:40:22 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 61AD646B66; Tue, 31 Aug 2010 15:40:22 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id CA2BF8A03C; Tue, 31 Aug 2010 15:40:09 -0400 (EDT) From: John Baldwin To: Dimitry Andric Date: Tue, 31 Aug 2010 15:37:51 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201008311811.o7VIBoC5037894@svn.freebsd.org> In-Reply-To: <201008311811.o7VIBoC5037894@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201008311537.51825.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 31 Aug 2010 15:40:09 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 19:40:23 -0000 On Tuesday, August 31, 2010 2:11:50 pm Dimitry Andric wrote: > Author: dim > Date: Tue Aug 31 18:11:50 2010 > New Revision: 212064 > URL: http://svn.freebsd.org/changeset/base/212064 > > Log: > Avoid directly manipulating a NULL pointer (which could result in > undefined behaviour) in sys/boot/pc98/boot2/boot2.c. > > Reviewed by: nyan > Approved by: rpaulo (mentor) > > Modified: > head/sys/boot/pc98/boot2/boot2.c > > Modified: head/sys/boot/pc98/boot2/boot2.c > ============================================================================== > --- head/sys/boot/pc98/boot2/boot2.c Tue Aug 31 17:43:47 2010 (r212063) > +++ head/sys/boot/pc98/boot2/boot2.c Tue Aug 31 18:11:50 2010 (r212064) > @@ -187,9 +187,9 @@ xfsread(ino_t inode, void *buf, size_t n > static inline uint32_t > memsize(void) > { > - u_char *p = (u_char *)PTOV(0); > + u_char *p = (u_char *)PTOV(0x401); > > - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; > + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; > } Perhaps replace '(p + 0x594 - 0x401)' with just 'PTOV(0x594)'? I would actually find it cleaner to remove 'p' altogether perhaps: return (*(u_char *)PTOV(0x401) * 128 * 1024 + *(uint16_t *)PTOV(0x594) * 1024 * 1024); -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:40:24 2010 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 8C3A410656BB; Tue, 31 Aug 2010 19:40:24 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 589798FC28; Tue, 31 Aug 2010 19:40:24 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id EE00646B46; Tue, 31 Aug 2010 15:40:23 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id F008E8A04E; Tue, 31 Aug 2010 15:40:22 -0400 (EDT) From: John Baldwin To: Matthew Jacob Date: Tue, 31 Aug 2010 15:39:56 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201008311733.o7VHXmxX037013@svn.freebsd.org> <201008311350.17175.jhb@freebsd.org> <4C7D41E9.7060907@feral.com> In-Reply-To: <4C7D41E9.7060907@feral.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201008311539.57185.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 31 Aug 2010 15:40:23 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Pyun YongHyeon Subject: Re: svn commit: r212061 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 19:40:24 -0000 On Tuesday, August 31, 2010 1:54:49 pm Matthew Jacob wrote: > But not amd64 please. > > > Keep in mind the PAE case where you cannot effectively specify a 4GB > > boundary. I used a 2GB boundary for twa(4) in the PAE case to deal > > with the boundary issue. Probably though, bus_dma should just always > > enforce a 4GB boundary, at least on x86. Yes, thinking about this more, only i386 + PAE is special. All other cases could represent the 4GB boundary restriction in a bus dma tag for the PCI bus (or in the platform-specific Host-PCI bridge drivers). For i386 + PAE it might make sense to always enforce a 4GB boundary in the bus_dma code itself. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:49:32 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 7590310656A9; Tue, 31 Aug 2010 19:49:32 +0000 (UTC) Date: Tue, 31 Aug 2010 19:49:32 +0000 From: Alexander Best To: Xin LI Message-ID: <20100831194932.GA21692@freebsd.org> References: <201008311901.o7VJ1CKx038980@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201008311901.o7VJ1CKx038980@svn.freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212066 - in head/sys/boot/i386: efi loader zfsloader X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 19:49:32 -0000 On Tue Aug 31 10, Xin LI wrote: > Author: delphij > Date: Tue Aug 31 19:01:12 2010 > New Revision: 212066 > URL: http://svn.freebsd.org/changeset/base/212066 > > Log: > For consistency, change all 'i386' and MACHINE_ARCH to x86. > > Reviewed by: jhb > MFC after: 1 week > > Modified: > head/sys/boot/i386/efi/Makefile > head/sys/boot/i386/loader/Makefile > head/sys/boot/i386/zfsloader/Makefile > > Modified: head/sys/boot/i386/efi/Makefile > ============================================================================== > --- head/sys/boot/i386/efi/Makefile Tue Aug 31 18:48:09 2010 (r212065) > +++ head/sys/boot/i386/efi/Makefile Tue Aug 31 19:01:12 2010 (r212066) > @@ -42,7 +42,7 @@ ${PROG}: ${LDSCRIPT} > > CLEANFILES= vers.c loader.efi > > -NEWVERSWHAT= "EFI loader" ${MACHINE_ARCH} > +NEWVERSWHAT= "EFI loader" x86 > > vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version > sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} > > Modified: head/sys/boot/i386/loader/Makefile > ============================================================================== > --- head/sys/boot/i386/loader/Makefile Tue Aug 31 18:48:09 2010 (r212065) > +++ head/sys/boot/i386/loader/Makefile Tue Aug 31 19:01:12 2010 (r212066) > @@ -6,7 +6,7 @@ MK_SSP= no > LOADER?= loader > PROG= ${LOADER}.sym > INTERNALPROG= > -NEWVERSWHAT?= "bootstrap loader" i386 > +NEWVERSWHAT?= "bootstrap loader" x86 > > # architecture-specific loader code > SRCS= main.c conf.c vers.c > > Modified: head/sys/boot/i386/zfsloader/Makefile > ============================================================================== > --- head/sys/boot/i386/zfsloader/Makefile Tue Aug 31 18:48:09 2010 (r212065) > +++ head/sys/boot/i386/zfsloader/Makefile Tue Aug 31 19:01:12 2010 (r212066) > @@ -3,7 +3,7 @@ > .PATH: ${.CURDIR}/../loader > > LOADER= zfsloader > -NEWVERSWHAT= "ZFS enabled bootstrap loader" i386 > +NEWVERSWHAT= "ZFS enabled bootstrap loader" x86 > LOADER_ZFS_SUPPORT=yes > LOADER_ONLY= yes > NO_MAN= yes thanks a lot. :) i hope at some point in the feature sys/boot/i386 can be renamed to sys/boot/x86 to indicate the boot code is being shared between i386 and amd64. cheers. alex -- a13x From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:51:33 2010 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 DF887106567A; Tue, 31 Aug 2010 19:51:33 +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 5BAC78FC20; Tue, 31 Aug 2010 19:51:32 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7VJpTxf034919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Aug 2010 22:51:29 +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.4/8.14.4) with ESMTP id o7VJpTWR017603; Tue, 31 Aug 2010 22:51:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7VJpTVg017602; Tue, 31 Aug 2010 22:51:29 +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: Tue, 31 Aug 2010 22:51:28 +0300 From: Kostik Belousov To: Dimitry Andric Message-ID: <20100831195128.GC2396@deviant.kiev.zoral.com.ua> References: <201008311811.o7VIBoC5037894@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8/DAEFlfduWObZNP" Content-Disposition: inline In-Reply-To: <201008311811.o7VIBoC5037894@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=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no 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: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 19:51:34 -0000 --8/DAEFlfduWObZNP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 31, 2010 at 06:11:50PM +0000, Dimitry Andric wrote: > Author: dim > Date: Tue Aug 31 18:11:50 2010 > New Revision: 212064 > URL: http://svn.freebsd.org/changeset/base/212064 >=20 > Log: > Avoid directly manipulating a NULL pointer (which could result in > undefined behaviour) in sys/boot/pc98/boot2/boot2.c. > =20 > Reviewed by: nyan > Approved by: rpaulo (mentor) >=20 > Modified: > head/sys/boot/pc98/boot2/boot2.c >=20 > Modified: head/sys/boot/pc98/boot2/boot2.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/boot/pc98/boot2/boot2.c Tue Aug 31 17:43:47 2010 (r212063) > +++ head/sys/boot/pc98/boot2/boot2.c Tue Aug 31 18:11:50 2010 (r212064) > @@ -187,9 +187,9 @@ xfsread(ino_t inode, void *buf, size_t n > static inline uint32_t > memsize(void) > { > - u_char *p =3D (u_char *)PTOV(0); > + u_char *p =3D (u_char *)PTOV(0x401); > =20 > - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 = * 1024; > + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 = * 1024; > } > =20 > static inline void What is the undefined behaviour you are claiming there ? Meaningful conversion from the integer type to a pointer type is implementation-defined anyway. --8/DAEFlfduWObZNP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx9XUAACgkQC3+MBN1Mb4iWNQCgvUwNOSdFWnakovIflx6KAOya 2YoAoNp2tIqHBhvjmwfNh6Iy4noI0306 =3k+I -----END PGP SIGNATURE----- --8/DAEFlfduWObZNP-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:54:01 2010 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 AB37D1065695; Tue, 31 Aug 2010 19:54:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 6BF128FC14; Tue, 31 Aug 2010 19:54:01 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:c4ac:5d43:43f8:c580] (unknown [IPv6:2001:7b8:3a7:0:c4ac:5d43:43f8:c580]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B35C75C59; Tue, 31 Aug 2010 21:53:58 +0200 (CEST) Message-ID: <4C7D5DD2.40407@FreeBSD.org> Date: Tue, 31 Aug 2010 21:53:54 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.10pre) Gecko/20100831 Lanikai/3.1.4pre MIME-Version: 1.0 To: John Baldwin References: <201008311811.o7VIBoC5037894@svn.freebsd.org> <201008311537.51825.jhb@freebsd.org> In-Reply-To: <201008311537.51825.jhb@freebsd.org> 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: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 19:54:01 -0000 On 2010-08-31 21:37, John Baldwin wrote: >> - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; >> + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; >> } > > Perhaps replace '(p + 0x594 - 0x401)' with just 'PTOV(0x594)'? > > I would actually find it cleaner to remove 'p' altogether perhaps: > > return (*(u_char *)PTOV(0x401) * 128 * 1024 + > *(uint16_t *)PTOV(0x594) * 1024 * 1024); Yes, I attempted this variation at first, but it made the code bigger, which I wanted to avoid: it went from "11 bytes available" to "7 bytes" available. I tried several semantically equivalent permutations of the expression, and the one I committed gave no increase or decrease in code size. Apparently the code size produced by gcc is very sensitive to even minimal changes. For example, a lot of the PTOV() pointer dereferences should really be qualified with 'volatile', but that even causes boot2 to become too big to fit! If the 4 extra bytes are no problem, then I would be glad to change it to the above expression, though. It is certainly clearer. :) From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 19:59:19 2010 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 00A1D1065675; Tue, 31 Aug 2010 19:59:19 +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 E44468FC1B; Tue, 31 Aug 2010 19:59:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VJxI50040334; Tue, 31 Aug 2010 19:59:18 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VJxIgk040332; Tue, 31 Aug 2010 19:59:18 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008311959.o7VJxIgk040332@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 19:59: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: r212069 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 19:59:19 -0000 Author: yongari Date: Tue Aug 31 19:59:18 2010 New Revision: 212069 URL: http://svn.freebsd.org/changeset/base/212069 Log: bge_txeof() already checks whether it has to free transmitted mbufs or not by comparing reported TX consumer index with saved index. So remove unnecessary check done after freeing transmitted mbufs. While I'm here nuke unnecessary variable initializations. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Aug 31 19:26:29 2010 (r212068) +++ head/sys/dev/bge/if_bge.c Tue Aug 31 19:59:18 2010 (r212069) @@ -3394,7 +3394,7 @@ bge_rxeof(struct bge_softc *sc, uint16_t static void bge_txeof(struct bge_softc *sc, uint16_t tx_cons) { - struct bge_tx_bd *cur_tx = NULL; + struct bge_tx_bd *cur_tx; struct ifnet *ifp; BGE_LOCK_ASSERT(sc); @@ -3412,7 +3412,7 @@ bge_txeof(struct bge_softc *sc, uint16_t * frames that have been sent. */ while (sc->bge_tx_saved_considx != tx_cons) { - uint32_t idx = 0; + uint32_t idx; idx = sc->bge_tx_saved_considx; cur_tx = &sc->bge_ldata.bge_tx_ring[idx]; @@ -3431,8 +3431,7 @@ bge_txeof(struct bge_softc *sc, uint16_t BGE_INC(sc->bge_tx_saved_considx, BGE_TX_RING_CNT); } - if (cur_tx != NULL) - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (sc->bge_txcnt == 0) sc->bge_timer = 0; } From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 20:11:16 2010 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 E539D1065673; Tue, 31 Aug 2010 20:11:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id A59BB8FC18; Tue, 31 Aug 2010 20:11:16 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:c4ac:5d43:43f8:c580] (unknown [IPv6:2001:7b8:3a7:0:c4ac:5d43:43f8:c580]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id E84A55C59; Tue, 31 Aug 2010 22:11:15 +0200 (CEST) Message-ID: <4C7D61E3.6020409@FreeBSD.org> Date: Tue, 31 Aug 2010 22:11:15 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.10pre) Gecko/20100831 Lanikai/3.1.4pre MIME-Version: 1.0 To: Kostik Belousov References: <201008311811.o7VIBoC5037894@svn.freebsd.org> <20100831195128.GC2396@deviant.kiev.zoral.com.ua> In-Reply-To: <20100831195128.GC2396@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 20:11:17 -0000 On 2010-08-31 21:51, Kostik Belousov wrote: > What is the undefined behaviour you are claiming there ? Arithmetic on a NULL pointer, which is undefined. The C standard says in 6.5.6 (additive operators): 3. For subtraction, one of the following shall hold: =97 both operands have arithmetic type; =97 both operands are pointers to qualified or unqualified versions of= compatible object types; or =97 the left operand is a pointer to an object type and the right operand has integer type. (Decrementing is equivalent to subtracting 1.) But NULL does not point to any specific object. A few paragraphs down it says: 9. When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object; the result is the difference of the subscripts of the two array elements. NULL does not point to anything, so you cannot subtract NULL from a pointer, nor subtract a pointer from NULL (as is done here). Apparently gcc allows it, possibly as an extension? But clang does not, and will generate a 'unreachable' instruction for this expression. (I encountered this when I was trying to get boot2 compiled by clang small enough to fit in 7168 bytes.) From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 20:21:52 2010 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 DA2D710656AB; Tue, 31 Aug 2010 20:21:52 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9AA38FC15; Tue, 31 Aug 2010 20:21:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VKLq23040872; Tue, 31 Aug 2010 20:21:52 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VKLqq1040870; Tue, 31 Aug 2010 20:21:52 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201008312021.o7VKLqq1040870@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 31 Aug 2010 20:21: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: r212070 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 20:21:53 -0000 Author: jkim Date: Tue Aug 31 20:21:52 2010 New Revision: 212070 URL: http://svn.freebsd.org/changeset/base/212070 Log: Make sure the interrupt entry point is within the video ROM range. We must not change interrupt vector if it is not pointing the ROM itself. Actually, we just fail shadowing altogether if that is the case because the shadowed copy will be useless for sure and POST may not be relocatable or useful. While I'm here, fix a debugging message under bootverbose, really. r211829 fixed one case but broke another. Mea Culpa. Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Tue Aug 31 19:59:18 2010 (r212069) +++ head/sys/dev/fb/vesa.c Tue Aug 31 20:21:52 2010 (r212070) @@ -799,19 +799,25 @@ vesa_bios_init(void) /* * Shadow video ROM. */ - offs = BIOS_SADDRTOLADDR(vesa_bios_int10); + offs = vesa_bios_int10; if (vesa_shadow_rom) { vbios = x86bios_get_orm(vesa_bios_offs); if (vbios != NULL) { vesa_bios_size = vbios[2] * 512; - vesa_bios = x86bios_alloc(&vesa_bios_offs, - vesa_bios_size, M_WAITOK); - memcpy(vesa_bios, vbios, vesa_bios_size); - offs = offs - VESA_BIOS_OFFSET + vesa_bios_offs; - offs = (X86BIOS_PHYSTOSEG(offs) << 16) + - X86BIOS_PHYSTOOFF(offs); - x86bios_set_intr(0x10, offs); - } else + offs = BIOS_SADDRTOLADDR(vesa_bios_int10); + if (offs > vesa_bios_offs && + offs < vesa_bios_offs + vesa_bios_size) { + vesa_bios = x86bios_alloc(&vesa_bios_offs, + vesa_bios_size, M_WAITOK); + memcpy(vesa_bios, vbios, vesa_bios_size); + offs = offs - VESA_BIOS_OFFSET + vesa_bios_offs; + offs = (X86BIOS_PHYSTOSEG(offs) << 16) + + X86BIOS_PHYSTOOFF(offs); + x86bios_set_intr(0x10, offs); + } else + offs = vesa_bios_int10; + } + if (vesa_bios == NULL) printf("VESA: failed to shadow video ROM\n"); } if (bootverbose) From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 20:22:02 2010 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 6456910656F3; Tue, 31 Aug 2010 20:21:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0CD618FC08; Tue, 31 Aug 2010 20:21:59 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id A60EC46B46; Tue, 31 Aug 2010 16:21:58 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D16118A03C; Tue, 31 Aug 2010 16:21:57 -0400 (EDT) From: John Baldwin To: Dimitry Andric Date: Tue, 31 Aug 2010 16:21:47 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201008311811.o7VIBoC5037894@svn.freebsd.org> <201008311537.51825.jhb@freebsd.org> <4C7D5DD2.40407@FreeBSD.org> In-Reply-To: <4C7D5DD2.40407@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201008311621.48087.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 31 Aug 2010 16:21:57 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 20:22:02 -0000 On Tuesday, August 31, 2010 3:53:54 pm Dimitry Andric wrote: > On 2010-08-31 21:37, John Baldwin wrote: > >> - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; > >> + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; > >> } > > > > Perhaps replace '(p + 0x594 - 0x401)' with just 'PTOV(0x594)'? > > > > I would actually find it cleaner to remove 'p' altogether perhaps: > > > > return (*(u_char *)PTOV(0x401) * 128 * 1024 + > > *(uint16_t *)PTOV(0x594) * 1024 * 1024); > > Yes, I attempted this variation at first, but it made the code bigger, > which I wanted to avoid: it went from "11 bytes available" to "7 bytes" > available. > > I tried several semantically equivalent permutations of the expression, > and the one I committed gave no increase or decrease in code size. > > Apparently the code size produced by gcc is very sensitive to even > minimal changes. For example, a lot of the PTOV() pointer dereferences > should really be qualified with 'volatile', but that even causes boot2 > to become too big to fit! > > If the 4 extra bytes are no problem, then I would be glad to change it > to the above expression, though. It is certainly clearer. :) I would go with cleaner as long as it fits. I would only resort to weird tricks such as the 'p' one used previously if they are actually needed. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 20:34:03 2010 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 F099C10656A4; Tue, 31 Aug 2010 20:34:02 +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 72B998FC0C; Tue, 31 Aug 2010 20:34:02 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7VKXxGo037800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 31 Aug 2010 23:33:59 +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.4/8.14.4) with ESMTP id o7VKXwkS018006; Tue, 31 Aug 2010 23:33:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7VKXw9S018005; Tue, 31 Aug 2010 23:33:58 +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: Tue, 31 Aug 2010 23:33:58 +0300 From: Kostik Belousov To: Dimitry Andric Message-ID: <20100831203358.GD2396@deviant.kiev.zoral.com.ua> References: <201008311811.o7VIBoC5037894@svn.freebsd.org> <20100831195128.GC2396@deviant.kiev.zoral.com.ua> <4C7D61E3.6020409@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="MdMUFF6WG8fEME8Z" Content-Disposition: inline In-Reply-To: <4C7D61E3.6020409@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=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no 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: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 20:34:03 -0000 --MdMUFF6WG8fEME8Z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 31, 2010 at 10:11:15PM +0200, Dimitry Andric wrote: > On 2010-08-31 21:51, Kostik Belousov wrote: > > What is the undefined behaviour you are claiming there ? >=20 > Arithmetic on a NULL pointer, which is undefined. The C standard says > in 6.5.6 (additive operators): >=20 > 3. For subtraction, one of the following shall hold: > ? both operands have arithmetic type; > ? both operands are pointers to qualified or unqualified versions of > compatible object types; or > ? the left operand is a pointer to an object type and the right > operand has integer type. (Decrementing is equivalent to > subtracting 1.) >=20 > But NULL does not point to any specific object. A few paragraphs down > it says: >=20 > 9. When two pointers are subtracted, both shall point to elements of > the same array object, or one past the last element of the array > object; the result is the difference of the subscripts of the two > array elements. >=20 > NULL does not point to anything, so you cannot subtract NULL from a > pointer, nor subtract a pointer from NULL (as is done here). Going into this mode, can you cite the spell that makes the NULL to not point to anything ? There is 6.3.2.3, ---------------------------------------------------- If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function. ---------------------------------------------------- In other words, any object instantiated by C source code (be it declaration, malloc-kind allocation etc) cannot have address equial to NULL. But this does not make NULL lesser pointer then any other. >=20 > Apparently gcc allows it, possibly as an extension? But clang does not, > and will generate a 'unreachable' instruction for this expression. (I > encountered this when I was trying to get boot2 compiled by clang small > enough to fit in 7168 bytes.) >=20 6.5.6.9 is worded to allow tagged architectures to support ANSI C. Clang behaviour is literalism and very unuseful for freestanding environments on the usual architectures, where whole address space is a single char array. I do not see the substraction of two pointers in the changed fragment of co= de. :#define PTOV(pa) ((caddr_t)(pa) - __base) caddr_t is indeed char *, but __base is u_int32_t. And there seems to be no substraction of pointers in the old version of - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * = 1024; + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * = 1024; --MdMUFF6WG8fEME8Z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx9ZzYACgkQC3+MBN1Mb4j3gQCgkmTXNY1gDMZXgv2wbE0xX28n 8J8An1MVGNM0PoMwXs1CkACkyKCEolUR =/C1Z -----END PGP SIGNATURE----- --MdMUFF6WG8fEME8Z-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 20:56:19 2010 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 3804110656A8; Tue, 31 Aug 2010 20:56:19 +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 27A118FC14; Tue, 31 Aug 2010 20:56:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VKuJSA041533; Tue, 31 Aug 2010 20:56:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VKuJ3Q041531; Tue, 31 Aug 2010 20:56:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008312056.o7VKuJ3Q041531@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 31 Aug 2010 20: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: r212071 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 20:56:19 -0000 Author: yongari Date: Tue Aug 31 20:56:18 2010 New Revision: 212071 URL: http://svn.freebsd.org/changeset/base/212071 Log: Remove unnecessary atomic operation in bge_poll. bge(4) always holds a driver lock in the function entry and memory synchronization is handled by bus_dmamap_sync(9). Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Tue Aug 31 20:21:52 2010 (r212070) +++ head/sys/dev/bge/if_bge.c Tue Aug 31 20:56:18 2010 (r212071) @@ -3457,8 +3457,8 @@ bge_poll(struct ifnet *ifp, enum poll_cm rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; - statusword = atomic_readandclear_32( - &sc->bge_ldata.bge_status_block->bge_status); + statusword = sc->bge_ldata.bge_status_block->bge_status; + sc->bge_ldata.bge_status_block->bge_status = 0; bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 21:17:07 2010 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 BEE5810656C3; Tue, 31 Aug 2010 21:17:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 7DAD08FC1A; Tue, 31 Aug 2010 21:17:07 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:c4ac:5d43:43f8:c580] (unknown [IPv6:2001:7b8:3a7:0:c4ac:5d43:43f8:c580]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B430C5C59; Tue, 31 Aug 2010 23:17:06 +0200 (CEST) Message-ID: <4C7D7151.7070001@FreeBSD.org> Date: Tue, 31 Aug 2010 23:17:05 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.10pre) Gecko/20100831 Lanikai/3.1.4pre MIME-Version: 1.0 To: Kostik Belousov References: <201008311811.o7VIBoC5037894@svn.freebsd.org> <20100831195128.GC2396@deviant.kiev.zoral.com.ua> <4C7D61E3.6020409@FreeBSD.org> <20100831203358.GD2396@deviant.kiev.zoral.com.ua> In-Reply-To: <20100831203358.GD2396@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 21:17:07 -0000 On 2010-08-31 22:33, Kostik Belousov wrote: > Going into this mode, can you cite the spell that makes the NULL to > not point to anything ? There is 6.3.2.3, > ---------------------------------------------------- > If a null pointer constant is converted to a pointer type, the resulting > pointer, called a null pointer, is guaranteed to compare unequal to a > pointer to any object or function. > ---------------------------------------------------- > In other words, any object instantiated by C source code (be it > declaration, malloc-kind allocation etc) cannot have address equial > to NULL. But this does not make NULL lesser pointer then any other. Well, I would interpret this as "the null pointer does not point to any object or function". But I am not a native English speaker. > 6.5.6.9 is worded to allow tagged architectures to support ANSI C. > Clang behaviour is literalism and very unuseful for freestanding > environments on the usual architectures, where whole address > space is a single char array. Yes, I completely agree with you. Although even gcc has the warning "NULL used in arithmetic", it apparently does compile such code to what you would expect from it (e.g. wrapping around from address 0x0 to wherever __base is located). But with -ffreestanding there should probably be an exception for this. I will ask the clang guys if it is possible. > I do not see the substraction of two pointers in the changed fragment of code. > :#define PTOV(pa) ((caddr_t)(pa) - __base) > caddr_t is indeed char *, but __base is u_int32_t. Sorry, I interpreted this incorrectly, it is indeed just subtracting an integer from NULL. If you would assume that the null pointer does not point anywhere, adding or substracting integers from it is still undefined, though. :) > And there seems to be no substraction of pointers in the old version of > - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; > + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; Indeed, any subtraction is only in "u_char *p = (u_char *)PTOV(0);". If you prefer, I will revert to the old expression, or maybe we could use John's suggestion of: return (*(u_char *)PTOV(0x401) * 128 * 1024 + *(uint16_t *)PTOV(0x594) * 1024 * 1024); which is less obfuscated. From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 21:48:45 2010 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 64F2310656B1; Tue, 31 Aug 2010 21:48:45 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54BFF8FC22; Tue, 31 Aug 2010 21:48:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VLmjXs042526; Tue, 31 Aug 2010 21:48:45 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VLmjqn042524; Tue, 31 Aug 2010 21:48:45 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201008312148.o7VLmjqn042524@svn.freebsd.org> From: Jamie Gritton Date: Tue, 31 Aug 2010 21:48: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: r212072 - head/lib/libjail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 21:48:45 -0000 Author: jamie Date: Tue Aug 31 21:48:45 2010 New Revision: 212072 URL: http://svn.freebsd.org/changeset/base/212072 Log: Make it clear in the example that jailparam_export's return value should be freed. MFC after: 3 days Modified: head/lib/libjail/jail.3 Modified: head/lib/libjail/jail.3 ============================================================================== --- head/lib/libjail/jail.3 Tue Aug 31 20:56:18 2010 (r212071) +++ head/lib/libjail/jail.3 Tue Aug 31 21:48:45 2010 (r212072) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 24, 2009 +.Dd August 31, 2010 .Dt JAIL 3 .Os .Sh NAME @@ -248,6 +248,8 @@ jailparam_init(¶ms[1], "host.hostnam jailparam_get(params, 2, 0); hostname = jailparam_export(¶ms[1]); jailparam_free(params, 2); +... +free(hostname); .Ed .Sh ERRORS The From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 21:50:09 2010 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 7653110656A4; Tue, 31 Aug 2010 21:50:09 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 660B98FC08; Tue, 31 Aug 2010 21:50:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VLo95a042599; Tue, 31 Aug 2010 21:50:09 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VLo9CW042597; Tue, 31 Aug 2010 21:50:09 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201008312150.o7VLo9CW042597@svn.freebsd.org> From: Jamie Gritton Date: Tue, 31 Aug 2010 21:50: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: r212073 - head/lib/libjail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 21:50:09 -0000 Author: jamie Date: Tue Aug 31 21:50:09 2010 New Revision: 212073 URL: http://svn.freebsd.org/changeset/base/212073 Log: Don't over-allocate array values in jailparam_export. Fix a little comment typo. MFC after: 3 days Modified: head/lib/libjail/jail.c Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Tue Aug 31 21:48:45 2010 (r212072) +++ head/lib/libjail/jail.c Tue Aug 31 21:50:09 2010 (r212073) @@ -719,6 +719,7 @@ jailparam_get(struct jailparam *jp, unsi char * jailparam_export(struct jailparam *jp) { + size_t *valuelens; char *value, *tvalue, **values; size_t valuelen; int i, nval, ival; @@ -740,6 +741,7 @@ jailparam_export(struct jailparam *jp) return (value); } values = alloca(nval * sizeof(char *)); + valuelens = alloca(nval * sizeof(size_t)); valuelen = 0; for (i = 0; i < nval; i++) { switch (jp->jp_ctltype & CTLTYPE) { @@ -809,11 +811,12 @@ jailparam_export(struct jailparam *jp) errno = ENOENT; return (NULL); } - valuelen += strlen(valbuf) + 1; - values[i] = alloca(valuelen); + valuelens[i] = strlen(valbuf) + 1; + valuelen += valuelens[i]; + values[i] = alloca(valuelens[i]); strcpy(values[i], valbuf); } - value = malloc(valuelen + 1); + value = malloc(valuelen); if (value == NULL) strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); else { @@ -821,8 +824,8 @@ jailparam_export(struct jailparam *jp) for (i = 0; i < nval; i++) { strcpy(tvalue, values[i]); if (i < nval - 1) { - tvalue += strlen(values[i]); - *tvalue++ = ','; + tvalue += valuelens[i]; + tvalue[-1] = ','; } } } @@ -830,7 +833,7 @@ jailparam_export(struct jailparam *jp) } /* - * Free the contents of a jail parameter list (but not thst list itself). + * Free the contents of a jail parameter list (but not the list itself). */ void jailparam_free(struct jailparam *jp, unsigned njp) From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 21:53:00 2010 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 9D89810656B1; Tue, 31 Aug 2010 21:53:00 +0000 (UTC) (envelope-from freebsd@nagilum.org) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by mx1.freebsd.org (Postfix) with ESMTP id 365438FC13; Tue, 31 Aug 2010 21:53:00 +0000 (UTC) Received: from cakebox.homeunix.net (p50813BAB.dip0.t-ipconnect.de [80.129.59.171]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MNezy-1OkUDI1iYs-007gnK; Tue, 31 Aug 2010 23:52:58 +0200 Received: from cakebox.homeunix.net (localhost [127.0.0.1]) by cakebox.homeunix.net (Postfix) with ESMTP id DF24067820; Tue, 31 Aug 2010 23:52:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cakebox.tis X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.7 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: by cakebox.homeunix.net (Postfix, from userid 80) id 6B9206781C; Tue, 31 Aug 2010 23:52:48 +0200 (CEST) Received: from p50813BAB.dip0.t-ipconnect.de (p50813BAB.dip0.t-ipconnect.de [80.129.59.171]) by cakebox.homeunix.net (Horde Framework) with HTTP; Tue, 31 Aug 2010 23:52:47 +0200 Message-ID: <20100831235247.29204rr58q2db38k@cakebox.homeunix.net> Date: Tue, 31 Aug 2010 23:52:47 +0200 From: Alexander To: pyunyh@gmail.com References: <201008310019.o7V0J39f012648@svn.freebsd.org> <20100831084348.1791378cih2dfssg@cakebox.homeunix.net> <20100831193409.GB9903@michelle.cdnetworks.com> In-Reply-To: <20100831193409.GB9903@michelle.cdnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-Provags-ID: V02:K0:QficA4VTFWi5iKNUTt1njqiL4smbQwU5XNrtcYnKMo0 AKIGmBxPjrZEIstgnqBiT8adPx8D6I2g26s9plXPks7nt/NsaQ XmabFFg6meZbeXscg3H89AF/dYCmImVw12JKl0t4o28i55+mVZ 9UEc6uL3rUUoqVu1Ol1ZNCZj7Jpeu2tPNyKu3Qo2BiEpmBxOFE 9xbyEZ7pYqATLeNRL2usv3BCfl3+3uDPAZy1tk/Na8= Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-8@FreeBSD.org, Pyun YongHyeon Subject: Re: svn commit: r212041 - 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: Tue, 31 Aug 2010 21:53:00 -0000 ----- Message from pyunyh@gmail.com --------- Date: Tue, 31 Aug 2010 12:34:09 -0700 From: Pyun YongHyeon Reply-To: pyunyh@gmail.com Subject: Re: svn commit: r212041 - stable/8/share/man/man4 To: Alexander Cc: Pyun YongHyeon , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-stable@FreeBSD.org, svn-src-stable-8@FreeBSD.org > On Tue, Aug 31, 2010 at 08:43:48AM +0200, Alexander wrote: >> Can we name the known examples somewhere? >> > > Do you have suggestion for somewhere? > Personally I think man page is one of best place to put these kind > of knobs. Yeah, the man page would be my choice as well. But I was thinking of naming the adapters known to require the use of memory space register mapping. (Besides the description we you already provided.) It doesn't have to be an exhaustive list. >> ----- Message from yongari@FreeBSD.org --------- >> Date: Tue, 31 Aug 2010 00:19:03 +0000 (UTC) >> From: Pyun YongHyeon >> >> >> >Author: yongari >> >Date: Tue Aug 31 00:19:03 2010 >> >New Revision: 212041 >> >URL: http://svn.freebsd.org/changeset/base/212041 >> > >> >Log: >> > MFC r211650,211667: >> > r211650: >> > Document tunable dev.rl.%unit.prefer_iomap >> > >> > r211667: >> > Better wording and fix wrong explanation. >> > >> > Submitted by: Ben Kaduk ( minimarmot <> gmail dot com ) >> > >> >Modified: >> > stable/8/share/man/man4/rl.4 >> >Directory Properties: >> > stable/8/share/man/man4/ (props changed) >> > >> >Modified: stable/8/share/man/man4/rl.4 >> >============================================================================== >> >--- stable/8/share/man/man4/rl.4 Tue Aug 31 00:16:30 2010 (r212040) >> >+++ stable/8/share/man/man4/rl.4 Tue Aug 31 00:19:03 2010 (r212041) >> >@@ -30,7 +30,7 @@ >> > .\" >> > .\" $FreeBSD$ >> > .\" >> >-.Dd November 1, 2008 >> >+.Dd August 22, 2010 >> > .Dt RL 4 >> > .Os >> > .Sh NAME >> >@@ -203,6 +203,13 @@ SOHO (PRAGMATIC) UE-1211C >> > .El >> > .Sh LOADER TUNABLES >> > .Bl -tag -width indent >> >+.It Va dev.rl.%unit.prefer_iomap >> >+This tunable controls which register mapping should be used on the >> >+specified device. >> >+A non-zero value enables I/O space register mapping. >> >+For controllers that have no I/O space register mapping this tunable >> >+should be set to 0 to use memory space register mapping. >> >+The default value is 1 to use I/O space register mapping. >> > .It Va dev.rl.%unit.twister_enable >> > Non-zero value enables the long cable tuning on the specified device. >> > Disabled by default. >> >_______________________________________________ >> >svn-src-stable-8@freebsd.org mailing list >> >http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 >> >> ----- End message from yongari@FreeBSD.org ----- ----- End message from pyunyh@gmail.com ----- ======================================================================== # _ __ _ __ http://www.nagilum.org/ \n icq://69646724 # # / |/ /__ ____ _(_) /_ ____ _ nagilum@nagilum.org \n +491776461165 # # / / _ `/ _ `/ / / // / ' \ Amiga (68k/PPC): AOS/NetBSD/Linux # # /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/ Mac (PPC): MacOS-X / Linux / MacOS-X # # /___/ x86: FreeBSD/Linux/Solaris/Win2k ARM9: EPOC EV6 # ======================================================================== ---------------------------------------------------------------- cakebox.homeunix.net - all the machine one needs.. From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 23:13:10 2010 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 2BC0C10656A5; Tue, 31 Aug 2010 23:13:10 +0000 (UTC) (envelope-from pgollucci@p6m7g8.com) Received: from cell.p6m7g8.net (static-71-178-236-107.washdc.fios.verizon.net [71.178.236.107]) by mx1.freebsd.org (Postfix) with ESMTP id CA37D8FC15; Tue, 31 Aug 2010 23:13:09 +0000 (UTC) Received: from philip.hq.rws (wsip-174-79-184-239.dc.dc.cox.net [174.79.184.239]) (authenticated bits=0) by cell.p6m7g8.net (8.14.4/8.14.3) with ESMTP id o7VND6SX051887 (version=TLSv1/SSLv3 cipher=DHE-DSS-CAMELLIA256-SHA bits=256 verify=NO); Tue, 31 Aug 2010 23:13:06 GMT (envelope-from pgollucci@p6m7g8.com) Message-ID: <4C7D8C82.5090703@p6m7g8.com> Date: Tue, 31 Aug 2010 23:13:06 +0000 From: "Philip M. Gollucci" Organization: P6M7G8 Inc. User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.9) Gecko/20100607 Thunderbird/3.0.4 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201008311041.o7VAfrAF028012@svn.freebsd.org> In-Reply-To: <201008311041.o7VAfrAF028012@svn.freebsd.org> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cell.p6m7g8.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212050 - 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, 31 Aug 2010 23:13:10 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Nice! On 08/31/10 10:41, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Tue Aug 31 10:41:53 2010 > New Revision: 212050 > URL: http://svn.freebsd.org/changeset/base/212050 > > Log: > When upgrading a pool which contain root file system, give user a hint that > he should update boot code. > > MFC after: 2 weeks > > Modified: > head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c > > Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 09:38:43 2010 (r212049) > +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 10:41:53 2010 (r212050) > @@ -3333,12 +3333,39 @@ typedef struct upgrade_cbdata { > int cb_all; > int cb_first; > int cb_newer; > + char cb_poolname[ZPOOL_MAXNAMELEN]; > int cb_argc; > uint64_t cb_version; > char **cb_argv; > } upgrade_cbdata_t; > > static int > +is_root_pool(zpool_handle_t *zhp) > +{ > + static struct statfs sfs; > + static char *poolname = NULL; > + static boolean_t stated = B_FALSE; > + char *slash; > + > + while (!stated) { > + stated = B_TRUE; > + if (statfs("/", &sfs) == -1) { > + (void) fprintf(stderr, > + "Unable to stat root file system: %s.\n", > + strerror(errno)); > + break; > + } > + if (strcmp(sfs.f_fstypename, "zfs") != 0) > + break; > + poolname = sfs.f_mntfromname; > + if ((slash = strchr(poolname, '/')) != NULL) > + *slash = '\0'; > + break; > + } > + return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0); > +} > + > +static int > upgrade_cb(zpool_handle_t *zhp, void *arg) > { > upgrade_cbdata_t *cbp = arg; > @@ -3371,6 +3398,12 @@ upgrade_cb(zpool_handle_t *zhp, void *ar > if (!ret) { > (void) printf(gettext("Successfully upgraded " > "'%s'\n\n"), zpool_get_name(zhp)); > + if (cbp->cb_poolname[0] == '\0' && > + is_root_pool(zhp)) { > + (void) strlcpy(cbp->cb_poolname, > + zpool_get_name(zhp), > + sizeof(cbp->cb_poolname)); > + } > } > } > } else if (cbp->cb_newer && version > SPA_VERSION) { > @@ -3428,6 +3461,10 @@ upgrade_one(zpool_handle_t *zhp, void *d > "from version %llu to version %llu\n\n"), > zpool_get_name(zhp), (u_longlong_t)cur_version, > (u_longlong_t)cbp->cb_version); > + if (cbp->cb_poolname[0] == '\0' && is_root_pool(zhp)) { > + (void) strlcpy(cbp->cb_poolname, zpool_get_name(zhp), > + sizeof(cbp->cb_poolname)); > + } > } > > return (ret != 0); > @@ -3569,6 +3606,16 @@ zpool_do_upgrade(int argc, char **argv) > upgrade_one, &cb); > } > > + if (cb.cb_poolname[0] != '\0') { > + (void) printf( > + "If you boot from pool '%s', don't forget to update boot code.\n" > + "Assuming you use GPT partitioning and da0 is your boot disk\n" > + "the following command will do it:\n" > + "\n" > + "\tgpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0\n\n", > + cb.cb_poolname); > + } > + > return (ret); > } > > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" - -- - ------------------------------------------------------------------------ 1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C Philip M. Gollucci (pgollucci@p6m7g8.com) c: 703.336.9354 VP Apache Infrastructure; Member, Apache Software Foundation Committer, FreeBSD Foundation Consultant, P6M7G8 Inc. Sr. System Admin, Ridecharge Inc. Work like you don't need the money, love like you'll never get hurt, and dance like nobody's watching. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iD8DBQFMfYyCdbiP+9ubjBwRAvY2AJ9c8KljK10d+BDUdxhoX+zs5IOrVwCeNqun xWIPcs2YJT0xAbAryFY8Gvs= =T0tq -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 23:14:03 2010 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 936761065672; Tue, 31 Aug 2010 23:14:03 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8305A8FC19; Tue, 31 Aug 2010 23:14:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7VNE38r044613; Tue, 31 Aug 2010 23:14:03 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7VNE3Wu044611; Tue, 31 Aug 2010 23:14:03 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201008312314.o7VNE3Wu044611@svn.freebsd.org> From: Jamie Gritton Date: Tue, 31 Aug 2010 23:14: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: r212074 - head/lib/libjail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 31 Aug 2010 23:14:03 -0000 Author: jamie Date: Tue Aug 31 23:14:03 2010 New Revision: 212074 URL: http://svn.freebsd.org/changeset/base/212074 Log: Whitespace and comment fixes. MFC after: 3 days Modified: head/lib/libjail/jail.c Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Tue Aug 31 21:50:09 2010 (r212073) +++ head/lib/libjail/jail.c Tue Aug 31 23:14:03 2010 (r212074) @@ -786,7 +786,6 @@ jailparam_export(struct jailparam *jp) valbuf, sizeof(valbuf)) == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - return (NULL); } break; @@ -796,7 +795,6 @@ jailparam_export(struct jailparam *jp) valbuf, sizeof(valbuf)) == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - return (NULL); } break; @@ -894,7 +892,7 @@ jailparam_type(struct jailparam *jp) mib[1] = 4; desclen = sizeof(desc); if (sysctl(mib, (miblen / sizeof(int)) + 2, - &desc, &desclen, NULL, 0) < 0) { + &desc, &desclen, NULL, 0) < 0) { snprintf(jail_errmsg, JAIL_ERRMSGLEN, "sysctl(0.4.%s): %s", desc.s, @@ -934,7 +932,7 @@ jailparam_type(struct jailparam *jp) isarray = 1; p[-2] = 0; } - /* Look for types we understand */ + /* Look for types we understand. */ jp->jp_ctltype = desc.i; switch (desc.i & CTLTYPE) { case CTLTYPE_INT: From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 01:24:02 2010 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 CA7FA10656BE; Wed, 1 Sep 2010 01:24:02 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B9A788FC0C; Wed, 1 Sep 2010 01:24:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o811O0DX061383; Wed, 1 Sep 2010 01:24:01 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C7E1BB1.3080209@freebsd.org> Date: Wed, 01 Sep 2010 09:24:01 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Jilles Tjoelker References: <201008310715.o7V7FoSI021421@svn.freebsd.org> <20100831181631.GA31653@stack.nl> In-Reply-To: <20100831181631.GA31653@stack.nl> Content-Type: text/plain; charset=ISO-8859-1; 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: r212047 - 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, 01 Sep 2010 01:24:03 -0000 Jilles Tjoelker wrote: > On Tue, Aug 31, 2010 at 07:15:50AM +0000, David Xu wrote: >> Author: davidxu >> Date: Tue Aug 31 07:15:50 2010 >> New Revision: 212047 >> URL: http://svn.freebsd.org/changeset/base/212047 > >> Log: >> If a process is being debugged, skips job control caused by SIGSTOP/SIGCONT >> signals, because it is managed by debugger, however a normal signal sent to >> a interruptibly sleeping thread wakes up the thread so it will handle the >> signal when the process leaves the stopped state. > >> PR: 150138 >> MFC after: 1 week > >> Modified: >> head/sys/kern/kern_sig.c > >> Modified: head/sys/kern/kern_sig.c >> ============================================================================== >> --- head/sys/kern/kern_sig.c Tue Aug 31 06:22:03 2010 (r212046) >> +++ head/sys/kern/kern_sig.c Tue Aug 31 07:15:50 2010 (r212047) >> if (sig == SIGKILL) { >> + if (p->p_flag & P_TRACED) >> + goto out; >> /* >> * SIGKILL sets process running. >> * It will die elsewhere. > > Hmm, shouldn't SIGKILL kill right away regardless of debuggers? > Hmm^2, it is a history behavior. From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 01:26:07 2010 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 6148E1065698; Wed, 1 Sep 2010 01:26:07 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 518268FC1C; Wed, 1 Sep 2010 01:26:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o811Q742047249; Wed, 1 Sep 2010 01:26:07 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o811Q7fc047247; Wed, 1 Sep 2010 01:26:07 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009010126.o811Q7fc047247@svn.freebsd.org> From: David Xu Date: Wed, 1 Sep 2010 01:26: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: r212075 - 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, 01 Sep 2010 01:26:07 -0000 Author: davidxu Date: Wed Sep 1 01:26:07 2010 New Revision: 212075 URL: http://svn.freebsd.org/changeset/base/212075 Log: rescure comments from RELENG_4. Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Aug 31 23:14:03 2010 (r212074) +++ head/sys/kern/kern_sig.c Wed Sep 1 01:26:07 2010 (r212075) @@ -2140,6 +2140,10 @@ tdsendsignal(struct proc *p, struct thre */ if (P_SHOULDSTOP(p)) { if (sig == SIGKILL) { + /* + * If traced process is already stopped, + * then no further action is necessary. + */ if (p->p_flag & P_TRACED) goto out; /* @@ -2152,6 +2156,10 @@ tdsendsignal(struct proc *p, struct thre } if (prop & SA_CONT) { + /* + * If traced process is already stopped, + * then no further action is necessary. + */ if (p->p_flag & P_TRACED) goto out; /* @@ -2198,6 +2206,10 @@ tdsendsignal(struct proc *p, struct thre } if (prop & SA_STOP) { + /* + * If traced process is already stopped, + * then no further action is necessary. + */ if (p->p_flag & P_TRACED) goto out; /* From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 02:18:33 2010 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 695A1106566B; Wed, 1 Sep 2010 02:18:33 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57E258FC14; Wed, 1 Sep 2010 02:18:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o812IXxW048270; Wed, 1 Sep 2010 02:18:33 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o812IX5G048257; Wed, 1 Sep 2010 02:18:33 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009010218.o812IX5G048257@svn.freebsd.org> From: David Xu Date: Wed, 1 Sep 2010 02:18: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: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 02:18:33 -0000 Author: davidxu Date: Wed Sep 1 02:18:33 2010 New Revision: 212076 URL: http://svn.freebsd.org/changeset/base/212076 Log: Add signal handler wrapper, the reason to add it becauses there are some cases we want to improve: 1) if a thread signal got a signal while in cancellation point, it is possible the TDP_WAKEUP may be eaten by signal handler if the handler called some interruptibly system calls. 2) In signal handler, we want to disable cancellation. 3) When thread holding some low level locks, it is better to disable signal, those code need not to worry reentrancy, sigprocmask system call is avoided because it is a bit expensive. The signal handler wrapper works in this way: 1) libthr installs its signal handler if user code invokes sigaction to install its handler, the user handler is recorded in internal array. 2) when a signal is delivered, libthr's signal handler is invoke, libthr checks if thread holds some low level lock or is in critical region, if it is true, the signal is buffered, and all signals are masked, once the thread leaves critical region, correct signal mask is restored and buffered signal is processed. 3) before user signal handler is invoked, cancellation is temporarily disabled, after user signal handler is returned, cancellation state is restored, and pending cancellation is rescheduled. Modified: head/lib/libthr/thread/thr_cancel.c head/lib/libthr/thread/thr_cond.c head/lib/libthr/thread/thr_create.c head/lib/libthr/thread/thr_exit.c head/lib/libthr/thread/thr_fork.c head/lib/libthr/thread/thr_init.c head/lib/libthr/thread/thr_join.c head/lib/libthr/thread/thr_kern.c head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_rtld.c head/lib/libthr/thread/thr_sig.c head/lib/libthr/thread/thr_syscalls.c head/lib/libthr/thread/thr_umtx.c head/lib/libthr/thread/thr_umtx.h Modified: head/lib/libthr/thread/thr_cancel.c ============================================================================== --- head/lib/libthr/thread/thr_cancel.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_cancel.c Wed Sep 1 02:18:33 2010 (r212076) @@ -85,14 +85,11 @@ _pthread_setcancelstate(int state, int * oldval = curthread->cancel_enable; switch (state) { case PTHREAD_CANCEL_DISABLE: - THR_LOCK(curthread); curthread->cancel_enable = 0; - THR_UNLOCK(curthread); break; case PTHREAD_CANCEL_ENABLE: - THR_LOCK(curthread); curthread->cancel_enable = 1; - THR_UNLOCK(curthread); + testcancel(curthread); break; default: return (EINVAL); @@ -136,23 +133,22 @@ _pthread_testcancel(void) { struct pthread *curthread = _get_curthread(); - _thr_cancel_enter(curthread); - _thr_cancel_leave(curthread); + curthread->cancel_point = 1; + testcancel(curthread); + curthread->cancel_point = 0; } void _thr_cancel_enter(struct pthread *curthread) { - curthread->cancel_point++; - if (curthread->cancel_enable) - testcancel(curthread); + curthread->cancel_point = 1; + testcancel(curthread); } void -_thr_cancel_enter_defer(struct pthread *curthread, int maycancel) +_thr_cancel_enter2(struct pthread *curthread, int maycancel) { - curthread->cancel_defer++; - curthread->cancel_point++; + curthread->cancel_point = 1; if (__predict_false(SHOULD_CANCEL(curthread) && !THR_IN_CRITICAL(curthread))) { if (!maycancel) @@ -163,24 +159,9 @@ _thr_cancel_enter_defer(struct pthread * } void -_thr_cancel_leave(struct pthread *curthread) -{ - curthread->cancel_point--; -} - -void -_thr_cancel_leave2(struct pthread *curthread, int maycancel) -{ - if (curthread->cancel_enable && maycancel) - testcancel(curthread); - curthread->cancel_point--; -} - -void -_thr_cancel_leave_defer(struct pthread *curthread, int maycancel) +_thr_cancel_leave(struct pthread *curthread, int maycancel) { - if (curthread->cancel_enable && maycancel) + if (maycancel) testcancel(curthread); - curthread->cancel_point--; - curthread->cancel_defer--; + curthread->cancel_point = 0; } Modified: head/lib/libthr/thread/thr_cond.c ============================================================================== --- head/lib/libthr/thread/thr_cond.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_cond.c Wed Sep 1 02:18:33 2010 (r212076) @@ -210,10 +210,10 @@ cond_wait_common(pthread_cond_t *cond, p if (cancel) { THR_CLEANUP_PUSH(curthread, cond_cancel_handler, &info); - _thr_cancel_enter_defer(curthread, 0); + _thr_cancel_enter2(curthread, 0); ret = _thr_ucond_wait(&cv->c_kerncv, &cv->c_lock, tsp, 1); info.cond = NULL; - _thr_cancel_leave_defer(curthread, (ret != 0)); + _thr_cancel_leave(curthread, (ret != 0)); THR_CLEANUP_POP(curthread, 0); } else { ret = _thr_ucond_wait(&cv->c_kerncv, &cv->c_lock, tsp, 0); Modified: head/lib/libthr/thread/thr_create.c ============================================================================== --- head/lib/libthr/thread/thr_create.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_create.c Wed Sep 1 02:18:33 2010 (r212076) @@ -127,11 +127,6 @@ _pthread_create(pthread_t * thread, cons if (new_thread->attr.flags & PTHREAD_CREATE_DETACHED) new_thread->tlflags |= TLFLAGS_DETACHED; - if (curthread->in_sigcancel_handler) - new_thread->unblock_sigcancel = 1; - else - new_thread->unblock_sigcancel = 0; - /* Add the new thread. */ new_thread->refcount = 1; _thr_link(curthread, new_thread); @@ -263,14 +258,6 @@ thread_start(struct pthread *curthread) if (curthread->force_exit) _pthread_exit(PTHREAD_CANCELED); - if (curthread->unblock_sigcancel) { - sigset_t set1; - - SIGEMPTYSET(set1); - SIGADDSET(set1, SIGCANCEL); - __sys_sigprocmask(SIG_UNBLOCK, &set1, NULL); - } - if (curthread->attr.suspend == THR_CREATE_SUSPENDED) { #if 0 /* Done in THR_UNLOCK() */ Modified: head/lib/libthr/thread/thr_exit.c ============================================================================== --- head/lib/libthr/thread/thr_exit.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_exit.c Wed Sep 1 02:18:33 2010 (r212076) @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include "un-namespace.h" #include "libc_private.h" @@ -58,6 +60,12 @@ _thread_exit(const char *fname, int line void _pthread_exit(void *status) { + _pthread_exit_mask(status, NULL); +} + +void +_pthread_exit_mask(void *status, sigset_t *mask) +{ struct pthread *curthread = _get_curthread(); /* Check if this thread is already in the process of exiting: */ @@ -73,6 +81,17 @@ _pthread_exit(void *status) curthread->cancelling = 1; curthread->cancel_enable = 0; curthread->cancel_async = 0; + curthread->cancel_point = 0; + if (mask != NULL) + __sys_sigprocmask(SIG_SETMASK, mask, NULL); + if (curthread->unblock_sigcancel) { + sigset_t set; + + curthread->unblock_sigcancel = 0; + SIGEMPTYSET(set); + SIGADDSET(set, SIGCANCEL); + __sys_sigprocmask(SIG_UNBLOCK, mask, NULL); + } /* Save the return value: */ curthread->ret = status; Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_fork.c Wed Sep 1 02:18:33 2010 (r212076) @@ -115,6 +115,7 @@ __pthread_cxa_finalize(struct dl_phdr_in } THR_UMUTEX_UNLOCK(curthread, &_thr_atfork_lock); _thr_tsd_unload(phdr_info); + _thr_sigact_unload(phdr_info); } __weak_reference(_fork, fork); @@ -161,6 +162,7 @@ _fork(void) * Block all signals until we reach a safe point. */ _thr_signal_block(curthread); + _thr_signal_prefork(); /* Fork a new process: */ if ((ret = __sys_fork()) == 0) { @@ -182,6 +184,8 @@ _fork(void) _thr_umutex_init(&curthread->lock); _thr_umutex_init(&_thr_atfork_lock); + _thr_signal_postfork_child(); + if (was_threaded) _rtld_atfork_post(rtld_locks); _thr_setthreaded(0); @@ -211,6 +215,8 @@ _fork(void) /* Parent process */ errsave = errno; + _thr_signal_postfork(); + /* Ready to continue, unblock signals. */ _thr_signal_unblock(curthread); Modified: head/lib/libthr/thread/thr_init.c ============================================================================== --- head/lib/libthr/thread/thr_init.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_init.c Wed Sep 1 02:18:33 2010 (r212076) @@ -289,7 +289,6 @@ void _libpthread_init(struct pthread *curthread) { int fd, first = 0; - sigset_t sigset, oldset; /* Check if this function has already been called: */ if ((_thr_initial != NULL) && (curthread == NULL)) @@ -347,13 +346,8 @@ _libpthread_init(struct pthread *curthre _tcb_set(curthread->tcb); if (first) { - SIGFILLSET(sigset); - SIGDELSET(sigset, SIGTRAP); - __sys_sigprocmask(SIG_SETMASK, &sigset, &oldset); - _thr_signal_init(); _thr_initial = curthread; - SIGDELSET(oldset, SIGCANCEL); - __sys_sigprocmask(SIG_SETMASK, &oldset, NULL); + _thr_signal_init(); if (_thread_event_mask & TD_CREATE) _thr_report_creation(curthread, curthread); } Modified: head/lib/libthr/thread/thr_join.c ============================================================================== --- head/lib/libthr/thread/thr_join.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_join.c Wed Sep 1 02:18:33 2010 (r212076) @@ -107,7 +107,7 @@ join_common(pthread_t pthread, void **th THREAD_LIST_UNLOCK(curthread); THR_CLEANUP_PUSH(curthread, backout_join, pthread); - _thr_cancel_enter_defer(curthread, 1); + _thr_cancel_enter(curthread); tid = pthread->tid; while (pthread->tid != TID_TERMINATED) { @@ -127,7 +127,7 @@ join_common(pthread_t pthread, void **th break; } - _thr_cancel_leave_defer(curthread, 0); + _thr_cancel_leave(curthread, 0); THR_CLEANUP_POP(curthread, 0); if (ret == ETIMEDOUT) { Modified: head/lib/libthr/thread/thr_kern.c ============================================================================== --- head/lib/libthr/thread/thr_kern.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_kern.c Wed Sep 1 02:18:33 2010 (r212076) @@ -61,38 +61,6 @@ _thr_setthreaded(int threaded) } void -_thr_signal_block(struct pthread *curthread) -{ - sigset_t set; - - if (curthread->sigblock > 0) { - curthread->sigblock++; - return; - } - SIGFILLSET(set); - SIGDELSET(set, SIGBUS); - SIGDELSET(set, SIGILL); - SIGDELSET(set, SIGFPE); - SIGDELSET(set, SIGSEGV); - SIGDELSET(set, SIGTRAP); - __sys_sigprocmask(SIG_BLOCK, &set, &curthread->sigmask); - curthread->sigblock++; -} - -void -_thr_signal_unblock(struct pthread *curthread) -{ - if (--curthread->sigblock == 0) - __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL); -} - -int -_thr_send_sig(struct pthread *thread, int sig) -{ - return thr_kill(thread->tid, sig); -} - -void _thr_assert_lock_level() { PANIC("locklevel <= 0"); Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_private.h Wed Sep 1 02:18:33 2010 (r212076) @@ -376,12 +376,21 @@ struct pthread { /* Thread temporary signal mask. */ sigset_t sigmask; - /* Thread is in SIGCANCEL handler. */ - int in_sigcancel_handler; - - /* New thread should unblock SIGCANCEL. */ + /* Thread should unblock SIGCANCEL. */ int unblock_sigcancel; + /* In sigsuspend state */ + int in_sigsuspend; + + /* deferred signal info */ + siginfo_t deferred_siginfo; + + /* signal mask to restore. */ + sigset_t deferred_sigmask; + + /* the sigaction should be used for deferred signal. */ + struct sigaction deferred_sigact; + /* Force new thread to exit. */ int force_exit; @@ -629,6 +638,7 @@ void _thr_ref_delete_unlocked(struct pth int _thr_find_thread(struct pthread *, struct pthread *, int) __hidden; void _thr_rtld_init(void) __hidden; void _thr_rtld_fini(void) __hidden; +void _thr_rtld_postfork_child(void) __hidden; int _thr_stack_alloc(struct pthread_attr *) __hidden; void _thr_stack_free(struct pthread_attr *) __hidden; void _thr_free(struct pthread *, struct pthread *) __hidden; @@ -637,10 +647,8 @@ void _thread_cleanupspecific(void) __ void _thread_printf(int, const char *, ...) __hidden; void _thr_spinlock_init(void) __hidden; void _thr_cancel_enter(struct pthread *) __hidden; -void _thr_cancel_leave(struct pthread *) __hidden; -void _thr_cancel_leave2(struct pthread *, int) __hidden; -void _thr_cancel_enter_defer(struct pthread *, int) __hidden; -void _thr_cancel_leave_defer(struct pthread *, int) __hidden; +void _thr_cancel_enter2(struct pthread *, int) __hidden; +void _thr_cancel_leave(struct pthread *, int) __hidden; void _thr_testcancel(struct pthread *) __hidden; void _thr_signal_block(struct pthread *) __hidden; void _thr_signal_unblock(struct pthread *) __hidden; @@ -653,7 +661,6 @@ void _thr_hash_remove(struct pthread *) struct pthread *_thr_hash_find(struct pthread *) __hidden; void _thr_link(struct pthread *, struct pthread *) __hidden; void _thr_unlink(struct pthread *, struct pthread *) __hidden; -void _thr_suspend_check(struct pthread *) __hidden; void _thr_assert_lock_level(void) __hidden __dead2; void _thr_ast(struct pthread *) __hidden; void _thr_once_init(void) __hidden; @@ -662,6 +669,9 @@ void _thr_report_creation(struct pthread void _thr_report_death(struct pthread *curthread) __hidden; int _thr_getscheduler(lwpid_t, int *, struct sched_param *) __hidden; int _thr_setscheduler(lwpid_t, int, const struct sched_param *) __hidden; +void _thr_signal_prefork(void) __hidden; +void _thr_signal_postfork(void) __hidden; +void _thr_signal_postfork_child(void) __hidden; int _rtp_to_schedparam(const struct rtprio *rtp, int *policy, struct sched_param *param) __hidden; int _schedparam_to_rtp(int policy, const struct sched_param *param, @@ -672,6 +682,8 @@ int _sched_yield(void); void _pthread_cleanup_push(void (*)(void *), void *); void _pthread_cleanup_pop(int); +void _pthread_exit_mask(void *status, sigset_t *mask) __dead2 __hidden; + /* #include */ #ifdef _SYS_FCNTL_H_ @@ -687,7 +699,7 @@ int __sys_sigaction(int, const struc int __sys_sigpending(sigset_t *); int __sys_sigprocmask(int, const sigset_t *, sigset_t *); int __sys_sigsuspend(const sigset_t *); -int __sys_sigreturn(ucontext_t *); +int __sys_sigreturn(const ucontext_t *); int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *); int __sys_sigwait(const sigset_t *, int *); int __sys_sigtimedwait(const sigset_t *, siginfo_t *, @@ -740,6 +752,7 @@ _thr_check_init(void) struct dl_phdr_info; void __pthread_cxa_finalize(struct dl_phdr_info *phdr_info); void _thr_tsd_unload(struct dl_phdr_info *phdr_info) __hidden; +void _thr_sigact_unload(struct dl_phdr_info *phdr_info) __hidden; __END_DECLS Modified: head/lib/libthr/thread/thr_rtld.c ============================================================================== --- head/lib/libthr/thread/thr_rtld.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_rtld.c Wed Sep 1 02:18:33 2010 (r212076) @@ -32,6 +32,7 @@ */ #include #include +#include #include "rtld_lock.h" #include "thr_private.h" @@ -132,7 +133,7 @@ _thr_rtld_wlock_acquire(void *lock) SAVE_ERRNO(); l = (struct rtld_lock *)lock; - _thr_signal_block(curthread); + THR_CRITICAL_ENTER(curthread); while (_thr_rwlock_wrlock(&l->lock, NULL) != 0) ; RESTORE_ERRNO(); @@ -152,12 +153,9 @@ _thr_rtld_lock_release(void *lock) state = l->lock.rw_state; if (_thr_rwlock_unlock(&l->lock) == 0) { - if ((state & URWLOCK_WRITE_OWNER) == 0) { + if ((state & URWLOCK_WRITE_OWNER) == 0) curthread->rdlock_count--; - THR_CRITICAL_LEAVE(curthread); - } else { - _thr_signal_unblock(curthread); - } + THR_CRITICAL_LEAVE(curthread); } RESTORE_ERRNO(); } @@ -193,6 +191,9 @@ _thr_rtld_init(void) /* force to resolve errno() PLT */ __error(); + /* force to resolve memcpy PLT */ + memcpy(&dummy, &dummy, sizeof(dummy)); + li.lock_create = _thr_rtld_lock_create; li.lock_destroy = _thr_rtld_lock_destroy; li.rlock_acquire = _thr_rtld_rlock_acquire; Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Wed Sep 1 01:26:07 2010 (r212075) +++ head/lib/libthr/thread/thr_sig.c Wed Sep 1 02:18:33 2010 (r212076) @@ -32,11 +32,10 @@ #include #include #include -#include -#include #include #include #include "un-namespace.h" +#include "libc_private.h" #include "thr_private.h" @@ -47,7 +46,19 @@ #define DBG_MSG(x...) #endif -extern int __pause(void); +struct usigaction { + struct sigaction sigact; + struct urwlock lock; +}; + +static struct usigaction _thr_sigact[_SIG_MAXSIG]; + +static void thr_sighandler(int, siginfo_t *, void *); +static void handle_signal(struct sigaction *, int, siginfo_t *, ucontext_t *); +static void check_deferred_signal(struct pthread *); +static void check_suspend(struct pthread *); +static void check_cancel(struct pthread *curthread, ucontext_t *ucp); + int ___pause(void); int _raise(int); int __sigtimedwait(const sigset_t *set, siginfo_t *info, @@ -59,10 +70,49 @@ int _sigwaitinfo(const sigset_t *set, si int __sigwait(const sigset_t *set, int *sig); int _sigwait(const sigset_t *set, int *sig); int __sigsuspend(const sigset_t *sigmask); +int _sigaction(int, const struct sigaction *, struct sigaction *); int _setcontext(const ucontext_t *); int _swapcontext(ucontext_t *, const ucontext_t *); -static void +static const sigset_t _thr_deferset={{ + 0xffffffff & ~(_SIG_BIT(SIGBUS)|_SIG_BIT(SIGILL)|_SIG_BIT(SIGFPE)| + _SIG_BIT(SIGSEGV)|_SIG_BIT(SIGTRAP)|_SIG_BIT(SIGSYS)), + 0xffffffff, + 0xffffffff, + 0xffffffff}}; + +static const sigset_t _thr_maskset={{ + 0xffffffff, + 0xffffffff, + 0xffffffff, + 0xffffffff}}; + +void +_thr_signal_block(struct pthread *curthread) +{ + + if (curthread->sigblock > 0) { + curthread->sigblock++; + return; + } + __sys_sigprocmask(SIG_BLOCK, &_thr_maskset, &curthread->sigmask); + curthread->sigblock++; +} + +void +_thr_signal_unblock(struct pthread *curthread) +{ + if (--curthread->sigblock == 0) + __sys_sigprocmask(SIG_SETMASK, &curthread->sigmask, NULL); +} + +int +_thr_send_sig(struct pthread *thread, int sig) +{ + return thr_kill(thread->tid, sig); +} + +static inline void remove_thr_signals(sigset_t *set) { if (SIGISMEMBER(*set, SIGCANCEL)) @@ -72,87 +122,244 @@ remove_thr_signals(sigset_t *set) static const sigset_t * thr_remove_thr_signals(const sigset_t *set, sigset_t *newset) { - const sigset_t *pset; - - if (SIGISMEMBER(*set, SIGCANCEL)) { - *newset = *set; - SIGDELSET(*newset, SIGCANCEL); - pset = newset; - } else - pset = set; - return (pset); + *newset = *set; + remove_thr_signals(newset); + return (newset); } static void sigcancel_handler(int sig __unused, - siginfo_t *info __unused, ucontext_t *ucp __unused) + siginfo_t *info __unused, ucontext_t *ucp) +{ + struct pthread *curthread = _get_curthread(); + int err; + + if (THR_IN_CRITICAL(curthread)) + return; + err = errno; + check_suspend(curthread); + check_cancel(curthread, ucp); + errno = err; +} + +typedef void (*ohandler)(int sig, int code, + struct sigcontext *scp, char *addr, __sighandler_t *catcher); + +/* + * The signal handler wrapper is entered with all signal masked. + */ +static void +thr_sighandler(int sig, siginfo_t *info, void *_ucp) +{ + struct pthread *curthread = _get_curthread(); + ucontext_t *ucp = _ucp; + struct sigaction act; + int err; + + err = errno; + _thr_rwl_rdlock(&_thr_sigact[sig-1].lock); + act = _thr_sigact[sig-1].sigact; + _thr_rwl_unlock(&_thr_sigact[sig-1].lock); + errno = err; + + /* + * if a thread is in critical region, for example it holds low level locks, + * try to defer the signal processing, however if the signal is synchronous + * signal, it means a bad thing has happened, this is a programming error, + * resuming fault point can not help anything (normally causes deadloop), + * so here we let user code handle it immediately. + */ + if (THR_IN_CRITICAL(curthread) && SIGISMEMBER(_thr_deferset, sig)) { + memcpy(&curthread->deferred_sigact, &act, sizeof(struct sigaction)); + memcpy(&curthread->deferred_siginfo, info, sizeof(siginfo_t)); + curthread->deferred_sigmask = ucp->uc_sigmask; + /* mask all signals, we will restore it later. */ + ucp->uc_sigmask = _thr_deferset; + return; + } + + handle_signal(&act, sig, info, ucp); +} + +static void +handle_signal(struct sigaction *actp, int sig, siginfo_t *info, ucontext_t *ucp) { struct pthread *curthread = _get_curthread(); + ucontext_t uc2; + __siginfohandler_t *sigfunc; + int cancel_defer; + int cancel_point; + int cancel_async; + int cancel_enable; + int in_sigsuspend; + int err; + + /* add previous level mask */ + SIGSETOR(actp->sa_mask, ucp->uc_sigmask); + + /* add this signal's mask */ + if (!(actp->sa_flags & SA_NODEFER)) + SIGADDSET(actp->sa_mask, sig); + + in_sigsuspend = curthread->in_sigsuspend; + curthread->in_sigsuspend = 0; + + /* + * if thread is in deferred cancellation mode, disable cancellation + * in signal handler. + * if user signal handler calls a cancellation point function, e.g, + * it calls write() to write data to file, because write() is a + * cancellation point, the thread is immediately cancelled if + * cancellation is pending, to avoid this problem while thread is in + * deferring mode, cancellation is temporarily disabled. + */ + cancel_defer = curthread->cancel_defer; + cancel_point = curthread->cancel_point; + cancel_async = curthread->cancel_async; + cancel_enable = curthread->cancel_enable; + curthread->cancel_point = 0; + curthread->cancel_defer = 0; + if (!cancel_async) + curthread->cancel_enable = 0; - curthread->in_sigcancel_handler++; - _thr_ast(curthread); - curthread->in_sigcancel_handler--; + /* restore correct mask before calling user handler */ + __sys_sigprocmask(SIG_SETMASK, &actp->sa_mask, NULL); + + sigfunc = actp->sa_sigaction; + + /* + * We have already reset cancellation point flags, so if user's code + * longjmp()s out of its signal handler, wish its jmpbuf was set + * outside of a cancellation point, in most cases, this would be + * true. however, ther is no way to save cancel_enable in jmpbuf, + * so after setjmps() returns once more, the user code may need to + * re-set cancel_enable flag by calling pthread_setcancelstate(). + */ + if ((actp->sa_flags & SA_SIGINFO) != 0) + (*(sigfunc))(sig, info, ucp); + else { + ((ohandler)(*sigfunc))( + sig, info->si_code, (struct sigcontext *)ucp, + info->si_addr, (__sighandler_t *)sigfunc); + } + err = errno; + + curthread->in_sigsuspend = in_sigsuspend; + curthread->cancel_defer = cancel_defer; + curthread->cancel_point = cancel_point; + curthread->cancel_enable = cancel_enable; + + memcpy(&uc2, ucp, sizeof(uc2)); + SIGDELSET(uc2.uc_sigmask, SIGCANCEL); + + /* reschedule cancellation */ + check_cancel(curthread, &uc2); + errno = err; + __sys_sigreturn(&uc2); } void _thr_ast(struct pthread *curthread) { - if (THR_IN_CRITICAL(curthread)) + if (!THR_IN_CRITICAL(curthread)) { + check_deferred_signal(curthread); + check_suspend(curthread); + check_cancel(curthread, NULL); + } +} + +/* reschedule cancellation */ +static void +check_cancel(struct pthread *curthread, ucontext_t *ucp) +{ + + if (__predict_true(!curthread->cancel_pending || !curthread->cancel_enable || + curthread->cancelling)) return; - if (curthread->cancel_pending && curthread->cancel_enable - && !curthread->cancelling) { - if (curthread->cancel_async) { - /* - * asynchronous cancellation mode, act upon - * immediately. - */ - _pthread_exit(PTHREAD_CANCELED); - } else { - /* - * Otherwise, we are in defer mode, and we are at - * cancel point, tell kernel to not block the current - * thread on next cancelable system call. - * - * There are two cases we should call thr_wake() to - * turn on TDP_WAKEUP in kernel: - * 1) we are going to call a cancelable system call, - * non-zero cancel_point means we are already in - * cancelable state, next system call is cancelable. - * 2) because _thr_ast() may be called by - * THR_CRITICAL_LEAVE() which is used by rtld rwlock - * and any libthr internal locks, when rtld rwlock - * is used, it is mostly caused my an unresolved PLT. - * those routines may clear the TDP_WAKEUP flag by - * invoking some system calls, in those cases, we - * also should reenable the flag. - */ - if (curthread->cancel_point) { - if (curthread->cancel_defer) - thr_wake(curthread->tid); - else - _pthread_exit(PTHREAD_CANCELED); - } + if (curthread->cancel_async) { + /* + * asynchronous cancellation mode, act upon + * immediately. + */ + _pthread_exit_mask(PTHREAD_CANCELED, + ucp? &ucp->uc_sigmask : NULL); + } else { + /* + * Otherwise, we are in defer mode, and we are at + * cancel point, tell kernel to not block the current + * thread on next cancelable system call. + * + * There are three cases we should call thr_wake() to + * turn on TDP_WAKEUP or send SIGCANCEL in kernel: + * 1) we are going to call a cancelable system call, + * non-zero cancel_point means we are already in + * cancelable state, next system call is cancelable. + * 2) because _thr_ast() may be called by + * THR_CRITICAL_LEAVE() which is used by rtld rwlock + * and any libthr internal locks, when rtld rwlock + * is used, it is mostly caused my an unresolved PLT. + * those routines may clear the TDP_WAKEUP flag by + * invoking some system calls, in those cases, we + * also should reenable the flag. + * 3) thread is in sigsuspend(), and the syscall insists + * on getting a signal before it agrees to return. + */ + if (curthread->cancel_point) { + if (curthread->in_sigsuspend && ucp) { + SIGADDSET(ucp->uc_sigmask, SIGCANCEL); + curthread->unblock_sigcancel = 1; + _thr_send_sig(curthread, SIGCANCEL); + } else + thr_wake(curthread->tid); } } +} + +static void +check_deferred_signal(struct pthread *curthread) +{ + ucontext_t uc; + struct sigaction act; + siginfo_t info; + volatile int first; - if (__predict_false((curthread->flags & - (THR_FLAGS_NEED_SUSPEND | THR_FLAGS_SUSPENDED)) - == THR_FLAGS_NEED_SUSPEND)) - _thr_suspend_check(curthread); + if (__predict_true(curthread->deferred_siginfo.si_signo == 0)) + return; + first = 1; + getcontext(&uc); + if (first) { + first = 0; + act = curthread->deferred_sigact; + uc.uc_sigmask = curthread->deferred_sigmask; + memcpy(&info, &curthread->deferred_siginfo, sizeof(siginfo_t)); + /* remove signal */ + curthread->deferred_siginfo.si_signo = 0; + if (act.sa_flags & SA_RESETHAND) { + struct sigaction tact; + + tact = act; + tact.sa_handler = SIG_DFL; + _sigaction(info.si_signo, &tact, NULL); + } + handle_signal(&act, info.si_signo, &info, &uc); + } } -void -_thr_suspend_check(struct pthread *curthread) +static void +check_suspend(struct pthread *curthread) { uint32_t cycle; - int err; + + if (__predict_true((curthread->flags & + (THR_FLAGS_NEED_SUSPEND | THR_FLAGS_SUSPENDED)) + != THR_FLAGS_NEED_SUSPEND)) + return; if (curthread->force_exit) return; - err = errno; /* * Blocks SIGCANCEL which other threads must send. */ @@ -188,15 +395,7 @@ _thr_suspend_check(struct pthread *curth THR_UMUTEX_UNLOCK(curthread, &(curthread)->lock); curthread->critical_count--; - /* - * Unblocks SIGCANCEL, it is possible a new SIGCANCEL is ready and - * a new signal frame will nest us, this seems a problem because - * stack will grow and overflow, but because kernel will automatically - * mask the SIGCANCEL when delivering the signal, so we at most only - * have one nesting signal frame, this should be fine. - */ _thr_signal_unblock(curthread); - errno = err; } void @@ -204,11 +403,80 @@ _thr_signal_init(void) { struct sigaction act; - /* Install cancel handler. */ - SIGEMPTYSET(act.sa_mask); - act.sa_flags = SA_SIGINFO | SA_RESTART; + /* Install SIGCANCEL handler. */ + SIGFILLSET(act.sa_mask); + act.sa_flags = SA_SIGINFO; act.sa_sigaction = (__siginfohandler_t *)&sigcancel_handler; __sys_sigaction(SIGCANCEL, &act, NULL); + + /* Unblock SIGCANCEL */ + SIGEMPTYSET(act.sa_mask); + SIGADDSET(act.sa_mask, SIGCANCEL); + __sys_sigprocmask(SIG_UNBLOCK, &act.sa_mask, NULL); +} + +/* + * called from rtld with rtld_lock locked, because rtld_lock is + * a critical region, so all signals have already beeen masked. + */ +void +_thr_sigact_unload(struct dl_phdr_info *phdr_info) +{ + struct urwlock *rwlp; + struct sigaction *actp; + struct sigaction kact; + void (*handler)(int); + int sig; + + for (sig = 1; sig < _SIG_MAXSIG; sig++) { + actp = &_thr_sigact[sig].sigact; +retry: + handler = actp->sa_handler; + if (handler != SIG_DFL && handler != SIG_IGN && + __elf_phdr_match_addr(phdr_info, handler)) { + rwlp = &_thr_sigact[sig].lock; + _thr_rwl_wrlock(rwlp); + if (handler != actp->sa_handler) { + _thr_rwl_unlock(rwlp); + goto retry; + } + actp->sa_handler = SIG_DFL; + actp->sa_flags = SA_SIGINFO; + SIGEMPTYSET(actp->sa_mask); + if (__sys_sigaction(sig, NULL, &kact) == 0 && + kact.sa_handler != SIG_DFL && + kact.sa_handler != SIG_IGN) + __sys_sigaction(sig, actp, NULL); + _thr_rwl_unlock(rwlp); + } + } +} + +void +_thr_signal_prefork(void) +{ + int i; + + for (i = 1; i < _SIG_MAXSIG; ++i) + _thr_rwl_rdlock(&_thr_sigact[i-1].lock); +} + +void +_thr_signal_postfork(void) +{ + int i; + + for (i = 1; i < _SIG_MAXSIG; ++i) + _thr_rwl_unlock(&_thr_sigact[i-1].lock); +} + +void +_thr_signal_postfork_child(void) +{ + int i; + + for (i = 1; i < _SIG_MAXSIG; ++i) + bzero(&_thr_sigact[i-1].lock, sizeof(struct urwlock)); } void @@ -221,14 +489,11 @@ __weak_reference(___pause, pause); int ___pause(void) { - struct pthread *curthread = _get_curthread(); - int ret; + sigset_t oset; - _thr_cancel_enter(curthread); - ret = __pause(); - _thr_cancel_leave(curthread); - - return ret; + if (_sigprocmask(SIG_BLOCK, NULL, &oset) == -1) + return (-1); + return (__sigsuspend(&oset)); } __weak_reference(_raise, raise); @@ -236,13 +501,7 @@ __weak_reference(_raise, raise); int _raise(int sig) { - int ret; - - if (!_thr_isthreaded()) - ret = kill(getpid(), sig); - else - ret = _thr_send_sig(_get_curthread(), sig); - return (ret); + return _thr_send_sig(_get_curthread(), sig); } __weak_reference(_sigaction, sigaction); @@ -250,14 +509,65 @@ __weak_reference(_sigaction, sigaction); int _sigaction(int sig, const struct sigaction * act, struct sigaction * oact) { - /* Check if the signal number is out of range: */ + struct sigaction newact, oldact, oldact2; + sigset_t oldset; + int ret = 0, err = 0; + if (!_SIG_VALID(sig) || sig == SIGCANCEL) { - /* Return an invalid argument: */ errno = EINVAL; return (-1); } - return __sys_sigaction(sig, act, oact); + if (act) + newact = *act; + + __sys_sigprocmask(SIG_SETMASK, &_thr_maskset, &oldset); + _thr_rwl_wrlock(&_thr_sigact[sig-1].lock); + + if (act != NULL) { + oldact2 = _thr_sigact[sig-1].sigact; + + /* + * if a new sig handler is SIG_DFL or SIG_IGN, + * don't remove old handler from _thr_sigact[], + * so deferred signals still can use the handlers, + * multiple threads invoking sigaction itself is + * a race condition, so it is not a problem. + */ + if (newact.sa_handler != SIG_DFL && + newact.sa_handler != SIG_IGN) { + _thr_sigact[sig-1].sigact = newact; + remove_thr_signals( + &_thr_sigact[sig-1].sigact.sa_mask); + newact.sa_flags &= ~SA_NODEFER; + newact.sa_flags |= SA_SIGINFO; + newact.sa_sigaction = thr_sighandler; + newact.sa_mask = _thr_maskset; /* mask all signals */ + } + if ((ret = __sys_sigaction(sig, &newact, &oldact))) { + err = errno; + _thr_sigact[sig-1].sigact = oldact2; + } + } else if (oact != NULL) { + ret = __sys_sigaction(sig, NULL, &oldact); + err = errno; + } + + if (oldact.sa_handler != SIG_DFL && + oldact.sa_handler != SIG_IGN) { + oldact = _thr_sigact[sig-1].sigact; + } + + _thr_rwl_unlock(&_thr_sigact[sig-1].lock); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 03:11:21 2010 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 C9F1810656AA; Wed, 1 Sep 2010 03:11:21 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B91E18FC19; Wed, 1 Sep 2010 03:11:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o813BLNj049643; Wed, 1 Sep 2010 03:11:21 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o813BLIQ049636; Wed, 1 Sep 2010 03:11:21 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009010311.o813BLIQ049636@svn.freebsd.org> From: David Xu Date: Wed, 1 Sep 2010 03:11: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: r212077 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 03:11:21 -0000 Author: davidxu Date: Wed Sep 1 03:11:21 2010 New Revision: 212077 URL: http://svn.freebsd.org/changeset/base/212077 Log: Change atfork lock from mutex to rwlock, also make mutexes used by malloc() module private type, when private type mutex is locked/unlocked, thread critical region is entered or leaved. These changes makes fork() async-signal safe which required by POSIX. Note that user's atfork handler still needs to be async-signal safe, but it is not problem of libthr, it is user's responsiblity. Modified: head/lib/libthr/thread/thr_fork.c head/lib/libthr/thread/thr_init.c head/lib/libthr/thread/thr_mutex.c head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_umtx.c head/lib/libthr/thread/thr_umtx.h Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Wed Sep 1 02:18:33 2010 (r212076) +++ head/lib/libthr/thread/thr_fork.c Wed Sep 1 03:11:21 2010 (r212077) @@ -89,9 +89,9 @@ _pthread_atfork(void (*prepare)(void), v af->prepare = prepare; af->parent = parent; af->child = child; - THR_UMUTEX_LOCK(curthread, &_thr_atfork_lock); + _thr_rwl_rdlock(&_thr_atfork_lock); TAILQ_INSERT_TAIL(&_thr_atfork_list, af, qe); - THR_UMUTEX_UNLOCK(curthread, &_thr_atfork_lock); + _thr_rwl_unlock(&_thr_atfork_lock); return (0); } @@ -104,7 +104,7 @@ __pthread_cxa_finalize(struct dl_phdr_in _thr_check_init(); curthread = _get_curthread(); - THR_UMUTEX_LOCK(curthread, &_thr_atfork_lock); + _thr_rwl_wrlock(&_thr_atfork_lock); TAILQ_FOREACH_SAFE(af, &_thr_atfork_list, qe, af1) { if (__elf_phdr_match_addr(phdr_info, af->prepare) || __elf_phdr_match_addr(phdr_info, af->parent) || @@ -113,7 +113,7 @@ __pthread_cxa_finalize(struct dl_phdr_in free(af); } } - THR_UMUTEX_UNLOCK(curthread, &_thr_atfork_lock); + _thr_rwl_unlock(&_thr_atfork_lock); _thr_tsd_unload(phdr_info); _thr_sigact_unload(phdr_info); } @@ -137,7 +137,7 @@ _fork(void) curthread = _get_curthread(); - THR_UMUTEX_LOCK(curthread, &_thr_atfork_lock); + _thr_rwl_rdlock(&_thr_atfork_lock); /* Run down atfork prepare handlers. */ TAILQ_FOREACH_REVERSE(af, &_thr_atfork_list, atfork_head, qe) { @@ -146,6 +146,12 @@ _fork(void) } /* + * Block all signals until we reach a safe point. + */ + _thr_signal_block(curthread); + _thr_signal_prefork(); + + /* * All bets are off as to what should happen soon if the parent * process was not so kindly as to set up pthread fork hooks to * relinquish all running threads. @@ -158,12 +164,6 @@ _fork(void) was_threaded = 0; } - /* - * Block all signals until we reach a safe point. - */ - _thr_signal_block(curthread); - _thr_signal_prefork(); - /* Fork a new process: */ if ((ret = __sys_fork()) == 0) { /* Child process */ @@ -182,7 +182,7 @@ _fork(void) /* clear other threads locked us. */ _thr_umutex_init(&curthread->lock); - _thr_umutex_init(&_thr_atfork_lock); + _mutex_fork(curthread); _thr_signal_postfork_child(); @@ -192,13 +192,12 @@ _fork(void) /* reinitialize libc spinlocks. */ _thr_spinlock_init(); - _mutex_fork(curthread); /* reinitalize library. */ _libpthread_init(curthread); - /* Ready to continue, unblock signals. */ - _thr_signal_unblock(curthread); + /* atfork is reinitializeded by _libpthread_init()! */ + _thr_rwl_rdlock(&_thr_atfork_lock); if (was_threaded) { __isthreaded = 1; @@ -206,32 +205,36 @@ _fork(void) __isthreaded = 0; } + /* Ready to continue, unblock signals. */ + _thr_signal_unblock(curthread); + /* Run down atfork child handlers. */ TAILQ_FOREACH(af, &_thr_atfork_list, qe) { if (af->child != NULL) af->child(); } + _thr_rwlock_unlock(&_thr_atfork_lock); } else { /* Parent process */ errsave = errno; _thr_signal_postfork(); - /* Ready to continue, unblock signals. */ - _thr_signal_unblock(curthread); - if (was_threaded) { _rtld_atfork_post(rtld_locks); _malloc_postfork(); } + /* Ready to continue, unblock signals. */ + _thr_signal_unblock(curthread); + /* Run down atfork parent handlers. */ TAILQ_FOREACH(af, &_thr_atfork_list, qe) { if (af->parent != NULL) af->parent(); } - THR_UMUTEX_UNLOCK(curthread, &_thr_atfork_lock); + _thr_rwlock_unlock(&_thr_atfork_lock); } errno = errsave; Modified: head/lib/libthr/thread/thr_init.c ============================================================================== --- head/lib/libthr/thread/thr_init.c Wed Sep 1 02:18:33 2010 (r212076) +++ head/lib/libthr/thread/thr_init.c Wed Sep 1 03:11:21 2010 (r212077) @@ -65,7 +65,7 @@ pthreadlist _thread_list = TAILQ_HEAD_IN pthreadlist _thread_gc_list = TAILQ_HEAD_INITIALIZER(_thread_gc_list); int _thread_active_threads = 1; atfork_head _thr_atfork_list = TAILQ_HEAD_INITIALIZER(_thr_atfork_list); -struct umutex _thr_atfork_lock = DEFAULT_UMUTEX; +struct urwlock _thr_atfork_lock = DEFAULT_URWLOCK; struct pthread_prio _thr_priorities[3] = { {RTP_PRIO_MIN, RTP_PRIO_MAX, 0}, /* FIFO */ @@ -427,7 +427,7 @@ init_private(void) _thr_umutex_init(&_cond_static_lock); _thr_umutex_init(&_rwlock_static_lock); _thr_umutex_init(&_keytable_lock); - _thr_umutex_init(&_thr_atfork_lock); + _thr_urwlock_init(&_thr_atfork_lock); _thr_umutex_init(&_thr_event_lock); _thr_once_init(); _thr_spinlock_init(); Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Wed Sep 1 02:18:33 2010 (r212076) +++ head/lib/libthr/thread/thr_mutex.c Wed Sep 1 03:11:21 2010 (r212077) @@ -224,8 +224,12 @@ _pthread_mutex_init_calloc_cb(pthread_mu .m_ceiling = 0 }; static const struct pthread_mutex_attr *pattr = &attr; + int ret; - return mutex_init(mutex, (pthread_mutexattr_t *)&pattr, calloc_cb); + ret = mutex_init(mutex, (pthread_mutexattr_t *)&pattr, calloc_cb); + if (ret == 0) + (*mutex)->m_private = 1; + return (ret); } void @@ -319,13 +323,16 @@ mutex_trylock_common(struct pthread *cur id = TID(curthread); m = *mutex; + if (m->m_private) + THR_CRITICAL_ENTER(curthread); ret = _thr_umutex_trylock(&m->m_lock, id); if (ret == 0) { ENQUEUE_MUTEX(curthread, m); } else if (m->m_owner == curthread) { ret = mutex_self_trylock(m); } /* else {} */ - + if (ret && m->m_private) + THR_CRITICAL_LEAVE(curthread); return (ret); } @@ -417,13 +424,19 @@ static inline int mutex_lock_common(struct pthread *curthread, struct pthread_mutex *m, const struct timespec *abstime) { + int ret; + if (m->m_private) + THR_CRITICAL_ENTER(curthread); if (_thr_umutex_trylock2(&m->m_lock, TID(curthread)) == 0) { ENQUEUE_MUTEX(curthread, m); - return (0); + ret = 0; + } else { + ret = mutex_lock_sleep(curthread, m, abstime); } - - return (mutex_lock_sleep(curthread, m, abstime)); + if (ret && m->m_private) + THR_CRITICAL_LEAVE(curthread); + return (ret); } int @@ -625,6 +638,8 @@ mutex_unlock_common(pthread_mutex_t *mut MUTEX_INIT_LINK(m); _thr_umutex_unlock(&m->m_lock, id); } + if (m->m_private) + THR_CRITICAL_LEAVE(curthread); return (0); } @@ -660,6 +675,9 @@ _mutex_cv_unlock(pthread_mutex_t *mutex, } MUTEX_INIT_LINK(m); _thr_umutex_unlock(&m->m_lock, TID(curthread)); + + if (m->m_private) + THR_CRITICAL_LEAVE(curthread); return (0); } Modified: head/lib/libthr/thread/thr_private.h ============================================================================== --- head/lib/libthr/thread/thr_private.h Wed Sep 1 02:18:33 2010 (r212076) +++ head/lib/libthr/thread/thr_private.h Wed Sep 1 03:11:21 2010 (r212077) @@ -132,6 +132,7 @@ struct pthread_mutex { int m_refcount; int m_spinloops; int m_yieldloops; + int m_private; /* * Link for all mutexes a thread currently owns. */ @@ -587,7 +588,7 @@ extern pthreadlist _thread_gc_list __hid extern int _thread_active_threads; extern atfork_head _thr_atfork_list __hidden; -extern struct umutex _thr_atfork_lock __hidden; +extern struct urwlock _thr_atfork_lock __hidden; /* Default thread attributes: */ extern struct pthread_attr _pthread_attr_default __hidden; Modified: head/lib/libthr/thread/thr_umtx.c ============================================================================== --- head/lib/libthr/thread/thr_umtx.c Wed Sep 1 02:18:33 2010 (r212076) +++ head/lib/libthr/thread/thr_umtx.c Wed Sep 1 03:11:21 2010 (r212077) @@ -47,6 +47,13 @@ _thr_umutex_init(struct umutex *mtx) *mtx = default_mtx; } +void +_thr_urwlock_init(struct urwlock *rwl) +{ + static struct urwlock default_rwl = DEFAULT_URWLOCK; + *rwl = default_rwl; +} + int __thr_umutex_lock(struct umutex *mtx, uint32_t id) { Modified: head/lib/libthr/thread/thr_umtx.h ============================================================================== --- head/lib/libthr/thread/thr_umtx.h Wed Sep 1 02:18:33 2010 (r212076) +++ head/lib/libthr/thread/thr_umtx.h Wed Sep 1 03:11:21 2010 (r212077) @@ -32,7 +32,8 @@ #include #include -#define DEFAULT_UMUTEX {0,0, {0,0},{0,0,0,0}} +#define DEFAULT_UMUTEX {0,0,{0,0},{0,0,0,0}} +#define DEFAULT_URWLOCK {0,0,0,0,{0,0,0,0}} int __thr_umutex_lock(struct umutex *mtx, uint32_t id) __hidden; int __thr_umutex_timedlock(struct umutex *mtx, uint32_t id, @@ -43,6 +44,8 @@ int __thr_umutex_set_ceiling(struct umut uint32_t *oldceiling) __hidden; void _thr_umutex_init(struct umutex *mtx) __hidden; +void _thr_urwlock_init(struct urwlock *rwl) __hidden; + int _thr_umtx_wait(volatile long *mtx, long exp, const struct timespec *timeout) __hidden; int _thr_umtx_wait_uint(volatile u_int *mtx, u_int exp, From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 03:55:11 2010 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 F2E911065672; Wed, 1 Sep 2010 03:55:10 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E317E8FC18; Wed, 1 Sep 2010 03:55:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o813tARd050522; Wed, 1 Sep 2010 03:55:10 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o813tAjI050520; Wed, 1 Sep 2010 03:55:10 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009010355.o813tAjI050520@svn.freebsd.org> From: David Xu Date: Wed, 1 Sep 2010 03:55: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: r212078 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 03:55:11 -0000 Author: davidxu Date: Wed Sep 1 03:55:10 2010 New Revision: 212078 URL: http://svn.freebsd.org/changeset/base/212078 Log: pthread_atfork should acquire writer lock and protect the code with critical region. Modified: head/lib/libthr/thread/thr_fork.c Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Wed Sep 1 03:11:21 2010 (r212077) +++ head/lib/libthr/thread/thr_fork.c Wed Sep 1 03:55:10 2010 (r212078) @@ -89,9 +89,11 @@ _pthread_atfork(void (*prepare)(void), v af->prepare = prepare; af->parent = parent; af->child = child; - _thr_rwl_rdlock(&_thr_atfork_lock); + THR_CRITICAL_ENTER(curthread); + _thr_rwl_wrlock(&_thr_atfork_lock); TAILQ_INSERT_TAIL(&_thr_atfork_list, af, qe); _thr_rwl_unlock(&_thr_atfork_lock); + THR_CRITICAL_LEAVE(curthread); return (0); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 05:34:17 2010 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 D67CF106566B; Wed, 1 Sep 2010 05:34:17 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6A468FC14; Wed, 1 Sep 2010 05:34:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o815YHVc052631; Wed, 1 Sep 2010 05:34:17 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o815YHJV052629; Wed, 1 Sep 2010 05:34:17 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <201009010534.o815YHJV052629@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 1 Sep 2010 05:34: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: r212079 - head/sys/fs/ext2fs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 05:34:17 -0000 Author: lulf Date: Wed Sep 1 05:34:17 2010 New Revision: 212079 URL: http://svn.freebsd.org/changeset/base/212079 Log: - Remove duplicate comment. PR: kern/148820 Submitted by: pluknet Modified: head/sys/fs/ext2fs/ext2_alloc.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Wed Sep 1 03:55:10 2010 (r212078) +++ head/sys/fs/ext2fs/ext2_alloc.c Wed Sep 1 05:34:17 2010 (r212079) @@ -75,20 +75,6 @@ static daddr_t ext2_mapsearch(struct m_ * inode for the file. * 2) quadradically rehash into other cylinder groups, until an * available block is located. - * - * A preference may be optionally specified. If a preference is given - * the following hierarchy is used to allocate a block: - * 1) allocate the requested block. - * 2) allocate a rotationally optimal block in the same cylinder. - * 3) allocate a block in the same cylinder group. - * 4) quadradically rehash into other cylinder groups, until an - * available block is located. - * If no block preference is given the following hierarchy is used - * to allocate a block: - * 1) allocate a block in the cylinder group that contains the - * inode for the file. - * 2) quadradically rehash into other cylinder groups, until an - * available block is located. */ int From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 05:39:56 2010 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 A645E1065672; Wed, 1 Sep 2010 05:39:56 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 957DF8FC12; Wed, 1 Sep 2010 05:39:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o815dueI052777; Wed, 1 Sep 2010 05:39:56 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o815duMQ052775; Wed, 1 Sep 2010 05:39:56 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201009010539.o815duMQ052775@svn.freebsd.org> From: Maxim Konovalov Date: Wed, 1 Sep 2010 05:39:56 +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: r212080 - in stable/8/etc: defaults periodic/daily X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 05:39:56 -0000 Author: maxim Date: Wed Sep 1 05:39:56 2010 New Revision: 212080 URL: http://svn.freebsd.org/changeset/base/212080 Log: MFC r211801: fix typo. Modified: stable/8/etc/defaults/rc.conf Directory Properties: stable/8/etc/ (props changed) stable/8/etc/periodic/daily/ (props changed) stable/8/etc/periodic/daily/800.scrub-zfs (props changed) Modified: stable/8/etc/defaults/rc.conf ============================================================================== --- stable/8/etc/defaults/rc.conf Wed Sep 1 05:34:17 2010 (r212079) +++ stable/8/etc/defaults/rc.conf Wed Sep 1 05:39:56 2010 (r212080) @@ -212,7 +212,7 @@ ifconfig_lo0="inet 127.0.0.1" # default #ifconfig_ed0_ipx="ipx 0x00010010" # Sample IPX address family entry. #ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0. #vlans_fxp0="101 vlan0" # vlan(4) interfaces for fxp0 device -#create_arg_vlan0="vlan 102" # vlan tag for vlan0 device +#create_args_vlan0="vlan 102" # vlan tag for vlan0 device #wlans_ath0="wlan0" # wlan(4) interfaces for ath0 device #wlandebug_wlan0="scan+auth+assoc" # Set debug flags with wlanddebug(8) #ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 06:43:41 2010 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 AC01D10656AD; Wed, 1 Sep 2010 06:43:41 +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 9BA748FC12; Wed, 1 Sep 2010 06:43:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o816hfje054057; Wed, 1 Sep 2010 06:43:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o816hf5k054055; Wed, 1 Sep 2010 06:43:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009010643.o816hf5k054055@svn.freebsd.org> From: Alexander Motin Date: Wed, 1 Sep 2010 06:43:41 +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: r212081 - 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: Wed, 01 Sep 2010 06:43:41 -0000 Author: mav Date: Wed Sep 1 06:43:41 2010 New Revision: 212081 URL: http://svn.freebsd.org/changeset/base/212081 Log: Increase device reset timeout from 10 to 15 seconds, same as in ahci(4). Some devices found need about 10-12 seconds to spinup. Modified: head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Wed Sep 1 05:39:56 2010 (r212080) +++ head/sys/dev/ata/chipsets/ata-ahci.c Wed Sep 1 06:43:41 2010 (r212081) @@ -815,7 +815,7 @@ ata_ahci_hardreset(device_t dev, int por if (!ata_sata_phy_reset(dev, port, 0)) return (ENOENT); /* Wait for clearing busy status. */ - if (ata_ahci_wait_ready(dev, 10000)) { + if (ata_ahci_wait_ready(dev, 15000)) { device_printf(dev, "hardware reset timeout\n"); return (EBUSY); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 06:46:23 2010 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 70DD3106564A; Wed, 1 Sep 2010 06:46:23 +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 D6E7B8FC1A; Wed, 1 Sep 2010 06:46:22 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o816kI9A082195 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Sep 2010 09:46:18 +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.4/8.14.4) with ESMTP id o816kIGr032196; Wed, 1 Sep 2010 09:46:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o816kIYH032195; Wed, 1 Sep 2010 09:46:18 +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: Wed, 1 Sep 2010 09:46:18 +0300 From: Kostik Belousov To: Dimitry Andric Message-ID: <20100901064618.GE2396@deviant.kiev.zoral.com.ua> References: <201008311811.o7VIBoC5037894@svn.freebsd.org> <20100831195128.GC2396@deviant.kiev.zoral.com.ua> <4C7D61E3.6020409@FreeBSD.org> <20100831203358.GD2396@deviant.kiev.zoral.com.ua> <4C7D7151.7070001@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0gFGHS8Pm/ryTu+B" Content-Disposition: inline In-Reply-To: <4C7D7151.7070001@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=-2.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_20, DNS_FROM_OPENWHOIS autolearn=no 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: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 06:46:23 -0000 --0gFGHS8Pm/ryTu+B Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 31, 2010 at 11:17:05PM +0200, Dimitry Andric wrote: > Indeed, any subtraction is only in "u_char *p =3D (u_char *)PTOV(0);". If > you prefer, I will revert to the old expression, or maybe we could use > John's suggestion of: >=20 > return (*(u_char *)PTOV(0x401) * 128 * 1024 + > *(uint16_t *)PTOV(0x594) * 1024 * 1024); >=20 > which is less obfuscated. John suggestion looks best, and it makes code cleaner too. --0gFGHS8Pm/ryTu+B Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx99rkACgkQC3+MBN1Mb4hZegCfTUNbPV6UVQo1X2914eYI3NiK kcUAoOz+TSKZKrF9iKrBpb2gNPe1wuiL =/Dlr -----END PGP SIGNATURE----- --0gFGHS8Pm/ryTu+B-- From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 06:51:43 2010 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 186BE10656B6; Wed, 1 Sep 2010 06:51:43 +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 077AA8FC22; Wed, 1 Sep 2010 06:51:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o816pgl2054290; Wed, 1 Sep 2010 06:51:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o816pgv2054288; Wed, 1 Sep 2010 06:51:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201009010651.o816pgv2054288@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 1 Sep 2010 06:51:42 +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: r212082 - stable/8/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: Wed, 01 Sep 2010 06:51:43 -0000 Author: kib Date: Wed Sep 1 06:51:42 2010 New Revision: 212082 URL: http://svn.freebsd.org/changeset/base/212082 Log: MFC r211966: Use NULL instead of 0 for pointer in example. Modified: stable/8/lib/libc/sys/sigaltstack.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/sys/sigaltstack.2 ============================================================================== --- stable/8/lib/libc/sys/sigaltstack.2 Wed Sep 1 06:43:41 2010 (r212081) +++ stable/8/lib/libc/sys/sigaltstack.2 Wed Sep 1 06:51:42 2010 (r212082) @@ -104,7 +104,7 @@ if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == /* error return */ sigstk.ss_size = SIGSTKSZ; sigstk.ss_flags = 0; -if (sigaltstack(&sigstk,0) < 0) +if (sigaltstack(&sigstk, NULL) < 0) perror("sigaltstack"); .Ed An alternative approach is provided for programs with signal handlers From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 07:09:47 2010 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 13E1D10656B0; Wed, 1 Sep 2010 07:09:47 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 033E78FC19; Wed, 1 Sep 2010 07:09:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8179knH054706; Wed, 1 Sep 2010 07:09:46 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8179kCP054704; Wed, 1 Sep 2010 07:09:46 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009010709.o8179kCP054704@svn.freebsd.org> From: David Xu Date: Wed, 1 Sep 2010 07:09: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: r212083 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 07:09:47 -0000 Author: davidxu Date: Wed Sep 1 07:09:46 2010 New Revision: 212083 URL: http://svn.freebsd.org/changeset/base/212083 Log: In function __pthread_cxa_finalize(), also make code for removing atfork handler be async-signal safe. Modified: head/lib/libthr/thread/thr_fork.c Modified: head/lib/libthr/thread/thr_fork.c ============================================================================== --- head/lib/libthr/thread/thr_fork.c Wed Sep 1 06:51:42 2010 (r212082) +++ head/lib/libthr/thread/thr_fork.c Wed Sep 1 07:09:46 2010 (r212083) @@ -100,22 +100,29 @@ _pthread_atfork(void (*prepare)(void), v void __pthread_cxa_finalize(struct dl_phdr_info *phdr_info) { + atfork_head temp_list = TAILQ_HEAD_INITIALIZER(temp_list); struct pthread *curthread; struct pthread_atfork *af, *af1; _thr_check_init(); curthread = _get_curthread(); + THR_CRITICAL_ENTER(curthread); _thr_rwl_wrlock(&_thr_atfork_lock); TAILQ_FOREACH_SAFE(af, &_thr_atfork_list, qe, af1) { if (__elf_phdr_match_addr(phdr_info, af->prepare) || __elf_phdr_match_addr(phdr_info, af->parent) || __elf_phdr_match_addr(phdr_info, af->child)) { TAILQ_REMOVE(&_thr_atfork_list, af, qe); - free(af); + TAILQ_INSERT_TAIL(&temp_list, af, qe); } } _thr_rwl_unlock(&_thr_atfork_lock); + THR_CRITICAL_LEAVE(curthread); + while ((af = TAILQ_FIRST(&temp_list)) != NULL) { + TAILQ_REMOVE(&temp_list, af, qe); + free(af); + } _thr_tsd_unload(phdr_info); _thr_sigact_unload(phdr_info); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 08:32:40 2010 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 A801210656C9; Wed, 1 Sep 2010 08:32:40 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 968308FC17; Wed, 1 Sep 2010 08:32:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o818WeS6056282; Wed, 1 Sep 2010 08:32:40 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o818WeBP056280; Wed, 1 Sep 2010 08:32:40 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201009010832.o818WeBP056280@svn.freebsd.org> From: Maxim Konovalov Date: Wed, 1 Sep 2010 08:32: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: r212084 - head/sbin/geom/core X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 08:32:40 -0000 Author: maxim Date: Wed Sep 1 08:32:40 2010 New Revision: 212084 URL: http://svn.freebsd.org/changeset/base/212084 Log: o List MOUNTVER and SCHED classes. X-ref gsched(8). Bump Dd. PR: docs/149925 Submitted by: arundel Modified: head/sbin/geom/core/geom.8 Modified: head/sbin/geom/core/geom.8 ============================================================================== --- head/sbin/geom/core/geom.8 Wed Sep 1 07:09:46 2010 (r212083) +++ head/sbin/geom/core/geom.8 Wed Sep 1 08:32:40 2010 (r212084) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 5, 2008 +.Dd September 1, 2010 .Dt GEOM 8 .Os .Sh NAME @@ -120,6 +120,8 @@ LABEL .It MIRROR .It +MOUNTVER +.It MULTIPATH .It NOP @@ -128,6 +130,8 @@ PART .It RAID3 .It +SCHED +.It SHSEC .It STRIPE @@ -177,6 +181,7 @@ geom md unload .Xr gnop 8 , .Xr gpart 8 , .Xr graid3 8 , +.Xr gsched 8 , .Xr gshsec 8 , .Xr gstripe 8 , .Xr gvirstor 8 From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 09:53:25 2010 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 5392010656AE; Wed, 1 Sep 2010 09:53:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 420DE8FC16; Wed, 1 Sep 2010 09:53:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o819rPIC058017; Wed, 1 Sep 2010 09:53:25 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o819rPbl058015; Wed, 1 Sep 2010 09:53:25 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009010953.o819rPbl058015@svn.freebsd.org> From: Ed Schouten Date: Wed, 1 Sep 2010 09:53: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: r212087 - 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: Wed, 01 Sep 2010 09:53:25 -0000 Author: ed Date: Wed Sep 1 09:53:24 2010 New Revision: 212087 URL: http://svn.freebsd.org/changeset/base/212087 Log: Remove reference to device minor numbers in psm(4) man page. The number returned by stat(2) is generated automatically, so it is not possible to deduce whether the device is blocking or not. MFC after: 1 week Modified: head/share/man/man4/psm.4 Modified: head/share/man/man4/psm.4 ============================================================================== --- head/share/man/man4/psm.4 Wed Sep 1 09:51:47 2010 (r212086) +++ head/share/man/man4/psm.4 Wed Sep 1 09:53:24 2010 (r212087) @@ -179,22 +179,6 @@ The driver has an internal variable whic the acceleration. Its value can be modified via the driver flag or via an ioctl call. -.Ss Device Number -The minor device number of the -.Nm -is made up of: -.Bd -literal -offset indent -minor = (`unit' << 1) | `non-blocking' -.Ed -.Pp -where `unit' is the device number (usually 0) and the `non-blocking' bit -is set to indicate ``do not block waiting for mouse input, -return immediately''. -The `non-blocking' bit should be set for \fIXFree86\fP, -therefore the minor device number usually used for \fIXFree86\fP is 1. -See -.Sx FILES -for device node names. .Sh DRIVER CONFIGURATION .Ss Kernel Configuration Options There are following kernel configuration options to control the @@ -682,8 +666,7 @@ movement counts as described in .It Pa /dev/psm0 `non-blocking' device node .It Pa /dev/bpsm0 -`blocking' device node under -.Em devfs . +`blocking' device node .El .Sh EXAMPLES In order to install the From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 11:11:20 2010 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 8EC1510656B5; Wed, 1 Sep 2010 11:11:20 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C3A58FC1D; Wed, 1 Sep 2010 11:11:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81BBKNj062036; Wed, 1 Sep 2010 11:11:20 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81BBK53062034; Wed, 1 Sep 2010 11:11:20 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <201009011111.o81BBK53062034@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 1 Sep 2010 11:11:20 +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: r212091 - stable/8/etc/periodic/daily X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 11:11:20 -0000 Author: netchild Date: Wed Sep 1 11:11:20 2010 New Revision: 212091 URL: http://svn.freebsd.org/changeset/base/212091 Log: MFC r211800: - Change the threshold from 'running next scrub the th day after the last one' to 'running next scrub the th day after the last one'. - Improve wording. Requested by: jhell Modified: stable/8/etc/periodic/daily/800.scrub-zfs (contents, props changed) Directory Properties: stable/8/etc/periodic/daily/ (props changed) Modified: stable/8/etc/periodic/daily/800.scrub-zfs ============================================================================== --- stable/8/etc/periodic/daily/800.scrub-zfs Wed Sep 1 10:50:58 2010 (r212090) +++ stable/8/etc/periodic/daily/800.scrub-zfs Wed Sep 1 11:11:20 2010 (r212091) @@ -53,7 +53,7 @@ case "$daily_scrub_zfs_enable" in # Now minus last scrub (both in seconds) converted to days. _scrub_diff=$(expr -e \( $(date +%s) - \ $(date -j -f %F.%T ${_last_scrub} +%s) \) / 60 / 60 / 24) - if [ ${_scrub_diff} -le ${_pool_threshold} ]; then + if [ ${_scrub_diff} -lt ${_pool_threshold} ]; then echo " skipping scrubbing of pool '${pool}':" echo " last scrubbing is ${_scrub_diff} days ago, threshold is set to ${_pool_threshold} days" continue @@ -65,11 +65,11 @@ case "$daily_scrub_zfs_enable" in echo " scrubbing of pool '${pool}' already in progress, skipping:" ;; *"none requested"*) - echo " starting first scrubbing (after reboot) of pool '${pool}':" + echo " starting first scrub (since reboot) of pool '${pool}':" zpool scrub ${pool} ;; *) - echo " starting scrubbing of pool '${pool}':" + echo " starting scrub of pool '${pool}':" zpool scrub ${pool} ;; esac From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 11:27:09 2010 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 D28361065670; Wed, 1 Sep 2010 11:27:09 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0D538FC0C; Wed, 1 Sep 2010 11:27:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81BR9ff062516; Wed, 1 Sep 2010 11:27:09 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81BR9AY062514; Wed, 1 Sep 2010 11:27:09 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009011127.o81BR9AY062514@svn.freebsd.org> From: Rui Paulo Date: Wed, 1 Sep 2010 11:27: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: r212092 - head/cddl/contrib/opensolaris/lib/libdtrace/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: Wed, 01 Sep 2010 11:27:09 -0000 Author: rpaulo Date: Wed Sep 1 11:27:09 2010 New Revision: 212092 URL: http://svn.freebsd.org/changeset/base/212092 Log: Include on a generated header. Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c Wed Sep 1 11:11:20 2010 (r212091) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c Wed Sep 1 11:27:09 2010 (r212092) @@ -557,6 +557,10 @@ dt_header_provider(dtrace_hdl_t *dtp, dt info.dthi_pfname = alloca(strlen(pvp->pv_desc.dtvd_name) + 1 + i); dt_header_fmt_func(info.dthi_pfname, pvp->pv_desc.dtvd_name); +#ifdef __FreeBSD__ + if (fprintf(out, "#include \n\n") < 0) + return (dt_set_errno(dtp, errno)); +#endif if (fprintf(out, "#if _DTRACE_VERSION\n\n") < 0) return (dt_set_errno(dtp, errno)); From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 12:08:32 2010 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 C086B10656A8; Wed, 1 Sep 2010 12:08:32 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF4198FC13; Wed, 1 Sep 2010 12:08:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81C8Wuc063434; Wed, 1 Sep 2010 12:08:32 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81C8WJd063432; Wed, 1 Sep 2010 12:08:32 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201009011208.o81C8WJd063432@svn.freebsd.org> From: Rui Paulo Date: Wed, 1 Sep 2010 12:08: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: r212093 - head/sys/cddl/dev/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 12:08:32 -0000 Author: rpaulo Date: Wed Sep 1 12:08:32 2010 New Revision: 212093 URL: http://svn.freebsd.org/changeset/base/212093 Log: Make the /dev/dtrace/helper node have the mode 0660. This allows programs that refuse to run as root (pgsql) to install probes when their user is part of the wheel group. Sponsored by: The FreeBSD Foundation > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. M dev/dtrace/dtrace_load.c Modified: head/sys/cddl/dev/dtrace/dtrace_load.c Modified: head/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_load.c Wed Sep 1 11:27:09 2010 (r212092) +++ head/sys/cddl/dev/dtrace/dtrace_load.c Wed Sep 1 12:08:32 2010 (r212093) @@ -163,7 +163,7 @@ dtrace_load(void *dummy) #else dtrace_dev = make_dev(&dtrace_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "dtrace/dtrace"); - helper_dev = make_dev(&helper_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, + helper_dev = make_dev(&helper_cdevsw, 0, UID_ROOT, GID_WHEEL, 0660, "dtrace/helper"); #endif From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 12:08:54 2010 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 EC5941065674; Wed, 1 Sep 2010 12:08:54 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB23D8FC15; Wed, 1 Sep 2010 12:08:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81C8soq063475; Wed, 1 Sep 2010 12:08:54 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81C8s70063473; Wed, 1 Sep 2010 12:08:54 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201009011208.o81C8s70063473@svn.freebsd.org> From: Maxim Konovalov Date: Wed, 1 Sep 2010 12:08: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: r212094 - head/share/man/man7 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 12:08:55 -0000 Author: maxim Date: Wed Sep 1 12:08:54 2010 New Revision: 212094 URL: http://svn.freebsd.org/changeset/base/212094 Log: o Sync the man page with the reality: nfs/ includes are under include/ and include/fs/. PR: docs/139153 Submitted by: gjb MFC after: 1 week Modified: head/share/man/man7/hier.7 Modified: head/share/man/man7/hier.7 ============================================================================== --- head/share/man/man7/hier.7 Wed Sep 1 12:08:32 2010 (r212093) +++ head/share/man/man7/hier.7 Wed Sep 1 12:08:54 2010 (r212094) @@ -250,6 +250,8 @@ per-process file descriptors file system FIFOs file system .It Pa msdosfs/ MS-DOS file system +.It Pa nfs/ +C include files for NFS (Network File System) version 2, 3 and 4 .It Pa ntfs/ NTFS file system .It Pa nullfs/ @@ -334,7 +336,7 @@ include files for the UNI signalling pro .It Pa netsmb/ SMB/CIFS requester .It Pa nfs/ -C include files for NFS (Network File System) +C include files for NFS (Network File System) version 2 and 3 (legacy) .It Pa objc/ Objective C include files .It Pa openssl/ From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 13:22:55 2010 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 B62541065674; Wed, 1 Sep 2010 13:22:55 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A51FD8FC14; Wed, 1 Sep 2010 13:22:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81DMtVq065889; Wed, 1 Sep 2010 13:22:55 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81DMtSp065887; Wed, 1 Sep 2010 13:22:55 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201009011322.o81DMtSp065887@svn.freebsd.org> From: David Xu Date: Wed, 1 Sep 2010 13:22: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: r212095 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 13:22:55 -0000 Author: davidxu Date: Wed Sep 1 13:22:55 2010 New Revision: 212095 URL: http://svn.freebsd.org/changeset/base/212095 Log: Remove incorrect comments, also make sure signal is disabled when unregistering sigaction. Modified: head/lib/libthr/thread/thr_sig.c Modified: head/lib/libthr/thread/thr_sig.c ============================================================================== --- head/lib/libthr/thread/thr_sig.c Wed Sep 1 12:08:54 2010 (r212094) +++ head/lib/libthr/thread/thr_sig.c Wed Sep 1 13:22:55 2010 (r212095) @@ -415,19 +415,17 @@ _thr_signal_init(void) __sys_sigprocmask(SIG_UNBLOCK, &act.sa_mask, NULL); } -/* - * called from rtld with rtld_lock locked, because rtld_lock is - * a critical region, so all signals have already beeen masked. - */ void _thr_sigact_unload(struct dl_phdr_info *phdr_info) { + struct pthread *curthread = _get_curthread(); struct urwlock *rwlp; struct sigaction *actp; struct sigaction kact; void (*handler)(int); int sig; + _thr_signal_block(curthread); for (sig = 1; sig < _SIG_MAXSIG; sig++) { actp = &_thr_sigact[sig].sigact; retry: @@ -447,9 +445,10 @@ retry: kact.sa_handler != SIG_DFL && kact.sa_handler != SIG_IGN) __sys_sigaction(sig, actp, NULL); - _thr_rwl_unlock(rwlp); + _thr_rwl_unlock(rwlp); } } + _thr_signal_unblock(curthread); } void From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 13:47:12 2010 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 2AFBC10656B9; Wed, 1 Sep 2010 13:47:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 192138FC0A; Wed, 1 Sep 2010 13:47:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81DlBlU066502; Wed, 1 Sep 2010 13:47:11 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81DlBe0066499; Wed, 1 Sep 2010 13:47:11 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009011347.o81DlBe0066499@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Sep 2010 13:47: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: r212096 - 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, 01 Sep 2010 13:47:12 -0000 Author: emaste Date: Wed Sep 1 13:47:11 2010 New Revision: 212096 URL: http://svn.freebsd.org/changeset/base/212096 Log: As long as we are going to panic anyway, there's no need to hide additional information behind DIAGNOSTIC. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Sep 1 13:22:55 2010 (r212095) +++ head/sys/kern/vfs_subr.c Wed Sep 1 13:47:11 2010 (r212096) @@ -2203,9 +2203,7 @@ vputx(struct vnode *vp, int func) } if (vp->v_usecount != 1) { -#ifdef DIAGNOSTIC vprint("vputx: negative ref count", vp); -#endif panic("vputx: negative ref cnt"); } CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp); From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 14:31:05 2010 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 7EE0410656A4; Wed, 1 Sep 2010 14:31:05 +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 541988FC19; Wed, 1 Sep 2010 14:31:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81EV5qu068063; Wed, 1 Sep 2010 14:31:05 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81EV5eB068060; Wed, 1 Sep 2010 14:31:05 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009011431.o81EV5eB068060@svn.freebsd.org> From: John Baldwin Date: Wed, 1 Sep 2010 14:31:05 +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: r212097 - stable/7/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 14:31:05 -0000 Author: jhb Date: Wed Sep 1 14:31:05 2010 New Revision: 212097 URL: http://svn.freebsd.org/changeset/base/212097 Log: Fix the build with DEVICE_POLLING enabled. Poll handlers return void instead of int on 7.x and earlier. Pointy hat to: jhb Modified: stable/7/sys/dev/e1000/if_em.c stable/7/sys/dev/e1000/if_lem.c Modified: stable/7/sys/dev/e1000/if_em.c ============================================================================== --- stable/7/sys/dev/e1000/if_em.c Wed Sep 1 13:47:11 2010 (r212096) +++ stable/7/sys/dev/e1000/if_em.c Wed Sep 1 14:31:05 2010 (r212097) @@ -1345,7 +1345,7 @@ em_init(void *arg) * Legacy polling routine: note this only works with single queue * *********************************************************************/ -static int +static void em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { struct adapter *adapter = ifp->if_softc; @@ -1357,7 +1357,7 @@ em_poll(struct ifnet *ifp, enum poll_cmd EM_CORE_LOCK(adapter); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { EM_CORE_UNLOCK(adapter); - return (0); + return; } if (cmd == POLL_AND_CHECK_STATUS) { @@ -1384,8 +1384,6 @@ em_poll(struct ifnet *ifp, enum poll_cmd em_start_locked(ifp, txr); #endif EM_TX_UNLOCK(txr); - - return (rx_done); } #endif /* DEVICE_POLLING */ Modified: stable/7/sys/dev/e1000/if_lem.c ============================================================================== --- stable/7/sys/dev/e1000/if_lem.c Wed Sep 1 13:47:11 2010 (r212096) +++ stable/7/sys/dev/e1000/if_lem.c Wed Sep 1 14:31:05 2010 (r212097) @@ -1231,7 +1231,7 @@ lem_init(void *arg) * Legacy polling routine * *********************************************************************/ -static int +static void lem_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { struct adapter *adapter = ifp->if_softc; @@ -1240,7 +1240,7 @@ lem_poll(struct ifnet *ifp, enum poll_cm EM_CORE_LOCK(adapter); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { EM_CORE_UNLOCK(adapter); - return (rx_done); + return; } if (cmd == POLL_AND_CHECK_STATUS) { @@ -1262,7 +1262,6 @@ lem_poll(struct ifnet *ifp, enum poll_cm if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) lem_start_locked(ifp); EM_TX_UNLOCK(adapter); - return (rx_done); } #endif /* DEVICE_POLLING */ From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 14:38:12 2010 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 E1C7F1065698; Wed, 1 Sep 2010 14:38:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B05FD8FC19; Wed, 1 Sep 2010 14:38:11 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 5397E46B2A; Wed, 1 Sep 2010 10:38:11 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 898EC8A04E; Wed, 1 Sep 2010 10:38:10 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Wed, 1 Sep 2010 10:26:17 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201008311926.o7VJQTF3039592@svn.freebsd.org> In-Reply-To: <201008311926.o7VJQTF3039592@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009011026.17306.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 01 Sep 2010 10:38:10 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r212068 - stable/7/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 14:38:12 -0000 On Tuesday, August 31, 2010 3:26:29 pm John Baldwin wrote: > Author: jhb > Date: Tue Aug 31 19:26:29 2010 > New Revision: 212068 > URL: http://svn.freebsd.org/changeset/base/212068 > > Log: > MFC 206429: > Sync em(4) and igb(4) drivers with 8 except for VF support: > - Remove unneeded rxtx handler, make que handler generic in igb. > - Do not allocate header mbufs in rx ring if not doing hdr split in igb. > - Release the lock in rxeof call to stack. > - Change rxeof api for poll friendliness, and eliminate unnecessary link > tasklet use. > - Move statistics for em into sysctl tree. > - Reenable hardware checksum offload for VLAN frames in igb. > - Fix for a panic when TX checksum offload is done and a packet has only > a header in the first mbuf in em. Oops, the list of changes was truncated, it merged the following changes (some of them were already partially merged): 206429, 206437, 206447, 206460, 206629, 207331, 207337, 208103, 209068, 209218, 209238, 209242, 209259, 209859, and 209959. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 15:24:47 2010 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 6ADE01065696; Wed, 1 Sep 2010 15:24:47 +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 5A8E18FC18; Wed, 1 Sep 2010 15:24:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81FOljs069495; Wed, 1 Sep 2010 15:24:47 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81FOlSm069493; Wed, 1 Sep 2010 15:24:47 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201009011524.o81FOlSm069493@svn.freebsd.org> From: Dimitry Andric Date: Wed, 1 Sep 2010 15:24: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: r212098 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 15:24:47 -0000 Author: dim Date: Wed Sep 1 15:24:47 2010 New Revision: 212098 URL: http://svn.freebsd.org/changeset/base/212098 Log: Use a cleaner expression to retrieve the memory size in pc98's boot2.c, which also avoids NULL pointer arithmetic, as suggested by jhb. The available space goes from 11 bytes to 7. Reviewed by: nyan Approved by: rpaulo (mentor) Modified: head/sys/boot/pc98/boot2/boot2.c Modified: head/sys/boot/pc98/boot2/boot2.c ============================================================================== --- head/sys/boot/pc98/boot2/boot2.c Wed Sep 1 14:31:05 2010 (r212097) +++ head/sys/boot/pc98/boot2/boot2.c Wed Sep 1 15:24:47 2010 (r212098) @@ -187,9 +187,8 @@ xfsread(ino_t inode, void *buf, size_t n static inline uint32_t memsize(void) { - u_char *p = (u_char *)PTOV(0x401); - - return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; + return (*(u_char *)PTOV(0x401) * 128 * 1024 + + *(uint16_t *)PTOV(0x594) * 1024 * 1024); } static inline void From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 16:11:27 2010 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 1798110656AB; Wed, 1 Sep 2010 16:11: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 076658FC22; Wed, 1 Sep 2010 16:11:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81GBQLO071399; Wed, 1 Sep 2010 16:11:26 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81GBQTv071397; Wed, 1 Sep 2010 16:11:26 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201009011611.o81GBQTv071397@svn.freebsd.org> From: Michael Tuexen Date: Wed, 1 Sep 2010 16:11: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: r212099 - 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: Wed, 01 Sep 2010 16:11:27 -0000 Author: tuexen Date: Wed Sep 1 16:11:26 2010 New Revision: 212099 URL: http://svn.freebsd.org/changeset/base/212099 Log: Fix a bug which results in peer IPv4 addresses a.b.c.d with 224<=d<=239 incorrectly being detected as multicast addresses on little endian systems. MFC after: 2 weeks Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Wed Sep 1 15:24:47 2010 (r212098) +++ head/sys/netinet/sctp_pcb.c Wed Sep 1 16:11:26 2010 (r212099) @@ -5988,7 +5988,7 @@ sctp_load_addresses_from_init(struct sct } p4 = (struct sctp_ipv4addr_param *)phdr; sin.sin_addr.s_addr = p4->addr; - if (IN_MULTICAST(sin.sin_addr.s_addr)) { + if (IN_MULTICAST(ntohl(sin.sin_addr.s_addr))) { /* Skip multi-cast addresses */ goto next_param; } From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 16:53:38 2010 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 7A4FB1065675; Wed, 1 Sep 2010 16:53:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A3E88FC1B; Wed, 1 Sep 2010 16:53:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81GrciO072661; Wed, 1 Sep 2010 16:53:38 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81GrcLO072659; Wed, 1 Sep 2010 16:53:38 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009011653.o81GrcLO072659@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Sep 2010 16:53: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: r212100 - 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: Wed, 01 Sep 2010 16:53:38 -0000 Author: emaste Date: Wed Sep 1 16:53:38 2010 New Revision: 212100 URL: http://svn.freebsd.org/changeset/base/212100 Log: Add a sysctl knob to accept input packets on any link in a failover lagg. Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Wed Sep 1 16:11:26 2010 (r212099) +++ head/sys/net/if_lagg.c Wed Sep 1 16:53:38 2010 (r212100) @@ -162,6 +162,14 @@ static const struct { { LAGG_PROTO_NONE, NULL } }; +SYSCTL_DECL(_net_link); +SYSCTL_NODE(_net_link, OID_AUTO, lagg, CTLFLAG_RW, 0, "Link Aggregation"); + +static int lagg_failover_rx_all = 0; /* Allow input on any failover links */ +SYSCTL_INT(_net_link_lagg, OID_AUTO, failover_rx_all, CTLFLAG_RW, + &lagg_failover_rx_all, 0, + "Accept input from any interface in a failover lagg"); + static int lagg_modevent(module_t mod, int type, void *data) { @@ -1560,7 +1568,7 @@ lagg_fail_input(struct lagg_softc *sc, s struct ifnet *ifp = sc->sc_ifp; struct lagg_port *tmp_tp; - if (lp == sc->sc_primary) { + if (lp == sc->sc_primary || lagg_failover_rx_all) { m->m_pkthdr.rcvif = ifp; return (m); } From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 17:35:32 2010 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 2730B10656A6; Wed, 1 Sep 2010 17:35:32 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 163458FC08; Wed, 1 Sep 2010 17:35:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81HZVBI074004; Wed, 1 Sep 2010 17:35:31 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81HZVhE073999; Wed, 1 Sep 2010 17:35:31 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201009011735.o81HZVhE073999@svn.freebsd.org> From: "Jayachandran C." Date: Wed, 1 Sep 2010 17:35: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: r212102 - 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: Wed, 01 Sep 2010 17:35:32 -0000 Author: jchandra Date: Wed Sep 1 17:35:31 2010 New Revision: 212102 URL: http://svn.freebsd.org/changeset/base/212102 Log: Updates for the RMI MIPS platform code - set cache_coherent_dma flag in cpuinfo for XLR, this will make sure that BUS_DMA_COHERENT flag is handled correctly in busdma_machdep.c - iodi.c, call device_get_name() just once - clear RMI specific EIRR while intializing CPUs - remove debug print in intr_machdep.c Modified: head/sys/mips/rmi/intr_machdep.c head/sys/mips/rmi/iodi.c head/sys/mips/rmi/pic.h head/sys/mips/rmi/xlr_machdep.c Modified: head/sys/mips/rmi/intr_machdep.c ============================================================================== --- head/sys/mips/rmi/intr_machdep.c Wed Sep 1 17:02:31 2010 (r212101) +++ head/sys/mips/rmi/intr_machdep.c Wed Sep 1 17:35:31 2010 (r212102) @@ -62,8 +62,10 @@ static int intrcnt_index; void xlr_enable_irq(int irq) { + uint64_t eimr; - write_c0_eimr64(read_c0_eimr64() | (1ULL << irq)); + eimr = read_c0_eimr64(); + write_c0_eimr64(eimr | (1ULL << irq)); } void @@ -128,9 +130,6 @@ xlr_establish_intr(const char *name, dri * FIXME locking - not needed now, because we do this only on * startup from CPU0 */ - printf("[%s] Setup intr %d called on cpu %d (%d)\n", name, irq, - xlr_cpu_id(), PCPU_GET(cpuid)); - src = &xlr_interrupts[irq]; ie = src->ie; if (ie == NULL) { Modified: head/sys/mips/rmi/iodi.c ============================================================================== --- head/sys/mips/rmi/iodi.c Wed Sep 1 17:02:31 2010 (r212101) +++ head/sys/mips/rmi/iodi.c Wed Sep 1 17:35:31 2010 (r212102) @@ -95,7 +95,7 @@ bridge_pcmcia_ack(int irq) static int iodi_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) { const char *name = device_get_name(child); @@ -130,6 +130,7 @@ iodi_alloc_resource(device_t bus, device u_long start, u_long end, u_long count, u_int flags) { struct resource *res = malloc(sizeof(*res), M_DEVBUF, M_WAITOK); + const char *name = device_get_name(child); int unit; #ifdef DEBUG @@ -151,7 +152,7 @@ iodi_alloc_resource(device_t bus, device } #endif - if (strcmp(device_get_name(child), "uart") == 0) { + if (strcmp(name, "uart") == 0) { if ((unit = device_get_unit(child)) == 0) { /* uart 0 */ res->r_bushandle = (xlr_io_base + XLR_IO_UART_0_OFFSET); } else if (unit == 1) { @@ -160,13 +161,13 @@ iodi_alloc_resource(device_t bus, device printf("%s: Unknown uart unit\n", __FUNCTION__); res->r_bustag = uart_bus_space_mem; - } else if (strcmp(device_get_name(child), "ehci") == 0) { + } else if (strcmp(name, "ehci") == 0) { res->r_bushandle = MIPS_PHYS_TO_KSEG1(0x1ef24000); res->r_bustag = rmi_pci_bus_space; - } else if (strcmp(device_get_name(child), "cfi") == 0) { + } else if (strcmp(name, "cfi") == 0) { res->r_bushandle = MIPS_PHYS_TO_KSEG1(0x1c000000); res->r_bustag = 0; - } else if (strcmp(device_get_name(child), "ata") == 0) { + } else if (strcmp(name, "ata") == 0) { res->r_bushandle = MIPS_PHYS_TO_KSEG1(0x1d000000); res->r_bustag = rmi_pci_bus_space; /* byte swapping (not really PCI) */ } Modified: head/sys/mips/rmi/pic.h ============================================================================== --- head/sys/mips/rmi/pic.h Wed Sep 1 17:02:31 2010 (r212101) +++ head/sys/mips/rmi/pic.h Wed Sep 1 17:35:31 2010 (r212102) @@ -189,7 +189,7 @@ pic_ack(int picintr) { xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_PIC_OFFSET); - xlr_write_reg(mmio, PIC_INT_ACK, 1 << picintr); + xlr_write_reg(mmio, PIC_INT_ACK, 1U << picintr); } static __inline Modified: head/sys/mips/rmi/xlr_machdep.c ============================================================================== --- head/sys/mips/rmi/xlr_machdep.c Wed Sep 1 17:02:31 2010 (r212101) +++ head/sys/mips/rmi/xlr_machdep.c Wed Sep 1 17:35:31 2010 (r212102) @@ -266,6 +266,7 @@ mips_init(void) init_param2(physmem); mips_cpu_init(); + cpuinfo.cache_coherent_dma = TRUE; pmap_bootstrap(); #ifdef DDB kdb_init(); @@ -298,6 +299,7 @@ xlr_pic_init(void) xlr_reg_t *mmio = xlr_io_mmio(XLR_IO_PIC_OFFSET); int i, level, irq; + write_c0_eimr64(0ULL); mtx_init(&xlr_pic_lock, "pic", NULL, MTX_SPIN); xlr_write_reg(mmio, PIC_CTRL, 0); @@ -574,6 +576,7 @@ platform_init_ap(int cpuid) stat |= MIPS_SR_COP_2_BIT | MIPS_SR_COP_0_BIT; mips_wr_status(stat); + write_c0_eimr64(0ULL); xlr_enable_irq(IRQ_IPI); xlr_enable_irq(IRQ_TIMER); if (xlr_thr_id() == 0) { From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 18:28:08 2010 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 A80DB10656A6; Wed, 1 Sep 2010 18:28:08 +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 970438FC0C; Wed, 1 Sep 2010 18:28:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81IS8Tm075642; Wed, 1 Sep 2010 18:28:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81IS8aA075639; Wed, 1 Sep 2010 18:28:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009011828.o81IS8aA075639@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 18:28: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: r212103 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 18:28:08 -0000 Author: yongari Date: Wed Sep 1 18:28:08 2010 New Revision: 212103 URL: http://svn.freebsd.org/changeset/base/212103 Log: Remove leading and trailing white spaces. No functional changes. Modified: head/sys/dev/sis/if_sis.c head/sys/dev/sis/if_sisreg.h Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 17:35:31 2010 (r212102) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 18:28:08 2010 (r212103) @@ -406,7 +406,7 @@ sis_read_mac(struct sis_softc *sc, devic CSR_WRITE_4(sc, SIS_CSR, SIS_CSR_RELOAD | filtsave); CSR_WRITE_4(sc, SIS_CSR, 0); - + CSR_WRITE_4(sc, SIS_RXFILT_CTL, filtsave & ~SIS_RXFILTCTL_ENABLE); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR0); @@ -429,9 +429,9 @@ static void sis_mii_sync(struct sis_softc *sc) { int i; - + SIO_SET(SIS_MII_DIR|SIS_MII_DATA); - + for (i = 0; i < 32; i++) { SIO_SET(SIS_MII_CLK); DELAY(1); @@ -439,7 +439,7 @@ sis_mii_sync(struct sis_softc *sc) DELAY(1); } } - + /* * Clock a series of bits through the MII. */ @@ -447,9 +447,9 @@ static void sis_mii_send(struct sis_softc *sc, uint32_t bits, int cnt) { int i; - + SIO_CLR(SIS_MII_CLK); - + for (i = (0x1 << (cnt - 1)); i; i >>= 1) { if (bits & i) { SIO_SET(SIS_MII_DATA); @@ -462,7 +462,7 @@ sis_mii_send(struct sis_softc *sc, uint3 SIO_SET(SIS_MII_CLK); } } - + /* * Read an PHY register through the MII. */ @@ -470,7 +470,7 @@ static int sis_mii_readreg(struct sis_softc *sc, struct sis_mii_frame *frame) { int i, ack; - + /* * Set up frame for RX. */ @@ -478,14 +478,14 @@ sis_mii_readreg(struct sis_softc *sc, st frame->mii_opcode = SIS_MII_READOP; frame->mii_turnaround = 0; frame->mii_data = 0; - + /* * Turn on data xmit. */ SIO_SET(SIS_MII_DIR); sis_mii_sync(sc); - + /* * Send command/address info. */ @@ -493,23 +493,23 @@ sis_mii_readreg(struct sis_softc *sc, st sis_mii_send(sc, frame->mii_opcode, 2); sis_mii_send(sc, frame->mii_phyaddr, 5); sis_mii_send(sc, frame->mii_regaddr, 5); - + /* Idle bit */ SIO_CLR((SIS_MII_CLK|SIS_MII_DATA)); DELAY(1); SIO_SET(SIS_MII_CLK); DELAY(1); - + /* Turn off xmit. */ SIO_CLR(SIS_MII_DIR); - + /* Check for ack */ SIO_CLR(SIS_MII_CLK); DELAY(1); ack = CSR_READ_4(sc, SIS_EECTL) & SIS_MII_DATA; SIO_SET(SIS_MII_CLK); DELAY(1); - + /* * Now try reading data bits. If the ack failed, we still * need to clock through 16 cycles to keep the PHY(s) in sync. @@ -523,7 +523,7 @@ sis_mii_readreg(struct sis_softc *sc, st } goto fail; } - + for (i = 0x8000; i; i >>= 1) { SIO_CLR(SIS_MII_CLK); DELAY(1); @@ -547,47 +547,47 @@ fail: return(1); return(0); } - + /* * Write to a PHY register through the MII. */ static int sis_mii_writereg(struct sis_softc *sc, struct sis_mii_frame *frame) { - + /* * Set up frame for TX. */ - + frame->mii_stdelim = SIS_MII_STARTDELIM; frame->mii_opcode = SIS_MII_WRITEOP; frame->mii_turnaround = SIS_MII_TURNAROUND; - + /* * Turn on data output. */ SIO_SET(SIS_MII_DIR); - + sis_mii_sync(sc); - + sis_mii_send(sc, frame->mii_stdelim, 2); sis_mii_send(sc, frame->mii_opcode, 2); sis_mii_send(sc, frame->mii_phyaddr, 5); sis_mii_send(sc, frame->mii_regaddr, 5); sis_mii_send(sc, frame->mii_turnaround, 2); sis_mii_send(sc, frame->mii_data, 16); - + /* Idle bit. */ SIO_SET(SIS_MII_CLK); DELAY(1); SIO_CLR(SIS_MII_CLK); DELAY(1); - + /* * Turn off xmit. */ SIO_CLR(SIS_MII_DIR); - + return(0); } @@ -877,7 +877,7 @@ sis_reset(struct sis_softc *sc) CSR_WRITE_4(sc, NS_CLKRUN, 0); } - return; + return; } /* @@ -947,8 +947,8 @@ sis_attach(device_t dev) sis_reset(sc); if (sc->sis_type == SIS_TYPE_900 && - (sc->sis_rev == SIS_REV_635 || - sc->sis_rev == SIS_REV_900B)) { + (sc->sis_rev == SIS_REV_635 || + sc->sis_rev == SIS_REV_900B)) { SIO_SET(SIS_CFG_RND_CNT); SIO_SET(SIS_CFG_PERR_DETECT); } @@ -1065,13 +1065,13 @@ sis_attach(device_t dev) * Allocate the parent bus DMA tag appropriate for PCI. */ #define SIS_NSEG_NEW 32 - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create(NULL, /* parent */ 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ MAXBSIZE, SIS_NSEG_NEW, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ + BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ BUS_DMA_ALLOCNOW, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->sis_parent_tag); @@ -1213,7 +1213,7 @@ sis_attach(device_t dev) * Call MI attach routine. */ ether_ifattach(ifp, eaddr); - + /* * Tell the upper layer(s) we support long frames. */ @@ -1444,7 +1444,7 @@ sis_rxeof(struct sis_softc *sc) continue; } - /* No errors; receive the packet. */ + /* No errors; receive the packet. */ #ifdef __NO_STRICT_ALIGNMENT /* * On architectures without alignment problems we try to @@ -1655,7 +1655,7 @@ sis_intr(void *arg) if (status & (SIS_ISR_TX_DESC_OK | SIS_ISR_TX_ERR | - SIS_ISR_TX_OK | SIS_ISR_TX_IDLE) ) + SIS_ISR_TX_OK | SIS_ISR_TX_IDLE) ) sis_txeof(sc); if (status & (SIS_ISR_RX_DESC_OK | SIS_ISR_RX_OK | @@ -1717,7 +1717,7 @@ sis_encap(struct sis_softc *sc, struct m return (ENOBUFS); *m_head = m; } - + /* * Start packing the mbufs in this chain into * the fragment pointers. Stop when we run out @@ -2003,7 +2003,7 @@ sis_initl(struct sis_softc *sc) uint32_t reg; /* - * Short Cable Receive Errors (MP21.E) + * Short Cable Receive Errors (MP21.E) */ CSR_WRITE_4(sc, NS_PHY_PAGE, 0x0001); reg = CSR_READ_4(sc, NS_PHY_DSPCFG) & 0xfff; @@ -2141,7 +2141,7 @@ sis_ioctl(struct ifnet *ifp, u_long comm ifp->if_capenable |= IFCAP_POLLING; SIS_UNLOCK(sc); return (error); - + } if (!(ifr->ifr_reqcap & IFCAP_POLLING) && ifp->if_capenable & IFCAP_POLLING) { Modified: head/sys/dev/sis/if_sisreg.h ============================================================================== --- head/sys/dev/sis/if_sisreg.h Wed Sep 1 17:35:31 2010 (r212102) +++ head/sys/dev/sis/if_sisreg.h Wed Sep 1 18:28:08 2010 (r212103) @@ -252,7 +252,7 @@ SIS_TXCFG_FILL(64)|SIS_TXCFG_DRAIN(1536)) #define SIS_RXCFG_DRAIN_THRESH 0x0000003E /* 8-byte units */ -#define SIS_TXCFG_MPII03D 0x00040000 /* "Must be 1" */ +#define SIS_TXCFG_MPII03D 0x00040000 /* "Must be 1" */ #define SIS_RXCFG_DMABURST 0x00700000 #define SIS_RXCFG_RX_JABBER 0x08000000 #define SIS_RXCFG_RX_TXPKTS 0x10000000 From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 18:39:35 2010 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 9AFA010656AD; Wed, 1 Sep 2010 18:39:35 +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 89D9A8FC08; Wed, 1 Sep 2010 18:39:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81IdZTw075949; Wed, 1 Sep 2010 18:39:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81IdZMG075947; Wed, 1 Sep 2010 18:39:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009011839.o81IdZMG075947@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 18:39: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: r212104 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 18:39:35 -0000 Author: yongari Date: Wed Sep 1 18:39:35 2010 New Revision: 212104 URL: http://svn.freebsd.org/changeset/base/212104 Log: style(9) - space after keywords. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 18:28:08 2010 (r212103) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 18:39:35 2010 (r212104) @@ -203,7 +203,7 @@ sis_reverse(uint16_t n) n = ((n >> 4) & 0x0f0f) | ((n << 4) & 0xf0f0); n = ((n >> 8) & 0x00ff) | ((n << 8) & 0xff00); - return(n); + return (n); } static void @@ -342,7 +342,7 @@ sis_find_bridge(device_t dev) int i, j; if ((pci_devclass = devclass_find("pci")) == NULL) - return(NULL); + return (NULL); devclass_get_devices(pci_devclass, &pci_devices, &pci_count); @@ -363,7 +363,7 @@ sis_find_bridge(device_t dev) done: free(pci_devices, M_TEMP); - return(child); + return (child); } static void @@ -515,7 +515,7 @@ sis_mii_readreg(struct sis_softc *sc, st * need to clock through 16 cycles to keep the PHY(s) in sync. */ if (ack) { - for(i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) { SIO_CLR(SIS_MII_CLK); DELAY(1); SIO_SET(SIS_MII_CLK); @@ -544,8 +544,8 @@ fail: DELAY(1); if (ack) - return(1); - return(0); + return (1); + return (0); } /* @@ -588,7 +588,7 @@ sis_mii_writereg(struct sis_softc *sc, s */ SIO_CLR(SIS_MII_DIR); - return(0); + return (0); } static int @@ -601,7 +601,7 @@ sis_miibus_readreg(device_t dev, int phy if (sc->sis_type == SIS_TYPE_83815) { if (phy != 0) - return(0); + return (0); /* * The NatSemi chip can take a while after * a reset to come ready, during which the BMSR @@ -627,7 +627,7 @@ sis_miibus_readreg(device_t dev, int phy int i, val = 0; if (phy != 0) - return(0); + return (0); CSR_WRITE_4(sc, SIS_PHYCTL, (phy << 11) | (reg << 6) | SIS_PHYOP_READ); @@ -640,15 +640,15 @@ sis_miibus_readreg(device_t dev, int phy if (i == SIS_TIMEOUT) { device_printf(sc->sis_dev, "PHY failed to come ready\n"); - return(0); + return (0); } val = (CSR_READ_4(sc, SIS_PHYCTL) >> 16) & 0xFFFF; if (val == 0xFFFF) - return(0); + return (0); - return(val); + return (val); } else { bzero((char *)&frame, sizeof(frame)); @@ -656,7 +656,7 @@ sis_miibus_readreg(device_t dev, int phy frame.mii_regaddr = reg; sis_mii_readreg(sc, &frame); - return(frame.mii_data); + return (frame.mii_data); } } @@ -670,9 +670,9 @@ sis_miibus_writereg(device_t dev, int ph if (sc->sis_type == SIS_TYPE_83815) { if (phy != 0) - return(0); + return (0); CSR_WRITE_4(sc, NS_BMCR + (reg * 4), data); - return(0); + return (0); } /* @@ -685,7 +685,7 @@ sis_miibus_writereg(device_t dev, int ph int i; if (phy != 0) - return(0); + return (0); CSR_WRITE_4(sc, SIS_PHYCTL, (data << 16) | (phy << 11) | (reg << 6) | SIS_PHYOP_WRITE); @@ -706,7 +706,7 @@ sis_miibus_writereg(device_t dev, int ph frame.mii_data = data; sis_mii_writereg(sc, &frame); } - return(0); + return (0); } static void @@ -891,7 +891,7 @@ sis_probe(device_t dev) t = sis_devs; - while(t->sis_name != NULL) { + while (t->sis_name != NULL) { if ((pci_get_vendor(dev) == t->sis_vid) && (pci_get_device(dev) == t->sis_did)) { device_set_desc(dev, t->sis_name); @@ -900,7 +900,7 @@ sis_probe(device_t dev) t++; } - return(ENXIO); + return (ENXIO); } /* @@ -1238,7 +1238,7 @@ fail: if (error) sis_detach(dev); - return(error); + return (error); } /* @@ -1304,7 +1304,7 @@ sis_detach(device_t dev) mtx_destroy(&sc->sis_mtx); - return(0); + return (0); } /* @@ -1342,7 +1342,7 @@ sis_ring_init(struct sis_softc *sc) for (i = 0; i < SIS_RX_LIST_CNT; i++, dp++) { error = sis_newbuf(sc, dp, NULL); if (error) - return(error); + return (error); if (i == (SIS_RX_LIST_CNT - 1)) dp->sis_nextdesc = &sc->sis_rx_list[0]; else @@ -1358,7 +1358,7 @@ sis_ring_init(struct sis_softc *sc) sc->sis_rx_pdsc = &sc->sis_rx_list[0]; - return(0); + return (0); } /* @@ -1369,12 +1369,12 @@ sis_newbuf(struct sis_softc *sc, struct { if (c == NULL) - return(EINVAL); + return (EINVAL); if (m == NULL) { m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) - return(ENOBUFS); + return (ENOBUFS); } else m->m_data = m->m_ext.ext_buf; @@ -1387,7 +1387,7 @@ sis_newbuf(struct sis_softc *sc, struct sis_dma_map_desc_ptr, c, 0); bus_dmamap_sync(sc->sis_tag, c->sis_map, BUS_DMASYNC_PREREAD); - return(0); + return (0); } /* @@ -1407,7 +1407,7 @@ sis_rxeof(struct sis_softc *sc) ifp = sc->sis_ifp; - for(cur_rx = sc->sis_rx_pdsc; SIS_OWNDESC(cur_rx); + for (cur_rx = sc->sis_rx_pdsc; SIS_OWNDESC(cur_rx); cur_rx = cur_rx->sis_nextdesc) { #ifdef DEVICE_POLLING @@ -1729,7 +1729,7 @@ sis_encap(struct sis_softc *sc, struct m if (m->m_len != 0) { if ((SIS_TX_LIST_CNT - (sc->sis_tx_cnt + cnt)) < 2) - return(ENOBUFS); + return (ENOBUFS); f = &sc->sis_tx_list[frag]; f->sis_ctl = SIS_CMDSTS_MORE | m->m_len; bus_dmamap_create(sc->sis_tag, 0, &f->sis_map); @@ -1747,7 +1747,7 @@ sis_encap(struct sis_softc *sc, struct m } if (m != NULL) - return(ENOBUFS); + return (ENOBUFS); sc->sis_tx_list[cur].sis_mbuf = *m_head; sc->sis_tx_list[cur].sis_ctl &= ~SIS_CMDSTS_MORE; @@ -1755,7 +1755,7 @@ sis_encap(struct sis_softc *sc, struct m sc->sis_tx_cnt += cnt; *txidx = frag; - return(0); + return (0); } /* @@ -1795,7 +1795,7 @@ sis_startl(struct ifnet *ifp) if (ifp->if_drv_flags & IFF_DRV_OACTIVE) return; - while(sc->sis_tx_list[idx].sis_mbuf == NULL) { + while (sc->sis_tx_list[idx].sis_mbuf == NULL) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -2071,7 +2071,7 @@ sis_ifmedia_upd(struct ifnet *ifp) mii_mediachg(mii); SIS_UNLOCK(sc); - return(0); + return (0); } /* @@ -2101,7 +2101,7 @@ sis_ioctl(struct ifnet *ifp, u_long comm struct mii_data *mii; int error = 0; - switch(command) { + switch (command) { case SIOCSIFFLAGS: SIS_LOCK(sc); if (ifp->if_flags & IFF_UP) { @@ -2134,7 +2134,7 @@ sis_ioctl(struct ifnet *ifp, u_long comm !(ifp->if_capenable & IFCAP_POLLING)) { error = ether_poll_register(sis_poll, ifp); if (error) - return(error); + return (error); SIS_LOCK(sc); /* Disable interrupts */ CSR_WRITE_4(sc, SIS_IER, 0); @@ -2160,7 +2160,7 @@ sis_ioctl(struct ifnet *ifp, u_long comm break; } - return(error); + return (error); } static void From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 18:41:59 2010 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 7FDD21065694; Wed, 1 Sep 2010 18:41:59 +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 6F91A8FC1C; Wed, 1 Sep 2010 18:41:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81IfxlF076031; Wed, 1 Sep 2010 18:41:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81IfxaQ076029; Wed, 1 Sep 2010 18:41:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009011841.o81IfxaQ076029@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 18:41: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: r212105 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 18:41:59 -0000 Author: yongari Date: Wed Sep 1 18:41:59 2010 New Revision: 212105 URL: http://svn.freebsd.org/changeset/base/212105 Log: Nuke unnecessary return at the end of function. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 18:39:35 2010 (r212104) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 18:41:59 2010 (r212105) @@ -393,7 +393,6 @@ sis_read_cmos(struct sis_softc *sc, devi } pci_write_config(bridge, 0x48, reg & ~0x40, 1); - return; } static void @@ -418,7 +417,6 @@ sis_read_mac(struct sis_softc *sc, devic CSR_WRITE_4(sc, SIS_RXFILT_CTL, filtsave); CSR_WRITE_4(sc, SIS_CSR, csrsave); - return; } #endif @@ -789,8 +787,6 @@ sis_setmulti_ns(struct sis_softc *sc) if_maddr_runlock(ifp); CSR_WRITE_4(sc, SIS_RXFILT_CTL, filtsave); - - return; } static void @@ -876,8 +872,6 @@ sis_reset(struct sis_softc *sc) CSR_WRITE_4(sc, NS_CLKRUN, NS_CLKRUN_PMESTS); CSR_WRITE_4(sc, NS_CLKRUN, 0); } - - return; } /* @@ -1538,8 +1532,6 @@ sis_txeof(struct sis_softc *sc) } sc->sis_watchdog_timer = (sc->sis_tx_cnt == 0) ? 0 : 5; - - return; } static void From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 19:33:41 2010 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 22DCA1065679; Wed, 1 Sep 2010 19:33:41 +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 10A208FC16; Wed, 1 Sep 2010 19:33:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81JXfPB077880; Wed, 1 Sep 2010 19:33:41 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81JXf3c077877; Wed, 1 Sep 2010 19:33:41 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009011933.o81JXf3c077877@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 19:33:41 +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: r212109 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 19:33:41 -0000 Author: yongari Date: Wed Sep 1 19:33:40 2010 New Revision: 212109 URL: http://svn.freebsd.org/changeset/base/212109 Log: bus_dma(9) cleanup. o Enforce TX/RX descriptor ring alignment. NS data sheet says the controller needs 4 bytes alignment but use 16 to cover both SiS and NS controllers. I don't have SiS data sheet so I'm not sure what is alignment restriction of SiS controller but 16 would be enough because it's larger than the size of a TX/RX descriptor. Previously sis(4) ignored the alignment restriction. o Enforce RX buffer alignment, 4. Previously sis(4) ignored RX buffer alignment restriction. o Limit number of TX DMA segment to be used to 16. It seems controller has no restriction on number of DMA segments but using more than 16 looks resource waste. o Collapse long mbuf chains with m_collapse(9) instead of calling expensive m_defrag(9). o TX/RX side bus_dmamap_load_mbuf_sg(9) support and remove unnecessary callbacks. o Initial endianness support. o Prefer local alignment fixup code to m_devget(9). o Pre-allocate TX/RX mbuf DMA maps instead of creating/destroying these maps in fast TX/RX path. On non-x86 architectures, this is very expensive operation and there is no need to do that. o Add missing bus_dmamap_sync(9) in TX/RX path. o watchdog is now unarmed only when there are no pending frames on controller. Previously sis(4) blindly unarmed watchdog without checking the number of queued frames. o For efficiency, loaded DMA map is reused for error frames. o DMA map loading failure is now gracefully handled. Previously sis(4) ignored any DMA map loading errors. o Nuke unused macros which are not appropriate for endianness operation. o Stop embedding driver maintained structures into descriptor rings. Because TX/RX descriptor structures are shared between host and controller, frequent bus_dmamap_sync(9) operations are required in fast path. Embedding driver structures will increase the size of DMA map which in turn will slow down performance. Modified: head/sys/dev/sis/if_sis.c head/sys/dev/sis/if_sisreg.h Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 19:27:41 2010 (r212108) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 19:33:40 2010 (r212109) @@ -64,12 +64,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include +#include +#include #include +#include +#include +#include #include #include +#include #include #include @@ -127,13 +130,23 @@ static struct sis_type sis_devs[] = { }; static int sis_detach(device_t); +static __inline void sis_discard_rxbuf(struct sis_rxdesc *); +static int sis_dma_alloc(struct sis_softc *); +static void sis_dma_free(struct sis_softc *); +static int sis_dma_ring_alloc(struct sis_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); +static void sis_dmamap_cb(void *, bus_dma_segment_t *, int, int); +#ifndef __NO_STRICT_ALIGNMENT +static __inline void sis_fixup_rx(struct mbuf *); +#endif static void sis_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int sis_ifmedia_upd(struct ifnet *); static void sis_init(void *); static void sis_initl(struct sis_softc *); static void sis_intr(void *); static int sis_ioctl(struct ifnet *, u_long, caddr_t); -static int sis_newbuf(struct sis_softc *, struct sis_desc *, struct mbuf *); +static int sis_newbuf(struct sis_softc *, struct sis_rxdesc *); +static int sis_rxeof(struct sis_softc *); static void sis_start(struct ifnet *); static void sis_startl(struct ifnet *); static void sis_stop(struct sis_softc *); @@ -164,33 +177,6 @@ static struct resource_spec sis_res_spec #define SIO_CLR(x) \ CSR_WRITE_4(sc, SIS_EECTL, CSR_READ_4(sc, SIS_EECTL) & ~x) -static void -sis_dma_map_desc_next(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct sis_desc *r; - - r = arg; - r->sis_next = segs->ds_addr; -} - -static void -sis_dma_map_desc_ptr(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct sis_desc *r; - - r = arg; - r->sis_ptr = segs->ds_addr; -} - -static void -sis_dma_map_ring(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - u_int32_t *p; - - p = arg; - *p = segs->ds_addr; -} - /* * Routine to reverse the bits in a word. Stolen almost * verbatim from /usr/games/fortune. @@ -1055,127 +1041,10 @@ sis_attach(device_t dev) break; } - /* - * Allocate the parent bus DMA tag appropriate for PCI. - */ -#define SIS_NSEG_NEW 32 - error = bus_dma_tag_create(NULL, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - MAXBSIZE, SIS_NSEG_NEW, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->sis_parent_tag); - if (error) - goto fail; - - /* - * Now allocate a tag for the DMA descriptor lists and a chunk - * of DMA-able memory based on the tag. Also obtain the physical - * addresses of the RX and TX ring, which we'll need later. - * All of our lists are allocated as a contiguous block - * of memory. - */ - error = bus_dma_tag_create(sc->sis_parent_tag, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - SIS_RX_LIST_SZ, 1, /* maxsize,nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ - 0, /* flags */ - busdma_lock_mutex, /* lockfunc */ - &Giant, /* lockarg */ - &sc->sis_rx_tag); - if (error) - goto fail; - - error = bus_dmamem_alloc(sc->sis_rx_tag, - (void **)&sc->sis_rx_list, BUS_DMA_NOWAIT | BUS_DMA_ZERO, - &sc->sis_rx_dmamap); - - if (error) { - device_printf(dev, "no memory for rx list buffers!\n"); - bus_dma_tag_destroy(sc->sis_rx_tag); - sc->sis_rx_tag = NULL; - goto fail; - } - - error = bus_dmamap_load(sc->sis_rx_tag, - sc->sis_rx_dmamap, &(sc->sis_rx_list[0]), - sizeof(struct sis_desc), sis_dma_map_ring, - &sc->sis_rx_paddr, 0); - - if (error) { - device_printf(dev, "cannot get address of the rx ring!\n"); - bus_dmamem_free(sc->sis_rx_tag, - sc->sis_rx_list, sc->sis_rx_dmamap); - bus_dma_tag_destroy(sc->sis_rx_tag); - sc->sis_rx_tag = NULL; - goto fail; - } - - error = bus_dma_tag_create(sc->sis_parent_tag, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - SIS_TX_LIST_SZ, 1, /* maxsize,nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ - 0, /* flags */ - busdma_lock_mutex, /* lockfunc */ - &Giant, /* lockarg */ - &sc->sis_tx_tag); - if (error) - goto fail; - - error = bus_dmamem_alloc(sc->sis_tx_tag, - (void **)&sc->sis_tx_list, BUS_DMA_NOWAIT | BUS_DMA_ZERO, - &sc->sis_tx_dmamap); - - if (error) { - device_printf(dev, "no memory for tx list buffers!\n"); - bus_dma_tag_destroy(sc->sis_tx_tag); - sc->sis_tx_tag = NULL; - goto fail; - } - - error = bus_dmamap_load(sc->sis_tx_tag, - sc->sis_tx_dmamap, &(sc->sis_tx_list[0]), - sizeof(struct sis_desc), sis_dma_map_ring, - &sc->sis_tx_paddr, 0); - - if (error) { - device_printf(dev, "cannot get address of the tx ring!\n"); - bus_dmamem_free(sc->sis_tx_tag, - sc->sis_tx_list, sc->sis_tx_dmamap); - bus_dma_tag_destroy(sc->sis_tx_tag); - sc->sis_tx_tag = NULL; - goto fail; - } - - error = bus_dma_tag_create(sc->sis_parent_tag, /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - MCLBYTES, 1, /* maxsize,nsegments */ - BUS_SPACE_MAXSIZE_32BIT,/* maxsegsize */ - 0, /* flags */ - busdma_lock_mutex, /* lockfunc */ - &Giant, /* lockarg */ - &sc->sis_tag); - if (error) + /* Allocate DMA'able memory. */ + if ((error = sis_dma_alloc(sc)) != 0) goto fail; - /* - * Obtain the physical addresses of the RX and TX - * rings which we'll need later in the init routine. - */ - ifp = sc->sis_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { device_printf(dev, "can not if_alloc()\n"); @@ -1277,30 +1146,206 @@ sis_detach(device_t dev) if (ifp) if_free(ifp); - if (sc->sis_rx_tag) { - bus_dmamap_unload(sc->sis_rx_tag, - sc->sis_rx_dmamap); - bus_dmamem_free(sc->sis_rx_tag, - sc->sis_rx_list, sc->sis_rx_dmamap); - bus_dma_tag_destroy(sc->sis_rx_tag); + sis_dma_free(sc); + + mtx_destroy(&sc->sis_mtx); + + return (0); +} + +struct sis_dmamap_arg { + bus_addr_t sis_busaddr; +}; + +static void +sis_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct sis_dmamap_arg *ctx; + + if (error != 0) + return; + + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + ctx = (struct sis_dmamap_arg *)arg; + ctx->sis_busaddr = segs[0].ds_addr; +} + +static int +sis_dma_ring_alloc(struct sis_softc *sc, bus_size_t alignment, + bus_size_t maxsize, bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, + bus_addr_t *paddr, const char *msg) +{ + struct sis_dmamap_arg ctx; + int error; + + error = bus_dma_tag_create(sc->sis_parent_tag, alignment, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, maxsize, 1, + maxsize, 0, NULL, NULL, tag); + if (error != 0) { + device_printf(sc->sis_dev, + "could not create %s dma tag\n", msg); + return (ENOMEM); } - if (sc->sis_tx_tag) { - bus_dmamap_unload(sc->sis_tx_tag, - sc->sis_tx_dmamap); - bus_dmamem_free(sc->sis_tx_tag, - sc->sis_tx_list, sc->sis_tx_dmamap); - bus_dma_tag_destroy(sc->sis_tx_tag); + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->sis_dev, + "could not allocate DMA'able memory for %s\n", msg); + return (ENOMEM); } - if (sc->sis_parent_tag) - bus_dma_tag_destroy(sc->sis_parent_tag); - if (sc->sis_tag) - bus_dma_tag_destroy(sc->sis_tag); + /* Load the address of the ring. */ + ctx.sis_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, sis_dmamap_cb, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->sis_dev, + "could not load DMA'able memory for %s\n", msg); + return (ENOMEM); + } + *paddr = ctx.sis_busaddr; + return (0); +} - mtx_destroy(&sc->sis_mtx); +static int +sis_dma_alloc(struct sis_softc *sc) +{ + struct sis_rxdesc *rxd; + struct sis_txdesc *txd; + int error, i; + + /* Allocate the parent bus DMA tag appropriate for PCI. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->sis_dev), + 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, + NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, + 0, NULL, NULL, &sc->sis_parent_tag); + if (error != 0) { + device_printf(sc->sis_dev, + "could not allocate parent dma tag\n"); + return (ENOMEM); + } + + /* Create RX ring. */ + error = sis_dma_ring_alloc(sc, SIS_DESC_ALIGN, SIS_RX_LIST_SZ, + &sc->sis_rx_list_tag, (uint8_t **)&sc->sis_rx_list, + &sc->sis_rx_list_map, &sc->sis_rx_paddr, "RX ring"); + if (error) + return (error); + + /* Create TX ring. */ + error = sis_dma_ring_alloc(sc, SIS_DESC_ALIGN, SIS_TX_LIST_SZ, + &sc->sis_tx_list_tag, (uint8_t **)&sc->sis_tx_list, + &sc->sis_tx_list_map, &sc->sis_tx_paddr, "TX ring"); + if (error) + return (error); + + /* Create tag for RX mbufs. */ + error = bus_dma_tag_create(sc->sis_parent_tag, SIS_RX_BUF_ALIGN, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->sis_rx_tag); + if (error) { + device_printf(sc->sis_dev, "could not allocate RX dma tag\n"); + return (error); + } + + /* Create tag for TX mbufs. */ + error = bus_dma_tag_create(sc->sis_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * SIS_MAXTXSEGS, SIS_MAXTXSEGS, MCLBYTES, 0, NULL, NULL, + &sc->sis_tx_tag); + if (error) { + device_printf(sc->sis_dev, "could not allocate TX dma tag\n"); + return (error); + } + + /* Create DMA maps for RX buffers. */ + error = bus_dmamap_create(sc->sis_rx_tag, 0, &sc->sis_rx_sparemap); + if (error) { + device_printf(sc->sis_dev, + "can't create spare DMA map for RX\n"); + return (error); + } + for (i = 0; i < SIS_RX_LIST_CNT; i++) { + rxd = &sc->sis_rxdesc[i]; + rxd->rx_m = NULL; + error = bus_dmamap_create(sc->sis_rx_tag, 0, &rxd->rx_dmamap); + if (error) { + device_printf(sc->sis_dev, + "can't create DMA map for RX\n"); + return (error); + } + } + + /* Create DMA maps for TX buffers. */ + for (i = 0; i < SIS_TX_LIST_CNT; i++) { + txd = &sc->sis_txdesc[i]; + txd->tx_m = NULL; + error = bus_dmamap_create(sc->sis_tx_tag, 0, &txd->tx_dmamap); + if (error) { + device_printf(sc->sis_dev, + "can't create DMA map for TX\n"); + return (error); + } + } return (0); } +static void +sis_dma_free(struct sis_softc *sc) +{ + struct sis_rxdesc *rxd; + struct sis_txdesc *txd; + int i; + + /* Destroy DMA maps for RX buffers. */ + for (i = 0; i < SIS_RX_LIST_CNT; i++) { + rxd = &sc->sis_rxdesc[i]; + if (rxd->rx_dmamap) + bus_dmamap_destroy(sc->sis_rx_tag, rxd->rx_dmamap); + } + if (sc->sis_rx_sparemap) + bus_dmamap_destroy(sc->sis_rx_tag, sc->sis_rx_sparemap); + + /* Destroy DMA maps for TX buffers. */ + for (i = 0; i < SIS_TX_LIST_CNT; i++) { + txd = &sc->sis_txdesc[i]; + if (txd->tx_dmamap) + bus_dmamap_destroy(sc->sis_tx_tag, txd->tx_dmamap); + } + + if (sc->sis_rx_tag) + bus_dma_tag_destroy(sc->sis_rx_tag); + if (sc->sis_tx_tag) + bus_dma_tag_destroy(sc->sis_tx_tag); + + /* Destroy RX ring. */ + if (sc->sis_rx_list_map) + bus_dmamap_unload(sc->sis_rx_list_tag, sc->sis_rx_list_map); + if (sc->sis_rx_list_map && sc->sis_rx_list) + bus_dmamem_free(sc->sis_rx_list_tag, sc->sis_rx_list, + sc->sis_rx_list_map); + + if (sc->sis_rx_list_tag) + bus_dma_tag_destroy(sc->sis_rx_list_tag); + + /* Destroy TX ring. */ + if (sc->sis_tx_list_map) + bus_dmamap_unload(sc->sis_tx_list_tag, sc->sis_tx_list_map); + + if (sc->sis_tx_list_map && sc->sis_tx_list) + bus_dmamem_free(sc->sis_tx_list_tag, sc->sis_tx_list, + sc->sis_tx_list_map); + + if (sc->sis_tx_list_tag) + bus_dma_tag_destroy(sc->sis_tx_list_tag); + + /* Destroy the parent tag. */ + if (sc->sis_parent_tag) + bus_dma_tag_destroy(sc->sis_parent_tag); +} + /* * Initialize the TX and RX descriptors and allocate mbufs for them. Note that * we arrange the descriptors in a closed ring, so that the last descriptor @@ -1309,48 +1354,41 @@ sis_detach(device_t dev) static int sis_ring_init(struct sis_softc *sc) { - int i, error; - struct sis_desc *dp; - - dp = &sc->sis_tx_list[0]; - for (i = 0; i < SIS_TX_LIST_CNT; i++, dp++) { - if (i == (SIS_TX_LIST_CNT - 1)) - dp->sis_nextdesc = &sc->sis_tx_list[0]; + struct sis_rxdesc *rxd; + struct sis_txdesc *txd; + bus_addr_t next; + int error, i; + + bzero(&sc->sis_tx_list[0], SIS_TX_LIST_SZ); + for (i = 0; i < SIS_TX_LIST_CNT; i++) { + txd = &sc->sis_txdesc[i]; + txd->tx_m = NULL; + if (i == SIS_TX_LIST_CNT - 1) + next = SIS_TX_RING_ADDR(sc, 0); else - dp->sis_nextdesc = dp + 1; - bus_dmamap_load(sc->sis_tx_tag, - sc->sis_tx_dmamap, - dp->sis_nextdesc, sizeof(struct sis_desc), - sis_dma_map_desc_next, dp, 0); - dp->sis_mbuf = NULL; - dp->sis_ptr = 0; - dp->sis_ctl = 0; + next = SIS_TX_RING_ADDR(sc, i + 1); + sc->sis_tx_list[i].sis_next = htole32(SIS_ADDR_LO(next)); } - sc->sis_tx_prod = sc->sis_tx_cons = sc->sis_tx_cnt = 0; + bus_dmamap_sync(sc->sis_tx_list_tag, sc->sis_tx_list_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - bus_dmamap_sync(sc->sis_tx_tag, - sc->sis_tx_dmamap, BUS_DMASYNC_PREWRITE); - - dp = &sc->sis_rx_list[0]; - for (i = 0; i < SIS_RX_LIST_CNT; i++, dp++) { - error = sis_newbuf(sc, dp, NULL); + sc->sis_rx_cons = 0; + bzero(&sc->sis_rx_list[0], SIS_RX_LIST_SZ); + for (i = 0; i < SIS_RX_LIST_CNT; i++) { + rxd = &sc->sis_rxdesc[i]; + rxd->rx_desc = &sc->sis_rx_list[i]; + if (i == SIS_RX_LIST_CNT - 1) + next = SIS_RX_RING_ADDR(sc, 0); + else + next = SIS_RX_RING_ADDR(sc, i + 1); + rxd->rx_desc->sis_next = htole32(SIS_ADDR_LO(next)); + error = sis_newbuf(sc, rxd); if (error) return (error); - if (i == (SIS_RX_LIST_CNT - 1)) - dp->sis_nextdesc = &sc->sis_rx_list[0]; - else - dp->sis_nextdesc = dp + 1; - bus_dmamap_load(sc->sis_rx_tag, - sc->sis_rx_dmamap, - dp->sis_nextdesc, sizeof(struct sis_desc), - sis_dma_map_desc_next, dp, 0); - } - - bus_dmamap_sync(sc->sis_rx_tag, - sc->sis_rx_dmamap, BUS_DMASYNC_PREWRITE); - - sc->sis_rx_pdsc = &sc->sis_rx_list[0]; + } + bus_dmamap_sync(sc->sis_rx_list_tag, sc->sis_rx_list_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } @@ -1359,30 +1397,66 @@ sis_ring_init(struct sis_softc *sc) * Initialize an RX descriptor and attach an MBUF cluster. */ static int -sis_newbuf(struct sis_softc *sc, struct sis_desc *c, struct mbuf *m) +sis_newbuf(struct sis_softc *sc, struct sis_rxdesc *rxd) { + struct mbuf *m; + bus_dma_segment_t segs[1]; + bus_dmamap_t map; + int nsegs; - if (c == NULL) - return (EINVAL); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = SIS_RXLEN; +#ifndef __NO_STRICT_ALIGNMENT + m_adj(m, SIS_RX_BUF_ALIGN); +#endif - if (m == NULL) { - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - if (m == NULL) - return (ENOBUFS); - } else - m->m_data = m->m_ext.ext_buf; + if (bus_dmamap_load_mbuf_sg(sc->sis_rx_tag, sc->sis_rx_sparemap, m, + segs, &nsegs, 0) != 0) { + m_freem(m); + return (ENOBUFS); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); - c->sis_mbuf = m; - c->sis_ctl = SIS_RXLEN; + if (rxd->rx_m != NULL) { + bus_dmamap_sync(sc->sis_rx_tag, rxd->rx_dmamap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sis_rx_tag, rxd->rx_dmamap); + } + map = rxd->rx_dmamap; + rxd->rx_dmamap = sc->sis_rx_sparemap; + sc->sis_rx_sparemap = map; + bus_dmamap_sync(sc->sis_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_PREREAD); + rxd->rx_m = m; + rxd->rx_desc->sis_cmdsts = htole32(SIS_RXLEN); + rxd->rx_desc->sis_ptr = htole32(SIS_ADDR_LO(segs[0].ds_addr)); + return (0); +} - bus_dmamap_create(sc->sis_tag, 0, &c->sis_map); - bus_dmamap_load(sc->sis_tag, c->sis_map, - mtod(m, void *), MCLBYTES, - sis_dma_map_desc_ptr, c, 0); - bus_dmamap_sync(sc->sis_tag, c->sis_map, BUS_DMASYNC_PREREAD); +static __inline void +sis_discard_rxbuf(struct sis_rxdesc *rxd) +{ - return (0); + rxd->rx_desc->sis_cmdsts = htole32(SIS_RXLEN); +} + +#ifndef __NO_STRICT_ALIGNMENT +static __inline void +sis_fixup_rx(struct mbuf *m) +{ + uint16_t *src, *dst; + int i; + + src = mtod(m, uint16_t *); + dst = src - (SIS_RX_BUF_ALIGN - ETHER_ALIGN) / sizeof(*src); + + for (i = 0; i < (m->m_len / sizeof(uint16_t) + 1); i++) + *dst++ = *src++; + + m->m_data -= SIS_RX_BUF_ALIGN - ETHER_ALIGN; } +#endif /* * A frame has been uploaded: pass the resulting mbuf chain up to @@ -1391,19 +1465,23 @@ sis_newbuf(struct sis_softc *sc, struct static int sis_rxeof(struct sis_softc *sc) { - struct mbuf *m, *m0; + struct mbuf *m; struct ifnet *ifp; + struct sis_rxdesc *rxd; struct sis_desc *cur_rx; - int total_len = 0, rx_npkts = 0; - u_int32_t rxstat; + int prog, rx_cons, rx_npkts = 0, total_len; + uint32_t rxstat; SIS_LOCK_ASSERT(sc); - ifp = sc->sis_ifp; + bus_dmamap_sync(sc->sis_rx_list_tag, sc->sis_rx_list_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - for (cur_rx = sc->sis_rx_pdsc; SIS_OWNDESC(cur_rx); - cur_rx = cur_rx->sis_nextdesc) { + rx_cons = sc->sis_rx_cons; + ifp = sc->sis_ifp; + for (prog = 0; (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0; + SIS_INC(rx_cons, SIS_RX_LIST_CNT), prog++) { #ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) { if (sc->rxcycles <= 0) @@ -1411,21 +1489,13 @@ sis_rxeof(struct sis_softc *sc) sc->rxcycles--; } #endif - rxstat = cur_rx->sis_rxstat; - bus_dmamap_sync(sc->sis_tag, - cur_rx->sis_map, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sis_tag, cur_rx->sis_map); - bus_dmamap_destroy(sc->sis_tag, cur_rx->sis_map); - m = cur_rx->sis_mbuf; - cur_rx->sis_mbuf = NULL; - total_len = SIS_RXBYTES(cur_rx); + cur_rx = &sc->sis_rx_list[rx_cons]; + rxstat = le32toh(cur_rx->sis_cmdsts); + if ((rxstat & SIS_CMDSTS_OWN) == 0) + break; + rxd = &sc->sis_rxdesc[rx_cons]; - /* - * If an error occurs, update stats, clear the - * status word and leave the mbuf cluster in place: - * it should simply get re-used next time this descriptor - * comes up in the ring. - */ + total_len = (rxstat & SIS_CMDSTS_BUFLEN) - ETHER_CRC_LEN; if ((ifp->if_capenable & IFCAP_VLAN_MTU) != 0 && total_len <= (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN - ETHER_CRC_LEN)) @@ -1434,36 +1504,29 @@ sis_rxeof(struct sis_softc *sc) ifp->if_ierrors++; if (rxstat & SIS_RXSTAT_COLL) ifp->if_collisions++; - sis_newbuf(sc, cur_rx, m); + sis_discard_rxbuf(rxd); + continue; + } + + /* Add a new receive buffer to the ring. */ + m = rxd->rx_m; + if (sis_newbuf(sc, rxd) != 0) { + ifp->if_iqdrops++; + sis_discard_rxbuf(rxd); continue; } /* No errors; receive the packet. */ -#ifdef __NO_STRICT_ALIGNMENT + m->m_pkthdr.len = m->m_len = total_len; +#ifndef __NO_STRICT_ALIGNMENT /* * On architectures without alignment problems we try to * allocate a new buffer for the receive ring, and pass up * the one where the packet is already, saving the expensive - * copy done in m_devget(). - * If we are on an architecture with alignment problems, or - * if the allocation fails, then use m_devget and leave the - * existing buffer in the receive ring. + * copy operation. */ - if (sis_newbuf(sc, cur_rx, NULL) == 0) - m->m_pkthdr.len = m->m_len = total_len; - else + sis_fixup_rx(m); #endif - { - m0 = m_devget(mtod(m, char *), total_len, - ETHER_ALIGN, ifp, NULL); - sis_newbuf(sc, cur_rx, m); - if (m0 == NULL) { - ifp->if_ierrors++; - continue; - } - m = m0; - } - ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; @@ -1473,7 +1536,12 @@ sis_rxeof(struct sis_softc *sc) rx_npkts++; } - sc->sis_rx_pdsc = cur_rx; + if (prog > 0) { + sc->sis_rx_cons = rx_cons; + bus_dmamap_sync(sc->sis_rx_list_tag, sc->sis_rx_list_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + } + return (rx_npkts); } @@ -1486,52 +1554,54 @@ static void sis_txeof(struct sis_softc *sc) { struct ifnet *ifp; - u_int32_t idx; + struct sis_desc *cur_tx; + struct sis_txdesc *txd; + uint32_t cons, txstat; SIS_LOCK_ASSERT(sc); + + cons = sc->sis_tx_cons; + if (cons == sc->sis_tx_prod) + return; + ifp = sc->sis_ifp; + bus_dmamap_sync(sc->sis_tx_list_tag, sc->sis_tx_list_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* * Go through our tx list and free mbufs for those * frames that have been transmitted. */ - for (idx = sc->sis_tx_cons; sc->sis_tx_cnt > 0; - sc->sis_tx_cnt--, SIS_INC(idx, SIS_TX_LIST_CNT) ) { - struct sis_desc *cur_tx = &sc->sis_tx_list[idx]; - - if (SIS_OWNDESC(cur_tx)) + for (; cons != sc->sis_tx_prod; SIS_INC(cons, SIS_TX_LIST_CNT)) { + cur_tx = &sc->sis_tx_list[cons]; + txstat = le32toh(cur_tx->sis_cmdsts); + if ((txstat & SIS_CMDSTS_OWN) != 0) break; - - if (cur_tx->sis_ctl & SIS_CMDSTS_MORE) - continue; - - if (!(cur_tx->sis_ctl & SIS_CMDSTS_PKT_OK)) { - ifp->if_oerrors++; - if (cur_tx->sis_txstat & SIS_TXSTAT_EXCESSCOLLS) - ifp->if_collisions++; - if (cur_tx->sis_txstat & SIS_TXSTAT_OUTOFWINCOLL) - ifp->if_collisions++; - } - - ifp->if_collisions += - (cur_tx->sis_txstat & SIS_TXSTAT_COLLCNT) >> 16; - - ifp->if_opackets++; - if (cur_tx->sis_mbuf != NULL) { - m_freem(cur_tx->sis_mbuf); - cur_tx->sis_mbuf = NULL; - bus_dmamap_unload(sc->sis_tag, cur_tx->sis_map); - bus_dmamap_destroy(sc->sis_tag, cur_tx->sis_map); + txd = &sc->sis_txdesc[cons]; + if (txd->tx_m != NULL) { + bus_dmamap_sync(sc->sis_tx_tag, txd->tx_dmamap, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sis_tx_tag, txd->tx_dmamap); + m_freem(txd->tx_m); + txd->tx_m = NULL; + if ((txstat & SIS_CMDSTS_PKT_OK) != 0) { + ifp->if_opackets++; + ifp->if_collisions += + (txstat & SIS_TXSTAT_COLLCNT) >> 16; + } else { + ifp->if_oerrors++; + if (txstat & SIS_TXSTAT_EXCESSCOLLS) + ifp->if_collisions++; + if (txstat & SIS_TXSTAT_OUTOFWINCOLL) + ifp->if_collisions++; + } } - } - - if (idx != sc->sis_tx_cons) { - /* we freed up some buffers */ - sc->sis_tx_cons = idx; + sc->sis_tx_cnt--; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } - - sc->sis_watchdog_timer = (sc->sis_tx_cnt == 0) ? 0 : 5; + sc->sis_tx_cons = cons; + if (sc->sis_tx_cnt == 0) + sc->sis_watchdog_timer = 0; } static void @@ -1680,83 +1750,80 @@ sis_intr(void *arg) * pointers to the fragment pointers. */ static int -sis_encap(struct sis_softc *sc, struct mbuf **m_head, uint32_t *txidx) +sis_encap(struct sis_softc *sc, struct mbuf **m_head) { - struct sis_desc *f = NULL; struct mbuf *m; - int frag, cur, cnt = 0, chainlen = 0; - - /* - * If there's no way we can send any packets, return now. - */ - if (SIS_TX_LIST_CNT - sc->sis_tx_cnt < 2) - return (ENOBUFS); - - /* - * Count the number of frags in this chain to see if - * we need to m_defrag. Since the descriptor list is shared - * by all packets, we'll m_defrag long chains so that they - * do not use up the entire list, even if they would fit. - */ - - for (m = *m_head; m != NULL; m = m->m_next) - chainlen++; - - if ((chainlen > SIS_TX_LIST_CNT / 4) || - ((SIS_TX_LIST_CNT - (chainlen + sc->sis_tx_cnt)) < 2)) { - m = m_defrag(*m_head, M_DONTWAIT); - if (m == NULL) + struct sis_txdesc *txd; + struct sis_desc *f; + bus_dma_segment_t segs[SIS_MAXTXSEGS]; + bus_dmamap_t map; + int error, i, frag, nsegs, prod; + + prod = sc->sis_tx_prod; + txd = &sc->sis_txdesc[prod]; + error = bus_dmamap_load_mbuf_sg(sc->sis_tx_tag, txd->tx_dmamap, + *m_head, segs, &nsegs, 0); + if (error == EFBIG) { + m = m_collapse(*m_head, M_DONTWAIT, SIS_MAXTXSEGS); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; return (ENOBUFS); + } *m_head = m; - } - - /* - * Start packing the mbufs in this chain into - * the fragment pointers. Stop when we run out - * of fragments or hit the end of the mbuf chain. - */ - cur = frag = *txidx; - - for (m = *m_head; m != NULL; m = m->m_next) { - if (m->m_len != 0) { - if ((SIS_TX_LIST_CNT - - (sc->sis_tx_cnt + cnt)) < 2) - return (ENOBUFS); - f = &sc->sis_tx_list[frag]; - f->sis_ctl = SIS_CMDSTS_MORE | m->m_len; - bus_dmamap_create(sc->sis_tag, 0, &f->sis_map); - bus_dmamap_load(sc->sis_tag, f->sis_map, - mtod(m, void *), m->m_len, - sis_dma_map_desc_ptr, f, 0); - bus_dmamap_sync(sc->sis_tag, - f->sis_map, BUS_DMASYNC_PREREAD); - if (cnt != 0) - f->sis_ctl |= SIS_CMDSTS_OWN; - cur = frag; - SIS_INC(frag, SIS_TX_LIST_CNT); - cnt++; + error = bus_dmamap_load_mbuf_sg(sc->sis_tx_tag, txd->tx_dmamap, + *m_head, segs, &nsegs, 0); + if (error != 0) { + m_freem(*m_head); + *m_head = NULL; + return (error); } - } + } else if (error != 0) + return (error); - if (m != NULL) + /* Check for descriptor overruns. */ + if (sc->sis_tx_cnt + nsegs > SIS_TX_LIST_CNT - 1) { + bus_dmamap_unload(sc->sis_tx_tag, txd->tx_dmamap); return (ENOBUFS); + } - sc->sis_tx_list[cur].sis_mbuf = *m_head; - sc->sis_tx_list[cur].sis_ctl &= ~SIS_CMDSTS_MORE; - sc->sis_tx_list[*txidx].sis_ctl |= SIS_CMDSTS_OWN; - sc->sis_tx_cnt += cnt; - *txidx = frag; + bus_dmamap_sync(sc->sis_tx_tag, txd->tx_dmamap, BUS_DMASYNC_PREWRITE); + + frag = prod; + for (i = 0; i < nsegs; i++) { + f = &sc->sis_tx_list[prod]; + if (i == 0) + f->sis_cmdsts = htole32(segs[i].ds_len | + SIS_CMDSTS_MORE); + else + f->sis_cmdsts = htole32(segs[i].ds_len | + SIS_CMDSTS_OWN | SIS_CMDSTS_MORE); + f->sis_ptr = htole32(SIS_ADDR_LO(segs[i].ds_addr)); + SIS_INC(prod, SIS_TX_LIST_CNT); + sc->sis_tx_cnt++; + } + + /* Update producer index. */ + sc->sis_tx_prod = prod; + + /* Remove MORE flag on the last descriptor. */ + prod = (prod - 1) & (SIS_TX_LIST_CNT - 1); + f = &sc->sis_tx_list[prod]; + f->sis_cmdsts &= ~htole32(SIS_CMDSTS_MORE); + + /* Lastly transfer ownership of packet to the controller. */ + f = &sc->sis_tx_list[frag]; + f->sis_cmdsts |= htole32(SIS_CMDSTS_OWN); + + /* Swap the last and the first dmamaps. */ + map = txd->tx_dmamap; + txd->tx_dmamap = sc->sis_txdesc[frag].tx_dmamap; + sc->sis_txdesc[frag].tx_dmamap = map; + txd->tx_m = *m_head; return (0); } -/* - * Main transmit routine. To avoid having to do mbuf copies, we put pointers - * to the mbuf data regions directly in the transmit lists. We also save a - * copy of the pointers since the transmit list fragment pointers are - * physical addresses. - */ - static void sis_start(struct ifnet *ifp) { @@ -1772,27 +1839,26 @@ static void sis_startl(struct ifnet *ifp) { struct sis_softc *sc; - struct mbuf *m_head = NULL; - u_int32_t idx, queued = 0; + struct mbuf *m_head; + int queued; sc = ifp->if_softc; SIS_LOCK_ASSERT(sc); - if (!sc->sis_link) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || sc->sis_link == 0) return; - idx = sc->sis_tx_prod; - - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) - return; - - while (sc->sis_tx_list[idx].sis_mbuf == NULL) { + for (queued = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && + sc->sis_tx_cnt < SIS_TX_LIST_CNT - 4;) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; - if (sis_encap(sc, &m_head, &idx)) { + if (sis_encap(sc, &m_head) != 0) { + if (m_head == NULL) + break; IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; @@ -1805,12 +1871,12 @@ sis_startl(struct ifnet *ifp) * to him. */ BPF_MTAP(ifp, m_head); - } if (queued) { /* Transmit */ - sc->sis_tx_prod = idx; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 19:36:06 2010 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 6DA441065672; Wed, 1 Sep 2010 19:36:06 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C6788FC16; Wed, 1 Sep 2010 19:36:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81Ja6Nm078124; Wed, 1 Sep 2010 19:36:06 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81Ja63l078122; Wed, 1 Sep 2010 19:36:06 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009011936.o81Ja63l078122@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Sep 2010 19:36:06 +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: r212110 - stable/8/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: Wed, 01 Sep 2010 19:36:06 -0000 Author: emaste Date: Wed Sep 1 19:36:06 2010 New Revision: 212110 URL: http://svn.freebsd.org/changeset/base/212110 Log: MFC r202988, r203022 Remove vestigial NetBSD compatibility shim. Convert to 2-clause license, from NetBSD rc.subr r1.70. Modified: stable/8/etc/rc.subr Modified: stable/8/etc/rc.subr ============================================================================== --- stable/8/etc/rc.subr Wed Sep 1 19:33:40 2010 (r212109) +++ stable/8/etc/rc.subr Wed Sep 1 19:36:06 2010 (r212110) @@ -15,13 +15,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 @@ -52,22 +45,12 @@ _rc_subr_loaded="YES" SYSCTL="/sbin/sysctl" SYSCTL_N="${SYSCTL} -n" -CMD_OSTYPE="${SYSCTL_N} kern.ostype" -OSTYPE=`${CMD_OSTYPE}` +SYSCTL_W="${SYSCTL}" ID="/usr/bin/id" IDCMD="if [ -x $ID ]; then $ID -un; fi" PS="/bin/ps -ww" JID=`$PS -p $$ -o jid=` -case ${OSTYPE} in -FreeBSD) - SYSCTL_W="${SYSCTL}" - ;; -NetBSD) - SYSCTL_W="${SYSCTL} -w" - ;; -esac - # # functions # --------- From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 19:49:24 2010 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 6CC7C10656BC; Wed, 1 Sep 2010 19:49:24 +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 5B7778FC14; Wed, 1 Sep 2010 19:49:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81JnOXQ078404; Wed, 1 Sep 2010 19:49:24 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81JnOqP078402; Wed, 1 Sep 2010 19:49:24 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009011949.o81JnOqP078402@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 1 Sep 2010 19:49: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: r212111 - stable/8/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 19:49:24 -0000 Author: jilles Date: Wed Sep 1 19:49:24 2010 New Revision: 212111 URL: http://svn.freebsd.org/changeset/base/212111 Log: MFC r210736: sh: Do not enter consecutive duplicates into the history. This simply sets a flag in libedit. It has a shortcoming in that it does not apply to multi-line commands. Note that a configuration option for this is not going to happen, but always having this seems better than not having it. NetBSD has done the same. PR: bin/54683 Obtained from: NetBSD Modified: stable/8/bin/sh/histedit.c Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/histedit.c ============================================================================== --- stable/8/bin/sh/histedit.c Wed Sep 1 19:36:06 2010 (r212110) +++ stable/8/bin/sh/histedit.c Wed Sep 1 19:49:24 2010 (r212111) @@ -157,6 +157,7 @@ sethistsize(hs) (histsize = atoi(hs)) < 0) histsize = 100; history(hist, &he, H_SETSIZE, histsize); + history(hist, &he, H_SETUNIQUE, 1); } } From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 19:50:04 2010 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 2F747106567A; Wed, 1 Sep 2010 19:50:04 +0000 (UTC) (envelope-from mlaier@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D4D08FC1D; Wed, 1 Sep 2010 19:50:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81Jo4CE078467; Wed, 1 Sep 2010 19:50:04 GMT (envelope-from mlaier@svn.freebsd.org) Received: (from mlaier@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81Jo4Bx078460; Wed, 1 Sep 2010 19:50:04 GMT (envelope-from mlaier@svn.freebsd.org) Message-Id: <201009011950.o81Jo4Bx078460@svn.freebsd.org> From: Max Laier Date: Wed, 1 Sep 2010 19:50: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: r212112 - in head: share/man/man9 sys/kern 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, 01 Sep 2010 19:50:04 -0000 Author: mlaier Date: Wed Sep 1 19:50:03 2010 New Revision: 212112 URL: http://svn.freebsd.org/changeset/base/212112 Log: rmlock(9) two additions and one change/fix: - add rm_try_rlock(). - add RM_SLEEPABLE to use sx(9) as the back-end lock in order to sleep while holding the write lock. - change rm_noreadtoken to a cpu bitmask to indicate which CPUs need to go through the lock/unlock in order to synchronize. As a side effect, this also avoids IPI to CPUs without any readers during rm_wlock. Discussed with: ups@, rwatson@ on arch@ Sponsored by: Isilon Systems, Inc. Modified: head/share/man/man9/Makefile head/share/man/man9/locking.9 head/share/man/man9/rmlock.9 head/sys/kern/kern_rmlock.c head/sys/sys/_rmlock.h head/sys/sys/rmlock.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Sep 1 19:49:24 2010 (r212111) +++ head/share/man/man9/Makefile Wed Sep 1 19:50:03 2010 (r212112) @@ -986,6 +986,7 @@ MLINKS+=rman.9 rman_activate_resource.9 MLINKS+=rmlock.9 rm_destroy.9 \ rmlock.9 rm_init.9 \ rmlock.9 rm_rlock.9 \ + rmlock.9 rm_try_rlock.9 \ rmlock.9 rm_runlock.9 \ rmlock.9 RM_SYSINIT.9 \ rmlock.9 rm_wlock.9 \ Modified: head/share/man/man9/locking.9 ============================================================================== --- head/share/man/man9/locking.9 Wed Sep 1 19:49:24 2010 (r212111) +++ head/share/man/man9/locking.9 Wed Sep 1 19:50:03 2010 (r212112) @@ -301,7 +301,7 @@ one of the synchronization primitives di .It mutex Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3 .It sx Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4 .It rwlock Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&ok Ta \&no-3 -.It rmlock Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok-2 Ta \&no +.It rmlock Ta \&ok Ta \&ok Ta \&ok-5 Ta \&ok Ta \&ok-2 Ta \&ok-5 .El .Pp .Em *1 @@ -326,6 +326,13 @@ Though one can sleep holding an sx lock, .Fn sx_sleep which will atomically release this primitive when going to sleep and reacquire it on wakeup. +.Pp +.Em *5 +.Em Read-mostly +locks can be initialized to support sleeping while holding a write lock. +See +.Xr rmlock 9 +for details. .Ss Context mode table The next table shows what can be used in different contexts. At this time this is a rather easy to remember table. Modified: head/share/man/man9/rmlock.9 ============================================================================== --- head/share/man/man9/rmlock.9 Wed Sep 1 19:49:24 2010 (r212111) +++ head/share/man/man9/rmlock.9 Wed Sep 1 19:50:03 2010 (r212112) @@ -35,6 +35,7 @@ .Nm rm_init_flags , .Nm rm_destroy , .Nm rm_rlock , +.Nm rm_try_rlock , .Nm rm_wlock , .Nm rm_runlock , .Nm rm_wunlock , @@ -53,6 +54,8 @@ .Fn rm_destroy "struct rmlock *rm" .Ft void .Fn rm_rlock "struct rmlock *rm" "struct rm_priotracker* tracker" +.Ft int +.Fn rm_try_rlock "struct rmlock *rm" "struct rm_priotracker* tracker" .Ft void .Fn rm_wlock "struct rmlock *rm" .Ft void @@ -84,14 +87,16 @@ Although reader/writer locks look very s locks, their usage pattern is different. Reader/writer locks can be treated as mutexes (see .Xr mutex 9 ) -with shared/exclusive semantics. +with shared/exclusive semantics unless initialized with +.Dv RM_SLEEPABLE . Unlike .Xr sx 9 , an .Nm can be locked while holding a non-spin mutex, and an .Nm -cannot be held while sleeping. +cannot be held while sleeping, again unless initialized with +.Dv RM_SLEEPABLE . The .Nm locks have full priority propagation like mutexes. @@ -135,6 +140,13 @@ to ignore this lock. .It Dv RM_RECURSE Allow threads to recursively acquire exclusive locks for .Fa rm . +.It Dv RM_SLEEPABLE +Allow writers to sleep while holding the lock. +Readers must not sleep while holding the lock and can avoid to sleep on +taking the lock by using +.Fn rm_try_rlock +instead of +.Fn rm_rlock . .El .It Fn rm_rlock "struct rmlock *rm" "struct rm_priotracker* tracker" Lock @@ -161,6 +173,16 @@ access on .Fa rm . This is called .Dq "recursing on a lock" . +.It Fn rm_try_rlock "struct rmlock *rm" "struct rm_priotracker* tracker" +Try to lock +.Fa rm +as a reader. +.Fn rm_try_rlock +will return 0 if the lock cannot be acquired immediately; +otherwise the lock will be acquired and a non-zero value will be returned. +Note that +.Fn rm_try_rlock +may fail even while the lock is not currently held by a writer. .It Fn rm_wlock "struct rmlock *rm" Lock .Fa rm @@ -217,6 +239,10 @@ The .Nm implementation is currently not optimized for single processor systems. .Pp +.Fn rm_try_rlock +can fail transiently even when there is no writer, while another reader +updates the state on the local CPU. +.Pp The .Nm implementation uses a single per CPU list shared by all Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Wed Sep 1 19:49:24 2010 (r212111) +++ head/sys/kern/kern_rmlock.c Wed Sep 1 19:50:03 2010 (r212112) @@ -187,6 +187,8 @@ rm_cleanIPI(void *arg) } } +CTASSERT((RM_SLEEPABLE & LO_CLASSFLAGS) == RM_SLEEPABLE); + void rm_init_flags(struct rmlock *rm, const char *name, int opts) { @@ -197,9 +199,13 @@ rm_init_flags(struct rmlock *rm, const c liflags |= LO_WITNESS; if (opts & RM_RECURSE) liflags |= LO_RECURSABLE; - rm->rm_noreadtoken = 1; + rm->rm_writecpus = all_cpus; LIST_INIT(&rm->rm_activeReaders); - mtx_init(&rm->rm_lock, name, "rmlock_mtx", MTX_NOWITNESS); + if (opts & RM_SLEEPABLE) { + liflags |= RM_SLEEPABLE; + sx_init_flags(&rm->rm_lock_sx, "rmlock_sx", SX_RECURSE); + } else + mtx_init(&rm->rm_lock_mtx, name, "rmlock_mtx", MTX_NOWITNESS); lock_init(&rm->lock_object, &lock_class_rm, name, NULL, liflags); } @@ -214,7 +220,10 @@ void rm_destroy(struct rmlock *rm) { - mtx_destroy(&rm->rm_lock); + if (rm->lock_object.lo_flags & RM_SLEEPABLE) + sx_destroy(&rm->rm_lock_sx); + else + mtx_destroy(&rm->rm_lock_mtx); lock_destroy(&rm->lock_object); } @@ -222,7 +231,10 @@ int rm_wowned(struct rmlock *rm) { - return (mtx_owned(&rm->rm_lock)); + if (rm->lock_object.lo_flags & RM_SLEEPABLE) + return (sx_xlocked(&rm->rm_lock_sx)); + else + return (mtx_owned(&rm->rm_lock_mtx)); } void @@ -241,8 +253,8 @@ rm_sysinit_flags(void *arg) rm_init_flags(args->ra_rm, args->ra_desc, args->ra_opts); } -static void -_rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker) +static int +_rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) { struct pcpu *pc; struct rm_queue *queue; @@ -252,9 +264,9 @@ _rm_rlock_hard(struct rmlock *rm, struct pc = pcpu_find(curcpu); /* Check if we just need to do a proper critical_exit. */ - if (0 == rm->rm_noreadtoken) { + if (!(pc->pc_cpumask & rm->rm_writecpus)) { critical_exit(); - return; + return (1); } /* Remove our tracker from the per-cpu list. */ @@ -265,7 +277,7 @@ _rm_rlock_hard(struct rmlock *rm, struct /* Just add back tracker - we hold the lock. */ rm_tracker_add(pc, tracker); critical_exit(); - return; + return (1); } /* @@ -289,7 +301,7 @@ _rm_rlock_hard(struct rmlock *rm, struct mtx_unlock_spin(&rm_spinlock); rm_tracker_add(pc, tracker); critical_exit(); - return; + return (1); } } } @@ -297,20 +309,38 @@ _rm_rlock_hard(struct rmlock *rm, struct sched_unpin(); critical_exit(); - mtx_lock(&rm->rm_lock); - rm->rm_noreadtoken = 0; - critical_enter(); + if (trylock) { + if (rm->lock_object.lo_flags & RM_SLEEPABLE) { + if (!sx_try_xlock(&rm->rm_lock_sx)) + return (0); + } else { + if (!mtx_trylock(&rm->rm_lock_mtx)) + return (0); + } + } else { + if (rm->lock_object.lo_flags & RM_SLEEPABLE) + sx_xlock(&rm->rm_lock_sx); + else + mtx_lock(&rm->rm_lock_mtx); + } + critical_enter(); pc = pcpu_find(curcpu); + rm->rm_writecpus &= ~pc->pc_cpumask; rm_tracker_add(pc, tracker); sched_pin(); critical_exit(); - mtx_unlock(&rm->rm_lock); + if (rm->lock_object.lo_flags & RM_SLEEPABLE) + sx_xunlock(&rm->rm_lock_sx); + else + mtx_unlock(&rm->rm_lock_mtx); + + return (1); } -void -_rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker) +int +_rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) { struct thread *td = curthread; struct pcpu *pc; @@ -337,11 +367,11 @@ _rm_rlock(struct rmlock *rm, struct rm_p * Fast path to combine two common conditions into a single * conditional jump. */ - if (0 == (td->td_owepreempt | rm->rm_noreadtoken)) - return; + if (0 == (td->td_owepreempt | (rm->rm_writecpus & pc->pc_cpumask))) + return (1); /* We do not have a read token and need to acquire one. */ - _rm_rlock_hard(rm, tracker); + return _rm_rlock_hard(rm, tracker, trylock); } static void @@ -400,20 +430,26 @@ _rm_wlock(struct rmlock *rm) { struct rm_priotracker *prio; struct turnstile *ts; + cpumask_t readcpus; - mtx_lock(&rm->rm_lock); + if (rm->lock_object.lo_flags & RM_SLEEPABLE) + sx_xlock(&rm->rm_lock_sx); + else + mtx_lock(&rm->rm_lock_mtx); - if (rm->rm_noreadtoken == 0) { + if (rm->rm_writecpus != all_cpus) { /* Get all read tokens back */ - rm->rm_noreadtoken = 1; + readcpus = all_cpus & (all_cpus & ~rm->rm_writecpus); + rm->rm_writecpus = all_cpus; /* - * Assumes rm->rm_noreadtoken update is visible on other CPUs + * Assumes rm->rm_writecpus update is visible on other CPUs * before rm_cleanIPI is called. */ #ifdef SMP - smp_rendezvous(smp_no_rendevous_barrier, + smp_rendezvous_cpus(readcpus, + smp_no_rendevous_barrier, rm_cleanIPI, smp_no_rendevous_barrier, rm); @@ -439,7 +475,10 @@ void _rm_wunlock(struct rmlock *rm) { - mtx_unlock(&rm->rm_lock); + if (rm->lock_object.lo_flags & RM_SLEEPABLE) + sx_xunlock(&rm->rm_lock_sx); + else + mtx_unlock(&rm->rm_lock_mtx); } #ifdef LOCK_DEBUG @@ -454,7 +493,11 @@ void _rm_wlock_debug(struct rmlock *rm, LOCK_LOG_LOCK("RMWLOCK", &rm->lock_object, 0, 0, file, line); - WITNESS_LOCK(&rm->lock_object, LOP_EXCLUSIVE, file, line); + if (rm->lock_object.lo_flags & RM_SLEEPABLE) + WITNESS_LOCK(&rm->rm_lock_sx.lock_object, LOP_EXCLUSIVE, + file, line); + else + WITNESS_LOCK(&rm->lock_object, LOP_EXCLUSIVE, file, line); curthread->td_locks++; @@ -465,25 +508,35 @@ _rm_wunlock_debug(struct rmlock *rm, con { curthread->td_locks--; - WITNESS_UNLOCK(&rm->lock_object, LOP_EXCLUSIVE, file, line); + if (rm->lock_object.lo_flags & RM_SLEEPABLE) + WITNESS_UNLOCK(&rm->rm_lock_sx.lock_object, LOP_EXCLUSIVE, + file, line); + else + WITNESS_UNLOCK(&rm->lock_object, LOP_EXCLUSIVE, file, line); LOCK_LOG_LOCK("RMWUNLOCK", &rm->lock_object, 0, 0, file, line); _rm_wunlock(rm); } -void +int _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, - const char *file, int line) + int trylock, const char *file, int line) { - + if (!trylock && (rm->lock_object.lo_flags & RM_SLEEPABLE)) + WITNESS_CHECKORDER(&rm->rm_lock_sx.lock_object, LOP_NEWORDER, + file, line, NULL); WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER, file, line, NULL); - _rm_rlock(rm, tracker); + if (_rm_rlock(rm, tracker, trylock)) { + LOCK_LOG_LOCK("RMRLOCK", &rm->lock_object, 0, 0, file, line); - LOCK_LOG_LOCK("RMRLOCK", &rm->lock_object, 0, 0, file, line); + WITNESS_LOCK(&rm->lock_object, 0, file, line); - WITNESS_LOCK(&rm->lock_object, 0, file, line); + curthread->td_locks++; - curthread->td_locks++; + return (1); + } + + return (0); } void @@ -517,12 +570,12 @@ _rm_wunlock_debug(struct rmlock *rm, con _rm_wunlock(rm); } -void +int _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, - const char *file, int line) + int trylock, const char *file, int line) { - _rm_rlock(rm, tracker); + return _rm_rlock(rm, tracker, trylock); } void Modified: head/sys/sys/_rmlock.h ============================================================================== --- head/sys/sys/_rmlock.h Wed Sep 1 19:49:24 2010 (r212111) +++ head/sys/sys/_rmlock.h Wed Sep 1 19:50:03 2010 (r212112) @@ -45,11 +45,15 @@ LIST_HEAD(rmpriolist,rm_priotracker); struct rmlock { struct lock_object lock_object; - volatile int rm_noreadtoken; + volatile cpumask_t rm_writecpus; LIST_HEAD(,rm_priotracker) rm_activeReaders; - struct mtx rm_lock; - + union { + struct mtx _rm_lock_mtx; + struct sx _rm_lock_sx; + } _rm_lock; }; +#define rm_lock_mtx _rm_lock._rm_lock_mtx +#define rm_lock_sx _rm_lock._rm_lock_sx struct rm_priotracker { struct rm_queue rmp_cpuQueue; /* Must be first */ Modified: head/sys/sys/rmlock.h ============================================================================== --- head/sys/sys/rmlock.h Wed Sep 1 19:49:24 2010 (r212111) +++ head/sys/sys/rmlock.h Wed Sep 1 19:50:03 2010 (r212112) @@ -33,6 +33,7 @@ #define _SYS_RMLOCK_H_ #include +#include #include #include @@ -43,6 +44,7 @@ */ #define RM_NOWITNESS 0x00000001 #define RM_RECURSE 0x00000002 +#define RM_SLEEPABLE 0x00000004 void rm_init(struct rmlock *rm, const char *name); void rm_init_flags(struct rmlock *rm, const char *name, int opts); @@ -53,14 +55,15 @@ void rm_sysinit_flags(void *arg); void _rm_wlock_debug(struct rmlock *rm, const char *file, int line); void _rm_wunlock_debug(struct rmlock *rm, const char *file, int line); -void _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, - const char *file, int line); +int _rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, + int trylock, const char *file, int line); void _rm_runlock_debug(struct rmlock *rm, struct rm_priotracker *tracker, const char *file, int line); void _rm_wlock(struct rmlock *rm); void _rm_wunlock(struct rmlock *rm); -void _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker); +int _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, + int trylock); void _rm_runlock(struct rmlock *rm, struct rm_priotracker *tracker); /* @@ -74,14 +77,17 @@ void _rm_runlock(struct rmlock *rm, str #define rm_wlock(rm) _rm_wlock_debug((rm), LOCK_FILE, LOCK_LINE) #define rm_wunlock(rm) _rm_wunlock_debug((rm), LOCK_FILE, LOCK_LINE) #define rm_rlock(rm,tracker) \ - _rm_rlock_debug((rm),(tracker), LOCK_FILE, LOCK_LINE ) + ((void)_rm_rlock_debug((rm),(tracker), 0, LOCK_FILE, LOCK_LINE )) +#define rm_try_rlock(rm,tracker) \ + _rm_rlock_debug((rm),(tracker), 1, LOCK_FILE, LOCK_LINE ) #define rm_runlock(rm,tracker) \ _rm_runlock_debug((rm), (tracker), LOCK_FILE, LOCK_LINE ) #else -#define rm_wlock(rm) _rm_wlock((rm)) -#define rm_wunlock(rm) _rm_wunlock((rm)) -#define rm_rlock(rm,tracker) _rm_rlock((rm),(tracker)) -#define rm_runlock(rm,tracker) _rm_runlock((rm), (tracker)) +#define rm_wlock(rm) _rm_wlock((rm)) +#define rm_wunlock(rm) _rm_wunlock((rm)) +#define rm_rlock(rm,tracker) ((void)_rm_rlock((rm),(tracker), 0)) +#define rm_try_rlock(rm,tracker) _rm_rlock((rm),(tracker), 1) +#define rm_runlock(rm,tracker) _rm_runlock((rm), (tracker)) #endif struct rm_args { From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 19:53:16 2010 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 211B310656A3; Wed, 1 Sep 2010 19:53:16 +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 0FC288FC08; Wed, 1 Sep 2010 19:53:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81JrFww078784; Wed, 1 Sep 2010 19:53:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81JrFoZ078780; Wed, 1 Sep 2010 19:53:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009011953.o81JrFoZ078780@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 19: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: r212113 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 19:53:16 -0000 Author: yongari Date: Wed Sep 1 19:53:15 2010 New Revision: 212113 URL: http://svn.freebsd.org/changeset/base/212113 Log: s/u_intXX_t/uintXX_t/g Modified: head/sys/dev/sis/if_sis.c head/sys/dev/sis/if_sisreg.h Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 19:50:03 2010 (r212112) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 19:53:15 2010 (r212113) @@ -259,7 +259,7 @@ static void sis_eeprom_getword(struct sis_softc *sc, int addr, uint16_t *dest) { int i; - u_int16_t word = 0; + uint16_t word = 0; /* Force EEPROM to idle state. */ sis_eeprom_idle(sc); @@ -302,11 +302,11 @@ static void sis_read_eeprom(struct sis_softc *sc, caddr_t dest, int off, int cnt, int swap) { int i; - u_int16_t word = 0, *ptr; + uint16_t word = 0, *ptr; for (i = 0; i < cnt; i++) { sis_eeprom_getword(sc, off + i, &word); - ptr = (u_int16_t *)(dest + (i * 2)); + ptr = (uint16_t *)(dest + (i * 2)); if (swap) *ptr = ntohs(word); else @@ -356,7 +356,7 @@ static void sis_read_cmos(struct sis_softc *sc, device_t dev, caddr_t dest, int off, int cnt) { device_t bridge; - u_int8_t reg; + uint8_t reg; int i; bus_space_tag_t btag; @@ -384,7 +384,7 @@ sis_read_cmos(struct sis_softc *sc, devi static void sis_read_mac(struct sis_softc *sc, device_t dev, caddr_t dest) { - u_int32_t filtsave, csrsave; + uint32_t filtsave, csrsave; filtsave = CSR_READ_4(sc, SIS_RXFILT_CTL); csrsave = CSR_READ_4(sc, SIS_CSR); @@ -395,11 +395,11 @@ sis_read_mac(struct sis_softc *sc, devic CSR_WRITE_4(sc, SIS_RXFILT_CTL, filtsave & ~SIS_RXFILTCTL_ENABLE); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR0); - ((u_int16_t *)dest)[0] = CSR_READ_2(sc, SIS_RXFILT_DATA); + ((uint16_t *)dest)[0] = CSR_READ_2(sc, SIS_RXFILT_DATA); CSR_WRITE_4(sc, SIS_RXFILT_CTL,SIS_FILTADDR_PAR1); - ((u_int16_t *)dest)[1] = CSR_READ_2(sc, SIS_RXFILT_DATA); + ((uint16_t *)dest)[1] = CSR_READ_2(sc, SIS_RXFILT_DATA); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR2); - ((u_int16_t *)dest)[2] = CSR_READ_2(sc, SIS_RXFILT_DATA); + ((uint16_t *)dest)[2] = CSR_READ_2(sc, SIS_RXFILT_DATA); CSR_WRITE_4(sc, SIS_RXFILT_CTL, filtsave); CSR_WRITE_4(sc, SIS_CSR, csrsave); @@ -731,7 +731,7 @@ sis_setmulti_ns(struct sis_softc *sc) { struct ifnet *ifp; struct ifmultiaddr *ifma; - u_int32_t h = 0, i, filtsave; + uint32_t h = 0, i, filtsave; int bit, index; ifp = sc->sis_ifp; @@ -780,8 +780,8 @@ sis_setmulti_sis(struct sis_softc *sc) { struct ifnet *ifp; struct ifmultiaddr *ifma; - u_int32_t h, i, n, ctl; - u_int16_t hashes[16]; + uint32_t h, i, n, ctl; + uint16_t hashes[16]; ifp = sc->sis_ifp; @@ -963,7 +963,7 @@ sis_attach(device_t dev) * Why? Who the hell knows. */ { - u_int16_t tmp[4]; + uint16_t tmp[4]; sis_read_eeprom(sc, (caddr_t)&tmp, NS_EE_NODEADDR, 4, 0); @@ -1661,7 +1661,7 @@ sis_poll(struct ifnet *ifp, enum poll_cm sis_startl(ifp); if (sc->rxcycles > 0 || cmd == POLL_AND_CHECK_STATUS) { - u_int32_t status; + uint32_t status; /* Reading the ISR register clears all interrupts. */ status = CSR_READ_4(sc, SIS_ISR); @@ -1688,7 +1688,7 @@ sis_intr(void *arg) { struct sis_softc *sc; struct ifnet *ifp; - u_int32_t status; + uint32_t status; sc = arg; ifp = sc->sis_ifp; @@ -1926,23 +1926,23 @@ sis_initl(struct sis_softc *sc) if (sc->sis_type == SIS_TYPE_83815) { CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR0); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)IF_LLADDR(sc->sis_ifp))[0]); + ((uint16_t *)IF_LLADDR(sc->sis_ifp))[0]); CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR1); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)IF_LLADDR(sc->sis_ifp))[1]); + ((uint16_t *)IF_LLADDR(sc->sis_ifp))[1]); CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR2); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)IF_LLADDR(sc->sis_ifp))[2]); + ((uint16_t *)IF_LLADDR(sc->sis_ifp))[2]); } else { CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR0); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)IF_LLADDR(sc->sis_ifp))[0]); + ((uint16_t *)IF_LLADDR(sc->sis_ifp))[0]); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR1); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)IF_LLADDR(sc->sis_ifp))[1]); + ((uint16_t *)IF_LLADDR(sc->sis_ifp))[1]); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR2); CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((u_int16_t *)IF_LLADDR(sc->sis_ifp))[2]); + ((uint16_t *)IF_LLADDR(sc->sis_ifp))[2]); } /* Init circular TX/RX lists. */ Modified: head/sys/dev/sis/if_sisreg.h ============================================================================== --- head/sys/dev/sis/if_sisreg.h Wed Sep 1 19:50:03 2010 (r212112) +++ head/sys/dev/sis/if_sisreg.h Wed Sep 1 19:53:15 2010 (r212113) @@ -308,9 +308,9 @@ */ struct sis_desc { /* SiS hardware descriptor section */ - u_int32_t sis_next; - u_int32_t sis_cmdsts; - u_int32_t sis_ptr; + uint32_t sis_next; + uint32_t sis_cmdsts; + uint32_t sis_ptr; }; #define SIS_CMDSTS_BUFLEN 0x00000FFF @@ -403,18 +403,18 @@ struct sis_desc { #define NS_DEVICEID_DP83815 0x0020 struct sis_type { - u_int16_t sis_vid; - u_int16_t sis_did; + uint16_t sis_vid; + uint16_t sis_did; char *sis_name; }; struct sis_mii_frame { - u_int8_t mii_stdelim; - u_int8_t mii_opcode; - u_int8_t mii_phyaddr; - u_int8_t mii_regaddr; - u_int8_t mii_turnaround; - u_int16_t mii_data; + uint8_t mii_stdelim; + uint8_t mii_opcode; + uint8_t mii_phyaddr; + uint8_t mii_regaddr; + uint8_t mii_turnaround; + uint16_t mii_data; }; /* @@ -447,10 +447,10 @@ struct sis_softc { void *sis_intrhand; device_t sis_dev; device_t sis_miibus; - u_int8_t sis_type; - u_int8_t sis_rev; - u_int8_t sis_link; - u_int sis_srr; + uint8_t sis_type; + uint8_t sis_rev; + uint8_t sis_link; + uint32_t sis_srr; struct sis_desc *sis_rx_list; struct sis_desc *sis_tx_list; bus_dma_tag_t sis_rx_list_tag; From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 20:25:36 2010 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 E04A010656AB; Wed, 1 Sep 2010 20:25:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEA798FC12; Wed, 1 Sep 2010 20:25:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81KPa1W079882; Wed, 1 Sep 2010 20:25:36 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81KPahi079880; Wed, 1 Sep 2010 20:25:36 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009012025.o81KPahi079880@svn.freebsd.org> From: Ed Maste Date: Wed, 1 Sep 2010 20:25:36 +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: r212114 - stable/8/sbin/ifconfig X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 20:25:37 -0000 Author: emaste Date: Wed Sep 1 20:25:36 2010 New Revision: 212114 URL: http://svn.freebsd.org/changeset/base/212114 Log: MFC r202289: Reject invalid CIDR widths rather than silently stopping at the first non-digit character. Due to an issue with rc(8) in a test configuration, ifconfig was being invoked with the address used again as the width - for example, ifconfig vlan0 10.0.0.1/10.0.0.1 Prior to this change, that address/width would be interpreted as 10.0.0.1/10. Modified: stable/8/sbin/ifconfig/af_inet.c Directory Properties: stable/8/sbin/ifconfig/ (props changed) Modified: stable/8/sbin/ifconfig/af_inet.c ============================================================================== --- stable/8/sbin/ifconfig/af_inet.c Wed Sep 1 19:53:15 2010 (r212113) +++ stable/8/sbin/ifconfig/af_inet.c Wed Sep 1 20:25:36 2010 (r212114) @@ -37,6 +37,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -110,15 +111,18 @@ in_getaddr(const char *s, int which) char *p = NULL; if((p = strrchr(s, '/')) != NULL) { + const char *errstr; /* address is `name/masklen' */ int masklen; - int ret; struct sockaddr_in *min = sintab[MASK]; *p = '\0'; - ret = sscanf(p+1, "%u", &masklen); - if(ret != 1 || (masklen < 0 || masklen > 32)) { + if (!isdigit(*(p + 1))) + errstr = "invalid"; + else + masklen = (int)strtonum(p + 1, 0, 32, &errstr); + if (errstr != NULL) { *p = '/'; - errx(1, "%s: bad value", s); + errx(1, "%s: bad value (width %s)", s, errstr); } min->sin_len = sizeof(*min); min->sin_addr.s_addr = htonl(~((1LL << (32 - masklen)) - 1) & From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 20:32:48 2010 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 6067210656CC; Wed, 1 Sep 2010 20:32:48 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34F798FC19; Wed, 1 Sep 2010 20:32:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81KWm5m080034; Wed, 1 Sep 2010 20:32:48 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81KWmu5080032; Wed, 1 Sep 2010 20:32:48 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009012032.o81KWmu5080032@svn.freebsd.org> From: Matthew D Fleming Date: Wed, 1 Sep 2010 20:32: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: r212115 - 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, 01 Sep 2010 20:32:48 -0000 Author: mdf Date: Wed Sep 1 20:32:47 2010 New Revision: 212115 URL: http://svn.freebsd.org/changeset/base/212115 Log: Fix a bug with sched_affinity() where it checks td_pinned of another thread in a racy manner, which can lead to attempting to migrate a thread that is pinned to a CPU. Instead, have sched_switch() determine which CPU a thread should run on if the current one is not allowed. KASSERT in sched_bind() that the thread is not yet pinned to a CPU. KASSERT in sched_switch() that only migratable threads or those moving due to a sched_bind() are changing CPUs. sched_affinity code came from jhb@. MFC after: 2 weeks Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Wed Sep 1 20:25:36 2010 (r212114) +++ head/sys/kern/sched_ule.c Wed Sep 1 20:32:47 2010 (r212115) @@ -1797,10 +1797,16 @@ sched_switch(struct thread *td, struct t srqflag = (flags & SW_PREEMPT) ? SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : SRQ_OURSELF|SRQ_YIELDING; + if (THREAD_CAN_MIGRATE(td) && !THREAD_CAN_SCHED(td, ts->ts_cpu)) + ts->ts_cpu = sched_pickcpu(td, 0); if (ts->ts_cpu == cpuid) tdq_runq_add(tdq, td, srqflag); - else + else { + KASSERT(THREAD_CAN_MIGRATE(td) || + (ts->ts_flags & TSF_BOUND) != 0, + ("Thread %p shouldn't migrate", td)); mtx = sched_switch_migrate(tdq, td, srqflag); + } } else { /* This thread must be going to sleep. */ TDQ_LOCK(tdq); @@ -2383,7 +2389,6 @@ sched_affinity(struct thread *td) { #ifdef SMP struct td_sched *ts; - int cpu; THREAD_LOCK_ASSERT(td, MA_OWNED); ts = td->td_sched; @@ -2397,17 +2402,13 @@ sched_affinity(struct thread *td) if (!TD_IS_RUNNING(td)) return; td->td_flags |= TDF_NEEDRESCHED; - if (!THREAD_CAN_MIGRATE(td)) - return; /* - * Assign the new cpu and force a switch before returning to - * userspace. If the target thread is not running locally send - * an ipi to force the issue. + * Force a switch before returning to userspace. If the + * target thread is not running locally send an ipi to force + * the issue. */ - cpu = ts->ts_cpu; - ts->ts_cpu = sched_pickcpu(td, 0); - if (cpu != PCPU_GET(cpuid)) - ipi_cpu(cpu, IPI_PREEMPT); + if (td != curthread) + ipi_cpu(ts->ts_cpu, IPI_PREEMPT); #endif } @@ -2424,6 +2425,7 @@ sched_bind(struct thread *td, int cpu) ts = td->td_sched; if (ts->ts_flags & TSF_BOUND) sched_unbind(td); + KASSERT(THREAD_CAN_MIGRATE(td), ("%p must be migratable", td)); ts->ts_flags |= TSF_BOUND; sched_pin(); if (PCPU_GET(cpuid) == cpu) From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 21:31:19 2010 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 68E2F10656AD; Wed, 1 Sep 2010 21:31:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2DA3F8FC0C; Wed, 1 Sep 2010 21:31:19 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id B1B9B46B35; Wed, 1 Sep 2010 17:31:18 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DD8588A03C; Wed, 1 Sep 2010 17:31:17 -0400 (EDT) From: John Baldwin To: Matthew D Fleming Date: Wed, 1 Sep 2010 17:31:12 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009012032.o81KWmu5080032@svn.freebsd.org> In-Reply-To: <201009012032.o81KWmu5080032@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009011731.12499.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 01 Sep 2010 17:31:17 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212115 - 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, 01 Sep 2010 21:31:19 -0000 On Wednesday, September 01, 2010 4:32:48 pm Matthew D Fleming wrote: > Author: mdf > Date: Wed Sep 1 20:32:47 2010 > New Revision: 212115 > URL: http://svn.freebsd.org/changeset/base/212115 > > Log: > Fix a bug with sched_affinity() where it checks td_pinned of another > thread in a racy manner, which can lead to attempting to migrate a > thread that is pinned to a CPU. Instead, have sched_switch() determine > which CPU a thread should run on if the current one is not allowed. > > KASSERT in sched_bind() that the thread is not yet pinned to a CPU. > > KASSERT in sched_switch() that only migratable threads or those moving > due to a sched_bind() are changing CPUs. > > sched_affinity code came from jhb@. > > MFC after: 2 weeks Cool, I guess this fixed it in your tests then? -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 21:42:20 2010 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 46AE710656A4; Wed, 1 Sep 2010 21:42:20 +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 298148FC13; Wed, 1 Sep 2010 21:42:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81LgKql082259; Wed, 1 Sep 2010 21:42:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81LgKNu082256; Wed, 1 Sep 2010 21:42:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009012142.o81LgKNu082256@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 21:42: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: r212116 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 21:42:20 -0000 Author: yongari Date: Wed Sep 1 21:42:19 2010 New Revision: 212116 URL: http://svn.freebsd.org/changeset/base/212116 Log: Overhaul link state change handling. Previously sis(4) blindly configured TX/RX MACs before getting a valid link. After that, when link state change callback is called, it called device initialization again to reconfigure TX/RX MACs depending on resolved link state. This hack created several bad side effects and it required more hacks to not collide with sis_tick callback as well as disabling switching to currently selected media in device initialization. Also it seems sis(4) was used to be a template driver for long time so other drivers which was modeled after sis(4) also should be changed. TX/RX MACs are now reconfigured after getting a valid link. Fix for short cable error is also applied after getting a link because it's only valid when the resolved speed is 100Mbps. While I'm here slightly reorganize interrupt handler such that sis(4) always read SIS_ISR register to see whether the interrupt is ours or not. This change removes another hack and make it possible to nuke sis_stopped variable in softc. Modified: head/sys/dev/sis/if_sis.c head/sys/dev/sis/if_sisreg.h Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 20:32:47 2010 (r212115) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 21:42:19 2010 (r212116) @@ -697,10 +697,86 @@ static void sis_miibus_statchg(device_t dev) { struct sis_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t reg; sc = device_get_softc(dev); SIS_LOCK_ASSERT(sc); - sis_initl(sc); + + mii = device_get_softc(sc->sis_miibus); + ifp = sc->sis_ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + sc->sis_link = 0; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + sc->sis_link++; + CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_10); + break; + case IFM_100_TX: + sc->sis_link++; + CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_100); + break; + default: + break; + } + } + + if (sc->sis_link == 0) { + /* + * Stopping MACs seem to reset SIS_TX_LISTPTR and + * SIS_RX_LISTPTR which in turn requires resetting + * TX/RX buffers. So just don't do anything for + * lost link. + */ + return; + } + + /* Set full/half duplex mode. */ + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { + SIS_SETBIT(sc, SIS_TX_CFG, + (SIS_TXCFG_IGN_HBEAT | SIS_TXCFG_IGN_CARR)); + SIS_SETBIT(sc, SIS_RX_CFG, SIS_RXCFG_RX_TXPKTS); + } else { + SIS_CLRBIT(sc, SIS_TX_CFG, + (SIS_TXCFG_IGN_HBEAT | SIS_TXCFG_IGN_CARR)); + SIS_CLRBIT(sc, SIS_RX_CFG, SIS_RXCFG_RX_TXPKTS); + } + + if (sc->sis_type == SIS_TYPE_83816) { + /* + * MPII03.D: Half Duplex Excessive Collisions. + * Also page 49 in 83816 manual + */ + SIS_SETBIT(sc, SIS_TX_CFG, SIS_TXCFG_MPII03D); + } + + if (sc->sis_type == SIS_TYPE_83815 && sc->sis_srr < NS_SRR_16A && + IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX) { + /* + * Short Cable Receive Errors (MP21.E) + */ + CSR_WRITE_4(sc, NS_PHY_PAGE, 0x0001); + reg = CSR_READ_4(sc, NS_PHY_DSPCFG) & 0xfff; + CSR_WRITE_4(sc, NS_PHY_DSPCFG, reg | 0x1000); + DELAY(100); + reg = CSR_READ_4(sc, NS_PHY_TDATA) & 0xff; + if ((reg & 0x0080) == 0 || (reg > 0xd8 && reg <= 0xff)) { + device_printf(sc->sis_dev, + "Applying short cable fix (reg=%x)\n", reg); + CSR_WRITE_4(sc, NS_PHY_TDATA, 0x00e8); + SIS_SETBIT(sc, NS_PHY_DSPCFG, 0x20); + } + CSR_WRITE_4(sc, NS_PHY_PAGE, 0); + } + /* Enable TX/RX MACs. */ + SIS_CLRBIT(sc, SIS_CSR, SIS_CSR_TX_DISABLE | SIS_CSR_RX_DISABLE); + SIS_SETBIT(sc, SIS_CSR, SIS_CSR_TX_ENABLE | SIS_CSR_RX_ENABLE); } static uint32_t @@ -1613,23 +1689,14 @@ sis_tick(void *xsc) sc = xsc; SIS_LOCK_ASSERT(sc); - sc->in_tick = 1; ifp = sc->sis_ifp; mii = device_get_softc(sc->sis_miibus); mii_tick(mii); - sis_watchdog(sc); - - if (!sc->sis_link && mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - sc->sis_link++; - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - sis_startl(ifp); - } - + if (sc->sis_link == 0) + sis_miibus_statchg(sc->sis_dev); callout_reset(&sc->sis_stat_ch, hz, sis_tick, sc); - sc->in_tick = 0; } #ifdef DEVICE_POLLING @@ -1693,9 +1760,6 @@ sis_intr(void *arg) sc = arg; ifp = sc->sis_ifp; - if (sc->sis_stopped) /* Most likely shared interrupt */ - return; - SIS_LOCK(sc); #ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) { @@ -1704,17 +1768,17 @@ sis_intr(void *arg) } #endif + /* Reading the ISR register clears all interrupts. */ + status = CSR_READ_4(sc, SIS_ISR); + if ((status & SIS_INTRS) == 0) { + /* Not ours. */ + SIS_UNLOCK(sc); + } + /* Disable interrupts. */ CSR_WRITE_4(sc, SIS_IER, 0); - for (;;) { - SIS_LOCK_ASSERT(sc); - /* Reading the ISR register clears all interrupts. */ - status = CSR_READ_4(sc, SIS_ISR); - - if ((status & SIS_INTRS) == 0) - break; - + for (;(status & SIS_INTRS) != 0;) { if (status & (SIS_ISR_TX_DESC_OK | SIS_ISR_TX_ERR | SIS_ISR_TX_OK | SIS_ISR_TX_IDLE) ) @@ -1733,7 +1797,10 @@ sis_intr(void *arg) if (status & SIS_ISR_SYSERR) { sis_reset(sc); sis_initl(sc); + SIS_UNLOCK(sc); + return; } + status = CSR_READ_4(sc, SIS_ISR); } /* Re-enable interrupts. */ @@ -1908,7 +1975,6 @@ sis_initl(struct sis_softc *sc) * Cancel pending I/O and free all RX/TX buffers. */ sis_stop(sc); - sc->sis_stopped = 0; #ifdef notyet if (sc->sis_type == SIS_TYPE_83815 && sc->sis_srr >= NS_SRR_16A) { @@ -1972,7 +2038,6 @@ sis_initl(struct sis_softc *sc) CSR_WRITE_4(sc, NS_PHY_PAGE, 0); } - /* * For the NatSemi chip, we have to explicitly enable the * reception of ARP frames, as well as turn on the 'perfect @@ -2030,52 +2095,11 @@ sis_initl(struct sis_softc *sc) /* Accept Long Packets for VLAN support */ SIS_SETBIT(sc, SIS_RX_CFG, SIS_RXCFG_RX_JABBER); - /* Set TX configuration */ - if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) { - CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_10); - } else { - CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_100); - } - - /* Set full/half duplex mode. */ - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) { - SIS_SETBIT(sc, SIS_TX_CFG, - (SIS_TXCFG_IGN_HBEAT|SIS_TXCFG_IGN_CARR)); - SIS_SETBIT(sc, SIS_RX_CFG, SIS_RXCFG_RX_TXPKTS); - } else { - SIS_CLRBIT(sc, SIS_TX_CFG, - (SIS_TXCFG_IGN_HBEAT|SIS_TXCFG_IGN_CARR)); - SIS_CLRBIT(sc, SIS_RX_CFG, SIS_RXCFG_RX_TXPKTS); - } - - if (sc->sis_type == SIS_TYPE_83816) { - /* - * MPII03.D: Half Duplex Excessive Collisions. - * Also page 49 in 83816 manual - */ - SIS_SETBIT(sc, SIS_TX_CFG, SIS_TXCFG_MPII03D); - } - - if (sc->sis_type == SIS_TYPE_83815 && sc->sis_srr < NS_SRR_16A && - IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX) { - uint32_t reg; - - /* - * Short Cable Receive Errors (MP21.E) - */ - CSR_WRITE_4(sc, NS_PHY_PAGE, 0x0001); - reg = CSR_READ_4(sc, NS_PHY_DSPCFG) & 0xfff; - CSR_WRITE_4(sc, NS_PHY_DSPCFG, reg | 0x1000); - DELAY(100); - reg = CSR_READ_4(sc, NS_PHY_TDATA) & 0xff; - if ((reg & 0x0080) == 0 || (reg > 0xd8 && reg <= 0xff)) { - device_printf(sc->sis_dev, - "Applying short cable fix (reg=%x)\n", reg); - CSR_WRITE_4(sc, NS_PHY_TDATA, 0x00e8); - SIS_SETBIT(sc, NS_PHY_DSPCFG, 0x20); - } - CSR_WRITE_4(sc, NS_PHY_PAGE, 0); - } + /* + * Assume 100Mbps link, actual MAC configuration is done + * after getting a valid link. + */ + CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_100); /* * Enable interrupts. @@ -2092,19 +2116,16 @@ sis_initl(struct sis_softc *sc) #endif CSR_WRITE_4(sc, SIS_IER, 1); - /* Enable receiver and transmitter. */ - SIS_CLRBIT(sc, SIS_CSR, SIS_CSR_TX_DISABLE|SIS_CSR_RX_DISABLE); - SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE); + /* Clear MAC disable. */ + SIS_CLRBIT(sc, SIS_CSR, SIS_CSR_TX_DISABLE | SIS_CSR_RX_DISABLE); -#ifdef notdef + sc->sis_link = 0; mii_mediachg(mii); -#endif ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - if (!sc->in_tick) - callout_reset(&sc->sis_stat_ch, hz, sis_tick, sc); + callout_reset(&sc->sis_stat_ch, hz, sis_tick, sc); } /* @@ -2226,10 +2247,6 @@ sis_watchdog(struct sis_softc *sc) { SIS_LOCK_ASSERT(sc); - if (sc->sis_stopped) { - SIS_UNLOCK(sc); - return; - } if (sc->sis_watchdog_timer == 0 || --sc->sis_watchdog_timer >0) return; @@ -2257,9 +2274,8 @@ sis_stop(struct sis_softc *sc) struct sis_txdesc *txd; int i; - if (sc->sis_stopped) - return; SIS_LOCK_ASSERT(sc); + ifp = sc->sis_ifp; sc->sis_watchdog_timer = 0; @@ -2303,8 +2319,6 @@ sis_stop(struct sis_softc *sc) txd->tx_m = NULL; } } - - sc->sis_stopped = 1; } /* Modified: head/sys/dev/sis/if_sisreg.h ============================================================================== --- head/sys/dev/sis/if_sisreg.h Wed Sep 1 20:32:47 2010 (r212115) +++ head/sys/dev/sis/if_sisreg.h Wed Sep 1 21:42:19 2010 (r212116) @@ -471,11 +471,9 @@ struct sis_softc { bus_addr_t sis_tx_paddr; struct callout sis_stat_ch; int sis_watchdog_timer; - int sis_stopped; #ifdef DEVICE_POLLING int rxcycles; #endif - int in_tick; struct mtx sis_mtx; }; From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 21:44:36 2010 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 AF99F10656A5; Wed, 1 Sep 2010 21:44:36 +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 9E1318FC12; Wed, 1 Sep 2010 21:44:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81LiaJi082499; Wed, 1 Sep 2010 21:44:36 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81Liad1082497; Wed, 1 Sep 2010 21:44:36 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009012144.o81Liad1082497@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 21:44:36 +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: r212117 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 21:44:36 -0000 Author: yongari Date: Wed Sep 1 21:44:36 2010 New Revision: 212117 URL: http://svn.freebsd.org/changeset/base/212117 Log: Report result of link state change to caller. Previously it always returned success. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 21:42:19 2010 (r212116) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 21:44:36 2010 (r212117) @@ -2136,6 +2136,7 @@ sis_ifmedia_upd(struct ifnet *ifp) { struct sis_softc *sc; struct mii_data *mii; + int error; sc = ifp->if_softc; @@ -2147,10 +2148,10 @@ sis_ifmedia_upd(struct ifnet *ifp) LIST_FOREACH(miisc, &mii->mii_phys, mii_list) mii_phy_reset(miisc); } - mii_mediachg(mii); + error = mii_mediachg(mii); SIS_UNLOCK(sc); - return (0); + return (error); } /* From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 21:51:29 2010 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 AD44610656BE; Wed, 1 Sep 2010 21:51:29 +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 9A89D8FC15; Wed, 1 Sep 2010 21:51:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81LpT1a082731; Wed, 1 Sep 2010 21:51:29 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81LpT3L082728; Wed, 1 Sep 2010 21:51:29 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009012151.o81LpT3L082728@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 1 Sep 2010 21:51:29 +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: r212118 - in stable/7: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 21:51:29 -0000 Author: jilles Date: Wed Sep 1 21:51:29 2010 New Revision: 212118 URL: http://svn.freebsd.org/changeset/base/212118 Log: MFC r211155: sh: Fix heap-based buffer overflow in pathname generation. The buffer for generated pathnames could be too small in some cases. It happened to be always at least PATH_MAX long, so there was never an overflow if the resulting pathnames would be usable. This bug may be abused if a script subjects input from an untrusted source to pathname generation, which a bad idea anyhow. Most shell scripts do not work on untrusted data. secteam@ says no advisory is necessary. PR: bin/148733 Reported by: Changming Sun snnn119 at gmail com Added: stable/7/tools/regression/bin/sh/expansion/pathname3.0 - copied unchanged from r211155, head/tools/regression/bin/sh/expansion/pathname3.0 Modified: stable/7/bin/sh/expand.c Directory Properties: stable/7/bin/sh/ (props changed) stable/7/tools/regression/bin/sh/ (props changed) Modified: stable/7/bin/sh/expand.c ============================================================================== --- stable/7/bin/sh/expand.c Wed Sep 1 21:44:36 2010 (r212117) +++ stable/7/bin/sh/expand.c Wed Sep 1 21:51:29 2010 (r212118) @@ -1054,8 +1054,8 @@ ifsbreakup(char *string, struct arglist * should be escapes. The results are stored in the list exparg. */ -STATIC char *expdir; - +STATIC char expdir[PATH_MAX]; +#define expdir_end (expdir + sizeof(expdir)) STATIC void expandmeta(struct strlist *str, int flag __unused) @@ -1078,14 +1078,7 @@ expandmeta(struct strlist *str, int flag } savelastp = exparg.lastp; INTOFF; - if (expdir == NULL) { - int i = strlen(str->text); - expdir = ckmalloc(i < 2048 ? 2048 : i); /* XXX */ - } - expmeta(expdir, str->text); - ckfree(expdir); - expdir = NULL; INTON; if (exparg.lastp == savelastp) { /* @@ -1174,6 +1167,8 @@ expmeta(char *enddir, char *name) *enddir++ = *p; if (*p == '\0') break; + if (enddir == expdir_end) + return; } if (metaflag == 0 || lstat(expdir, &statb) >= 0) addfname(expdir); @@ -1188,6 +1183,8 @@ expmeta(char *enddir, char *name) if (*p == CTLESC) p++; *enddir++ = *p++; + if (enddir == expdir_end) + return; } } if (enddir == expdir) { @@ -1221,15 +1218,17 @@ expmeta(char *enddir, char *name) if (dp->d_name[0] == '.' && ! matchdot) continue; if (patmatch(start, dp->d_name, 0)) { - if (atend) { - scopy(dp->d_name, enddir); + if (enddir + dp->d_namlen + 1 > expdir_end) + continue; + memcpy(enddir, dp->d_name, dp->d_namlen + 1); + if (atend) addfname(expdir); - } else { - for (p = enddir, q = dp->d_name; - (*p++ = *q++) != '\0';) + else { + if (enddir + dp->d_namlen + 2 > expdir_end) continue; - p[-1] = '/'; - expmeta(p, endname); + enddir[dp->d_namlen] = '/'; + enddir[dp->d_namlen + 1] = '\0'; + expmeta(enddir + dp->d_namlen + 1, endname); } } } Copied: stable/7/tools/regression/bin/sh/expansion/pathname3.0 (from r211155, head/tools/regression/bin/sh/expansion/pathname3.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/tools/regression/bin/sh/expansion/pathname3.0 Wed Sep 1 21:51:29 2010 (r212118, copy of r211155, head/tools/regression/bin/sh/expansion/pathname3.0) @@ -0,0 +1,29 @@ +# $FreeBSD$ + +v=12345678 +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +v=$v$v$v$v +# 8192 bytes +v=${v##???} +[ /*/$v = "/*/$v" ] || exit 1 + +s=//// +s=$s$s$s$s +s=$s$s$s$s +s=$s$s$s$s +s=$s$s$s$s +# 1024 bytes +s=${s##??????????} +[ /var/empt[y]/$s/$v = "/var/empt[y]/$s/$v" ] || exit 2 +while [ ${#s} -lt 1034 ]; do + set -- /.${s}et[c] + [ ${#s} -gt 1018 ] || [ "$1" = /.${s}etc ] || exit 3 + set -- /.${s}et[c]/ + [ ${#s} -gt 1017 ] || [ "$1" = /.${s}etc/ ] || exit 4 + set -- /.${s}et[c]/. + [ ${#s} -gt 1016 ] || [ "$1" = /.${s}etc/. ] || exit 5 + s=$s/ +done From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 22:08:24 2010 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 198DF10656BD; Wed, 1 Sep 2010 22:08:24 +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 085038FC12; Wed, 1 Sep 2010 22:08:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81M8N5B083140; Wed, 1 Sep 2010 22:08:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81M8NAP083137; Wed, 1 Sep 2010 22:08:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009012208.o81M8NAP083137@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 22:08: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: r212119 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 22:08:24 -0000 Author: yongari Date: Wed Sep 1 22:08:23 2010 New Revision: 212119 URL: http://svn.freebsd.org/changeset/base/212119 Log: Do not reinitialize controller whenever promiscuous mode or allmulti is toggled. Controller does not require reinitialization. This removes unnecessary controller reinitialization whenever tcpdump is used. While I'm here remove unnecessary variable reinitialization. Modified: head/sys/dev/sis/if_sis.c head/sys/dev/sis/if_sisreg.h Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 21:51:29 2010 (r212118) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 22:08:23 2010 (r212119) @@ -2185,10 +2185,19 @@ sis_ioctl(struct ifnet *ifp, u_long comm case SIOCSIFFLAGS: SIS_LOCK(sc); if (ifp->if_flags & IFF_UP) { - sis_initl(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && + ((ifp->if_flags ^ sc->sis_if_flags) & + (IFF_PROMISC | IFF_ALLMULTI)) != 0) { + if (sc->sis_type == SIS_TYPE_83815) + sis_setmulti_ns(sc); + else + sis_setmulti_sis(sc); + } else + sis_initl(sc); } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { sis_stop(sc); } + sc->sis_if_flags = ifp->if_flags; SIS_UNLOCK(sc); error = 0; break; @@ -2200,7 +2209,6 @@ sis_ioctl(struct ifnet *ifp, u_long comm else sis_setmulti_sis(sc); SIS_UNLOCK(sc); - error = 0; break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: Modified: head/sys/dev/sis/if_sisreg.h ============================================================================== --- head/sys/dev/sis/if_sisreg.h Wed Sep 1 21:51:29 2010 (r212118) +++ head/sys/dev/sis/if_sisreg.h Wed Sep 1 22:08:23 2010 (r212119) @@ -471,6 +471,7 @@ struct sis_softc { bus_addr_t sis_tx_paddr; struct callout sis_stat_ch; int sis_watchdog_timer; + int sis_if_flags; #ifdef DEVICE_POLLING int rxcycles; #endif From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 22:16:26 2010 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 0699410656B1; Wed, 1 Sep 2010 22:16:26 +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 E9DBE8FC16; Wed, 1 Sep 2010 22:16:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81MGPEQ083335; Wed, 1 Sep 2010 22:16:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81MGPYq083333; Wed, 1 Sep 2010 22:16:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009012216.o81MGPYq083333@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 22:16: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: r212120 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 22:16:26 -0000 Author: yongari Date: Wed Sep 1 22:16:25 2010 New Revision: 212120 URL: http://svn.freebsd.org/changeset/base/212120 Log: Avoid controller reinitialization which could be triggered by dhclient(8) or alias addresses are added. PR: kern/87506 Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 22:08:23 2010 (r212119) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 22:16:25 2010 (r212120) @@ -1741,6 +1741,7 @@ sis_poll(struct ifnet *ifp, enum poll_cm if (status & SIS_ISR_SYSERR) { sis_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sis_initl(sc); } } @@ -1796,6 +1797,7 @@ sis_intr(void *arg) if (status & SIS_ISR_SYSERR) { sis_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sis_initl(sc); SIS_UNLOCK(sc); return; @@ -1971,6 +1973,9 @@ sis_initl(struct sis_softc *sc) SIS_LOCK_ASSERT(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + /* * Cancel pending I/O and free all RX/TX buffers. */ From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 22:17:07 2010 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 8477610656B1; Wed, 1 Sep 2010 22:17:07 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 93AD88FC21; Wed, 1 Sep 2010 22:17:06 +0000 (UTC) Received: by ewy4 with SMTP id 4so5182436ewy.13 for ; Wed, 01 Sep 2010 15:17:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=xEps3BITXlBjOde8sDnD2So3Uc+ee5hKmN9YJ66YYVU=; b=ayn8OQs4xllm9I069F+7UFq4uv3teH7ErP8afgglju/cgctmWyVGteE+hblY4DSqf+ 2fc8qzPo5TOaUwHnMqB1GSC31nF7VHQaKi3dQfc5MmZjL86uXLwoO1rqxKyZz08rvSsQ GvhepwlbzhrgYXxpf+vBWBViDwQW8woE5JEHo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=sGAS4erfIE4ITYTwnAEDvSSDhjGbCfuXqHTxeJB2Eb6EG+ds28w5cLb5tASjnV8ib6 lkw/65O9MRAvvinjNcxDz54vTobs3MIdjHMaXv0AYD5TbzbYrf+jk7pCTFCDGyESCZnt nmnnySxBZRY+EwHNieONhKt/lxCjJN/tdwjvY= MIME-Version: 1.0 Received: by 10.213.7.7 with SMTP id b7mr12249961ebb.30.1283379425574; Wed, 01 Sep 2010 15:17:05 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.213.30.13 with HTTP; Wed, 1 Sep 2010 15:17:05 -0700 (PDT) In-Reply-To: <201009011731.12499.jhb@freebsd.org> References: <201009012032.o81KWmu5080032@svn.freebsd.org> <201009011731.12499.jhb@freebsd.org> Date: Wed, 1 Sep 2010 15:17:05 -0700 X-Google-Sender-Auth: wezK0s7SCA02Q2aXLLPPdg4EJjI Message-ID: From: mdf@FreeBSD.org To: John Baldwin 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: r212115 - 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, 01 Sep 2010 22:17:07 -0000 On Wed, Sep 1, 2010 at 2:31 PM, John Baldwin wrote: > On Wednesday, September 01, 2010 4:32:48 pm Matthew D Fleming wrote: >> Author: mdf >> Date: Wed Sep =A01 20:32:47 2010 >> New Revision: 212115 >> URL: http://svn.freebsd.org/changeset/base/212115 >> >> Log: >> =A0 Fix a bug with sched_affinity() where it checks td_pinned of another >> =A0 thread in a racy manner, which can lead to attempting to migrate a >> =A0 thread that is pinned to a CPU. =A0Instead, have sched_switch() dete= rmine >> =A0 which CPU a thread should run on if the current one is not allowed. >> >> =A0 KASSERT in sched_bind() that the thread is not yet pinned to a CPU. >> >> =A0 KASSERT in sched_switch() that only migratable threads or those movi= ng >> =A0 due to a sched_bind() are changing CPUs. >> >> =A0 sched_affinity code came from jhb@. >> >> =A0 MFC after: =A02 weeks > > Cool, I guess this fixed it in your tests then? Yes, the stress case I pointed out in the earlier thread ran for quite a few minutes before I killed it. Previously it would crash (with the added assert) in a few seconds. Thanks, matthew From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 22:50:11 2010 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 A876B1065695; Wed, 1 Sep 2010 22:50:11 +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 9767D8FC08; Wed, 1 Sep 2010 22:50:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81MoBsf084093; Wed, 1 Sep 2010 22:50:11 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81MoBHT084091; Wed, 1 Sep 2010 22:50:11 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009012250.o81MoBHT084091@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 1 Sep 2010 22:50: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: r212121 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 22:50:11 -0000 Author: yongari Date: Wed Sep 1 22:50:11 2010 New Revision: 212121 URL: http://svn.freebsd.org/changeset/base/212121 Log: Move sis_reset() to sis_initl(). This ensures driver starts with known good state of controller. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 22:16:25 2010 (r212120) +++ head/sys/dev/sis/if_sis.c Wed Sep 1 22:50:11 2010 (r212121) @@ -1205,7 +1205,6 @@ sis_detach(device_t dev) /* These should only be active if attach succeeded. */ if (device_is_attached(dev)) { SIS_LOCK(sc); - sis_reset(sc); sis_stop(sc); SIS_UNLOCK(sc); callout_drain(&sc->sis_stat_ch); @@ -1740,7 +1739,6 @@ sis_poll(struct ifnet *ifp, enum poll_cm SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE); if (status & SIS_ISR_SYSERR) { - sis_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sis_initl(sc); } @@ -1796,7 +1794,6 @@ sis_intr(void *arg) SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE); if (status & SIS_ISR_SYSERR) { - sis_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sis_initl(sc); SIS_UNLOCK(sc); @@ -1980,7 +1977,10 @@ sis_initl(struct sis_softc *sc) * Cancel pending I/O and free all RX/TX buffers. */ sis_stop(sc); - + /* + * Reset the chip to a known state. + */ + sis_reset(sc); #ifdef notyet if (sc->sis_type == SIS_TYPE_83815 && sc->sis_srr >= NS_SRR_16A) { /* @@ -2268,8 +2268,7 @@ sis_watchdog(struct sis_softc *sc) device_printf(sc->sis_dev, "watchdog timeout\n"); sc->sis_ifp->if_oerrors++; - sis_stop(sc); - sis_reset(sc); + sc->sis_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; sis_initl(sc); if (!IFQ_DRV_IS_EMPTY(&sc->sis_ifp->if_snd)) @@ -2346,7 +2345,6 @@ sis_shutdown(device_t dev) sc = device_get_softc(dev); SIS_LOCK(sc); - sis_reset(sc); sis_stop(sc); SIS_UNLOCK(sc); return (0); From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 23:47:54 2010 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 29A3F10656B7; Wed, 1 Sep 2010 23:47:54 +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 15D2E8FC13; Wed, 1 Sep 2010 23:47:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81NlsEm085247; Wed, 1 Sep 2010 23:47:54 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81NlrGP085208; Wed, 1 Sep 2010 23:47:53 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009012347.o81NlrGP085208@svn.freebsd.org> From: Andrew Thompson Date: Wed, 1 Sep 2010 23:47: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: r212122 - in head/sys/dev: if_ndis usb usb/input usb/misc usb/net usb/serial usb/storage 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: Wed, 01 Sep 2010 23:47:54 -0000 Author: thompsa Date: Wed Sep 1 23:47:53 2010 New Revision: 212122 URL: http://svn.freebsd.org/changeset/base/212122 Log: Add missing MODULE_VERSION() definitions, this resolves problems around duplicate module loads. PR: usb/125736 Submitted by: danger, mm Reviewed by: hselasky Modified: head/sys/dev/if_ndis/if_ndis_usb.c head/sys/dev/usb/input/atp.c head/sys/dev/usb/input/uep.c head/sys/dev/usb/input/uhid.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/input/ums.c head/sys/dev/usb/misc/udbp.c head/sys/dev/usb/misc/ufm.c head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_cue.c head/sys/dev/usb/net/if_kue.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/ulpt.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/storage/umass.c head/sys/dev/usb/storage/urio.c head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/if_ndis/if_ndis_usb.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_usb.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/if_ndis/if_ndis_usb.c Wed Sep 1 23:47:53 2010 (r212122) @@ -107,6 +107,7 @@ static driver_t ndis_driver = { static devclass_t ndis_devclass; DRIVER_MODULE(ndis, uhub, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); +MODULE_VERSION(ndis, 1); static int ndisusb_devcompare(interface_type bustype, struct ndis_usb_type *t, device_t dev) Modified: head/sys/dev/usb/input/atp.c ============================================================================== --- head/sys/dev/usb/input/atp.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/input/atp.c Wed Sep 1 23:47:53 2010 (r212122) @@ -2222,3 +2222,4 @@ static devclass_t atp_devclass; DRIVER_MODULE(atp, uhub, atp_driver, atp_devclass, NULL, 0); MODULE_DEPEND(atp, usb, 1, 1, 1); +MODULE_VERSION(atp, 1); Modified: head/sys/dev/usb/input/uep.c ============================================================================== --- head/sys/dev/usb/input/uep.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/input/uep.c Wed Sep 1 23:47:53 2010 (r212122) @@ -439,3 +439,4 @@ static driver_t uep_driver = { DRIVER_MODULE(uep, uhub, uep_driver, uep_devclass, NULL, NULL); MODULE_DEPEND(uep, usb, 1, 1, 1); +MODULE_VERSION(uep, 1); Modified: head/sys/dev/usb/input/uhid.c ============================================================================== --- head/sys/dev/usb/input/uhid.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/input/uhid.c Wed Sep 1 23:47:53 2010 (r212122) @@ -801,3 +801,4 @@ static driver_t uhid_driver = { DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, NULL, 0); MODULE_DEPEND(uhid, usb, 1, 1, 1); +MODULE_VERSION(uhid, 1); Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/input/ukbd.c Wed Sep 1 23:47:53 2010 (r212122) @@ -1887,3 +1887,4 @@ static driver_t ukbd_driver = { DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, ukbd_driver_load, 0); MODULE_DEPEND(ukbd, usb, 1, 1, 1); +MODULE_VERSION(ukbd, 1); Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/input/ums.c Wed Sep 1 23:47:53 2010 (r212122) @@ -1010,3 +1010,4 @@ static driver_t ums_driver = { DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, NULL, 0); MODULE_DEPEND(ums, usb, 1, 1, 1); +MODULE_VERSION(ums, 1); Modified: head/sys/dev/usb/misc/udbp.c ============================================================================== --- head/sys/dev/usb/misc/udbp.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/misc/udbp.c Wed Sep 1 23:47:53 2010 (r212122) @@ -261,6 +261,7 @@ static driver_t udbp_driver = { DRIVER_MODULE(udbp, uhub, udbp_driver, udbp_devclass, udbp_modload, 0); MODULE_DEPEND(udbp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION); MODULE_DEPEND(udbp, usb, 1, 1, 1); +MODULE_VERSION(udbp, 1); static int udbp_modload(module_t mod, int event, void *data) Modified: head/sys/dev/usb/misc/ufm.c ============================================================================== --- head/sys/dev/usb/misc/ufm.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/misc/ufm.c Wed Sep 1 23:47:53 2010 (r212122) @@ -117,6 +117,7 @@ static driver_t ufm_driver = { DRIVER_MODULE(ufm, uhub, ufm_driver, ufm_devclass, NULL, 0); MODULE_DEPEND(ufm, usb, 1, 1, 1); +MODULE_VERSION(ufm, 1); static int ufm_probe(device_t dev) Modified: head/sys/dev/usb/net/if_aue.c ============================================================================== --- head/sys/dev/usb/net/if_aue.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/net/if_aue.c Wed Sep 1 23:47:53 2010 (r212122) @@ -281,6 +281,7 @@ MODULE_DEPEND(aue, uether, 1, 1, 1); MODULE_DEPEND(aue, usb, 1, 1, 1); MODULE_DEPEND(aue, ether, 1, 1, 1); MODULE_DEPEND(aue, miibus, 1, 1, 1); +MODULE_VERSION(aue, 1); static const struct usb_ether_methods aue_ue_methods = { .ue_attach_post = aue_attach_post, Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/net/if_axe.c Wed Sep 1 23:47:53 2010 (r212122) @@ -256,6 +256,7 @@ MODULE_DEPEND(axe, uether, 1, 1, 1); MODULE_DEPEND(axe, usb, 1, 1, 1); MODULE_DEPEND(axe, ether, 1, 1, 1); MODULE_DEPEND(axe, miibus, 1, 1, 1); +MODULE_VERSION(axe, 1); static const struct usb_ether_methods axe_ue_methods = { .ue_attach_post = axe_attach_post, Modified: head/sys/dev/usb/net/if_cue.c ============================================================================== --- head/sys/dev/usb/net/if_cue.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/net/if_cue.c Wed Sep 1 23:47:53 2010 (r212122) @@ -173,6 +173,7 @@ DRIVER_MODULE(cue, uhub, cue_driver, cue MODULE_DEPEND(cue, uether, 1, 1, 1); MODULE_DEPEND(cue, usb, 1, 1, 1); MODULE_DEPEND(cue, ether, 1, 1, 1); +MODULE_VERSION(cue, 1); static const struct usb_ether_methods cue_ue_methods = { .ue_attach_post = cue_attach_post, Modified: head/sys/dev/usb/net/if_kue.c ============================================================================== --- head/sys/dev/usb/net/if_kue.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/net/if_kue.c Wed Sep 1 23:47:53 2010 (r212122) @@ -215,6 +215,7 @@ DRIVER_MODULE(kue, uhub, kue_driver, kue MODULE_DEPEND(kue, uether, 1, 1, 1); MODULE_DEPEND(kue, usb, 1, 1, 1); MODULE_DEPEND(kue, ether, 1, 1, 1); +MODULE_VERSION(kue, 1); static const struct usb_ether_methods kue_ue_methods = { .ue_attach_post = kue_attach_post, Modified: head/sys/dev/usb/net/if_rue.c ============================================================================== --- head/sys/dev/usb/net/if_rue.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/net/if_rue.c Wed Sep 1 23:47:53 2010 (r212122) @@ -213,6 +213,7 @@ MODULE_DEPEND(rue, uether, 1, 1, 1); MODULE_DEPEND(rue, usb, 1, 1, 1); MODULE_DEPEND(rue, ether, 1, 1, 1); MODULE_DEPEND(rue, miibus, 1, 1, 1); +MODULE_VERSION(rue, 1); static const struct usb_ether_methods rue_ue_methods = { .ue_attach_post = rue_attach_post, Modified: head/sys/dev/usb/net/if_udav.c ============================================================================== --- head/sys/dev/usb/net/if_udav.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/net/if_udav.c Wed Sep 1 23:47:53 2010 (r212122) @@ -172,6 +172,7 @@ MODULE_DEPEND(udav, uether, 1, 1, 1); MODULE_DEPEND(udav, usb, 1, 1, 1); MODULE_DEPEND(udav, ether, 1, 1, 1); MODULE_DEPEND(udav, miibus, 1, 1, 1); +MODULE_VERSION(udav, 1); static const struct usb_ether_methods udav_ue_methods = { .ue_attach_post = udav_attach_post, Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/u3g.c Wed Sep 1 23:47:53 2010 (r212122) @@ -178,6 +178,7 @@ static driver_t u3g_driver = { DRIVER_MODULE(u3g, uhub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0); MODULE_DEPEND(u3g, ucom, 1, 1, 1); MODULE_DEPEND(u3g, usb, 1, 1, 1); +MODULE_VERSION(u3g, 1); static const struct usb_device_id u3g_devs[] = { #define U3G_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } Modified: head/sys/dev/usb/serial/uark.c ============================================================================== --- head/sys/dev/usb/serial/uark.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/uark.c Wed Sep 1 23:47:53 2010 (r212122) @@ -169,6 +169,7 @@ static driver_t uark_driver = { DRIVER_MODULE(uark, uhub, uark_driver, uark_devclass, NULL, 0); MODULE_DEPEND(uark, ucom, 1, 1, 1); MODULE_DEPEND(uark, usb, 1, 1, 1); +MODULE_VERSION(uark, 1); static const struct usb_device_id uark_devs[] = { {USB_VPI(USB_VENDOR_ARKMICRO, USB_PRODUCT_ARKMICRO_ARK3116, 0)}, Modified: head/sys/dev/usb/serial/ubsa.c ============================================================================== --- head/sys/dev/usb/serial/ubsa.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/ubsa.c Wed Sep 1 23:47:53 2010 (r212122) @@ -277,6 +277,7 @@ static driver_t ubsa_driver = { DRIVER_MODULE(ubsa, uhub, ubsa_driver, ubsa_devclass, NULL, 0); MODULE_DEPEND(ubsa, ucom, 1, 1, 1); MODULE_DEPEND(ubsa, usb, 1, 1, 1); +MODULE_VERSION(ubsa, 1); static int ubsa_probe(device_t dev) Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/ubser.c Wed Sep 1 23:47:53 2010 (r212122) @@ -215,6 +215,7 @@ static driver_t ubser_driver = { DRIVER_MODULE(ubser, uhub, ubser_driver, ubser_devclass, NULL, 0); MODULE_DEPEND(ubser, ucom, 1, 1, 1); MODULE_DEPEND(ubser, usb, 1, 1, 1); +MODULE_VERSION(ubser, 1); static int ubser_probe(device_t dev) Modified: head/sys/dev/usb/serial/uchcom.c ============================================================================== --- head/sys/dev/usb/serial/uchcom.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/uchcom.c Wed Sep 1 23:47:53 2010 (r212122) @@ -855,3 +855,4 @@ static devclass_t uchcom_devclass; DRIVER_MODULE(uchcom, uhub, uchcom_driver, uchcom_devclass, NULL, 0); MODULE_DEPEND(uchcom, ucom, 1, 1, 1); MODULE_DEPEND(uchcom, usb, 1, 1, 1); +MODULE_VERSION(uchcom, 1); Modified: head/sys/dev/usb/serial/ucycom.c ============================================================================== --- head/sys/dev/usb/serial/ucycom.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/ucycom.c Wed Sep 1 23:47:53 2010 (r212122) @@ -176,6 +176,7 @@ static driver_t ucycom_driver = { DRIVER_MODULE(ucycom, uhub, ucycom_driver, ucycom_devclass, NULL, 0); MODULE_DEPEND(ucycom, ucom, 1, 1, 1); MODULE_DEPEND(ucycom, usb, 1, 1, 1); +MODULE_VERSION(ucycom, 1); /* * Supported devices Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/ufoma.c Wed Sep 1 23:47:53 2010 (r212122) @@ -326,6 +326,7 @@ static driver_t ufoma_driver = { DRIVER_MODULE(ufoma, uhub, ufoma_driver, ufoma_devclass, NULL, 0); MODULE_DEPEND(ufoma, ucom, 1, 1, 1); MODULE_DEPEND(ufoma, usb, 1, 1, 1); +MODULE_VERSION(ufoma, 1); static int ufoma_probe(device_t dev) Modified: head/sys/dev/usb/serial/uftdi.c ============================================================================== --- head/sys/dev/usb/serial/uftdi.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/uftdi.c Wed Sep 1 23:47:53 2010 (r212122) @@ -205,6 +205,7 @@ static driver_t uftdi_driver = { DRIVER_MODULE(uftdi, uhub, uftdi_driver, uftdi_devclass, NULL, 0); MODULE_DEPEND(uftdi, ucom, 1, 1, 1); MODULE_DEPEND(uftdi, usb, 1, 1, 1); +MODULE_VERSION(uftdi, 1); static struct usb_device_id uftdi_devs[] = { #define UFTDI_DEV(v,p,t) \ Modified: head/sys/dev/usb/serial/ugensa.c ============================================================================== --- head/sys/dev/usb/serial/ugensa.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/ugensa.c Wed Sep 1 23:47:53 2010 (r212122) @@ -153,6 +153,7 @@ static driver_t ugensa_driver = { DRIVER_MODULE(ugensa, uhub, ugensa_driver, ugensa_devclass, NULL, 0); MODULE_DEPEND(ugensa, ucom, 1, 1, 1); MODULE_DEPEND(ugensa, usb, 1, 1, 1); +MODULE_VERSION(ugensa, 1); static const struct usb_device_id ugensa_devs[] = { {USB_VPI(USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220, 0)}, Modified: head/sys/dev/usb/serial/uipaq.c ============================================================================== --- head/sys/dev/usb/serial/uipaq.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/uipaq.c Wed Sep 1 23:47:53 2010 (r212122) @@ -1085,6 +1085,7 @@ static driver_t uipaq_driver = { DRIVER_MODULE(uipaq, uhub, uipaq_driver, uipaq_devclass, NULL, 0); MODULE_DEPEND(uipaq, ucom, 1, 1, 1); MODULE_DEPEND(uipaq, usb, 1, 1, 1); +MODULE_VERSION(uipaq, 1); static int uipaq_probe(device_t dev) Modified: head/sys/dev/usb/serial/ulpt.c ============================================================================== --- head/sys/dev/usb/serial/ulpt.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/ulpt.c Wed Sep 1 23:47:53 2010 (r212122) @@ -745,3 +745,4 @@ static driver_t ulpt_driver = { DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, NULL, 0); MODULE_DEPEND(ulpt, usb, 1, 1, 1); MODULE_DEPEND(ulpt, ucom, 1, 1, 1); +MODULE_VERSION(ulpt, 1); Modified: head/sys/dev/usb/serial/umct.c ============================================================================== --- head/sys/dev/usb/serial/umct.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/umct.c Wed Sep 1 23:47:53 2010 (r212122) @@ -219,6 +219,7 @@ static driver_t umct_driver = { DRIVER_MODULE(umct, uhub, umct_driver, umct_devclass, NULL, 0); MODULE_DEPEND(umct, ucom, 1, 1, 1); MODULE_DEPEND(umct, usb, 1, 1, 1); +MODULE_VERSION(umct, 1); static int umct_probe(device_t dev) Modified: head/sys/dev/usb/serial/umoscom.c ============================================================================== --- head/sys/dev/usb/serial/umoscom.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/umoscom.c Wed Sep 1 23:47:53 2010 (r212122) @@ -279,6 +279,7 @@ static driver_t umoscom_driver = { DRIVER_MODULE(umoscom, uhub, umoscom_driver, umoscom_devclass, NULL, 0); MODULE_DEPEND(umoscom, ucom, 1, 1, 1); MODULE_DEPEND(umoscom, usb, 1, 1, 1); +MODULE_VERSION(umoscom, 1); static const struct usb_device_id umoscom_devs[] = { {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7703, 0)} Modified: head/sys/dev/usb/serial/uvisor.c ============================================================================== --- head/sys/dev/usb/serial/uvisor.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/serial/uvisor.c Wed Sep 1 23:47:53 2010 (r212122) @@ -252,6 +252,7 @@ static driver_t uvisor_driver = { DRIVER_MODULE(uvisor, uhub, uvisor_driver, uvisor_devclass, NULL, 0); MODULE_DEPEND(uvisor, ucom, 1, 1, 1); MODULE_DEPEND(uvisor, usb, 1, 1, 1); +MODULE_VERSION(uvisor, 1); static const struct usb_device_id uvisor_devs[] = { #define UVISOR_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/storage/umass.c Wed Sep 1 23:47:53 2010 (r212122) @@ -715,6 +715,7 @@ static driver_t umass_driver = { DRIVER_MODULE(umass, uhub, umass_driver, umass_devclass, NULL, 0); MODULE_DEPEND(umass, usb, 1, 1, 1); MODULE_DEPEND(umass, cam, 1, 1, 1); +MODULE_VERSION(umass, 1); /* * USB device probe/attach/detach Modified: head/sys/dev/usb/storage/urio.c ============================================================================== --- head/sys/dev/usb/storage/urio.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/storage/urio.c Wed Sep 1 23:47:53 2010 (r212122) @@ -197,6 +197,7 @@ static driver_t urio_driver = { DRIVER_MODULE(urio, uhub, urio_driver, urio_devclass, NULL, 0); MODULE_DEPEND(urio, usb, 1, 1, 1); +MODULE_VERSION(urio, 1); static int urio_probe(device_t dev) Modified: head/sys/dev/usb/usb_compat_linux.c ============================================================================== --- head/sys/dev/usb/usb_compat_linux.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/usb_compat_linux.c Wed Sep 1 23:47:53 2010 (r212122) @@ -122,6 +122,7 @@ static driver_t usb_linux_driver = { static devclass_t usb_linux_devclass; DRIVER_MODULE(usb_linux, uhub, usb_linux_driver, usb_linux_devclass, NULL, 0); +MODULE_VERSION(usb_linux, 1); /*------------------------------------------------------------------------* * usb_linux_lookup_id Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/usb_hub.c Wed Sep 1 23:47:53 2010 (r212122) @@ -170,6 +170,7 @@ static driver_t uhub_driver = { DRIVER_MODULE(uhub, usbus, uhub_driver, uhub_devclass, 0, 0); DRIVER_MODULE(uhub, uhub, uhub_driver, uhub_devclass, NULL, 0); +MODULE_VERSION(uhub, 1); static void uhub_intr_callback(struct usb_xfer *xfer, usb_error_t error) Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/wlan/if_rum.c Wed Sep 1 23:47:53 2010 (r212122) @@ -139,9 +139,6 @@ static const struct usb_device_id rum_de #undef RUM_DEV }; -MODULE_DEPEND(rum, wlan, 1, 1, 1); -MODULE_DEPEND(rum, usb, 1, 1, 1); - static device_probe_t rum_match; static device_attach_t rum_attach; static device_detach_t rum_detach; @@ -2360,3 +2357,6 @@ static driver_t rum_driver = { static devclass_t rum_devclass; DRIVER_MODULE(rum, uhub, rum_driver, rum_devclass, NULL, 0); +MODULE_DEPEND(rum, wlan, 1, 1, 1); +MODULE_DEPEND(rum, usb, 1, 1, 1); +MODULE_VERSION(rum, 1); Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/wlan/if_run.c Wed Sep 1 23:47:53 2010 (r212122) @@ -294,10 +294,6 @@ static const struct usb_device_id run_de #undef RUN_DEV }; -MODULE_DEPEND(run, wlan, 1, 1, 1); -MODULE_DEPEND(run, usb, 1, 1, 1); -MODULE_DEPEND(run, firmware, 1, 1, 1); - static device_probe_t run_match; static device_attach_t run_attach; static device_detach_t run_detach; @@ -4871,3 +4867,7 @@ static driver_t run_driver = { static devclass_t run_devclass; DRIVER_MODULE(run, uhub, run_driver, run_devclass, NULL, 0); +MODULE_DEPEND(run, wlan, 1, 1, 1); +MODULE_DEPEND(run, usb, 1, 1, 1); +MODULE_DEPEND(run, firmware, 1, 1, 1); +MODULE_VERSION(run, 1); Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/wlan/if_uath.c Wed Sep 1 23:47:53 2010 (r212122) @@ -2892,3 +2892,4 @@ static devclass_t uath_devclass; DRIVER_MODULE(uath, uhub, uath_driver, uath_devclass, NULL, 0); MODULE_DEPEND(uath, wlan, 1, 1, 1); MODULE_DEPEND(uath, usb, 1, 1, 1); +MODULE_VERSION(uath, 1); Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/wlan/if_ural.c Wed Sep 1 23:47:53 2010 (r212122) @@ -400,6 +400,7 @@ static devclass_t ural_devclass; DRIVER_MODULE(ural, uhub, ural_driver, ural_devclass, NULL, 0); MODULE_DEPEND(ural, usb, 1, 1, 1); MODULE_DEPEND(ural, wlan, 1, 1, 1); +MODULE_VERSION(ural, 1); static int ural_match(device_t self) Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/wlan/if_urtw.c Wed Sep 1 23:47:53 2010 (r212122) @@ -4441,3 +4441,4 @@ static devclass_t urtw_devclass; DRIVER_MODULE(urtw, uhub, urtw_driver, urtw_devclass, NULL, 0); MODULE_DEPEND(urtw, wlan, 1, 1, 1); MODULE_DEPEND(urtw, usb, 1, 1, 1); +MODULE_VERSION(urtw, 1); Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Wed Sep 1 22:50:11 2010 (r212121) +++ head/sys/dev/usb/wlan/if_zyd.c Wed Sep 1 23:47:53 2010 (r212122) @@ -2948,3 +2948,4 @@ static devclass_t zyd_devclass; DRIVER_MODULE(zyd, uhub, zyd_driver, zyd_devclass, NULL, 0); MODULE_DEPEND(zyd, usb, 1, 1, 1); MODULE_DEPEND(zyd, wlan, 1, 1, 1); +MODULE_VERSION(zyd, 1); From owner-svn-src-all@FreeBSD.ORG Wed Sep 1 23:51:07 2010 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 772F310656E2; Wed, 1 Sep 2010 23:51:07 +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 64E0D8FC12; Wed, 1 Sep 2010 23:51:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o81Np7u7085349; Wed, 1 Sep 2010 23:51:07 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o81Np7VV085347; Wed, 1 Sep 2010 23:51:07 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009012351.o81Np7VV085347@svn.freebsd.org> From: Rick Macklem Date: Wed, 1 Sep 2010 23:51: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: r212123 - head/sys/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 01 Sep 2010 23:51:07 -0000 Author: rmacklem Date: Wed Sep 1 23:51:07 2010 New Revision: 212123 URL: http://svn.freebsd.org/changeset/base/212123 Log: Modify nfs_diskless.c to recognize the environment variable boot.nfsroot.nfshandlelen and set the diskless root fs to use NFSv3 and this file handle length when it is set. If this environment variable is not set, the diskless root fs will use NFSv2 and the same defaults as before. This fixes the problem where the diskless nfs root fs had to be on a FreeBSD server for NFSv3 to work, because it did not know the correct file handle length and assumed the size used by FreeBSD. Until pxeboot and loader are replaced by ones built from commits coming soon, boot.nfsroot.nfshandlelen will not be set by them and the diskless root fs will use NFSv2 unless the /etc/fstab entry has the "nfsv3" option specified. Tested by: danny at cs.huji.ac.il MFC after: 2 weeks Modified: head/sys/nfsclient/nfs_diskless.c Modified: head/sys/nfsclient/nfs_diskless.c ============================================================================== --- head/sys/nfsclient/nfs_diskless.c Wed Sep 1 23:47:53 2010 (r212122) +++ head/sys/nfsclient/nfs_diskless.c Wed Sep 1 23:51:07 2010 (r212123) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); static int inaddr_to_sockaddr(char *ev, struct sockaddr_in *sa); static int hwaddr_to_sockaddr(char *ev, struct sockaddr_dl *sa); -static int decode_nfshandle(char *ev, u_char *fh); +static int decode_nfshandle(char *ev, u_char *fh, int maxfh); /* * Validate/sanity check a rsize/wsize parameter. @@ -143,20 +143,37 @@ nfs_parse_options(const char *envopts, s * boot.nfsroot.server IP address of root filesystem server * boot.nfsroot.path path of the root filesystem on server * boot.nfsroot.nfshandle NFS handle for root filesystem on server + * boot.nfsroot.nfshandlelen and length of this handle (for NFSv3 only) * boot.nfsroot.options NFS options for the root filesystem */ void nfs_setup_diskless(void) { struct nfs_diskless *nd = &nfs_diskless; + struct nfsv3_diskless *nd3 = &nfsv3_diskless; struct ifnet *ifp; struct ifaddr *ifa; struct sockaddr_dl *sdl, ourdl; struct sockaddr_in myaddr, netmask; char *cp; + int cnt, fhlen, is_nfsv3; + uint32_t len; - if (nfs_diskless_valid) + if (nfs_diskless_valid != 0) return; + + /* get handle size. If this succeeds, it's an NFSv3 setup. */ + if ((cp = getenv("boot.nfsroot.nfshandlelen")) != NULL) { + cnt = sscanf(cp, "%d", &len); + freeenv(cp); + if (cnt != 1 || len == 0 || len > NFSX_V3FHMAX) { + printf("nfs_diskless: bad NFS handle len\n"); + return; + } + nd3->root_fhsize = len; + is_nfsv3 = 1; + } else + is_nfsv3 = 0; /* set up interface */ if (inaddr_to_sockaddr("boot.netif.ip", &myaddr)) return; @@ -164,11 +181,21 @@ nfs_setup_diskless(void) printf("nfs_diskless: no netmask\n"); return; } - bcopy(&myaddr, &nd->myif.ifra_addr, sizeof(myaddr)); - bcopy(&myaddr, &nd->myif.ifra_broadaddr, sizeof(myaddr)); - ((struct sockaddr_in *) &nd->myif.ifra_broadaddr)->sin_addr.s_addr = - myaddr.sin_addr.s_addr | ~ netmask.sin_addr.s_addr; - bcopy(&netmask, &nd->myif.ifra_mask, sizeof(netmask)); + if (is_nfsv3 != 0) { + bcopy(&myaddr, &nd3->myif.ifra_addr, sizeof(myaddr)); + bcopy(&myaddr, &nd3->myif.ifra_broadaddr, sizeof(myaddr)); + ((struct sockaddr_in *) + &nd3->myif.ifra_broadaddr)->sin_addr.s_addr = + myaddr.sin_addr.s_addr | ~ netmask.sin_addr.s_addr; + bcopy(&netmask, &nd3->myif.ifra_mask, sizeof(netmask)); + } else { + bcopy(&myaddr, &nd->myif.ifra_addr, sizeof(myaddr)); + bcopy(&myaddr, &nd->myif.ifra_broadaddr, sizeof(myaddr)); + ((struct sockaddr_in *) + &nd->myif.ifra_broadaddr)->sin_addr.s_addr = + myaddr.sin_addr.s_addr | ~ netmask.sin_addr.s_addr; + bcopy(&netmask, &nd->myif.ifra_mask, sizeof(netmask)); + } if (hwaddr_to_sockaddr("boot.netif.hwaddr", &ourdl)) { printf("nfs_diskless: no hardware address\n"); @@ -196,46 +223,94 @@ nfs_setup_diskless(void) return; /* no matching interface */ match_done: setenv("boot.netif.name", ifp->if_xname); - strlcpy(nd->myif.ifra_name, ifp->if_xname, sizeof(nd->myif.ifra_name)); + if (is_nfsv3 != 0) { + strlcpy(nd3->myif.ifra_name, ifp->if_xname, + sizeof(nd3->myif.ifra_name)); - /* set up gateway */ - inaddr_to_sockaddr("boot.netif.gateway", &nd->mygateway); + /* set up gateway */ + inaddr_to_sockaddr("boot.netif.gateway", &nd3->mygateway); - /* set up root mount */ - nd->root_args.rsize = 8192; /* XXX tunable? */ - nd->root_args.wsize = 8192; - nd->root_args.sotype = SOCK_STREAM; - nd->root_args.flags = (NFSMNT_NFSV3 | NFSMNT_WSIZE | NFSMNT_RSIZE | NFSMNT_RESVPORT); - if (inaddr_to_sockaddr("boot.nfsroot.server", &nd->root_saddr)) { - printf("nfs_diskless: no server\n"); - return; - } - nd->root_saddr.sin_port = htons(NFS_PORT); - if (decode_nfshandle("boot.nfsroot.nfshandle", &nd->root_fh[0]) == 0) { - printf("nfs_diskless: no NFS handle\n"); - return; - } - if ((cp = getenv("boot.nfsroot.path")) != NULL) { - strncpy(nd->root_hostnam, cp, MNAMELEN - 1); - freeenv(cp); - } - if ((cp = getenv("boot.nfsroot.options")) != NULL) { - struct nfs_args args; + /* set up root mount */ + nd3->root_args.rsize = 32768; /* XXX tunable? */ + nd3->root_args.wsize = 32768; + nd3->root_args.sotype = SOCK_STREAM; + nd3->root_args.flags = (NFSMNT_NFSV3 | NFSMNT_WSIZE | + NFSMNT_RSIZE | NFSMNT_RESVPORT); + if (inaddr_to_sockaddr("boot.nfsroot.server", + &nd3->root_saddr)) { + printf("nfs_diskless: no server\n"); + return; + } + nd3->root_saddr.sin_port = htons(NFS_PORT); + fhlen = decode_nfshandle("boot.nfsroot.nfshandle", + &nd3->root_fh[0], NFSX_V3FHMAX); + if (fhlen == 0) { + printf("nfs_diskless: no NFS handle\n"); + return; + } + if (fhlen != nd3->root_fhsize) { + printf("nfs_diskless: bad NFS handle len=%d\n", fhlen); + return; + } + if ((cp = getenv("boot.nfsroot.path")) != NULL) { + strncpy(nd3->root_hostnam, cp, MNAMELEN - 1); + freeenv(cp); + } + if ((cp = getenv("boot.nfsroot.options")) != NULL) { + nfs_parse_options(cp, &nd3->root_args); + freeenv(cp); + } + + nfs_diskless_valid = 3; + } else { + strlcpy(nd->myif.ifra_name, ifp->if_xname, + sizeof(nd->myif.ifra_name)); + + /* set up gateway */ + inaddr_to_sockaddr("boot.netif.gateway", &nd->mygateway); - /* XXX yech, convert between old and current arg format */ - args.flags = nd->root_args.flags; - args.sotype = nd->root_args.sotype; - args.rsize = nd->root_args.rsize; - args.wsize = nd->root_args.wsize; - nfs_parse_options(cp, &args); - nd->root_args.flags = args.flags; - nd->root_args.sotype = args.sotype; - nd->root_args.rsize = args.rsize; - nd->root_args.wsize = args.wsize; - freeenv(cp); + /* set up root mount */ + nd->root_args.rsize = 8192; /* XXX tunable? */ + nd->root_args.wsize = 8192; + nd->root_args.sotype = SOCK_STREAM; + nd->root_args.flags = (NFSMNT_WSIZE | + NFSMNT_RSIZE | NFSMNT_RESVPORT); + if (inaddr_to_sockaddr("boot.nfsroot.server", + &nd->root_saddr)) { + printf("nfs_diskless: no server\n"); + return; + } + nd->root_saddr.sin_port = htons(NFS_PORT); + if (decode_nfshandle("boot.nfsroot.nfshandle", + &nd->root_fh[0], NFSX_V2FH) == 0) { + printf("nfs_diskless: no NFS handle\n"); + return; + } + if ((cp = getenv("boot.nfsroot.path")) != NULL) { + strncpy(nd->root_hostnam, cp, MNAMELEN - 1); + freeenv(cp); + } + if ((cp = getenv("boot.nfsroot.options")) != NULL) { + struct nfs_args args; + + /* + * XXX yech, convert between old and current + * arg format + */ + args.flags = nd->root_args.flags; + args.sotype = nd->root_args.sotype; + args.rsize = nd->root_args.rsize; + args.wsize = nd->root_args.wsize; + nfs_parse_options(cp, &args); + nd->root_args.flags = args.flags; + nd->root_args.sotype = args.sotype; + nd->root_args.rsize = args.rsize; + nd->root_args.wsize = args.wsize; + freeenv(cp); + } + + nfs_diskless_valid = 1; } - - nfs_diskless_valid = 1; } static int @@ -289,7 +364,7 @@ hwaddr_to_sockaddr(char *ev, struct sock } static int -decode_nfshandle(char *ev, u_char *fh) +decode_nfshandle(char *ev, u_char *fh, int maxfh) { u_char *cp, *ep; int len, val; @@ -315,7 +390,7 @@ decode_nfshandle(char *ev, u_char *fh) *(fh++) = val; len++; cp += 2; - if (len > NFSX_V2FH) { + if (len > maxfh) { freeenv(ep); return (0); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 00:44:05 2010 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 75D321065792; Thu, 2 Sep 2010 00:44:05 +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 49E5A8FC20; Thu, 2 Sep 2010 00:44:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o820i5pJ086575; Thu, 2 Sep 2010 00:44:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o820i53s086573; Thu, 2 Sep 2010 00:44:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009020044.o820i53s086573@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 2 Sep 2010 00:44: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: r212124 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 00:44:05 -0000 Author: yongari Date: Thu Sep 2 00:44:05 2010 New Revision: 212124 URL: http://svn.freebsd.org/changeset/base/212124 Log: Fix stupid error in r212109 which didn't swap DMA maps. This caused IOMMU panic on sparc64 under high TX load. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Wed Sep 1 23:51:07 2010 (r212123) +++ head/sys/dev/sis/if_sis.c Thu Sep 2 00:44:05 2010 (r212124) @@ -1883,8 +1883,8 @@ sis_encap(struct sis_softc *sc, struct m /* Swap the last and the first dmamaps. */ map = txd->tx_dmamap; - txd->tx_dmamap = sc->sis_txdesc[frag].tx_dmamap; - sc->sis_txdesc[frag].tx_dmamap = map; + txd->tx_dmamap = sc->sis_txdesc[prod].tx_dmamap; + sc->sis_txdesc[prod].tx_dmamap = map; txd->tx_m = *m_head; return (0); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 01:00:14 2010 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 3C50810656BD; Thu, 2 Sep 2010 01:00:14 +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 2A7A68FC19; Thu, 2 Sep 2010 01:00:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8210D5f086971; Thu, 2 Sep 2010 01:00:13 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8210DOd086969; Thu, 2 Sep 2010 01:00:13 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009020100.o8210DOd086969@svn.freebsd.org> From: Rick Macklem Date: Thu, 2 Sep 2010 01:00: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: r212125 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 01:00:14 -0000 Author: rmacklem Date: Thu Sep 2 01:00:13 2010 New Revision: 212125 URL: http://svn.freebsd.org/changeset/base/212125 Log: Modify lib/libstand/nfs.c to use NFSv3 instead of NFSv2. This allows the nfs_getrootfh() function to return the correct file handle size to pxe.c for pxeboot. It also results in NFSv2 no longer being used by default anywhere in FreeBSD. If built with OLD_NFSV2 defined, the old code that predated this patch will be built and NFSv2 will be used. Tested by: danny at cs.huji.ac.il MFC after: 2 weeks Modified: head/lib/libstand/nfs.c Modified: head/lib/libstand/nfs.c ============================================================================== --- head/lib/libstand/nfs.c Thu Sep 2 00:44:05 2010 (r212124) +++ head/lib/libstand/nfs.c Thu Sep 2 01:00:13 2010 (r212125) @@ -50,7 +50,10 @@ __FBSDID("$FreeBSD$"); #define NFS_DEBUGxx +#define NFSREAD_SIZE 1024 + /* Define our own NFS attributes without NQNFS stuff. */ +#ifdef OLD_NFSV2 struct nfsv2_fattrs { n_long fa_type; n_long fa_mode; @@ -68,7 +71,6 @@ struct nfsv2_fattrs { struct nfsv2_time fa_ctime; }; - struct nfs_read_args { u_char fh[NFS_FHSIZE]; n_long off; @@ -77,7 +79,6 @@ struct nfs_read_args { }; /* Data part of nfs rpc reply (also the largest thing we receive) */ -#define NFSREAD_SIZE 1024 struct nfs_read_repl { n_long errno; struct nfsv2_fattrs fa; @@ -116,6 +117,72 @@ struct nfs_iodesc { u_char fh[NFS_FHSIZE]; struct nfsv2_fattrs fa; /* all in network order */ }; +#else /* !OLD_NFSV2 */ + +/* NFSv3 definitions */ +#define NFS_V3MAXFHSIZE 64 +#define NFS_VER3 3 +#define RPCMNT_VER3 3 +#define NFSPROCV3_LOOKUP 3 +#define NFSPROCV3_READLINK 5 +#define NFSPROCV3_READ 6 +#define NFSPROCV3_READDIR 16 + +typedef struct { + uint32_t val[2]; +} n_quad; + +struct nfsv3_time { + uint32_t nfs_sec; + uint32_t nfs_nsec; +}; + +struct nfsv3_fattrs { + uint32_t fa_type; + uint32_t fa_mode; + uint32_t fa_nlink; + uint32_t fa_uid; + uint32_t fa_gid; + n_quad fa_size; + n_quad fa_used; + n_quad fa_rdev; + n_quad fa_fsid; + n_quad fa_fileid; + struct nfsv3_time fa_atime; + struct nfsv3_time fa_mtime; + struct nfsv3_time fa_ctime; +}; + +/* + * For NFSv3, the file handle is variable in size, so most fixed sized + * structures for arguments won't work. For most cases, a structure + * that starts with any fixed size section is followed by an array + * that covers the maximum size required. + */ +struct nfsv3_readdir_repl { + uint32_t errno; + uint32_t ok; + struct nfsv3_fattrs fa; + uint32_t cookiev0; + uint32_t cookiev1; +}; + +struct nfsv3_readdir_entry { + uint32_t follows; + uint32_t fid0; + uint32_t fid1; + uint32_t len; + uint32_t nameplus[0]; +}; + +struct nfs_iodesc { + struct iodesc *iodesc; + off_t off; + uint32_t fhsize; + u_char fh[NFS_V3MAXFHSIZE]; + struct nfsv3_fattrs fa; /* all in network order */ +}; +#endif /* OLD_NFSV2 */ /* * XXX interactions with tftp? See nfswrapper.c for a confusing @@ -142,6 +209,7 @@ struct fs_ops nfs_fsops = { nfs_readdir }; +#ifdef OLD_NFSV2 /* * Fetch the root file handle (call mount daemon) * Return zero or error number. @@ -745,3 +813,675 @@ nfs_readdir(struct open_file *f, struct cookie = ntohl(roff->cookie); return 0; } +#else /* !OLD_NFSV2 */ +/* + * Fetch the root file handle (call mount daemon) + * Return zero or error number. + */ +int +nfs_getrootfh(struct iodesc *d, char *path, uint32_t *fhlenp, u_char *fhp) +{ + int len; + struct args { + uint32_t len; + char path[FNAME_SIZE]; + } *args; + struct repl { + uint32_t errno; + uint32_t fhsize; + u_char fh[NFS_V3MAXFHSIZE]; + uint32_t authcnt; + uint32_t auth[7]; + } *repl; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct args d; + } sdata; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct repl d; + } rdata; + size_t cc; + +#ifdef NFS_DEBUG + if (debug) + printf("nfs_getrootfh: %s\n", path); +#endif + + args = &sdata.d; + repl = &rdata.d; + + bzero(args, sizeof(*args)); + len = strlen(path); + if (len > sizeof(args->path)) + len = sizeof(args->path); + args->len = htonl(len); + bcopy(path, args->path, len); + len = sizeof(uint32_t) + roundup(len, sizeof(uint32_t)); + + cc = rpc_call(d, RPCPROG_MNT, RPCMNT_VER3, RPCMNT_MOUNT, + args, len, repl, sizeof(*repl)); + if (cc == -1) + /* errno was set by rpc_call */ + return (errno); + if (cc < 2 * sizeof (uint32_t)) + return (EBADRPC); + if (repl->errno != 0) + return (ntohl(repl->errno)); + *fhlenp = ntohl(repl->fhsize); + bcopy(repl->fh, fhp, *fhlenp); + return (0); +} + +/* + * Lookup a file. Store handle and attributes. + * Return zero or error number. + */ +int +nfs_lookupfh(struct nfs_iodesc *d, const char *name, struct nfs_iodesc *newfd) +{ + int len, rlen, pos; + struct args { + uint32_t fhsize; + uint32_t fhplusname[1 + + (NFS_V3MAXFHSIZE + FNAME_SIZE) / sizeof(uint32_t)]; + } *args; + struct repl { + uint32_t errno; + uint32_t fhsize; + uint32_t fhplusattr[(NFS_V3MAXFHSIZE + + 2 * (sizeof(uint32_t) + + sizeof(struct nfsv3_fattrs))) / sizeof(uint32_t)]; + } *repl; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct args d; + } sdata; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct repl d; + } rdata; + ssize_t cc; + +#ifdef NFS_DEBUG + if (debug) + printf("lookupfh: called\n"); +#endif + + args = &sdata.d; + repl = &rdata.d; + + bzero(args, sizeof(*args)); + args->fhsize = htonl(d->fhsize); + bcopy(d->fh, args->fhplusname, d->fhsize); + len = strlen(name); + if (len > FNAME_SIZE) + len = FNAME_SIZE; + pos = roundup(d->fhsize, sizeof(uint32_t)) / sizeof(uint32_t); + args->fhplusname[pos++] = htonl(len); + bcopy(name, &args->fhplusname[pos], len); + len = sizeof(uint32_t) + pos * sizeof(uint32_t) + + roundup(len, sizeof(uint32_t)); + + rlen = sizeof(*repl); + + cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_LOOKUP, + args, len, repl, rlen); + if (cc == -1) + return (errno); /* XXX - from rpc_call */ + if (cc < 2 * sizeof(uint32_t)) + return (EIO); + if (repl->errno != 0) + /* saerrno.h now matches NFS error numbers. */ + return (ntohl(repl->errno)); + newfd->fhsize = ntohl(repl->fhsize); + bcopy(repl->fhplusattr, &newfd->fh, newfd->fhsize); + pos = roundup(newfd->fhsize, sizeof(uint32_t)) / sizeof(uint32_t); + if (repl->fhplusattr[pos++] == 0) + return (EIO); + bcopy(&repl->fhplusattr[pos], &newfd->fa, sizeof(newfd->fa)); + return (0); +} + +#ifndef NFS_NOSYMLINK +/* + * Get the destination of a symbolic link. + */ +int +nfs_readlink(struct nfs_iodesc *d, char *buf) +{ + struct args { + uint32_t fhsize; + u_char fh[NFS_V3MAXFHSIZE]; + } *args; + struct repl { + uint32_t errno; + uint32_t ok; + struct nfsv3_fattrs fa; + uint32_t len; + u_char path[NFS_MAXPATHLEN]; + } *repl; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct args d; + } sdata; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct repl d; + } rdata; + ssize_t cc; + +#ifdef NFS_DEBUG + if (debug) + printf("readlink: called\n"); +#endif + + args = &sdata.d; + repl = &rdata.d; + + bzero(args, sizeof(*args)); + args->fhsize = htonl(d->fhsize); + bcopy(d->fh, args->fh, d->fhsize); + cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READLINK, + args, sizeof(uint32_t) + roundup(d->fhsize, sizeof(uint32_t)), + repl, sizeof(*repl)); + if (cc == -1) + return (errno); + + if (cc < 2 * sizeof(uint32_t)) + return (EIO); + + if (repl->errno != 0) + return (ntohl(repl->errno)); + + if (repl->ok == 0) + return (EIO); + + repl->len = ntohl(repl->len); + if (repl->len > NFS_MAXPATHLEN) + return (ENAMETOOLONG); + + bcopy(repl->path, buf, repl->len); + buf[repl->len] = 0; + return (0); +} +#endif + +/* + * Read data from a file. + * Return transfer count or -1 (and set errno) + */ +ssize_t +nfs_readdata(struct nfs_iodesc *d, off_t off, void *addr, size_t len) +{ + struct args { + uint32_t fhsize; + uint32_t fhoffcnt[NFS_V3MAXFHSIZE / sizeof(uint32_t) + 3]; + } *args; + struct repl { + uint32_t errno; + uint32_t ok; + struct nfsv3_fattrs fa; + uint32_t count; + uint32_t eof; + uint32_t len; + u_char data[NFSREAD_SIZE]; + } *repl; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct args d; + } sdata; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct repl d; + } rdata; + size_t cc; + long x; + int hlen, rlen, pos; + + args = &sdata.d; + repl = &rdata.d; + + bzero(args, sizeof(*args)); + args->fhsize = htonl(d->fhsize); + bcopy(d->fh, args->fhoffcnt, d->fhsize); + pos = roundup(d->fhsize, sizeof(uint32_t)) / sizeof(uint32_t); + args->fhoffcnt[pos++] = 0; + args->fhoffcnt[pos++] = htonl((uint32_t)off); + if (len > NFSREAD_SIZE) + len = NFSREAD_SIZE; + args->fhoffcnt[pos] = htonl((uint32_t)len); + hlen = sizeof(*repl) - NFSREAD_SIZE; + + cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READ, + args, 4 * sizeof(uint32_t) + roundup(d->fhsize, sizeof(uint32_t)), + repl, sizeof(*repl)); + if (cc == -1) + /* errno was already set by rpc_call */ + return (-1); + if (cc < hlen) { + errno = EBADRPC; + return (-1); + } + if (repl->errno != 0) { + errno = ntohl(repl->errno); + return (-1); + } + rlen = cc - hlen; + x = ntohl(repl->count); + if (rlen < x) { + printf("nfsread: short packet, %d < %ld\n", rlen, x); + errno = EBADRPC; + return (-1); + } + bcopy(repl->data, addr, x); + return (x); +} + +/* + * Open a file. + * return zero or error number + */ +int +nfs_open(const char *upath, struct open_file *f) +{ + struct iodesc *desc; + struct nfs_iodesc *currfd; + char buf[2 * NFS_V3MAXFHSIZE + 3]; + u_char *fh; + char *cp; + int i; +#ifndef NFS_NOSYMLINK + struct nfs_iodesc *newfd; + struct nfsv3_fattrs *fa; + char *ncp; + int c; + char namebuf[NFS_MAXPATHLEN + 1]; + char linkbuf[NFS_MAXPATHLEN + 1]; + int nlinks = 0; +#endif + int error; + char *path; + +#ifdef NFS_DEBUG + if (debug) + printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); +#endif + if (!rootpath[0]) { + printf("no rootpath, no nfs\n"); + return (ENXIO); + } + + /* + * This is silly - we should look at dv_type but that value is + * arch dependant and we can't use it here. + */ +#ifndef __i386__ + if (strcmp(f->f_dev->dv_name, "net") != 0) + return (EINVAL); +#else + if (strcmp(f->f_dev->dv_name, "pxe") != 0) + return (EINVAL); +#endif + + if (!(desc = socktodesc(*(int *)(f->f_devdata)))) + return (EINVAL); + + /* Bind to a reserved port. */ + desc->myport = htons(--rpc_port); + desc->destip = rootip; + if ((error = nfs_getrootfh(desc, rootpath, &nfs_root_node.fhsize, + nfs_root_node.fh))) + return (error); + nfs_root_node.iodesc = desc; + + fh = &nfs_root_node.fh[0]; + buf[0] = 'X'; + cp = &buf[1]; + for (i = 0; i < nfs_root_node.fhsize; i++, cp += 2) + sprintf(cp, "%02x", fh[i]); + sprintf(cp, "X"); + setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); + setenv("boot.nfsroot.path", rootpath, 1); + setenv("boot.nfsroot.nfshandle", buf, 1); + sprintf(buf, "%d", nfs_root_node.fhsize); + setenv("boot.nfsroot.nfshandlelen", buf, 1); + +#ifndef NFS_NOSYMLINK + /* Fake up attributes for the root dir. */ + fa = &nfs_root_node.fa; + fa->fa_type = htonl(NFDIR); + fa->fa_mode = htonl(0755); + fa->fa_nlink = htonl(2); + + currfd = &nfs_root_node; + newfd = 0; + + cp = path = strdup(upath); + if (path == NULL) { + error = ENOMEM; + goto out; + } + while (*cp) { + /* + * Remove extra separators + */ + while (*cp == '/') + cp++; + + if (*cp == '\0') + break; + /* + * Check that current node is a directory. + */ + if (currfd->fa.fa_type != htonl(NFDIR)) { + error = ENOTDIR; + goto out; + } + + /* allocate file system specific data structure */ + newfd = malloc(sizeof(*newfd)); + if (newfd == NULL) { + error = ENOMEM; + goto out; + } + newfd->iodesc = currfd->iodesc; + newfd->off = 0; + + /* + * Get next component of path name. + */ + { + int len = 0; + + ncp = cp; + while ((c = *cp) != '\0' && c != '/') { + if (++len > NFS_MAXNAMLEN) { + error = ENOENT; + goto out; + } + cp++; + } + *cp = '\0'; + } + + /* lookup a file handle */ + error = nfs_lookupfh(currfd, ncp, newfd); + *cp = c; + if (error) + goto out; + + /* + * Check for symbolic link + */ + if (newfd->fa.fa_type == htonl(NFLNK)) { + int link_len, len; + + error = nfs_readlink(newfd, linkbuf); + if (error) + goto out; + + link_len = strlen(linkbuf); + len = strlen(cp); + + if (link_len + len > MAXPATHLEN + || ++nlinks > MAXSYMLINKS) { + error = ENOENT; + goto out; + } + + bcopy(cp, &namebuf[link_len], len + 1); + bcopy(linkbuf, namebuf, link_len); + + /* + * If absolute pathname, restart at root. + * If relative pathname, restart at parent directory. + */ + cp = namebuf; + if (*cp == '/') { + if (currfd != &nfs_root_node) + free(currfd); + currfd = &nfs_root_node; + } + + free(newfd); + newfd = 0; + + continue; + } + + if (currfd != &nfs_root_node) + free(currfd); + currfd = newfd; + newfd = 0; + } + + error = 0; + +out: + free(newfd); + free(path); +#else + /* allocate file system specific data structure */ + currfd = malloc(sizeof(*currfd)); + if (currfd != NULL) { + currfd->iodesc = desc; + currfd->off = 0; + + error = nfs_lookupfh(&nfs_root_node, upath, currfd); + } else + error = ENOMEM; +#endif + if (!error) { + f->f_fsdata = (void *)currfd; + return (0); + } + +#ifdef NFS_DEBUG + if (debug) + printf("nfs_open: %s lookupfh failed: %s\n", + path, strerror(error)); +#endif +#ifndef NFS_NOSYMLINK + if (currfd != &nfs_root_node) +#endif + free(currfd); + + return (error); +} + +int +nfs_close(struct open_file *f) +{ + struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata; + +#ifdef NFS_DEBUG + if (debug) + printf("nfs_close: fp=0x%lx\n", (u_long)fp); +#endif + + if (fp != &nfs_root_node && fp) + free(fp); + f->f_fsdata = (void *)0; + + return (0); +} + +/* + * read a portion of a file + */ +int +nfs_read(struct open_file *f, void *buf, size_t size, size_t *resid) +{ + struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata; + ssize_t cc; + char *addr = buf; + +#ifdef NFS_DEBUG + if (debug) + printf("nfs_read: size=%lu off=%d\n", (u_long)size, + (int)fp->off); +#endif + while ((int)size > 0) { + twiddle(); + cc = nfs_readdata(fp, fp->off, (void *)addr, size); + /* XXX maybe should retry on certain errors */ + if (cc == -1) { +#ifdef NFS_DEBUG + if (debug) + printf("nfs_read: read: %s", strerror(errno)); +#endif + return (errno); /* XXX - from nfs_readdata */ + } + if (cc == 0) { +#ifdef NFS_DEBUG + if (debug) + printf("nfs_read: hit EOF unexpectantly"); +#endif + goto ret; + } + fp->off += cc; + addr += cc; + size -= cc; + } +ret: + if (resid) + *resid = size; + + return (0); +} + +/* + * Not implemented. + */ +int +nfs_write(struct open_file *f, void *buf, size_t size, size_t *resid) +{ + return (EROFS); +} + +off_t +nfs_seek(struct open_file *f, off_t offset, int where) +{ + struct nfs_iodesc *d = (struct nfs_iodesc *)f->f_fsdata; + uint32_t size = ntohl(d->fa.fa_size.val[1]); + + switch (where) { + case SEEK_SET: + d->off = offset; + break; + case SEEK_CUR: + d->off += offset; + break; + case SEEK_END: + d->off = size - offset; + break; + default: + errno = EINVAL; + return (-1); + } + + return (d->off); +} + +/* NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5, NFSOCK=6, NFFIFO=7 */ +int nfs_stat_types[9] = { + 0, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO, 0 }; + +int +nfs_stat(struct open_file *f, struct stat *sb) +{ + struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata; + uint32_t ftype, mode; + + ftype = ntohl(fp->fa.fa_type); + mode = ntohl(fp->fa.fa_mode); + mode |= nfs_stat_types[ftype & 7]; + + sb->st_mode = mode; + sb->st_nlink = ntohl(fp->fa.fa_nlink); + sb->st_uid = ntohl(fp->fa.fa_uid); + sb->st_gid = ntohl(fp->fa.fa_gid); + sb->st_size = ntohl(fp->fa.fa_size.val[1]); + + return (0); +} + +static int +nfs_readdir(struct open_file *f, struct dirent *d) +{ + struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata; + struct nfsv3_readdir_repl *repl; + struct nfsv3_readdir_entry *rent; + static char *buf; + static uint32_t cookie0 = 0; + static uint32_t cookie1 = 0; + size_t cc; + static uint32_t cookieverf0 = 0; + static uint32_t cookieverf1 = 0; + int pos; + + struct args { + uint32_t fhsize; + uint32_t fhpluscookie[5 + NFS_V3MAXFHSIZE]; + } *args; + struct { + uint32_t h[RPC_HEADER_WORDS]; + struct args d; + } sdata; + static struct { + uint32_t h[RPC_HEADER_WORDS]; + u_char d[NFS_READDIRSIZE]; + } rdata; + + if (cookie0 == 0 && cookie1 == 0) { + refill: + args = &sdata.d; + bzero(args, sizeof(*args)); + + args->fhsize = htonl(fp->fhsize); + bcopy(fp->fh, args->fhpluscookie, fp->fhsize); + pos = roundup(fp->fhsize, sizeof(uint32_t)) / sizeof(uint32_t); + args->fhpluscookie[pos++] = cookie0; + args->fhpluscookie[pos++] = cookie1; + args->fhpluscookie[pos++] = cookieverf0; + args->fhpluscookie[pos++] = cookieverf1; + args->fhpluscookie[pos] = htonl(NFS_READDIRSIZE); + + cc = rpc_call(fp->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READDIR, + args, 6 * sizeof(uint32_t) + + roundup(fp->fhsize, sizeof(uint32_t)), + rdata.d, sizeof(rdata.d)); + buf = rdata.d; + repl = (struct nfsv3_readdir_repl *)buf; + if (repl->errno != 0) + return (ntohl(repl->errno)); + cookieverf0 = repl->cookiev0; + cookieverf1 = repl->cookiev1; + buf += sizeof (struct nfsv3_readdir_repl); + } + rent = (struct nfsv3_readdir_entry *)buf; + + if (rent->follows == 0) { + /* fid0 is actually eof */ + if (rent->fid0 != 0) { + cookie0 = 0; + cookie1 = 0; + cookieverf0 = 0; + cookieverf1 = 0; + return (ENOENT); + } + goto refill; + } + + d->d_namlen = ntohl(rent->len); + bcopy(rent->nameplus, d->d_name, d->d_namlen); + d->d_name[d->d_namlen] = '\0'; + + pos = roundup(d->d_namlen, sizeof(uint32_t)) / sizeof(uint32_t); + cookie0 = rent->nameplus[pos++]; + cookie1 = rent->nameplus[pos++]; + buf = (u_char *)&rent->nameplus[pos]; + return (0); +} +#endif /* OLD_NFSV2 */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 01:05:11 2010 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 0BE6A10656C2; Thu, 2 Sep 2010 01:05:11 +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 D4B3A8FC17; Thu, 2 Sep 2010 01:05:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8215AS0087185; Thu, 2 Sep 2010 01:05:10 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8215AVd087183; Thu, 2 Sep 2010 01:05:10 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201009020105.o8215AVd087183@svn.freebsd.org> From: Rick Macklem Date: Thu, 2 Sep 2010 01:05: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: r212126 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 01:05:11 -0000 Author: rmacklem Date: Thu Sep 2 01:05:10 2010 New Revision: 212126 URL: http://svn.freebsd.org/changeset/base/212126 Log: Modify pxe.c to use the version of nfs_getrootfh() that returns the file handle's size and was recently committed to lib/libstand/nfs.c. This allows pxeboot to use NFSv3 and work correcty for non-FreeBSD as well as FreeBSD NFS servers. If built with OLD_NFSV2 defined, the old code that predated this patch will be used. Tested by: danny at cs.huji.ac.il Modified: head/sys/boot/i386/libi386/pxe.c Modified: head/sys/boot/i386/libi386/pxe.c ============================================================================== --- head/sys/boot/i386/libi386/pxe.c Thu Sep 2 01:00:13 2010 (r212125) +++ head/sys/boot/i386/libi386/pxe.c Thu Sep 2 01:05:10 2010 (r212126) @@ -409,6 +409,7 @@ pxe_perror(int err) * Reach inside the libstand NFS code and dig out an NFS handle * for the root filesystem. */ +#ifdef OLD_NFSV2 struct nfs_iodesc { struct iodesc *iodesc; off_t off; @@ -456,6 +457,64 @@ pxe_setnfshandle(char *rootpath) sprintf(cp, "X"); setenv("boot.nfsroot.nfshandle", buf, 1); } +#else /* !OLD_NFSV2 */ + +#define NFS_V3MAXFHSIZE 64 + +struct nfs_iodesc { + struct iodesc *iodesc; + off_t off; + uint32_t fhsize; + u_char fh[NFS_V3MAXFHSIZE]; + /* structure truncated */ +}; +extern struct nfs_iodesc nfs_root_node; +extern int rpc_port; + +static void +pxe_rpcmountcall() +{ + struct iodesc *d; + int error; + + if (!(d = socktodesc(pxe_sock))) + return; + d->myport = htons(--rpc_port); + d->destip = rootip; + if ((error = nfs_getrootfh(d, rootpath, &nfs_root_node.fhsize, + nfs_root_node.fh)) != 0) { + printf("NFS MOUNT RPC error: %d\n", error); + nfs_root_node.fhsize = 0; + } + nfs_root_node.iodesc = d; +} + +static void +pxe_setnfshandle(char *rootpath) +{ + int i; + u_char *fh; + char buf[2 * NFS_V3MAXFHSIZE + 3], *cp; + + /* + * If NFS files were never opened, we need to do mount call + * ourselves. Use nfs_root_node.iodesc as flag indicating + * previous NFS usage. + */ + if (nfs_root_node.iodesc == NULL) + pxe_rpcmountcall(); + + fh = &nfs_root_node.fh[0]; + buf[0] = 'X'; + cp = &buf[1]; + for (i = 0; i < nfs_root_node.fhsize; i++, cp += 2) + sprintf(cp, "%02x", fh[i]); + sprintf(cp, "X"); + setenv("boot.nfsroot.nfshandle", buf, 1); + sprintf(buf, "%d", nfs_root_node.fhsize); + setenv("boot.nfsroot.nfshandlelen", buf, 1); +} +#endif /* OLD_NFSV2 */ void pxenv_call(int func) From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 03:28:03 2010 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 DF57210656FC; Thu, 2 Sep 2010 03:28:03 +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 CE5678FC13; Thu, 2 Sep 2010 03:28:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o823S3Ds090284; Thu, 2 Sep 2010 03:28:03 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o823S3pV090276; Thu, 2 Sep 2010 03:28:03 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020328.o823S3pV090276@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 03:28: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: r212127 - 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: Thu, 02 Sep 2010 03:28:04 -0000 Author: thompsa Date: Thu Sep 2 03:28:03 2010 New Revision: 212127 URL: http://svn.freebsd.org/changeset/base/212127 Log: We need to grab a node reference count to vap->iv_bss before using it as it is possible for the node to be replaced and freed at any time by ieee80211_sta_join1(). Modified: head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_rum.c ============================================================================== --- head/sys/dev/usb/wlan/if_rum.c Thu Sep 2 01:05:10 2010 (r212126) +++ head/sys/dev/usb/wlan/if_rum.c Thu Sep 2 03:28:03 2010 (r212127) @@ -719,7 +719,7 @@ rum_newstate(struct ieee80211vap *vap, e break; case IEEE80211_S_RUN: - ni = vap->iv_bss; + ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { rum_update_slot(ic->ic_ifp); @@ -743,6 +743,7 @@ rum_newstate(struct ieee80211vap *vap, e tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) rum_ratectl_start(sc, ni); + ieee80211_free_node(ni); break; default: break; @@ -2223,7 +2224,7 @@ rum_ratectl_task(void *arg, int pending) struct ieee80211com *ic = vap->iv_ic; struct ifnet *ifp = ic->ic_ifp; struct rum_softc *sc = ifp->if_softc; - struct ieee80211_node *ni = vap->iv_bss; + struct ieee80211_node *ni; int ok, fail; int sum, retrycnt; @@ -2237,8 +2238,10 @@ rum_ratectl_task(void *arg, int pending) sum = ok+fail; retrycnt = (le32toh(sc->sta[5]) & 0xffff) + fail; + ni = ieee80211_ref_node(vap->iv_bss); ieee80211_ratectl_tx_update(vap, ni, &sum, &ok, &retrycnt); (void) ieee80211_ratectl_rate(ni, NULL, 0); + ieee80211_free_node(ni); ifp->if_oerrors += fail; /* count TX retry-fail as Tx errors */ Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Thu Sep 2 01:05:10 2010 (r212126) +++ head/sys/dev/usb/wlan/if_run.c Thu Sep 2 03:28:03 2010 (r212127) @@ -1693,7 +1693,6 @@ run_media_change(struct ifnet *ifp) struct ieee80211com *ic = vap->iv_ic; const struct ieee80211_txparam *tp; struct run_softc *sc = ic->ic_ifp->if_softc; - struct run_node *rn = (void *)vap->iv_bss; uint8_t rate, ridx; int error; @@ -1707,13 +1706,19 @@ run_media_change(struct ifnet *ifp) tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { + struct ieee80211_node *ni; + struct run_node *rn; + rate = ic->ic_sup_rates[ic->ic_curmode]. rs_rates[tp->ucastrate] & IEEE80211_RATE_VAL; for (ridx = 0; ridx < RT2860_RIDX_MAX; ridx++) if (rt2860_rates[ridx].rate == rate) break; + ni = ieee80211_ref_node(vap->iv_bss); + rn = (struct run_node *)ni; rn->fix_ridx = ridx; DPRINTF("rate=%d, fix_ridx=%d\n", rate, rn->fix_ridx); + ieee80211_free_node(ni); } #if 0 @@ -1736,7 +1741,6 @@ run_newstate(struct ieee80211vap *vap, e struct run_softc *sc = ic->ic_ifp->if_softc; struct run_vap *rvp = RUN_VAP(vap); enum ieee80211_state ostate; - struct ieee80211_node *ni; uint32_t sta[3]; uint32_t tmp; uint8_t ratectl; @@ -1781,7 +1785,6 @@ run_newstate(struct ieee80211vap *vap, e case IEEE80211_S_RUN: - ni = vap->iv_bss; if (!(sc->runbmap & bid)) { if(sc->running++) restart_ratectl = 1; @@ -1817,12 +1820,16 @@ run_newstate(struct ieee80211vap *vap, e } if (vap->iv_opmode != IEEE80211_M_MONITOR) { + struct ieee80211_node *ni; + run_updateslot(ic->ic_ifp); run_enable_mrr(sc); run_set_txpreamble(sc); run_set_basicrates(sc); + ni = ieee80211_ref_node(vap->iv_bss); IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); run_set_bssid(sc, ni->ni_bssid); + ieee80211_free_node(ni); run_enable_tsf_sync(sc); /* enable automatic rate adaptation */ Modified: head/sys/dev/usb/wlan/if_uath.c ============================================================================== --- head/sys/dev/usb/wlan/if_uath.c Thu Sep 2 01:05:10 2010 (r212126) +++ head/sys/dev/usb/wlan/if_uath.c Thu Sep 2 03:28:03 2010 (r212127) @@ -1968,9 +1968,10 @@ uath_create_connection(struct uath_softc const struct ieee80211_rateset *rs; struct ieee80211com *ic = sc->sc_ifp->if_l2com; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); - struct ieee80211_node *ni = vap->iv_bss; + struct ieee80211_node *ni; struct uath_cmd_create_connection create; + ni = ieee80211_ref_node(vap->iv_bss); bzero(&create, sizeof create); create.connid = htobe32(connid); create.bssid = htobe32(0); @@ -1989,6 +1990,7 @@ uath_create_connection(struct uath_softc create.connattr.wlanmode = htobe32(WLAN_MODE_11g); else create.connattr.wlanmode = htobe32(WLAN_MODE_11b); + ieee80211_free_node(ni); return uath_cmd_write(sc, WDCMSG_CREATE_CONNECTION, &create, sizeof create, 0); @@ -2017,14 +2019,16 @@ uath_write_associd(struct uath_softc *sc { struct ieee80211com *ic = sc->sc_ifp->if_l2com; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); - struct ieee80211_node *ni = vap->iv_bss; + struct ieee80211_node *ni; struct uath_cmd_set_associd associd; + ni = ieee80211_ref_node(vap->iv_bss); bzero(&associd, sizeof associd); associd.defaultrateix = htobe32(1); /* XXX */ associd.associd = htobe32(ni->ni_associd); associd.timoffset = htobe32(0x3b); /* XXX */ IEEE80211_ADDR_COPY(associd.bssid, ni->ni_bssid); + ieee80211_free_node(ni); return uath_cmd_write(sc, WDCMSG_WRITE_ASSOCID, &associd, sizeof associd, 0); } @@ -2065,7 +2069,7 @@ uath_newstate(struct ieee80211vap *vap, { enum ieee80211_state ostate = vap->iv_state; int error; - struct ieee80211_node *ni = vap->iv_bss; + struct ieee80211_node *ni; struct ieee80211com *ic = vap->iv_ic; struct uath_softc *sc = ic->ic_ifp->if_softc; struct uath_vap *uvp = UATH_VAP(vap); @@ -2078,6 +2082,7 @@ uath_newstate(struct ieee80211vap *vap, UATH_LOCK(sc); callout_stop(&sc->stat_ch); callout_stop(&sc->watchdog_ch); + ni = ieee80211_ref_node(vap->iv_bss); switch (nstate) { case IEEE80211_S_INIT: @@ -2150,6 +2155,7 @@ uath_newstate(struct ieee80211vap *vap, default: break; } + ieee80211_free_node(ni); UATH_UNLOCK(sc); IEEE80211_LOCK(ic); return (uvp->newstate(vap, nstate, arg)); Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Thu Sep 2 01:05:10 2010 (r212126) +++ head/sys/dev/usb/wlan/if_upgt.c Thu Sep 2 03:28:03 2010 (r212127) @@ -652,7 +652,6 @@ upgt_set_macfilter(struct upgt_softc *sc struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); - struct ieee80211_node *ni = vap->iv_bss; struct upgt_data *data_cmd; struct upgt_lmac_mem *mem; struct upgt_lmac_filter *filter; @@ -707,6 +706,9 @@ upgt_set_macfilter(struct upgt_softc *sc filter->unknown3 = htole16(UPGT_FILTER_UNKNOWN3); break; case IEEE80211_S_RUN: + struct ieee80211_node *ni; + + ni = ieee80211_ref_node(vap->iv_bss); /* XXX monitor mode isn't tested yet. */ if (vap->iv_opmode == IEEE80211_M_MONITOR) { filter->type = htole16(UPGT_FILTER_TYPE_MONITOR); @@ -730,6 +732,7 @@ upgt_set_macfilter(struct upgt_softc *sc filter->rxhw = htole32(sc->sc_eeprom_hwrx); filter->unknown3 = htole16(UPGT_FILTER_UNKNOWN3); } + ieee80211_free_node(ni); break; default: device_printf(sc->sc_dev, Modified: head/sys/dev/usb/wlan/if_ural.c ============================================================================== --- head/sys/dev/usb/wlan/if_ural.c Thu Sep 2 01:05:10 2010 (r212126) +++ head/sys/dev/usb/wlan/if_ural.c Thu Sep 2 03:28:03 2010 (r212127) @@ -711,7 +711,7 @@ ural_newstate(struct ieee80211vap *vap, break; case IEEE80211_S_RUN: - ni = vap->iv_bss; + ni = ieee80211_ref_node(vap->iv_bss); if (vap->iv_opmode != IEEE80211_M_MONITOR) { ural_update_slot(ic->ic_ifp); @@ -729,6 +729,7 @@ ural_newstate(struct ieee80211vap *vap, "could not allocate beacon\n"); RAL_UNLOCK(sc); IEEE80211_LOCK(ic); + ieee80211_free_node(ni); return (-1); } ieee80211_ref_node(ni); @@ -737,6 +738,7 @@ ural_newstate(struct ieee80211vap *vap, "could not send beacon\n"); RAL_UNLOCK(sc); IEEE80211_LOCK(ic); + ieee80211_free_node(ni); return (-1); } } @@ -754,7 +756,7 @@ ural_newstate(struct ieee80211vap *vap, tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)]; if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) ural_ratectl_start(sc, ni); - + ieee80211_free_node(ni); break; default: @@ -2237,10 +2239,11 @@ ural_ratectl_task(void *arg, int pending struct ieee80211com *ic = vap->iv_ic; struct ifnet *ifp = ic->ic_ifp; struct ural_softc *sc = ifp->if_softc; - struct ieee80211_node *ni = vap->iv_bss; + struct ieee80211_node *ni; int ok, fail; int sum, retrycnt; + ni = ieee80211_ref_node(vap->iv_bss); RAL_LOCK(sc); /* read and clear statistic registers (STA_CSR0 to STA_CSR10) */ ural_read_multi(sc, RAL_STA_CSR0, sc->sta, sizeof(sc->sta)); @@ -2258,6 +2261,7 @@ ural_ratectl_task(void *arg, int pending usb_callout_reset(&uvp->ratectl_ch, hz, ural_ratectl_timeout, uvp); RAL_UNLOCK(sc); + ieee80211_free_node(ni); } static int Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Thu Sep 2 01:05:10 2010 (r212126) +++ head/sys/dev/usb/wlan/if_urtw.c Thu Sep 2 03:28:03 2010 (r212127) @@ -1830,7 +1830,6 @@ urtw_tx_start(struct urtw_softc *sc, str static int urtw_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) { - struct ieee80211_node *ni = vap->iv_bss; struct ieee80211com *ic = vap->iv_ic; struct urtw_softc *sc = ic->ic_ifp->if_softc; struct urtw_vap *uvp = URTW_VAP(vap); @@ -1854,6 +1853,9 @@ urtw_newstate(struct ieee80211vap *vap, case IEEE80211_S_ASSOC: break; case IEEE80211_S_RUN: + struct ieee80211_node *ni; + + ni = ieee80211_ref_node(vap->iv_bss); /* setting bssid. */ urtw_write32_m(sc, URTW_BSSID, ((uint32_t *)ni->ni_bssid)[0]); urtw_write16_m(sc, URTW_BSSID + 4, @@ -1868,6 +1870,7 @@ urtw_newstate(struct ieee80211vap *vap, if (error != 0) device_printf(sc->sc_dev, "could not control LED (%d)\n", error); + ieee80211_free_node(ni); break; default: break; Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Thu Sep 2 01:05:10 2010 (r212126) +++ head/sys/dev/usb/wlan/if_zyd.c Thu Sep 2 03:28:03 2010 (r212127) @@ -572,7 +572,6 @@ zyd_newstate(struct ieee80211vap *vap, e struct zyd_vap *zvp = ZYD_VAP(vap); struct ieee80211com *ic = vap->iv_ic; struct zyd_softc *sc = ic->ic_ifp->if_softc; - struct ieee80211_node *ni; int error; DPRINTF(sc, ZYD_DEBUG_STATE, "%s: %s -> %s\n", __func__, @@ -586,7 +585,6 @@ zyd_newstate(struct ieee80211vap *vap, e zyd_set_chan(sc, ic->ic_curchan); break; case IEEE80211_S_RUN: - ni = vap->iv_bss; if (vap->iv_opmode == IEEE80211_M_MONITOR) break; @@ -598,7 +596,7 @@ zyd_newstate(struct ieee80211vap *vap, e /* make data LED blink upon Tx */ zyd_write32_m(sc, sc->sc_fwbase + ZYD_FW_LINK_STATUS, 1); - IEEE80211_ADDR_COPY(sc->sc_bssid, ni->ni_bssid); + IEEE80211_ADDR_COPY(sc->sc_bssid, vap->iv_bss->ni_bssid); zyd_set_bssid(sc, sc->sc_bssid); break; default: From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 03:42:27 2010 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 F3A4D10656E1; Thu, 2 Sep 2010 03:42:26 +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 E2F098FC19; Thu, 2 Sep 2010 03:42:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o823gQk6090568; Thu, 2 Sep 2010 03:42:26 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o823gQOq090566; Thu, 2 Sep 2010 03:42:26 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020342.o823gQOq090566@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 03:42: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: r212128 - head/sys/dev/usb/input X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 03:42:27 -0000 Author: thompsa Date: Thu Sep 2 03:42:26 2010 New Revision: 212128 URL: http://svn.freebsd.org/changeset/base/212128 Log: Silence debug error by default. PR: usb/141212 Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Thu Sep 2 03:28:03 2010 (r212127) +++ head/sys/dev/usb/input/ukbd.c Thu Sep 2 03:42:26 2010 (r212128) @@ -720,7 +720,7 @@ ukbd_set_leds_callback(struct usb_xfer * break; default: /* Error */ - DPRINTFN(0, "error=%s\n", usbd_errstr(error)); + DPRINTFN(1, "error=%s\n", usbd_errstr(error)); break; } } From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 03:44:56 2010 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 D2CCE10656BC; Thu, 2 Sep 2010 03:44:56 +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 C2CA08FC15; Thu, 2 Sep 2010 03:44:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o823iuEj090659; Thu, 2 Sep 2010 03:44:56 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o823iuhk090657; Thu, 2 Sep 2010 03:44:56 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020344.o823iuhk090657@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 03:44: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: r212129 - head/sys/dev/usb/input X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 03:44:56 -0000 Author: thompsa Date: Thu Sep 2 03:44:56 2010 New Revision: 212129 URL: http://svn.freebsd.org/changeset/base/212129 Log: Add support for extra buttons on the Kensington Slimblade Trackball. Submitted by: Lee, Chung-Yeol Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Thu Sep 2 03:42:26 2010 (r212128) +++ head/sys/dev/usb/input/ums.c Thu Sep 2 03:44:56 2010 (r212129) @@ -399,6 +399,7 @@ ums_hid_parse(struct ums_softc *sc, devi struct ums_info *info = &sc->sc_info[index]; uint32_t flags; uint8_t i; + uint8_t j; if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), hid_input, index, &info->sc_loc_x, &flags, &info->sc_iid_x)) { @@ -476,6 +477,17 @@ ums_hid_parse(struct ums_softc *sc, devi break; } } + + /* detect other buttons */ + + for (j = 0; (i < UMS_BUTTONS_MAX) && (j < 2); i++, j++) { + if (!hid_locate(buf, len, HID_USAGE2(HUP_MICROSOFT, (j + 1)), + hid_input, index, &info->sc_loc_btn[i], NULL, + &info->sc_iid_btn[i])) { + break; + } + } + info->sc_buttons = i; if (i > sc->sc_buttons) From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 03:47:08 2010 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 2506710656C0; Thu, 2 Sep 2010 03:47:08 +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 144668FC1A; Thu, 2 Sep 2010 03:47:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o823l78g090738; Thu, 2 Sep 2010 03:47:07 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o823l7MW090735; Thu, 2 Sep 2010 03:47:07 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020347.o823l7MW090735@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 03:47: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: r212130 - head/sys/dev/usb/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, 02 Sep 2010 03:47:08 -0000 Author: thompsa Date: Thu Sep 2 03:47:07 2010 New Revision: 212130 URL: http://svn.freebsd.org/changeset/base/212130 Log: Add GPIO programming for more PHY hardware. Submitted by: yongari Modified: head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_axereg.h Modified: head/sys/dev/usb/net/if_axe.c ============================================================================== --- head/sys/dev/usb/net/if_axe.c Thu Sep 2 03:44:56 2010 (r212129) +++ head/sys/dev/usb/net/if_axe.c Thu Sep 2 03:47:07 2010 (r212130) @@ -515,12 +515,19 @@ axe_get_phyno(struct axe_softc *sc, int return (phyno); } +#define AXE_GPIO_WRITE(x, y) do { \ + axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, (x), NULL); \ + uether_pause(ue, (y)); \ +} while (0) + static void axe_ax88178_init(struct axe_softc *sc) { - int gpio0 = 0, phymode = 0; - uint16_t eeprom; + struct usb_ether *ue; + int gpio0, phymode; + uint16_t eeprom, val; + ue = &sc->sc_ue; axe_cmd(sc, AXE_CMD_SROM_WR_ENABLE, 0, 0, NULL); /* XXX magic */ axe_cmd(sc, AXE_CMD_SROM_READ, 0, 0x0017, &eeprom); @@ -529,46 +536,89 @@ axe_ax88178_init(struct axe_softc *sc) /* if EEPROM is invalid we have to use to GPIO0 */ if (eeprom == 0xffff) { - phymode = 0; + phymode = AXE_PHY_MODE_MARVELL; gpio0 = 1; } else { - phymode = eeprom & 7; + phymode = eeprom & 0x7f; gpio0 = (eeprom & 0x80) ? 0 : 1; } - axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x008c, NULL); - uether_pause(&sc->sc_ue, hz / 16); - - if ((eeprom >> 8) != 0x01) { - axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x003c, NULL); - uether_pause(&sc->sc_ue, hz / 32); - - axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x001c, NULL); - uether_pause(&sc->sc_ue, hz / 3); - - axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x003c, NULL); - uether_pause(&sc->sc_ue, hz / 32); - } else { - axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x0004, NULL); - uether_pause(&sc->sc_ue, hz / 32); - - axe_cmd(sc, AXE_CMD_WRITE_GPIO, 0, 0x000c, NULL); - uether_pause(&sc->sc_ue, hz / 32); + if (bootverbose) + device_printf(sc->sc_ue.ue_dev, "EEPROM data : 0x%04x\n", + eeprom); + /* Program GPIOs depending on PHY hardware. */ + switch (phymode) { + case AXE_PHY_MODE_MARVELL: + if (gpio0 == 1) { + AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO0_EN, + hz / 32); + AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2 | AXE_GPIO2_EN, + hz / 32); + AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2_EN, hz / 4); + AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2 | AXE_GPIO2_EN, + hz / 32); + } else + AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO1 | + AXE_GPIO1_EN, hz / 32); + break; + case AXE_PHY_MODE_CICADA: + if (gpio0 == 1) + AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO0 | + AXE_GPIO0_EN, hz / 32); + else + AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO1 | + AXE_GPIO1_EN, hz / 32); + break; + case AXE_PHY_MODE_AGERE: + AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO1 | + AXE_GPIO1_EN, hz / 32); + AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN | AXE_GPIO2 | + AXE_GPIO2_EN, hz / 32); + AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN | AXE_GPIO2_EN, hz / 4); + AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN | AXE_GPIO2 | + AXE_GPIO2_EN, hz / 32); + break; + case AXE_PHY_MODE_REALTEK_8211CL: + case AXE_PHY_MODE_REALTEK_8211BN: + case AXE_PHY_MODE_REALTEK_8251CL: + val = gpio0 == 1 ? AXE_GPIO0 | AXE_GPIO0_EN : + AXE_GPIO1 | AXE_GPIO1_EN; + AXE_GPIO_WRITE(val, hz / 32); + AXE_GPIO_WRITE(val | AXE_GPIO2 | AXE_GPIO2_EN, hz / 32); + AXE_GPIO_WRITE(val | AXE_GPIO2_EN, hz / 4); + AXE_GPIO_WRITE(val | AXE_GPIO2 | AXE_GPIO2_EN, hz / 32); + if (phymode == AXE_PHY_MODE_REALTEK_8211CL) { + axe_miibus_writereg(ue->ue_dev, sc->sc_phyno, + 0x1F, 0x0005); + axe_miibus_writereg(ue->ue_dev, sc->sc_phyno, + 0x0C, 0x0000); + val = axe_miibus_readreg(ue->ue_dev, sc->sc_phyno, + 0x0001); + axe_miibus_writereg(ue->ue_dev, sc->sc_phyno, + 0x01, val | 0x0080); + axe_miibus_writereg(ue->ue_dev, sc->sc_phyno, + 0x1F, 0x0000); + } + break; + default: + /* Unknown PHY model or no need to program GPIOs. */ + break; } /* soft reset */ axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_CLEAR, NULL); - uether_pause(&sc->sc_ue, hz / 4); + uether_pause(ue, hz / 4); axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_PRL | AXE_178_RESET_MAGIC, NULL); - uether_pause(&sc->sc_ue, hz / 4); + uether_pause(ue, hz / 4); /* Enable MII/GMII/RGMII interface to work with external PHY. */ axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, 0, NULL); - uether_pause(&sc->sc_ue, hz / 4); + uether_pause(ue, hz / 4); axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL); } +#undef AXE_GPIO_WRITE static void axe_ax88772_init(struct axe_softc *sc) @@ -637,10 +687,9 @@ axe_attach_post(struct usb_ether *ue) * Load PHY indexes first. Needed by axe_xxx_init(). */ axe_cmd(sc, AXE_CMD_READ_PHYID, 0, 0, sc->sc_phyaddrs); -#if 1 - device_printf(sc->sc_ue.ue_dev, "PHYADDR 0x%02x:0x%02x\n", - sc->sc_phyaddrs[0], sc->sc_phyaddrs[1]); -#endif + if (bootverbose) + device_printf(sc->sc_ue.ue_dev, "PHYADDR 0x%02x:0x%02x\n", + sc->sc_phyaddrs[0], sc->sc_phyaddrs[1]); sc->sc_phyno = axe_get_phyno(sc, AXE_PHY_SEL_PRI); if (sc->sc_phyno == -1) sc->sc_phyno = axe_get_phyno(sc, AXE_PHY_SEL_SEC); Modified: head/sys/dev/usb/net/if_axereg.h ============================================================================== --- head/sys/dev/usb/net/if_axereg.h Thu Sep 2 03:44:56 2010 (r212129) +++ head/sys/dev/usb/net/if_axereg.h Thu Sep 2 03:47:07 2010 (r212130) @@ -153,6 +153,25 @@ #define AXE_772_PHY_NO_EPHY 0x10 /* Embedded 10/100 PHY of AX88772 */ +#define AXE_GPIO0_EN 0x01 +#define AXE_GPIO0 0x02 +#define AXE_GPIO1_EN 0x04 +#define AXE_GPIO1 0x08 +#define AXE_GPIO2_EN 0x10 +#define AXE_GPIO2 0x20 +#define AXE_GPIO_RELOAD_EEPROM 0x80 + +#define AXE_PHY_MODE_MARVELL 0x00 +#define AXE_PHY_MODE_CICADA 0x01 +#define AXE_PHY_MODE_AGERE 0x02 +#define AXE_PHY_MODE_CICADA_V2 0x05 +#define AXE_PHY_MODE_AGERE_GMII 0x06 +#define AXE_PHY_MODE_CICADA_V2_ASIX 0x09 +#define AXE_PHY_MODE_REALTEK_8211CL 0x0C +#define AXE_PHY_MODE_REALTEK_8211BN 0x0D +#define AXE_PHY_MODE_REALTEK_8251CL 0x0E +#define AXE_PHY_MODE_ATTANSIC 0x40 + #define AXE_BULK_BUF_SIZE 16384 /* bytes */ #define AXE_CTL_READ 0x01 From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 03:50:12 2010 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 3A67610656A7; Thu, 2 Sep 2010 03:50:12 +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 2A5108FC08; Thu, 2 Sep 2010 03:50:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o823oCvO090840; Thu, 2 Sep 2010 03:50:12 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o823oCga090837; Thu, 2 Sep 2010 03:50:12 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020350.o823oCga090837@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 03:50: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: r212131 - 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: Thu, 02 Sep 2010 03:50:12 -0000 Author: thompsa Date: Thu Sep 2 03:50:11 2010 New Revision: 212131 URL: http://svn.freebsd.org/changeset/base/212131 Log: Fix build breakage from r212127 Modified: head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_urtw.c Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Thu Sep 2 03:47:07 2010 (r212130) +++ head/sys/dev/usb/wlan/if_upgt.c Thu Sep 2 03:50:11 2010 (r212131) @@ -652,6 +652,7 @@ upgt_set_macfilter(struct upgt_softc *sc struct ifnet *ifp = sc->sc_ifp; struct ieee80211com *ic = ifp->if_l2com; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct ieee80211_node *ni; struct upgt_data *data_cmd; struct upgt_lmac_mem *mem; struct upgt_lmac_filter *filter; @@ -706,8 +707,6 @@ upgt_set_macfilter(struct upgt_softc *sc filter->unknown3 = htole16(UPGT_FILTER_UNKNOWN3); break; case IEEE80211_S_RUN: - struct ieee80211_node *ni; - ni = ieee80211_ref_node(vap->iv_bss); /* XXX monitor mode isn't tested yet. */ if (vap->iv_opmode == IEEE80211_M_MONITOR) { Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Thu Sep 2 03:47:07 2010 (r212130) +++ head/sys/dev/usb/wlan/if_urtw.c Thu Sep 2 03:50:11 2010 (r212131) @@ -1833,6 +1833,7 @@ urtw_newstate(struct ieee80211vap *vap, struct ieee80211com *ic = vap->iv_ic; struct urtw_softc *sc = ic->ic_ifp->if_softc; struct urtw_vap *uvp = URTW_VAP(vap); + struct ieee80211_node *ni; usb_error_t error = 0; DPRINTF(sc, URTW_DEBUG_STATE, "%s: %s -> %s\n", __func__, @@ -1853,8 +1854,6 @@ urtw_newstate(struct ieee80211vap *vap, case IEEE80211_S_ASSOC: break; case IEEE80211_S_RUN: - struct ieee80211_node *ni; - ni = ieee80211_ref_node(vap->iv_bss); /* setting bssid. */ urtw_write32_m(sc, URTW_BSSID, ((uint32_t *)ni->ni_bssid)[0]); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 03:52:04 2010 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 6EF5E1065742; Thu, 2 Sep 2010 03:52:04 +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 5F24F8FC13; Thu, 2 Sep 2010 03:52:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o823q4iX090916; Thu, 2 Sep 2010 03:52:04 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o823q4vH090914; Thu, 2 Sep 2010 03:52:04 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020352.o823q4vH090914@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 03:52: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: r212132 - head/sys/dev/usb/input X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 03:52:04 -0000 Author: thompsa Date: Thu Sep 2 03:52:04 2010 New Revision: 212132 URL: http://svn.freebsd.org/changeset/base/212132 Log: Fix UMS_BUTTON_MAX define name Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Thu Sep 2 03:50:11 2010 (r212131) +++ head/sys/dev/usb/input/ums.c Thu Sep 2 03:52:04 2010 (r212132) @@ -480,7 +480,7 @@ ums_hid_parse(struct ums_softc *sc, devi /* detect other buttons */ - for (j = 0; (i < UMS_BUTTONS_MAX) && (j < 2); i++, j++) { + for (j = 0; (i < UMS_BUTTON_MAX) && (j < 2); i++, j++) { if (!hid_locate(buf, len, HID_USAGE2(HUP_MICROSOFT, (j + 1)), hid_input, index, &info->sc_loc_btn[i], NULL, &info->sc_iid_btn[i])) { From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 03:55:09 2010 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 0F10810656B6; Thu, 2 Sep 2010 03:55:09 +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 F316C8FC19; Thu, 2 Sep 2010 03:55:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o823t8OW091022; Thu, 2 Sep 2010 03:55:08 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o823t8tk091020; Thu, 2 Sep 2010 03:55:08 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020355.o823t8tk091020@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 03:55: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: r212133 - head/sys/dev/usb/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, 02 Sep 2010 03:55:09 -0000 Author: thompsa Date: Thu Sep 2 03:55:08 2010 New Revision: 212133 URL: http://svn.freebsd.org/changeset/base/212133 Log: Fix setting of the rx_max and tx_max variables. If the expected buffer size is greater than 65535 bytes then the CDC driver might not work as expected, which is not likely with the existing USB speeds. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/net/if_cdce.c Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Thu Sep 2 03:52:04 2010 (r212132) +++ head/sys/dev/usb/net/if_cdce.c Thu Sep 2 03:55:08 2010 (r212133) @@ -312,14 +312,14 @@ cdce_ncm_init(struct cdce_softc *sc) /* Read correct set of parameters according to device mode */ if (usbd_get_mode(sc->sc_ue.ue_udev) == USB_MODE_HOST) { - sc->sc_ncm.rx_max = UGETW(temp.dwNtbInMaxSize); - sc->sc_ncm.tx_max = UGETW(temp.dwNtbOutMaxSize); + sc->sc_ncm.rx_max = UGETDW(temp.dwNtbInMaxSize); + sc->sc_ncm.tx_max = UGETDW(temp.dwNtbOutMaxSize); sc->sc_ncm.tx_remainder = UGETW(temp.wNdpOutPayloadRemainder); sc->sc_ncm.tx_modulus = UGETW(temp.wNdpOutDivisor); sc->sc_ncm.tx_struct_align = UGETW(temp.wNdpOutAlignment); } else { - sc->sc_ncm.rx_max = UGETW(temp.dwNtbOutMaxSize); - sc->sc_ncm.tx_max = UGETW(temp.dwNtbInMaxSize); + sc->sc_ncm.rx_max = UGETDW(temp.dwNtbOutMaxSize); + sc->sc_ncm.tx_max = UGETDW(temp.dwNtbInMaxSize); sc->sc_ncm.tx_remainder = UGETW(temp.wNdpInPayloadRemainder); sc->sc_ncm.tx_modulus = UGETW(temp.wNdpInDivisor); sc->sc_ncm.tx_struct_align = UGETW(temp.wNdpInAlignment); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 04:01:19 2010 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 0577E106573A; Thu, 2 Sep 2010 04:01:19 +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 E90218FC0C; Thu, 2 Sep 2010 04:01:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8241Iie091212; Thu, 2 Sep 2010 04:01:18 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8241ImG091204; Thu, 2 Sep 2010 04:01:18 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020401.o8241ImG091204@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 04:01: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: r212134 - in head/sys/dev/usb: . controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 04:01:19 -0000 Author: thompsa Date: Thu Sep 2 04:01:18 2010 New Revision: 212134 URL: http://svn.freebsd.org/changeset/base/212134 Log: Change argument for usbd_get_dma_delay() from USB bus to USB device, some embedded hardware needs to know exactly which device is in question before it exactly can decide the required delay. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_transfer.c head/sys/dev/usb/usb_transfer.h Modified: head/sys/dev/usb/controller/ehci.c ============================================================================== --- head/sys/dev/usb/controller/ehci.c Thu Sep 2 03:55:08 2010 (r212133) +++ head/sys/dev/usb/controller/ehci.c Thu Sep 2 04:01:18 2010 (r212134) @@ -3804,7 +3804,7 @@ done: } static void -ehci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) +ehci_get_dma_delay(struct usb_device *udev, uint32_t *pus) { /* * Wait until the hardware has finished any possible use of Modified: head/sys/dev/usb/controller/ohci.c ============================================================================== --- head/sys/dev/usb/controller/ohci.c Thu Sep 2 03:55:08 2010 (r212133) +++ head/sys/dev/usb/controller/ohci.c Thu Sep 2 04:01:18 2010 (r212134) @@ -2630,7 +2630,7 @@ ohci_xfer_unsetup(struct usb_xfer *xfer) } static void -ohci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) +ohci_get_dma_delay(struct usb_device *udev, uint32_t *pus) { /* * Wait until hardware has finished any possible use of the Modified: head/sys/dev/usb/controller/uhci.c ============================================================================== --- head/sys/dev/usb/controller/uhci.c Thu Sep 2 03:55:08 2010 (r212133) +++ head/sys/dev/usb/controller/uhci.c Thu Sep 2 04:01:18 2010 (r212134) @@ -3084,7 +3084,7 @@ uhci_xfer_unsetup(struct usb_xfer *xfer) } static void -uhci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) +uhci_get_dma_delay(struct usb_device *udev, uint32_t *pus) { /* * Wait until hardware has finished any possible use of the Modified: head/sys/dev/usb/usb_controller.h ============================================================================== --- head/sys/dev/usb/usb_controller.h Thu Sep 2 03:55:08 2010 (r212133) +++ head/sys/dev/usb/usb_controller.h Thu Sep 2 04:01:18 2010 (r212134) @@ -62,7 +62,7 @@ struct usb_bus_methods { struct usb_endpoint_descriptor *, struct usb_endpoint *); void (*xfer_setup) (struct usb_setup_params *); void (*xfer_unsetup) (struct usb_xfer *); - void (*get_dma_delay) (struct usb_bus *, uint32_t *); + void (*get_dma_delay) (struct usb_device *, uint32_t *); void (*device_suspend) (struct usb_device *); void (*device_resume) (struct usb_device *); void (*set_hw_power) (struct usb_bus *); Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Thu Sep 2 03:55:08 2010 (r212133) +++ head/sys/dev/usb/usb_hub.c Thu Sep 2 04:01:18 2010 (r212134) @@ -2105,8 +2105,9 @@ repeat: (udev->bus->methods->device_suspend) (udev); /* do DMA delay */ - temp = usbd_get_dma_delay(udev->bus); - usb_pause_mtx(NULL, USB_MS_TO_TICKS(temp)); + temp = usbd_get_dma_delay(udev); + if (temp != 0) + usb_pause_mtx(NULL, USB_MS_TO_TICKS(temp)); } /* suspend current port */ Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Thu Sep 2 03:55:08 2010 (r212133) +++ head/sys/dev/usb/usb_transfer.c Thu Sep 2 04:01:18 2010 (r212134) @@ -158,12 +158,16 @@ usbd_update_max_frame_size(struct usb_xf * Else: milliseconds of DMA delay *------------------------------------------------------------------------*/ usb_timeout_t -usbd_get_dma_delay(struct usb_bus *bus) +usbd_get_dma_delay(struct usb_device *udev) { - uint32_t temp = 0; + struct usb_bus_methods *mtod; + uint32_t temp; - if (bus->methods->get_dma_delay) { - (bus->methods->get_dma_delay) (bus, &temp); + mtod = udev->bus->methods; + temp = 0; + + if (mtod->get_dma_delay) { + (mtod->get_dma_delay) (udev, &temp); /* * Round up and convert to milliseconds. Note that we use * 1024 milliseconds per second. to save a division. @@ -1094,9 +1098,11 @@ usbd_transfer_unsetup_sub(struct usb_xfe if (needs_delay) { usb_timeout_t temp; - temp = usbd_get_dma_delay(info->bus); - usb_pause_mtx(&info->bus->bus_mtx, - USB_MS_TO_TICKS(temp)); + temp = usbd_get_dma_delay(info->udev); + if (temp != 0) { + usb_pause_mtx(&info->bus->bus_mtx, + USB_MS_TO_TICKS(temp)); + } } /* make sure that our done messages are not queued anywhere */ @@ -2577,7 +2583,7 @@ usbd_callback_wrapper_sub(struct usb_xfe /* we can not cancel this delay */ xfer->flags_int.can_cancel_immed = 0; - temp = usbd_get_dma_delay(xfer->xroot->bus); + temp = usbd_get_dma_delay(xfer->xroot->udev); DPRINTFN(3, "DMA delay, %u ms, " "on %p\n", temp, xfer); Modified: head/sys/dev/usb/usb_transfer.h ============================================================================== --- head/sys/dev/usb/usb_transfer.h Thu Sep 2 03:55:08 2010 (r212133) +++ head/sys/dev/usb/usb_transfer.h Thu Sep 2 04:01:18 2010 (r212134) @@ -131,7 +131,7 @@ usb_callback_t usb_handle_request_callba usb_callback_t usb_do_clear_stall_callback; void usbd_transfer_timeout_ms(struct usb_xfer *xfer, void (*cb) (void *arg), usb_timeout_t ms); -usb_timeout_t usbd_get_dma_delay(struct usb_bus *bus); +usb_timeout_t usbd_get_dma_delay(struct usb_device *udev); void usbd_transfer_power_ref(struct usb_xfer *xfer, int val); #endif /* _USB_TRANSFER_H_ */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 04:05:00 2010 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 97222106570C; Thu, 2 Sep 2010 04:05:00 +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 865FE8FC0C; Thu, 2 Sep 2010 04:05:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82450Nw091328; Thu, 2 Sep 2010 04:05:00 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82450NW091321; Thu, 2 Sep 2010 04:05:00 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020405.o82450NW091321@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 04:05: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: r212135 - head/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: Thu, 02 Sep 2010 04:05:00 -0000 Author: thompsa Date: Thu Sep 2 04:05:00 2010 New Revision: 212135 URL: http://svn.freebsd.org/changeset/base/212135 Log: Add support for power mode filtering as some USB hardware does not support power saving. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_generic.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usbdi.h Modified: head/sys/dev/usb/usb_controller.h ============================================================================== --- head/sys/dev/usb/usb_controller.h Thu Sep 2 04:01:18 2010 (r212134) +++ head/sys/dev/usb/usb_controller.h Thu Sep 2 04:05:00 2010 (r212135) @@ -102,6 +102,10 @@ struct usb_bus_methods { /* Optional transfer polling support */ void (*xfer_poll) (struct usb_bus *); + + /* Optional fixed power mode support */ + + void (*get_power_mode) (struct usb_device *udev, int8_t *pmode); }; /* Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Thu Sep 2 04:01:18 2010 (r212134) +++ head/sys/dev/usb/usb_device.c Thu Sep 2 04:05:00 2010 (r212135) @@ -1524,7 +1524,7 @@ usb_alloc_device(device_t parent_dev, st * of USB devices out there that do not work very well with * automatic suspend and resume! */ - udev->power_mode = USB_POWER_MODE_ON; + udev->power_mode = usbd_filter_power_mode(udev, USB_POWER_MODE_ON); udev->pwr_save.last_xfer_time = ticks; /* we are not ready yet */ udev->refcount = 1; Modified: head/sys/dev/usb/usb_generic.c ============================================================================== --- head/sys/dev/usb/usb_generic.c Thu Sep 2 04:01:18 2010 (r212134) +++ head/sys/dev/usb/usb_generic.c Thu Sep 2 04:05:00 2010 (r212135) @@ -1791,10 +1791,9 @@ ugen_get_power_mode(struct usb_fifo *f) { struct usb_device *udev = f->udev; - if ((udev == NULL) || - (udev->parent_hub == NULL)) { + if (udev == NULL) return (USB_POWER_MODE_ON); - } + return (udev->power_mode); } Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Thu Sep 2 04:01:18 2010 (r212134) +++ head/sys/dev/usb/usb_hub.c Thu Sep 2 04:05:00 2010 (r212135) @@ -2133,12 +2133,39 @@ usbd_set_power_mode(struct usb_device *u { /* filter input argument */ if ((power_mode != USB_POWER_MODE_ON) && - (power_mode != USB_POWER_MODE_OFF)) { + (power_mode != USB_POWER_MODE_OFF)) power_mode = USB_POWER_MODE_SAVE; - } + + power_mode = usbd_filter_power_mode(udev, power_mode); + udev->power_mode = power_mode; /* update copy of power mode */ #if USB_HAVE_POWERD usb_bus_power_update(udev->bus); #endif } + +/*------------------------------------------------------------------------* + * usbd_filter_power_mode + * + * This function filters the power mode based on hardware requirements. + *------------------------------------------------------------------------*/ +uint8_t +usbd_filter_power_mode(struct usb_device *udev, uint8_t power_mode) +{ + struct usb_bus_methods *mtod; + int8_t temp; + + mtod = udev->bus->methods; + temp = -1; + + if (mtod->get_power_mode != NULL) + (mtod->get_power_mode) (udev, &temp); + + /* check if we should not filter */ + if (temp < 0) + return (power_mode); + + /* use fixed power mode given by hardware driver */ + return (temp); +} Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Thu Sep 2 04:01:18 2010 (r212134) +++ head/sys/dev/usb/usbdi.h Thu Sep 2 04:05:00 2010 (r212135) @@ -479,6 +479,7 @@ void usbd_set_parent_iface(struct usb_de uint8_t usbd_get_bus_index(struct usb_device *udev); uint8_t usbd_get_device_index(struct usb_device *udev); void usbd_set_power_mode(struct usb_device *udev, uint8_t power_mode); +uint8_t usbd_filter_power_mode(struct usb_device *udev, uint8_t power_mode); uint8_t usbd_device_attached(struct usb_device *udev); void usbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen, From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 04:39:45 2010 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 F141B10656ED; Thu, 2 Sep 2010 04:39:45 +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 DF7808FC1D; Thu, 2 Sep 2010 04:39:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o824dj82092110; Thu, 2 Sep 2010 04:39:45 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o824dj41092102; Thu, 2 Sep 2010 04:39:45 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201009020439.o824dj41092102@svn.freebsd.org> From: Andrew Thompson Date: Thu, 2 Sep 2010 04:39: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: r212136 - in head/sys/dev/usb: . net serial storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 04:39:46 -0000 Author: thompsa Date: Thu Sep 2 04:39:45 2010 New Revision: 212136 URL: http://svn.freebsd.org/changeset/base/212136 Log: Reduce the need to accesss struct usb_device by providing functions to access the product, manufacturer and serial strings. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb/net/uhso.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/storage/umass.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_generic.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usbdi_util.h Modified: head/sys/dev/usb/net/uhso.c ============================================================================== --- head/sys/dev/usb/net/uhso.c Thu Sep 2 04:05:00 2010 (r212135) +++ head/sys/dev/usb/net/uhso.c Thu Sep 2 04:39:45 2010 (r212136) @@ -62,13 +62,11 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR uhso_debug #include #include -#include #include -#include -#include -#include #include +#include + struct uhso_tty { struct uhso_softc *ht_sc; struct usb_xfer *ht_xfer[3]; @@ -513,7 +511,7 @@ uhso_probe(device_t self) return (ENXIO); if (uaa->info.bConfigIndex != 0) return (ENXIO); - if (uaa->device->ddesc.bDeviceClass != 0xff) + if (uaa->info.bDeviceClass != 0xff) return (ENXIO); error = usbd_lookup_id_by_uaa(uhso_devs, sizeof(uhso_devs), uaa); @@ -603,8 +601,9 @@ uhso_attach(device_t self) /* Announce device */ device_printf(self, "<%s port> at <%s %s> on %s\n", uhso_port_type[UHSO_IFACE_PORT_TYPE(sc->sc_type)], - uaa->device->manufacturer, uaa->device->product, - device_get_nameunit(uaa->device->bus->bdev)); + usb_get_manufacturer(uaa->device), + usb_get_product(uaa->device), + device_get_nameunit(device_get_parent(self))); if (sc->sc_ttys > 0) { SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "ports", Modified: head/sys/dev/usb/serial/ubser.c ============================================================================== --- head/sys/dev/usb/serial/ubser.c Thu Sep 2 04:05:00 2010 (r212135) +++ head/sys/dev/usb/serial/ubser.c Thu Sep 2 04:39:45 2010 (r212136) @@ -104,7 +104,6 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR ubser_debug #include #include -#include #include @@ -226,7 +225,7 @@ ubser_probe(device_t dev) return (ENXIO); } /* check if this is a BWCT vendor specific ubser interface */ - if ((strcmp(uaa->device->manufacturer, "BWCT") == 0) && + if ((strcmp(usb_get_manufacturer(uaa->device), "BWCT") == 0) && (uaa->info.bInterfaceClass == 0xff) && (uaa->info.bInterfaceSubClass == 0x00)) return (0); Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Thu Sep 2 04:05:00 2010 (r212135) +++ head/sys/dev/usb/storage/umass.c Thu Sep 2 04:39:45 2010 (r212136) @@ -124,7 +124,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "usbdevs.h" #include @@ -2304,23 +2304,24 @@ umass_cam_action(struct cam_sim *sim, un if (umass_std_transform(sc, ccb, cmd, ccb->csio.cdb_len)) { if (sc->sc_transfer.cmd_data[0] == INQUIRY) { + const char *pserial; + + pserial = usb_get_serial(sc->sc_udev); /* * Umass devices don't generally report their serial numbers * in the usual SCSI way. Emulate it here. */ if ((sc->sc_transfer.cmd_data[1] & SI_EVPD) && - sc->sc_transfer.cmd_data[2] == SVPD_UNIT_SERIAL_NUMBER && - sc->sc_udev != NULL && - sc->sc_udev->serial != NULL && - sc->sc_udev->serial[0] != '\0') { + (sc->sc_transfer.cmd_data[2] == SVPD_UNIT_SERIAL_NUMBER) && + (pserial[0] != '\0')) { struct scsi_vpd_unit_serial_number *vpd_serial; vpd_serial = (struct scsi_vpd_unit_serial_number *)ccb->csio.data_ptr; - vpd_serial->length = strlen(sc->sc_udev->serial); + vpd_serial->length = strlen(pserial); if (vpd_serial->length > sizeof(vpd_serial->serial_num)) vpd_serial->length = sizeof(vpd_serial->serial_num); - memcpy(vpd_serial->serial_num, sc->sc_udev->serial, vpd_serial->length); + memcpy(vpd_serial->serial_num, pserial, vpd_serial->length); ccb->csio.scsi_status = SCSI_STATUS_OK; ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -2553,9 +2554,7 @@ umass_cam_cb(struct umass_softc *sc, uni sc->sc_transfer.cmd_data[0] == INQUIRY && (sc->sc_transfer.cmd_data[1] & SI_EVPD) && sc->sc_transfer.cmd_data[2] == SVPD_SUPPORTED_PAGE_LIST && - sc->sc_udev != NULL && - sc->sc_udev->serial != NULL && - sc->sc_udev->serial[0] != '\0') { + (usb_get_serial(sc->sc_udev)[0] != '\0')) { struct ccb_scsiio *csio; struct scsi_vpd_supported_page_list *page_list; Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Thu Sep 2 04:05:00 2010 (r212135) +++ head/sys/dev/usb/usb_device.c Thu Sep 2 04:39:45 2010 (r212136) @@ -136,6 +136,24 @@ usb_statestr(enum usb_dev_state state) return ((state < USB_STATE_MAX) ? statestr[state] : "UNKNOWN"); } +const char * +usb_get_manufacturer(struct usb_device *udev) +{ + return (udev->manufacturer ? udev->manufacturer : "Unknown"); +} + +const char * +usb_get_product(struct usb_device *udev) +{ + return (udev->product ? udev->product : ""); +} + +const char * +usb_get_serial(struct usb_device *udev) +{ + return (udev->serial ? udev->serial : ""); +} + /*------------------------------------------------------------------------* * usbd_get_ep_by_addr * @@ -1833,7 +1851,8 @@ config_done: udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name); /* Announce device */ - printf("%s: <%s> at %s\n", udev->ugen_name, udev->manufacturer, + printf("%s: <%s> at %s\n", udev->ugen_name, + usb_get_manufacturer(udev), device_get_nameunit(udev->bus->bdev)); usb_notify_addq("ATTACH", udev); @@ -1985,7 +2004,7 @@ usb_free_device(struct usb_device *udev, usb_notify_addq("DETACH", udev); printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name, - udev->manufacturer, device_get_nameunit(bus->bdev)); + usb_get_manufacturer(udev), device_get_nameunit(bus->bdev)); /* Destroy UGEN symlink, if any */ if (udev->ugen_symlink) { @@ -2150,7 +2169,8 @@ usb_devinfo(struct usb_device *udev, cha if (udd->bDeviceClass != 0xFF) { snprintf(dst_ptr, dst_len, "%s %s, class %d/%d, rev %x.%02x/" "%x.%02x, addr %d", - udev->manufacturer, udev->product, + usb_get_manufacturer(udev), + usb_get_product(udev), udd->bDeviceClass, udd->bDeviceSubClass, (bcdUSB >> 8), bcdUSB & 0xFF, (bcdDevice >> 8), bcdDevice & 0xFF, @@ -2158,7 +2178,8 @@ usb_devinfo(struct usb_device *udev, cha } else { snprintf(dst_ptr, dst_len, "%s %s, rev %x.%02x/" "%x.%02x, addr %d", - udev->manufacturer, udev->product, + usb_get_manufacturer(udev), + usb_get_product(udev), (bcdUSB >> 8), bcdUSB & 0xFF, (bcdDevice >> 8), bcdDevice & 0xFF, udev->address); @@ -2397,7 +2418,7 @@ usb_notify_addq_compat(const char *type, UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, udev->ddesc.bDeviceSubClass, - udev->serial, + usb_get_serial(udev), UGETW(udev->ddesc.bcdDevice), udev->port_no, udev->parent_hub != NULL ? @@ -2437,7 +2458,7 @@ usb_notify_addq(const char *type, struct UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, udev->ddesc.bDeviceSubClass, - udev->serial, + usb_get_serial(udev), UGETW(udev->ddesc.bcdDevice), (udev->flags.usb_mode == USB_MODE_HOST) ? "host" : "device", udev->port_no, @@ -2476,7 +2497,7 @@ usb_notify_addq(const char *type, struct UGETW(udev->ddesc.idProduct), udev->ddesc.bDeviceClass, udev->ddesc.bDeviceSubClass, - udev->serial, + usb_get_serial(udev), UGETW(udev->ddesc.bcdDevice), (udev->flags.usb_mode == USB_MODE_HOST) ? "host" : "device", iface->idesc->bInterfaceNumber, Modified: head/sys/dev/usb/usb_generic.c ============================================================================== --- head/sys/dev/usb/usb_generic.c Thu Sep 2 04:05:00 2010 (r212135) +++ head/sys/dev/usb/usb_generic.c Thu Sep 2 04:39:45 2010 (r212136) @@ -825,9 +825,9 @@ usb_gen_fill_deviceinfo(struct usb_fifo di->udi_bus = device_get_unit(udev->bus->bdev); di->udi_addr = udev->address; di->udi_index = udev->device_index; - strlcpy(di->udi_serial, udev->serial, sizeof(di->udi_serial)); - strlcpy(di->udi_vendor, udev->manufacturer, sizeof(di->udi_vendor)); - strlcpy(di->udi_product, udev->product, sizeof(di->udi_product)); + strlcpy(di->udi_serial, usb_get_serial(udev), sizeof(di->udi_serial)); + strlcpy(di->udi_vendor, usb_get_manufacturer(udev), sizeof(di->udi_vendor)); + strlcpy(di->udi_product, usb_get_product(udev), sizeof(di->udi_product)); usb_printbcd(di->udi_release, sizeof(di->udi_release), UGETW(udev->ddesc.bcdDevice)); di->udi_vendorNo = UGETW(udev->ddesc.idVendor); Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Thu Sep 2 04:05:00 2010 (r212135) +++ head/sys/dev/usb/usb_hub.c Thu Sep 2 04:39:45 2010 (r212136) @@ -53,6 +53,7 @@ #include #include #include +#include #define USB_DEBUG_VAR uhub_debug @@ -1059,7 +1060,7 @@ uhub_child_pnpinfo_string(device_t paren UGETW(res.udev->ddesc.idProduct), res.udev->ddesc.bDeviceClass, res.udev->ddesc.bDeviceSubClass, - res.udev->serial, + usb_get_serial(res.udev), UGETW(res.udev->ddesc.bcdDevice), iface->idesc->bInterfaceClass, iface->idesc->bInterfaceSubClass); Modified: head/sys/dev/usb/usbdi_util.h ============================================================================== --- head/sys/dev/usb/usbdi_util.h Thu Sep 2 04:05:00 2010 (r212135) +++ head/sys/dev/usb/usbdi_util.h Thu Sep 2 04:39:45 2010 (r212136) @@ -78,4 +78,11 @@ usb_error_t usbd_req_set_protocol(struct usb_error_t usbd_req_set_report(struct usb_device *udev, struct mtx *mtx, void *data, uint16_t len, uint8_t iface_index, uint8_t type, uint8_t id); + +/* The following functions will not return NULL strings. */ + +const char *usb_get_manufacturer(struct usb_device *); +const char *usb_get_product(struct usb_device *); +const char *usb_get_serial(struct usb_device *); + #endif /* _USB_USBDI_UTIL_H_ */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 04:56:01 2010 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 A64C610656C4; Thu, 2 Sep 2010 04:56:01 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9580A8FC20; Thu, 2 Sep 2010 04:56:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o824u1IH092519; Thu, 2 Sep 2010 04:56:01 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o824u1gG092517; Thu, 2 Sep 2010 04:56:01 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201009020456.o824u1gG092517@svn.freebsd.org> From: Brian Somers Date: Thu, 2 Sep 2010 04:56: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: r212137 - 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: Thu, 02 Sep 2010 04:56:01 -0000 Author: brian Date: Thu Sep 2 04:56:01 2010 New Revision: 212137 URL: http://svn.freebsd.org/changeset/base/212137 Log: MFC r211684 & r211818; return ENOENT if we fall off the end of the directory. Modified: stable/8/sys/kern/vfs_default.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/vfs_default.c ============================================================================== --- stable/8/sys/kern/vfs_default.c Thu Sep 2 04:39:45 2010 (r212136) +++ stable/8/sys/kern/vfs_default.c Thu Sep 2 04:56:01 2010 (r212137) @@ -284,6 +284,9 @@ get_next_dirent(struct vnode *vp, struct *cpos = dirbuf; *len = (dirbuflen - uio.uio_resid); + + if (*len == 0) + return (ENOENT); } dp = (struct dirent *)(*cpos); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 05:07:35 2010 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 31E091065726; Thu, 2 Sep 2010 05:07:35 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20FCC8FC0A; Thu, 2 Sep 2010 05:07:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8257ZZ2092794; Thu, 2 Sep 2010 05:07:35 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8257ZHw092792; Thu, 2 Sep 2010 05:07:35 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201009020507.o8257ZHw092792@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 2 Sep 2010 05:07: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: r212138 - head/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: Thu, 02 Sep 2010 05:07:35 -0000 Author: maxim Date: Thu Sep 2 05:07:34 2010 New Revision: 212138 URL: http://svn.freebsd.org/changeset/base/212138 Log: o csup(1) does not have -g flag. Remove it from the example. PR: conf/150214 Submitted by: Li MFC after: 1 week Modified: head/share/examples/etc/make.conf Modified: head/share/examples/etc/make.conf ============================================================================== --- head/share/examples/etc/make.conf Thu Sep 2 04:56:01 2010 (r212137) +++ head/share/examples/etc/make.conf Thu Sep 2 05:07:34 2010 (r212138) @@ -180,7 +180,7 @@ #SUP_UPDATE= # #SUP= /usr/bin/csup -#SUPFLAGS= -g -L 2 +#SUPFLAGS= -L 2 #SUPHOST= cvsup.uk.FreeBSD.org #SUPFILE= /usr/share/examples/cvsup/standard-supfile #PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 05:26:44 2010 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 CF05110656BF; Thu, 2 Sep 2010 05:26:44 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from mp2.macomnet.net (cl-2958.ham-01.de.sixxs.net [IPv6:2001:6f8:900:b8d::2]) by mx1.freebsd.org (Postfix) with ESMTP id 597388FC08; Thu, 2 Sep 2010 05:26:44 +0000 (UTC) Received: from localhost (localhost [IPv6:::1]) by mp2.macomnet.net (8.14.3/8.14.3) with ESMTP id o825QgJM054060; Thu, 2 Sep 2010 09:26:42 +0400 (MSD) (envelope-from maxim.konovalov@gmail.com) Date: Thu, 2 Sep 2010 09:26:41 +0400 (MSD) From: Maxim Konovalov To: src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG In-Reply-To: <201009020507.o8257ZHw092792@svn.freebsd.org> Message-ID: References: <201009020507.o8257ZHw092792@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Subject: Re: svn commit: r212138 - head/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: Thu, 02 Sep 2010 05:26:44 -0000 Just a short followup: csup(1) actually has '-g' (command line mode, no graphics) flag for compatibility with cvsup(1) while doesn't announce it in usage(). We still have "SUPFLAGS=-g -L2" in src/Makefile.inc1 and perhaps it's time to remove '-g' there too. On Thu, 2 Sep 2010, 05:07-0000, Maxim Konovalov wrote: > Author: maxim > Date: Thu Sep 2 05:07:34 2010 > New Revision: 212138 > URL: http://svn.freebsd.org/changeset/base/212138 > > Log: > o csup(1) does not have -g flag. Remove it from the example. > > PR: conf/150214 > Submitted by: Li > MFC after: 1 week > > Modified: > head/share/examples/etc/make.conf > > Modified: head/share/examples/etc/make.conf > ============================================================================== > --- head/share/examples/etc/make.conf Thu Sep 2 04:56:01 2010 (r212137) > +++ head/share/examples/etc/make.conf Thu Sep 2 05:07:34 2010 (r212138) > @@ -180,7 +180,7 @@ > #SUP_UPDATE= > # > #SUP= /usr/bin/csup > -#SUPFLAGS= -g -L 2 > +#SUPFLAGS= -L 2 > #SUPHOST= cvsup.uk.FreeBSD.org > #SUPFILE= /usr/share/examples/cvsup/standard-supfile > #PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile > -- Maxim Konovalov From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 06:07:03 2010 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 6FD4C106566C; Thu, 2 Sep 2010 06:07:03 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EA9B8FC1A; Thu, 2 Sep 2010 06:07:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82673Hh094181; Thu, 2 Sep 2010 06:07:03 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82673fA094178; Thu, 2 Sep 2010 06:07:03 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201009020607.o82673fA094178@svn.freebsd.org> From: Maxim Konovalov Date: Thu, 2 Sep 2010 06:07:03 +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: r212139 - stable/8/sbin/kldload X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 06:07:03 -0000 Author: maxim Date: Thu Sep 2 06:07:03 2010 New Revision: 212139 URL: http://svn.freebsd.org/changeset/base/212139 Log: MFC r209970,209971,211990: add -q flag to usage() and man page synopsys. Modified: stable/8/sbin/kldload/kldload.8 stable/8/sbin/kldload/kldload.c Directory Properties: stable/8/sbin/kldload/ (props changed) Modified: stable/8/sbin/kldload/kldload.8 ============================================================================== --- stable/8/sbin/kldload/kldload.8 Thu Sep 2 05:07:34 2010 (r212138) +++ stable/8/sbin/kldload/kldload.8 Thu Sep 2 06:07:03 2010 (r212139) @@ -33,7 +33,7 @@ .Nd load a file into the kernel .Sh SYNOPSIS .Nm -.Op Fl v +.Op Fl qv .Ar .Sh DESCRIPTION The @@ -60,7 +60,7 @@ The utility will warn if a module is requested as a bare filename and is present in the current directory. .Pp -The following option is available: +The following options are available: .Bl -tag -width indent .It Fl v Be more verbose. Modified: stable/8/sbin/kldload/kldload.c ============================================================================== --- stable/8/sbin/kldload/kldload.c Thu Sep 2 05:07:34 2010 (r212138) +++ stable/8/sbin/kldload/kldload.c Thu Sep 2 06:07:03 2010 (r212139) @@ -129,7 +129,7 @@ path_check(const char *kldname, int quie static void usage(void) { - fprintf(stderr, "usage: kldload [-v] file ...\n"); + fprintf(stderr, "usage: kldload [-qv] file ...\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 06:49:28 2010 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 07CCA1065702; Thu, 2 Sep 2010 06:49:28 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB18D8FC15; Thu, 2 Sep 2010 06:49:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o826nRph094989; Thu, 2 Sep 2010 06:49:27 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o826nRLa094987; Thu, 2 Sep 2010 06:49:27 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201009020649.o826nRLa094987@svn.freebsd.org> From: Hajimu UMEMOTO Date: Thu, 2 Sep 2010 06:49: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: r212140 - stable/8/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 06:49:28 -0000 Author: ume Date: Thu Sep 2 06:49:27 2010 New Revision: 212140 URL: http://svn.freebsd.org/changeset/base/212140 Log: We don't have etc/rc.d/ip6fw anymore. Since HEAD doesn't have etc/rc.d/network_ipv6, this commit is directly into RELENG_8. Spotted by: takachan__at__running-dog.net Modified: stable/8/etc/rc.d/network_ipv6 Modified: stable/8/etc/rc.d/network_ipv6 ============================================================================== --- stable/8/etc/rc.d/network_ipv6 Thu Sep 2 06:07:03 2010 (r212139) +++ stable/8/etc/rc.d/network_ipv6 Thu Sep 2 06:49:27 2010 (r212140) @@ -29,7 +29,7 @@ # # PROVIDE: network_ipv6 -# REQUIRE: routing ip6fw +# REQUIRE: routing # KEYWORD: nojail . /etc/rc.subr From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 07:49:46 2010 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 3F30010656A6; Thu, 2 Sep 2010 07:49:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DEEF8FC0A; Thu, 2 Sep 2010 07:49:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o827nkX8096227; Thu, 2 Sep 2010 07:49:46 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o827nk7m096225; Thu, 2 Sep 2010 07:49:46 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201009020749.o827nk7m096225@svn.freebsd.org> From: Ed Schouten Date: Thu, 2 Sep 2010 07:49:46 +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: r212141 - 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, 02 Sep 2010 07:49:46 -0000 Author: ed Date: Thu Sep 2 07:49:45 2010 New Revision: 212141 URL: http://svn.freebsd.org/changeset/base/212141 Log: MFC r211633: Add missing mlink for insmntque1(). Modified: stable/8/share/man/man9/Makefile Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Thu Sep 2 06:49:27 2010 (r212140) +++ stable/8/share/man/man9/Makefile Thu Sep 2 07:49:45 2010 (r212141) @@ -699,6 +699,7 @@ MLINKS+=ieee80211_vap.9 ieee80211_vap_se MLINKS+=ifnet.9 ifaddr.9 \ ifnet.9 if_data.9 \ ifnet.9 ifqueue.9 +MLINKS+=insmntque.9 insmntque1.9 MLINKS+=ithread.9 ithread_add_handler.9 \ ithread.9 ithread_create.9 \ ithread.9 ithread_destroy.9 \ From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 08:11:43 2010 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 A9AD41065751; Thu, 2 Sep 2010 08:11:43 +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 453EF8FC1E; Thu, 2 Sep 2010 08:11:42 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o828BaSo004481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Sep 2010 11:11:36 +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.4/8.14.4) with ESMTP id o828Bait056049; Thu, 2 Sep 2010 11:11:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o828BaYt056048; Thu, 2 Sep 2010 11:11:36 +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: Thu, 2 Sep 2010 11:11:36 +0300 From: Kostik Belousov To: David Xu Message-ID: <20100902081136.GG2396@deviant.kiev.zoral.com.ua> References: <201009010218.o812IX5G048257@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DNWMrkyqDUV26QiQ" Content-Disposition: inline In-Reply-To: <201009010218.o812IX5G048257@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=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no 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: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 08:11:43 -0000 --DNWMrkyqDUV26QiQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 01, 2010 at 02:18:33AM +0000, David Xu wrote: > Author: davidxu > Date: Wed Sep 1 02:18:33 2010 > New Revision: 212076 > URL: http://svn.freebsd.org/changeset/base/212076 >=20 > Log: > Add signal handler wrapper, the reason to add it becauses there are > some cases we want to improve: > 1) if a thread signal got a signal while in cancellation point, > it is possible the TDP_WAKEUP may be eaten by signal handler > if the handler called some interruptibly system calls. > 2) In signal handler, we want to disable cancellation. > 3) When thread holding some low level locks, it is better to > disable signal, those code need not to worry reentrancy, > sigprocmask system call is avoided because it is a bit expensive. > The signal handler wrapper works in this way: > 1) libthr installs its signal handler if user code invokes sigaction > to install its handler, the user handler is recorded in internal > array. > 2) when a signal is delivered, libthr's signal handler is invoke, > libthr checks if thread holds some low level lock or is in critical > region, if it is true, the signal is buffered, and all signals are > masked, once the thread leaves critical region, correct signal > mask is restored and buffered signal is processed. > 3) before user signal handler is invoked, cancellation is temporarily > disabled, after user signal handler is returned, cancellation state > is restored, and pending cancellation is rescheduled. > +static void > +thr_sighandler(int sig, siginfo_t *info, void *_ucp) > +{ > + if ((actp->sa_flags & SA_SIGINFO) !=3D 0) > + (*(sigfunc))(sig, info, ucp); > + else { > + ((ohandler)(*sigfunc))( > + sig, info->si_code, (struct sigcontext *)ucp, > + info->si_addr, (__sighandler_t *)sigfunc); > + } I do not think this is very important, but freebsd old-style signal handler fourth argument is usually the faulted %eip value. This is most likely irrelevant for any source that is linked with libthr.so new enough to contain this change. --DNWMrkyqDUV26QiQ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx/XDgACgkQC3+MBN1Mb4iwWQCgjjl5Xxc5WHgKeHE+VJ5cpPpu vmAAn1Ez/iXX4u9dZCd+mU7aJ9k0+Jhu =42+D -----END PGP SIGNATURE----- --DNWMrkyqDUV26QiQ-- From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 08:35:00 2010 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 D0C88106571C; Thu, 2 Sep 2010 08:35:00 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id A3BAA8FC12; Thu, 2 Sep 2010 08:35:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o828YwlQ070530; Thu, 2 Sep 2010 08:34:59 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C7FD232.9080100@freebsd.org> Date: Thu, 02 Sep 2010 16:34:58 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Kostik Belousov References: <201009010218.o812IX5G048257@svn.freebsd.org> <20100902081136.GG2396@deviant.kiev.zoral.com.ua> In-Reply-To: <20100902081136.GG2396@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; 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: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 08:35:00 -0000 Kostik Belousov wrote: > On Wed, Sep 01, 2010 at 02:18:33AM +0000, David Xu wrote: >> Author: davidxu >> Date: Wed Sep 1 02:18:33 2010 >> New Revision: 212076 >> URL: http://svn.freebsd.org/changeset/base/212076 >> >> Log: >> Add signal handler wrapper, the reason to add it becauses there are >> some cases we want to improve: >> 1) if a thread signal got a signal while in cancellation point, >> it is possible the TDP_WAKEUP may be eaten by signal handler >> if the handler called some interruptibly system calls. >> 2) In signal handler, we want to disable cancellation. >> 3) When thread holding some low level locks, it is better to >> disable signal, those code need not to worry reentrancy, >> sigprocmask system call is avoided because it is a bit expensive. >> The signal handler wrapper works in this way: >> 1) libthr installs its signal handler if user code invokes sigaction >> to install its handler, the user handler is recorded in internal >> array. >> 2) when a signal is delivered, libthr's signal handler is invoke, >> libthr checks if thread holds some low level lock or is in critical >> region, if it is true, the signal is buffered, and all signals are >> masked, once the thread leaves critical region, correct signal >> mask is restored and buffered signal is processed. >> 3) before user signal handler is invoked, cancellation is temporarily >> disabled, after user signal handler is returned, cancellation state >> is restored, and pending cancellation is rescheduled. > >> +static void >> +thr_sighandler(int sig, siginfo_t *info, void *_ucp) >> +{ > >> + if ((actp->sa_flags & SA_SIGINFO) != 0) >> + (*(sigfunc))(sig, info, ucp); >> + else { >> + ((ohandler)(*sigfunc))( >> + sig, info->si_code, (struct sigcontext *)ucp, >> + info->si_addr, (__sighandler_t *)sigfunc); >> + } > > I do not think this is very important, but freebsd old-style signal > handler fourth argument is usually the faulted %eip value. This is > most likely irrelevant for any source that is linked with libthr.so > new enough to contain this change. Isn't the si_addr in siginfo a fault address ? I remembered I saved the fault address in ksiginfo_t which is converted to userland siginfo, and fault address should be there. what's wrong here ? From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 08:41:20 2010 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 C1C3F1065730; Thu, 2 Sep 2010 08:41:20 +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 5A48E8FC21; Thu, 2 Sep 2010 08:41:19 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o828fGg7006942 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Sep 2010 11:41:16 +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.4/8.14.4) with ESMTP id o828fGIw056378; Thu, 2 Sep 2010 11:41:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o828fGgG056377; Thu, 2 Sep 2010 11:41:16 +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: Thu, 2 Sep 2010 11:41:16 +0300 From: Kostik Belousov To: David Xu Message-ID: <20100902084116.GJ2396@deviant.kiev.zoral.com.ua> References: <201009010218.o812IX5G048257@svn.freebsd.org> <20100902081136.GG2396@deviant.kiev.zoral.com.ua> <4C7FD232.9080100@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7SYzLFxCLxOg+UP5" Content-Disposition: inline In-Reply-To: <4C7FD232.9080100@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=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no 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: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 08:41:20 -0000 --7SYzLFxCLxOg+UP5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 02, 2010 at 04:34:58PM +0000, David Xu wrote: > Kostik Belousov wrote: > >On Wed, Sep 01, 2010 at 02:18:33AM +0000, David Xu wrote: > >>Author: davidxu > >>Date: Wed Sep 1 02:18:33 2010 > >>New Revision: 212076 > >>URL: http://svn.freebsd.org/changeset/base/212076 > >> > >>Log: > >> Add signal handler wrapper, the reason to add it becauses there are > >> some cases we want to improve: > >> 1) if a thread signal got a signal while in cancellation point, > >> it is possible the TDP_WAKEUP may be eaten by signal handler > >> if the handler called some interruptibly system calls. > >> 2) In signal handler, we want to disable cancellation. > >> 3) When thread holding some low level locks, it is better to > >> disable signal, those code need not to worry reentrancy, > >> sigprocmask system call is avoided because it is a bit expensive. > >> The signal handler wrapper works in this way: > >> 1) libthr installs its signal handler if user code invokes sigaction > >> to install its handler, the user handler is recorded in internal > >> array. > >> 2) when a signal is delivered, libthr's signal handler is invoke, > >> libthr checks if thread holds some low level lock or is in criti= cal > >> region, if it is true, the signal is buffered, and all signals a= re > >> masked, once the thread leaves critical region, correct signal > >> mask is restored and buffered signal is processed. > >> 3) before user signal handler is invoked, cancellation is temporari= ly > >> disabled, after user signal handler is returned, cancellation st= ate > >> is restored, and pending cancellation is rescheduled. > > > >>+static void > >>+thr_sighandler(int sig, siginfo_t *info, void *_ucp) > >>+{ > > > >>+ if ((actp->sa_flags & SA_SIGINFO) !=3D 0) > >>+ (*(sigfunc))(sig, info, ucp); > >>+ else { > >>+ ((ohandler)(*sigfunc))( > >>+ sig, info->si_code, (struct sigcontext *)ucp, > >>+ info->si_addr, (__sighandler_t *)sigfunc); > >>+ } > > > >I do not think this is very important, but freebsd old-style signal > >handler fourth argument is usually the faulted %eip value. This is > >most likely irrelevant for any source that is linked with libthr.so > >new enough to contain this change. >=20 > Isn't the si_addr in siginfo a fault address ? I remembered I saved > the fault address in ksiginfo_t which is converted to userland > siginfo, and fault address should be there. what's wrong here ? >=20 Oops, sorry, I miscalculated the position of the arguments :(. --7SYzLFxCLxOg+UP5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx/YywACgkQC3+MBN1Mb4i/9wCglYCkDv4JoFnRTFhmrdJXOfmx 8+8AoKhvH9n0ZUs2Co+PnmbAVS691mDx =dBtf -----END PGP SIGNATURE----- --7SYzLFxCLxOg+UP5-- From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 09:03:15 2010 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 B4595106570C; Thu, 2 Sep 2010 09:03:15 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 85A4F8FC1C; Thu, 2 Sep 2010 09:03:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o8293D7j001669; Thu, 2 Sep 2010 09:03:14 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C7FD8D1.1000702@freebsd.org> Date: Thu, 02 Sep 2010 17:03:13 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Kostik Belousov References: <201009010218.o812IX5G048257@svn.freebsd.org> <20100902081136.GG2396@deviant.kiev.zoral.com.ua> <4C7FD232.9080100@freebsd.org> <20100902084116.GJ2396@deviant.kiev.zoral.com.ua> In-Reply-To: <20100902084116.GJ2396@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; 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: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 09:03:15 -0000 Kostik Belousov wrote: > On Thu, Sep 02, 2010 at 04:34:58PM +0000, David Xu wrote: >> Kostik Belousov wrote: >>> On Wed, Sep 01, 2010 at 02:18:33AM +0000, David Xu wrote: >>>> Author: davidxu >>>> Date: Wed Sep 1 02:18:33 2010 >>>> New Revision: 212076 >>>> URL: http://svn.freebsd.org/changeset/base/212076 >>>> >>>> Log: >>>> Add signal handler wrapper, the reason to add it becauses there are >>>> some cases we want to improve: >>>> 1) if a thread signal got a signal while in cancellation point, >>>> it is possible the TDP_WAKEUP may be eaten by signal handler >>>> if the handler called some interruptibly system calls. >>>> 2) In signal handler, we want to disable cancellation. >>>> 3) When thread holding some low level locks, it is better to >>>> disable signal, those code need not to worry reentrancy, >>>> sigprocmask system call is avoided because it is a bit expensive. >>>> The signal handler wrapper works in this way: >>>> 1) libthr installs its signal handler if user code invokes sigaction >>>> to install its handler, the user handler is recorded in internal >>>> array. >>>> 2) when a signal is delivered, libthr's signal handler is invoke, >>>> libthr checks if thread holds some low level lock or is in critical >>>> region, if it is true, the signal is buffered, and all signals are >>>> masked, once the thread leaves critical region, correct signal >>>> mask is restored and buffered signal is processed. >>>> 3) before user signal handler is invoked, cancellation is temporarily >>>> disabled, after user signal handler is returned, cancellation state >>>> is restored, and pending cancellation is rescheduled. >>>> +static void >>>> +thr_sighandler(int sig, siginfo_t *info, void *_ucp) >>>> +{ >>>> + if ((actp->sa_flags & SA_SIGINFO) != 0) >>>> + (*(sigfunc))(sig, info, ucp); >>>> + else { >>>> + ((ohandler)(*sigfunc))( >>>> + sig, info->si_code, (struct sigcontext *)ucp, >>>> + info->si_addr, (__sighandler_t *)sigfunc); >>>> + } >>> I do not think this is very important, but freebsd old-style signal >>> handler fourth argument is usually the faulted %eip value. This is >>> most likely irrelevant for any source that is linked with libthr.so >>> new enough to contain this change. >> Isn't the si_addr in siginfo a fault address ? I remembered I saved >> the fault address in ksiginfo_t which is converted to userland >> siginfo, and fault address should be there. what's wrong here ? >> > Oops, sorry, I miscalculated the position of the arguments :(. Sorry, I think I also misunderstood you too. :( I think kernel still has some compatible problems. I just skimmed it again, and I found a problem. In RELENG_4, I found sys/i386/i386/machdep.c has following code in sendsig(): sf.sf_signum = sig; sf.sf_ucontext = (register_t)&sfp->sf_uc; if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ sf.sf_siginfo = (register_t)&sfp->sf_si; sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; /* fill siginfo structure */ sf.sf_si.si_signo = sig; sf.sf_si.si_code = code; sf.sf_si.si_addr = (void*)regs->tf_err; } else { /* Old FreeBSD-style arguments. */ sf.sf_siginfo = code; sf.sf_addr = regs->tf_err; <------- sf.sf_ahu.sf_handler = catcher; } the sf.sf_addr is assigned by tf_err here. In later branch ( I don't know which ), it seems it uses ksi.ksi_addr, /* Old FreeBSD-style arguments. */ sf.sf_arg2 = ksi->ksi_code; sf.sf_addr = (register_t)ksi->ksi_addr; sf.sf_ahu.sf_handler = catcher; the tf_err may not be equal to ksi_addr! This may need to be fixed. From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 09:26:38 2010 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 036521065708; Thu, 2 Sep 2010 09:26:38 +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 91B468FC26; Thu, 2 Sep 2010 09:26:37 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o829QXt8010892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Sep 2010 12:26:33 +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.4/8.14.4) with ESMTP id o829QX0d057358; Thu, 2 Sep 2010 12:26:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o829QXbc057357; Thu, 2 Sep 2010 12:26:33 +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: Thu, 2 Sep 2010 12:26:33 +0300 From: Kostik Belousov To: David Xu Message-ID: <20100902092633.GM2396@deviant.kiev.zoral.com.ua> References: <201009010218.o812IX5G048257@svn.freebsd.org> <20100902081136.GG2396@deviant.kiev.zoral.com.ua> <4C7FD232.9080100@freebsd.org> <20100902084116.GJ2396@deviant.kiev.zoral.com.ua> <4C7FD8D1.1000702@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EEu/qcNrcbWqPwHS" Content-Disposition: inline In-Reply-To: <4C7FD8D1.1000702@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=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no 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: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 09:26:38 -0000 --EEu/qcNrcbWqPwHS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 02, 2010 at 05:03:13PM +0000, David Xu wrote: > Kostik Belousov wrote: > >On Thu, Sep 02, 2010 at 04:34:58PM +0000, David Xu wrote: > >>Kostik Belousov wrote: > >>>On Wed, Sep 01, 2010 at 02:18:33AM +0000, David Xu wrote: > >>>>Author: davidxu > >>>>Date: Wed Sep 1 02:18:33 2010 > >>>>New Revision: 212076 > >>>>URL: http://svn.freebsd.org/changeset/base/212076 > >>>> > >>>>Log: > >>>> Add signal handler wrapper, the reason to add it becauses there are > >>>> some cases we want to improve: > >>>> 1) if a thread signal got a signal while in cancellation point, > >>>> it is possible the TDP_WAKEUP may be eaten by signal handler > >>>> if the handler called some interruptibly system calls. > >>>> 2) In signal handler, we want to disable cancellation. > >>>> 3) When thread holding some low level locks, it is better to > >>>> disable signal, those code need not to worry reentrancy, > >>>> sigprocmask system call is avoided because it is a bit expensiv= e. > >>>> The signal handler wrapper works in this way: > >>>> 1) libthr installs its signal handler if user code invokes sigacti= on > >>>> to install its handler, the user handler is recorded in internal > >>>> array. > >>>> 2) when a signal is delivered, libthr's signal handler is invoke, > >>>> libthr checks if thread holds some low level lock or is in=20 > >>>> critical > >>>> region, if it is true, the signal is buffered, and all signals = are > >>>> masked, once the thread leaves critical region, correct signal > >>>> mask is restored and buffered signal is processed. > >>>> 3) before user signal handler is invoked, cancellation is temporar= ily > >>>> disabled, after user signal handler is returned, cancellation= =20 > >>>> state > >>>> is restored, and pending cancellation is rescheduled. > >>>>+static void > >>>>+thr_sighandler(int sig, siginfo_t *info, void *_ucp) > >>>>+{ > >>>>+ if ((actp->sa_flags & SA_SIGINFO) !=3D 0) > >>>>+ (*(sigfunc))(sig, info, ucp); > >>>>+ else { > >>>>+ ((ohandler)(*sigfunc))( > >>>>+ sig, info->si_code, (struct sigcontext *)ucp, > >>>>+ info->si_addr, (__sighandler_t *)sigfunc); > >>>>+ } > >>>I do not think this is very important, but freebsd old-style signal > >>>handler fourth argument is usually the faulted %eip value. This is > >>>most likely irrelevant for any source that is linked with libthr.so > >>>new enough to contain this change. > >>Isn't the si_addr in siginfo a fault address ? I remembered I saved > >>the fault address in ksiginfo_t which is converted to userland > >>siginfo, and fault address should be there. what's wrong here ? > >> > >Oops, sorry, I miscalculated the position of the arguments :(. >=20 > Sorry, I think I also misunderstood you too. :( > I think kernel still has some compatible problems. I just skimmed > it again, and I found a problem. >=20 > In RELENG_4, I found sys/i386/i386/machdep.c has following code in > sendsig(): >=20 >=20 > sf.sf_signum =3D sig; > sf.sf_ucontext =3D (register_t)&sfp->sf_uc; > if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { > /* Signal handler installed with SA_SIGINFO. */ > sf.sf_siginfo =3D (register_t)&sfp->sf_si; > sf.sf_ahu.sf_action =3D (__siginfohandler_t *)catcher; >=20 > /* fill siginfo structure */ > sf.sf_si.si_signo =3D sig; > sf.sf_si.si_code =3D code; > sf.sf_si.si_addr =3D (void*)regs->tf_err; > } > else { > /* Old FreeBSD-style arguments. */ > sf.sf_siginfo =3D code; > sf.sf_addr =3D regs->tf_err; <------- > sf.sf_ahu.sf_handler =3D catcher; > } >=20 > the sf.sf_addr is assigned by tf_err here. >=20 > In later branch ( I don't know which ), it seems it uses ksi.ksi_addr, >=20 > /* Old FreeBSD-style arguments. */ > sf.sf_arg2 =3D ksi->ksi_code; > sf.sf_addr =3D (register_t)ksi->ksi_addr; > sf.sf_ahu.sf_handler =3D catcher; >=20 >=20 >=20 > the tf_err may not be equal to ksi_addr! This may need to be fixed. >=20 The change was introduced by r151316 | davidxu | 2005-10-14 /* Old FreeBSD-style arguments. */ - sf.sf_siginfo =3D code; - sf.sf_addr =3D regs->tf_err; + sf.sf_siginfo =3D ksi->ksi_code; + sf.sf_addr =3D (register_t)ksi->ksi_addr; sf.sf_ahu.sf_handler =3D catcher; --EEu/qcNrcbWqPwHS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx/bckACgkQC3+MBN1Mb4jDewCg9oK3MITarwsG1hpppvsS5V/y ZAQAoITzHIw/F10pF2XYQM9pRzPRjsve =BWAc -----END PGP SIGNATURE----- --EEu/qcNrcbWqPwHS-- From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 09:35:41 2010 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 CA9861065714; Thu, 2 Sep 2010 09:35:41 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9B5308FC21; Thu, 2 Sep 2010 09:35:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o829ZdRI032176; Thu, 2 Sep 2010 09:35:40 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C7FE06B.9070609@freebsd.org> Date: Thu, 02 Sep 2010 17:35:39 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Kostik Belousov References: <201009010218.o812IX5G048257@svn.freebsd.org> <20100902081136.GG2396@deviant.kiev.zoral.com.ua> <4C7FD232.9080100@freebsd.org> <20100902084116.GJ2396@deviant.kiev.zoral.com.ua> <4C7FD8D1.1000702@freebsd.org> <20100902092633.GM2396@deviant.kiev.zoral.com.ua> In-Reply-To: <20100902092633.GM2396@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; 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: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 09:35:41 -0000 Kostik Belousov wrote: >> the tf_err may not be equal to ksi_addr! This may need to be fixed. >> > The change was introduced by > r151316 | davidxu | 2005-10-14 > /* Old FreeBSD-style arguments. */ > - sf.sf_siginfo = code; > - sf.sf_addr = regs->tf_err; > + sf.sf_siginfo = ksi->ksi_code; > + sf.sf_addr = (register_t)ksi->ksi_addr; > sf.sf_ahu.sf_handler = catcher; > :( From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 10:22:23 2010 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 A452D10656A8; Thu, 2 Sep 2010 10:22:23 +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 20A4D8FC16; Thu, 2 Sep 2010 10:22:22 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o82AMJM9015763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Sep 2010 13:22:19 +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.4/8.14.4) with ESMTP id o82AMJXD010760; Thu, 2 Sep 2010 13:22:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o82AMIbq010759; Thu, 2 Sep 2010 13:22:18 +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: Thu, 2 Sep 2010 13:22:18 +0300 From: Kostik Belousov To: David Xu Message-ID: <20100902102218.GO2396@deviant.kiev.zoral.com.ua> References: <201009010218.o812IX5G048257@svn.freebsd.org> <20100902081136.GG2396@deviant.kiev.zoral.com.ua> <4C7FD232.9080100@freebsd.org> <20100902084116.GJ2396@deviant.kiev.zoral.com.ua> <4C7FD8D1.1000702@freebsd.org> <20100902092633.GM2396@deviant.kiev.zoral.com.ua> <4C7FE06B.9070609@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4KEqdnCeStZX4x/8" Content-Disposition: inline In-Reply-To: <4C7FE06B.9070609@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=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no 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: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 10:22:23 -0000 --4KEqdnCeStZX4x/8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 02, 2010 at 05:35:39PM +0000, David Xu wrote: > Kostik Belousov wrote: >=20 > >>the tf_err may not be equal to ksi_addr! This may need to be fixed. > >> > >The change was introduced by > >r151316 | davidxu | 2005-10-14 > > /* Old FreeBSD-style arguments. */ > >- sf.sf_siginfo =3D code; > >- sf.sf_addr =3D regs->tf_err; > >+ sf.sf_siginfo =3D ksi->ksi_code; > >+ sf.sf_addr =3D (register_t)ksi->ksi_addr; > > sf.sf_ahu.sf_handler =3D catcher; > > > :( The rollback looks straightforward. I explicitely decided to not change any architecture that is not i386. diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index d85a3bb..5ce6993 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -374,7 +374,7 @@ freebsd4_ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, s= igset_t *mask) } else { /* Old FreeBSD-style arguments. */ sf.sf_siginfo =3D siginfo.si_code; - sf.sf_addr =3D (u_int32_t)siginfo.si_addr; + sf.sf_addr =3D regs->tf_err; sf.sf_ah =3D (u_int32_t)(uintptr_t)catcher; } mtx_unlock(&psp->ps_mtx); @@ -495,7 +495,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *= mask) } else { /* Old FreeBSD-style arguments. */ sf.sf_siginfo =3D siginfo.si_code; - sf.sf_addr =3D (u_int32_t)siginfo.si_addr; + sf.sf_addr =3D regs->tf_err; sf.sf_ah =3D (u_int32_t)(uintptr_t)catcher; } mtx_unlock(&psp->ps_mtx); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index ef229ca..6a5e4e6 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -390,7 +390,7 @@ osendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) } else { /* Old FreeBSD-style arguments. */ sf.sf_arg2 =3D ksi->ksi_code; - sf.sf_addr =3D (register_t)ksi->ksi_addr; + sf.sf_addr =3D regs->tf_err; sf.sf_ahu.sf_handler =3D catcher; } mtx_unlock(&psp->ps_mtx); @@ -531,7 +531,7 @@ freebsd4_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset= _t *mask) } else { /* Old FreeBSD-style arguments. */ sf.sf_siginfo =3D ksi->ksi_code; - sf.sf_addr =3D (register_t)ksi->ksi_addr; + sf.sf_addr =3D regs->tf_err; sf.sf_ahu.sf_handler =3D catcher; } mtx_unlock(&psp->ps_mtx); @@ -684,7 +684,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) } else { /* Old FreeBSD-style arguments. */ sf.sf_siginfo =3D ksi->ksi_code; - sf.sf_addr =3D (register_t)ksi->ksi_addr; + sf.sf_addr =3D regs->tf_err; sf.sf_ahu.sf_handler =3D catcher; } mtx_unlock(&psp->ps_mtx); --4KEqdnCeStZX4x/8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx/etoACgkQC3+MBN1Mb4hOXACZAdSd98Pi9SPVYm6LhiRAPCPM TVoAnA5Tht/Hh86but+Di1tSYJIwV37A =xm5/ -----END PGP SIGNATURE----- --4KEqdnCeStZX4x/8-- From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 10:41:05 2010 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 6E2E01065709; Thu, 2 Sep 2010 10:41:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3D6BE8FC1B; Thu, 2 Sep 2010 10:41:05 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id DE6AA46B2C; Thu, 2 Sep 2010 06:41:04 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8358A8A03C; Thu, 2 Sep 2010 06:40:52 -0400 (EDT) From: John Baldwin To: Kostik Belousov Date: Thu, 2 Sep 2010 06:39:46 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009010218.o812IX5G048257@svn.freebsd.org> <4C7FE06B.9070609@freebsd.org> <20100902102218.GO2396@deviant.kiev.zoral.com.ua> In-Reply-To: <20100902102218.GO2396@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201009020639.47198.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 02 Sep 2010 06:40:52 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu Subject: Re: svn commit: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 10:41:05 -0000 On Thursday, September 02, 2010 6:22:18 am Kostik Belousov wrote: > On Thu, Sep 02, 2010 at 05:35:39PM +0000, David Xu wrote: > > Kostik Belousov wrote: > > > > >>the tf_err may not be equal to ksi_addr! This may need to be fixed. > > >> > > >The change was introduced by > > >r151316 | davidxu | 2005-10-14 > > > /* Old FreeBSD-style arguments. */ > > >- sf.sf_siginfo = code; > > >- sf.sf_addr = regs->tf_err; > > >+ sf.sf_siginfo = ksi->ksi_code; > > >+ sf.sf_addr = (register_t)ksi->ksi_addr; > > > sf.sf_ahu.sf_handler = catcher; > > > > > :( > The rollback looks straightforward. I explicitely decided to not change > any architecture that is not i386. It may not be this simple. At one point we had a "feature" where we trashed tf_err in the trapframe to store the address so it could be passed to sendsig for this purpose. I think once we started using ksi_addr here we removed the trashing of tf_err as it was no longer necessary. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 11:18:44 2010 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 454561065712; Thu, 2 Sep 2010 11:18:44 +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 340DB8FC1C; Thu, 2 Sep 2010 11:18:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82BIiii003265; Thu, 2 Sep 2010 11:18:44 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82BIiQv003261; Thu, 2 Sep 2010 11:18:44 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009021118.o82BIiQv003261@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Sep 2010 11:18: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: r212145 - in 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, 02 Sep 2010 11:18:44 -0000 Author: mav Date: Thu Sep 2 11:18:43 2010 New Revision: 212145 URL: http://svn.freebsd.org/changeset/base/212145 Log: SATA1.x SiliconImage controllers on power-on reset TFD Status register into value 0xff. On hot-plug this value confuses ata_generic_reset() device presence detection logic. As soon as we already know drive presence from SATA hard reset, hint ata_generic_reset() to wait for device signature until success or full timeout. Modified: head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-lowlevel.c head/sys/dev/ata/chipsets/ata-siliconimage.c Modified: head/sys/dev/ata/ata-all.h ============================================================================== --- head/sys/dev/ata/ata-all.h Thu Sep 2 09:45:06 2010 (r212144) +++ head/sys/dev/ata/ata-all.h Thu Sep 2 11:18:43 2010 (r212145) @@ -565,6 +565,7 @@ struct ata_channel { #define ATA_NO_ATAPI_DMA 0x40 #define ATA_SATA 0x80 #define ATA_DMA_BEFORE_CMD 0x100 +#define ATA_KNOWN_PRESENCE 0x200 int pm_level; /* power management level */ int devices; /* what is present */ Modified: head/sys/dev/ata/ata-lowlevel.c ============================================================================== --- head/sys/dev/ata/ata-lowlevel.c Thu Sep 2 09:45:06 2010 (r212144) +++ head/sys/dev/ata/ata-lowlevel.c Thu Sep 2 11:18:43 2010 (r212145) @@ -474,7 +474,8 @@ ata_generic_reset(device_t dev) ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_MASTER)); DELAY(10); ostat0 = ATA_IDX_INB(ch, ATA_STATUS); - if ((ostat0 & 0xf8) != 0xf8 && ostat0 != 0xa5) { + if (((ostat0 & 0xf8) != 0xf8 || (ch->flags & ATA_KNOWN_PRESENCE)) && + ostat0 != 0xa5) { stat0 = ATA_S_BUSY; mask |= 0x01; } @@ -484,7 +485,8 @@ ata_generic_reset(device_t dev) ATA_IDX_OUTB(ch, ATA_DRIVE, ATA_D_IBM | ATA_D_LBA | ATA_DEV(ATA_SLAVE)); DELAY(10); ostat1 = ATA_IDX_INB(ch, ATA_STATUS); - if ((ostat1 & 0xf8) != 0xf8 && ostat1 != 0xa5) { + if (((ostat1 & 0xf8) != 0xf8 || (ch->flags & ATA_KNOWN_PRESENCE)) && + ostat1 != 0xa5) { stat1 = ATA_S_BUSY; mask |= 0x02; } @@ -570,22 +572,16 @@ ata_generic_reset(device_t dev) } } - if (mask == 0x00) /* nothing to wait for */ - break; - if (mask == 0x01) /* wait for master only */ - if (!(stat0 & ATA_S_BUSY) || (stat0 == 0xff && timeout > 10)) - break; - if (mask == 0x02) /* wait for slave only */ - if (!(stat1 & ATA_S_BUSY) || (stat1 == 0xff && timeout > 10)) - break; - if (mask == 0x03) { /* wait for both master & slave */ - if (!(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY)) - break; - if ((stat0 == 0xff) && (timeout > 20)) - mask &= ~0x01; - if ((stat1 == 0xff) && (timeout > 20)) - mask &= ~0x02; + if ((ch->flags & ATA_KNOWN_PRESENCE) == 0 && + timeout > ((mask == 0x03) ? 20 : 10)) { + if ((mask & 0x01) && stat0 == 0xff) + mask &= ~0x01; + if ((mask & 0x02) && stat1 == 0xff) + mask &= ~0x02; } + if (((mask & 0x01) == 0 || !(stat0 & ATA_S_BUSY)) && + ((mask & 0x02) == 0 || !(stat1 & ATA_S_BUSY))) + break; ata_udelay(100000); } Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Thu Sep 2 09:45:06 2010 (r212144) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Thu Sep 2 11:18:43 2010 (r212145) @@ -316,6 +316,7 @@ ata_sii_ch_attach(device_t dev) ch->r_io[ATA_SCONTROL].offset = 0x100 + (unit01 << 7) + (unit10 << 8); ch->flags |= ATA_NO_SLAVE; ch->flags |= ATA_SATA; + ch->flags |= ATA_KNOWN_PRESENCE; /* enable PHY state change interrupt */ ATA_OUTL(ctlr->r_res2, 0x148 + (unit01 << 7) + (unit10 << 8),(1 << 16)); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 11:36:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from alona.my.domain (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 302EC10657B6; Thu, 2 Sep 2010 11:36:14 +0000 (UTC) (envelope-from davidxu@freebsd.org) Message-ID: <4C7F8C28.50309@freebsd.org> Date: Thu, 02 Sep 2010 19:36:08 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.21 (X11/20090522) MIME-Version: 1.0 To: John Baldwin References: <201009010218.o812IX5G048257@svn.freebsd.org> <4C7FE06B.9070609@freebsd.org> <20100902102218.GO2396@deviant.kiev.zoral.com.ua> <201009020639.47198.jhb@freebsd.org> In-Reply-To: <201009020639.47198.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 11:36:19 -0000 John Baldwin wrote: > On Thursday, September 02, 2010 6:22:18 am Kostik Belousov wrote: > >> On Thu, Sep 02, 2010 at 05:35:39PM +0000, David Xu wrote: >> >>> Kostik Belousov wrote: >>> >>> >>>>> the tf_err may not be equal to ksi_addr! This may need to be fixed. >>>>> >>>>> >>>> The change was introduced by >>>> r151316 | davidxu | 2005-10-14 >>>> /* Old FreeBSD-style arguments. */ >>>> - sf.sf_siginfo = code; >>>> - sf.sf_addr = regs->tf_err; >>>> + sf.sf_siginfo = ksi->ksi_code; >>>> + sf.sf_addr = (register_t)ksi->ksi_addr; >>>> sf.sf_ahu.sf_handler = catcher; >>>> >>>> >>> :( >>> >> The rollback looks straightforward. I explicitely decided to not change >> any architecture that is not i386. >> > > It may not be this simple. At one point we had a "feature" where we trashed > tf_err in the trapframe to store the address so it could be passed to sendsig > for this purpose. I think once we started using ksi_addr here we removed the > trashing of tf_err as it was no longer necessary. > > I saw RELENG_5 saved it at td_md.md_fault_address, but I really can not remember which version has such "feature". ;-) By the way, I still can not find a modern program uses this old style and wants to know the exact fault address. Kostik Belousov fixed the error I had made when I was implementing signal queue. Thanks! From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 12:17:34 2010 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 2577110657BF; Thu, 2 Sep 2010 12:17:34 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id AF62B8FC1E; Thu, 2 Sep 2010 12:17:33 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 493E846B09; Thu, 2 Sep 2010 08:17:33 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7F7A18A03C; Thu, 2 Sep 2010 08:17:18 -0400 (EDT) From: John Baldwin To: David Xu Date: Thu, 2 Sep 2010 08:16:59 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201009010218.o812IX5G048257@svn.freebsd.org> <201009020639.47198.jhb@freebsd.org> <4C7F8C28.50309@freebsd.org> In-Reply-To: <4C7F8C28.50309@freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201009020816.59745.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 02 Sep 2010 08:17:18 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 12:17:34 -0000 On Thursday, September 02, 2010 7:36:08 am David Xu wrote: > John Baldwin wrote: > > On Thursday, September 02, 2010 6:22:18 am Kostik Belousov wrote: > > > >> On Thu, Sep 02, 2010 at 05:35:39PM +0000, David Xu wrote: > >> > >>> Kostik Belousov wrote: > >>> > >>> > >>>>> the tf_err may not be equal to ksi_addr! This may need to be fixed. > >>>>> > >>>>> > >>>> The change was introduced by > >>>> r151316 | davidxu | 2005-10-14 > >>>> /* Old FreeBSD-style arguments. */ > >>>> - sf.sf_siginfo = code; > >>>> - sf.sf_addr = regs->tf_err; > >>>> + sf.sf_siginfo = ksi->ksi_code; > >>>> + sf.sf_addr = (register_t)ksi->ksi_addr; > >>>> sf.sf_ahu.sf_handler = catcher; > >>>> > >>>> > >>> :( > >>> > >> The rollback looks straightforward. I explicitely decided to not change > >> any architecture that is not i386. > >> > > > > It may not be this simple. At one point we had a "feature" where we trashed > > tf_err in the trapframe to store the address so it could be passed to sendsig > > for this purpose. I think once we started using ksi_addr here we removed the > > trashing of tf_err as it was no longer necessary. > > > > > I saw RELENG_5 saved it at td_md.md_fault_address, but I really can not > remember > which version has such "feature". ;-) > By the way, I still can not find a modern program uses this old style > and wants to > know the exact fault address. > Kostik Belousov fixed the error I had made when I was implementing > signal queue. See revision 170688 for example: r170688 | jhb | 2007-06-13 18:37:48 -0400 (Wed, 13 Jun 2007) | 6 lines Don't clobber tf_err with the eva from a page fault as the page fault address is saved in ksi_addr already. PR: i386/101379 Submitted by: Tijl Coosemans : tijl ulyssis org Index: trap.c =================================================================== --- trap.c (revision 170687) +++ trap.c (revision 170688) @@ -785,9 +785,6 @@ return (-1); } - /* kludge to pass faulting virtual address to sendsig */ - frame->tf_err = eva; - return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV); } Given that, I think the existing code is correct and that there is no bug to be fixed. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 12:32:29 2010 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 5F67A1065769; Thu, 2 Sep 2010 12:32:29 +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 4ECF68FC14; Thu, 2 Sep 2010 12:32:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82CWTQO004816; Thu, 2 Sep 2010 12:32:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82CWTRD004814; Thu, 2 Sep 2010 12:32:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009021232.o82CWTRD004814@svn.freebsd.org> From: Alexander Motin Date: Thu, 2 Sep 2010 12:32: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: r212146 - 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, 02 Sep 2010 12:32:29 -0000 Author: mav Date: Thu Sep 2 12:32:29 2010 New Revision: 212146 URL: http://svn.freebsd.org/changeset/base/212146 Log: Add fix for SiI3114 and SiI3512 chips bug, which caused sending R_ERR in response to DMA activate FIS under certain circumstances. This is recommended fix from chip datasheet. If triggered, this bug most likely cause write command timeout. MFC after: 2 weeks Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Thu Sep 2 11:18:43 2010 (r212145) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Thu Sep 2 12:32:29 2010 (r212146) @@ -365,7 +365,15 @@ ata_sii_status(device_t dev) static void ata_sii_reset(device_t dev) { + struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); struct ata_channel *ch = device_get_softc(dev); + int offset = ((ch->unit & 1) << 7) + ((ch->unit & 2) << 8); + uint32_t val; + + /* Apply R_ERR on DMA activate FIS errata workaround. */ + val = ATA_INL(ctlr->r_res2, 0x14c + offset); + if ((val & 0x3) == 0x1) + ATA_OUTL(ctlr->r_res2, 0x14c + offset, val & ~0x3); if (ata_sata_phy_reset(dev, -1, 1)) ata_generic_reset(dev); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 12:51:58 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from alona.my.domain (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id DA1AE10656A8; Thu, 2 Sep 2010 12:51:55 +0000 (UTC) (envelope-from davidxu@freebsd.org) Message-ID: <4C7F9DE6.6010900@freebsd.org> Date: Thu, 02 Sep 2010 20:51:50 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.21 (X11/20090522) MIME-Version: 1.0 To: John Baldwin References: <201009010218.o812IX5G048257@svn.freebsd.org> <201009020639.47198.jhb@freebsd.org> <4C7F8C28.50309@freebsd.org> <201009020816.59745.jhb@freebsd.org> In-Reply-To: <201009020816.59745.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Kostik Belousov , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212076 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 12:51:58 -0000 John Baldwin wrote: > On Thursday, September 02, 2010 7:36:08 am David Xu wrote: > >> John Baldwin wrote: >> >>> On Thursday, September 02, 2010 6:22:18 am Kostik Belousov wrote: >>> >>> >>>> On Thu, Sep 02, 2010 at 05:35:39PM +0000, David Xu wrote: >>>> >>>> >>>>> Kostik Belousov wrote: >>>>> >>>>> >>>>> >>>>>>> the tf_err may not be equal to ksi_addr! This may need to be fixed. >>>>>>> >>>>>>> >>>>>>> >>>>>> The change was introduced by >>>>>> r151316 | davidxu | 2005-10-14 >>>>>> /* Old FreeBSD-style arguments. */ >>>>>> - sf.sf_siginfo = code; >>>>>> - sf.sf_addr = regs->tf_err; >>>>>> + sf.sf_siginfo = ksi->ksi_code; >>>>>> + sf.sf_addr = (register_t)ksi->ksi_addr; >>>>>> sf.sf_ahu.sf_handler = catcher; >>>>>> >>>>>> >>>>>> >>>>> :( >>>>> >>>>> >>>> The rollback looks straightforward. I explicitely decided to not change >>>> any architecture that is not i386. >>>> >>>> >>> It may not be this simple. At one point we had a "feature" where we >>> > trashed > >>> tf_err in the trapframe to store the address so it could be passed to >>> > sendsig > >>> for this purpose. I think once we started using ksi_addr here we removed >>> > the > >>> trashing of tf_err as it was no longer necessary. >>> >>> >>> >> I saw RELENG_5 saved it at td_md.md_fault_address, but I really can not >> remember >> which version has such "feature". ;-) >> By the way, I still can not find a modern program uses this old style >> and wants to >> know the exact fault address. >> Kostik Belousov fixed the error I had made when I was implementing >> signal queue. >> > > See revision 170688 for example: > > r170688 | jhb | 2007-06-13 18:37:48 -0400 (Wed, 13 Jun 2007) | 6 lines > > Don't clobber tf_err with the eva from a page fault as the page fault > address is saved in ksi_addr already. > > PR: i386/101379 > Submitted by: Tijl Coosemans : tijl ulyssis org > > Index: trap.c > =================================================================== > --- trap.c (revision 170687) > +++ trap.c (revision 170688) > @@ -785,9 +785,6 @@ > return (-1); > } > > - /* kludge to pass faulting virtual address to sendsig */ > - frame->tf_err = eva; > - > return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV); > } > > Given that, I think the existing code is correct and that there is no bug to > be fixed. > > Thanks for clarifying, I am really confused when Kostik Belousov mailed me, I wish I had not made the mistake, after all it was 4 years 10 months ago, so I can not remember exactly what had happened at that time. From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 12:55:36 2010 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 8632E10658AE; Thu, 2 Sep 2010 12:55:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id E460D8FC24; Thu, 2 Sep 2010 12:55:35 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.4/8.14.4) with ESMTP id o82CPtfu009490; Thu, 2 Sep 2010 16:25:55 +0400 (MSD) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.4/8.14.4/Submit) id o82CPsx0009489; Thu, 2 Sep 2010 16:25:54 +0400 (MSD) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 2 Sep 2010 16:25:54 +0400 From: Gleb Smirnoff To: Xin LI Message-ID: <20100902122554.GC90731@FreeBSD.org> References: <201008080704.o7874RFS090260@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201008080704.o7874RFS090260@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r211059 - 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: Thu, 02 Sep 2010 12:55:36 -0000 Xin, sorry for late answer. On Sun, Aug 08, 2010 at 07:04:27AM +0000, Xin LI wrote: X> Author: delphij X> Date: Sun Aug 8 07:04:27 2010 X> New Revision: 211059 X> URL: http://svn.freebsd.org/changeset/base/211059 X> X> Log: X> Address an edge condition that we found at work, where the carp(4) X> interface goes to issue LINK_UP, then LINK_DOWN, then LINK_UP at X> cold boot. This behavior is not observed when carp(4) interface X> is created slightly later, when the underlying interface is fully X> up. X> X> Before this change what happen at boot is roughly: X> X> - ifconfig creates em0 interface; X> - ifconfig clones a carp device using em0; X> (em0's link state is DOWN at this point) X> - carp state: INIT -> BACKUP [*] X> - carp state: BACKUP -> MASTER X> - [Some negotiate between em0 and switch] X> - em0 kicks up link state change event X> (em0's link state is now up DOWN at this point) X> - do_link_state_change() -> carp_carpdev_state() X> - carp state: MASTER -> INIT (via carp_set_state(sc, INIT)) [+] X> - carp state: INIT -> BACKUP X> - carp state: BACKUP -> MASTER X> X> At the [*] stage, em0 did not received any broadcast message from other X> node, and assume our node is the master, thus carp(4) sets the link X> state to "UP" after becoming a master. At [+], the master status X> is forcely set to "INIT", then an election is casted, after which our X> node would actually become a master. X> X> We believe that at the [*] stage, the master status should remain as X> "INIT" since the underlying parent interface's link state is not up. Yes, it should. The current problem is that some underlying network interfaces may not yet support link state notification, so carp(4) treats LINK_STATE_UNKNOWN as UP. Once all ethernet devices in tree maintain end report their link state change, we can switch to treating LINK_STATE_UNKNOWN as DOWN. -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 13:34:54 2010 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 8EDC91065704; Thu, 2 Sep 2010 13:34:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DBFA8FC1A; Thu, 2 Sep 2010 13:34:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82DYs0V006130; Thu, 2 Sep 2010 13:34:54 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82DYs8e006128; Thu, 2 Sep 2010 13:34:54 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009021334.o82DYs8e006128@svn.freebsd.org> From: Ed Maste Date: Thu, 2 Sep 2010 13:34:54 +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: r212147 - stable/8/sys/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: Thu, 02 Sep 2010 13:34:54 -0000 Author: emaste Date: Thu Sep 2 13:34:54 2010 New Revision: 212147 URL: http://svn.freebsd.org/changeset/base/212147 Log: MFC r199972: Use switch out (SWO) instead of switch in (SWI) debug log mask in csw_out. Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_mod.c Thu Sep 2 12:32:29 2010 (r212146) +++ stable/8/sys/dev/hwpmc/hwpmc_mod.c Thu Sep 2 13:34:54 2010 (r212147) @@ -1408,7 +1408,7 @@ pmc_process_csw_out(struct thread *td) tmp = newvalue - PMC_PCPU_SAVED(cpu,ri); - PMCDBG(CSW,SWI,1,"cpu=%d ri=%d tmp=%jd", cpu, ri, + PMCDBG(CSW,SWO,1,"cpu=%d ri=%d tmp=%jd", cpu, ri, tmp); if (mode == PMC_MODE_TS) { From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 14:05:32 2010 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 DAB271065723; Thu, 2 Sep 2010 14:05:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B03C78FC0C; Thu, 2 Sep 2010 14:05:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82E5WxA006772; Thu, 2 Sep 2010 14:05:32 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82E5Wqv006770; Thu, 2 Sep 2010 14:05:32 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201009021405.o82E5Wqv006770@svn.freebsd.org> From: Ed Maste Date: Thu, 2 Sep 2010 14:05: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: r212148 - 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, 02 Sep 2010 14:05:33 -0000 Author: emaste Date: Thu Sep 2 14:05:32 2010 New Revision: 212148 URL: http://svn.freebsd.org/changeset/base/212148 Log: Remove trailing whitespace. Modified: head/sys/sys/copyright.h Modified: head/sys/sys/copyright.h ============================================================================== --- head/sys/sys/copyright.h Thu Sep 2 13:34:54 2010 (r212147) +++ head/sys/sys/copyright.h Thu Sep 2 14:05:32 2010 (r212148) @@ -27,7 +27,7 @@ /* Copyrights macros */ - + /* FreeBSD */ #define COPYRIGHT_FreeBSD \ "Copyright (c) 1992-2010 The FreeBSD Project.\n" From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 14:13:44 2010 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 1BC9910656F0; Thu, 2 Sep 2010 14:13:44 +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 0AC738FC22; Thu, 2 Sep 2010 14:13:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82EDhL5007042; Thu, 2 Sep 2010 14:13:43 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82EDhBg007039; Thu, 2 Sep 2010 14:13:43 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201009021413.o82EDhBg007039@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Thu, 2 Sep 2010 14:13:43 +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: r212149 - head/sys/dev/iscsi/initiator X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 14:13:44 -0000 Author: des Date: Thu Sep 2 14:13:43 2010 New Revision: 212149 URL: http://svn.freebsd.org/changeset/base/212149 Log: Remove the freelist, which simply duplicates some of the zone allocator's functionality. Submitted by: Daniel Braniss MFC after: 3 weeks Modified: head/sys/dev/iscsi/initiator/iscsi.c head/sys/dev/iscsi/initiator/iscsivar.h Modified: head/sys/dev/iscsi/initiator/iscsi.c ============================================================================== --- head/sys/dev/iscsi/initiator/iscsi.c Thu Sep 2 14:05:32 2010 (r212148) +++ head/sys/dev/iscsi/initiator/iscsi.c Thu Sep 2 14:13:43 2010 (r212149) @@ -295,12 +295,6 @@ iscsi_read(struct cdev *dev, struct uio sprintf(buf, "%d/%d /---- free -----/\n", sc->npdu_alloc, sc->npdu_max); i = 0; uiomove(buf, strlen(buf), uio); - TAILQ_FOREACH(pq, &sc->freepdu, pq_link) { - if(uio->uio_resid == 0) - return 0; - sprintf(buf, "%03d] %06x\n", i++, ntohl(pq->pdu.ipdu.bhs.itt)); - uiomove(buf, strlen(buf), uio); - } } else { int i = 0; @@ -704,15 +698,10 @@ iscsi_shutdown(void *v) static void free_pdus(struct isc_softc *sc) { - pduq_t *pq; debug_called(8); if(sc->pdu_zone != NULL) { - TAILQ_FOREACH(pq, &sc->freepdu, pq_link) { - TAILQ_REMOVE(&sc->freepdu, pq, pq_link); - uma_zfree(sc->pdu_zone, pq); - } uma_zdestroy(sc->pdu_zone); sc->pdu_zone = NULL; } @@ -730,7 +719,6 @@ iscsi_start(void) isc->dev = make_dev(&iscsi_cdevsw, max_sessions, UID_ROOT, GID_WHEEL, 0600, "iscsi"); isc->dev->si_drv1 = isc; mtx_init(&isc->isc_mtx, "iscsi", NULL, MTX_DEF); - mtx_init(&isc->pdu_mtx, "iscsi pdu pool", NULL, MTX_DEF); TAILQ_INIT(&isc->isc_sess); /* @@ -744,7 +732,6 @@ iscsi_start(void) // XXX: should fail... } uma_zone_set_max(isc->pdu_zone, max_pdus); - TAILQ_INIT(&isc->freepdu); isc->unit = new_unrhdr(0, max_sessions-1, NULL); sx_init(&isc->unit_sx, "iscsi sx"); @@ -818,7 +805,6 @@ iscsi_stop(void) ic_destroy(sp); } mtx_destroy(&isc->isc_mtx); - mtx_destroy(&isc->pdu_mtx); sx_destroy(&isc->unit_sx); free_pdus(isc); Modified: head/sys/dev/iscsi/initiator/iscsivar.h ============================================================================== --- head/sys/dev/iscsi/initiator/iscsivar.h Thu Sep 2 14:05:32 2010 (r212148) +++ head/sys/dev/iscsi/initiator/iscsivar.h Thu Sep 2 14:13:43 2010 (r212149) @@ -203,10 +203,7 @@ struct isc_softc { struct unrhdr *unit; struct sx unit_sx; - struct mtx pdu_mtx; uma_zone_t pdu_zone; // pool of free pdu's - TAILQ_HEAD(,pduq) freepdu; - #ifdef ISCSI_INITIATOR_DEBUG int npdu_alloc, npdu_max; // for instrumentation #endif @@ -303,25 +300,15 @@ pdu_alloc(struct isc_softc *isc, int wai { pduq_t *pq; - mtx_lock(&isc->pdu_mtx); - if((pq = TAILQ_FIRST(&isc->freepdu)) == NULL) { - mtx_unlock(&isc->pdu_mtx); - pq = (pduq_t *)uma_zalloc(isc->pdu_zone, wait /* M_WAITOK or M_NOWAIT*/); - } - else { - TAILQ_REMOVE(&isc->freepdu, pq, pq_link); - mtx_unlock(&isc->pdu_mtx); - } + pq = (pduq_t *)uma_zalloc(isc->pdu_zone, wait /* M_WAITOK or M_NOWAIT*/); if(pq == NULL) { debug(7, "out of mem"); return NULL; } #ifdef ISCSI_INITIATOR_DEBUG - mtx_lock(&isc->pdu_mtx); isc->npdu_alloc++; if(isc->npdu_alloc > isc->npdu_max) isc->npdu_max = isc->npdu_alloc; - mtx_unlock(&isc->pdu_mtx); #endif memset(pq, 0, sizeof(pduq_t)); @@ -337,12 +324,10 @@ pdu_free(struct isc_softc *isc, pduq_t * if(pq->buf != NULL) free(pq->buf, M_ISCSIBUF); #endif - mtx_lock(&isc->pdu_mtx); - TAILQ_INSERT_TAIL(&isc->freepdu, pq, pq_link); #ifdef ISCSI_INITIATOR_DEBUG isc->npdu_alloc--; #endif - mtx_unlock(&isc->pdu_mtx); + uma_zfree(isc->pdu_zone, pq); } static __inline void From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 16:09:09 2010 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 BA9D01065789; Thu, 2 Sep 2010 16:09:09 +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 A97B48FC18; Thu, 2 Sep 2010 16:09:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82G99FK010407; Thu, 2 Sep 2010 16:09:09 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82G99b5010405; Thu, 2 Sep 2010 16:09:09 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009021609.o82G99b5010405@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 2 Sep 2010 16:09:09 +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: r212150 - 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: Thu, 02 Sep 2010 16:09:09 -0000 Author: bz Date: Thu Sep 2 16:09:09 2010 New Revision: 212150 URL: http://svn.freebsd.org/changeset/base/212150 Log: MFC r211904: MFp4 CH=182972: Add explicit linkstate UP/DOWN for the epair. This is needed by carp(4) and other things to work. Modified: stable/8/sys/net/if_epair.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/net/if_epair.c ============================================================================== --- stable/8/sys/net/if_epair.c Thu Sep 2 14:13:43 2010 (r212149) +++ stable/8/sys/net/if_epair.c Thu Sep 2 16:09:09 2010 (r212150) @@ -841,6 +841,8 @@ epair_clone_create(struct if_clone *ifc, /* Tell the world, that we are ready to rock. */ sca->ifp->if_drv_flags |= IFF_DRV_RUNNING; scb->ifp->if_drv_flags |= IFF_DRV_RUNNING; + if_link_state_change(sca->ifp, LINK_STATE_UP); + if_link_state_change(scb->ifp, LINK_STATE_UP); return (0); } @@ -868,6 +870,8 @@ epair_clone_destroy(struct if_clone *ifc scb = oifp->if_softc; DPRINTF("ifp=%p oifp=%p\n", ifp, oifp); + if_link_state_change(ifp, LINK_STATE_DOWN); + if_link_state_change(oifp, LINK_STATE_DOWN); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; oifp->if_drv_flags &= ~IFF_DRV_RUNNING; ether_ifdetach(oifp); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 16:11:12 2010 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 713D61065693; Thu, 2 Sep 2010 16:11: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 6130E8FC25; Thu, 2 Sep 2010 16:11:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82GBCCO010552; Thu, 2 Sep 2010 16:11:12 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82GBCKC010550; Thu, 2 Sep 2010 16:11:12 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009021611.o82GBCKC010550@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 2 Sep 2010 16:11: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: r212152 - 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: Thu, 02 Sep 2010 16:11:12 -0000 Author: bz Date: Thu Sep 2 16:11:12 2010 New Revision: 212152 URL: http://svn.freebsd.org/changeset/base/212152 Log: MFp4 CH=183259: No reason to use if_free_type() as we don't change our type. Just if_free() is fine. MFC after: 3 days Modified: head/sys/net/if_epair.c Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Thu Sep 2 16:09:46 2010 (r212151) +++ head/sys/net/if_epair.c Thu Sep 2 16:11:12 2010 (r212152) @@ -892,9 +892,9 @@ epair_clone_destroy(struct if_clone *ifc * we need to switch before freeing them. */ CURVNET_SET_QUIET(oifp->if_vnet); - if_free_type(oifp, IFT_ETHER); + if_free(oifp); CURVNET_RESTORE(); - if_free_type(ifp, IFT_ETHER); + if_free(ifp); free(scb, M_EPAIR); free(sca, M_EPAIR); ifc_free_unit(ifc, unit); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 16:23:06 2010 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 470C110656A4; Thu, 2 Sep 2010 16:23:06 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36EB28FC17; Thu, 2 Sep 2010 16:23:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82GN66r010865; Thu, 2 Sep 2010 16:23:06 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82GN68s010863; Thu, 2 Sep 2010 16:23:06 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009021623.o82GN68s010863@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 2 Sep 2010 16:23:06 +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: r212153 - 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, 02 Sep 2010 16:23:06 -0000 Author: mdf Date: Thu Sep 2 16:23:05 2010 New Revision: 212153 URL: http://svn.freebsd.org/changeset/base/212153 Log: Fix UP build. MFC after: 2 weeks Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Thu Sep 2 16:11:12 2010 (r212152) +++ head/sys/kern/sched_ule.c Thu Sep 2 16:23:05 2010 (r212153) @@ -1797,8 +1797,10 @@ sched_switch(struct thread *td, struct t srqflag = (flags & SW_PREEMPT) ? SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : SRQ_OURSELF|SRQ_YIELDING; +#ifdef SMP if (THREAD_CAN_MIGRATE(td) && !THREAD_CAN_SCHED(td, ts->ts_cpu)) ts->ts_cpu = sched_pickcpu(td, 0); +#endif if (ts->ts_cpu == cpuid) tdq_runq_add(tdq, td, srqflag); else { From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 16:25:52 2010 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 4B8631065804; Thu, 2 Sep 2010 16:25:52 +0000 (UTC) (envelope-from mdf356@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 813E28FC1A; Thu, 2 Sep 2010 16:25:51 +0000 (UTC) Received: by eyx24 with SMTP id 24so458432eyx.13 for ; Thu, 02 Sep 2010 09:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=j0pQiRpK3QYnH7jl8HwBL1M6a7TiRQrQXdalBY6hMJ4=; b=pupR4o6I59IIjm/LV5JegpVxbpYgv5O+0nN9UTCkJy+qABdA5W0XdHK8t/uTXMmDIi lZ/QBzoNDJPkwK0ITK1E0xRfzoQbMyHRywz8WACMYs+snfR4uT7BSTmRmc2cf2K/BFYS OZSgNGid4RhiCOiVPQ3avM/iKZXqKpguu1gPM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=v7AsymCsnBjIqSZCdhvX2d73l09X5eU/Ua+0tpWBpnQLmvUvGuDF4Nm4PQXGMjEQAu Iac2BAMmfmwcmV11LfBwwPzUCRnK3YVaeZQhnLq/a1rBTW4RrUndOBs4rLfz119V7QF2 HiYXwZ/HZW6ufuPm6rG0eJxNQyYUcNp9gw4sM= MIME-Version: 1.0 Received: by 10.213.19.203 with SMTP id c11mr2003414ebb.31.1283444750401; Thu, 02 Sep 2010 09:25:50 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.213.30.13 with HTTP; Thu, 2 Sep 2010 09:25:50 -0700 (PDT) In-Reply-To: <201009021623.o82GN68s010863@svn.freebsd.org> References: <201009021623.o82GN68s010863@svn.freebsd.org> Date: Thu, 2 Sep 2010 09:25:50 -0700 X-Google-Sender-Auth: jQy5zqpNgiiiCJpzffx-BxBPqTQ Message-ID: From: mdf@FreeBSD.org To: 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: r212153 - 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, 02 Sep 2010 16:25:52 -0000 On Thu, Sep 2, 2010 at 9:23 AM, Matthew D Fleming wrote: > Author: mdf > Date: Thu Sep =A02 16:23:05 2010 > New Revision: 212153 > URL: http://svn.freebsd.org/changeset/base/212153 > > Log: > =A0Fix UP build. Noticed by b.f. (bf1783 at gmail dot com) We apologize for the inconvenience. matthew > =A0MFC after: =A0 =A02 weeks > > Modified: > =A0head/sys/kern/sched_ule.c > > Modified: head/sys/kern/sched_ule.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/kern/sched_ule.c =A0 Thu Sep =A02 16:11:12 2010 =A0 =A0 =A0 = =A0(r212152) > +++ head/sys/kern/sched_ule.c =A0 Thu Sep =A02 16:23:05 2010 =A0 =A0 =A0 = =A0(r212153) > @@ -1797,8 +1797,10 @@ sched_switch(struct thread *td, struct t > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0srqflag =3D (flags & SW_PREEMPT) ? > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEM= PTED : > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0SRQ_OURSELF|SRQ_YIELDING; > +#ifdef SMP > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (THREAD_CAN_MIGRATE(td) && !THREAD_CAN_= SCHED(td, ts->ts_cpu)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ts->ts_cpu =3D sched_pickc= pu(td, 0); > +#endif > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (ts->ts_cpu =3D=3D cpuid) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tdq_runq_add(tdq, td, srqf= lag); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0else { > From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 17:22:12 2010 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 8D52A10657D7; Thu, 2 Sep 2010 17:22:12 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D1578FC36; Thu, 2 Sep 2010 17:22:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82HMCNI012930; Thu, 2 Sep 2010 17:22:12 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82HMCwJ012928; Thu, 2 Sep 2010 17:22:12 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201009021722.o82HMCwJ012928@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 2 Sep 2010 17:22: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: r212154 - head/sys/dev/fb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 17:22:12 -0000 Author: jkim Date: Thu Sep 2 17:22:12 2010 New Revision: 212154 URL: http://svn.freebsd.org/changeset/base/212154 Log: Disable video ROM shadowing by default as I originally intended. I found a case where video ROM for an IGP is too tightly coupled with system BIOS to get relocated. Modified: head/sys/dev/fb/vesa.c Modified: head/sys/dev/fb/vesa.c ============================================================================== --- head/sys/dev/fb/vesa.c Thu Sep 2 16:23:05 2010 (r212153) +++ head/sys/dev/fb/vesa.c Thu Sep 2 17:22:12 2010 (r212154) @@ -96,10 +96,10 @@ static size_t vesa_bios_size = 0; static video_adapter_t *vesa_adp = NULL; SYSCTL_NODE(_debug, OID_AUTO, vesa, CTLFLAG_RD, NULL, "VESA debugging"); -static int vesa_shadow_rom = 1; +static int vesa_shadow_rom = 0; TUNABLE_INT("debug.vesa.shadow_rom", &vesa_shadow_rom); SYSCTL_INT(_debug_vesa, OID_AUTO, shadow_rom, CTLFLAG_RDTUN, &vesa_shadow_rom, - 1, "Enable video BIOS shadow"); + 0, "Enable video BIOS shadow"); /* VESA functions */ #if 0 From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 17:43:44 2010 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 6B42010656C0; Thu, 2 Sep 2010 17:43:44 +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 5A4BF8FC21; Thu, 2 Sep 2010 17:43:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82Hhib5013922; Thu, 2 Sep 2010 17:43:44 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82Hhiu1013917; Thu, 2 Sep 2010 17:43:44 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009021743.o82Hhiu1013917@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 2 Sep 2010 17:43: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: r212155 - 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, 02 Sep 2010 17:43:44 -0000 Author: bz Date: Thu Sep 2 17:43:44 2010 New Revision: 212155 URL: http://svn.freebsd.org/changeset/base/212155 Log: MFp4 CH=183052 183053 183258: In protosw we define pr_protocol as short, while on the wire it is an uint8_t. That way we can have "internal" protocols like DIVERT, SEND or gaps for modules (PROTO_SPACER). Switch ipproto_{un,}register to accept a short protocol number(*) and do an upfront check for valid boundries. With this we also consistently report EPROTONOSUPPORT for out of bounds protocols, as we did for proto == 0. This allows a caller to not error for this case, which is especially important if we want to automatically call these from domain handling. (*) the functions have been without any in-tree consumer since the initial introducation, so this is considered save. Implement ip6proto_{un,}register() similarly to their legacy IP counter parts to allow modules to hook up dynamically. Reviewed by: philip, will MFC after: 1 week Modified: head/sys/netinet/ip_input.c head/sys/netinet/ip_var.h head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_var.h Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Thu Sep 2 17:22:12 2010 (r212154) +++ head/sys/netinet/ip_input.c Thu Sep 2 17:43:44 2010 (r212155) @@ -1287,12 +1287,12 @@ ip_drain(void) * in inetsw[], either statically or through pf_proto_register(). */ int -ipproto_register(u_char ipproto) +ipproto_register(short ipproto) { struct protosw *pr; /* Sanity checks. */ - if (ipproto == 0) + if (ipproto <= 0 || ipproto >= IPPROTO_MAX) return (EPROTONOSUPPORT); /* @@ -1310,24 +1310,20 @@ ipproto_register(u_char ipproto) pr < inetdomain.dom_protoswNPROTOSW; pr++) { if (pr->pr_domain->dom_family == PF_INET && pr->pr_protocol && pr->pr_protocol == ipproto) { - /* Be careful to only index valid IP protocols. */ - if (pr->pr_protocol < IPPROTO_MAX) { - ip_protox[pr->pr_protocol] = pr - inetsw; - return (0); - } else - return (EINVAL); + ip_protox[pr->pr_protocol] = pr - inetsw; + return (0); } } return (EPROTONOSUPPORT); } int -ipproto_unregister(u_char ipproto) +ipproto_unregister(short ipproto) { struct protosw *pr; /* Sanity checks. */ - if (ipproto == 0) + if (ipproto <= 0 || ipproto >= IPPROTO_MAX) return (EPROTONOSUPPORT); /* Check if the protocol was indeed registered. */ Modified: head/sys/netinet/ip_var.h ============================================================================== --- head/sys/netinet/ip_var.h Thu Sep 2 17:22:12 2010 (r212154) +++ head/sys/netinet/ip_var.h Thu Sep 2 17:43:44 2010 (r212155) @@ -220,8 +220,8 @@ extern int int ip_output(struct mbuf *, struct mbuf *, struct route *, int, struct ip_moptions *, struct inpcb *); -int ipproto_register(u_char); -int ipproto_unregister(u_char); +int ipproto_register(short); +int ipproto_unregister(short); struct mbuf * ip_reass(struct mbuf *); struct in_ifaddr * Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Thu Sep 2 17:22:12 2010 (r212154) +++ head/sys/netinet6/ip6_input.c Thu Sep 2 17:43:44 2010 (r212155) @@ -227,6 +227,64 @@ ip6_init(void) netisr_register(&ip6_nh); } +/* + * The protocol to be inserted into ip6_protox[] must be already registered + * in inet6sw[], either statically or through pf_proto_register(). + */ +int +ip6proto_register(short ip6proto) +{ + struct ip6protosw *pr; + + /* Sanity checks. */ + if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX) + return (EPROTONOSUPPORT); + + /* + * The protocol slot must not be occupied by another protocol + * already. An index pointing to IPPROTO_RAW is unused. + */ + pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); + if (pr == NULL) + return (EPFNOSUPPORT); + if (ip6_protox[ip6proto] != pr - inet6sw) /* IPPROTO_RAW */ + return (EEXIST); + + /* + * Find the protocol position in inet6sw[] and set the index. + */ + for (pr = (struct ip6protosw *)inet6domain.dom_protosw; + pr < (struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++) { + if (pr->pr_domain->dom_family == PF_INET6 && + pr->pr_protocol && pr->pr_protocol == ip6proto) { + ip6_protox[pr->pr_protocol] = pr - inet6sw; + return (0); + } + } + return (EPROTONOSUPPORT); +} + +int +ip6proto_unregister(short ip6proto) +{ + struct ip6protosw *pr; + + /* Sanity checks. */ + if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX) + return (EPROTONOSUPPORT); + + /* Check if the protocol was indeed registered. */ + pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); + if (pr == NULL) + return (EPFNOSUPPORT); + if (ip6_protox[ip6proto] == pr - inet6sw) /* IPPROTO_RAW */ + return (ENOENT); + + /* Reset the protocol slot to IPPROTO_RAW. */ + ip6_protox[ip6proto] = pr - inet6sw; + return (0); +} + #ifdef VIMAGE void ip6_destroy() Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Thu Sep 2 17:22:12 2010 (r212154) +++ head/sys/netinet6/ip6_var.h Thu Sep 2 17:43:44 2010 (r212155) @@ -368,6 +368,9 @@ void ip6_init __P((void)); #ifdef VIMAGE void ip6_destroy __P((void)); #endif +int ip6proto_register(short); +int ip6proto_unregister(short); + void ip6_input __P((struct mbuf *)); struct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *)); void ip6_freepcbopts __P((struct ip6_pktopts *)); From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 17:51:42 2010 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 5E6AA10656D5; Thu, 2 Sep 2010 17:51:42 +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 332FD8FC13; Thu, 2 Sep 2010 17:51:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82HpgpM014167; Thu, 2 Sep 2010 17:51:42 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82HpguF014165; Thu, 2 Sep 2010 17:51:42 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009021751.o82HpguF014165@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 2 Sep 2010 17: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: r212156 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 17:51:42 -0000 Author: yongari Date: Thu Sep 2 17:51:41 2010 New Revision: 212156 URL: http://svn.freebsd.org/changeset/base/212156 Log: Fix the last endianness issue on handling station address which prevented driver from working on big-endian machines. Also rewrite station address programming to make it work on strict-alignment architectures. With this change, sis(4) now works on sparc64 and performance number looks good even though sis(4) have to apply fixup code to align received frames on 2 bytes boundary on sparc64. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Thu Sep 2 17:43:44 2010 (r212155) +++ head/sys/dev/sis/if_sis.c Thu Sep 2 17:51:41 2010 (r212156) @@ -1057,7 +1057,12 @@ sis_attach(device_t dev) tmp[2] = sis_reverse(tmp[2]); tmp[1] = sis_reverse(tmp[1]); - bcopy((char *)&tmp[1], eaddr, ETHER_ADDR_LEN); + eaddr[0] = (tmp[1] >> 0) & 0xFF; + eaddr[1] = (tmp[1] >> 8) & 0xFF; + eaddr[2] = (tmp[2] >> 0) & 0xFF; + eaddr[3] = (tmp[2] >> 8) & 0xFF; + eaddr[4] = (tmp[3] >> 0) & 0xFF; + eaddr[5] = (tmp[3] >> 8) & 0xFF; } break; case SIS_VENDORID: @@ -1967,6 +1972,7 @@ sis_initl(struct sis_softc *sc) { struct ifnet *ifp = sc->sis_ifp; struct mii_data *mii; + uint8_t *eaddr; SIS_LOCK_ASSERT(sc); @@ -1994,26 +2000,21 @@ sis_initl(struct sis_softc *sc) mii = device_get_softc(sc->sis_miibus); /* Set MAC address */ + eaddr = IF_LLADDR(sc->sis_ifp); if (sc->sis_type == SIS_TYPE_83815) { CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR0); - CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((uint16_t *)IF_LLADDR(sc->sis_ifp))[0]); + CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[0] | eaddr[1] << 8); CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR1); - CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((uint16_t *)IF_LLADDR(sc->sis_ifp))[1]); + CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[2] | eaddr[3] << 8); CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR2); - CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((uint16_t *)IF_LLADDR(sc->sis_ifp))[2]); + CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[4] | eaddr[5] << 8); } else { CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR0); - CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((uint16_t *)IF_LLADDR(sc->sis_ifp))[0]); + CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[0] | eaddr[1] << 8); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR1); - CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((uint16_t *)IF_LLADDR(sc->sis_ifp))[1]); + CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[2] | eaddr[3] << 8); CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR2); - CSR_WRITE_4(sc, SIS_RXFILT_DATA, - ((uint16_t *)IF_LLADDR(sc->sis_ifp))[2]); + CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[4] | eaddr[5] << 8); } /* Init circular TX/RX lists. */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 18:10:12 2010 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 11A5A1065770; Thu, 2 Sep 2010 18:10:12 +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 006A68FC20; Thu, 2 Sep 2010 18:10:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82IABbC014568; Thu, 2 Sep 2010 18:10:11 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82IABBH014565; Thu, 2 Sep 2010 18:10:11 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009021810.o82IABBH014565@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 2 Sep 2010 18:10: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: r212157 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 18:10:12 -0000 Author: yongari Date: Thu Sep 2 18:10:11 2010 New Revision: 212157 URL: http://svn.freebsd.org/changeset/base/212157 Log: Unlike most other controllers, NS DP83815/DP83816 controllers seem to pad with 0xFF when it encounter short frames. According to RFC 1042 the pad bytes should be 0x00. Because manual padding consumes extra CPU cycles, introduce a new tunable which controls the padding behavior. Turning this tunable on will have driver pad manually but it's disabled by default. Users can enable software padding by setting the following tunable to non-zero value. dev.sis.%d.manual_pad="1" PR: kern/35422 (patch not used) Modified: head/sys/dev/sis/if_sis.c head/sys/dev/sis/if_sisreg.h Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Thu Sep 2 17:51:41 2010 (r212156) +++ head/sys/dev/sis/if_sis.c Thu Sep 2 18:10:11 2010 (r212157) @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -150,6 +151,7 @@ static int sis_rxeof(struct sis_softc *) static void sis_start(struct ifnet *); static void sis_startl(struct ifnet *); static void sis_stop(struct sis_softc *); +static void sis_add_sysctls(struct sis_softc *); static void sis_watchdog(struct sis_softc *); @@ -710,24 +712,24 @@ sis_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->sis_link = 0; + sc->sis_flags &= ~SIS_FLAG_LINK; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: - sc->sis_link++; CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_10); + sc->sis_flags |= SIS_FLAG_LINK; break; case IFM_100_TX: - sc->sis_link++; CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_100); + sc->sis_flags |= SIS_FLAG_LINK; break; default: break; } } - if (sc->sis_link == 0) { + if ((sc->sis_flags & SIS_FLAG_LINK) == 0) { /* * Stopping MACs seem to reset SIS_TX_LISTPTR and * SIS_RX_LISTPTR which in turn requires resetting @@ -1122,6 +1124,8 @@ sis_attach(device_t dev) break; } + sis_add_sysctls(sc); + /* Allocate DMA'able memory. */ if ((error = sis_dma_alloc(sc)) != 0) goto fail; @@ -1698,7 +1702,7 @@ sis_tick(void *xsc) mii = device_get_softc(sc->sis_miibus); mii_tick(mii); sis_watchdog(sc); - if (sc->sis_link == 0) + if ((sc->sis_flags & SIS_FLAG_LINK) == 0) sis_miibus_statchg(sc->sis_dev); callout_reset(&sc->sis_stat_ch, hz, sis_tick, sc); } @@ -1829,9 +1833,41 @@ sis_encap(struct sis_softc *sc, struct m bus_dma_segment_t segs[SIS_MAXTXSEGS]; bus_dmamap_t map; int error, i, frag, nsegs, prod; + int padlen; prod = sc->sis_tx_prod; txd = &sc->sis_txdesc[prod]; + if ((sc->sis_flags & SIS_FLAG_MANUAL_PAD) != 0 && + (*m_head)->m_pkthdr.len < SIS_MIN_FRAMELEN) { + m = *m_head; + padlen = SIS_MIN_FRAMELEN - m->m_pkthdr.len; + if (M_WRITABLE(m) == 0) { + /* Get a writable copy. */ + m = m_dup(*m_head, M_DONTWAIT); + m_freem(*m_head); + if (m == NULL) { + *m_head = NULL; + return (ENOBUFS); + } + *m_head = m; + } + if (m->m_next != NULL || M_TRAILINGSPACE(m) < padlen) { + m = m_defrag(m, M_DONTWAIT); + if (m == NULL) { + m_freem(*m_head); + *m_head = NULL; + return (ENOBUFS); + } + } + /* + * Manually pad short frames, and zero the pad space + * to avoid leaking data. + */ + bzero(mtod(m, char *) + m->m_pkthdr.len, padlen); + m->m_pkthdr.len += padlen; + m->m_len = m->m_pkthdr.len; + *m_head = m; + } error = bus_dmamap_load_mbuf_sg(sc->sis_tx_tag, txd->tx_dmamap, *m_head, segs, &nsegs, 0); if (error == EFBIG) { @@ -1918,7 +1954,7 @@ sis_startl(struct ifnet *ifp) SIS_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || sc->sis_link == 0) + IFF_DRV_RUNNING || (sc->sis_flags & SIS_FLAG_LINK) == 0) return; for (queued = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && @@ -2025,6 +2061,13 @@ sis_initl(struct sis_softc *sc) return; } + if (sc->sis_type == SIS_TYPE_83815 || sc->sis_type == SIS_TYPE_83816) { + if (sc->sis_manual_pad != 0) + sc->sis_flags |= SIS_FLAG_MANUAL_PAD; + else + sc->sis_flags &= ~SIS_FLAG_MANUAL_PAD; + } + /* * Short Cable Receive Errors (MP21.E) * also: Page 78 of the DP83815 data sheet (september 2002 version) @@ -2125,7 +2168,7 @@ sis_initl(struct sis_softc *sc) /* Clear MAC disable. */ SIS_CLRBIT(sc, SIS_CSR, SIS_CSR_TX_DISABLE | SIS_CSR_RX_DISABLE); - sc->sis_link = 0; + sc->sis_flags &= ~SIS_FLAG_LINK; mii_mediachg(mii); ifp->if_drv_flags |= IFF_DRV_RUNNING; @@ -2148,7 +2191,6 @@ sis_ifmedia_upd(struct ifnet *ifp) SIS_LOCK(sc); mii = device_get_softc(sc->sis_miibus); - sc->sis_link = 0; if (mii->mii_instance) { struct mii_softc *miisc; LIST_FOREACH(miisc, &mii->mii_phys, mii_list) @@ -2304,7 +2346,7 @@ sis_stop(struct sis_softc *sc) CSR_WRITE_4(sc, SIS_TX_LISTPTR, 0); CSR_WRITE_4(sc, SIS_RX_LISTPTR, 0); - sc->sis_link = 0; + sc->sis_flags &= ~SIS_FLAG_LINK; /* * Free data in the RX lists. @@ -2351,6 +2393,32 @@ sis_shutdown(device_t dev) return (0); } +static void +sis_add_sysctls(struct sis_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *children; + char tn[32]; + int unit; + + ctx = device_get_sysctl_ctx(sc->sis_dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sis_dev)); + + unit = device_get_unit(sc->sis_dev); + /* + * Unlike most other controllers, NS DP83815/DP83816 controllers + * seem to pad with 0xFF when it encounter short frames. According + * to RFC 1042 the pad bytes should be 0x00. Turning this tunable + * on will have driver pad manully but it's disabled by default + * because it will consume extra CPU cycles for short frames. + */ + sc->sis_manual_pad = 0; + snprintf(tn, sizeof(tn), "dev.sis.%d.manual_pad", unit); + TUNABLE_INT_FETCH(tn, &sc->sis_manual_pad); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "manual_pad", + CTLFLAG_RW, &sc->sis_manual_pad, 0, "Manually pad short frames"); +} + static device_method_t sis_methods[] = { /* Device interface */ DEVMETHOD(device_probe, sis_probe), Modified: head/sys/dev/sis/if_sisreg.h ============================================================================== --- head/sys/dev/sis/if_sisreg.h Thu Sep 2 17:51:41 2010 (r212156) +++ head/sys/dev/sis/if_sisreg.h Thu Sep 2 18:10:11 2010 (r212157) @@ -449,7 +449,10 @@ struct sis_softc { device_t sis_miibus; uint8_t sis_type; uint8_t sis_rev; - uint8_t sis_link; + uint32_t sis_flags; +#define SIS_FLAG_MANUAL_PAD 0x0800 +#define SIS_FLAG_LINK 0x8000 + int sis_manual_pad; uint32_t sis_srr; struct sis_desc *sis_rx_list; struct sis_desc *sis_tx_list; From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 18:12:55 2010 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 0E8411065722; Thu, 2 Sep 2010 18:12:55 +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 F20318FC0A; Thu, 2 Sep 2010 18:12:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82ICs93014655; Thu, 2 Sep 2010 18:12:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82ICs2V014653; Thu, 2 Sep 2010 18:12:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009021812.o82ICs2V014653@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 2 Sep 2010 18:12: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: r212158 - head/sys/sparc64/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, 02 Sep 2010 18:12:55 -0000 Author: yongari Date: Thu Sep 2 18:12:54 2010 New Revision: 212158 URL: http://svn.freebsd.org/changeset/base/212158 Log: Enable sis(4). sis(4) should work on all architectures. Modified: head/sys/sparc64/conf/GENERIC Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Thu Sep 2 18:10:11 2010 (r212157) +++ head/sys/sparc64/conf/GENERIC Thu Sep 2 18:12:54 2010 (r212158) @@ -185,7 +185,7 @@ device nge # NatSemi DP83820 gigabit E device re # RealTek 8139C+/8169/8169S/8110S device rl # RealTek 8129/8139 device sf # Adaptec AIC-6915 (``Starfire'') -#device sis # Silicon Integrated Systems SiS 900/SiS 7016 +device sis # Silicon Integrated Systems SiS 900/SiS 7016 device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet device ste # Sundance ST201 (D-Link DFE-550TX) device stge # Sundance/Tamarack TC9021 gigabit Ethernet From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 18:22:08 2010 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 483FE10656D2; Thu, 2 Sep 2010 18:22:08 +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 3799C8FC13; Thu, 2 Sep 2010 18:22:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82IM867014883; Thu, 2 Sep 2010 18:22:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82IM89Q014881; Thu, 2 Sep 2010 18:22:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009021822.o82IM89Q014881@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 2 Sep 2010 18:22: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: r212159 - 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: Thu, 02 Sep 2010 18:22:08 -0000 Author: yongari Date: Thu Sep 2 18:22:06 2010 New Revision: 212159 URL: http://svn.freebsd.org/changeset/base/212159 Log: Document tunable dev.sis.%unit.manual_pad While I'm here Xref vlan(4) as sis(4) supports VLAN oversized frames. Modified: head/share/man/man4/sis.4 Modified: head/share/man/man4/sis.4 ============================================================================== --- head/share/man/man4/sis.4 Thu Sep 2 18:12:54 2010 (r212158) +++ head/share/man/man4/sis.4 Thu Sep 2 18:22:06 2010 (r212159) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2006 +.Dd September 2, 2010 .Dt SIS 4 .Os .Sh NAME @@ -145,6 +145,22 @@ SiS 630, 635, and 735 motherboard chipse .It Soekris Engineering net45xx, net48xx, lan1621, and lan1641 .El +.Sh SYSCTL VARIABLES +The following variable is available as both +.Xr sysctl 8 +variable and +.Xr loader 8 +tunable: +.Bl -tag -width indent +.It Va dev.sis.%unit.manual_pad +This variable controls how to pad short frames for DP83815/DP83816 +controllers on the specified device. +DP83815/DP83816 controllers are known to pad 0xFF for short frames +which is violation of RFC 1042. +A non-zero value have driver manually pad zeros for short frames +with the cost of extra CPU cycles. +The default valus is 0 to let hardware automatically pad short frames. +.El .Sh DIAGNOSTICS .Bl -diag .It "sis%d: couldn't map ports/memory" @@ -190,6 +206,7 @@ the card should be configured correctly. .Xr netintro 4 , .Xr ng_ether 4 , .Xr polling 4 , +.Xr vlan 4 , .Xr ifconfig 8 .Rs .%T SiS 900 and SiS 7016 datasheets From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 18:27:42 2010 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 AF981106570D; Thu, 2 Sep 2010 18:27:42 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 623548FC14; Thu, 2 Sep 2010 18:27:42 +0000 (UTC) Received: by pvg4 with SMTP id 4so328973pvg.13 for ; Thu, 02 Sep 2010 11:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=m0aFOCp8cBbflnSqyoiZM/pWLhWMNL1BcayJn9pp6vM=; b=IGxT3pxNMJdr+C2Q1PegfJxo/UJ5KvZskRoKDY4oFU/R5opJI4eGdMgo8lrU7I/R/H eKvRRH0U2F0z2RfX9gadvwWEEBefJNZk4BPzF7Fi76EQwgkWDkHqgMu0uPXf5tEKWXt2 FRicMje8y1w7ch3H+lb4YbjuNJI0j5JyrpHFs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=GL9QW4edHJdMsj0fmEkE4dqVj/WD9n1dDMnWuirQAtT9dCm8xMyZeJ7y6CHYC7Akbm MKCqEajIMvuslYyBbfaFc4ZieHFM4p8l0oFW3AE7h97EyTEkTjr+2p482v2ogxLPRG2y rbLiQG/OLhwya/+u3KPaoP5P9sKQlntdsT6hI= Received: by 10.114.131.2 with SMTP id e2mr153278wad.158.1283452041974; Thu, 02 Sep 2010 11:27:21 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id d38sm1500271wam.8.2010.09.02.11.27.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 02 Sep 2010 11:27:19 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Thu, 2 Sep 2010 11:26:52 -0700 From: Pyun YongHyeon Date: Thu, 2 Sep 2010 11:26:52 -0700 To: Pyun YongHyeon Message-ID: <20100902182652.GB21940@michelle.cdnetworks.com> References: <201009021810.o82IABBH014565@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201009021810.o82IABBH014565@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212157 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: "SVN commit messages 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, 02 Sep 2010 18:27:42 -0000 On Thu, Sep 02, 2010 at 06:10:11PM +0000, Pyun YongHyeon wrote: > Author: yongari > Date: Thu Sep 2 18:10:11 2010 > New Revision: 212157 > URL: http://svn.freebsd.org/changeset/base/212157 > > Log: > Unlike most other controllers, NS DP83815/DP83816 controllers seem > to pad with 0xFF when it encounter short frames. According to RFC > 1042 the pad bytes should be 0x00. > Because manual padding consumes extra CPU cycles, introduce a new > tunable which controls the padding behavior. Turning this tunable > on will have driver pad manually but it's disabled by default. Users > can enable software padding by setting the following tunable to > non-zero value. > > dev.sis.%d.manual_pad="1" > > PR: kern/35422 (patch not used) Opps, it should be read kern/35442. From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 19:40:29 2010 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 E575410657F2; Thu, 2 Sep 2010 19:40:28 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1E588FC14; Thu, 2 Sep 2010 19:40:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82JeSVk017546; Thu, 2 Sep 2010 19:40:28 GMT (envelope-from gibbs@svn.freebsd.org) Received: (from gibbs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82JeS8M017537; Thu, 2 Sep 2010 19:40:28 GMT (envelope-from gibbs@svn.freebsd.org) Message-Id: <201009021940.o82JeS8M017537@svn.freebsd.org> From: "Justin T. Gibbs" Date: Thu, 2 Sep 2010 19:40: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: r212160 - in head/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched 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: Thu, 02 Sep 2010 19:40:29 -0000 Author: gibbs Date: Thu Sep 2 19:40:28 2010 New Revision: 212160 URL: http://svn.freebsd.org/changeset/base/212160 Log: Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic. Add the BIO_ORDERED flag for struct bio and update bio clients to use it. The barrier semantics of bioq_insert_tail() were broken in two ways: o In bioq_disksort(), an added bio could be inserted at the head of the queue, even when a barrier was present, if the sort key for the new entry was less than that of the last queued barrier bio. o The last_offset used to generate the sort key for newly queued bios did not stay at the position of the barrier until either the barrier was de-queued, or a new barrier (which updates last_offset) was queued. When a barrier is in effect, we know that the disk will pass through the barrier position just before the "blocked bios" are released, so using the barrier's offset for last_offset is the optimal choice. sys/geom/sched/subr_disk.c: sys/kern/subr_disk.c: o Update last_offset in bioq_insert_tail(). o Only update last_offset in bioq_remove() if the removed bio is at the head of the queue (typically due to a call via bioq_takefirst()) and no barrier is active. o In bioq_disksort(), if we have a barrier (insert_point is non-NULL), set prev to the barrier and cur to it's next element. Now that last_offset is kept at the barrier position, this change isn't strictly necessary, but since we have to take a decision branch anyway, it does avoid one, no-op, loop iteration in the while loop that immediately follows. o In bioq_disksort(), bypass the normal sort for bios with the BIO_ORDERED attribute and instead insert them into the queue with bioq_insert_tail(). bioq_insert_tail() not only gives the desired command order during insertion, but also provides barrier semantics so that commands disksorted in the future cannot pass the just enqueued transaction. sys/sys/bio.h: Add BIO_ORDERED as bit 4 of the bio_flags field in struct bio. sys/cam/ata/ata_da.c: sys/cam/scsi/scsi_da.c Use an ordered command for SCSI/ATA-NCQ commands issued in response to bios with the BIO_ORDERED flag set. sys/cam/scsi/scsi_da.c Use an ordered tag when issuing a synchronize cache command. Wrap some lines to 80 columns. sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c sys/geom/geom_io.c Mark bios with the BIO_FLUSH command as BIO_ORDERED. Sponsored by: Spectra Logic Corporation MFC after: 1 month Modified: head/sys/cam/ata/ata_da.c head/sys/cam/scsi/scsi_da.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/geom/geom_io.c head/sys/geom/sched/subr_disk.c head/sys/kern/subr_disk.c head/sys/sys/bio.h Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Sep 2 18:22:06 2010 (r212159) +++ head/sys/cam/ata/ata_da.c Thu Sep 2 19:40:28 2010 (r212160) @@ -874,7 +874,8 @@ adastart(struct cam_periph *periph, unio } bioq_remove(&softc->bio_queue, bp); - if ((softc->flags & ADA_FLAG_NEED_OTAG) != 0) { + if ((bp->bio_flags & BIO_ORDERED) != 0 + || (softc->flags & ADA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~ADA_FLAG_NEED_OTAG; softc->ordered_tag_count++; tag_code = 0; Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu Sep 2 18:22:06 2010 (r212159) +++ head/sys/cam/scsi/scsi_da.c Thu Sep 2 19:40:28 2010 (r212160) @@ -1354,7 +1354,8 @@ dastart(struct cam_periph *periph, union bioq_remove(&softc->bio_queue, bp); - if ((softc->flags & DA_FLAG_NEED_OTAG) != 0) { + if ((bp->bio_flags & BIO_ORDERED) != 0 + || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~DA_FLAG_NEED_OTAG; softc->ordered_tag_count++; tag_code = MSG_ORDERED_Q_TAG; @@ -1368,7 +1369,8 @@ dastart(struct cam_periph *periph, union /*retries*/da_retry_count, /*cbfcnp*/dadone, /*tag_action*/tag_code, - /*read_op*/bp->bio_cmd == BIO_READ, + /*read_op*/bp->bio_cmd + == BIO_READ, /*byte2*/0, softc->minimum_cmd_size, /*lba*/bp->bio_pblkno, @@ -1377,17 +1379,24 @@ dastart(struct cam_periph *periph, union /*data_ptr*/ bp->bio_data, /*dxfer_len*/ bp->bio_bcount, /*sense_len*/SSD_FULL_SIZE, - /*timeout*/da_default_timeout*1000); + da_default_timeout * 1000); break; case BIO_FLUSH: + /* + * BIO_FLUSH doesn't currently communicate + * range data, so we synchronize the cache + * over the whole disk. We also force + * ordered tag semantics the flush applies + * to all previously queued I/O. + */ scsi_synchronize_cache(&start_ccb->csio, /*retries*/1, /*cbfcnp*/dadone, - MSG_SIMPLE_Q_TAG, - /*begin_lba*/0,/* Cover the whole disk */ + MSG_ORDERED_Q_TAG, + /*begin_lba*/0, /*lb_count*/0, SSD_FULL_SIZE, - /*timeout*/da_default_timeout*1000); + da_default_timeout*1000); break; } start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Sep 2 18:22:06 2010 (r212159) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Sep 2 19:40:28 2010 (r212160) @@ -598,6 +598,7 @@ sendreq: break; case ZIO_TYPE_IOCTL: bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; bp->bio_data = NULL; bp->bio_offset = cp->provider->mediasize; bp->bio_length = 0; Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Thu Sep 2 18:22:06 2010 (r212159) +++ head/sys/geom/geom_io.c Thu Sep 2 19:40:28 2010 (r212160) @@ -265,6 +265,7 @@ g_io_flush(struct g_consumer *cp) g_trace(G_T_BIO, "bio_flush(%s)", cp->provider->name); bp = g_alloc_bio(); bp->bio_cmd = BIO_FLUSH; + bp->bio_flags |= BIO_ORDERED; bp->bio_done = NULL; bp->bio_attribute = NULL; bp->bio_offset = cp->provider->mediasize; Modified: head/sys/geom/sched/subr_disk.c ============================================================================== --- head/sys/geom/sched/subr_disk.c Thu Sep 2 18:22:06 2010 (r212159) +++ head/sys/geom/sched/subr_disk.c Thu Sep 2 19:40:28 2010 (r212160) @@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$"); * bioq_remove() remove a generic element from the queue, act as * bioq_takefirst() if invoked on the head of the queue. * - * The semantic of these methods is the same of the operations + * The semantic of these methods is the same as the operations * on the underlying TAILQ, but with additional guarantees on * subsequent bioq_disksort() calls. E.g. bioq_insert_tail() * can be useful for making sure that all previous ops are flushed @@ -115,10 +115,10 @@ void gs_bioq_remove(struct bio_queue_head *head, struct bio *bp) { - if (bp == TAILQ_FIRST(&head->queue)) - head->last_offset = bp->bio_offset + bp->bio_length; - - if (bp == head->insert_point) + if (head->insert_point == NULL) { + if (bp == TAILQ_FIRST(&head->queue)) + head->last_offset = bp->bio_offset + bp->bio_length; + } else if (bp == head->insert_point) head->insert_point = NULL; TAILQ_REMOVE(&head->queue, bp, bio_queue); @@ -137,7 +137,8 @@ void gs_bioq_insert_head(struct bio_queue_head *head, struct bio *bp) { - head->last_offset = bp->bio_offset; + if (head->insert_point == NULL) + head->last_offset = bp->bio_offset; TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue); } @@ -147,6 +148,7 @@ gs_bioq_insert_tail(struct bio_queue_hea TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue); head->insert_point = bp; + head->last_offset = bp->bio_offset; } struct bio * @@ -189,13 +191,28 @@ gs_bioq_bio_key(struct bio_queue_head *h void gs_bioq_disksort(struct bio_queue_head *head, struct bio *bp) { - struct bio *cur, *prev = NULL; - uoff_t key = gs_bioq_bio_key(head, bp); + struct bio *cur, *prev; + uoff_t key; + if ((bp->bio_flags & BIO_ORDERED) != 0) { + /* + * Ordered transactions can only be dispatched + * after any currently queued transactions. They + * also have barrier semantics - no transactions + * queued in the future can pass them. + */ + gs_bioq_insert_tail(head, bp); + return; + } + + prev = NULL; + key = gs_bioq_bio_key(head, bp); cur = TAILQ_FIRST(&head->queue); - if (head->insert_point) - cur = head->insert_point; + if (head->insert_point) { + prev = head->insert_point; + cur = TAILQ_NEXT(head->insert_point, bio_queue); + } while (cur != NULL && key >= gs_bioq_bio_key(head, cur)) { prev = cur; Modified: head/sys/kern/subr_disk.c ============================================================================== --- head/sys/kern/subr_disk.c Thu Sep 2 18:22:06 2010 (r212159) +++ head/sys/kern/subr_disk.c Thu Sep 2 19:40:28 2010 (r212160) @@ -127,7 +127,7 @@ disk_err(struct bio *bp, const char *wha * bioq_remove() remove a generic element from the queue, act as * bioq_takefirst() if invoked on the head of the queue. * - * The semantic of these methods is the same of the operations + * The semantic of these methods is the same as the operations * on the underlying TAILQ, but with additional guarantees on * subsequent bioq_disksort() calls. E.g. bioq_insert_tail() * can be useful for making sure that all previous ops are flushed @@ -156,10 +156,10 @@ void bioq_remove(struct bio_queue_head *head, struct bio *bp) { - if (bp == TAILQ_FIRST(&head->queue)) - head->last_offset = bp->bio_offset + bp->bio_length; - - if (bp == head->insert_point) + if (head->insert_point == NULL) { + if (bp == TAILQ_FIRST(&head->queue)) + head->last_offset = bp->bio_offset + bp->bio_length; + } else if (bp == head->insert_point) head->insert_point = NULL; TAILQ_REMOVE(&head->queue, bp, bio_queue); @@ -178,7 +178,8 @@ void bioq_insert_head(struct bio_queue_head *head, struct bio *bp) { - head->last_offset = bp->bio_offset; + if (head->insert_point == NULL) + head->last_offset = bp->bio_offset; TAILQ_INSERT_HEAD(&head->queue, bp, bio_queue); } @@ -188,6 +189,7 @@ bioq_insert_tail(struct bio_queue_head * TAILQ_INSERT_TAIL(&head->queue, bp, bio_queue); head->insert_point = bp; + head->last_offset = bp->bio_offset; } struct bio * @@ -230,13 +232,28 @@ bioq_bio_key(struct bio_queue_head *head void bioq_disksort(struct bio_queue_head *head, struct bio *bp) { - struct bio *cur, *prev = NULL; - uoff_t key = bioq_bio_key(head, bp); + struct bio *cur, *prev; + uoff_t key; + if ((bp->bio_flags & BIO_ORDERED) != 0) { + /* + * Ordered transactions can only be dispatched + * after any currently queued transactions. They + * also have barrier semantics - no transactions + * queued in the future can pass them. + */ + bioq_insert_tail(head, bp); + return; + } + + prev = NULL; + key = bioq_bio_key(head, bp); cur = TAILQ_FIRST(&head->queue); - if (head->insert_point) - cur = head->insert_point; + if (head->insert_point) { + prev = head->insert_point; + cur = TAILQ_NEXT(head->insert_point, bio_queue); + } while (cur != NULL && key >= bioq_bio_key(head, cur)) { prev = cur; Modified: head/sys/sys/bio.h ============================================================================== --- head/sys/sys/bio.h Thu Sep 2 18:22:06 2010 (r212159) +++ head/sys/sys/bio.h Thu Sep 2 19:40:28 2010 (r212160) @@ -54,6 +54,7 @@ #define BIO_ERROR 0x01 #define BIO_DONE 0x02 #define BIO_ONQUEUE 0x04 +#define BIO_ORDERED 0x08 #ifdef _KERNEL struct disk; From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 20:43:01 2010 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 69E3A1065750; Thu, 2 Sep 2010 20:43:01 +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 589958FC1B; Thu, 2 Sep 2010 20:43:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82Kh1qK019543; Thu, 2 Sep 2010 20:43:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82Kh1eb019541; Thu, 2 Sep 2010 20:43:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009022043.o82Kh1eb019541@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 2 Sep 2010 20:43: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: r212161 - 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: Thu, 02 Sep 2010 20:43:01 -0000 Author: yongari Date: Thu Sep 2 20:43:01 2010 New Revision: 212161 URL: http://svn.freebsd.org/changeset/base/212161 Log: Better wording. Submitted by: jkim Modified: head/share/man/man4/sis.4 Modified: head/share/man/man4/sis.4 ============================================================================== --- head/share/man/man4/sis.4 Thu Sep 2 19:40:28 2010 (r212160) +++ head/share/man/man4/sis.4 Thu Sep 2 20:43:01 2010 (r212161) @@ -157,9 +157,9 @@ This variable controls how to pad short controllers on the specified device. DP83815/DP83816 controllers are known to pad 0xFF for short frames which is violation of RFC 1042. -A non-zero value have driver manually pad zeros for short frames -with the cost of extra CPU cycles. -The default valus is 0 to let hardware automatically pad short frames. +Set this variable to a non-zero value to let driver manually pad +each short frame with zeros at the cost of extra CPU cycles. +The default value is 0 to let hardware perform automatic padding. .El .Sh DIAGNOSTICS .Bl -diag From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 21:29:50 2010 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 F1BDD1065721; Thu, 2 Sep 2010 21:29:50 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E067E8FC1D; Thu, 2 Sep 2010 21:29:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82LToaW021121; Thu, 2 Sep 2010 21:29:50 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82LTo29021119; Thu, 2 Sep 2010 21:29:50 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201009022129.o82LTo29021119@svn.freebsd.org> From: Gavin Atkinson Date: Thu, 2 Sep 2010 21:29: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: r212162 - head/usr.bin/split X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 21:29:51 -0000 Author: gavin Date: Thu Sep 2 21:29:50 2010 New Revision: 212162 URL: http://svn.freebsd.org/changeset/base/212162 Log: Correct spelling mistake, int -> into MFC after: 3 days Modified: head/usr.bin/split/split.1 Modified: head/usr.bin/split/split.1 ============================================================================== --- head/usr.bin/split/split.1 Thu Sep 2 20:43:01 2010 (r212161) +++ head/usr.bin/split/split.1 Thu Sep 2 21:29:50 2010 (r212162) @@ -32,7 +32,7 @@ .\" @(#)split.1 8.3 (Berkeley) 4/16/94 .\" $FreeBSD$ .\" -.Dd January 23, 2009 +.Dd September 2, 2010 .Dt SPLIT 1 .Os .Sh NAME @@ -117,7 +117,7 @@ Create split files .Ar line_count lines in length. .It Fl n Ar chunk_count -Split file int +Split file into .Ar chunk_count smaller files. .It Fl p Ar pattern From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 21:39:54 2010 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 F27B710657DD; Thu, 2 Sep 2010 21:39:53 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 20FD58FC21; Thu, 2 Sep 2010 21:39:42 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id A964A45E11; Thu, 2 Sep 2010 23:39:40 +0200 (CEST) Received: from localhost (chello089077043238.chello.pl [89.77.43.238]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 9918B45CDD; Thu, 2 Sep 2010 23:39:35 +0200 (CEST) Date: Thu, 2 Sep 2010 23:39:26 +0200 From: Pawel Jakub Dawidek To: "Justin T. Gibbs" Message-ID: <20100902213926.GA2542@garage.freebsd.pl> References: <201009021940.o82JeS8M017537@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: <201009021940.o82JeS8M017537@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212160 - in head/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched 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: Thu, 02 Sep 2010 21:39:54 -0000 --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 02, 2010 at 07:40:28PM +0000, Justin T. Gibbs wrote: > Author: gibbs > Date: Thu Sep 2 19:40:28 2010 > New Revision: 212160 > URL: http://svn.freebsd.org/changeset/base/212160 >=20 > Log: > Correct bioq_disksort so that bioq_insert_tail() offers barrier semanti= c. Thank you for working on this, Justin! > sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > sys/geom/geom_io.c > Mark bios with the BIO_FLUSH command as BIO_ORDERED. [...] Don't you think it would be better to set the flag from within g_io_request()? This way every BIO_FLUSH consumer doesn't have to remember to set it. Or am I missing something? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --4Ckj6UjgE2iN1+kY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyAGY4ACgkQForvXbEpPzQ3gwCdF0QP84b130HXi+HoDuk2ppKw kv4Anj3WqnLR8uTTKBkrTdnyH0MR9gor =4+At -----END PGP SIGNATURE----- --4Ckj6UjgE2iN1+kY-- From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 21:48:36 2010 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 2CC5B106581E; Thu, 2 Sep 2010 21:48:36 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B0038FC17; Thu, 2 Sep 2010 21:48:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82LmauJ021545; Thu, 2 Sep 2010 21:48:36 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82LmZRS021543; Thu, 2 Sep 2010 21:48:35 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201009022148.o82LmZRS021543@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 2 Sep 2010 21:48: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: r212163 - head/usr.bin/calendar/calendars/fr_FR.ISO8859-1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 21:48:36 -0000 Author: edwin Date: Thu Sep 2 21:48:35 2010 New Revision: 212163 URL: http://svn.freebsd.org/changeset/base/212163 Log: Adding a missing firstname (Monique) PR: conf/150049 Submitted by: Thierry Thomas Modified: head/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Modified: head/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes ============================================================================== --- head/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Thu Sep 2 21:29:50 2010 (r212162) +++ head/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Thu Sep 2 21:48:35 2010 (r212163) @@ -382,7 +382,7 @@ LANG=fr_FR.ISO8859-1 08/26 Bonne fête aux Zéphirin ! 08/26 Aujourd'hui, c'est la St(e) Eulade. 08/27 N'oubliez pas les Edwige ! -08/27 Bonne fête aux Joseph ! +08/27 Bonne fête aux Monique et aux Joseph ! 08/28 Aujourd'hui, c'est la St(e) Augustin. 08/29 N'oubliez pas les Sabine ! 08/30 Bonne fête aux Fiacre ! From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 21:52:43 2010 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 CA6C11065716; Thu, 2 Sep 2010 21:52:43 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7D778FC0A; Thu, 2 Sep 2010 21:52:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82LqhMq021677; Thu, 2 Sep 2010 21:52:43 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82LqhNZ021675; Thu, 2 Sep 2010 21:52:43 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201009022152.o82LqhNZ021675@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 2 Sep 2010 21:52: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: r212164 - stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 21:52:43 -0000 Author: edwin Date: Thu Sep 2 21:52:43 2010 New Revision: 212164 URL: http://svn.freebsd.org/changeset/base/212164 Log: Add nameday for Monique PR: conf/150049 Submitted by: Thierry Thomas Modified: stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Directory Properties: stable/8/usr.bin/calendar/ (props changed) Modified: stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes ============================================================================== --- stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Thu Sep 2 21:48:35 2010 (r212163) +++ stable/8/usr.bin/calendar/calendars/fr_FR.ISO8859-1/calendar.fetes Thu Sep 2 21:52:43 2010 (r212164) @@ -382,7 +382,7 @@ LANG=fr_FR.ISO8859-1 08/26 Bonne fête aux Zéphirin ! 08/26 Aujourd'hui, c'est la St(e) Eulade. 08/27 N'oubliez pas les Edwige ! -08/27 Bonne fête aux Joseph ! +08/27 Bonne fête aux Monique et aux Joseph ! 08/28 Aujourd'hui, c'est la St(e) Augustin. 08/29 N'oubliez pas les Sabine ! 08/30 Bonne fête aux Fiacre ! From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 22:18:05 2010 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 B239910657E0; Thu, 2 Sep 2010 22:18:05 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from aslan.scsiguy.com (aslan.scsiguy.com [70.89.174.89]) by mx1.freebsd.org (Postfix) with ESMTP id 72D538FC1C; Thu, 2 Sep 2010 22:18:05 +0000 (UTC) Received: from [192.168.4.137] (207-225-98-3.dia.static.qwest.net [207.225.98.3]) (authenticated bits=0) by aslan.scsiguy.com (8.14.4/8.14.4) with ESMTP id o82M7eJA004236 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 2 Sep 2010 16:07:42 -0600 (MDT) (envelope-from gibbs@FreeBSD.org) Message-ID: <4C802028.4040400@FreeBSD.org> Date: Thu, 02 Sep 2010 16:07:36 -0600 From: "Justin T. Gibbs" Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.9) Gecko/20100825 Thunderbird/3.1.3 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201009021940.o82JeS8M017537@svn.freebsd.org> <20100902213926.GA2542@garage.freebsd.pl> In-Reply-To: <20100902213926.GA2542@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212160 - in head/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gibbs@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: Thu, 02 Sep 2010 22:18:05 -0000 On 9/2/2010 3:39 PM, Pawel Jakub Dawidek wrote: > On Thu, Sep 02, 2010 at 07:40:28PM +0000, Justin T. Gibbs wrote: >> Author: gibbs >> Date: Thu Sep 2 19:40:28 2010 >> New Revision: 212160 >> URL: http://svn.freebsd.org/changeset/base/212160 >> >> Log: >> Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic. ... >> sys/geom/geom_io.c >> Mark bios with the BIO_FLUSH command as BIO_ORDERED. > [...] > > Don't you think it would be better to set the flag from within > g_io_request()? This way every BIO_FLUSH consumer doesn't have to > remember to set it. Or am I missing something? I don't feel strongly one way or the other, but I thought that g_io_request()'s job was to execute the request and to test invariants, not to set policy. Perhaps I misinterpreted it's role. -- Justin From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 22:20:28 2010 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 440A71065877; Thu, 2 Sep 2010 22:20:28 +0000 (UTC) (envelope-from mj@feral.com) Received: from ns1.feral.com (ns1.feral.com [192.67.166.1]) by mx1.freebsd.org (Postfix) with ESMTP id 0B7138FC08; Thu, 2 Sep 2010 22:20:27 +0000 (UTC) Received: from [192.168.221.2] (remotevpn [192.168.221.2]) by ns1.feral.com (8.14.3/8.14.3) with ESMTP id o82MKLI8018470 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 2 Sep 2010 15:20:27 -0700 (PDT) (envelope-from mj@feral.com) Message-ID: <4C80231F.4080806@feral.com> Date: Thu, 02 Sep 2010 15:20:15 -0700 From: Matthew Jacob Organization: Feral Software User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 To: gibbs@FreeBSD.org References: <201009021940.o82JeS8M017537@svn.freebsd.org> <20100902213926.GA2542@garage.freebsd.pl> <4C802028.4040400@FreeBSD.org> In-Reply-To: <4C802028.4040400@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.2.6 (ns1.feral.com [192.168.221.1]); Thu, 02 Sep 2010 15:20:27 -0700 (PDT) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Pawel Jakub Dawidek Subject: Re: svn commit: r212160 - in head/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched 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: Thu, 02 Sep 2010 22:20:28 -0000 FWIW, policy should be set the callers of g_io_request (IMO) > I don't feel strongly one way or the other, but I thought that > g_io_request()'s job was to execute the request and to test invariants, > not to set policy. Perhaps I misinterpreted it's role. > > -- > Justin > From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 22:26:50 2010 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 2F19C1065675; Thu, 2 Sep 2010 22:26:50 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D5AB8FC19; Thu, 2 Sep 2010 22:26:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82MQo0U023075; Thu, 2 Sep 2010 22:26:50 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82MQoCs023073; Thu, 2 Sep 2010 22:26:50 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201009022226.o82MQoCs023073@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 2 Sep 2010 22:26: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: r212165 - head/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, 02 Sep 2010 22:26:50 -0000 Author: nwhitehorn Date: Thu Sep 2 22:26:49 2010 New Revision: 212165 URL: http://svn.freebsd.org/changeset/base/212165 Log: In the case of non-sequential mappings, ofw_mapmem() could ask Open Firmware to map a memory region with negative length, causing crashes and Undefined Behavior. Add the appropriate check to make the behavior defined. Modified: head/sys/boot/ofw/libofw/ofw_copy.c Modified: head/sys/boot/ofw/libofw/ofw_copy.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_copy.c Thu Sep 2 21:52:43 2010 (r212164) +++ head/sys/boot/ofw/libofw/ofw_copy.c Thu Sep 2 22:26:49 2010 (r212165) @@ -68,7 +68,7 @@ ofw_mapmem(vm_offset_t dest, const size_ /* * Trim area covered by existing mapping, if any */ - if (dest < (last_dest + last_len)) { + if (dest < (last_dest + last_len) && dest >= last_dest) { nlen -= (last_dest + last_len) - dest; dest = last_dest + last_len; } From owner-svn-src-all@FreeBSD.ORG Thu Sep 2 22:37:14 2010 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 5654B1065781; Thu, 2 Sep 2010 22:37:14 +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 4537F8FC16; Thu, 2 Sep 2010 22:37:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o82MbE4L023295; Thu, 2 Sep 2010 22:37:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o82MbE0n023293; Thu, 2 Sep 2010 22:37:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009022237.o82MbE0n023293@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 2 Sep 2010 22:37: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: r212166 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 02 Sep 2010 22:37:14 -0000 Author: yongari Date: Thu Sep 2 22:37:13 2010 New Revision: 212166 URL: http://svn.freebsd.org/changeset/base/212166 Log: Implement initial device suspend/resume method. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Thu Sep 2 22:26:49 2010 (r212165) +++ head/sys/dev/sis/if_sis.c Thu Sep 2 22:37:13 2010 (r212166) @@ -2393,6 +2393,35 @@ sis_shutdown(device_t dev) return (0); } +static int +sis_suspend(device_t dev) +{ + struct sis_softc *sc; + + sc = device_get_softc(dev); + SIS_LOCK(sc); + sis_stop(sc); + SIS_UNLOCK(sc); + return (0); +} + +static int +sis_resume(device_t dev) +{ + struct sis_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + SIS_LOCK(sc); + ifp = sc->sis_ifp; + if ((ifp->if_flags & IFF_UP) != 0) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + sis_initl(sc); + } + SIS_UNLOCK(sc); + return (0); +} + static void sis_add_sysctls(struct sis_softc *sc) { @@ -2425,6 +2454,8 @@ static device_method_t sis_methods[] = { DEVMETHOD(device_attach, sis_attach), DEVMETHOD(device_detach, sis_detach), DEVMETHOD(device_shutdown, sis_shutdown), + DEVMETHOD(device_suspend, sis_suspend), + DEVMETHOD(device_resume, sis_resume), /* bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 00:34:45 2010 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 AD0191065869; Fri, 3 Sep 2010 00:34:45 +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 9BEA28FC0C; Fri, 3 Sep 2010 00:34:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o830Yjf9027054; Fri, 3 Sep 2010 00:34:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o830Yj1K027051; Fri, 3 Sep 2010 00:34:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009030034.o830Yj1K027051@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 3 Sep 2010 00:34: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: r212167 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 00:34:45 -0000 Author: yongari Date: Fri Sep 3 00:34:45 2010 New Revision: 212167 URL: http://svn.freebsd.org/changeset/base/212167 Log: Initial WOL support. NS DP8315 was tested but SiS900/SiS7016 was not tested. While I'm here, clean up SIOCSIFCAP handler. Modified: head/sys/dev/sis/if_sis.c head/sys/dev/sis/if_sisreg.h Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Thu Sep 2 22:37:13 2010 (r212166) +++ head/sys/dev/sis/if_sis.c Fri Sep 3 00:34:45 2010 (r212167) @@ -147,12 +147,15 @@ static void sis_initl(struct sis_softc * static void sis_intr(void *); static int sis_ioctl(struct ifnet *, u_long, caddr_t); static int sis_newbuf(struct sis_softc *, struct sis_rxdesc *); +static int sis_resume(device_t); static int sis_rxeof(struct sis_softc *); static void sis_start(struct ifnet *); static void sis_startl(struct ifnet *); static void sis_stop(struct sis_softc *); +static int sis_suspend(device_t); static void sis_add_sysctls(struct sis_softc *); static void sis_watchdog(struct sis_softc *); +static void sis_wol(struct sis_softc *); static struct resource_spec sis_res_spec[] = { @@ -935,6 +938,9 @@ sis_reset(struct sis_softc *sc) if (sc->sis_type == SIS_TYPE_83815) { CSR_WRITE_4(sc, NS_CLKRUN, NS_CLKRUN_PMESTS); CSR_WRITE_4(sc, NS_CLKRUN, 0); + } else { + /* Disable WOL functions. */ + CSR_WRITE_4(sc, SIS_PWRMAN_CTL, 0); } } @@ -971,7 +977,7 @@ sis_attach(device_t dev) u_char eaddr[ETHER_ADDR_LEN]; struct sis_softc *sc; struct ifnet *ifp; - int error = 0, waittime = 0; + int error = 0, pmc, waittime = 0; waittime = 0; sc = device_get_softc(dev); @@ -1147,6 +1153,14 @@ sis_attach(device_t dev) ifp->if_snd.ifq_drv_maxlen = SIS_TX_LIST_CNT - 1; IFQ_SET_READY(&ifp->if_snd); + if (pci_find_extcap(sc->sis_dev, PCIY_PMG, &pmc) == 0) { + if (sc->sis_type == SIS_TYPE_83815) + ifp->if_capabilities |= IFCAP_WOL; + else + ifp->if_capabilities |= IFCAP_WOL_MAGIC; + ifp->if_capenable = ifp->if_capabilities; + } + /* * Do MII setup. */ @@ -2227,7 +2241,7 @@ sis_ioctl(struct ifnet *ifp, u_long comm struct sis_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; struct mii_data *mii; - int error = 0; + int error = 0, mask; switch (command) { case SIOCSIFFLAGS: @@ -2264,32 +2278,37 @@ sis_ioctl(struct ifnet *ifp, u_long comm error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; case SIOCSIFCAP: - /* ok, disable interrupts */ + SIS_LOCK(sc); + mask = ifr->ifr_reqcap ^ ifp->if_capenable; #ifdef DEVICE_POLLING - if (ifr->ifr_reqcap & IFCAP_POLLING && - !(ifp->if_capenable & IFCAP_POLLING)) { - error = ether_poll_register(sis_poll, ifp); - if (error) - return (error); - SIS_LOCK(sc); - /* Disable interrupts */ - CSR_WRITE_4(sc, SIS_IER, 0); - ifp->if_capenable |= IFCAP_POLLING; - SIS_UNLOCK(sc); - return (error); - - } - if (!(ifr->ifr_reqcap & IFCAP_POLLING) && - ifp->if_capenable & IFCAP_POLLING) { - error = ether_poll_deregister(ifp); - /* Enable interrupts. */ - SIS_LOCK(sc); - CSR_WRITE_4(sc, SIS_IER, 1); - ifp->if_capenable &= ~IFCAP_POLLING; - SIS_UNLOCK(sc); - return (error); + if ((mask & IFCAP_POLLING) != 0 && + (IFCAP_POLLING & ifp->if_capabilities) != 0) { + ifp->if_capenable ^= IFCAP_POLLING; + if ((IFCAP_POLLING & ifp->if_capenable) != 0) { + error = ether_poll_register(sis_poll, ifp); + if (error != 0) { + SIS_UNLOCK(sc); + break; + } + /* Disable interrupts. */ + CSR_WRITE_4(sc, SIS_IER, 0); + } else { + error = ether_poll_deregister(ifp); + /* Enable interrupts. */ + CSR_WRITE_4(sc, SIS_IER, 1); + } } #endif /* DEVICE_POLLING */ + if ((mask & IFCAP_WOL) != 0 && + (ifp->if_capabilities & IFCAP_WOL) != 0) { + if ((mask & IFCAP_WOL_UCAST) != 0) + ifp->if_capenable ^= IFCAP_WOL_UCAST; + if ((mask & IFCAP_WOL_MCAST) != 0) + ifp->if_capenable ^= IFCAP_WOL_MCAST; + if ((mask & IFCAP_WOL_MAGIC) != 0) + ifp->if_capenable ^= IFCAP_WOL_MAGIC; + } + SIS_UNLOCK(sc); break; default: error = ether_ioctl(ifp, command, data); @@ -2384,13 +2403,8 @@ sis_stop(struct sis_softc *sc) static int sis_shutdown(device_t dev) { - struct sis_softc *sc; - sc = device_get_softc(dev); - SIS_LOCK(sc); - sis_stop(sc); - SIS_UNLOCK(sc); - return (0); + return (sis_suspend(dev)); } static int @@ -2401,6 +2415,7 @@ sis_suspend(device_t dev) sc = device_get_softc(dev); SIS_LOCK(sc); sis_stop(sc); + sis_wol(sc); SIS_UNLOCK(sc); return (0); } @@ -2423,6 +2438,56 @@ sis_resume(device_t dev) } static void +sis_wol(struct sis_softc *sc) +{ + struct ifnet *ifp; + uint32_t val; + uint16_t pmstat; + int pmc; + + ifp = sc->sis_ifp; + if ((ifp->if_capenable & IFCAP_WOL) == 0) + return; + + if (sc->sis_type == SIS_TYPE_83815) { + /* Reset RXDP. */ + CSR_WRITE_4(sc, SIS_RX_LISTPTR, 0); + + /* Configure WOL events. */ + CSR_READ_4(sc, NS_WCSR); + val = 0; + if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) + val |= NS_WCSR_WAKE_UCAST; + if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) + val |= NS_WCSR_WAKE_MCAST; + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + val |= NS_WCSR_WAKE_MAGIC; + CSR_WRITE_4(sc, NS_WCSR, val); + /* Enable PME and clear PMESTS. */ + val = CSR_READ_4(sc, NS_CLKRUN); + val |= NS_CLKRUN_PMEENB | NS_CLKRUN_PMESTS; + CSR_WRITE_4(sc, NS_CLKRUN, val); + /* Enable silent RX mode. */ + SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE); + } else { + if (pci_find_extcap(sc->sis_dev, PCIY_PMG, &pmc) != 0) + return; + val = 0; + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + val |= SIS_PWRMAN_WOL_MAGIC; + CSR_WRITE_4(sc, SIS_PWRMAN_CTL, val); + /* Request PME. */ + pmstat = pci_read_config(sc->sis_dev, + pmc + PCIR_POWER_STATUS, 2); + pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE); + if ((ifp->if_capenable & IFCAP_WOL_MAGIC) != 0) + pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE; + pci_write_config(sc->sis_dev, + pmc + PCIR_POWER_STATUS, pmstat, 2); + } +} + +static void sis_add_sysctls(struct sis_softc *sc) { struct sysctl_ctx_list *ctx; Modified: head/sys/dev/sis/if_sisreg.h ============================================================================== --- head/sys/dev/sis/if_sisreg.h Thu Sep 2 22:37:13 2010 (r212166) +++ head/sys/dev/sis/if_sisreg.h Fri Sep 3 00:34:45 2010 (r212167) @@ -77,6 +77,7 @@ /* NS DP83815/6 registers */ #define NS_IHR 0x1C #define NS_CLKRUN 0x3C +#define NS_WCSR 0x40 #define NS_SRR 0x58 #define NS_BMCR 0x80 #define NS_BMSR 0x84 @@ -99,6 +100,29 @@ #define NS_CLKRUN_PMEENB 0x00000100 #define NS_CLNRUN_CLKRUN_ENB 0x00000001 +#define NS_WCSR_WAKE_PHYINTR 0x00000001 +#define NS_WCSR_WAKE_UCAST 0x00000002 +#define NS_WCSR_WAKE_MCAST 0x00000004 +#define NS_WCSR_WAKE_BCAST 0x00000008 +#define NS_WCSR_WAKE_ARP 0x00000010 +#define NS_WCSR_WAKE_PATTERN0 0x00000020 +#define NS_WCSR_WAKE_PATTERN1 0x00000040 +#define NS_WCSR_WAKE_PATTERN2 0x00000080 +#define NS_WCSR_WAKE_PATTERN3 0x00000100 +#define NS_WCSR_WAKE_MAGIC 0x00000200 +#define NS_WCSR_WAKE_MAGIC_SEC 0x00000400 +#define NS_WCSR_DET_MAGIC_SECH 0x00100000 +#define NS_WCSR_DET_PHYINTR 0x00400000 +#define NS_WCSR_DET_UCAST 0x00800000 +#define NS_WCSR_DET_MCAST 0x01000000 +#define NS_WCSR_DET_BCAST 0x02000000 +#define NS_WCSR_DET_ARP 0x04000000 +#define NS_WCSR_DET_PATTERN0 0x08000000 +#define NS_WCSR_DET_PATTERN1 0x10000000 +#define NS_WCSR_DET_PATTERN2 0x20000000 +#define NS_WCSR_DET_PATTERN3 0x40000000 +#define NS_WCSR_DET_MAGIC 0x80000000 + /* NS silicon revisions */ #define NS_SRR_15C 0x302 #define NS_SRR_15D 0x403 @@ -303,6 +327,10 @@ #define NS_FILTADDR_FMEM_LO 0x00000200 #define NS_FILTADDR_FMEM_HI 0x000003FE +#define SIS_PWRMAN_WOL_LINK_OFF 0x00000001 +#define SIS_PWRMAN_WOL_LINK_ON 0x00000002 +#define SIS_PWRMAN_WOL_MAGIC 0x00000400 + /* * TX/RX DMA descriptor structures. */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 03:20:36 2010 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 AF928106573A; Fri, 3 Sep 2010 03:20:36 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F7E28FC16; Fri, 3 Sep 2010 03:20:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o833KaIj031925; Fri, 3 Sep 2010 03:20:36 GMT (envelope-from jmg@svn.freebsd.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o833KYFF031921; Fri, 3 Sep 2010 03:20:34 GMT (envelope-from jmg@svn.freebsd.org) Message-Id: <201009030320.o833KYFF031921@svn.freebsd.org> From: John-Mark Gurney Date: Fri, 3 Sep 2010 03:20:34 +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: r212168 - head/games/fortune/datfiles X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 03:20:36 -0000 Author: jmg Date: Fri Sep 3 03:20:34 2010 New Revision: 212168 URL: http://svn.freebsd.org/changeset/base/212168 Log: fix the move so that it matches what the rest of the internet says about this game... This move also makes more sense... MFC after: 1 week Modified: head/games/fortune/datfiles/fortunes Modified: head/games/fortune/datfiles/fortunes ============================================================================== --- head/games/fortune/datfiles/fortunes Fri Sep 3 00:34:45 2010 (r212167) +++ head/games/fortune/datfiles/fortunes Fri Sep 3 03:20:34 2010 (r212168) @@ -45221,7 +45221,7 @@ of their own homes. 1: P-Q4, Kt-KB3 2: Kt-Q2, P-K4 3: PxP, Kt-Kt5 - 4: P-K6, Kt-K6/ + 4: P-KR3, Kt-K6/ White then resigns on realizing that a fifth move would involve either a Q-KR5 check or the loss of his queen. -- Stephen Pile, "The Book of Heroic Failures" From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 03:48:06 2010 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 6112610656EC; Fri, 3 Sep 2010 03:48:06 +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 512078FC0A; Fri, 3 Sep 2010 03:48:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o833m6sW032588; Fri, 3 Sep 2010 03:48:06 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o833m6mS032586; Fri, 3 Sep 2010 03:48:06 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201009030348.o833m6mS032586@svn.freebsd.org> From: Warner Losh Date: Fri, 3 Sep 2010 03:48:06 +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: r212169 - head/tools/tools/nanobsd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 03:48:06 -0000 Author: imp Date: Fri Sep 3 03:48:06 2010 New Revision: 212169 URL: http://svn.freebsd.org/changeset/base/212169 Log: Allow / in the NANO_DEVICE PR: 149729 Submitted by: Thomas Quinot Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Fri Sep 3 03:20:34 2010 (r212168) +++ head/tools/tools/nanobsd/nanobsd.sh Fri Sep 3 03:48:06 2010 (r212169) @@ -503,7 +503,7 @@ create_i386_diskimage ( ) ( mount /dev/${MD}s2a ${MNT} for f in ${MNT}/etc/fstab ${MNT}/conf/base/etc/fstab do - sed -i "" "s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g" $f + sed -i "" "s=${NANO_DRIVE}s1=${NANO_DRIVE}s2=g" $f done umount ${MNT} fi From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 03:56:09 2010 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 BFDEA106584F; Fri, 3 Sep 2010 03:56:09 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94BDA8FC08; Fri, 3 Sep 2010 03:56:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o833u9Ob032776; Fri, 3 Sep 2010 03:56:09 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o833u9f3032772; Fri, 3 Sep 2010 03:56:09 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201009030356.o833u9f3032772@svn.freebsd.org> From: Peter Grehan Date: Fri, 3 Sep 2010 03:56: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: r212170 - in head/sys/powerpc: conf include powerpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 03:56:09 -0000 Author: grehan Date: Fri Sep 3 03:56:09 2010 New Revision: 212170 URL: http://svn.freebsd.org/changeset/base/212170 Log: - Bump MAXCPU to 4. Tested on a quad G5 with both 32 and 64-bit kernels. A make buildkernel -j4 uses ~360% CPU. - Bracket the AP spinup printf with a mutex to avoid garbled output. - Enable SMP by default on powerpc64. Reviewed by: nwhitehorn Modified: head/sys/powerpc/conf/GENERIC64 head/sys/powerpc/include/param.h head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Fri Sep 3 03:48:06 2010 (r212169) +++ head/sys/powerpc/conf/GENERIC64 Fri Sep 3 03:56:09 2010 (r212170) @@ -76,8 +76,8 @@ options WITNESS #Enable checks to det options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones -# To make an SMP kernel, the next line is needed -#options SMP # Symmetric MultiProcessor Kernel +# Make an SMP-capable kernel by default +options SMP # Symmetric MultiProcessor Kernel # CPU frequency control device cpufreq Modified: head/sys/powerpc/include/param.h ============================================================================== --- head/sys/powerpc/include/param.h Fri Sep 3 03:48:06 2010 (r212169) +++ head/sys/powerpc/include/param.h Fri Sep 3 03:56:09 2010 (r212170) @@ -68,7 +68,7 @@ #endif #if defined(SMP) || defined(KLD_MODULE) -#define MAXCPU 2 +#define MAXCPU 4 #else #define MAXCPU 1 #endif /* SMP || KLD_MODULE */ Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Fri Sep 3 03:48:06 2010 (r212169) +++ head/sys/powerpc/powerpc/mp_machdep.c Fri Sep 3 03:56:09 2010 (r212170) @@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -60,6 +62,7 @@ volatile static u_int ap_letgo; volatile static uint32_t ap_decr; volatile static u_quad_t ap_timebase; static u_int ipi_msg_cnt[32]; +static struct mtx ap_boot_mtx; void machdep_ap_bootstrap(void) @@ -80,8 +83,11 @@ machdep_ap_bootstrap(void) mttb(ap_timebase); __asm __volatile("mtdec %0" :: "r"(ap_decr)); - atomic_add_int(&ap_awake, 1); + /* Serialize console output and AP count increment */ + mtx_lock_spin(&ap_boot_mtx); + ap_awake++; printf("SMP: AP CPU #%d launched\n", PCPU_GET(cpuid)); + mtx_unlock_spin(&ap_boot_mtx); /* Initialize curthread */ PCPU_SET(curthread, PCPU_GET(idlethread)); @@ -203,6 +209,8 @@ cpu_mp_unleash(void *dummy) if (mp_ncpus <= 1) return; + mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); + cpus = 0; smp_cpus = 0; SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 06:24:22 2010 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 9B4C5106578C; Fri, 3 Sep 2010 06:24:22 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id E74848FC0A; Fri, 3 Sep 2010 06:24:10 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 9BA3645C8C; Fri, 3 Sep 2010 08:24:09 +0200 (CEST) Received: from localhost (pdawidek.whl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id ABDC045685; Fri, 3 Sep 2010 08:24:04 +0200 (CEST) Date: Fri, 3 Sep 2010 08:23:55 +0200 From: Pawel Jakub Dawidek To: "Justin T. Gibbs" Message-ID: <20100903062355.GB1780@garage.freebsd.pl> References: <201009021940.o82JeS8M017537@svn.freebsd.org> <20100902213926.GA2542@garage.freebsd.pl> <4C802028.4040400@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pvezYHf7grwyp3Bc" Content-Disposition: inline In-Reply-To: <4C802028.4040400@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r212160 - in head/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched 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: Fri, 03 Sep 2010 06:24:22 -0000 --pvezYHf7grwyp3Bc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 02, 2010 at 04:07:36PM -0600, Justin T. Gibbs wrote: > On 9/2/2010 3:39 PM, Pawel Jakub Dawidek wrote: > > Don't you think it would be better to set the flag from within > > g_io_request()? This way every BIO_FLUSH consumer doesn't have to > > remember to set it. Or am I missing something? >=20 > I don't feel strongly one way or the other, but I thought that > g_io_request()'s job was to execute the request and to test invariants, > not to set policy. Perhaps I misinterpreted it's role. Does BIO_FLUSH make sense without BIO_ORDERED? My understanding is that it doesn't. But we still want BIO_ORDERED for use with BIO_WRITE for write barriers without cache flushing. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --pvezYHf7grwyp3Bc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyAlHsACgkQForvXbEpPzRCZwCg1/3tHQmYuao+m9qF9Nvj2jbH 1DIAn3unwLCsDxs5fiyrOYDeOSHbOl4d =dskq -----END PGP SIGNATURE----- --pvezYHf7grwyp3Bc-- From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 06:30:12 2010 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 A0C3E1065882; Fri, 3 Sep 2010 06:30:12 +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 439998FC1F; Fri, 3 Sep 2010 06:30:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o836UCvr035855; Fri, 3 Sep 2010 06:30:12 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o836UCOG035853; Fri, 3 Sep 2010 06:30:12 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009030630.o836UCOG035853@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 3 Sep 2010 06:30: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: r212171 - 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: Fri, 03 Sep 2010 06:30:12 -0000 Author: jh Date: Fri Sep 3 06:30:11 2010 New Revision: 212171 URL: http://svn.freebsd.org/changeset/base/212171 Log: MFC r209256, r209549, r209816, r209844: - Fix compilation of the subr_unit.c user space test program. - Use %zu for size_t in a few format strings. - Correct a comment typo. - Assert that low and high are >= 0 in new_unrhdr(). Modified: stable/8/sys/kern/subr_unit.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/subr_unit.c ============================================================================== --- stable/8/sys/kern/subr_unit.c Fri Sep 3 03:56:09 2010 (r212170) +++ stable/8/sys/kern/subr_unit.c Fri Sep 3 06:30:11 2010 (r212171) @@ -153,6 +153,7 @@ mtx_assert(struct mtx *mp, int flag) } #define CTASSERT(foo) +#define WITNESS_WARN(flags, lock, fmt, ...) (void)0 #endif /* USERLAND */ @@ -317,7 +318,7 @@ clean_unrhdr(struct unrhdr *uh) /* * Allocate a new unrheader set. * - * Highest and lowest valid values given as paramters. + * Highest and lowest valid values given as parameters. */ struct unrhdr * @@ -325,8 +326,8 @@ new_unrhdr(int low, int high, struct mtx { struct unrhdr *uh; - KASSERT(low <= high, - ("UNR: use error: new_unrhdr(%u, %u)", low, high)); + KASSERT(low >= 0 && low <= high, + ("UNR: use error: new_unrhdr(%d, %d)", low, high)); uh = Malloc(sizeof *uh); if (mutex != NULL) uh->mtx = mutex; @@ -825,9 +826,9 @@ main(int argc __unused, const char **arg memset(a, 0, sizeof a); - fprintf(stderr, "sizeof(struct unr) %d\n", sizeof (struct unr)); - fprintf(stderr, "sizeof(struct unrb) %d\n", sizeof (struct unrb)); - fprintf(stderr, "sizeof(struct unrhdr) %d\n", sizeof (struct unrhdr)); + fprintf(stderr, "sizeof(struct unr) %zu\n", sizeof(struct unr)); + fprintf(stderr, "sizeof(struct unrb) %zu\n", sizeof(struct unrb)); + fprintf(stderr, "sizeof(struct unrhdr) %zu\n", sizeof(struct unrhdr)); fprintf(stderr, "NBITS %d\n", NBITS); x = 1; for (m = 0; m < NN * 100; m++) { From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 07:05:34 2010 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 7D9C81065836; Fri, 3 Sep 2010 07:05:34 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id A29CE8FC18; Fri, 3 Sep 2010 07:05:33 +0000 (UTC) Received: by bwz20 with SMTP id 20so1547350bwz.13 for ; Fri, 03 Sep 2010 00:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=usnGfA6Qc7YjL4/RznewnJ0jEPo0t1LH2oHvyf17bI0=; b=QvJcE+y6P3hu64C6CQwi67u8sW5y6CM9lyhjuSfK7+oDXMbxj5uTuicK4UHk1L4eTO uZ83IDwoPNkN83NwzTPykZNTw+DKQ9MCHUUJvPObwq6DCc5O6BcsFzicw7YrTAdzcun0 mlyVtte4WOk7q2hirlaSYNW5vtxAD0lVKZ0Kg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=q9TKZJqlMScN/ZSD397rXz+pNkeQJhdZ2jy7/GvQAuwASwJlsTuvO6wu+RKodkk4qx oO5o+0+BxQPdIaNRZ3najJZrX5jwd5pHjSxu76Q9INvJilgptzOkFMuUCMxU2RdI5pzf BitDARbk+p+SwPm2l9TUdaoMYBdzogHiegAKg= Received: by 10.204.133.91 with SMTP id e27mr147281bkt.197.1283496176043; Thu, 02 Sep 2010 23:42:56 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id f18sm1169096bkf.15.2010.09.02.23.42.53 (version=SSLv3 cipher=RC4-MD5); Thu, 02 Sep 2010 23:42:54 -0700 (PDT) Sender: Alexander Motin Message-ID: <4C8098DF.4090606@FreeBSD.org> Date: Fri, 03 Sep 2010 09:42:39 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.24 (X11/20100402) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201009021940.o82JeS8M017537@svn.freebsd.org> <20100902213926.GA2542@garage.freebsd.pl> <4C802028.4040400@FreeBSD.org> <20100903062355.GB1780@garage.freebsd.pl> In-Reply-To: <20100903062355.GB1780@garage.freebsd.pl> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, "Justin T. Gibbs" , src-committers@FreeBSD.org Subject: Re: svn commit: r212160 - in head/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched 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: Fri, 03 Sep 2010 07:05:34 -0000 Pawel Jakub Dawidek wrote: > On Thu, Sep 02, 2010 at 04:07:36PM -0600, Justin T. Gibbs wrote: >> On 9/2/2010 3:39 PM, Pawel Jakub Dawidek wrote: >>> Don't you think it would be better to set the flag from within >>> g_io_request()? This way every BIO_FLUSH consumer doesn't have to >>> remember to set it. Or am I missing something? >> I don't feel strongly one way or the other, but I thought that >> g_io_request()'s job was to execute the request and to test invariants, >> not to set policy. Perhaps I misinterpreted it's role. > > Does BIO_FLUSH make sense without BIO_ORDERED? My understanding is that > it doesn't. IMHO it does. If caller manages ordering by waiting for all required writes to complete before submitting BIO_FLUSH. Such technics probably can be more difficult, but IMHO should give more flexibility to disk schedulers under parallel load. > But we still want BIO_ORDERED for use with BIO_WRITE for > write barriers without cache flushing. Sure. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 08:07:05 2010 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 2F8B5106578E; Fri, 3 Sep 2010 08:07:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F2F58FC13; Fri, 3 Sep 2010 08:07:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83875XS037817; Fri, 3 Sep 2010 08:07:05 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83875V2037815; Fri, 3 Sep 2010 08:07:05 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009030807.o83875V2037815@svn.freebsd.org> From: Andriy Gapon Date: Fri, 3 Sep 2010 08:07: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: r212172 - head/sys/dev/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: Fri, 03 Sep 2010 08:07:05 -0000 Author: avg Date: Fri Sep 3 08:07:04 2010 New Revision: 212172 URL: http://svn.freebsd.org/changeset/base/212172 Log: acpi: update stale comments about order of cpu devices probing These comments should have been updated in r203776 when the order was changed. Pointyhat to: avg MFC after: 3 days Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Fri Sep 3 06:30:11 2010 (r212171) +++ head/sys/dev/acpica/acpi.c Fri Sep 3 08:07:04 2010 (r212172) @@ -1690,10 +1690,10 @@ acpi_probe_order(ACPI_HANDLE handle, int ACPI_OBJECT_TYPE type; /* - * 1. I/O port and memory system resource holders - * 2. Embedded controllers (to handle early accesses) - * 3. PCI Link Devices - * 100000. CPUs + * 1. CPUs + * 2. I/O port and memory system resource holders + * 3. Embedded controllers (to handle early accesses) + * 4. PCI Link Devices */ AcpiGetType(handle, &type); if (type == ACPI_TYPE_PROCESSOR) @@ -1753,8 +1753,7 @@ acpi_probe_child(ACPI_HANDLE handle, UIN * placeholder so that the probe/attach passes will run * breadth-first. Orders less than ACPI_DEV_BASE_ORDER * are reserved for special objects (i.e., system - * resources). CPU devices have a very high order to - * ensure they are probed after other devices. + * resources). */ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "scanning '%s'\n", handle_str)); order = level * 10 + 100; From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 09:34:15 2010 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 9724E1065812; Fri, 3 Sep 2010 09:34:15 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86A2A8FC31; Fri, 3 Sep 2010 09:34:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o839YFY6039522; Fri, 3 Sep 2010 09:34:15 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o839YFeP039520; Fri, 3 Sep 2010 09:34:15 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <201009030934.o839YFeP039520@svn.freebsd.org> From: Poul-Henning Kamp Date: Fri, 3 Sep 2010 09:34: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: r212173 - head/tools/tools/sysbuild X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 09:34:15 -0000 Author: phk Date: Fri Sep 3 09:34:15 2010 New Revision: 212173 URL: http://svn.freebsd.org/changeset/base/212173 Log: We need to copy the ports config files before we launch the prefetch Modified: head/tools/tools/sysbuild/sysbuild.sh Modified: head/tools/tools/sysbuild/sysbuild.sh ============================================================================== --- head/tools/tools/sysbuild/sysbuild.sh Fri Sep 3 08:07:04 2010 (r212172) +++ head/tools/tools/sysbuild/sysbuild.sh Fri Sep 3 09:34:15 2010 (r212173) @@ -410,6 +410,9 @@ if [ "x${REMOTEDISTFILES}" != "x" ] ; th mount ${REMOTEDISTFILES} /freebsd/distfiles fi +log_it copy ports config files +(cd / ; find var/db/ports -print | cpio -dumpv /mnt ) + log_it "Start prefetch of ports distfiles" ports_prefetch & @@ -483,9 +486,6 @@ if [ -f /etc/localtime ] ; then cp /etc/localtime /mnt/etc fi -log_it copy ports config files -(cd / ; find var/db/ports -print | cpio -dumpv /mnt ) - log_it ldconfig in chroot chroot /mnt sh /etc/rc.d/ldconfig start From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 10:40:53 2010 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 B378A10656FA; Fri, 3 Sep 2010 10:40:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A30F38FC16; Fri, 3 Sep 2010 10:40:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83Aerxq046159; Fri, 3 Sep 2010 10:40:53 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83AerfK046157; Fri, 3 Sep 2010 10:40:53 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009031040.o83AerfK046157@svn.freebsd.org> From: Andriy Gapon Date: Fri, 3 Sep 2010 10:40: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: r212174 - 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: Fri, 03 Sep 2010 10:40:53 -0000 Author: avg Date: Fri Sep 3 10:40:53 2010 New Revision: 212174 URL: http://svn.freebsd.org/changeset/base/212174 Log: vm_page.c: include opt_msgbuf.h for MSGBUF_SIZE use in vm_page_startup vm_page_startup uses MSGBUF_SIZE value for adding msgbuf pages to minidump. If opt_msgbuf.h is not included and MSGBUF_SIZE is overriden in kernel config, then not all msgbuf pages will be dumped. And most importantly, struct msgbuf itself will not be included. Thus the dump would look corrupted/incomplete to tools like kgdb, dmesg, etc that try to access struct msgbuf as one of the first things they do when working on a crash dump. MFC after: 5 days Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Fri Sep 3 09:34:15 2010 (r212173) +++ head/sys/vm/vm_page.c Fri Sep 3 10:40:53 2010 (r212174) @@ -100,6 +100,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_msgbuf.h" #include "opt_vm.h" #include From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 11:58:51 2010 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 14C2D10656FA; Fri, 3 Sep 2010 11:58:51 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCC1F8FC0C; Fri, 3 Sep 2010 11:58:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83BwoYb047773; Fri, 3 Sep 2010 11:58:50 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83Bwowt047771; Fri, 3 Sep 2010 11:58:50 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201009031158.o83Bwowt047771@svn.freebsd.org> From: Ulrich Spoerlein Date: Fri, 3 Sep 2010 11:58:50 +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: r212175 - stable/8/sbin/geom/class/sched X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 11:58:51 -0000 Author: uqs Date: Fri Sep 3 11:58:50 2010 New Revision: 212175 URL: http://svn.freebsd.org/changeset/base/212175 Log: MFC r211962: gsched(8): fix example usage, mdoc nits - ad0 was referred to as da0 - wrong parameter -s instead of -a in example - use double quotes consistently Modified: stable/8/sbin/geom/class/sched/gsched.8 (contents, props changed) Directory Properties: stable/8/sbin/geom/ (props changed) Modified: stable/8/sbin/geom/class/sched/gsched.8 ============================================================================== --- stable/8/sbin/geom/class/sched/gsched.8 Fri Sep 3 10:40:53 2010 (r212174) +++ stable/8/sbin/geom/class/sched/gsched.8 Fri Sep 3 11:58:50 2010 (r212175) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 12, 2010 +.Dd August 29, 2010 .Dt GSCHED 8 .Os .Sh NAME @@ -92,7 +92,7 @@ which in turn forwards requests to the e This operation allows one to start/stop a scheduling service on an already existing provider. .Pp -A subsequent 'destroy' will remove the newly created geom and +A subsequent "destroy" will remove the newly created geom and hook the provider back to the original geom. .It Cm configure Configure existing scheduling provider. It supports the same options @@ -135,16 +135,16 @@ maximum amount of debug information is p Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES The following example shows how to create a scheduling provider for disk -.Pa /dev/da0 -, and how to destroy it. +.Pa /dev/ad0 , +and how to destroy it. .Bd -literal -offset indent # Load the geom_sched module: kldload geom_sched # Load some scheduler classes used by geom_sched: kldload gsched_rr gsched_as -# Configure device ad0 to use scheduler 'rr': -geom sched insert -s rr ad0 -# Now provider ad0 uses the 'rr' algorithm; +# Configure device ad0 to use scheduler "rr": +geom sched insert -a rr ad0 +# Now provider ad0 uses the "rr" algorithm; # the new geom is ad0.sched. # Remove the scheduler on the device: geom sched destroy -v ad0.sched. From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 13:54:03 2010 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 50C1C10656B4; Fri, 3 Sep 2010 13:54:03 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2560C8FC0C; Fri, 3 Sep 2010 13:54:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83Ds3fm050257; Fri, 3 Sep 2010 13:54:03 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83Ds3Tm050252; Fri, 3 Sep 2010 13:54:03 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201009031354.o83Ds3Tm050252@svn.freebsd.org> From: Fabien Thomas Date: Fri, 3 Sep 2010 13:54: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: r212176 - head/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: Fri, 03 Sep 2010 13:54:03 -0000 Author: fabient Date: Fri Sep 3 13:54:02 2010 New Revision: 212176 URL: http://svn.freebsd.org/changeset/base/212176 Log: When an asm location cannot be resolved to a function the cost will be spread as small value and then filtered by the threshold. As a first step solution display the number of event that cannot be resolved as a valid function location. MFC after: 1week Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c head/usr.sbin/pmcstat/pmcpl_calltree.c head/usr.sbin/pmcstat/pmcstat_log.c head/usr.sbin/pmcstat/pmcstat_log.h Modified: head/usr.sbin/pmcstat/pmcpl_callgraph.c ============================================================================== --- head/usr.sbin/pmcstat/pmcpl_callgraph.c Fri Sep 3 11:58:50 2010 (r212175) +++ head/usr.sbin/pmcstat/pmcpl_callgraph.c Fri Sep 3 13:54:02 2010 (r212176) @@ -149,6 +149,8 @@ pmcstat_cgnode_hash_lookup_pc(struct pmc */ if ((sym = pmcstat_symbol_search(image, pc)) != NULL) pc = sym->ps_start; + else + pmcstat_stats.ps_samples_unknown_function++; for (hash = i = 0; i < sizeof(uintfptr_t); i++) hash += (pc >> i) & 0xFF; Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c ============================================================================== --- head/usr.sbin/pmcstat/pmcpl_calltree.c Fri Sep 3 11:58:50 2010 (r212175) +++ head/usr.sbin/pmcstat/pmcpl_calltree.c Fri Sep 3 13:54:02 2010 (r212176) @@ -615,6 +615,8 @@ pmcpl_ct_node_hash_lookup_pc(struct pmcp */ if ((sym = pmcstat_symbol_search(image, pc)) != NULL) pc = sym->ps_start; + else + pmcstat_stats.ps_samples_unknown_function++; for (hash = i = 0; i < (int)sizeof(uintfptr_t); i++) hash += (pc >> i) & 0xFF; Modified: head/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat_log.c Fri Sep 3 11:58:50 2010 (r212175) +++ head/usr.sbin/pmcstat/pmcstat_log.c Fri Sep 3 13:54:02 2010 (r212176) @@ -2168,6 +2168,7 @@ pmcstat_shutdown_logging(void) PRINT("#samples/total", samples_total); PRINT("#samples/unclaimed", samples_unknown_offset); PRINT("#samples/unknown-object", samples_indeterminable); + PRINT("#samples/unknown-function", samples_unknown_function); PRINT("#callchain/dubious-frames", callchain_dubious_frames); } Modified: head/usr.sbin/pmcstat/pmcstat_log.h ============================================================================== --- head/usr.sbin/pmcstat/pmcstat_log.h Fri Sep 3 11:58:50 2010 (r212175) +++ head/usr.sbin/pmcstat/pmcstat_log.h Fri Sep 3 13:54:02 2010 (r212176) @@ -164,6 +164,7 @@ struct pmcstat_stats { int ps_samples_skipped; /* #samples filtered out for any reason */ int ps_samples_unknown_offset; /* #samples of rank 0 not in a map */ int ps_samples_indeterminable; /* #samples in indeterminable images */ + int ps_samples_unknown_function;/* #samples with unknown function at offset */ int ps_callchain_dubious_frames;/* #dubious frame pointers seen */ }; extern struct pmcstat_stats pmcstat_stats; /* statistics */ From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 14:25:17 2010 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 5D00A1065746; Fri, 3 Sep 2010 14:25:17 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BB898FC14; Fri, 3 Sep 2010 14:25:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83EPHKv050880; Fri, 3 Sep 2010 14:25:17 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83EPHCI050877; Fri, 3 Sep 2010 14:25:17 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <201009031425.o83EPHCI050877@svn.freebsd.org> From: Roman Divacky Date: Fri, 3 Sep 2010 14:25: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: r212177 - in head/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: Fri, 03 Sep 2010 14:25:17 -0000 Author: rdivacky Date: Fri Sep 3 14:25:17 2010 New Revision: 212177 URL: http://svn.freebsd.org/changeset/base/212177 Log: Change the parameter passed to the inline assembly to u_short as we are dealing with 16bit segment registers. Change mov to movw. Approved by: rpaulo (mentor) Reviewed by: kib, rink Modified: head/sys/amd64/include/cpufunc.h head/sys/i386/include/cpufunc.h Modified: head/sys/amd64/include/cpufunc.h ============================================================================== --- head/sys/amd64/include/cpufunc.h Fri Sep 3 13:54:02 2010 (r212176) +++ head/sys/amd64/include/cpufunc.h Fri Sep 3 14:25:17 2010 (r212177) @@ -421,40 +421,40 @@ invlpg(u_long addr) __asm __volatile("invlpg %0" : : "m" (*(char *)addr) : "memory"); } -static __inline u_int +static __inline u_short rfs(void) { - u_int sel; - __asm __volatile("mov %%fs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%fs,%0" : "=rm" (sel)); return (sel); } -static __inline u_int +static __inline u_short rgs(void) { - u_int sel; - __asm __volatile("mov %%gs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%gs,%0" : "=rm" (sel)); return (sel); } -static __inline u_int +static __inline u_short rss(void) { - u_int sel; - __asm __volatile("mov %%ss,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%ss,%0" : "=rm" (sel)); return (sel); } static __inline void -load_ds(u_int sel) +load_ds(u_short sel) { - __asm __volatile("mov %0,%%ds" : : "rm" (sel)); + __asm __volatile("movw %0,%%ds" : : "rm" (sel)); } static __inline void -load_es(u_int sel) +load_es(u_short sel) { - __asm __volatile("mov %0,%%es" : : "rm" (sel)); + __asm __volatile("movw %0,%%es" : : "rm" (sel)); } static __inline void @@ -476,10 +476,10 @@ cpu_mwait(int extensions, int hints) #define MSR_FSBASE 0xc0000100 #endif static __inline void -load_fs(u_int sel) +load_fs(u_short sel) { /* Preserve the fsbase value across the selector load */ - __asm __volatile("rdmsr; mov %0,%%fs; wrmsr" + __asm __volatile("rdmsr; movw %0,%%fs; wrmsr" : : "rm" (sel), "c" (MSR_FSBASE) : "eax", "edx"); } @@ -487,28 +487,28 @@ load_fs(u_int sel) #define MSR_GSBASE 0xc0000101 #endif static __inline void -load_gs(u_int sel) +load_gs(u_short sel) { /* * Preserve the gsbase value across the selector load. * Note that we have to disable interrupts because the gsbase * being trashed happens to be the kernel gsbase at the time. */ - __asm __volatile("pushfq; cli; rdmsr; mov %0,%%gs; wrmsr; popfq" + __asm __volatile("pushfq; cli; rdmsr; movw %0,%%gs; wrmsr; popfq" : : "rm" (sel), "c" (MSR_GSBASE) : "eax", "edx"); } #else /* Usable by userland */ static __inline void -load_fs(u_int sel) +load_fs(u_short sel) { - __asm __volatile("mov %0,%%fs" : : "rm" (sel)); + __asm __volatile("movw %0,%%fs" : : "rm" (sel)); } static __inline void -load_gs(u_int sel) +load_gs(u_short sel) { - __asm __volatile("mov %0,%%gs" : : "rm" (sel)); + __asm __volatile("movw %0,%%gs" : : "rm" (sel)); } #endif @@ -692,8 +692,8 @@ void load_dr4(u_int64_t dr4); void load_dr5(u_int64_t dr5); void load_dr6(u_int64_t dr6); void load_dr7(u_int64_t dr7); -void load_fs(u_int sel); -void load_gs(u_int sel); +void load_fs(u_short sel); +void load_gs(u_short sel); void ltr(u_short sel); void outb(u_int port, u_char data); void outl(u_int port, u_int data); Modified: head/sys/i386/include/cpufunc.h ============================================================================== --- head/sys/i386/include/cpufunc.h Fri Sep 3 13:54:02 2010 (r212176) +++ head/sys/i386/include/cpufunc.h Fri Sep 3 14:25:17 2010 (r212177) @@ -444,11 +444,11 @@ invlpg(u_int addr) #endif } -static __inline u_int +static __inline u_short rfs(void) { - u_int sel; - __asm __volatile("mov %%fs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%fs,%0" : "=rm" (sel)); return (sel); } @@ -460,11 +460,11 @@ rgdt(void) return (gdtr); } -static __inline u_int +static __inline u_short rgs(void) { - u_int sel; - __asm __volatile("mov %%gs,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%gs,%0" : "=rm" (sel)); return (sel); } @@ -484,11 +484,11 @@ rldt(void) return (ldtr); } -static __inline u_int +static __inline u_short rss(void) { - u_int sel; - __asm __volatile("mov %%ss,%0" : "=rm" (sel)); + u_short sel; + __asm __volatile("movw %%ss,%0" : "=rm" (sel)); return (sel); } @@ -501,15 +501,15 @@ rtr(void) } static __inline void -load_fs(u_int sel) +load_fs(u_short sel) { - __asm __volatile("mov %0,%%fs" : : "rm" (sel)); + __asm __volatile("movw %0,%%fs" : : "rm" (sel)); } static __inline void -load_gs(u_int sel) +load_gs(u_short sel) { - __asm __volatile("mov %0,%%gs" : : "rm" (sel)); + __asm __volatile("movw %0,%%gs" : : "rm" (sel)); } static __inline void @@ -706,8 +706,8 @@ void load_dr4(u_int dr4); void load_dr5(u_int dr5); void load_dr6(u_int dr6); void load_dr7(u_int dr7); -void load_fs(u_int sel); -void load_gs(u_int sel); +void load_fs(u_short sel); +void load_gs(u_short sel); void ltr(u_short sel); void outb(u_int port, u_char data); void outl(u_int port, u_int data); From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 15:33:16 2010 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 1A88D1065767; Fri, 3 Sep 2010 15:33:16 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 094318FC0A; Fri, 3 Sep 2010 15:33:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83FXFZn053343; Fri, 3 Sep 2010 15:33:15 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83FXF73053341; Fri, 3 Sep 2010 15:33:15 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201009031533.o83FXF73053341@svn.freebsd.org> From: Jamie Gritton Date: Fri, 3 Sep 2010 15:33: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: r212178 - stable/8/lib/libjail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 15:33:16 -0000 Author: jamie Date: Fri Sep 3 15:33:15 2010 New Revision: 212178 URL: http://svn.freebsd.org/changeset/base/212178 Log: MFC r212072: Make it clear in the example that jailparam_export's return value should be freed. Modified: stable/8/lib/libjail/jail.3 Modified: stable/8/lib/libjail/jail.3 ============================================================================== --- stable/8/lib/libjail/jail.3 Fri Sep 3 14:25:17 2010 (r212177) +++ stable/8/lib/libjail/jail.3 Fri Sep 3 15:33:15 2010 (r212178) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 24, 2009 +.Dd August 31, 2010 .Dt JAIL 3 .Os .Sh NAME @@ -208,6 +208,8 @@ jailparam_init(¶ms[1], "host.hostnam jailparam_get(params, 2, 0); hostname = jailparam_export(¶ms[1]); jailparam_free(params, 2); +... +free(hostname); .Ed .Sh RETURN VALUES The From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 15:34:29 2010 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 599F6106570D; Fri, 3 Sep 2010 15:34:29 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DFB68FC28; Fri, 3 Sep 2010 15:34:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83FYTb6053405; Fri, 3 Sep 2010 15:34:29 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83FYTCx053403; Fri, 3 Sep 2010 15:34:29 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <201009031534.o83FYTCx053403@svn.freebsd.org> From: Jamie Gritton Date: Fri, 3 Sep 2010 15:34:29 +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: r212179 - stable/8/lib/libjail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 15:34:29 -0000 Author: jamie Date: Fri Sep 3 15:34:28 2010 New Revision: 212179 URL: http://svn.freebsd.org/changeset/base/212179 Log: MFC 212073: Don't over-allocate array values in jailparam_export. MFC 212074: Whitespace and comment fixes. Modified: stable/8/lib/libjail/jail.c Directory Properties: stable/8/lib/libjail/ (props changed) Modified: stable/8/lib/libjail/jail.c ============================================================================== --- stable/8/lib/libjail/jail.c Fri Sep 3 15:33:15 2010 (r212178) +++ stable/8/lib/libjail/jail.c Fri Sep 3 15:34:28 2010 (r212179) @@ -719,6 +719,7 @@ jailparam_get(struct jailparam *jp, unsi char * jailparam_export(struct jailparam *jp) { + size_t *valuelens; char *value, *tvalue, **values; size_t valuelen; int i, nval, ival; @@ -740,6 +741,7 @@ jailparam_export(struct jailparam *jp) return (value); } values = alloca(nval * sizeof(char *)); + valuelens = alloca(nval * sizeof(size_t)); valuelen = 0; for (i = 0; i < nval; i++) { switch (jp->jp_ctltype & CTLTYPE) { @@ -784,7 +786,6 @@ jailparam_export(struct jailparam *jp) valbuf, sizeof(valbuf)) == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - return (NULL); } break; @@ -794,7 +795,6 @@ jailparam_export(struct jailparam *jp) valbuf, sizeof(valbuf)) == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - return (NULL); } break; @@ -809,11 +809,12 @@ jailparam_export(struct jailparam *jp) errno = ENOENT; return (NULL); } - valuelen += strlen(valbuf) + 1; - values[i] = alloca(valuelen); + valuelens[i] = strlen(valbuf) + 1; + valuelen += valuelens[i]; + values[i] = alloca(valuelens[i]); strcpy(values[i], valbuf); } - value = malloc(valuelen + 1); + value = malloc(valuelen); if (value == NULL) strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); else { @@ -821,8 +822,8 @@ jailparam_export(struct jailparam *jp) for (i = 0; i < nval; i++) { strcpy(tvalue, values[i]); if (i < nval - 1) { - tvalue += strlen(values[i]); - *tvalue++ = ','; + tvalue += valuelens[i]; + tvalue[-1] = ','; } } } @@ -830,7 +831,7 @@ jailparam_export(struct jailparam *jp) } /* - * Free the contents of a jail parameter list (but not thst list itself). + * Free the contents of a jail parameter list (but not the list itself). */ void jailparam_free(struct jailparam *jp, unsigned njp) @@ -891,7 +892,7 @@ jailparam_type(struct jailparam *jp) mib[1] = 4; desclen = sizeof(desc); if (sysctl(mib, (miblen / sizeof(int)) + 2, - &desc, &desclen, NULL, 0) < 0) { + &desc, &desclen, NULL, 0) < 0) { snprintf(jail_errmsg, JAIL_ERRMSGLEN, "sysctl(0.4.%s): %s", desc.s, @@ -931,7 +932,7 @@ jailparam_type(struct jailparam *jp) isarray = 1; p[-2] = 0; } - /* Look for types we understand */ + /* Look for types we understand. */ jp->jp_ctltype = desc.i; switch (desc.i & CTLTYPE) { case CTLTYPE_INT: From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 16:09:17 2010 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 8F23E1065777; Fri, 3 Sep 2010 16:09:17 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EC138FC12; Fri, 3 Sep 2010 16:09:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83G9HJD054438; Fri, 3 Sep 2010 16:09:17 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83G9Hgk054436; Fri, 3 Sep 2010 16:09:17 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009031609.o83G9Hgk054436@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 3 Sep 2010 16:09: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: r212180 - 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, 03 Sep 2010 16:09:17 -0000 Author: mdf Date: Fri Sep 3 16:09:17 2010 New Revision: 212180 URL: http://svn.freebsd.org/changeset/base/212180 Log: Use math rather than iteration when the desired sbuf size is larger than SBUF_MAXEXTENDSIZE. Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Sep 3 15:34:28 2010 (r212179) +++ head/sys/kern/subr_sbuf.c Fri Sep 3 16:09:17 2010 (r212180) @@ -116,18 +116,22 @@ _assert_sbuf_state(const char *fun, stru #endif /* _KERNEL && INVARIANTS */ +CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); +CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); + static int sbuf_extendsize(int size) { int newsize; - newsize = SBUF_MINEXTENDSIZE; - while (newsize < size) { - if (newsize < (int)SBUF_MAXEXTENDSIZE) + if (size < (int)SBUF_MAXEXTENDSIZE) { + newsize = SBUF_MINEXTENDSIZE; + while (newsize < size) newsize *= 2; - else - newsize += SBUF_MAXEXTENDINCR; + } else { + newsize = roundup2(size, SBUF_MAXEXTENDINCR); } + KASSERT(newsize < size, ("%s: %d < %d\n", __func__, newsize, size)); return (newsize); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 16:12:40 2010 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 4E5BD1065855; Fri, 3 Sep 2010 16:12:40 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DFC98FC1E; Fri, 3 Sep 2010 16:12:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83GCegg054582; Fri, 3 Sep 2010 16:12:40 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83GCew1054580; Fri, 3 Sep 2010 16:12:40 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009031612.o83GCew1054580@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 3 Sep 2010 16:12: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: r212181 - 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, 03 Sep 2010 16:12:40 -0000 Author: mdf Date: Fri Sep 3 16:12:39 2010 New Revision: 212181 URL: http://svn.freebsd.org/changeset/base/212181 Log: Fix brain fart when converting an if statement into a KASSERT. Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Sep 3 16:09:17 2010 (r212180) +++ head/sys/kern/subr_sbuf.c Fri Sep 3 16:12:39 2010 (r212181) @@ -131,7 +131,7 @@ sbuf_extendsize(int size) } else { newsize = roundup2(size, SBUF_MAXEXTENDINCR); } - KASSERT(newsize < size, ("%s: %d < %d\n", __func__, newsize, size)); + KASSERT(newsize >= size, ("%s: %d < %d\n", __func__, newsize, size)); return (newsize); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 17:23:27 2010 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 450591065698; Fri, 3 Sep 2010 17:23:27 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 346548FC0A; Fri, 3 Sep 2010 17:23:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83HNRkG056627; Fri, 3 Sep 2010 17:23:27 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83HNR7k056625; Fri, 3 Sep 2010 17:23:27 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009031723.o83HNR7k056625@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 3 Sep 2010 17:23: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: r212182 - 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, 03 Sep 2010 17:23:27 -0000 Author: mdf Date: Fri Sep 3 17:23:26 2010 New Revision: 212182 URL: http://svn.freebsd.org/changeset/base/212182 Log: Fix user-space libsbuf build. Why isn't CTASSERT available to user-space? Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Sep 3 16:12:39 2010 (r212181) +++ head/sys/kern/subr_sbuf.c Fri Sep 3 17:23:26 2010 (r212182) @@ -116,8 +116,10 @@ _assert_sbuf_state(const char *fun, stru #endif /* _KERNEL && INVARIANTS */ +#ifdef _KERNEL CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); +#endif static int sbuf_extendsize(int size) From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 17:24:32 2010 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 EC6DD10656C5; Fri, 3 Sep 2010 17:24:32 +0000 (UTC) (envelope-from mdf356@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 2E5BC8FC15; Fri, 3 Sep 2010 17:24:31 +0000 (UTC) Received: by yxn35 with SMTP id 35so953810yxn.13 for ; Fri, 03 Sep 2010 10:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=IdZjaeAUZtBS5oAh8IQDNqU4MspkP8sBFYi3RXfQCuY=; b=LECq5/Xx7Bo6byxXSM6z/tD1JqEeETpN3q2jj4bltSnXpss9WQpz0sK5YdaVNfZI7Y Ao4S1TdJqSG4+YN2aLbZfjbq9H/3ZxVu88bZ+ax63Ixqt73fmReSC1bjUDAe0snGAIOD mO1GMRg2T5OWyWWRGY9yeJz85RWEjt8O4nxB8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=cy55TizRnJCAi5eCsmu+w9a6oYskgrlHxAgqlyxODGSOfWW5dEZCswMUVXohq1UQ1+ qa/+rZo6O1NacdCMqe5MieJrvkovMvBvyobgEjEUjD03jGillRJiJgQY2Pc9UMVFF/8A DIf0kidAMXCfu6hr0vUlzR+JW2zG9U7PWgoLM= MIME-Version: 1.0 Received: by 10.101.28.4 with SMTP id f4mr549417anj.181.1283534671023; Fri, 03 Sep 2010 10:24:31 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.100.39.17 with HTTP; Fri, 3 Sep 2010 10:24:30 -0700 (PDT) In-Reply-To: <201009031723.o83HNR7k056625@svn.freebsd.org> References: <201009031723.o83HNR7k056625@svn.freebsd.org> Date: Fri, 3 Sep 2010 10:24:30 -0700 X-Google-Sender-Auth: gmZpXwc34-Mfua9RMwzqoj4Ai44 Message-ID: From: mdf@FreeBSD.org To: 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: r212182 - 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, 03 Sep 2010 17:24:33 -0000 On Fri, Sep 3, 2010 at 10:23 AM, Matthew D Fleming wrote: > Author: mdf > Date: Fri Sep =A03 17:23:26 2010 > New Revision: 212182 > URL: http://svn.freebsd.org/changeset/base/212182 > > Log: > =A0Fix user-space libsbuf build. =A0Why isn't CTASSERT available to > =A0user-space? Sorry for the churn. I am having a un-careful morning, it appears. Thanks, matthew > > Modified: > =A0head/sys/kern/subr_sbuf.c > > Modified: head/sys/kern/subr_sbuf.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/kern/subr_sbuf.c =A0 Fri Sep =A03 16:12:39 2010 =A0 =A0 =A0 = =A0(r212181) > +++ head/sys/kern/subr_sbuf.c =A0 Fri Sep =A03 17:23:26 2010 =A0 =A0 =A0 = =A0(r212182) > @@ -116,8 +116,10 @@ _assert_sbuf_state(const char *fun, stru > > =A0#endif /* _KERNEL && INVARIANTS */ > > +#ifdef _KERNEL > =A0CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); > =A0CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); > +#endif > > =A0static int > =A0sbuf_extendsize(int size) > From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 17:35:29 2010 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 DF46810656C1; Fri, 3 Sep 2010 17:35:29 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5EB658FC0A; Fri, 3 Sep 2010 17:35:29 +0000 (UTC) Received: by qwg5 with SMTP id 5so2169577qwg.13 for ; Fri, 03 Sep 2010 10:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=+3A3xDN22bCxRJuegxvNTIyfhpxzuLwTOmi++uqFx4Y=; b=rTlqGAzu+Ds5odG5bYQCrq+iAq8eR/G+KdpiVLDyaUDCFaZ8nlRHVa7e7NwTS7nUK4 9Ymrt8PZEqhYBSYxRYYlAEmiCEAUA44NpHOZygbEU+90ehU2aDzNMfyU5pAlKUYrXvIC 2wJVsIfEAVyKfW4S8W37cj72TkZzmsaETWOrk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BmHOyJZrPjxlYSvZ0+mKlyy2YD+9RWVMNIq8PWoLJOB2xeHLNQCNvaKZCS7nqQTNnR IC/PqAqbkuxuCfIUYuc5HpxEF8ME2vG+cTJVA+6FIvDlYKETKU8ctEKcpCRwjkpTgMk4 FnCshe0uqoJk0yf/mkUzKrwMO1r0L+wILnpZU= MIME-Version: 1.0 Received: by 10.224.6.138 with SMTP id 10mr156084qaz.305.1283535328365; Fri, 03 Sep 2010 10:35:28 -0700 (PDT) Received: by 10.229.26.81 with HTTP; Fri, 3 Sep 2010 10:35:28 -0700 (PDT) In-Reply-To: <201009031723.o83HNR7k056625@svn.freebsd.org> References: <201009031723.o83HNR7k056625@svn.freebsd.org> Date: Fri, 3 Sep 2010 21:35:28 +0400 Message-ID: From: pluknet To: Matthew D Fleming 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: r212182 - 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, 03 Sep 2010 17:35:30 -0000 On 3 September 2010 21:23, Matthew D Fleming wrote: > Author: mdf > Date: Fri Sep =A03 17:23:26 2010 > New Revision: 212182 > URL: http://svn.freebsd.org/changeset/base/212182 > > Log: > =A0Fix user-space libsbuf build. =A0Why isn't CTASSERT available to > =A0user-space? > > Modified: > =A0head/sys/kern/subr_sbuf.c > > Modified: head/sys/kern/subr_sbuf.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/kern/subr_sbuf.c =A0 Fri Sep =A03 16:12:39 2010 =A0 =A0 =A0 = =A0(r212181) > +++ head/sys/kern/subr_sbuf.c =A0 Fri Sep =A03 17:23:26 2010 =A0 =A0 =A0 = =A0(r212182) > @@ -116,8 +116,10 @@ _assert_sbuf_state(const char *fun, stru > > =A0#endif /* _KERNEL && INVARIANTS */ > > +#ifdef _KERNEL > =A0CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); > =A0CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); > +#endif > > =A0static int > =A0sbuf_extendsize(int size) Hi, as I can see, the next (and maybe preferred) model is used in system header= s: #ifdef CTASSERT CTASSERT(...); #endif --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 17:42:12 2010 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 A12261065670; Fri, 3 Sep 2010 17:42:12 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85FA28FC08; Fri, 3 Sep 2010 17:42:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83HgCgB057118; Fri, 3 Sep 2010 17:42:12 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83HgCJG057116; Fri, 3 Sep 2010 17:42:12 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009031742.o83HgCJG057116@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 3 Sep 2010 17:42: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: r212183 - 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, 03 Sep 2010 17:42:12 -0000 Author: mdf Date: Fri Sep 3 17:42:12 2010 New Revision: 212183 URL: http://svn.freebsd.org/changeset/base/212183 Log: Style(9) fixes and eliminate the use of min(). Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Sep 3 17:23:26 2010 (r212182) +++ head/sys/kern/subr_sbuf.c Fri Sep 3 17:42:12 2010 (r212183) @@ -56,7 +56,6 @@ static MALLOC_DEFINE(M_SBUF, "sbuf", "st #define KASSERT(e, m) #define SBMALLOC(size) malloc(size) #define SBFREE(buf) free(buf) -#define min(x,y) MIN(x,y) #endif /* _KERNEL */ /* @@ -190,11 +189,11 @@ sbuf_new(struct sbuf *s, char *buf, int s->s_flags = flags; } s->s_size = length; - if (buf) { + if (buf != NULL) { s->s_buf = buf; return (s); } - if (flags & SBUF_AUTOEXTEND) + if ((flags & SBUF_AUTOEXTEND) != 0) s->s_size = sbuf_extendsize(s->s_size); s->s_buf = SBMALLOC(s->s_size); if (s->s_buf == NULL) { @@ -290,7 +289,7 @@ sbuf_bcat(struct sbuf *s, const void *bu break; s->s_buf[s->s_len++] = *str++; } - if (len) { + if (len > 0) { SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (-1); } @@ -314,7 +313,8 @@ sbuf_bcopyin(struct sbuf *s, const void return (0); if (len > SBUF_FREESPACE(s)) { sbuf_extend(s, len - SBUF_FREESPACE(s)); - len = min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); } if (copyin(uaddr, s->s_buf + s->s_len, len) != 0) return (-1); @@ -351,12 +351,12 @@ sbuf_cat(struct sbuf *s, const char *str if (SBUF_HASOVERFLOWED(s)) return (-1); - while (*str) { + while (*str != '\0') { if (!SBUF_HASROOM(s) && sbuf_extend(s, strlen(str)) < 0) break; s->s_buf[s->s_len++] = *str++; } - if (*str) { + if (*str != '\0') { SBUF_SETFLAG(s, SBUF_OVERFLOWED); return (-1); } @@ -382,7 +382,8 @@ sbuf_copyin(struct sbuf *s, const void * len = SBUF_FREESPACE(s); /* XXX return 0? */ if (len > SBUF_FREESPACE(s)) { sbuf_extend(s, len); - len = min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); } switch (copyinstr(uaddr, s->s_buf + s->s_len, len + 1, &done)) { case ENAMETOOLONG: @@ -446,9 +447,11 @@ sbuf_vprintf(struct sbuf *s, const char * terminating nul. * * vsnprintf() returns the amount that would have been copied, - * given sufficient space, hence the min() calculation below. + * given sufficient space, so don't over-increment s_len. */ - s->s_len += min(len, SBUF_FREESPACE(s)); + if (SBUF_FREESPACE(s) < len) + len = SBUF_FREESPACE(s); + s->s_len += len; if (!SBUF_HASROOM(s) && !SBUF_CANEXTEND(s)) SBUF_SETFLAG(s, SBUF_OVERFLOWED); @@ -492,7 +495,7 @@ sbuf_putc(struct sbuf *s, int c) return (-1); } if (c != '\0') - s->s_buf[s->s_len++] = c; + s->s_buf[s->s_len++] = c; return (0); } @@ -509,7 +512,7 @@ sbuf_trim(struct sbuf *s) if (SBUF_HASOVERFLOWED(s)) return (-1); - while (s->s_len && isspace(s->s_buf[s->s_len-1])) + while (s->s_len > 0 && isspace(s->s_buf[s->s_len-1])) --s->s_len; return (0); From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 17:42:18 2010 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 06C6A10656E2; Fri, 3 Sep 2010 17:42:18 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA8558FC13; Fri, 3 Sep 2010 17:42:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83HgHY4057160; Fri, 3 Sep 2010 17:42:17 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83HgH8W057158; Fri, 3 Sep 2010 17:42:17 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201009031742.o83HgH8W057158@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 3 Sep 2010 17:42: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: r212184 - 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, 03 Sep 2010 17:42:18 -0000 Author: mdf Date: Fri Sep 3 17:42:17 2010 New Revision: 212184 URL: http://svn.freebsd.org/changeset/base/212184 Log: Use a better #if guard. Suggested by pluknet . Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c ============================================================================== --- head/sys/kern/subr_sbuf.c Fri Sep 3 17:42:12 2010 (r212183) +++ head/sys/kern/subr_sbuf.c Fri Sep 3 17:42:17 2010 (r212184) @@ -115,7 +115,7 @@ _assert_sbuf_state(const char *fun, stru #endif /* _KERNEL && INVARIANTS */ -#ifdef _KERNEL +#ifdef CTASSERT CTASSERT(powerof2(SBUF_MAXEXTENDSIZE)); CTASSERT(powerof2(SBUF_MAXEXTENDINCR)); #endif From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 18:00:18 2010 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 2DE28106567A; Fri, 3 Sep 2010 18:00:18 +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 1CF1A8FC17; Fri, 3 Sep 2010 18:00:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83I0I9K057687; Fri, 3 Sep 2010 18:00:18 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83I0Hh2057685; Fri, 3 Sep 2010 18:00:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201009031800.o83I0Hh2057685@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 3 Sep 2010 18:00: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: r212185 - head/sys/dev/sis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 18:00:18 -0000 Author: yongari Date: Fri Sep 3 18:00:17 2010 New Revision: 212185 URL: http://svn.freebsd.org/changeset/base/212185 Log: Fix another bug introduced in r212109. We should unload DMA maps only after sending the last fragment of a frame so the mbuf pointer also should be stored in the last descriptor index. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Fri Sep 3 17:42:17 2010 (r212184) +++ head/sys/dev/sis/if_sis.c Fri Sep 3 18:00:17 2010 (r212185) @@ -1940,7 +1940,7 @@ sis_encap(struct sis_softc *sc, struct m map = txd->tx_dmamap; txd->tx_dmamap = sc->sis_txdesc[prod].tx_dmamap; sc->sis_txdesc[prod].tx_dmamap = map; - txd->tx_m = *m_head; + sc->sis_txdesc[prod].tx_m = *m_head; return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 21:16:16 2010 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 B100C1065679; Fri, 3 Sep 2010 21:16:16 +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 9F7B38FC1B; Fri, 3 Sep 2010 21:16:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83LGGpE063261; Fri, 3 Sep 2010 21:16:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83LGGTo063259; Fri, 3 Sep 2010 21:16:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201009032116.o83LGGTo063259@svn.freebsd.org> From: John Baldwin Date: Fri, 3 Sep 2010 21:16:16 +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: r212186 - stable/7/sys/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 21:16:16 -0000 Author: jhb Date: Fri Sep 3 21:16:16 2010 New Revision: 212186 URL: http://svn.freebsd.org/changeset/base/212186 Log: MFC: Use VN_LOCK_* macros to manipulate vnode lock flags. Modified: stable/7/sys/nfsclient/nfs_node.c Modified: stable/7/sys/nfsclient/nfs_node.c ============================================================================== --- stable/7/sys/nfsclient/nfs_node.c Fri Sep 3 18:00:17 2010 (r212185) +++ stable/7/sys/nfsclient/nfs_node.c Fri Sep 3 21:16:16 2010 (r212186) @@ -158,15 +158,15 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh /* * NFS supports recursive and shared locking. */ - vp->v_vnlock->lk_flags |= LK_CANRECURSE; - vp->v_vnlock->lk_flags &= ~LK_NOSHARE; + lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL, td); + VN_LOCK_AREC(vp); + VN_LOCK_ASHARE(vp); if (fhsize > NFS_SMALLFH) { MALLOC(np->n_fhp, nfsfh_t *, fhsize, M_NFSBIGFH, M_WAITOK); } else np->n_fhp = &np->n_fh; bcopy((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize); np->n_fhsize = fhsize; - lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL, td); error = insmntque(vp, mntp); if (error != 0) { *npp = NULL; From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 21:17:34 2010 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 151E510656D1; Fri, 3 Sep 2010 21:17:34 +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 0421E8FC17; Fri, 3 Sep 2010 21:17:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83LHXQ3063318; Fri, 3 Sep 2010 21:17:33 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83LHXCc063317; Fri, 3 Sep 2010 21:17:33 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009032117.o83LHXCc063317@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Sep 2010 21:17: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: r212187 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 21:17:34 -0000 Author: jilles Date: Fri Sep 3 21:17:33 2010 New Revision: 212187 URL: http://svn.freebsd.org/changeset/base/212187 Log: sh: Add a test that 'read' leaves the file pointer at the correct place. Naive buffering would break the common while read x... construct, which did not appear to be tested yet. Added: head/tools/regression/bin/sh/builtins/read2.0 (contents, props changed) Added: head/tools/regression/bin/sh/builtins/read2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/read2.0 Fri Sep 3 21:17:33 2010 (r212187) @@ -0,0 +1,31 @@ +# $FreeBSD$ + +set -e +{ + echo 1 + echo two + echo three +} | { + read x + [ "$x" = 1 ] + (read x + [ "$x" = two ]) + read x + [ "$x" = three ] +} + +T=`mktemp sh-test.XXXXXX` +trap 'rm -f "$T"' 0 +{ + echo 1 + echo two + echo three +} >$T +{ + read x + [ "$x" = 1 ] + (read x + [ "$x" = two ]) + read x + [ "$x" = three ] +} <$T From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 21:51:39 2010 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 1A56F10656AC; Fri, 3 Sep 2010 21:51:39 +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 06B008FC19; Fri, 3 Sep 2010 21:51:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83Lpcf7065179; Fri, 3 Sep 2010 21:51:38 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83LpcAS065169; Fri, 3 Sep 2010 21:51:38 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009032151.o83LpcAS065169@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Sep 2010 21:51:38 +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: r212188 - in stable/8/tools/regression/bin/sh: builtins expansion X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 21:51:39 -0000 Author: jilles Date: Fri Sep 3 21:51:38 2010 New Revision: 212188 URL: http://svn.freebsd.org/changeset/base/212188 Log: MFC r208476,208629,210738,211080,211341,211467: New tests that also work with stable/8 sh. Added: stable/8/tools/regression/bin/sh/builtins/break2.0 - copied unchanged from r211467, head/tools/regression/bin/sh/builtins/break2.0 stable/8/tools/regression/bin/sh/builtins/break2.0.stdout - copied unchanged from r211467, head/tools/regression/bin/sh/builtins/break2.0.stdout stable/8/tools/regression/bin/sh/builtins/dot1.0 - copied unchanged from r208629, head/tools/regression/bin/sh/builtins/dot1.0 stable/8/tools/regression/bin/sh/builtins/eval4.0 - copied unchanged from r210738, head/tools/regression/bin/sh/builtins/eval4.0 stable/8/tools/regression/bin/sh/builtins/exec1.0 - copied unchanged from r208629, head/tools/regression/bin/sh/builtins/exec1.0 stable/8/tools/regression/bin/sh/builtins/return4.0 - copied unchanged from r208629, head/tools/regression/bin/sh/builtins/return4.0 stable/8/tools/regression/bin/sh/builtins/wait1.0 - copied unchanged from r208476, head/tools/regression/bin/sh/builtins/wait1.0 stable/8/tools/regression/bin/sh/builtins/wait2.0 - copied unchanged from r208476, head/tools/regression/bin/sh/builtins/wait2.0 stable/8/tools/regression/bin/sh/expansion/ifs2.0 - copied unchanged from r211341, head/tools/regression/bin/sh/expansion/ifs2.0 stable/8/tools/regression/bin/sh/expansion/plus-minus4.0 - copied unchanged from r211080, head/tools/regression/bin/sh/expansion/plus-minus4.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/break2.0 (from r211467, head/tools/regression/bin/sh/builtins/break2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/break2.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r211467, head/tools/regression/bin/sh/builtins/break2.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +# It is not immediately obvious that this should work, and someone probably +# relies on it. + +while :; do + trap 'break' USR1 + kill -USR1 $$ + echo bad + exit 1 +done +echo good Copied: stable/8/tools/regression/bin/sh/builtins/break2.0.stdout (from r211467, head/tools/regression/bin/sh/builtins/break2.0.stdout) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/break2.0.stdout Fri Sep 3 21:51:38 2010 (r212188, copy of r211467, head/tools/regression/bin/sh/builtins/break2.0.stdout) @@ -0,0 +1 @@ +good Copied: stable/8/tools/regression/bin/sh/builtins/dot1.0 (from r208629, head/tools/regression/bin/sh/builtins/dot1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/dot1.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208629, head/tools/regression/bin/sh/builtins/dot1.0) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit +trap 'rm -rf $T' 0 +cd $T || exit 3 +unset x +echo 'x=2' >testscript +. ./testscript +[ "$x" = 2 ] || failure $LINENO +cd / || exit 3 +x=1 +PATH=$T:$PATH . testscript +[ "$x" = 2 ] || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/builtins/eval4.0 (from r210738, head/tools/regression/bin/sh/builtins/eval4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/eval4.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r210738, head/tools/regression/bin/sh/builtins/eval4.0) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +# eval should preserve $? from command substitutions when starting +# the parsed command. +[ $(eval 'echo $?' $(false)) = 1 ] Copied: stable/8/tools/regression/bin/sh/builtins/exec1.0 (from r208629, head/tools/regression/bin/sh/builtins/exec1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/exec1.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208629, head/tools/regression/bin/sh/builtins/exec1.0) @@ -0,0 +1,25 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +( + exec >/dev/null + echo bad +) +[ $? = 0 ] || failure $LINENO +( + exec sh -c 'exit 42' + echo bad +) +[ $? = 42 ] || failure $LINENO +( + exec /var/empty/nosuch + echo bad +) 2>/dev/null +[ $? = 127 ] || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/builtins/return4.0 (from r208629, head/tools/regression/bin/sh/builtins/return4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/return4.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208629, head/tools/regression/bin/sh/builtins/return4.0) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) || exit +trap 'rm -rf $T' 0 +cd $T || exit 3 +echo 'return 42; exit 4' >testscript +. ./testscript +[ "$?" = 42 ] || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/builtins/wait1.0 (from r208476, head/tools/regression/bin/sh/builtins/wait1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/wait1.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208476, head/tools/regression/bin/sh/builtins/wait1.0) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +exit 4 & p4=$! +exit 8 & p8=$! +wait $p4 +[ $? = 4 ] || failure $LINENO +wait $p8 +[ $? = 8 ] || failure $LINENO + +exit 3 & p3=$! +exit 7 & p7=$! +wait $p7 +[ $? = 7 ] || failure $LINENO +wait $p3 +[ $? = 3 ] || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/builtins/wait2.0 (from r208476, head/tools/regression/bin/sh/builtins/wait2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/wait2.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r208476, head/tools/regression/bin/sh/builtins/wait2.0) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +failures= +failure() { + echo "Error at line $1" >&2 + failures=x$failures +} + +for i in 1 2 3 4 5 6 7 8 9 10; do + exit $i & +done +wait || failure $LINENO +wait || failure $LINENO + +test -z "$failures" Copied: stable/8/tools/regression/bin/sh/expansion/ifs2.0 (from r211341, head/tools/regression/bin/sh/expansion/ifs2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/ifs2.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r211341, head/tools/regression/bin/sh/expansion/ifs2.0) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +failures=0 +i=1 +set -f +while [ "$i" -le 127 ]; do + # A different byte still in the range 1..127. + i2=$((i^2+(i==2))) + # Add a character to work around command substitution's removal of + # final newlines, then remove it again. + c=$(printf \\"$(printf %o@ "$i")") + c=${c%@} + c2=$(printf \\"$(printf %o@ "$i2")") + c2=${c2%@} + IFS=$c + set -- $c2$c$c2$c$c2 + if [ "$#" -ne 3 ] || [ "$1" != "$c2" ] || [ "$2" != "$c2" ] || + [ "$3" != "$c2" ]; then + echo "Bad results for separator $i (word $i2)" >&2 + : $((failures += 1)) + fi + i=$((i+1)) +done +exit $((failures > 0)) Copied: stable/8/tools/regression/bin/sh/expansion/plus-minus4.0 (from r211080, head/tools/regression/bin/sh/expansion/plus-minus4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/plus-minus4.0 Fri Sep 3 21:51:38 2010 (r212188, copy of r211080, head/tools/regression/bin/sh/expansion/plus-minus4.0) @@ -0,0 +1,38 @@ +# $FreeBSD$ + +# These may be a bit unclear in the POSIX spec or the proposed revisions, +# and conflict with bash's interpretation, but I think ksh93's interpretation +# makes most sense. In particular, it makes no sense to me that single-quotes +# must match but are not removed. + +e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}' +h='##' +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'set -- ${e:-'"'"'}'"'"'}' '1|}' +testcase "set -- \${e:-\\'}" "1|'" +testcase "set -- \${e:-\\'\\'}" "1|''" +testcase "set -- \"\${e:-'}\"" "1|'" +testcase "set -- \"\${e:-'}'}\"" "1|''}" +testcase "set -- \"\${e:-''}\"" "1|''" +testcase 'set -- ${e:-\a}' '1|a' +testcase 'set -- "${e:-\a}"' '1|\a' + +test "x$failures" = x From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 21:59:12 2010 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 61FAF10656CB; Fri, 3 Sep 2010 21:59:12 +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 5053F8FC1A; Fri, 3 Sep 2010 21:59:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83LxCTQ065436; Fri, 3 Sep 2010 21:59:12 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83LxCpt065434; Fri, 3 Sep 2010 21:59:12 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009032159.o83LxCpt065434@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Sep 2010 21:59: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: r212189 - stable/8/tools/regression/bin/sh/expansion X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 21:59:12 -0000 Author: jilles Date: Fri Sep 3 21:59:12 2010 New Revision: 212189 URL: http://svn.freebsd.org/changeset/base/212189 Log: MFC r209652: sh: Remove comment that the comma operator is missing in arithmetic expansion. The comma operator is not listed in POSIX.1-2008 XCU 1.1.2.1 Arithmetic Precision and Operations (referenced by XCU 2.6.4 Arithmetic Expansion) and is therefore not required. Modified: stable/8/tools/regression/bin/sh/expansion/arith2.0 Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/tools/regression/bin/sh/expansion/arith2.0 ============================================================================== --- stable/8/tools/regression/bin/sh/expansion/arith2.0 Fri Sep 3 21:51:38 2010 (r212188) +++ stable/8/tools/regression/bin/sh/expansion/arith2.0 Fri Sep 3 21:59:12 2010 (r212189) @@ -72,6 +72,6 @@ check "v" 10 check "(v=42)&&(v|=32)==42" 1 check "v" 42 -# missing: ternary, comma +# missing: ternary exit $((failures != 0)) From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 22:13:54 2010 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 DAD7B10656CA; Fri, 3 Sep 2010 22:13:54 +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 C9B6C8FC0C; Fri, 3 Sep 2010 22:13:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83MDs2Z065903; Fri, 3 Sep 2010 22:13:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83MDsp5065901; Fri, 3 Sep 2010 22:13:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009032213.o83MDsp5065901@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Sep 2010 22:13: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: r212190 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 22:13:55 -0000 Author: jilles Date: Fri Sep 3 22:13:54 2010 New Revision: 212190 URL: http://svn.freebsd.org/changeset/base/212190 Log: sh: Do not use locale for determining if something is a name. This makes it impossible to use locale-specific characters in variable names. Names containing locale-specific characters make scripts only work with the correct locale setting. Also, they did not even work in many practical cases because multibyte character sets such as utf-8 are not supported. This also avoids weirdness if LC_CTYPE is changed in the middle of a script. Modified: head/bin/sh/mksyntax.c Modified: head/bin/sh/mksyntax.c ============================================================================== --- head/bin/sh/mksyntax.c Fri Sep 3 21:59:12 2010 (r212189) +++ head/bin/sh/mksyntax.c Fri Sep 3 22:13:54 2010 (r212190) @@ -338,12 +338,12 @@ print(const char *name) */ static const char *macro[] = { - "#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)", + "#define is_digit(c)\t((is_type+SYNBASE)[(int)c] & ISDIGIT)", "#define is_eof(c)\t((c) == PEOF)", - "#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))", - "#define is_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalpha((unsigned char) (c))))", - "#define is_in_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalnum((unsigned char) (c))))", - "#define is_special(c)\t((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT))", + "#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && (is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))", + "#define is_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && (is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))", + "#define is_in_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && (is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))", + "#define is_special(c)\t((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))", NULL }; From owner-svn-src-all@FreeBSD.ORG Fri Sep 3 22:24:27 2010 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 5236710656B4; Fri, 3 Sep 2010 22:24:27 +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 418B18FC14; Fri, 3 Sep 2010 22:24:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o83MORbQ066445; Fri, 3 Sep 2010 22:24:27 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o83MOROe066443; Fri, 3 Sep 2010 22:24:27 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009032224.o83MOROe066443@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 3 Sep 2010 22:24: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: r212191 - head/lib/libedit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 03 Sep 2010 22:24:27 -0000 Author: jilles Date: Fri Sep 3 22:24:26 2010 New Revision: 212191 URL: http://svn.freebsd.org/changeset/base/212191 Log: libedit: Do not move the cursor for ed-delete-next-char in emacs mode. This makes ed-delete-next-char suitable for mapping to the key. Behaviour in vi mode is unchanged (for 'x'). Modified: head/lib/libedit/common.c Modified: head/lib/libedit/common.c ============================================================================== --- head/lib/libedit/common.c Fri Sep 3 22:13:54 2010 (r212190) +++ head/lib/libedit/common.c Fri Sep 3 22:24:26 2010 (r212191) @@ -163,15 +163,12 @@ ed_delete_next_char(EditLine *el, int c) return (CC_ERROR); #endif } - } else { - if (el->el_line.cursor != el->el_line.buffer) - el->el_line.cursor--; - else - return (CC_ERROR); - } + } else + return (CC_ERROR); } c_delafter(el, el->el_state.argument); /* delete after dot */ - if (el->el_line.cursor >= el->el_line.lastchar && + if (el->el_map.type == MAP_VI && + el->el_line.cursor >= el->el_line.lastchar && el->el_line.cursor > el->el_line.buffer) /* bounds check */ el->el_line.cursor = el->el_line.lastchar - 1; From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 05:00:30 2010 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 E345010656D3; Sat, 4 Sep 2010 05:00:29 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4C6938FC12; Sat, 4 Sep 2010 05:00:29 +0000 (UTC) Received: by vws7 with SMTP id 7so2105393vws.13 for ; Fri, 03 Sep 2010 22:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type; bh=p/t2QcvT8kcNrv6Yxfd8gYGJM7uB1uBuGoZD96XHcKg=; b=jvhIpnR46hVA706GMyEV9VfgfclVA2nxjr68xDFx6RxjHkkPqkDMOBMe/bnVNQxQ2W bpQLbDOOrGcUfiZTeckUNfEVvvhPi8VNmJhPooOIDY0AXPwsKthdzsiVEyWvqlc/aCOB Hl5IWUiaqLFf8sUyt5d6lNStJI7tJ3fjohDZc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; b=h7e+06Q3xvZIYZTXLMMaIJth4fa97F9ymPTOeLXPCuQTICtAwXR1kHSNHbJcBJtIH1 urzmieue5Rhe3ypyDe5eIVvq7koF3lgl3/3i9GS8c0Ywq2ncRVN1oIOA8FmaeIMnPGSA zXC0sNo18Lh0cuxgatH3s+fk4wYLZcywPxPys= Received: by 10.220.163.10 with SMTP id y10mr610368vcx.63.1283574593182; Fri, 03 Sep 2010 21:29:53 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id r15sm1702814vbp.0.2010.09.03.21.29.40 (version=SSLv3 cipher=RC4-MD5); Fri, 03 Sep 2010 21:29:49 -0700 (PDT) Date: Sat, 4 Sep 2010 00:29:33 -0400 From: Alexander Kabaev To: Pyun YongHyeon Message-ID: <20100904002933.6fb53534@kan.dnsalias.net> In-Reply-To: <201008311733.o7VHXmxX037013@svn.freebsd.org> References: <201008311733.o7VHXmxX037013@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/UlrpVLuIItmu183c/hIeC+M"; protocol="application/pgp-signature" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212061 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 05:00:30 -0000 --Sig_/UlrpVLuIItmu183c/hIeC+M Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 31 Aug 2010 17:33:48 +0000 (UTC) Pyun YongHyeon wrote: > Author: yongari > Date: Tue Aug 31 17:33:48 2010 > New Revision: 212061 > URL: http://svn.freebsd.org/changeset/base/212061 >=20 > Log: > Split common parent DMA tag into ring DMA tag and TX/RX mbuf DMA > tag. All controllers that are not BCM5755 or higher have 4GB > boundary DMA bug. Previously bge(4) used 32bit DMA address to > workaround the bug(r199670). However this caused the use of bounce > buffers such that it resulted in poor performance for systems which > have more than 4GB memory. Because bus_dma(9) honors boundary > restriction requirement of DMA tag for dynamic buffers, having a > separate TX/RX mbuf DMA tag will greatly reduce the possibility of > using bounce buffers. For DMA buffers allocated with > bus_dmamem_alloc(9), now bge(4) explicitly checks whether the > requested memory region crossed the boundary or not. > With this change, only the DMA buffer that crossed the boundary > will use 32bit DMA address. Other DMA buffers are not affected as > separate DMA tag is created for each DMA buffer. > Even if 32bit DMA address space is used for a buffer, the chance to > use bounce buffer is still very low as the size of buffer is small. > This change should eliminate most usage of bounce buffers on > systems that have more than 4GB memory. > =20 > More correct fix would be teaching bus_dma(9) to honor boundary > restriction for buffers created with bus_dmamem_alloc(9) but it > seems that is not easy. > =20 > While I'm here cleanup bge_dma_map_addr() and remove unnecessary > member variables in bge_dmamap_arg structure. > =20 > Tested by: marcel >=20 > Modified: > head/sys/dev/bge/if_bge.c > head/sys/dev/bge/if_bgereg.h >=20 Hi, with this commit my AMD64 machine reliably reboots after several minutes of uptime. Attempting cvs update of ports from repository located on NFS server seems to make it happen sooner. bge0: mem 0xfd8f0000-0xfd8fffff irq 24 at device 9.0 on pci2 miibus0: on bge0 brgphy0: PHY 1 on miibus0 brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto bge0: Ethernet address: 00:e0:81:28:24:e7 bge0: [ITHREAD] Booting kernel tree from just before this commit makes everything work again. --=20 Alexander Kabaev --Sig_/UlrpVLuIItmu183c/hIeC+M Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iD8DBQFMgcszQ6z1jMm+XZYRAiIMAJ9igyXdmnT8tYVe2C06IQeG+InLsgCgzDFR obNOVF90LjnGMTm2RJ4g81w= =09RZ -----END PGP SIGNATURE----- --Sig_/UlrpVLuIItmu183c/hIeC+M-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 06:05:57 2010 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 B454910656BE; Sat, 4 Sep 2010 06:05:57 +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 A1D8D8FC14; Sat, 4 Sep 2010 06:05:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8465vXS079531; Sat, 4 Sep 2010 06:05:57 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8465v79079528; Sat, 4 Sep 2010 06:05:57 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009040605.o8465v79079528@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Sep 2010 06:05:57 +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: r212192 - in stable/8/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: Sat, 04 Sep 2010 06:05:57 -0000 Author: mav Date: Sat Sep 4 06:05:57 2010 New Revision: 212192 URL: http://svn.freebsd.org/changeset/base/212192 Log: MFC r211920: Add Intel Cougar Point PCH SATA Controller DeviceIDs. Correct some existing entries for Intel Ibex Peak (5 Series/3400 Series) PCH SATA controllers. Modified: stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Fri Sep 3 22:24:26 2010 (r212191) +++ stable/8/sys/dev/ata/ata-pci.h Sat Sep 4 06:05:57 2010 (r212192) @@ -204,6 +204,29 @@ struct ata_pci_controller { #define ATA_I82801JI_AH 0x3a228086 #define ATA_I82801JI_R1 0x3a258086 #define ATA_I82801JI_S2 0x3a268086 + +#define ATA_5Series_S1 0x3b208086 +#define ATA_5Series_S2 0x3b218086 +#define ATA_5Series_AH1 0x3b228086 +#define ATA_5Series_AH2 0x3b238086 +#define ATA_5Series_R1 0x3b258086 +#define ATA_5Series_S3 0x3b268086 +#define ATA_5Series_S4 0x3b288086 +#define ATA_5Series_AH3 0x3b298086 +#define ATA_5Series_R2 0x3b2c8086 +#define ATA_5Series_S5 0x3b2d8086 +#define ATA_5Series_S6 0x3b2e8086 +#define ATA_5Series_AH4 0x3b2f8086 + +#define ATA_CPT_S1 0x1c008086 +#define ATA_CPT_S2 0x1c018086 +#define ATA_CPT_AH1 0x1c028086 +#define ATA_CPT_AH2 0x1c038086 +#define ATA_CPT_R1 0x1c048086 +#define ATA_CPT_R2 0x1c058086 +#define ATA_CPT_S3 0x1c088086 +#define ATA_CPT_S4 0x1c098086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Fri Sep 3 22:24:26 2010 (r212191) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Sat Sep 4 06:05:57 2010 (r212192) @@ -140,22 +140,26 @@ ata_intel_probe(device_t dev) { ATA_I82801JI_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JI_S2, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, - { 0x3b208086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b218086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b228086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b238086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b248086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b258086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b268086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b278086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b288086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b298086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2a8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2b8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2c8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2d8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2e8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3b2f8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, + { ATA_5Series_S1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_R1, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_AH3, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_R2, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S5, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_S6, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_5Series_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "5 Series/3400 Series PCH" }, + { ATA_CPT_S1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S3, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, + { ATA_CPT_S4, 0, INTEL_AHCI, 0, ATA_SA300, "Cougar Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { 0, 0, 0, 0, 0, 0}}; From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 06:09:09 2010 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 6830E10656B9; Sat, 4 Sep 2010 06:09:09 +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 3C4AE8FC08; Sat, 4 Sep 2010 06:09:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84699AM079712; Sat, 4 Sep 2010 06:09:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84699VX079710; Sat, 4 Sep 2010 06:09:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009040609.o84699VX079710@svn.freebsd.org> From: Alexander Motin Date: Sat, 4 Sep 2010 06:09:09 +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: r212193 - 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: Sat, 04 Sep 2010 06:09:09 -0000 Author: mav Date: Sat Sep 4 06:09:08 2010 New Revision: 212193 URL: http://svn.freebsd.org/changeset/base/212193 Log: MFC r211922: Add Intel Cougar Point PCH SATA Controller DeviceIDs. Correct some existing entries for Intel Ibex Peak (5 Series/3400 Series) PCH SATA controllers. Modified: stable/8/sys/dev/ahci/ahci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Sat Sep 4 06:05:57 2010 (r212192) +++ stable/8/sys/dev/ahci/ahci.c Sat Sep 4 06:09:08 2010 (r212193) @@ -151,14 +151,16 @@ static struct { {0x3a058086, 0x00, "Intel ICH10", 0}, {0x3a228086, 0x00, "Intel ICH10", 0}, {0x3a258086, 0x00, "Intel ICH10", 0}, - {0x3b228086, 0x00, "Intel PCH", 0}, - {0x3b238086, 0x00, "Intel PCH", 0}, - {0x3b248086, 0x00, "Intel PCH", 0}, - {0x3b258086, 0x00, "Intel PCH", 0}, - {0x3b298086, 0x00, "Intel PCH", 0}, - {0x3b2b8086, 0x00, "Intel PCH", 0}, - {0x3b2c8086, 0x00, "Intel PCH", 0}, - {0x3b2f8086, 0x00, "Intel PCH", 0}, + {0x3b228086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b238086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b258086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b298086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b2c8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x3b2f8086, 0x00, "Intel 5 Series/3400 Series", 0}, + {0x1c028086, 0x00, "Intel Cougar Point", 0}, + {0x1c038086, 0x00, "Intel Cougar Point", 0}, + {0x1c048086, 0x00, "Intel Cougar Point", 0}, + {0x1c058086, 0x00, "Intel Cougar Point", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 06:27:16 2010 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 9932510656BA; Sat, 4 Sep 2010 06:27:16 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx1.freebsd.org (Postfix) with ESMTP id AE0358FC0A; Sat, 4 Sep 2010 06:27:15 +0000 (UTC) Received: by wwb13 with SMTP id 13so125492wwb.1 for ; Fri, 03 Sep 2010 23:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:reply-to :in-reply-to:references:date:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=fsTP21XP24AI8we86dbP4RzpbgknR231BcNi5y2TKcA=; b=vR6ieIuypfQJb0Bhu/tOj4jlcOcvdEO6SAnl1qkJQeb7oPo9KOA9qXjiLGUHAOQmM2 rvL40ps6M1fk9EVrKY11OIAZwyA87wzNBe7AgC2zajNJD/IMTpzonjWAexGfLfBJrcmx AXvHvX8eVZMWR9SDEy4JKtjojXTcltCKN664o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; b=BttirMrg8iFMfV6g3BsO5P04soGlc1MQydi3CYws+6FCGvp0DmLSXD6cFY3VcmEDGi kUs0X4qr07nI30btPQZCgVncFiyBLJSwchIflCdVqsiKgUePLT0UNfwQKNcfDQjtPc7T 3N7ZXH0/L4euiseHIYZPxKcUfcwZ8APxT06z0= MIME-Version: 1.0 Received: by 10.216.28.204 with SMTP id g54mr979836wea.73.1283581634524; Fri, 03 Sep 2010 23:27:14 -0700 (PDT) Received: by 10.216.69.136 with HTTP; Fri, 3 Sep 2010 23:27:14 -0700 (PDT) In-Reply-To: <20100904002933.6fb53534@kan.dnsalias.net> References: <201008311733.o7VHXmxX037013@svn.freebsd.org> <20100904002933.6fb53534@kan.dnsalias.net> Date: Fri, 3 Sep 2010 23:27:14 -0700 Message-ID: From: Pyun YongHyeon To: Alexander Kabaev 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, Pyun YongHyeon Subject: Re: svn commit: r212061 - head/sys/dev/bge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: "SVN commit messages 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, 04 Sep 2010 06:27:16 -0000 On Fri, Sep 3, 2010 at 9:29 PM, Alexander Kabaev wrote: > On Tue, 31 Aug 2010 17:33:48 +0000 (UTC) > Pyun YongHyeon wrote: > >> Author: yongari >> Date: Tue Aug 31 17:33:48 2010 >> New Revision: 212061 >> URL: http://svn.freebsd.org/changeset/base/212061 >> >> Log: >> =A0 Split common parent DMA tag into ring DMA tag and TX/RX mbuf DMA >> =A0 tag. All controllers that are not BCM5755 or higher have 4GB >> =A0 boundary DMA bug. Previously bge(4) used 32bit DMA address to >> =A0 workaround the bug(r199670). However this caused the use of bounce >> =A0 buffers such that it resulted in poor performance for systems which >> =A0 have more than 4GB memory. Because bus_dma(9) honors boundary >> =A0 restriction requirement of DMA tag for dynamic buffers, having a >> =A0 separate TX/RX mbuf DMA tag will greatly reduce the possibility of >> =A0 using bounce buffers. For DMA buffers allocated with >> =A0 bus_dmamem_alloc(9), now bge(4) explicitly checks whether the >> =A0 requested memory region crossed the boundary or not. >> =A0 With this change, only the DMA buffer that crossed the boundary >> =A0 will use 32bit DMA address. Other DMA buffers are not affected as >> =A0 separate DMA tag is created for each DMA buffer. >> =A0 Even if 32bit DMA address space is used for a buffer, the chance to >> =A0 use bounce buffer is still very low as the size of buffer is small. >> =A0 This change should eliminate most usage of bounce buffers on >> =A0 systems that have more than 4GB memory. >> >> =A0 More correct fix would be teaching bus_dma(9) to honor boundary >> =A0 restriction for buffers created with bus_dmamem_alloc(9) but it >> =A0 seems that is not easy. >> >> =A0 While I'm here cleanup bge_dma_map_addr() and remove unnecessary >> =A0 member variables in bge_dmamap_arg structure. >> >> =A0 Tested by: =A0marcel >> >> Modified: >> =A0 head/sys/dev/bge/if_bge.c >> =A0 head/sys/dev/bge/if_bgereg.h >> > > Hi, > > with this commit my AMD64 machine reliably reboots after several > minutes of uptime. Attempting cvs update of ports from repository > located on NFS server seems to make it happen sooner. > > > bge0: =A00x001002> mem 0xfd8f0000-0xfd8fffff irq 24 at device 9.0 on pci2 > miibus0: on bge0 > brgphy0: PHY 1 on miibus0 > brgphy0: =A010baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, > 1000baseT-FDX, auto > bge0: Ethernet address: 00:e0:81:28:24:e7 > bge0: [ITHREAD] > > Booting kernel tree from just before this commit makes everything work > again. Sorry, it seems I forgot allocating statistics block. This may cause issues for controllers(e.g. 570x) that support hardware MAC statistics counters. This could be the reason why I couldn't see the issue on 5761. I'm on vacation so I'll fix it Tuesday. If it's urgent please back out this change. > -- > Alexander Kabaev > From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 06:36:12 2010 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 D20AE1065672; Sat, 4 Sep 2010 06:36:12 +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 C0AEB8FC0C; Sat, 4 Sep 2010 06:36:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o846aCZa080450; Sat, 4 Sep 2010 06:36:12 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o846aCXS080448; Sat, 4 Sep 2010 06:36:12 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201009040636.o846aCXS080448@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 4 Sep 2010 06:36: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: r212194 - stable/8/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 06:36:12 -0000 Author: jh Date: Sat Sep 4 06:36:12 2010 New Revision: 212194 URL: http://svn.freebsd.org/changeset/base/212194 Log: MFC r211513: Call dev_rel() in error paths. Modified: stable/8/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Sat Sep 4 06:09:08 2010 (r212193) +++ stable/8/sys/fs/devfs/devfs_vnops.c Sat Sep 4 06:36:12 2010 (r212194) @@ -825,6 +825,8 @@ devfs_lookupx(struct vop_lookup_args *ap *dm_unlock = 0; sx_xunlock(&dmp->dm_lock); devfs_unmount_final(dmp); + if (cdev != NULL) + dev_rel(cdev); return (ENOENT); } if (cdev == NULL) @@ -836,6 +838,7 @@ devfs_lookupx(struct vop_lookup_args *ap *dm_unlock = 0; sx_xunlock(&dmp->dm_lock); devfs_unmount_final(dmp); + dev_rel(cdev); return (ENOENT); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 08:42:19 2010 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 7AF4B1065697; Sat, 4 Sep 2010 08:42:19 +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 6A7808FC13; Sat, 4 Sep 2010 08:42:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o848gJc5088097; Sat, 4 Sep 2010 08:42:19 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o848gJiK088095; Sat, 4 Sep 2010 08:42:19 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201009040842.o848gJiK088095@svn.freebsd.org> From: Kevin Lo Date: Sat, 4 Sep 2010 08:42: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: r212195 - head/sbin/mount_nfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 08:42:19 -0000 Author: kevlo Date: Sat Sep 4 08:42:19 2010 New Revision: 212195 URL: http://svn.freebsd.org/changeset/base/212195 Log: Shut the compiler up; initializes the sotype variable to zero in nfs_tryproto(). Reviewed by: rmacklem Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Sat Sep 4 06:36:12 2010 (r212194) +++ head/sbin/mount_nfs/mount_nfs.c Sat Sep 4 08:42:19 2010 (r212195) @@ -866,6 +866,7 @@ nfs_tryproto(struct addrinfo *ai, char * enum clnt_stat stat; enum mountmode trymntmode; + sotype = 0; trymntmode = mountmode; errbuf[0] = '\0'; *errstr = errbuf; From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 11:50:17 2010 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 E531F106567A; Sat, 4 Sep 2010 11:50:17 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D3AD18FC16; Sat, 4 Sep 2010 11:50:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84BoH0D003768; Sat, 4 Sep 2010 11:50:17 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84BoHaD003766; Sat, 4 Sep 2010 11:50:17 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041150.o84BoHaD003766@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 11:50: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: r212196 - stable/8/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 11:50:18 -0000 Author: kaiw Date: Sat Sep 4 11:50:17 2010 New Revision: 212196 URL: http://svn.freebsd.org/changeset/base/212196 Log: MFC r210321: Remove a superfluous comment. Modified: stable/8/lib/libelf/elf_update.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_update.c ============================================================================== --- stable/8/lib/libelf/elf_update.c Sat Sep 4 08:42:19 2010 (r212195) +++ stable/8/lib/libelf/elf_update.c Sat Sep 4 11:50:17 2010 (r212196) @@ -297,7 +297,6 @@ _libelf_resync_sections(Elf *e, off_t rc else sh_type = s->s_shdr.s_shdr64.sh_type; - /* XXX Do we need the 'size' field of an SHT_NOBITS section */ if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) continue; From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 11:50:23 2010 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 D4ECF106577D; Sat, 4 Sep 2010 11:50:23 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2B4C8FC0A; Sat, 4 Sep 2010 11:50:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84BoNZw003810; Sat, 4 Sep 2010 11:50:23 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84BoNQv003808; Sat, 4 Sep 2010 11:50:23 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041150.o84BoNQv003808@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 11:50:23 +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: r212197 - stable/7/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 11:50:24 -0000 Author: kaiw Date: Sat Sep 4 11:50:23 2010 New Revision: 212197 URL: http://svn.freebsd.org/changeset/base/212197 Log: MFC r210321: Remove a superfluous comment. Modified: stable/7/lib/libelf/elf_update.c Directory Properties: stable/7/lib/libelf/ (props changed) Modified: stable/7/lib/libelf/elf_update.c ============================================================================== --- stable/7/lib/libelf/elf_update.c Sat Sep 4 11:50:17 2010 (r212196) +++ stable/7/lib/libelf/elf_update.c Sat Sep 4 11:50:23 2010 (r212197) @@ -297,7 +297,6 @@ _libelf_resync_sections(Elf *e, off_t rc else sh_type = s->s_shdr.s_shdr64.sh_type; - /* XXX Do we need the 'size' field of an SHT_NOBITS section */ if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) continue; From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 12:06:02 2010 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 8406910656B1; Sat, 4 Sep 2010 12:06:02 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7110B8FC14; Sat, 4 Sep 2010 12:06:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84C62OF004954; Sat, 4 Sep 2010 12:06:02 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84C62Tn004950; Sat, 4 Sep 2010 12:06:02 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041206.o84C62Tn004950@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:06:02 +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: r212198 - in stable/8: cddl/contrib/opensolaris/tools/ctf/cvt lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 12:06:02 -0000 Author: kaiw Date: Sat Sep 4 12:06:02 2010 New Revision: 212198 URL: http://svn.freebsd.org/changeset/base/212198 Log: MFC r210324, r210438. r210324: - Correctly handle sections of type SHT_NOBITS. For these sections: - elf_getdata() and elf_rawdata() should return an "Elf_Data" structure that has its "d_buf" member set to NULL and "d_size" member set to the nominal 'size' of the section. - Update the manual page for these functions. - Fix a memory leak in an error handling path inside elf_getdata(). - Use _libelf_allocate_data() in elf_newdata() for consistency. r210438: (np) Catch up with r210324. d_buf will be NULL for SHT_NOBITS sections, do not attempt to copy from it in that case. Modified: stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/output.c stable/8/lib/libelf/elf_data.c stable/8/lib/libelf/elf_getdata.3 Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/lib/libelf/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/output.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Sat Sep 4 11:50:23 2010 (r212197) +++ stable/8/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Sat Sep 4 12:06:02 2010 (r212198) @@ -644,7 +644,7 @@ write_file(Elf *src, const char *srcname } #if !defined(sun) - if (ddata->d_buf == NULL) { + if (ddata->d_buf == NULL && sdata->d_buf != NULL) { ddata->d_buf = xmalloc(shdr.sh_size); bcopy(sdata->d_buf, ddata->d_buf, shdr.sh_size); } Modified: stable/8/lib/libelf/elf_data.c ============================================================================== --- stable/8/lib/libelf/elf_data.c Sat Sep 4 11:50:23 2010 (r212197) +++ stable/8/lib/libelf/elf_data.c Sat Sep 4 12:06:02 2010 (r212198) @@ -39,7 +39,6 @@ Elf_Data * elf_getdata(Elf_Scn *s, Elf_Data *d) { Elf *e; - char *dst; size_t fsz, msz, count; int elfclass, elftype; unsigned int sh_type; @@ -79,20 +78,22 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) sh_align = s->s_shdr.s_shdr64.sh_addralign; } + if (sh_type == SHT_NULL) + return (NULL); + if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST || - elftype > ELF_T_LAST || - sh_offset + sh_size > (uint64_t) e->e_rawsize) { + elftype > ELF_T_LAST || (sh_type != SHT_NOBITS && + sh_offset + sh_size > (uint64_t) e->e_rawsize)) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); } - if ((fsz = (elfclass == ELFCLASS32 ? elf32_fsize : elf64_fsize)(elftype, - (size_t) 1, e->e_version)) == 0) { + if ((fsz = (elfclass == ELFCLASS32 ? elf32_fsize : elf64_fsize) + (elftype, (size_t) 1, e->e_version)) == 0) { LIBELF_SET_ERROR(UNIMPL, 0); return (NULL); } - if (sh_size % fsz) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); @@ -104,21 +105,25 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) assert(msz > 0); - if ((dst = malloc(msz*count)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = dst; + d->d_buf = NULL; d->d_off = 0; d->d_align = sh_align; d->d_size = msz * count; d->d_type = elftype; d->d_version = e->e_version; + if (sh_type == SHT_NOBITS) + return (d); + + if ((d->d_buf = malloc(msz*count)) == NULL) { + (void) _libelf_release_data(d); + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + d->d_flags |= LIBELF_F_MALLOCED; STAILQ_INSERT_TAIL(&s->s_data, d, d_next); @@ -149,14 +154,10 @@ elf_newdata(Elf_Scn *s) if (elf_getdata(s, NULL) == NULL) return (NULL); - if ((d = malloc(sizeof(Elf_Data))) == NULL) { - LIBELF_SET_ERROR(RESOURCE, errno); + if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - } STAILQ_INSERT_TAIL(&s->s_data, d, d_next); - d->d_flags = 0; - d->d_scn = s; d->d_align = 1; d->d_buf = NULL; @@ -180,6 +181,7 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) { Elf *e; int elf_class; + uint32_t sh_type; uint64_t sh_align, sh_offset, sh_size; if (s == NULL || (e = s->s_elf) == NULL || @@ -199,19 +201,24 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) assert(elf_class == ELFCLASS32 || elf_class == ELFCLASS64); if (elf_class == ELFCLASS32) { + sh_type = s->s_shdr.s_shdr32.sh_type; sh_offset = (uint64_t) s->s_shdr.s_shdr32.sh_offset; sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; sh_align = (uint64_t) s->s_shdr.s_shdr32.sh_addralign; } else { + sh_type = s->s_shdr.s_shdr64.sh_type; sh_offset = s->s_shdr.s_shdr64.sh_offset; sh_size = s->s_shdr.s_shdr64.sh_size; sh_align = s->s_shdr.s_shdr64.sh_addralign; } + if (sh_type == SHT_NULL) + return (NULL); + if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = e->e_rawfile + sh_offset; + d->d_buf = sh_type == SHT_NOBITS ? NULL : e->e_rawfile + sh_offset; d->d_off = 0; d->d_align = sh_align; d->d_size = sh_size; Modified: stable/8/lib/libelf/elf_getdata.3 ============================================================================== --- stable/8/lib/libelf/elf_getdata.3 Sat Sep 4 11:50:23 2010 (r212197) +++ stable/8/lib/libelf/elf_getdata.3 Sat Sep 4 12:06:02 2010 (r212198) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -142,6 +142,32 @@ always returns .Vt Elf_Data structures of type .Dv ELF_T_BYTE . +.Ss Special handling of SHT_NOBITS sections +For sections of type +.Dv SHT_NOBITS , +the functions +.Fn elf_getdata +and +.Fn elf_rawdata +return a pointer to a valid +.Vt Elf_Data +structure that has its +.Va d_buf +member set to NULL and its +.Va d_size +member set to the size of the section. +.Pp +If an application wishes to create a section of type +.Dv SHT_NOBITS , +it should add a data buffer to the section using function +.Fn elf_newdata . +It should then set the +.Va d_buf +and +.Va d_size +members of the returned +.Vt Elf_Data +structure to NULL and the desired size of the section respectively. .Sh RETURN VALUES These functions return a valid pointer to a data descriptor if successful, or NULL if an error occurs. From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 12:06:10 2010 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 56D4F10657DE; Sat, 4 Sep 2010 12:06:10 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4396B8FC1B; Sat, 4 Sep 2010 12:06:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84C6AYJ005002; Sat, 4 Sep 2010 12:06:10 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84C6AoX004998; Sat, 4 Sep 2010 12:06:10 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041206.o84C6AoX004998@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:06:10 +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: r212199 - in stable/7: cddl/contrib/opensolaris/tools/ctf/cvt lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 12:06:10 -0000 Author: kaiw Date: Sat Sep 4 12:06:09 2010 New Revision: 212199 URL: http://svn.freebsd.org/changeset/base/212199 Log: MFC r210324, r210438. r210324: - Correctly handle sections of type SHT_NOBITS. For these sections: - elf_getdata() and elf_rawdata() should return an "Elf_Data" structure that has its "d_buf" member set to NULL and "d_size" member set to the nominal 'size' of the section. - Update the manual page for these functions. - Fix a memory leak in an error handling path inside elf_getdata(). - Use _libelf_allocate_data() in elf_newdata() for consistency. r210438: (np) Catch up with r210324. d_buf will be NULL for SHT_NOBITS sections, do not attempt to copy from it in that case. Modified: stable/7/cddl/contrib/opensolaris/tools/ctf/cvt/output.c stable/7/lib/libelf/elf_data.c stable/7/lib/libelf/elf_getdata.3 Directory Properties: stable/7/cddl/contrib/opensolaris/ (props changed) stable/7/lib/libelf/ (props changed) Modified: stable/7/cddl/contrib/opensolaris/tools/ctf/cvt/output.c ============================================================================== --- stable/7/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Sat Sep 4 12:06:02 2010 (r212198) +++ stable/7/cddl/contrib/opensolaris/tools/ctf/cvt/output.c Sat Sep 4 12:06:09 2010 (r212199) @@ -644,7 +644,7 @@ write_file(Elf *src, const char *srcname } #if !defined(sun) - if (ddata->d_buf == NULL) { + if (ddata->d_buf == NULL && sdata->d_buf != NULL) { ddata->d_buf = xmalloc(shdr.sh_size); bcopy(sdata->d_buf, ddata->d_buf, shdr.sh_size); } Modified: stable/7/lib/libelf/elf_data.c ============================================================================== --- stable/7/lib/libelf/elf_data.c Sat Sep 4 12:06:02 2010 (r212198) +++ stable/7/lib/libelf/elf_data.c Sat Sep 4 12:06:09 2010 (r212199) @@ -39,7 +39,6 @@ Elf_Data * elf_getdata(Elf_Scn *s, Elf_Data *d) { Elf *e; - char *dst; size_t fsz, msz, count; int elfclass, elftype; unsigned int sh_type; @@ -79,20 +78,22 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) sh_align = s->s_shdr.s_shdr64.sh_addralign; } + if (sh_type == SHT_NULL) + return (NULL); + if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST || - elftype > ELF_T_LAST || - sh_offset + sh_size > (uint64_t) e->e_rawsize) { + elftype > ELF_T_LAST || (sh_type != SHT_NOBITS && + sh_offset + sh_size > (uint64_t) e->e_rawsize)) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); } - if ((fsz = (elfclass == ELFCLASS32 ? elf32_fsize : elf64_fsize)(elftype, - (size_t) 1, e->e_version)) == 0) { + if ((fsz = (elfclass == ELFCLASS32 ? elf32_fsize : elf64_fsize) + (elftype, (size_t) 1, e->e_version)) == 0) { LIBELF_SET_ERROR(UNIMPL, 0); return (NULL); } - if (sh_size % fsz) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); @@ -104,21 +105,25 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) assert(msz > 0); - if ((dst = malloc(msz*count)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = dst; + d->d_buf = NULL; d->d_off = 0; d->d_align = sh_align; d->d_size = msz * count; d->d_type = elftype; d->d_version = e->e_version; + if (sh_type == SHT_NOBITS) + return (d); + + if ((d->d_buf = malloc(msz*count)) == NULL) { + (void) _libelf_release_data(d); + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + d->d_flags |= LIBELF_F_MALLOCED; STAILQ_INSERT_TAIL(&s->s_data, d, d_next); @@ -149,14 +154,10 @@ elf_newdata(Elf_Scn *s) if (elf_getdata(s, NULL) == NULL) return (NULL); - if ((d = malloc(sizeof(Elf_Data))) == NULL) { - LIBELF_SET_ERROR(RESOURCE, errno); + if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - } STAILQ_INSERT_TAIL(&s->s_data, d, d_next); - d->d_flags = 0; - d->d_scn = s; d->d_align = 1; d->d_buf = NULL; @@ -180,6 +181,7 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) { Elf *e; int elf_class; + uint32_t sh_type; uint64_t sh_align, sh_offset, sh_size; if (s == NULL || (e = s->s_elf) == NULL || @@ -199,19 +201,24 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) assert(elf_class == ELFCLASS32 || elf_class == ELFCLASS64); if (elf_class == ELFCLASS32) { + sh_type = s->s_shdr.s_shdr32.sh_type; sh_offset = (uint64_t) s->s_shdr.s_shdr32.sh_offset; sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; sh_align = (uint64_t) s->s_shdr.s_shdr32.sh_addralign; } else { + sh_type = s->s_shdr.s_shdr64.sh_type; sh_offset = s->s_shdr.s_shdr64.sh_offset; sh_size = s->s_shdr.s_shdr64.sh_size; sh_align = s->s_shdr.s_shdr64.sh_addralign; } + if (sh_type == SHT_NULL) + return (NULL); + if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = e->e_rawfile + sh_offset; + d->d_buf = sh_type == SHT_NOBITS ? NULL : e->e_rawfile + sh_offset; d->d_off = 0; d->d_align = sh_align; d->d_size = sh_size; Modified: stable/7/lib/libelf/elf_getdata.3 ============================================================================== --- stable/7/lib/libelf/elf_getdata.3 Sat Sep 4 12:06:02 2010 (r212198) +++ stable/7/lib/libelf/elf_getdata.3 Sat Sep 4 12:06:09 2010 (r212199) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -142,6 +142,32 @@ always returns .Vt Elf_Data structures of type .Dv ELF_T_BYTE . +.Ss Special handling of SHT_NOBITS sections +For sections of type +.Dv SHT_NOBITS , +the functions +.Fn elf_getdata +and +.Fn elf_rawdata +return a pointer to a valid +.Vt Elf_Data +structure that has its +.Va d_buf +member set to NULL and its +.Va d_size +member set to the size of the section. +.Pp +If an application wishes to create a section of type +.Dv SHT_NOBITS , +it should add a data buffer to the section using function +.Fn elf_newdata . +It should then set the +.Va d_buf +and +.Va d_size +members of the returned +.Vt Elf_Data +structure to NULL and the desired size of the section respectively. .Sh RETURN VALUES These functions return a valid pointer to a data descriptor if successful, or NULL if an error occurs. From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 12:19:19 2010 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 7CD561065679; Sat, 4 Sep 2010 12:19:19 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A9738FC18; Sat, 4 Sep 2010 12:19:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84CJJIZ006150; Sat, 4 Sep 2010 12:19:19 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84CJJN6006144; Sat, 4 Sep 2010 12:19:19 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041219.o84CJJN6006144@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:19:19 +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: r212200 - stable/8/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 12:19:19 -0000 Author: kaiw Date: Sat Sep 4 12:19:19 2010 New Revision: 212200 URL: http://svn.freebsd.org/changeset/base/212200 Log: MFC r210325,r210326,r210328,r210349 r210325: Bug fix: when updating headers using the gelf_update_*() functions, the appropriate `dirty' bit needs to be set for both the Elf32 and Elf64 case. r210326: Improve compatibility with other implementations of the ELF(3) API: when an output file has no program headers, set the 'e_phentsize' field of the ELF executable header to zero. r210328: Bug fix: permit the creation of zero-sized sections. r210349: Remove a redundant word. Modified: stable/8/lib/libelf/elf.3 stable/8/lib/libelf/elf_update.c stable/8/lib/libelf/gelf_ehdr.c stable/8/lib/libelf/gelf_phdr.c stable/8/lib/libelf/gelf_shdr.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf.3 ============================================================================== --- stable/8/lib/libelf/elf.3 Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/elf.3 Sat Sep 4 12:19:19 2010 (r212200) @@ -36,8 +36,8 @@ .Sh DESCRIPTION The .Lb libelf -library provides functions that allow an application to read and -manipulate ELF object files, and to read +provides functions that allow an application to read and manipulate +ELF object files, and to read .Xr ar 1 archives. The library allows the manipulation of ELF objects in a byte ordering Modified: stable/8/lib/libelf/elf_update.c ============================================================================== --- stable/8/lib/libelf/elf_update.c Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/elf_update.c Sat Sep 4 12:19:19 2010 (r212200) @@ -422,8 +422,8 @@ _libelf_resync_elf(Elf *e) (E)->e_ident[EI_VERSION] = (V); \ (E)->e_ehsize = _libelf_fsize(ELF_T_EHDR, (EC), (V), \ (size_t) 1); \ - (E)->e_phentsize = _libelf_fsize(ELF_T_PHDR, (EC), (V), \ - (size_t) 1); \ + (E)->e_phentsize = (phnum == 0) ? 0 : _libelf_fsize( \ + ELF_T_PHDR, (EC), (V), (size_t) 1); \ (E)->e_shentsize = _libelf_fsize(ELF_T_SHDR, (EC), (V), \ (size_t) 1); \ } while (0) @@ -534,22 +534,24 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ int ec; size_t fsz, msz, nobjects; uint32_t sh_type; - uint64_t sh_off; + uint64_t sh_off, sh_size; int elftype; Elf_Data *d, dst; - if ((ec = e->e_class) == ELFCLASS32) + if ((ec = e->e_class) == ELFCLASS32) { sh_type = s->s_shdr.s_shdr32.sh_type; - else + sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; + } else { sh_type = s->s_shdr.s_shdr64.sh_type; + sh_size = s->s_shdr.s_shdr64.sh_size; + } /* * Ignore sections that do not allocate space in the file. */ - if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) + if (sh_type == SHT_NOBITS || sh_type == SHT_NULL || sh_size == 0) return (rc); - elftype = _libelf_xlate_shtype(sh_type); assert(elftype >= ELF_T_FIRST && elftype <= ELF_T_LAST); Modified: stable/8/lib/libelf/gelf_ehdr.c ============================================================================== --- stable/8/lib/libelf/gelf_ehdr.c Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/gelf_ehdr.c Sat Sep 4 12:19:19 2010 (r212200) @@ -137,6 +137,8 @@ gelf_update_ehdr(Elf *e, GElf_Ehdr *s) if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (0); + (void) elf_flagehdr(e, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { eh64 = (Elf64_Ehdr *) ehdr; *eh64 = *s; @@ -161,7 +163,5 @@ gelf_update_ehdr(Elf *e, GElf_Ehdr *s) eh32->e_shnum = s->e_shnum; eh32->e_shstrndx = s->e_shstrndx; - (void) elf_flagehdr(e, ELF_C_SET, ELF_F_DIRTY); - return (1); } Modified: stable/8/lib/libelf/gelf_phdr.c ============================================================================== --- stable/8/lib/libelf/gelf_phdr.c Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/gelf_phdr.c Sat Sep 4 12:19:19 2010 (r212200) @@ -155,6 +155,8 @@ gelf_update_phdr(Elf *e, int ndx, GElf_P return (0); } + (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { ph64 = e->e_u.e_elf.e_phdr.e_phdr64 + ndx; *ph64 = *s; @@ -172,7 +174,5 @@ gelf_update_phdr(Elf *e, int ndx, GElf_P LIBELF_COPY_U32(ph32, s, p_memsz); LIBELF_COPY_U32(ph32, s, p_align); - (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); - return (1); } Modified: stable/8/lib/libelf/gelf_shdr.c ============================================================================== --- stable/8/lib/libelf/gelf_shdr.c Sat Sep 4 12:06:09 2010 (r212199) +++ stable/8/lib/libelf/gelf_shdr.c Sat Sep 4 12:19:19 2010 (r212200) @@ -107,6 +107,8 @@ gelf_update_shdr(Elf_Scn *scn, GElf_Shdr return (0); } + (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { scn->s_shdr.s_shdr64 = *s; return (1); @@ -125,7 +127,5 @@ gelf_update_shdr(Elf_Scn *scn, GElf_Shdr LIBELF_COPY_U32(sh32, s, sh_addralign); LIBELF_COPY_U32(sh32, s, sh_entsize); - (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); - return (1); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 12:19:26 2010 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 91A5110656F4; Sat, 4 Sep 2010 12:19:25 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F2EB8FC08; Sat, 4 Sep 2010 12:19:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84CJPA0006198; Sat, 4 Sep 2010 12:19:25 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84CJPpd006192; Sat, 4 Sep 2010 12:19:25 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041219.o84CJPpd006192@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:19:25 +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: r212201 - stable/7/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 12:19:26 -0000 Author: kaiw Date: Sat Sep 4 12:19:25 2010 New Revision: 212201 URL: http://svn.freebsd.org/changeset/base/212201 Log: MFC r210325,r210326,r210328,r210349 r210325: Bug fix: when updating headers using the gelf_update_*() functions, the appropriate `dirty' bit needs to be set for both the Elf32 and Elf64 case. r210326: Improve compatibility with other implementations of the ELF(3) API: when an output file has no program headers, set the 'e_phentsize' field of the ELF executable header to zero. r210328: Bug fix: permit the creation of zero-sized sections. r210349: Remove a redundant word. Modified: stable/7/lib/libelf/elf.3 stable/7/lib/libelf/elf_update.c stable/7/lib/libelf/gelf_ehdr.c stable/7/lib/libelf/gelf_phdr.c stable/7/lib/libelf/gelf_shdr.c Directory Properties: stable/7/lib/libelf/ (props changed) Modified: stable/7/lib/libelf/elf.3 ============================================================================== --- stable/7/lib/libelf/elf.3 Sat Sep 4 12:19:19 2010 (r212200) +++ stable/7/lib/libelf/elf.3 Sat Sep 4 12:19:25 2010 (r212201) @@ -36,8 +36,8 @@ .Sh DESCRIPTION The .Lb libelf -library provides functions that allow an application to read and -manipulate ELF object files, and to read +provides functions that allow an application to read and manipulate +ELF object files, and to read .Xr ar 1 archives. The library allows the manipulation of ELF objects in a byte ordering Modified: stable/7/lib/libelf/elf_update.c ============================================================================== --- stable/7/lib/libelf/elf_update.c Sat Sep 4 12:19:19 2010 (r212200) +++ stable/7/lib/libelf/elf_update.c Sat Sep 4 12:19:25 2010 (r212201) @@ -422,8 +422,8 @@ _libelf_resync_elf(Elf *e) (E)->e_ident[EI_VERSION] = (V); \ (E)->e_ehsize = _libelf_fsize(ELF_T_EHDR, (EC), (V), \ (size_t) 1); \ - (E)->e_phentsize = _libelf_fsize(ELF_T_PHDR, (EC), (V), \ - (size_t) 1); \ + (E)->e_phentsize = (phnum == 0) ? 0 : _libelf_fsize( \ + ELF_T_PHDR, (EC), (V), (size_t) 1); \ (E)->e_shentsize = _libelf_fsize(ELF_T_SHDR, (EC), (V), \ (size_t) 1); \ } while (0) @@ -534,22 +534,24 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ int ec; size_t fsz, msz, nobjects; uint32_t sh_type; - uint64_t sh_off; + uint64_t sh_off, sh_size; int elftype; Elf_Data *d, dst; - if ((ec = e->e_class) == ELFCLASS32) + if ((ec = e->e_class) == ELFCLASS32) { sh_type = s->s_shdr.s_shdr32.sh_type; - else + sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; + } else { sh_type = s->s_shdr.s_shdr64.sh_type; + sh_size = s->s_shdr.s_shdr64.sh_size; + } /* * Ignore sections that do not allocate space in the file. */ - if (sh_type == SHT_NOBITS || sh_type == SHT_NULL) + if (sh_type == SHT_NOBITS || sh_type == SHT_NULL || sh_size == 0) return (rc); - elftype = _libelf_xlate_shtype(sh_type); assert(elftype >= ELF_T_FIRST && elftype <= ELF_T_LAST); Modified: stable/7/lib/libelf/gelf_ehdr.c ============================================================================== --- stable/7/lib/libelf/gelf_ehdr.c Sat Sep 4 12:19:19 2010 (r212200) +++ stable/7/lib/libelf/gelf_ehdr.c Sat Sep 4 12:19:25 2010 (r212201) @@ -137,6 +137,8 @@ gelf_update_ehdr(Elf *e, GElf_Ehdr *s) if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (0); + (void) elf_flagehdr(e, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { eh64 = (Elf64_Ehdr *) ehdr; *eh64 = *s; @@ -161,7 +163,5 @@ gelf_update_ehdr(Elf *e, GElf_Ehdr *s) eh32->e_shnum = s->e_shnum; eh32->e_shstrndx = s->e_shstrndx; - (void) elf_flagehdr(e, ELF_C_SET, ELF_F_DIRTY); - return (1); } Modified: stable/7/lib/libelf/gelf_phdr.c ============================================================================== --- stable/7/lib/libelf/gelf_phdr.c Sat Sep 4 12:19:19 2010 (r212200) +++ stable/7/lib/libelf/gelf_phdr.c Sat Sep 4 12:19:25 2010 (r212201) @@ -155,6 +155,8 @@ gelf_update_phdr(Elf *e, int ndx, GElf_P return (0); } + (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { ph64 = e->e_u.e_elf.e_phdr.e_phdr64 + ndx; *ph64 = *s; @@ -172,7 +174,5 @@ gelf_update_phdr(Elf *e, int ndx, GElf_P LIBELF_COPY_U32(ph32, s, p_memsz); LIBELF_COPY_U32(ph32, s, p_align); - (void) elf_flagphdr(e, ELF_C_SET, ELF_F_DIRTY); - return (1); } Modified: stable/7/lib/libelf/gelf_shdr.c ============================================================================== --- stable/7/lib/libelf/gelf_shdr.c Sat Sep 4 12:19:19 2010 (r212200) +++ stable/7/lib/libelf/gelf_shdr.c Sat Sep 4 12:19:25 2010 (r212201) @@ -107,6 +107,8 @@ gelf_update_shdr(Elf_Scn *scn, GElf_Shdr return (0); } + (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); + if (ec == ELFCLASS64) { scn->s_shdr.s_shdr64 = *s; return (1); @@ -125,7 +127,5 @@ gelf_update_shdr(Elf_Scn *scn, GElf_Shdr LIBELF_COPY_U32(sh32, s, sh_addralign); LIBELF_COPY_U32(sh32, s, sh_entsize); - (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); - return (1); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 12:40:06 2010 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 C128510656AA; Sat, 4 Sep 2010 12:40:06 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A59988FC15; Sat, 4 Sep 2010 12:40:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84Ce6sn007707; Sat, 4 Sep 2010 12:40:06 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84Ce645007701; Sat, 4 Sep 2010 12:40:06 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041240.o84Ce645007701@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:40:06 +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: r212202 - stable/8/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 12:40:07 -0000 Author: kaiw Date: Sat Sep 4 12:40:06 2010 New Revision: 212202 URL: http://svn.freebsd.org/changeset/base/212202 Log: MFC r210329,r210330,r210347. r210329: Use to declare the prototype for ftruncate(). r210330: Allow an application that updates only the ELF Ehdr to work. r210347: Fix a memory leak. Modified: stable/8/lib/libelf/_libelf.h stable/8/lib/libelf/elf_begin.c stable/8/lib/libelf/elf_scn.c stable/8/lib/libelf/elf_update.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/_libelf.h ============================================================================== --- stable/8/lib/libelf/_libelf.h Sat Sep 4 12:19:25 2010 (r212201) +++ stable/8/lib/libelf/_libelf.h Sat Sep 4 12:40:06 2010 (r212202) @@ -176,6 +176,7 @@ void (*_libelf_get_translator(Elf_Type _ void *_libelf_getphdr(Elf *_e, int _elfclass); void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass); void _libelf_init_elf(Elf *_e, Elf_Kind _kind); +int _libelf_load_scn(Elf *e, void *ehdr); int _libelf_malign(Elf_Type _t, int _elfclass); size_t _libelf_msize(Elf_Type _t, int _elfclass, unsigned int _version); void *_libelf_newphdr(Elf *_e, int _elfclass, size_t _count); Modified: stable/8/lib/libelf/elf_begin.c ============================================================================== --- stable/8/lib/libelf/elf_begin.c Sat Sep 4 12:19:25 2010 (r212201) +++ stable/8/lib/libelf/elf_begin.c Sat Sep 4 12:40:06 2010 (r212202) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "_libelf.h" Modified: stable/8/lib/libelf/elf_scn.c ============================================================================== --- stable/8/lib/libelf/elf_scn.c Sat Sep 4 12:19:25 2010 (r212201) +++ stable/8/lib/libelf/elf_scn.c Sat Sep 4 12:40:06 2010 (r212202) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); /* * Load an ELF section table and create a list of Elf_Scn structures. */ -static int +int _libelf_load_scn(Elf *e, void *ehdr) { int ec, swapbytes; Modified: stable/8/lib/libelf/elf_update.c ============================================================================== --- stable/8/lib/libelf/elf_update.c Sat Sep 4 12:19:25 2010 (r212201) +++ stable/8/lib/libelf/elf_update.c Sat Sep 4 12:40:06 2010 (r212202) @@ -472,6 +472,11 @@ _libelf_resync_elf(Elf *e) * file. */ + if (e->e_cmd != ELF_C_WRITE && + (e->e_flags & LIBELF_F_SHDRS_LOADED) == 0 && + _libelf_load_scn(e, ehdr) == 0) + return ((off_t) -1); + if ((rc = _libelf_resync_sections(e, rc)) < 0) return ((off_t) -1); @@ -726,14 +731,9 @@ _libelf_write_elf(Elf *e, off_t newsize) assert(phoff % _libelf_falign(ELF_T_PHDR, ec) == 0); assert(fsz > 0); + src.d_buf = _libelf_getphdr(e, ec); src.d_version = dst.d_version = e->e_version; src.d_type = ELF_T_PHDR; - - if (ec == ELFCLASS32) - src.d_buf = e->e_u.e_elf.e_phdr.e_phdr32; - else - src.d_buf = e->e_u.e_elf.e_phdr.e_phdr64; - src.d_size = phnum * _libelf_msize(ELF_T_PHDR, ec, e->e_version); @@ -855,11 +855,13 @@ _libelf_write_elf(Elf *e, off_t newsize) e->e_u.e_elf.e_phdr.e_phdr64 = NULL; } + free(newfile); + return (rc); error: - if (newfile) - free(newfile); + free(newfile); + return ((off_t) -1); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 12:40:17 2010 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 341B110656C9; Sat, 4 Sep 2010 12:40:17 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 173B58FC14; Sat, 4 Sep 2010 12:40:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84CeGkF007758; Sat, 4 Sep 2010 12:40:16 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84CeGlg007753; Sat, 4 Sep 2010 12:40:16 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041240.o84CeGlg007753@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:40:16 +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: r212203 - stable/7/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 12:40:17 -0000 Author: kaiw Date: Sat Sep 4 12:40:16 2010 New Revision: 212203 URL: http://svn.freebsd.org/changeset/base/212203 Log: MFC r210329,r210330,r210347. r210329: Use to declare the prototype for ftruncate(). r210330: Allow an application that updates only the ELF Ehdr to work. r210347: Fix a memory leak. Modified: stable/7/lib/libelf/_libelf.h stable/7/lib/libelf/elf_begin.c stable/7/lib/libelf/elf_scn.c stable/7/lib/libelf/elf_update.c Directory Properties: stable/7/lib/libelf/ (props changed) Modified: stable/7/lib/libelf/_libelf.h ============================================================================== --- stable/7/lib/libelf/_libelf.h Sat Sep 4 12:40:06 2010 (r212202) +++ stable/7/lib/libelf/_libelf.h Sat Sep 4 12:40:16 2010 (r212203) @@ -176,6 +176,7 @@ void (*_libelf_get_translator(Elf_Type _ void *_libelf_getphdr(Elf *_e, int _elfclass); void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass); void _libelf_init_elf(Elf *_e, Elf_Kind _kind); +int _libelf_load_scn(Elf *e, void *ehdr); int _libelf_malign(Elf_Type _t, int _elfclass); size_t _libelf_msize(Elf_Type _t, int _elfclass, unsigned int _version); void *_libelf_newphdr(Elf *_e, int _elfclass, size_t _count); Modified: stable/7/lib/libelf/elf_begin.c ============================================================================== --- stable/7/lib/libelf/elf_begin.c Sat Sep 4 12:40:06 2010 (r212202) +++ stable/7/lib/libelf/elf_begin.c Sat Sep 4 12:40:16 2010 (r212203) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "_libelf.h" Modified: stable/7/lib/libelf/elf_scn.c ============================================================================== --- stable/7/lib/libelf/elf_scn.c Sat Sep 4 12:40:06 2010 (r212202) +++ stable/7/lib/libelf/elf_scn.c Sat Sep 4 12:40:16 2010 (r212203) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); /* * Load an ELF section table and create a list of Elf_Scn structures. */ -static int +int _libelf_load_scn(Elf *e, void *ehdr) { int ec, swapbytes; Modified: stable/7/lib/libelf/elf_update.c ============================================================================== --- stable/7/lib/libelf/elf_update.c Sat Sep 4 12:40:06 2010 (r212202) +++ stable/7/lib/libelf/elf_update.c Sat Sep 4 12:40:16 2010 (r212203) @@ -472,6 +472,11 @@ _libelf_resync_elf(Elf *e) * file. */ + if (e->e_cmd != ELF_C_WRITE && + (e->e_flags & LIBELF_F_SHDRS_LOADED) == 0 && + _libelf_load_scn(e, ehdr) == 0) + return ((off_t) -1); + if ((rc = _libelf_resync_sections(e, rc)) < 0) return ((off_t) -1); @@ -726,14 +731,9 @@ _libelf_write_elf(Elf *e, off_t newsize) assert(phoff % _libelf_falign(ELF_T_PHDR, ec) == 0); assert(fsz > 0); + src.d_buf = _libelf_getphdr(e, ec); src.d_version = dst.d_version = e->e_version; src.d_type = ELF_T_PHDR; - - if (ec == ELFCLASS32) - src.d_buf = e->e_u.e_elf.e_phdr.e_phdr32; - else - src.d_buf = e->e_u.e_elf.e_phdr.e_phdr64; - src.d_size = phnum * _libelf_msize(ELF_T_PHDR, ec, e->e_version); @@ -855,11 +855,13 @@ _libelf_write_elf(Elf *e, off_t newsize) e->e_u.e_elf.e_phdr.e_phdr64 = NULL; } + free(newfile); + return (rc); error: - if (newfile) - free(newfile); + free(newfile); + return ((off_t) -1); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 12:52:44 2010 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 B367010656C4; Sat, 4 Sep 2010 12:52:44 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F8378FC08; Sat, 4 Sep 2010 12:52:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84CqiGn008765; Sat, 4 Sep 2010 12:52:44 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84Cqit5008748; Sat, 4 Sep 2010 12:52:44 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041252.o84Cqit5008748@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:52:44 +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: r212204 - stable/8/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 12:52:44 -0000 Author: kaiw Date: Sat Sep 4 12:52:44 2010 New Revision: 212204 URL: http://svn.freebsd.org/changeset/base/212204 Log: MFC r210344,r210345,r210348. r210344: Avoid switching between "unsigned char" and "char" in the C code generated from "libelf_convert.m4". r210345: * Deprecate `elf_getshnum()`, `elf_getphnum()` and `elf_getshstrndx()` in favour of `elf_getshdrnum()`, `elf_getphdrnum()` and `elf_getshdrstrndx()` respectively. * Add new manual pages for `elf_getshdrstrndx()`, `elf_getphdrnum()` and `elf_getshdrnum()`. * Add a deprecation warning for `elf_getshstrndx()`, `elf_getphnum()` and `elf_getshnum()`. r210348: Move helper functions `_libelf_ar_get_{name,number,string}()` and `_libelf_ar_open()` to a new compilation unit "libelf_ar_util.c" to break the circular dependency between "elf_memory.o" and "libelf_ar.o". Added: stable/8/lib/libelf/elf_getphdrnum.3 - copied unchanged from r210345, head/lib/libelf/elf_getphdrnum.3 stable/8/lib/libelf/elf_getshdrnum.3 - copied unchanged from r210345, head/lib/libelf/elf_getshdrnum.3 stable/8/lib/libelf/elf_getshdrstrndx.3 - copied unchanged from r210345, head/lib/libelf/elf_getshdrstrndx.3 stable/8/lib/libelf/libelf_ar_util.c - copied unchanged from r210348, head/lib/libelf/libelf_ar_util.c Modified: stable/8/lib/libelf/Makefile stable/8/lib/libelf/Version.map stable/8/lib/libelf/_libelf.h stable/8/lib/libelf/elf_getphnum.3 stable/8/lib/libelf/elf_getshnum.3 stable/8/lib/libelf/elf_getshstrndx.3 stable/8/lib/libelf/elf_phnum.c stable/8/lib/libelf/elf_shnum.c stable/8/lib/libelf/elf_shstrndx.c stable/8/lib/libelf/libelf.h stable/8/lib/libelf/libelf_ar.c stable/8/lib/libelf/libelf_convert.m4 Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/Makefile ============================================================================== --- stable/8/lib/libelf/Makefile Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/Makefile Sat Sep 4 12:52:44 2010 (r212204) @@ -44,6 +44,7 @@ SRCS= elf_begin.c \ libelf_align.c \ libelf_allocate.c \ libelf_ar.c \ + libelf_ar_util.c \ libelf_checksum.c \ libelf_data.c \ libelf_ehdr.c \ @@ -65,7 +66,8 @@ WARNS?= 6 MAN= elf.3 \ elf_begin.3 \ elf_cntl.3 \ - elf_end.3 elf_errmsg.3 \ + elf_end.3 \ + elf_errmsg.3 \ elf_fill.3 \ elf_flagdata.3 \ elf_getarhdr.3 \ @@ -74,8 +76,11 @@ MAN= elf.3 \ elf_getdata.3 \ elf_getident.3 \ elf_getscn.3 \ + elf_getphdrnum.3 \ elf_getphnum.3 \ + elf_getshdrnum.3 \ elf_getshnum.3 \ + elf_getshdrstrndx.3 \ elf_getshstrndx.3 \ elf_hash.3 \ elf_kind.3 \ Modified: stable/8/lib/libelf/Version.map ============================================================================== --- stable/8/lib/libelf/Version.map Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/Version.map Sat Sep 4 12:52:44 2010 (r212204) @@ -39,8 +39,11 @@ global: elf_getdata; elf_getident; elf_getscn; + elf_getphdrnum; elf_getphnum; + elf_getshdrnum; elf_getshnum; + elf_getshdrstrndx; elf_getshstrndx; elf_hash; elf_kind; Modified: stable/8/lib/libelf/_libelf.h ============================================================================== --- stable/8/lib/libelf/_libelf.h Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/_libelf.h Sat Sep 4 12:52:44 2010 (r212204) @@ -165,6 +165,10 @@ Elf_Scn *_libelf_allocate_scn(Elf *_e, s Elf_Arhdr *_libelf_ar_gethdr(Elf *_e); Elf *_libelf_ar_open(Elf *_e); Elf *_libelf_ar_open_member(int _fd, Elf_Cmd _c, Elf *_ar); +int _libelf_ar_get_member(char *_s, size_t _sz, int _base, size_t *_ret); +char *_libelf_ar_get_string(const char *_buf, size_t _sz, int _rawname); +char *_libelf_ar_get_name(char *_buf, size_t _sz, Elf *_e); +int _libelf_ar_get_number(char *_buf, size_t _sz, int _base, size_t *_ret); Elf_Arsym *_libelf_ar_process_symtab(Elf *_ar, size_t *_dst); unsigned long _libelf_checksum(Elf *_e, int _elfclass); void *_libelf_ehdr(Elf *_e, int _elfclass, int _allocate); Copied: stable/8/lib/libelf/elf_getphdrnum.3 (from r210345, head/lib/libelf/elf_getphdrnum.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libelf/elf_getphdrnum.3 Sat Sep 4 12:52:44 2010 (r212204, copy of r210345, head/lib/libelf/elf_getphdrnum.3) @@ -0,0 +1,86 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. 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 Joseph Koshy ``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 Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 5, 2009 +.Os +.Dt ELF_GETPHDRNUM 3 +.Sh NAME +.Nm elf_getphdrnum +.Nd return the number of program headers in an ELF file +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getphdrnum "Elf *elf" "size_t *phnum" +.Sh DESCRIPTION +Function +.Fn elf_getphdrnum +retrieves the number of ELF program headers associated with descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar phnum . +.Pp +This routine allows applications to uniformly process both normal ELF +objects and ELF objects that use extended numbering. +.Pp +.Sh RETURN VALUES +Function +.Fn elf_getphdrnum +returns a zero value if successful, or -1 in case of an error. +.Sh ERRORS +Function +.Fn elf_getphnum +can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable Header. +.It Bq Er ELF_E_HEADER +The ELF Executable Header associated with argument +.Ar elf +was corrupt. +.It Bq Er ELF_E_SECTION +The section header at index +.Dv SHN_UNDEF +was corrupt. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getshdrnum 3 , +.Xr elf_getshdrstrndx 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Modified: stable/8/lib/libelf/elf_getphnum.3 ============================================================================== --- stable/8/lib/libelf/elf_getphnum.3 Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_getphnum.3 Sat Sep 4 12:52:44 2010 (r212204) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2006 +.Dd August 5, 2009 .Dt ELF_GETPHNUM 3 .Os .Sh NAME @@ -36,6 +36,11 @@ .Ft int .Fn elf_getphnum "Elf *elf" "size_t *phnum" .Sh DESCRIPTION +This function is deprecated. +Please use function +.Xr elf_getphdrnum 3 +instead. +.Pp Function .Fn elf_getphnum retrieves the number of ELF program headers associated with descriptor @@ -81,7 +86,8 @@ was corrupt. .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshnum 3 , -.Xr elf_getshstrndx 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , +.Xr elf_getshdrstrndx 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Copied: stable/8/lib/libelf/elf_getshdrnum.3 (from r210345, head/lib/libelf/elf_getshdrnum.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libelf/elf_getshdrnum.3 Sat Sep 4 12:52:44 2010 (r212204, copy of r210345, head/lib/libelf/elf_getshdrnum.3) @@ -0,0 +1,78 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. 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 Joseph Koshy ``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 Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 4, 2009 +.Os +.Dt ELF_GETSHDRNUM 3 +.Sh NAME +.Nm elf_getshdrnum +.Nd return the number of sections in an ELF file +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getshdrnum "Elf *elf" "size_t *shnum" +.Sh DESCRIPTION +Function +.Fn elf_getshdrnum +retrieves the number of ELF sections associated with descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar shnum . +.Pp +This routine allows applications to uniformly process both normal ELF +objects, and ELF objects that use extended section numbering. +.Pp +.Sh RETURN VALUES +Function +.Fn elf_getshdrnum +returns zero value if successful, or -1 in case of an error. +.Sh ERRORS +Function +.Fn elf_getshdrnum +can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable header. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrstrndx 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Copied: stable/8/lib/libelf/elf_getshdrstrndx.3 (from r210345, head/lib/libelf/elf_getshdrstrndx.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libelf/elf_getshdrstrndx.3 Sat Sep 4 12:52:44 2010 (r212204, copy of r210345, head/lib/libelf/elf_getshdrstrndx.3) @@ -0,0 +1,79 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. 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 Joseph Koshy ``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 Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 5, 2009 +.Os +.Dt ELF_GETSHDRSTRNDX 3 +.Sh NAME +.Nm elf_getshdrstrndx +.Nd retrieve the index of the section name string table +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getshdrstrndx "Elf *elf" "size_t *ndxptr" +.Sh DESCRIPTION +Function +.Fn elf_getshdrstrndx +retrieves the section index of the string table containing section +names from descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar ndxptr . +.Pp +This function allow applications to process both normal ELF +objects and ELF objects that use extended section numbering uniformly. +.Pp +.Sh RETURN VALUES +These functions return zero if successful, or -1 in case of an error. +.Sh ERRORS +These functions can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable header. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar ndx +contained a value in the reserved range of section indices. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Modified: stable/8/lib/libelf/elf_getshnum.3 ============================================================================== --- stable/8/lib/libelf/elf_getshnum.3 Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_getshnum.3 Sat Sep 4 12:52:44 2010 (r212204) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2006 +.Dd August 5, 2009 .Dt ELF_GETSHNUM 3 .Os .Sh NAME @@ -36,6 +36,11 @@ .Ft int .Fn elf_getshnum "Elf *elf" "size_t *shnum" .Sh DESCRIPTION +This function is deprecated. +Please use +.Xr elf_getshdrnum 3 +instead. +.Pp Function .Fn elf_getshnum retrieves the number of ELF sections associated with descriptor @@ -73,6 +78,7 @@ lacks an ELF Executable header. .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshstrndx 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrstrndx 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Modified: stable/8/lib/libelf/elf_getshstrndx.3 ============================================================================== --- stable/8/lib/libelf/elf_getshstrndx.3 Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_getshstrndx.3 Sat Sep 4 12:52:44 2010 (r212204) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2006 +.Dd August 5, 2009 .Dt ELF_GETSHSTRNDX 3 .Os .Sh NAME @@ -46,6 +46,12 @@ names from descriptor .Ar elf and stores it into the location pointed to by argument .Ar ndxptr . +Function +.Fn elf_getshstrndx +is deprecated. +Please use +.Xr elf_getshdrstrndx 3 +instead. .Pp Function .Fn elf_setshstrndx @@ -82,6 +88,7 @@ contained a value in the reserved range .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshnum 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Modified: stable/8/lib/libelf/elf_phnum.c ============================================================================== --- stable/8/lib/libelf/elf_phnum.c Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_phnum.c Sat Sep 4 12:52:44 2010 (r212204) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getphnum(Elf *e, size_t *phnum) +static int +_libelf_getphdrnum(Elf *e, size_t *phnum) { void *eh; int ec; @@ -41,13 +41,26 @@ elf_getphnum(Elf *e, size_t *phnum) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *phnum = e->e_u.e_elf.e_nphdr; - return (1); + return (0); +} + +int +elf_getphdrnum(Elf *e, size_t *phnum) +{ + return (_libelf_getphdrnum(e, phnum)); +} + +/* Deprecated API */ +int +elf_getphnum(Elf *e, size_t *phnum) +{ + return (_libelf_getphdrnum(e, phnum) >= 0); } Modified: stable/8/lib/libelf/elf_shnum.c ============================================================================== --- stable/8/lib/libelf/elf_shnum.c Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_shnum.c Sat Sep 4 12:52:44 2010 (r212204) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getshnum(Elf *e, size_t *shnum) +static int +_libelf_getshdrnum(Elf *e, size_t *shnum) { void *eh; int ec; @@ -41,13 +41,26 @@ elf_getshnum(Elf *e, size_t *shnum) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *shnum = e->e_u.e_elf.e_nscn; - return (1); + return (0); +} + +int +elf_getshdrnum(Elf *e, size_t *shnum) +{ + return (_libelf_getshdrnum(e, shnum)); +} + +/* Deprecated API. */ +int +elf_getshnum(Elf *e, size_t *shnum) +{ + return (_libelf_getshdrnum(e, shnum) >= 0); } Modified: stable/8/lib/libelf/elf_shstrndx.c ============================================================================== --- stable/8/lib/libelf/elf_shstrndx.c Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/elf_shstrndx.c Sat Sep 4 12:52:44 2010 (r212204) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getshstrndx(Elf *e, size_t *strndx) +static int +_libelf_getshdrstrndx(Elf *e, size_t *strndx) { void *eh; int ec; @@ -41,15 +41,27 @@ elf_getshstrndx(Elf *e, size_t *strndx) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *strndx = e->e_u.e_elf.e_strndx; - return (1); + return (0); +} + +int +elf_getshdrstrndx(Elf *e, size_t *strndx) +{ + return (_libelf_getshdrstrndx(e, strndx)); +} + +int +elf_getshstrndx(Elf *e, size_t *strndx) /* Deprecated API. */ +{ + return (_libelf_getshdrstrndx(e, strndx) >= 0); } int Modified: stable/8/lib/libelf/libelf.h ============================================================================== --- stable/8/lib/libelf/libelf.h Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/libelf.h Sat Sep 4 12:52:44 2010 (r212204) @@ -192,10 +192,13 @@ Elf_Arsym *elf_getarsym(Elf *_elf, size_ off_t elf_getbase(Elf *_elf); Elf_Data *elf_getdata(Elf_Scn *, Elf_Data *); char *elf_getident(Elf *_elf, size_t *_ptr); -int elf_getphnum(Elf *_elf, size_t *_dst); +int elf_getphdrnum(Elf *_elf, size_t *_dst); +int elf_getphnum(Elf *_elf, size_t *_dst); /* Deprecated */ Elf_Scn *elf_getscn(Elf *_elf, size_t _index); -int elf_getshnum(Elf *_elf, size_t *_dst); -int elf_getshstrndx(Elf *_elf, size_t *_dst); +int elf_getshdrnum(Elf *_elf, size_t *_dst); +int elf_getshnum(Elf *_elf, size_t *_dst); /* Deprecated */ +int elf_getshdrstrndx(Elf *_elf, size_t *_dst); +int elf_getshstrndx(Elf *_elf, size_t *_dst); /* Deprecated */ unsigned long elf_hash(const char *_name); Elf_Kind elf_kind(Elf *_elf); Elf *elf_memory(char *_image, size_t _size); Modified: stable/8/lib/libelf/libelf_ar.c ============================================================================== --- stable/8/lib/libelf/libelf_ar.c Sat Sep 4 12:40:16 2010 (r212203) +++ stable/8/lib/libelf/libelf_ar.c Sat Sep 4 12:52:44 2010 (r212204) @@ -72,145 +72,6 @@ __FBSDID("$FreeBSD$"); * they must be the very first objects and in that order. */ -/* - * Convert a string bounded by `start' and `start+sz' (exclusive) to a - * number in the specified base. - */ -static int -_libelf_ar_get_number(char *s, size_t sz, int base, size_t *ret) -{ - int c, v; - size_t r; - char *e; - - assert(base <= 10); - - e = s + sz; - - /* skip leading blanks */ - for (;s < e && (c = *s) == ' '; s++) - ; - - r = 0L; - for (;s < e; s++) { - if ((c = *s) == ' ') - break; - if (c < '0' || c > '9') - return (0); - v = c - '0'; - if (v >= base) /* Illegal digit. */ - break; - r *= base; - r += v; - } - - *ret = r; - - return (1); -} - -/* - * Retrieve a string from a name field. If `rawname' is set, leave - * ar(1) control characters in. - */ -static char * -_libelf_ar_get_string(const char *buf, size_t bufsize, int rawname) -{ - const char *q; - char *r; - size_t sz; - - if (rawname) - sz = bufsize + 1; - else { - /* Skip back over trailing blanks. */ - for (q = buf + bufsize - 1; q >= buf && *q == ' '; --q) - ; - - if (q < buf) { - /* - * If the input buffer only had blanks in it, - * return a zero-length string. - */ - buf = ""; - sz = 1; - } else { - /* - * Remove the trailing '/' character, but only - * if the name isn't one of the special names - * "/" and "//". - */ - if (q > buf + 1 || - (q == (buf + 1) && *buf != '/')) - q--; - - sz = q - buf + 2; /* Space for a trailing NUL. */ - } - } - - if ((r = malloc(sz)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - - (void) strncpy(r, buf, sz); - r[sz - 1] = '\0'; - - return (r); -} - -/* - * Retrieve the full name of the archive member. - */ -static char * -_libelf_ar_get_name(char *buf, size_t bufsize, Elf *e) -{ - char c, *q, *r, *s; - size_t len; - size_t offset; - - assert(e->e_kind == ELF_K_AR); - - if (buf[0] == '/' && (c = buf[1]) >= '0' && c <= '9') { - /* - * The value in field ar_name is a decimal offset into - * the archive string table where the actual name - * resides. - */ - if (_libelf_ar_get_number(buf + 1, bufsize - 1, 10, - &offset) == 0) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - if (offset > e->e_u.e_ar.e_rawstrtabsz) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - s = q = e->e_u.e_ar.e_rawstrtab + offset; - r = e->e_u.e_ar.e_rawstrtab + e->e_u.e_ar.e_rawstrtabsz; - - for (s = q; s < r && *s != '/'; s++) - ; - len = s - q + 1; /* space for the trailing NUL */ - - if ((s = malloc(len)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - - (void) strncpy(s, q, len); - s[len - 1] = '\0'; - - return (s); - } - - /* - * Normal 'name' - */ - return (_libelf_ar_get_string(buf, bufsize, 0)); -} Elf_Arhdr * @@ -323,79 +184,6 @@ _libelf_ar_open_member(int fd, Elf_Cmd c return (e); } -Elf * -_libelf_ar_open(Elf *e) -{ - int i; - char *s, *end; - size_t sz; - struct ar_hdr arh; - - e->e_kind = ELF_K_AR; - e->e_u.e_ar.e_nchildren = 0; - e->e_u.e_ar.e_next = (off_t) -1; - - /* - * Look for special members. - */ - - s = e->e_rawfile + SARMAG; - end = e->e_rawfile + e->e_rawsize; - - assert(e->e_rawsize > 0); - - /* - * Look for magic names "/ " and "// " in the first two entries - * of the archive. - */ - for (i = 0; i < 2; i++) { - - if (s + sizeof(arh) > end) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - (void) memcpy(&arh, s, sizeof(arh)); - - if (arh.ar_fmag[0] != '`' || arh.ar_fmag[1] != '\n') { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - if (arh.ar_name[0] != '/') /* not a special symbol */ - break; - - if (_libelf_ar_get_number(arh.ar_size, sizeof(arh.ar_size), 10, &sz) == 0) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - assert(sz > 0); - - s += sizeof(arh); - - if (arh.ar_name[1] == ' ') { /* "/ " => symbol table */ - - e->e_u.e_ar.e_rawsymtab = s; - e->e_u.e_ar.e_rawsymtabsz = sz; - - } else if (arh.ar_name[1] == '/' && arh.ar_name[2] == ' ') { - - /* "// " => string table for long file names */ - e->e_u.e_ar.e_rawstrtab = s; - e->e_u.e_ar.e_rawstrtabsz = sz; - } - - sz = LIBELF_ADJUST_AR_SIZE(sz); - - s += sz; - } - - e->e_u.e_ar.e_next = (off_t) (s - e->e_rawfile); - - return (e); -} - /* * An ar(1) symbol table has the following layout: * Copied: stable/8/lib/libelf/libelf_ar_util.c (from r210348, head/lib/libelf/libelf_ar_util.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libelf/libelf_ar_util.c Sat Sep 4 12:52:44 2010 (r212204, copy of r210348, head/lib/libelf/libelf_ar_util.c) @@ -0,0 +1,253 @@ +/*- + * Copyright (c) 2006,2009 Joseph Koshy + * 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 +#include + +#include "_libelf.h" + +/* + * Convert a string bounded by `start' and `start+sz' (exclusive) to a + * number in the specified base. + */ +int +_libelf_ar_get_number(char *s, size_t sz, int base, size_t *ret) +{ + int c, v; + size_t r; + char *e; + + assert(base <= 10); + + e = s + sz; + + /* skip leading blanks */ + for (;s < e && (c = *s) == ' '; s++) + ; + + r = 0L; + for (;s < e; s++) { + if ((c = *s) == ' ') + break; + if (c < '0' || c > '9') + return (0); + v = c - '0'; + if (v >= base) /* Illegal digit. */ + break; + r *= base; + r += v; + } + + *ret = r; + + return (1); +} + +/* + * Retrieve a string from a name field. If `rawname' is set, leave + * ar(1) control characters in. + */ +char * +_libelf_ar_get_string(const char *buf, size_t bufsize, int rawname) +{ + const char *q; + char *r; + size_t sz; + + if (rawname) + sz = bufsize + 1; + else { + /* Skip back over trailing blanks. */ + for (q = buf + bufsize - 1; q >= buf && *q == ' '; --q) + ; + + if (q < buf) { + /* + * If the input buffer only had blanks in it, + * return a zero-length string. + */ + buf = ""; + sz = 1; + } else { + /* + * Remove the trailing '/' character, but only + * if the name isn't one of the special names + * "/" and "//". + */ + if (q > buf + 1 || + (q == (buf + 1) && *buf != '/')) + q--; + + sz = q - buf + 2; /* Space for a trailing NUL. */ + } + } + + if ((r = malloc(sz)) == NULL) { + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + + (void) strncpy(r, buf, sz); + r[sz - 1] = '\0'; + + return (r); +} + +/* + * Retrieve the full name of the archive member. + */ +char * +_libelf_ar_get_name(char *buf, size_t bufsize, Elf *e) +{ + char c, *q, *r, *s; + size_t len; + size_t offset; + + assert(e->e_kind == ELF_K_AR); + + if (buf[0] == '/' && (c = buf[1]) >= '0' && c <= '9') { + /* + * The value in field ar_name is a decimal offset into + * the archive string table where the actual name + * resides. + */ + if (_libelf_ar_get_number(buf + 1, bufsize - 1, 10, + &offset) == 0) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); + } + + if (offset > e->e_u.e_ar.e_rawstrtabsz) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); + } + + s = q = e->e_u.e_ar.e_rawstrtab + offset; + r = e->e_u.e_ar.e_rawstrtab + e->e_u.e_ar.e_rawstrtabsz; + + for (s = q; s < r && *s != '/'; s++) + ; + len = s - q + 1; /* space for the trailing NUL */ + + if ((s = malloc(len)) == NULL) { + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + + (void) strncpy(s, q, len); + s[len - 1] = '\0'; + + return (s); + } + + /* + * Normal 'name' + */ + return (_libelf_ar_get_string(buf, bufsize, 0)); +} + +/* + * Open an 'ar' archive. + */ +Elf * +_libelf_ar_open(Elf *e) +{ + int i; + char *s, *end; + size_t sz; + struct ar_hdr arh; + + e->e_kind = ELF_K_AR; + e->e_u.e_ar.e_nchildren = 0; + e->e_u.e_ar.e_next = (off_t) -1; + + /* + * Look for special members. + */ + + s = e->e_rawfile + SARMAG; + end = e->e_rawfile + e->e_rawsize; + + assert(e->e_rawsize > 0); + + /* + * Look for magic names "/ " and "// " in the first two entries + * of the archive. + */ + for (i = 0; i < 2; i++) { + + if (s + sizeof(arh) > end) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 12:52:53 2010 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 C24B510656FB; Sat, 4 Sep 2010 12:52:51 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B68238FC18; Sat, 4 Sep 2010 12:52:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84CqpUc008824; Sat, 4 Sep 2010 12:52:51 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84Cqp9m008807; Sat, 4 Sep 2010 12:52:51 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041252.o84Cqp9m008807@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 12:52:51 +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: r212205 - stable/7/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 12:52:53 -0000 Author: kaiw Date: Sat Sep 4 12:52:51 2010 New Revision: 212205 URL: http://svn.freebsd.org/changeset/base/212205 Log: MFC r210344,r210345,r210348. r210344: Avoid switching between "unsigned char" and "char" in the C code generated from "libelf_convert.m4". r210345: * Deprecate `elf_getshnum()`, `elf_getphnum()` and `elf_getshstrndx()` in favour of `elf_getshdrnum()`, `elf_getphdrnum()` and `elf_getshdrstrndx()` respectively. * Add new manual pages for `elf_getshdrstrndx()`, `elf_getphdrnum()` and `elf_getshdrnum()`. * Add a deprecation warning for `elf_getshstrndx()`, `elf_getphnum()` and `elf_getshnum()`. r210348: Move helper functions `_libelf_ar_get_{name,number,string}()` and `_libelf_ar_open()` to a new compilation unit "libelf_ar_util.c" to break the circular dependency between "elf_memory.o" and "libelf_ar.o". Added: stable/7/lib/libelf/elf_getphdrnum.3 - copied unchanged from r210345, head/lib/libelf/elf_getphdrnum.3 stable/7/lib/libelf/elf_getshdrnum.3 - copied unchanged from r210345, head/lib/libelf/elf_getshdrnum.3 stable/7/lib/libelf/elf_getshdrstrndx.3 - copied unchanged from r210345, head/lib/libelf/elf_getshdrstrndx.3 stable/7/lib/libelf/libelf_ar_util.c - copied unchanged from r210348, head/lib/libelf/libelf_ar_util.c Modified: stable/7/lib/libelf/Makefile stable/7/lib/libelf/Version.map stable/7/lib/libelf/_libelf.h stable/7/lib/libelf/elf_getphnum.3 stable/7/lib/libelf/elf_getshnum.3 stable/7/lib/libelf/elf_getshstrndx.3 stable/7/lib/libelf/elf_phnum.c stable/7/lib/libelf/elf_shnum.c stable/7/lib/libelf/elf_shstrndx.c stable/7/lib/libelf/libelf.h stable/7/lib/libelf/libelf_ar.c stable/7/lib/libelf/libelf_convert.m4 Directory Properties: stable/7/lib/libelf/ (props changed) Modified: stable/7/lib/libelf/Makefile ============================================================================== --- stable/7/lib/libelf/Makefile Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/Makefile Sat Sep 4 12:52:51 2010 (r212205) @@ -44,6 +44,7 @@ SRCS= elf_begin.c \ libelf_align.c \ libelf_allocate.c \ libelf_ar.c \ + libelf_ar_util.c \ libelf_checksum.c \ libelf_data.c \ libelf_ehdr.c \ @@ -65,7 +66,8 @@ WARNS?= 6 MAN= elf.3 \ elf_begin.3 \ elf_cntl.3 \ - elf_end.3 elf_errmsg.3 \ + elf_end.3 \ + elf_errmsg.3 \ elf_fill.3 \ elf_flagdata.3 \ elf_getarhdr.3 \ @@ -74,8 +76,11 @@ MAN= elf.3 \ elf_getdata.3 \ elf_getident.3 \ elf_getscn.3 \ + elf_getphdrnum.3 \ elf_getphnum.3 \ + elf_getshdrnum.3 \ elf_getshnum.3 \ + elf_getshdrstrndx.3 \ elf_getshstrndx.3 \ elf_hash.3 \ elf_kind.3 \ Modified: stable/7/lib/libelf/Version.map ============================================================================== --- stable/7/lib/libelf/Version.map Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/Version.map Sat Sep 4 12:52:51 2010 (r212205) @@ -39,8 +39,11 @@ global: elf_getdata; elf_getident; elf_getscn; + elf_getphdrnum; elf_getphnum; + elf_getshdrnum; elf_getshnum; + elf_getshdrstrndx; elf_getshstrndx; elf_hash; elf_kind; Modified: stable/7/lib/libelf/_libelf.h ============================================================================== --- stable/7/lib/libelf/_libelf.h Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/_libelf.h Sat Sep 4 12:52:51 2010 (r212205) @@ -165,6 +165,10 @@ Elf_Scn *_libelf_allocate_scn(Elf *_e, s Elf_Arhdr *_libelf_ar_gethdr(Elf *_e); Elf *_libelf_ar_open(Elf *_e); Elf *_libelf_ar_open_member(int _fd, Elf_Cmd _c, Elf *_ar); +int _libelf_ar_get_member(char *_s, size_t _sz, int _base, size_t *_ret); +char *_libelf_ar_get_string(const char *_buf, size_t _sz, int _rawname); +char *_libelf_ar_get_name(char *_buf, size_t _sz, Elf *_e); +int _libelf_ar_get_number(char *_buf, size_t _sz, int _base, size_t *_ret); Elf_Arsym *_libelf_ar_process_symtab(Elf *_ar, size_t *_dst); unsigned long _libelf_checksum(Elf *_e, int _elfclass); void *_libelf_ehdr(Elf *_e, int _elfclass, int _allocate); Copied: stable/7/lib/libelf/elf_getphdrnum.3 (from r210345, head/lib/libelf/elf_getphdrnum.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libelf/elf_getphdrnum.3 Sat Sep 4 12:52:51 2010 (r212205, copy of r210345, head/lib/libelf/elf_getphdrnum.3) @@ -0,0 +1,86 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. 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 Joseph Koshy ``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 Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 5, 2009 +.Os +.Dt ELF_GETPHDRNUM 3 +.Sh NAME +.Nm elf_getphdrnum +.Nd return the number of program headers in an ELF file +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getphdrnum "Elf *elf" "size_t *phnum" +.Sh DESCRIPTION +Function +.Fn elf_getphdrnum +retrieves the number of ELF program headers associated with descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar phnum . +.Pp +This routine allows applications to uniformly process both normal ELF +objects and ELF objects that use extended numbering. +.Pp +.Sh RETURN VALUES +Function +.Fn elf_getphdrnum +returns a zero value if successful, or -1 in case of an error. +.Sh ERRORS +Function +.Fn elf_getphnum +can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable Header. +.It Bq Er ELF_E_HEADER +The ELF Executable Header associated with argument +.Ar elf +was corrupt. +.It Bq Er ELF_E_SECTION +The section header at index +.Dv SHN_UNDEF +was corrupt. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getshdrnum 3 , +.Xr elf_getshdrstrndx 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Modified: stable/7/lib/libelf/elf_getphnum.3 ============================================================================== --- stable/7/lib/libelf/elf_getphnum.3 Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/elf_getphnum.3 Sat Sep 4 12:52:51 2010 (r212205) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2006 +.Dd August 5, 2009 .Os .Dt ELF_GETPHNUM 3 .Sh NAME @@ -36,6 +36,11 @@ .Ft int .Fn elf_getphnum "Elf *elf" "size_t *phnum" .Sh DESCRIPTION +This function is deprecated. +Please use function +.Xr elf_getphdrnum 3 +instead. +.Pp Function .Fn elf_getphnum retrieves the number of ELF program headers associated with descriptor @@ -81,7 +86,8 @@ was corrupt. .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshnum 3 , -.Xr elf_getshstrndx 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , +.Xr elf_getshdrstrndx 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Copied: stable/7/lib/libelf/elf_getshdrnum.3 (from r210345, head/lib/libelf/elf_getshdrnum.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libelf/elf_getshdrnum.3 Sat Sep 4 12:52:51 2010 (r212205, copy of r210345, head/lib/libelf/elf_getshdrnum.3) @@ -0,0 +1,78 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. 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 Joseph Koshy ``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 Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 4, 2009 +.Os +.Dt ELF_GETSHDRNUM 3 +.Sh NAME +.Nm elf_getshdrnum +.Nd return the number of sections in an ELF file +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getshdrnum "Elf *elf" "size_t *shnum" +.Sh DESCRIPTION +Function +.Fn elf_getshdrnum +retrieves the number of ELF sections associated with descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar shnum . +.Pp +This routine allows applications to uniformly process both normal ELF +objects, and ELF objects that use extended section numbering. +.Pp +.Sh RETURN VALUES +Function +.Fn elf_getshdrnum +returns zero value if successful, or -1 in case of an error. +.Sh ERRORS +Function +.Fn elf_getshdrnum +can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable header. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrstrndx 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Copied: stable/7/lib/libelf/elf_getshdrstrndx.3 (from r210345, head/lib/libelf/elf_getshdrstrndx.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libelf/elf_getshdrstrndx.3 Sat Sep 4 12:52:51 2010 (r212205, copy of r210345, head/lib/libelf/elf_getshdrstrndx.3) @@ -0,0 +1,79 @@ +.\" Copyright (c) 2006,2008 Joseph Koshy. 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 Joseph Koshy ``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 Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $FreeBSD$ +.\" +.Dd August 5, 2009 +.Os +.Dt ELF_GETSHDRSTRNDX 3 +.Sh NAME +.Nm elf_getshdrstrndx +.Nd retrieve the index of the section name string table +.Sh LIBRARY +.Lb libelf +.Sh SYNOPSIS +.In libelf.h +.Ft int +.Fn elf_getshdrstrndx "Elf *elf" "size_t *ndxptr" +.Sh DESCRIPTION +Function +.Fn elf_getshdrstrndx +retrieves the section index of the string table containing section +names from descriptor +.Ar elf +and stores it into the location pointed to by argument +.Ar ndxptr . +.Pp +This function allow applications to process both normal ELF +objects and ELF objects that use extended section numbering uniformly. +.Pp +.Sh RETURN VALUES +These functions return zero if successful, or -1 in case of an error. +.Sh ERRORS +These functions can fail with the following errors: +.Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARGUMENT +A NULL value was passed in for argument +.Ar elf . +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +was not for an ELF file. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar elf +lacks an ELF Executable header. +.It Bq Er ELF_E_ARGUMENT +Argument +.Ar ndx +contained a value in the reserved range of section indices. +.El +.Sh SEE ALSO +.Xr elf 3 , +.Xr elf32_getehdr 3 , +.Xr elf64_getehdr 3 , +.Xr elf_getident 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , +.Xr gelf 3 , +.Xr gelf_getehdr 3 Modified: stable/7/lib/libelf/elf_getshnum.3 ============================================================================== --- stable/7/lib/libelf/elf_getshnum.3 Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/elf_getshnum.3 Sat Sep 4 12:52:51 2010 (r212205) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2006 +.Dd August 5, 2009 .Os .Dt ELF_GETSHNUM 3 .Sh NAME @@ -36,6 +36,11 @@ .Ft int .Fn elf_getshnum "Elf *elf" "size_t *shnum" .Sh DESCRIPTION +This function is deprecated. +Please use +.Xr elf_getshdrnum 3 +instead. +.Pp Function .Fn elf_getshnum retrieves the number of ELF sections associated with descriptor @@ -73,6 +78,7 @@ lacks an ELF Executable header. .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshstrndx 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrstrndx 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Modified: stable/7/lib/libelf/elf_getshstrndx.3 ============================================================================== --- stable/7/lib/libelf/elf_getshstrndx.3 Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/elf_getshstrndx.3 Sat Sep 4 12:52:51 2010 (r212205) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2006 +.Dd August 5, 2009 .Os .Dt ELF_GETSHSTRNDX 3 .Sh NAME @@ -46,6 +46,12 @@ names from descriptor .Ar elf and stores it into the location pointed to by argument .Ar ndxptr . +Function +.Fn elf_getshstrndx +is deprecated. +Please use +.Xr elf_getshdrstrndx 3 +instead. .Pp Function .Fn elf_setshstrndx @@ -82,6 +88,7 @@ contained a value in the reserved range .Xr elf32_getehdr 3 , .Xr elf64_getehdr 3 , .Xr elf_getident 3 , -.Xr elf_getshnum 3 , +.Xr elf_getphdrnum 3 , +.Xr elf_getshdrnum 3 , .Xr gelf 3 , .Xr gelf_getehdr 3 Modified: stable/7/lib/libelf/elf_phnum.c ============================================================================== --- stable/7/lib/libelf/elf_phnum.c Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/elf_phnum.c Sat Sep 4 12:52:51 2010 (r212205) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getphnum(Elf *e, size_t *phnum) +static int +_libelf_getphdrnum(Elf *e, size_t *phnum) { void *eh; int ec; @@ -41,13 +41,26 @@ elf_getphnum(Elf *e, size_t *phnum) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *phnum = e->e_u.e_elf.e_nphdr; - return (1); + return (0); +} + +int +elf_getphdrnum(Elf *e, size_t *phnum) +{ + return (_libelf_getphdrnum(e, phnum)); +} + +/* Deprecated API */ +int +elf_getphnum(Elf *e, size_t *phnum) +{ + return (_libelf_getphdrnum(e, phnum) >= 0); } Modified: stable/7/lib/libelf/elf_shnum.c ============================================================================== --- stable/7/lib/libelf/elf_shnum.c Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/elf_shnum.c Sat Sep 4 12:52:51 2010 (r212205) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getshnum(Elf *e, size_t *shnum) +static int +_libelf_getshdrnum(Elf *e, size_t *shnum) { void *eh; int ec; @@ -41,13 +41,26 @@ elf_getshnum(Elf *e, size_t *shnum) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *shnum = e->e_u.e_elf.e_nscn; - return (1); + return (0); +} + +int +elf_getshdrnum(Elf *e, size_t *shnum) +{ + return (_libelf_getshdrnum(e, shnum)); +} + +/* Deprecated API. */ +int +elf_getshnum(Elf *e, size_t *shnum) +{ + return (_libelf_getshdrnum(e, shnum) >= 0); } Modified: stable/7/lib/libelf/elf_shstrndx.c ============================================================================== --- stable/7/lib/libelf/elf_shstrndx.c Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/elf_shstrndx.c Sat Sep 4 12:52:51 2010 (r212205) @@ -32,8 +32,8 @@ __FBSDID("$FreeBSD$"); #include "_libelf.h" -int -elf_getshstrndx(Elf *e, size_t *strndx) +static int +_libelf_getshdrstrndx(Elf *e, size_t *strndx) { void *eh; int ec; @@ -41,15 +41,27 @@ elf_getshstrndx(Elf *e, size_t *strndx) if (e == NULL || e->e_kind != ELF_K_ELF || ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { LIBELF_SET_ERROR(ARGUMENT, 0); - return (0); + return (-1); } if ((eh = _libelf_ehdr(e, ec, 0)) == NULL) - return (0); + return (-1); *strndx = e->e_u.e_elf.e_strndx; - return (1); + return (0); +} + +int +elf_getshdrstrndx(Elf *e, size_t *strndx) +{ + return (_libelf_getshdrstrndx(e, strndx)); +} + +int +elf_getshstrndx(Elf *e, size_t *strndx) /* Deprecated API. */ +{ + return (_libelf_getshdrstrndx(e, strndx) >= 0); } int Modified: stable/7/lib/libelf/libelf.h ============================================================================== --- stable/7/lib/libelf/libelf.h Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/libelf.h Sat Sep 4 12:52:51 2010 (r212205) @@ -192,10 +192,13 @@ Elf_Arsym *elf_getarsym(Elf *_elf, size_ off_t elf_getbase(Elf *_elf); Elf_Data *elf_getdata(Elf_Scn *, Elf_Data *); char *elf_getident(Elf *_elf, size_t *_ptr); -int elf_getphnum(Elf *_elf, size_t *_dst); +int elf_getphdrnum(Elf *_elf, size_t *_dst); +int elf_getphnum(Elf *_elf, size_t *_dst); /* Deprecated */ Elf_Scn *elf_getscn(Elf *_elf, size_t _index); -int elf_getshnum(Elf *_elf, size_t *_dst); -int elf_getshstrndx(Elf *_elf, size_t *_dst); +int elf_getshdrnum(Elf *_elf, size_t *_dst); +int elf_getshnum(Elf *_elf, size_t *_dst); /* Deprecated */ +int elf_getshdrstrndx(Elf *_elf, size_t *_dst); +int elf_getshstrndx(Elf *_elf, size_t *_dst); /* Deprecated */ unsigned long elf_hash(const char *_name); Elf_Kind elf_kind(Elf *_elf); Elf *elf_memory(char *_image, size_t _size); Modified: stable/7/lib/libelf/libelf_ar.c ============================================================================== --- stable/7/lib/libelf/libelf_ar.c Sat Sep 4 12:52:44 2010 (r212204) +++ stable/7/lib/libelf/libelf_ar.c Sat Sep 4 12:52:51 2010 (r212205) @@ -72,145 +72,6 @@ __FBSDID("$FreeBSD$"); * they must be the very first objects and in that order. */ -/* - * Convert a string bounded by `start' and `start+sz' (exclusive) to a - * number in the specified base. - */ -static int -_libelf_ar_get_number(char *s, size_t sz, int base, size_t *ret) -{ - int c, v; - size_t r; - char *e; - - assert(base <= 10); - - e = s + sz; - - /* skip leading blanks */ - for (;s < e && (c = *s) == ' '; s++) - ; - - r = 0L; - for (;s < e; s++) { - if ((c = *s) == ' ') - break; - if (c < '0' || c > '9') - return (0); - v = c - '0'; - if (v >= base) /* Illegal digit. */ - break; - r *= base; - r += v; - } - - *ret = r; - - return (1); -} - -/* - * Retrieve a string from a name field. If `rawname' is set, leave - * ar(1) control characters in. - */ -static char * -_libelf_ar_get_string(const char *buf, size_t bufsize, int rawname) -{ - const char *q; - char *r; - size_t sz; - - if (rawname) - sz = bufsize + 1; - else { - /* Skip back over trailing blanks. */ - for (q = buf + bufsize - 1; q >= buf && *q == ' '; --q) - ; - - if (q < buf) { - /* - * If the input buffer only had blanks in it, - * return a zero-length string. - */ - buf = ""; - sz = 1; - } else { - /* - * Remove the trailing '/' character, but only - * if the name isn't one of the special names - * "/" and "//". - */ - if (q > buf + 1 || - (q == (buf + 1) && *buf != '/')) - q--; - - sz = q - buf + 2; /* Space for a trailing NUL. */ - } - } - - if ((r = malloc(sz)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - - (void) strncpy(r, buf, sz); - r[sz - 1] = '\0'; - - return (r); -} - -/* - * Retrieve the full name of the archive member. - */ -static char * -_libelf_ar_get_name(char *buf, size_t bufsize, Elf *e) -{ - char c, *q, *r, *s; - size_t len; - size_t offset; - - assert(e->e_kind == ELF_K_AR); - - if (buf[0] == '/' && (c = buf[1]) >= '0' && c <= '9') { - /* - * The value in field ar_name is a decimal offset into - * the archive string table where the actual name - * resides. - */ - if (_libelf_ar_get_number(buf + 1, bufsize - 1, 10, - &offset) == 0) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - if (offset > e->e_u.e_ar.e_rawstrtabsz) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - s = q = e->e_u.e_ar.e_rawstrtab + offset; - r = e->e_u.e_ar.e_rawstrtab + e->e_u.e_ar.e_rawstrtabsz; - - for (s = q; s < r && *s != '/'; s++) - ; - len = s - q + 1; /* space for the trailing NUL */ - - if ((s = malloc(len)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - - (void) strncpy(s, q, len); - s[len - 1] = '\0'; - - return (s); - } - - /* - * Normal 'name' - */ - return (_libelf_ar_get_string(buf, bufsize, 0)); -} Elf_Arhdr * @@ -323,79 +184,6 @@ _libelf_ar_open_member(int fd, Elf_Cmd c return (e); } -Elf * -_libelf_ar_open(Elf *e) -{ - int i; - char *s, *end; - size_t sz; - struct ar_hdr arh; - - e->e_kind = ELF_K_AR; - e->e_u.e_ar.e_nchildren = 0; - e->e_u.e_ar.e_next = (off_t) -1; - - /* - * Look for special members. - */ - - s = e->e_rawfile + SARMAG; - end = e->e_rawfile + e->e_rawsize; - - assert(e->e_rawsize > 0); - - /* - * Look for magic names "/ " and "// " in the first two entries - * of the archive. - */ - for (i = 0; i < 2; i++) { - - if (s + sizeof(arh) > end) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - (void) memcpy(&arh, s, sizeof(arh)); - - if (arh.ar_fmag[0] != '`' || arh.ar_fmag[1] != '\n') { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - if (arh.ar_name[0] != '/') /* not a special symbol */ - break; - - if (_libelf_ar_get_number(arh.ar_size, sizeof(arh.ar_size), 10, &sz) == 0) { - LIBELF_SET_ERROR(ARCHIVE, 0); - return (NULL); - } - - assert(sz > 0); - - s += sizeof(arh); - - if (arh.ar_name[1] == ' ') { /* "/ " => symbol table */ - - e->e_u.e_ar.e_rawsymtab = s; - e->e_u.e_ar.e_rawsymtabsz = sz; - - } else if (arh.ar_name[1] == '/' && arh.ar_name[2] == ' ') { - - /* "// " => string table for long file names */ - e->e_u.e_ar.e_rawstrtab = s; - e->e_u.e_ar.e_rawstrtabsz = sz; - } - - sz = LIBELF_ADJUST_AR_SIZE(sz); - - s += sz; - } - - e->e_u.e_ar.e_next = (off_t) (s - e->e_rawfile); - - return (e); -} - /* * An ar(1) symbol table has the following layout: * Copied: stable/7/lib/libelf/libelf_ar_util.c (from r210348, head/lib/libelf/libelf_ar_util.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/lib/libelf/libelf_ar_util.c Sat Sep 4 12:52:51 2010 (r212205, copy of r210348, head/lib/libelf/libelf_ar_util.c) @@ -0,0 +1,253 @@ +/*- + * Copyright (c) 2006,2009 Joseph Koshy + * 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 +#include + +#include "_libelf.h" + +/* + * Convert a string bounded by `start' and `start+sz' (exclusive) to a + * number in the specified base. + */ +int +_libelf_ar_get_number(char *s, size_t sz, int base, size_t *ret) +{ + int c, v; + size_t r; + char *e; + + assert(base <= 10); + + e = s + sz; + + /* skip leading blanks */ + for (;s < e && (c = *s) == ' '; s++) + ; + + r = 0L; + for (;s < e; s++) { + if ((c = *s) == ' ') + break; + if (c < '0' || c > '9') + return (0); + v = c - '0'; + if (v >= base) /* Illegal digit. */ + break; + r *= base; + r += v; + } + + *ret = r; + + return (1); +} + +/* + * Retrieve a string from a name field. If `rawname' is set, leave + * ar(1) control characters in. + */ +char * +_libelf_ar_get_string(const char *buf, size_t bufsize, int rawname) +{ + const char *q; + char *r; + size_t sz; + + if (rawname) + sz = bufsize + 1; + else { + /* Skip back over trailing blanks. */ + for (q = buf + bufsize - 1; q >= buf && *q == ' '; --q) + ; + + if (q < buf) { + /* + * If the input buffer only had blanks in it, + * return a zero-length string. + */ + buf = ""; + sz = 1; + } else { + /* + * Remove the trailing '/' character, but only + * if the name isn't one of the special names + * "/" and "//". + */ + if (q > buf + 1 || + (q == (buf + 1) && *buf != '/')) + q--; + + sz = q - buf + 2; /* Space for a trailing NUL. */ + } + } + + if ((r = malloc(sz)) == NULL) { + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + + (void) strncpy(r, buf, sz); + r[sz - 1] = '\0'; + + return (r); +} + +/* + * Retrieve the full name of the archive member. + */ +char * +_libelf_ar_get_name(char *buf, size_t bufsize, Elf *e) +{ + char c, *q, *r, *s; + size_t len; + size_t offset; + + assert(e->e_kind == ELF_K_AR); + + if (buf[0] == '/' && (c = buf[1]) >= '0' && c <= '9') { + /* + * The value in field ar_name is a decimal offset into + * the archive string table where the actual name + * resides. + */ + if (_libelf_ar_get_number(buf + 1, bufsize - 1, 10, + &offset) == 0) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); + } + + if (offset > e->e_u.e_ar.e_rawstrtabsz) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); + } + + s = q = e->e_u.e_ar.e_rawstrtab + offset; + r = e->e_u.e_ar.e_rawstrtab + e->e_u.e_ar.e_rawstrtabsz; + + for (s = q; s < r && *s != '/'; s++) + ; + len = s - q + 1; /* space for the trailing NUL */ + + if ((s = malloc(len)) == NULL) { + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + + (void) strncpy(s, q, len); + s[len - 1] = '\0'; + + return (s); + } + + /* + * Normal 'name' + */ + return (_libelf_ar_get_string(buf, bufsize, 0)); +} + +/* + * Open an 'ar' archive. + */ +Elf * +_libelf_ar_open(Elf *e) +{ + int i; + char *s, *end; + size_t sz; + struct ar_hdr arh; + + e->e_kind = ELF_K_AR; + e->e_u.e_ar.e_nchildren = 0; + e->e_u.e_ar.e_next = (off_t) -1; + + /* + * Look for special members. + */ + + s = e->e_rawfile + SARMAG; + end = e->e_rawfile + e->e_rawsize; + + assert(e->e_rawsize > 0); + + /* + * Look for magic names "/ " and "// " in the first two entries + * of the archive. + */ + for (i = 0; i < 2; i++) { + + if (s + sizeof(arh) > end) { + LIBELF_SET_ERROR(ARCHIVE, 0); + return (NULL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 13:00:22 2010 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 A5EF210656B2; Sat, 4 Sep 2010 13:00:22 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 944288FC1E; Sat, 4 Sep 2010 13:00:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84D0M9D009608; Sat, 4 Sep 2010 13:00:22 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84D0Ms7009603; Sat, 4 Sep 2010 13:00:22 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041300.o84D0Ms7009603@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 13:00: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: r212206 - stable/8/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 13:00:22 -0000 Author: kaiw Date: Sat Sep 4 13:00:22 2010 New Revision: 212206 URL: http://svn.freebsd.org/changeset/base/212206 Log: MFC r210351-r210353,r211192. r210351: * Note that ar(1) archives may also be opened using `elf_memory(3)`. * Ignore the passed in value of the `fd` argument for ar(1) archives opened with elf_memory(3). r210352: Add a cross-reference to `elf_rawfile(3)`. r210353: * Remove a superfluous error description. * Document an additional error that may be returned: `ELF_E_ARCHIVE`. r211192: Add translation support for section type SHT_SUNW_dof. Modified: stable/8/lib/libelf/elf_begin.3 stable/8/lib/libelf/elf_begin.c stable/8/lib/libelf/elf_getdata.3 stable/8/lib/libelf/libelf_data.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_begin.3 ============================================================================== --- stable/8/lib/libelf/elf_begin.3 Sat Sep 4 12:52:51 2010 (r212205) +++ stable/8/lib/libelf/elf_begin.3 Sat Sep 4 13:00:22 2010 (r212206) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2006 +.Dd June 20, 2010 .Dt ELF_BEGIN 3 .Os .Sh NAME @@ -163,7 +163,9 @@ archive may be opened in read mode (with set to .Dv ELF_C_READ ) using -.Fn elf_begin . +.Fn elf_begin +or +.Fn elf_memory . The returned ELF descriptor can be passed into to subsequent calls to .Fn elf_begin @@ -222,6 +224,10 @@ Function can fail with the following errors: .Pp .Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARCHIVE +The archive denoted by argument +.Ar elf +could not be parsed. .It Bq Er ELF_E_ARGUMENT An unrecognized value was specified in argument .Ar cmd . @@ -245,12 +251,6 @@ differs from the value specified when EL .Ar elf was created. .It Bq Er ELF_E_ARGUMENT -Argument -.Ar elf -was not a descriptor for an -.Xr ar 1 -archive. -.It Bq Er ELF_E_ARGUMENT An .Xr ar 1 archive was opened with with Modified: stable/8/lib/libelf/elf_begin.c ============================================================================== --- stable/8/lib/libelf/elf_begin.c Sat Sep 4 12:52:51 2010 (r212205) +++ stable/8/lib/libelf/elf_begin.c Sat Sep 4 13:00:22 2010 (r212206) @@ -131,13 +131,15 @@ elf_begin(int fd, Elf_Cmd c, Elf *a) case ELF_C_READ: /* * Descriptor `a' could be for a regular ELF file, or - * for an ar(1) archive. + * for an ar(1) archive. If descriptor `a' was opened + * using a valid file descriptor, we need to check if + * the passed in `fd' value matches the original one. */ - if (a && (a->e_fd != fd || c != a->e_cmd)) { + if (a && + ((a->e_fd != -1 && a->e_fd != fd) || c != a->e_cmd)) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } - break; default: @@ -149,7 +151,7 @@ elf_begin(int fd, Elf_Cmd c, Elf *a) if (a == NULL) e = _libelf_open_object(fd, c); else if (a->e_kind == ELF_K_AR) - e = _libelf_ar_open_member(fd, c, a); + e = _libelf_ar_open_member(a->e_fd, c, a); else (e = a)->e_activations++; Modified: stable/8/lib/libelf/elf_getdata.3 ============================================================================== --- stable/8/lib/libelf/elf_getdata.3 Sat Sep 4 12:52:51 2010 (r212205) +++ stable/8/lib/libelf/elf_getdata.3 Sat Sep 4 13:00:22 2010 (r212206) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008,2010 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 26, 2006 +.Dd April 30, 2010 .Dt ELF_GETDATA 3 .Os .Sh NAME @@ -193,6 +193,7 @@ An out of memory condition was detected. .Xr elf_getscn 3 , .Xr elf_getshdr 3 , .Xr elf_newscn 3 , +.Xr elf_rawfile 3 , .Xr elf_update 3 , .Xr elf_version 3 , .Xr gelf 3 Modified: stable/8/lib/libelf/libelf_data.c ============================================================================== --- stable/8/lib/libelf/libelf_data.c Sat Sep 4 12:52:51 2010 (r212205) +++ stable/8/lib/libelf/libelf_data.c Sat Sep 4 13:00:22 2010 (r212206) @@ -77,6 +77,8 @@ _libelf_xlate_shtype(uint32_t sht) return (ELF_T_MOVE); case SHT_SUNW_syminfo: return (ELF_T_SYMINFO); + case SHT_SUNW_dof: + return (ELF_T_BYTE); #endif case SHT_AMD64_UNWIND: /* == SHT_IA_64_UNWIND */ return (ELF_T_BYTE); From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 13:00:29 2010 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 BF32510657AE; Sat, 4 Sep 2010 13:00:28 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C82098FC19; Sat, 4 Sep 2010 13:00:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84D0SLt009656; Sat, 4 Sep 2010 13:00:28 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84D0SlL009651; Sat, 4 Sep 2010 13:00:28 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041300.o84D0SlL009651@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 13:00:28 +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: r212207 - stable/7/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 13:00:30 -0000 Author: kaiw Date: Sat Sep 4 13:00:28 2010 New Revision: 212207 URL: http://svn.freebsd.org/changeset/base/212207 Log: MFC r210351-r210353,r211192. r210351: * Note that ar(1) archives may also be opened using `elf_memory(3)`. * Ignore the passed in value of the `fd` argument for ar(1) archives opened with elf_memory(3). r210352: Add a cross-reference to `elf_rawfile(3)`. r210353: * Remove a superfluous error description. * Document an additional error that may be returned: `ELF_E_ARCHIVE`. r211192: Add translation support for section type SHT_SUNW_dof. Modified: stable/7/lib/libelf/elf_begin.3 stable/7/lib/libelf/elf_begin.c stable/7/lib/libelf/elf_getdata.3 stable/7/lib/libelf/libelf_data.c Directory Properties: stable/7/lib/libelf/ (props changed) Modified: stable/7/lib/libelf/elf_begin.3 ============================================================================== --- stable/7/lib/libelf/elf_begin.3 Sat Sep 4 13:00:22 2010 (r212206) +++ stable/7/lib/libelf/elf_begin.3 Sat Sep 4 13:00:28 2010 (r212207) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2006 +.Dd June 20, 2010 .Os .Dt ELF_BEGIN 3 .Sh NAME @@ -163,7 +163,9 @@ archive may be opened in read mode (with set to .Dv ELF_C_READ ) using -.Fn elf_begin . +.Fn elf_begin +or +.Fn elf_memory . The returned ELF descriptor can be passed into to subsequent calls to .Fn elf_begin @@ -222,6 +224,10 @@ Function can fail with the following errors: .Pp .Bl -tag -width "[ELF_E_RESOURCE]" +.It Bq Er ELF_E_ARCHIVE +The archive denoted by argument +.Ar elf +could not be parsed. .It Bq Er ELF_E_ARGUMENT An unrecognized value was specified in argument .Ar cmd . @@ -245,12 +251,6 @@ differs from the value specified when EL .Ar elf was created. .It Bq Er ELF_E_ARGUMENT -Argument -.Ar elf -was not a descriptor for an -.Xr ar 1 -archive. -.It Bq Er ELF_E_ARGUMENT An .Xr ar 1 archive was opened with with Modified: stable/7/lib/libelf/elf_begin.c ============================================================================== --- stable/7/lib/libelf/elf_begin.c Sat Sep 4 13:00:22 2010 (r212206) +++ stable/7/lib/libelf/elf_begin.c Sat Sep 4 13:00:28 2010 (r212207) @@ -131,13 +131,15 @@ elf_begin(int fd, Elf_Cmd c, Elf *a) case ELF_C_READ: /* * Descriptor `a' could be for a regular ELF file, or - * for an ar(1) archive. + * for an ar(1) archive. If descriptor `a' was opened + * using a valid file descriptor, we need to check if + * the passed in `fd' value matches the original one. */ - if (a && (a->e_fd != fd || c != a->e_cmd)) { + if (a && + ((a->e_fd != -1 && a->e_fd != fd) || c != a->e_cmd)) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } - break; default: @@ -149,7 +151,7 @@ elf_begin(int fd, Elf_Cmd c, Elf *a) if (a == NULL) e = _libelf_open_object(fd, c); else if (a->e_kind == ELF_K_AR) - e = _libelf_ar_open_member(fd, c, a); + e = _libelf_ar_open_member(a->e_fd, c, a); else (e = a)->e_activations++; Modified: stable/7/lib/libelf/elf_getdata.3 ============================================================================== --- stable/7/lib/libelf/elf_getdata.3 Sat Sep 4 13:00:22 2010 (r212206) +++ stable/7/lib/libelf/elf_getdata.3 Sat Sep 4 13:00:28 2010 (r212207) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008,2010 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 26, 2006 +.Dd April 30, 2010 .Os .Dt ELF_GETDATA 3 .Sh NAME @@ -193,6 +193,7 @@ An out of memory condition was detected. .Xr elf_getscn 3 , .Xr elf_getshdr 3 , .Xr elf_newscn 3 , +.Xr elf_rawfile 3 , .Xr elf_update 3 , .Xr elf_version 3 , .Xr gelf 3 Modified: stable/7/lib/libelf/libelf_data.c ============================================================================== --- stable/7/lib/libelf/libelf_data.c Sat Sep 4 13:00:22 2010 (r212206) +++ stable/7/lib/libelf/libelf_data.c Sat Sep 4 13:00:28 2010 (r212207) @@ -77,6 +77,8 @@ _libelf_xlate_shtype(uint32_t sht) return (ELF_T_MOVE); case SHT_SUNW_syminfo: return (ELF_T_SYMINFO); + case SHT_SUNW_dof: + return (ELF_T_BYTE); #endif case SHT_AMD64_UNWIND: /* == SHT_IA_64_UNWIND */ return (ELF_T_BYTE); From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 13:13:01 2010 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 3B31F10656D4; Sat, 4 Sep 2010 13:13:01 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 280B68FC16; Sat, 4 Sep 2010 13:13:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84DD1DL010593; Sat, 4 Sep 2010 13:13:01 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84DD0rP010578; Sat, 4 Sep 2010 13:13:00 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201009041313.o84DD0rP010578@svn.freebsd.org> From: Kai Wang Date: Sat, 4 Sep 2010 13:13:00 +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: r212208 - stable/8/lib/libelf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 13:13:01 -0000 Author: kaiw Date: Sat Sep 4 13:13:00 2010 New Revision: 212208 URL: http://svn.freebsd.org/changeset/base/212208 Log: MFC r210331-r210333,r210335,r210336,r210338,r210340,r210341,r210559. r210331: Add a new ELF type denoting GNU style hash tables. r210332: Changes for supporting GNU Hash sections. r210333: Note that the *_fsize() functions are only defined for ELF types that have a fixed size. r210335: - Return zero for file sizes of ELF types that have a variable size. - Neaten a few comments. r210336: Reduce verbosity. r210338: Perform additional checks when translating between file and memory representations of ELF types. The ELF(3) API allows applications to request a conversion that is `in-place', i.e., with source and destinations data buffers being the same. However, the file and memory sizes of ELF sections that have additional internal structure, such as those of type `Elf_Note', or `Elf_GNU_Hash_Header', can be determined only known after the type-specific headers that comprise the first few words in these sections are read and translated. Pass in the size of destination buffer to type translation routines in "libelf_convert.m4" and have these routines return an error code if the translated data would not fit inside the destination buffer. r210340: - Document that the *fsize() functions return a size of 1 for Elf types that don't have a fixed size. - The *fsize() functions should return a size of 1, for variable length types. - Redefine symbol ELF_T_LAST to match the current end of the list. r210341: Add support for translating sections of type ELF_T_GNUHASH. r210559: Protect GNUHASH translation functions with #ifdef; unbreak cross toolchain build. Modified: stable/8/lib/libelf/_libelf.h stable/8/lib/libelf/elf_data.c stable/8/lib/libelf/elf_scn.c stable/8/lib/libelf/elf_types.m4 stable/8/lib/libelf/gelf_fsize.3 stable/8/lib/libelf/libelf.h stable/8/lib/libelf/libelf_align.c stable/8/lib/libelf/libelf_convert.m4 stable/8/lib/libelf/libelf_data.c stable/8/lib/libelf/libelf_ehdr.c stable/8/lib/libelf/libelf_fsize.m4 stable/8/lib/libelf/libelf_msize.m4 stable/8/lib/libelf/libelf_phdr.c stable/8/lib/libelf/libelf_xlate.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/_libelf.h ============================================================================== --- stable/8/lib/libelf/_libelf.h Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/_libelf.h Sat Sep 4 13:13:00 2010 (r212208) @@ -175,8 +175,8 @@ void *_libelf_ehdr(Elf *_e, int _elfclas int _libelf_falign(Elf_Type _t, int _elfclass); size_t _libelf_fsize(Elf_Type _t, int _elfclass, unsigned int _version, size_t count); -void (*_libelf_get_translator(Elf_Type _t, int _direction, int _elfclass)) - (char *_dst, char *_src, size_t _cnt, int _byteswap); +int (*_libelf_get_translator(Elf_Type _t, int _direction, int _elfclass)) + (char *_dst, size_t dsz, char *_src, size_t _cnt, int _byteswap); void *_libelf_getphdr(Elf *_e, int _elfclass); void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass); void _libelf_init_elf(Elf *_e, Elf_Kind _kind); Modified: stable/8/lib/libelf/elf_data.c ============================================================================== --- stable/8/lib/libelf/elf_data.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/elf_data.c Sat Sep 4 13:13:00 2010 (r212208) @@ -43,7 +43,7 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) int elfclass, elftype; unsigned int sh_type; uint64_t sh_align, sh_offset, sh_size; - void (*xlate)(char *_d, char *_s, size_t _c, int _swap); + int (*xlate)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); if (s == NULL || (e = s->s_elf) == NULL || e->e_kind != ELF_K_ELF || (d != NULL && s != d->d_scn)) { @@ -125,11 +125,16 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) } d->d_flags |= LIBELF_F_MALLOCED; - STAILQ_INSERT_TAIL(&s->s_data, d, d_next); xlate = _libelf_get_translator(elftype, ELF_TOMEMORY, elfclass); - (*xlate)(d->d_buf, e->e_rawfile + sh_offset, count, e->e_byteorder != - LIBELF_PRIVATE(byteorder)); + if (!(*xlate)(d->d_buf, d->d_size, e->e_rawfile + sh_offset, count, + e->e_byteorder != LIBELF_PRIVATE(byteorder))) { + _libelf_release_data(d); + LIBELF_SET_ERROR(DATA, 0); + return (NULL); + } + + STAILQ_INSERT_TAIL(&s->s_data, d, d_next); return (d); } Modified: stable/8/lib/libelf/elf_scn.c ============================================================================== --- stable/8/lib/libelf/elf_scn.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/elf_scn.c Sat Sep 4 13:13:00 2010 (r212208) @@ -48,7 +48,7 @@ _libelf_load_scn(Elf *e, void *ehdr) Elf32_Ehdr *eh32; Elf64_Ehdr *eh64; Elf_Scn *scn; - void (*xlator)(char *_d, char *_s, size_t _c, int _swap); + int (*xlator)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); assert(e != NULL); assert(ehdr != NULL); @@ -101,7 +101,8 @@ _libelf_load_scn(Elf *e, void *ehdr) if ((scn = _libelf_allocate_scn(e, i)) == NULL) return (0); - (*xlator)((char *) &scn->s_shdr, src, (size_t) 1, swapbytes); + (*xlator)((char *) &scn->s_shdr, sizeof(scn->s_shdr), src, + (size_t) 1, swapbytes); if (ec == ELFCLASS32) { scn->s_offset = scn->s_rawoff = Modified: stable/8/lib/libelf/elf_types.m4 ============================================================================== --- stable/8/lib/libelf/elf_types.m4 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/elf_types.m4 Sat Sep 4 13:13:00 2010 (r212208) @@ -46,6 +46,7 @@ define(`ELF_TYPE_LIST', `CAP, Cap, 700025', `DYN, Dyn, 600102', `EHDR, Ehdr, 600102', + `GNUHASH, -, 800062', `HALF, Half, 600102', `LWORD, Lword, 700025', `MOVE, Move, 700025', Modified: stable/8/lib/libelf/gelf_fsize.3 ============================================================================== --- stable/8/lib/libelf/gelf_fsize.3 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/gelf_fsize.3 Sat Sep 4 13:13:00 2010 (r212208) @@ -47,6 +47,8 @@ These functions return the size in bytes .Ar count numbers of objects of ELF type .Ar type . +For ELF types that are of variable length, these functions return a +size of one byte. .Pp Functions .Fn elf32_fsize Modified: stable/8/lib/libelf/libelf.h ============================================================================== --- stable/8/lib/libelf/libelf.h Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf.h Sat Sep 4 13:13:00 2010 (r212208) @@ -75,11 +75,12 @@ typedef enum { ELF_T_VNEED, ELF_T_WORD, ELF_T_XWORD, + ELF_T_GNUHASH, /* GNU style hash tables. */ ELF_T_NUM } Elf_Type; #define ELF_T_FIRST ELF_T_ADDR -#define ELF_T_LAST ELF_T_XWORD +#define ELF_T_LAST ELF_T_GNUHASH /* Commands */ typedef enum { Modified: stable/8/lib/libelf/libelf_align.c ============================================================================== --- stable/8/lib/libelf/libelf_align.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_align.c Sat Sep 4 13:13:00 2010 (r212208) @@ -51,6 +51,10 @@ struct align { .a32 = 0, \ .a64 = __alignof__(Elf64_##V) \ } +#define MALIGN_WORD() { \ + .a32 = __alignof__(int32_t), \ + .a64 = __alignof__(int64_t) \ + } #else #error Need the __alignof__ builtin. #endif @@ -92,7 +96,10 @@ static struct align malign[ELF_T_NUM] = [ELF_T_VNEED] = MALIGN(Verneed), #endif [ELF_T_WORD] = MALIGN(Word), - [ELF_T_XWORD] = MALIGN64(Xword) + [ELF_T_XWORD] = MALIGN64(Xword), +#if __FreeBSD_version >= 800062 + [ELF_T_GNUHASH] = MALIGN_WORD() +#endif }; int @@ -140,7 +147,10 @@ static struct align falign[ELF_T_NUM] = [ELF_T_VNEED] = FALIGN(4,4), #endif [ELF_T_WORD] = FALIGN(4,4), - [ELF_T_XWORD] = FALIGN(0,8) + [ELF_T_XWORD] = FALIGN(0,8), +#if __FreeBSD_version >= 800062 + [ELF_T_GNUHASH] = FALIGN(4,8) +#endif }; int Modified: stable/8/lib/libelf/libelf_convert.m4 ============================================================================== --- stable/8/lib/libelf/libelf_convert.m4 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_convert.m4 Sat Sep 4 13:13:00 2010 (r212208) @@ -234,8 +234,10 @@ define(`IGNORE', IGNORE(MOVEP) IGNORE(NOTE) +IGNORE(GNUHASH) define(IGNORE_BYTE, 1) /* 'lator, leave 'em bytes alone */ +define(IGNORE_GNUHASH, 1) define(IGNORE_NOTE, 1) define(IGNORE_SXWORD32, 1) define(IGNORE_XWORD32, 1) @@ -274,18 +276,18 @@ define(`SIZEDEP_OFF', 1) * `$4': ELF class specifier for types, one of [`32', `64'] */ define(`MAKEPRIM_TO_F',` -static void -libelf_cvt_$1$3_tof(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_$1$3_tof(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { Elf$4_$2 t, *s = (Elf$4_$2 *) (uintptr_t) src; size_t c; - if (dst == src && !byteswap) - return; + (void) dsz; if (!byteswap) { (void) memcpy(dst, src, count * sizeof(*s)); - return; + return (1); } for (c = 0; c < count; c++) { @@ -293,22 +295,25 @@ libelf_cvt_$1$3_tof(char *dst, char *src SWAP_$1$3(t); WRITE_$1$3(dst,t); } + + return (1); } ') define(`MAKEPRIM_TO_M',` -static void -libelf_cvt_$1$3_tom(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_$1$3_tom(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { Elf$4_$2 t, *d = (Elf$4_$2 *) (uintptr_t) dst; size_t c; - if (dst == src && !byteswap) - return; + if (dsz < count * sizeof(Elf$4_$2)) + return (0); if (!byteswap) { (void) memcpy(dst, src, count * sizeof(*d)); - return; + return (1); } for (c = 0; c < count; c++) { @@ -316,6 +321,8 @@ libelf_cvt_$1$3_tom(char *dst, char *src SWAP_$1$3(t); *d++ = t; } + + return (1); } ') @@ -392,12 +399,15 @@ define(`READ_STRUCT', define(`MAKE_TO_F', `ifdef(`IGNORE_'$1$3,`',` -static void -libelf_cvt$3_$1_tof(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt$3_$1_tof(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { Elf$3_$2 t, *s; size_t c; + (void) dsz; + s = (Elf$3_$2 *) (uintptr_t) src; for (c = 0; c < count; c++) { t = *s++; @@ -406,13 +416,16 @@ libelf_cvt$3_$1_tof(char *dst, char *src } WRITE_STRUCT($2,$3) } + + return (1); } ')') define(`MAKE_TO_M', `ifdef(`IGNORE_'$1$3,`',` -static void -libelf_cvt$3_$1_tom(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt$3_$1_tom(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { Elf$3_$2 t, *d; char *s,*s0; @@ -422,6 +435,9 @@ libelf_cvt$3_$1_tom(char *dst, char *src d = ((Elf$3_$2 *) (uintptr_t) dst) + (count - 1); s0 = (char *) src + (count - 1) * fsz; + if (dsz < count * sizeof(Elf$3_$2)) + return (0); + while (count--) { s = s0; READ_STRUCT($2,$3) @@ -430,6 +446,8 @@ libelf_cvt$3_$1_tom(char *dst, char *src } *d-- = t; s0 -= fsz; } + + return (1); } ')') @@ -475,84 +493,300 @@ divert(0) * simple memcpy suffices for both directions of conversion. */ -static void -libelf_cvt_BYTE_tox(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_BYTE_tox(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { (void) byteswap; + if (dsz < count) + return (0); if (dst != src) (void) memcpy(dst, src, count); + return (1); } +MAKE_TYPE_CONVERTERS(ELF_TYPE_LIST) + +#if __FreeBSD_version >= 800062 +/* + * Sections of type ELF_T_GNUHASH start with a header containing 4 32-bit + * words. Bloom filter data comes next, followed by hash buckets and the + * hash chain. + * + * Bloom filter words are 64 bit wide on ELFCLASS64 objects and are 32 bit + * wide on ELFCLASS32 objects. The other objects in this section are 32 + * bits wide. + * + * Argument `srcsz' denotes the number of bytes to be converted. In the + * 32-bit case we need to translate `srcsz' to a count of 32-bit words. + */ + +static int +libelf_cvt32_GNUHASH_tom(char *dst, size_t dsz, char *src, size_t srcsz, + int byteswap) +{ + return (libelf_cvt_WORD_tom(dst, dsz, src, srcsz / sizeof(uint32_t), + byteswap)); +} + +static int +libelf_cvt32_GNUHASH_tof(char *dst, size_t dsz, char *src, size_t srcsz, + int byteswap) +{ + return (libelf_cvt_WORD_tof(dst, dsz, src, srcsz / sizeof(uint32_t), + byteswap)); +} + +static int +libelf_cvt64_GNUHASH_tom(char *dst, size_t dsz, char *src, size_t srcsz, + int byteswap) +{ + size_t sz; + uint64_t t64, *bloom64; + Elf_GNU_Hash_Header *gh; + uint32_t n, nbuckets, nchains, maskwords, shift2, symndx, t32; + uint32_t *buckets, *chains; + + sz = 4 * sizeof(uint32_t); /* File header is 4 words long. */ + if (dsz < sizeof(Elf_GNU_Hash_Header) || srcsz < sz) + return (0); + + /* Read in the section header and byteswap if needed. */ + READ_WORD(src, nbuckets); + READ_WORD(src, symndx); + READ_WORD(src, maskwords); + READ_WORD(src, shift2); + + srcsz -= sz; + + if (byteswap) { + SWAP_WORD(nbuckets); + SWAP_WORD(symndx); + SWAP_WORD(maskwords); + SWAP_WORD(shift2); + } + + /* Check source buffer and destination buffer sizes. */ + sz = nbuckets * sizeof(uint32_t) + maskwords * sizeof(uint64_t); + if (srcsz < sz || dsz < sz + sizeof(Elf_GNU_Hash_Header)) + return (0); + + gh = (Elf_GNU_Hash_Header *) (uintptr_t) dst; + gh->gh_nbuckets = nbuckets; + gh->gh_symndx = symndx; + gh->gh_maskwords = maskwords; + gh->gh_shift2 = shift2; + + dsz -= sizeof(Elf_GNU_Hash_Header); + dst += sizeof(Elf_GNU_Hash_Header); + + bloom64 = (uint64_t *) (uintptr_t) dst; + + /* Copy bloom filter data. */ + for (n = 0; n < maskwords; n++) { + READ_XWORD(src, t64); + if (byteswap) + SWAP_XWORD(t64); + bloom64[n] = t64; + } + + /* The hash buckets follows the bloom filter. */ + dst += maskwords * sizeof(uint64_t); + buckets = (uint32_t *) (uintptr_t) dst; + + for (n = 0; n < nbuckets; n++) { + READ_WORD(src, t32); + if (byteswap) + SWAP_WORD(t32); + buckets[n] = t32; + } + + dst += nbuckets * sizeof(uint32_t); + + /* The hash chain follows the hash buckets. */ + dsz -= sz; + srcsz -= sz; + + if (dsz < srcsz) /* Destination lacks space. */ + return (0); + + nchains = srcsz / sizeof(uint32_t); + chains = (uint32_t *) (uintptr_t) dst; + + for (n = 0; n < nchains; n++) { + READ_WORD(src, t32); + if (byteswap) + SWAP_WORD(t32); + *chains++ = t32; + } + + return (1); +} + +static int +libelf_cvt64_GNUHASH_tof(char *dst, size_t dsz, char *src, size_t srcsz, + int byteswap) +{ + uint32_t *s32; + size_t sz, hdrsz; + uint64_t *s64, t64; + Elf_GNU_Hash_Header *gh; + uint32_t maskwords, n, nbuckets, nchains, t0, t1, t2, t3, t32; + + hdrsz = 4 * sizeof(uint32_t); /* Header is 4x32 bits. */ + if (dsz < hdrsz || srcsz < sizeof(Elf_GNU_Hash_Header)) + return (0); + + gh = (Elf_GNU_Hash_Header *) (uintptr_t) src; + + t0 = nbuckets = gh->gh_nbuckets; + t1 = gh->gh_symndx; + t2 = maskwords = gh->gh_maskwords; + t3 = gh->gh_shift2; + + src += sizeof(Elf_GNU_Hash_Header); + srcsz -= sizeof(Elf_GNU_Hash_Header); + dsz -= hdrsz; + + sz = gh->gh_nbuckets * sizeof(uint32_t) + gh->gh_maskwords * + sizeof(uint64_t); + + if (srcsz < sz || dsz < sz) + return (0); + + /* Write out the header. */ + if (byteswap) { + SWAP_WORD(t0); + SWAP_WORD(t1); + SWAP_WORD(t2); + SWAP_WORD(t3); + } + + WRITE_WORD(dst, t0); + WRITE_WORD(dst, t1); + WRITE_WORD(dst, t2); + WRITE_WORD(dst, t3); + + /* Copy the bloom filter and the hash table. */ + s64 = (uint64_t *) (uintptr_t) src; + for (n = 0; n < maskwords; n++) { + t64 = *s64++; + if (byteswap) + SWAP_XWORD(t64); + WRITE_WORD64(dst, t64); + } + + s32 = (uint32_t *) s64; + for (n = 0; n < nbuckets; n++) { + t32 = *s32++; + if (byteswap) + SWAP_WORD(t32); + WRITE_WORD(dst, t32); + } + + srcsz -= sz; + dsz -= sz; + + /* Copy out the hash chains. */ + if (dsz < srcsz) + return (0); + + nchains = srcsz / sizeof(uint32_t); + for (n = 0; n < nchains; n++) { + t32 = *s32++; + if (byteswap) + SWAP_WORD(t32); + WRITE_WORD(dst, t32); + } + + return (1); +} +#endif + /* * Elf_Note structures comprise a fixed size header followed by variable * length strings. The fixed size header needs to be byte swapped, but * not the strings. * * Argument `count' denotes the total number of bytes to be converted. + * The destination buffer needs to be at least `count' bytes in size. */ -static void -libelf_cvt_NOTE_tom(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_NOTE_tom(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { uint32_t namesz, descsz, type; Elf_Note *en; - size_t sz; + size_t sz, hdrsz; - if (dst == src && !byteswap) - return; + if (dsz < count) /* Destination buffer is too small. */ + return (0); + + hdrsz = 3 * sizeof(uint32_t); + if (count < hdrsz) /* Source too small. */ + return (0); if (!byteswap) { (void) memcpy(dst, src, count); - return; + return (1); } - while (count > sizeof(Elf_Note)) { - + /* Process all notes in the section. */ + while (count > hdrsz) { + /* Read the note header. */ READ_WORD(src, namesz); READ_WORD(src, descsz); READ_WORD(src, type); - if (byteswap) { - SWAP_WORD(namesz); - SWAP_WORD(descsz); - SWAP_WORD(type); - } + /* Translate. */ + SWAP_WORD(namesz); + SWAP_WORD(descsz); + SWAP_WORD(type); + /* Copy out the translated note header. */ en = (Elf_Note *) (uintptr_t) dst; en->n_namesz = namesz; en->n_descsz = descsz; en->n_type = type; + dsz -= sizeof(Elf_Note); dst += sizeof(Elf_Note); + count -= hdrsz; ROUNDUP2(namesz, 4); ROUNDUP2(descsz, 4); sz = namesz + descsz; - if (count < sz) - sz = count; + if (count < sz || dsz < sz) /* Buffers are too small. */ + return (0); (void) memcpy(dst, src, sz); src += sz; dst += sz; + count -= sz; + dsz -= sz; } + + return (1); } -static void -libelf_cvt_NOTE_tof(char *dst, char *src, size_t count, int byteswap) +static int +libelf_cvt_NOTE_tof(char *dst, size_t dsz, char *src, size_t count, + int byteswap) { uint32_t namesz, descsz, type; Elf_Note *en; size_t sz; - if (dst == src && !byteswap) - return; + if (dsz < count) + return (0); if (!byteswap) { (void) memcpy(dst, src, count); - return; + return (1); } while (count > sizeof(Elf_Note)) { @@ -562,12 +796,9 @@ libelf_cvt_NOTE_tof(char *dst, char *src descsz = en->n_descsz; type = en->n_type; - if (byteswap) { - SWAP_WORD(namesz); - SWAP_WORD(descsz); - SWAP_WORD(type); - } - + SWAP_WORD(namesz); + SWAP_WORD(descsz); + SWAP_WORD(type); WRITE_WORD(dst, namesz); WRITE_WORD(dst, descsz); @@ -589,15 +820,19 @@ libelf_cvt_NOTE_tof(char *dst, char *src dst += sz; count -= sz; } -} -MAKE_TYPE_CONVERTERS(ELF_TYPE_LIST) + return (1); +} struct converters { - void (*tof32)(char *dst, char *src, size_t cnt, int byteswap); - void (*tom32)(char *dst, char *src, size_t cnt, int byteswap); - void (*tof64)(char *dst, char *src, size_t cnt, int byteswap); - void (*tom64)(char *dst, char *src, size_t cnt, int byteswap); + int (*tof32)(char *dst, size_t dsz, char *src, size_t cnt, + int byteswap); + int (*tom32)(char *dst, size_t dsz, char *src, size_t cnt, + int byteswap); + int (*tof64)(char *dst, size_t dsz, char *src, size_t cnt, + int byteswap); + int (*tom64)(char *dst, size_t dsz, char *src, size_t cnt, + int byteswap); }; divert(-1) @@ -639,6 +874,16 @@ CONVERTER_NAMES(ELF_TYPE_LIST) .tof64 = libelf_cvt_BYTE_tox, .tom64 = libelf_cvt_BYTE_tox }, + +#if __FreeBSD_version >= 800062 + [ELF_T_GNUHASH] = { + .tof32 = libelf_cvt32_GNUHASH_tof, + .tom32 = libelf_cvt32_GNUHASH_tom, + .tof64 = libelf_cvt64_GNUHASH_tof, + .tom64 = libelf_cvt64_GNUHASH_tom + }, +#endif + [ELF_T_NOTE] = { .tof32 = libelf_cvt_NOTE_tof, .tom32 = libelf_cvt_NOTE_tom, @@ -647,8 +892,8 @@ CONVERTER_NAMES(ELF_TYPE_LIST) } }; -void (*_libelf_get_translator(Elf_Type t, int direction, int elfclass)) - (char *_dst, char *_src, size_t _cnt, int _byteswap) +int (*_libelf_get_translator(Elf_Type t, int direction, int elfclass)) + (char *_dst, size_t dsz, char *_src, size_t _cnt, int _byteswap) { assert(elfclass == ELFCLASS32 || elfclass == ELFCLASS64); assert(direction == ELF_TOFILE || direction == ELF_TOMEMORY); Modified: stable/8/lib/libelf/libelf_data.c ============================================================================== --- stable/8/lib/libelf/libelf_data.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_data.c Sat Sep 4 13:13:00 2010 (r212208) @@ -42,6 +42,10 @@ _libelf_xlate_shtype(uint32_t sht) return (ELF_T_SYM); case SHT_FINI_ARRAY: return (ELF_T_ADDR); +#if __FreeBSD_version >= 800062 + case SHT_GNU_HASH: + return (ELF_T_GNUHASH); +#endif case SHT_GROUP: return (ELF_T_WORD); case SHT_HASH: Modified: stable/8/lib/libelf/libelf_ehdr.c ============================================================================== --- stable/8/lib/libelf/libelf_ehdr.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_ehdr.c Sat Sep 4 13:13:00 2010 (r212208) @@ -46,7 +46,7 @@ _libelf_load_extended(Elf *e, int ec, ui { Elf_Scn *scn; size_t fsz; - void (*xlator)(char *_d, char *_s, size_t _c, int _swap); + int (*xlator)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); uint32_t shtype; assert(STAILQ_EMPTY(&e->e_u.e_elf.e_scn)); @@ -63,7 +63,8 @@ _libelf_load_extended(Elf *e, int ec, ui return (0); xlator = _libelf_get_translator(ELF_T_SHDR, ELF_TOMEMORY, ec); - (*xlator)((char *) &scn->s_shdr, e->e_rawfile + shoff, (size_t) 1, + (*xlator)((char *) &scn->s_shdr, sizeof(scn->s_shdr), + e->e_rawfile + shoff, (size_t) 1, e->e_byteorder != LIBELF_PRIVATE(byteorder)); #define GET_SHDR_MEMBER(M) ((ec == ELFCLASS32) ? scn->s_shdr.s_shdr32.M : \ @@ -105,7 +106,7 @@ _libelf_ehdr(Elf *e, int ec, int allocat size_t fsz, msz; uint16_t phnum, shnum, strndx; uint64_t shoff; - void (*xlator)(char *_d, char *_s, size_t _c, int _swap); + int (*xlator)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); assert(ec == ELFCLASS32 || ec == ELFCLASS64); @@ -167,7 +168,7 @@ _libelf_ehdr(Elf *e, int ec, int allocat return (ehdr); xlator = _libelf_get_translator(ELF_T_EHDR, ELF_TOMEMORY, ec); - (*xlator)(ehdr, e->e_rawfile, (size_t) 1, + (*xlator)(ehdr, msz, e->e_rawfile, (size_t) 1, e->e_byteorder != LIBELF_PRIVATE(byteorder)); /* Modified: stable/8/lib/libelf/libelf_fsize.m4 ============================================================================== --- stable/8/lib/libelf/libelf_fsize.m4 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_fsize.m4 Sat Sep 4 13:13:00 2010 (r212208) @@ -43,15 +43,18 @@ include(SRCDIR`/elf_types.m4') * representations. */ -/* `Basic' types */ +/* `Basic' types. */ define(`BYTE_SIZE', 1) define(`IDENT_SIZE', `EI_NIDENT') -define(`NOTE_SIZE', 1) /* Elf_Note structures have variable length. */ -/* Currently unimplemented types */ +/* Types that have variable length. */ +define(`GNUHASH_SIZE', 1) +define(`NOTE_SIZE', 1) + +/* Currently unimplemented types. */ define(`MOVEP_SIZE', 0) -/* Overrides for 32 bit types that do not exist */ +/* Overrides for 32 bit types that do not exist. */ define(`XWORD_SIZE32', 0) define(`SXWORD_SIZE32', 0) Modified: stable/8/lib/libelf/libelf_msize.m4 ============================================================================== --- stable/8/lib/libelf/libelf_msize.m4 Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_msize.m4 Sat Sep 4 13:13:00 2010 (r212208) @@ -49,6 +49,7 @@ divert(-1) include(SRCDIR`/elf_types.m4') define(BYTE_SIZE, 1) +define(GNUHASH_SIZE, 1) define(NOTE_SIZE, 1) /* Modified: stable/8/lib/libelf/libelf_phdr.c ============================================================================== --- stable/8/lib/libelf/libelf_phdr.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_phdr.c Sat Sep 4 13:13:00 2010 (r212208) @@ -45,7 +45,7 @@ _libelf_getphdr(Elf *e, int ec) Elf32_Ehdr *eh32; Elf64_Ehdr *eh64; void *ehdr, *phdr; - void (*xlator)(char *_d, char *_s, size_t _c, int _swap); + int (*xlator)(char *_d, size_t _dsz, char *_s, size_t _c, int _swap); assert(ec == ELFCLASS32 || ec == ELFCLASS64); @@ -103,7 +103,7 @@ _libelf_getphdr(Elf *e, int ec) xlator = _libelf_get_translator(ELF_T_PHDR, ELF_TOMEMORY, ec); - (*xlator)(phdr, e->e_rawfile + phoff, phnum, + (*xlator)(phdr, phnum * msz, e->e_rawfile + phoff, phnum, e->e_byteorder != LIBELF_PRIVATE(byteorder)); return (phdr); Modified: stable/8/lib/libelf/libelf_xlate.c ============================================================================== --- stable/8/lib/libelf/libelf_xlate.c Sat Sep 4 13:00:28 2010 (r212207) +++ stable/8/lib/libelf/libelf_xlate.c Sat Sep 4 13:13:00 2010 (r212208) @@ -48,6 +48,7 @@ Elf_Data * _libelf_xlate(Elf_Data *dst, const Elf_Data *src, unsigned int encoding, int elfclass, int direction) { + int byteswap; size_t cnt, dsz, fsz, msz; uintptr_t sb, se, db, de; @@ -132,12 +133,17 @@ _libelf_xlate(Elf_Data *dst, const Elf_D dst->d_type = src->d_type; dst->d_size = dsz; + byteswap = encoding != LIBELF_PRIVATE(byteorder); + if (src->d_size == 0 || - (db == sb && encoding == LIBELF_PRIVATE(byteorder) && fsz == msz)) + (db == sb && !byteswap && fsz == msz)) return (dst); /* nothing more to do */ - (_libelf_get_translator(src->d_type, direction, elfclass))(dst->d_buf, - src->d_buf, cnt, encoding != LIBELF_PRIVATE(byteorder)); + if (!(_libelf_get_translator(src->d_type, direction, elfclass)) + (dst->d_buf, dsz, src->d_buf, cnt, byteswap)) { + LIBELF_SET_ERROR(DATA, 0); + return (NULL); + } return (dst); } From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 16:06:01 2010 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 8918610656B3; Sat, 4 Sep 2010 16:06:01 +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 792158FC0C; Sat, 4 Sep 2010 16:06:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84G61tT020775; Sat, 4 Sep 2010 16:06:01 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84G61Ht020773; Sat, 4 Sep 2010 16:06:01 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009041606.o84G61Ht020773@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 4 Sep 2010 16:06: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: r212209 - 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: Sat, 04 Sep 2010 16:06:01 -0000 Author: bz Date: Sat Sep 4 16:06:01 2010 New Revision: 212209 URL: http://svn.freebsd.org/changeset/base/212209 Log: In case of RADIX_MPATH do not leak the IN_IFADDR read lock on early return. MFC after: 3 days Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sat Sep 4 13:13:00 2010 (r212208) +++ head/sys/netinet/in.c Sat Sep 4 16:06:01 2010 (r212209) @@ -1039,9 +1039,10 @@ in_addprefix(struct in_ifaddr *target, i if (ia->ia_flags & IFA_ROUTE) { #ifdef RADIX_MPATH if (ia->ia_addr.sin_addr.s_addr == - target->ia_addr.sin_addr.s_addr) + target->ia_addr.sin_addr.s_addr) { + IN_IFADDR_RUNLOCK(); return (EEXIST); - else + } else break; #endif if (V_sameprefixcarponly && From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 16:27:15 2010 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 0CD9C10656A4; Sat, 4 Sep 2010 16:27:15 +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 F119F8FC12; Sat, 4 Sep 2010 16:27:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84GRE46021799; Sat, 4 Sep 2010 16:27:14 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84GREfL021797; Sat, 4 Sep 2010 16:27:14 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009041627.o84GREfL021797@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 4 Sep 2010 16:27: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: r212210 - head/sys/dev/twa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 16:27:15 -0000 Author: bz Date: Sat Sep 4 16:27:14 2010 New Revision: 212210 URL: http://svn.freebsd.org/changeset/base/212210 Log: Fix a compile problem introduced with r212008 on 32bit: Both deadline and current_time are time_seconds (+ utc_offset()) casted to unsigned long long. No need to cast to or print as pointers. MFC after: 4 days Modified: head/sys/dev/twa/tw_osl_freebsd.c Modified: head/sys/dev/twa/tw_osl_freebsd.c ============================================================================== --- head/sys/dev/twa/tw_osl_freebsd.c Sat Sep 4 16:06:01 2010 (r212209) +++ head/sys/dev/twa/tw_osl_freebsd.c Sat Sep 4 16:27:14 2010 (r212210) @@ -472,7 +472,7 @@ twa_watchdog(TW_VOID *arg) (my_req->deadline < current_time)) { tw_cl_set_reset_needed(ctlr_handle); #ifdef TW_OSL_DEBUG - device_printf((sc)->bus_dev, "Request %d timed out! d = %p, c = %p\n", i, (void*)my_req->deadline, (void*)current_time); + device_printf((sc)->bus_dev, "Request %d timed out! d = %llu, c = %llu\n", i, my_req->deadline, current_time); #else /* TW_OSL_DEBUG */ device_printf((sc)->bus_dev, "Request %d timed out!\n", i); #endif /* TW_OSL_DEBUG */ From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 17:14:52 2010 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 834A810656AA; Sat, 4 Sep 2010 17:14:52 +0000 (UTC) (envelope-from gavin@ury.york.ac.uk) Received: from gse-mta-27.emailfiltering.com (gse-mta-27-tx.emailfiltering.com [194.116.198.158]) by mx1.freebsd.org (Postfix) with ESMTP id 980858FC19; Sat, 4 Sep 2010 17:14:51 +0000 (UTC) Received: from mail-gw5.york.ac.uk ([144.32.129.29]) by gse-mta-27.emailfiltering.com with emfmta (version 4.6.0.72) by TLS id 731991572 for jmg@FreeBSD.org;297b4ed765393105; Sat, 04 Sep 2010 18:14:50 +0100 Received: from ury.york.ac.uk ([144.32.108.81]:34766) by mail-gw5.york.ac.uk with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1OrwKH-0008Hq-Fu; Sat, 04 Sep 2010 18:14:49 +0100 Received: from gavin (helo=localhost) by ury.york.ac.uk with local-esmtp (Exim 4.72) (envelope-from ) id 1OrwKH-00073d-8I; Sat, 04 Sep 2010 18:14:49 +0100 Date: Sat, 4 Sep 2010 18:14:49 +0100 (BST) From: Gavin Atkinson X-X-Sender: gavin@ury.york.ac.uk To: John-Mark Gurney In-Reply-To: <201009030320.o833KYFF031921@svn.freebsd.org> Message-ID: References: <201009030320.o833KYFF031921@svn.freebsd.org> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212168 - head/games/fortune/datfiles X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 17:14:52 -0000 On Fri, 3 Sep 2010, John-Mark Gurney wrote: > Author: jmg > Date: Fri Sep 3 03:20:34 2010 > New Revision: 212168 > URL: http://svn.freebsd.org/changeset/base/212168 > > Log: > fix the move so that it matches what the rest of the internet > says about this game... This move also makes more sense... > > MFC after: 1 week > > Modified: > head/games/fortune/datfiles/fortunes > > Modified: head/games/fortune/datfiles/fortunes > ============================================================================== > --- head/games/fortune/datfiles/fortunes Fri Sep 3 00:34:45 2010 (r212167) > +++ head/games/fortune/datfiles/fortunes Fri Sep 3 03:20:34 2010 (r212168) > @@ -45221,7 +45221,7 @@ of their own homes. > 1: P-Q4, Kt-KB3 > 2: Kt-Q2, P-K4 > 3: PxP, Kt-Kt5 > - 4: P-K6, Kt-K6/ > + 4: P-KR3, Kt-K6/ > White then resigns on realizing that a fifth move would involve > either a Q-KR5 check or the loss of his queen. > -- Stephen Pile, "The Book of Heroic Failures" Just for the record - I've got the book (I'd highly recommend it to anyone who sees a copy), and it's not a transcription error - it appears incorrectly in the book itself. I guess the fact the quote has been corrected from the book probably isn't worth mentioning in the fortune though. Gavin From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 17:28:29 2010 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 CB36010656DA; Sat, 4 Sep 2010 17:28:29 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 698E58FC08; Sat, 4 Sep 2010 17:28:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84HSTfC025549; Sat, 4 Sep 2010 17:28:29 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84HST37025546; Sat, 4 Sep 2010 17:28:29 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201009041728.o84HST37025546@svn.freebsd.org> From: Andriy Gapon Date: Sat, 4 Sep 2010 17:28: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: r212213 - 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: Sat, 04 Sep 2010 17:28:29 -0000 Author: avg Date: Sat Sep 4 17:28:29 2010 New Revision: 212213 URL: http://svn.freebsd.org/changeset/base/212213 Log: struct device: widen type of flags and order fields to u_int Also change int -> u_int for order parameter in device_add_child_ordered. There should not be any ABI change as struct device is private to subr_bus.c and the API change should be compatible. To do: change int -> u_int for order parameter of bus_add_child method and its implementations. The change should also be API compatible, but is a bit more churn. Suggested by: imp, jhb MFC after: 1 week Modified: head/sys/kern/subr_bus.c head/sys/sys/bus.h Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Sat Sep 4 17:27:48 2010 (r212212) +++ head/sys/kern/subr_bus.c Sat Sep 4 17:28:29 2010 (r212213) @@ -121,7 +121,7 @@ struct device { int busy; /**< count of calls to device_busy() */ device_state_t state; /**< current device state */ uint32_t devflags; /**< api level flags for device_get_flags() */ - u_short flags; /**< internal device flags */ + u_int flags; /**< internal device flags */ #define DF_ENABLED 1 /* device should be probed/attached */ #define DF_FIXEDCLASS 2 /* devclass specified at create time */ #define DF_WILDCARD 4 /* unit was originally wildcard */ @@ -130,8 +130,7 @@ struct device { #define DF_DONENOMATCH 32 /* don't execute DEVICE_NOMATCH again */ #define DF_EXTERNALSOFTC 64 /* softc not allocated by us */ #define DF_REBID 128 /* Can rebid after attach */ - u_char order; /**< order from device_add_child_ordered() */ - u_char pad; + u_int order; /**< order from device_add_child_ordered() */ void *ivars; /**< instance variables */ void *softc; /**< current driver's variables */ @@ -1790,12 +1789,12 @@ device_add_child(device_t dev, const cha * @returns the new device */ device_t -device_add_child_ordered(device_t dev, int order, const char *name, int unit) +device_add_child_ordered(device_t dev, u_int order, const char *name, int unit) { device_t child; device_t place; - PDEBUG(("%s at %s with order %d as unit %d", + PDEBUG(("%s at %s with order %u as unit %d", name, DEVICENAME(dev), order, unit)); child = make_device(dev, name, unit); Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Sat Sep 4 17:27:48 2010 (r212212) +++ head/sys/sys/bus.h Sat Sep 4 17:28:29 2010 (r212213) @@ -410,7 +410,7 @@ bus_alloc_resource_any(device_t dev, int * Access functions for device. */ device_t device_add_child(device_t dev, const char *name, int unit); -device_t device_add_child_ordered(device_t dev, int order, +device_t device_add_child_ordered(device_t dev, u_int order, const char *name, int unit); void device_busy(device_t dev); int device_delete_child(device_t dev, device_t child); From owner-svn-src-all@FreeBSD.ORG Sat Sep 4 21:23:46 2010 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 D4C161065675; Sat, 4 Sep 2010 21:23:46 +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 C43128FC08; Sat, 4 Sep 2010 21:23:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o84LNkxL038489; Sat, 4 Sep 2010 21:23:46 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o84LNkGT038487; Sat, 4 Sep 2010 21:23:46 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009042123.o84LNkGT038487@svn.freebsd.org> From: Jilles Tjoelker Date: Sat, 4 Sep 2010 21:23: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: r212214 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages 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, 04 Sep 2010 21:23:46 -0000 Author: jilles Date: Sat Sep 4 21:23:46 2010 New Revision: 212214 URL: http://svn.freebsd.org/changeset/base/212214 Log: sh: Get rid of some magic numbers. MFC after: 1 week Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sat Sep 4 17:28:29 2010 (r212213) +++ head/bin/sh/eval.c Sat Sep 4 21:23:46 2010 (r212214) @@ -995,7 +995,7 @@ cmddone: goto out; parent: /* parent process gets here (if we forked) */ - if (mode == 0) { /* argument to fork */ + if (mode == FORK_FG) { /* argument to fork */ INTOFF; exitstatus = waitforjob(jp, &realstatus); INTON; @@ -1003,7 +1003,7 @@ parent: /* parent process gets here (if evalskip = SKIPBREAK; skipcount = loopnest; } - } else if (mode == 2) { + } else if (mode == FORK_NOJOB) { backcmd->fd = pip[0]; close(pip[1]); backcmd->jp = jp;