From owner-svn-src-head@FreeBSD.ORG Sun May 30 03:45:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB11B1065670; Sun, 30 May 2010 03:45:41 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A1F58FC08; Sun, 30 May 2010 03:45: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 o4U3jfoZ027319; Sun, 30 May 2010 03:45:41 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4U3jfBU027317; Sun, 30 May 2010 03:45:41 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201005300345.o4U3jfBU027317@svn.freebsd.org> From: Jung-uk Kim Date: Sun, 30 May 2010 03:45: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: r208650 - head/sys/dev/fdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 03:45:41 -0000 Author: jkim Date: Sun May 30 03:45:41 2010 New Revision: 208650 URL: http://svn.freebsd.org/changeset/base/208650 Log: Fix a regression from r200554, which broke fdc(4) attachment to acpi(4). I removed too many lines and a wrong pointer was accidentally passed down. Tested by: Scott Allendorf (scott-allendorf at uiowa dot edu), kib MFC after: 3 days Modified: head/sys/dev/fdc/fdc_acpi.c Modified: head/sys/dev/fdc/fdc_acpi.c ============================================================================== --- head/sys/dev/fdc/fdc_acpi.c Sat May 29 22:55:59 2010 (r208649) +++ head/sys/dev/fdc/fdc_acpi.c Sun May 30 03:45:41 2010 (r208650) @@ -96,6 +96,7 @@ fdc_acpi_attach(device_t dev) { struct fdc_data *sc; ACPI_BUFFER buf; + ACPI_OBJECT *obj; device_t bus; int error; @@ -131,7 +132,8 @@ fdc_acpi_attach(device_t dev) } /* Add fd child devices as specified. */ - error = fdc_acpi_probe_children(bus, dev, buf.Pointer); + obj = buf.Pointer; + error = fdc_acpi_probe_children(bus, dev, obj->Buffer.Pointer); out: if (buf.Pointer) From owner-svn-src-head@FreeBSD.ORG Sun May 30 04:32:48 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with SMTP id EEFC3106564A; Sun, 30 May 2010 04:32:47 +0000 (UTC) (envelope-from nork@FreeBSD.org) Date: Sun, 30 May 2010 13:32:41 +0900 From: Norikatsu Shigemura To: Gordon Tetlow Message-Id: <20100530133241.5f89ba07.nork@FreeBSD.org> In-Reply-To: <201005292255.o4TMtxmT056395@svn.freebsd.org> References: <201005292255.o4TMtxmT056395@svn.freebsd.org> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; i386-portbld-freebsd8.0) 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 Subject: Re: svn commit: r208649 - head/usr.sbin/newsyslog X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 04:32:48 -0000 Hi gordon. On Sat, 29 May 2010 22:55:59 +0000 (UTC) Gordon Tetlow wrote: > Log: > Add file include processing for newsyslog. > Format for the include line in /etc/newsyslog.conf is: > /etc/defaults/newsyslog.conf Oohh my god, that's great! Do you have any works to support following? 1. include from /usr/local/etc/newsyslog.d/* 2. not supported glob pattern is OK. I want to add and remove to /etc/newsyslog.conf, safe and simlply like: echo include ports > /etc/newsyslog.conf sed -i "" "/include ports/d" /etc/newsyslog.conf And 3. same to syslog.conf -- Norikatsu Shigemura From owner-svn-src-head@FreeBSD.ORG Sun May 30 04:44:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2F191065672; Sun, 30 May 2010 04:44:32 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C0DE78FC18; Sun, 30 May 2010 04:44: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 o4U4iWA0040228; Sun, 30 May 2010 04:44:32 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4U4iWxW040226; Sun, 30 May 2010 04:44:32 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005300444.o4U4iWxW040226@svn.freebsd.org> From: Alan Cox Date: Sun, 30 May 2010 04:44: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: r208651 - head/sys/i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 04:44:33 -0000 Author: alc Date: Sun May 30 04:44:32 2010 New Revision: 208651 URL: http://svn.freebsd.org/changeset/base/208651 Log: Merge various changes from i386/i386/pmap.c: The remaining, unmerged portions of r175404 Retire PMAP_DIAGNOSTIC. Any useful diagnostics that were conditionally compiled under PMAP_DIAGNOSTIC are now KASSERT()s. (Note: The kernel option DIAGNOSTIC still disables inlining of certain pmap functions.) Eliminate dead code from pmap_enter(). This code implemented an assertion. On i386, an equivalent check is already implemented. However, on amd64, a small change is required to implement an equivalent check. Eliminate \n from a nearby panic string. Use KASSERT() to reimplement pmap_copy()'s two assertions. Merge portions of r177659 To date, we have assumed that the TLB will only set the PG_M bit in a PTE if that PTE has the PG_RW bit set. However, this assumption does not hold on recent processors from Intel. For example, consider a PTE that has the PG_RW bit set but the PG_M bit clear. Suppose this PTE is cached in the TLB and later the PG_RW bit is cleared in the PTE, but the corresponding TLB entry is not (yet) invalidated. Historically, upon a write access using this (stale) TLB entry, the TLB would observe that the PG_RW bit had been cleared and initiate a page fault, aborting the setting of the PG_M bit in the PTE. Now, however, P4- and Core2-family processors will set the PG_M bit before observing that the PG_RW bit is clear and initiating a page fault. In other words, the write does not occur but the PG_M bit is still set. The real impact of this difference is not that great. Specifically, we should no longer assert that any PTE with the PG_M bit set must also have the PG_RW bit set, and we should ignore the state of the PG_M bit unless the PG_RW bit is set. r208609 Defer freeing any page table pages in pmap_remove_all() until after the page queues lock is released. This may reduce the amount of time that the page queues lock is held by pmap_remove_all(). r208645 When I pushed down the page queues lock into pmap_is_modified(), I created an ordering dependence: A pmap operation that clears PG_WRITEABLE and calls vm_page_dirty() must perform the call first. Otherwise, pmap_is_modified() could return FALSE without acquiring the page queues lock because the page is not (currently) writeable, and the caller to pmap_is_modified() might believe that the page's dirty field is clear because it has not seen the effect of the vm_page_dirty() call. When I pushed down the page queues lock into pmap_is_modified(), I overlooked one place where this ordering dependence is violated: pmap_enter(). In a rare situation pmap_enter() can be called to replace a dirty mapping to one page with a mapping to another page. (I say rare because replacements generally occur as a result of a copy-on-write fault, and so the old page is not dirty.) This change delays clearing PG_WRITEABLE until after vm_page_dirty() has been called. Fixing the ordering dependency also makes it easy to introduce a small optimization: When pmap_enter() used to replace a mapping to one page with a mapping to another page, it freed the pv entry for the first mapping and later called the pv entry allocator for the new mapping. Now, pmap_enter() attempts to recycle the old pv entry, saving two calls to the pv entry allocator. There is no point in setting PG_WRITEABLE on unmanaged pages, so don't. Update a comment to reflect this. Tidy up the variable declarations at the start of pmap_enter(). Modified: head/sys/i386/xen/pmap.c Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Sun May 30 03:45:41 2010 (r208650) +++ head/sys/i386/xen/pmap.c Sun May 30 04:44:32 2010 (r208651) @@ -103,8 +103,6 @@ __FBSDID("$FreeBSD$"); * and to when physical maps must be made correct. */ -#define PMAP_DIAGNOSTIC - #include "opt_cpu.h" #include "opt_pmap.h" #include "opt_msgbuf.h" @@ -168,13 +166,11 @@ __FBSDID("$FreeBSD$"); #define PMAP_SHPGPERPROC 200 #endif -#if defined(DIAGNOSTIC) -#define PMAP_DIAGNOSTIC -#endif +#define DIAGNOSTIC -#if !defined(PMAP_DIAGNOSTIC) +#if !defined(DIAGNOSTIC) #ifdef __GNUC_GNU_INLINE__ -#define PMAP_INLINE inline +#define PMAP_INLINE __attribute__((__gnu_inline__)) inline #else #define PMAP_INLINE extern inline #endif @@ -298,6 +294,9 @@ SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, map static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try); +static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); +static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, + vm_offset_t va); static vm_page_t pmap_enter_quick_locked(multicall_entry_t **mcl, int *count, pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, vm_page_t mpte); @@ -307,7 +306,6 @@ static void pmap_remove_page(struct pmap vm_page_t *free); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); -static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); @@ -2073,12 +2071,8 @@ pmap_collect(pmap_t locked_pmap, struct ("pmap_collect: wired pte %#jx", (uintmax_t)tpte)); if (tpte & PG_A) vm_page_flag_set(m, PG_REFERENCED); - if (tpte & PG_M) { - KASSERT((tpte & PG_RW), - ("pmap_collect: modified page not writable: va: %#x, pte: %#jx", - va, (uintmax_t)tpte)); + if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - } free = NULL; pmap_unuse_pt(pmap, va, &free); pmap_invalidate_page(pmap, va); @@ -2229,38 +2223,39 @@ retry: return (pv); } -static void -pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) +static __inline pv_entry_t +pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va) { pv_entry_t pv; - PMAP_LOCK_ASSERT(pmap, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - if (pmap == PV_PMAP(pv) && va == pv->pv_va) + TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) { + if (pmap == PV_PMAP(pv) && va == pv->pv_va) { + TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); break; + } } - KASSERT(pv != NULL, ("pmap_remove_entry: pv not found")); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - free_pv_entry(pmap, pv); + return (pv); } -/* - * Create a pv entry for page at pa for - * (pmap, va). - */ static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m) +pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va) { pv_entry_t pv; - PMAP_LOCK_ASSERT(pmap, MA_OWNED); + pv = pmap_pvh_remove(pvh, pmap, va); + KASSERT(pv != NULL, ("pmap_pvh_free: pv not found")); + free_pv_entry(pmap, pv); +} + +static void +pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) +{ + mtx_assert(&vm_page_queue_mtx, MA_OWNED); - pv = get_pv_entry(pmap, FALSE); - pv->pv_va = va; - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + pmap_pvh_free(&m->md, pmap, va); + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } /* @@ -2320,12 +2315,8 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t if (!(oldpte & PG_MANAGED)) printf("va=0x%x is unmanaged :-( pte=0x%llx\n", va, oldpte); - if (oldpte & PG_M) { - KASSERT((oldpte & PG_RW), - ("pmap_remove_pte: modified page not writable: va: %#x, pte: %#jx", - va, (uintmax_t)oldpte)); + if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - } if (oldpte & PG_A) vm_page_flag_set(m, PG_REFERENCED); pmap_remove_entry(pmap, m, va); @@ -2487,6 +2478,7 @@ pmap_remove_all(vm_page_t m) KASSERT((m->flags & PG_FICTITIOUS) == 0, ("pmap_remove_all: page %p is fictitious", m)); + free = NULL; vm_page_lock_queues(); sched_pin(); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { @@ -2505,16 +2497,10 @@ pmap_remove_all(vm_page_t m) /* * Update the vm_page_t clean and reference bits. */ - if (tpte & PG_M) { - KASSERT((tpte & PG_RW), - ("pmap_remove_all: modified page not writable: va: %#x, pte: %#jx", - pv->pv_va, (uintmax_t)tpte)); + if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); - } - free = NULL; pmap_unuse_pt(pmap, pv->pv_va, &free); pmap_invalidate_page(pmap, pv->pv_va); - pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); @@ -2525,6 +2511,7 @@ pmap_remove_all(vm_page_t m) PT_SET_MA(PADDR1, 0); sched_unpin(); vm_page_unlock_queues(); + pmap_free_zero_pages(free); } /* @@ -2671,19 +2658,19 @@ void pmap_enter(pmap_t pmap, vm_offset_t va, vm_prot_t access, vm_page_t m, vm_prot_t prot, boolean_t wired) { - vm_paddr_t pa; pd_entry_t *pde; pt_entry_t *pte; - vm_paddr_t opa; - pt_entry_t origpte, newpte; + pt_entry_t newpte, origpte; + pv_entry_t pv; + vm_paddr_t opa, pa; vm_page_t mpte, om; boolean_t invlva; CTR6(KTR_PMAP, "pmap_enter: pmap=%08p va=0x%08x access=0x%x ma=0x%08x prot=0x%x wired=%d", pmap, va, access, xpmap_ptom(VM_PAGE_TO_PHYS(m)), prot, wired); va = trunc_page(va); - KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); - KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, + KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); + KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)", va)); KASSERT((m->oflags & VPO_BUSY) != 0, @@ -2702,16 +2689,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (va < VM_MAXUSER_ADDRESS) { mpte = pmap_allocpte(pmap, va, M_WAITOK); } -#if 0 && defined(PMAP_DIAGNOSTIC) - else { - pd_entry_t *pdeaddr = pmap_pde(pmap, va); - origpte = *pdeaddr; - if ((origpte & PG_V) == 0) { - panic("pmap_enter: invalid kernel page table page, pdir=%p, pde=%p, va=%p\n", - pmap->pm_pdir[PTDPTDI], origpte, va); - } - } -#endif pde = pmap_pde(pmap, va); if ((*pde & PG_PS) != 0) @@ -2722,7 +2699,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=%#jx, va=%#x\n", + panic("pmap_enter: invalid page directory pdir=%#jx, va=%#x", (uintmax_t)pmap->pm_pdir[va >> PDRSHIFT], va); } @@ -2770,6 +2747,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, } goto validate; } + + pv = NULL; + /* * Mapping has changed, invalidate old range and fall through to * handle validating new mapping. @@ -2779,7 +2759,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, pmap->pm_stats.wired_count--; if (origpte & PG_MANAGED) { om = PHYS_TO_VM_PAGE(opa); - pmap_remove_entry(pmap, om, va); + pv = pmap_pvh_remove(&om->md, pmap, va); } else if (va < VM_MAXUSER_ADDRESS) printf("va=0x%x is unmanaged :-( \n", va); @@ -2798,9 +2778,13 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - pmap_insert_entry(pmap, va, m); + if (pv == NULL) + pv = get_pv_entry(pmap, FALSE); + pv->pv_va = va; + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); pa |= PG_MANAGED; - } + } else if (pv != NULL) + free_pv_entry(pmap, pv); /* * Increment counters @@ -2815,7 +2799,8 @@ validate: newpte = (pt_entry_t)(pa | PG_V); if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((newpte & PG_MANAGED) != 0) + vm_page_flag_set(m, PG_WRITEABLE); } #ifdef PAE if ((prot & VM_PROT_EXECUTE) == 0) @@ -2849,15 +2834,15 @@ validate: invlva = TRUE; #endif } - if (origpte & PG_M) { - KASSERT((origpte & PG_RW), - ("pmap_enter: modified page not writable: va: %#x, pte: %#jx", - va, (uintmax_t)origpte)); + if ((origpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) { if ((origpte & PG_MANAGED) != 0) vm_page_dirty(om); if ((prot & VM_PROT_WRITE) == 0) invlva = TRUE; } + if ((origpte & PG_MANAGED) != 0 && + TAILQ_EMPTY(&om->md.pv_list)) + vm_page_flag_clear(om, PG_WRITEABLE); if (invlva) pmap_invalidate_page(pmap, va); } else{ @@ -3270,8 +3255,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm pd_entry_t srcptepaddr; unsigned ptepindex; - if (addr >= UPT_MIN_ADDRESS) - panic("pmap_copy: invalid to pmap_copy page tables"); + KASSERT(addr < UPT_MIN_ADDRESS, + ("pmap_copy: invalid to pmap_copy page tables")); pdnxt = (addr + NBPDR) & ~PDRMASK; ptepindex = addr >> PDRSHIFT; @@ -3290,8 +3275,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm } srcmpte = PHYS_TO_VM_PAGE(srcptepaddr & PG_FRAME); - if (srcmpte->wire_count == 0) - panic("pmap_copy: source page table page is unused"); + KASSERT(srcmpte->wire_count > 0, + ("pmap_copy: source page table page is unused")); if (pdnxt > end_addr) pdnxt = end_addr; From owner-svn-src-head@FreeBSD.ORG Sun May 30 13:32:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B46E71065677; Sun, 30 May 2010 13:32:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3ED38FC15; Sun, 30 May 2010 13:32: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 o4UDWdg4056718; Sun, 30 May 2010 13:32:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4UDWdLJ056716; Sun, 30 May 2010 13:32:39 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005301332.o4UDWdLJ056716@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 30 May 2010 13:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208654 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 13:32:39 -0000 Author: jilles Date: Sun May 30 13:32:39 2010 New Revision: 208654 URL: http://svn.freebsd.org/changeset/base/208654 Log: devfs(5): Also mention when device nodes on ufs stopped working (6.0), as requested by some people. MFC after: 2 weeks Modified: head/share/man/man5/devfs.5 Modified: head/share/man/man5/devfs.5 ============================================================================== --- head/share/man/man5/devfs.5 Sun May 30 11:28:01 2010 (r208653) +++ head/share/man/man5/devfs.5 Sun May 30 13:32:39 2010 (r208654) @@ -38,7 +38,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 29, 2010 +.Dd May 30, 2010 .Dt DEVFS 5 .Os .Sh NAME @@ -90,9 +90,11 @@ volume located on The .Nm file system first appeared in -.Fx 2.0 -and became the preferred method for accessing devices in -.Fx 5.0 . +.Fx 2.0 . +It became the preferred method for accessing devices in +.Fx 5.0 +and the only method in +.Fx 6.0 . The .Nm manual page first appeared in From owner-svn-src-head@FreeBSD.ORG Sun May 30 14:11:27 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FE7A1065670; Sun, 30 May 2010 14:11:27 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E7828FC0C; Sun, 30 May 2010 14: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 o4UEBRiw065264; Sun, 30 May 2010 14:11:27 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4UEBRYc065260; Sun, 30 May 2010 14:11:27 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005301411.o4UEBRYc065260@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 30 May 2010 14:11: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: r208655 - in head: bin/sh tools/regression/bin/sh/parser X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 14:11:27 -0000 Author: jilles Date: Sun May 30 14:11:27 2010 New Revision: 208655 URL: http://svn.freebsd.org/changeset/base/208655 Log: sh: Change interaction of command substitution and here documents. If a command substitution contains a newline token, this no longer starts here documents of outer commands. This way, we follow POSIX's idea of the command substitution being a separate script more closely. It also matches other shells better and is consistent with newline characters in quotes not starting here documents. The extension tested in parser/heredoc3.0 ($(cat <next != NULL) + here = here->next; + here->next = heredoclist; + heredoclist = saveheredoclist; } handler = savehandler; + INTON; if (quoted) USTPUTC(CTLBACKQ | CTLQUOTE, out); else Added: head/tools/regression/bin/sh/parser/heredoc4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/parser/heredoc4.0 Sun May 30 14:11:27 2010 (r208655) @@ -0,0 +1,44 @@ +# $FreeBSD$ + +failures=0 + +check() { + if ! eval "[ $* ]"; then + echo "Failed: $*" + : $((failures += 1)) + fi +} + +f() { + cat < Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 638EF1065673; Sun, 30 May 2010 14:20:32 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5292F8FC14; Sun, 30 May 2010 14:20: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 o4UEKWfp067289; Sun, 30 May 2010 14:20:32 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4UEKWXv067286; Sun, 30 May 2010 14:20:32 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201005301420.o4UEKWXv067286@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 30 May 2010 14:20: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: r208656 - in head: bin/sh tools/regression/bin/sh/parser X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 14:20:32 -0000 Author: jilles Date: Sun May 30 14:20:32 2010 New Revision: 208656 URL: http://svn.freebsd.org/changeset/base/208656 Log: sh: Fix a crash if a heredoc was not properly ended and parsing continued. Example (in interactive mode): cat </dev/null; command eval : hi \${r:=0} +exit ${r:-3} From owner-svn-src-head@FreeBSD.ORG Sun May 30 18:48:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B957B106566B; Sun, 30 May 2010 18:48:41 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E7398FC17; Sun, 30 May 2010 18:48: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 o4UImfCH025936; Sun, 30 May 2010 18:48:41 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4UImfXE025932; Sun, 30 May 2010 18:48:41 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005301848.o4UImfXE025932@svn.freebsd.org> From: Alan Cox Date: Sun, 30 May 2010 18:48: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: r208657 - in head/sys: amd64/amd64 i386/i386 i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 18:48:41 -0000 Author: alc Date: Sun May 30 18:48:41 2010 New Revision: 208657 URL: http://svn.freebsd.org/changeset/base/208657 Log: Simplify the inner loop of pmap_collect(): While iterating over the page's pv list, there is no point in checking whether or not the pv list is empty. Instead, wait until the loop completes. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun May 30 14:20:32 2010 (r208656) +++ head/sys/amd64/amd64/pmap.c Sun May 30 18:48:41 2010 (r208657) @@ -2041,7 +2041,6 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_coll static void pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq) { - struct md_page *pvh; pd_entry_t *pde; pmap_t pmap; pt_entry_t *pte, tpte; @@ -2077,15 +2076,13 @@ pmap_collect(pmap_t locked_pmap, struct pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - } free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list) && + TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sun May 30 14:20:32 2010 (r208656) +++ head/sys/i386/i386/pmap.c Sun May 30 18:48:41 2010 (r208657) @@ -2147,7 +2147,6 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_coll static void pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq) { - struct md_page *pvh; pd_entry_t *pde; pmap_t pmap; pt_entry_t *pte, tpte; @@ -2184,15 +2183,13 @@ pmap_collect(pmap_t locked_pmap, struct pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - } free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list) && + TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } sched_unpin(); } Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Sun May 30 14:20:32 2010 (r208656) +++ head/sys/i386/xen/pmap.c Sun May 30 18:48:41 2010 (r208657) @@ -2078,12 +2078,12 @@ pmap_collect(pmap_t locked_pmap, struct pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } sched_unpin(); } From owner-svn-src-head@FreeBSD.ORG Sun May 30 20:31:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4458106566B; Sun, 30 May 2010 20:31:12 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2F2E8FC13; Sun, 30 May 2010 20:31: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 o4UKVCbL048679; Sun, 30 May 2010 20:31:12 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4UKVCpQ048675; Sun, 30 May 2010 20:31:12 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005302031.o4UKVCpQ048675@svn.freebsd.org> From: Alan Cox Date: Sun, 30 May 2010 20:31: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: r208659 - in head/sys: ia64/ia64 mips/mips sun4v/sun4v X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2010 20:31:13 -0000 Author: alc Date: Sun May 30 20:31:12 2010 New Revision: 208659 URL: http://svn.freebsd.org/changeset/base/208659 Log: Simplify the inner loop of get_pv_entry(): While iterating over the page's pv list, there is no point in checking whether or not the pv list is empty, wait instead until the loop completes. Modified: head/sys/ia64/ia64/pmap.c head/sys/mips/mips/pmap.c head/sys/sun4v/sun4v/pmap.c Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Sun May 30 19:34:20 2010 (r208658) +++ head/sys/ia64/ia64/pmap.c Sun May 30 20:31:12 2010 (r208659) @@ -800,8 +800,6 @@ retry: TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); m->md.pv_list_count--; TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); if (allocated_pv == NULL) @@ -809,6 +807,8 @@ retry: else free_pv_entry(pv); } + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } if (allocated_pv == NULL) { if (vpq == &vm_page_queues[PQ_INACTIVE]) { Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sun May 30 19:34:20 2010 (r208658) +++ head/sys/mips/mips/pmap.c Sun May 30 20:31:12 2010 (r208659) @@ -1342,10 +1342,6 @@ retry: TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); m->md.pv_list_count--; TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) { - vm_page_flag_clear(m, PG_WRITEABLE); - m->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); - } pmap_unuse_pt(pmap, va, pv->pv_ptem); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); @@ -1354,6 +1350,10 @@ retry: else free_pv_entry(pv); } + if (TAILQ_EMPTY(&m->md.pv_list)) { + vm_page_flag_clear(m, PG_WRITEABLE); + m->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); + } } if (allocated_pv == NULL) { if (vpq == &vm_page_queues[PQ_INACTIVE]) { Modified: head/sys/sun4v/sun4v/pmap.c ============================================================================== --- head/sys/sun4v/sun4v/pmap.c Sun May 30 19:34:20 2010 (r208658) +++ head/sys/sun4v/sun4v/pmap.c Sun May 30 20:31:12 2010 (r208659) @@ -341,8 +341,6 @@ retry: pmap_invalidate_page(pmap, va, TRUE); TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); m->md.pv_list_count--; if (pmap != locked_pmap) @@ -352,6 +350,8 @@ retry: else free_pv_entry(pv); } + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } if (allocated_pv == NULL) { if (vpq == &vm_page_queues[PQ_INACTIVE]) { From owner-svn-src-head@FreeBSD.ORG Mon May 31 01:43:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 737B51065672; Mon, 31 May 2010 01:43:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60AFD8FC08; Mon, 31 May 2010 01:43: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 o4V1h2Mx023004; Mon, 31 May 2010 01:43:02 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4V1h2gU023002; Mon, 31 May 2010 01:43:02 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005310143.o4V1h2gU023002@svn.freebsd.org> From: Alan Cox Date: Mon, 31 May 2010 01:43: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: r208665 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 01:43:02 -0000 Author: alc Date: Mon May 31 01:43:02 2010 New Revision: 208665 URL: http://svn.freebsd.org/changeset/base/208665 Log: Merge portions of r208645 and supporting code from the i386 pmap: When I pushed down the page queues lock into pmap_is_modified(), I created an ordering dependence: A pmap operation that clears PG_WRITEABLE and calls vm_page_dirty() must perform the call first. Otherwise, pmap_is_modified() could return FALSE without acquiring the page queues lock because the page is not (currently) writeable, and the caller to pmap_is_modified() might believe that the page's dirty field is clear because it has not seen the effect of the vm_page_dirty() call. When I pushed down the page queues lock into pmap_is_modified(), I overlooked one place where this ordering dependence is violated: pmap_enter(). In a rare situation pmap_enter() can be called to replace a dirty mapping to one page with a mapping to another page. (I say rare because replacements generally occur as a result of a copy-on-write fault, and so the old page is not dirty.) This change delays clearing PG_WRITEABLE until after vm_page_dirty() has been called. Fixing the ordering dependency also makes it easy to introduce a small optimization: When pmap_enter() used to replace a mapping to one page with a mapping to another page, it freed the pv entry for the first mapping and later called the pv entry allocator for the new mapping. Now, pmap_enter() attempts to recycle the old pv entry, saving two calls to the pv entry allocator. Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sun May 30 23:05:02 2010 (r208664) +++ head/sys/mips/mips/pmap.c Mon May 31 01:43:02 2010 (r208665) @@ -163,6 +163,9 @@ static int pv_entry_count = 0, pv_entry_ static PMAP_INLINE void free_pv_entry(pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap); +static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); +static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, + vm_offset_t va); static __inline void pmap_changebit(vm_page_t m, int bit, boolean_t setem); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, @@ -171,9 +174,6 @@ static int pmap_remove_pte(struct pmap * static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); static boolean_t pmap_testbit(vm_page_t m, int bit); -static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, - vm_page_t m, boolean_t wired); static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_page_t mpte, vm_offset_t va, vm_page_t m); @@ -1385,15 +1385,15 @@ retry: * the entry. In either case we free the now unused entry. */ -static void -pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va) +static pv_entry_t +pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va) { pv_entry_t pv; PMAP_LOCK_ASSERT(pmap, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED); - if (m->md.pv_list_count < pmap->pm_stats.resident_count) { - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + if (pvh->pv_list_count < pmap->pm_stats.resident_count) { + TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) { if (pmap == pv->pv_pmap && va == pv->pv_va) break; } @@ -1403,39 +1403,33 @@ pmap_remove_entry(struct pmap *pmap, vm_ break; } } + if (pv != NULL) { + TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); + pvh->pv_list_count--; + TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); + } + return (pv); +} - KASSERT(pv != NULL, ("pmap_remove_entry: pv not found, pa %lx va %lx", - (u_long)VM_PAGE_TO_PHYS(m), (u_long)va)); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - m->md.pv_list_count--; - if (TAILQ_FIRST(&m->md.pv_list) == NULL) - vm_page_flag_clear(m, PG_WRITEABLE); +static void +pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va) +{ + pv_entry_t pv; - TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); + pv = pmap_pvh_remove(pvh, pmap, va); + KASSERT(pv != NULL, ("pmap_pvh_free: pv not found, pa %lx va %lx", + (u_long)VM_PAGE_TO_PHYS(m), (u_long)va)); free_pv_entry(pv); } -/* - * Create a pv entry for page at pa for - * (pmap, va). - */ static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m, - boolean_t wired) +pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) { - pv_entry_t pv; - - pv = get_pv_entry(pmap); - pv->pv_va = va; - pv->pv_pmap = pmap; - pv->pv_ptem = mpte; - pv->pv_wired = wired; - PMAP_LOCK_ASSERT(pmap, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED); - TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); - m->md.pv_list_count++; + pmap_pvh_free(&m->md, pmap, va); + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } /* @@ -1740,6 +1734,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, opa; register pt_entry_t *pte; pt_entry_t origpte, newpte; + pv_entry_t pv; vm_page_t mpte, om; int rw = 0; @@ -1815,6 +1810,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, } goto validate; } + + pv = NULL; + /* * Mapping has changed, invalidate old range and fall through to * handle validating new mapping. @@ -1825,7 +1823,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (page_is_managed(opa)) { om = PHYS_TO_VM_PAGE(opa); - pmap_remove_entry(pmap, om, va); + pv = pmap_pvh_remove(&om->md, pmap, va); } if (mpte != NULL) { mpte->wire_count--; @@ -1844,8 +1842,18 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, ("pmap_enter: managed mapping within the clean submap")); - pmap_insert_entry(pmap, va, mpte, m, wired); - } + if (pv == NULL) + pv = get_pv_entry(pmap); + pv->pv_va = va; + pv->pv_pmap = pmap; + pv->pv_ptem = mpte; + pv->pv_wired = wired; + TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + m->md.pv_list_count++; + } else if (pv != NULL) + free_pv_entry(pv); + /* * Increment counters */ @@ -1897,6 +1905,9 @@ validate: if (page_is_managed(opa)) vm_page_dirty(om); } + if (page_is_managed(opa) && + TAILQ_EMPTY(&om->md.pv_list)) + vm_page_flag_clear(om, PG_WRITEABLE); } else { *pte = newpte; } From owner-svn-src-head@FreeBSD.ORG Mon May 31 06:06:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18EC91065679; Mon, 31 May 2010 06:06:11 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E201A8FC1E; Mon, 31 May 2010 06: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 o4V66Afk080773; Mon, 31 May 2010 06:06:10 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4V66Aji080767; Mon, 31 May 2010 06:06:10 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005310606.o4V66Aji080767@svn.freebsd.org> From: Alan Cox Date: Mon, 31 May 2010 06:06: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: r208667 - in head/sys: amd64/amd64 i386/i386 i386/xen mips/mips sun4v/sun4v X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 06:06:11 -0000 Author: alc Date: Mon May 31 06:06:10 2010 New Revision: 208667 URL: http://svn.freebsd.org/changeset/base/208667 Log: Eliminate a stale comment. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/mips/mips/pmap.c head/sys/sun4v/sun4v/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon May 31 05:35:46 2010 (r208666) +++ head/sys/amd64/amd64/pmap.c Mon May 31 06:06:10 2010 (r208667) @@ -3187,10 +3187,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (mpte) mpte->wire_count--; - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. - */ if (origpte & PG_MANAGED) { om = m; pa |= PG_MANAGED; Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon May 31 05:35:46 2010 (r208666) +++ head/sys/i386/i386/pmap.c Mon May 31 06:06:10 2010 (r208667) @@ -3323,10 +3323,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (mpte) mpte->wire_count--; - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. - */ if (origpte & PG_MANAGED) { om = m; pa |= PG_MANAGED; Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Mon May 31 05:35:46 2010 (r208666) +++ head/sys/i386/xen/pmap.c Mon May 31 06:06:10 2010 (r208667) @@ -2737,10 +2737,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (mpte) mpte->wire_count--; - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. - */ if (origpte & PG_MANAGED) { om = m; pa |= PG_MANAGED; Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Mon May 31 05:35:46 2010 (r208666) +++ head/sys/mips/mips/pmap.c Mon May 31 06:06:10 2010 (r208667) @@ -1801,10 +1801,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (mpte) mpte->wire_count--; - /* - * We might be turning off write access to the page, so we - * go ahead and sense modify status. - */ if (page_is_managed(opa)) { om = m; } Modified: head/sys/sun4v/sun4v/pmap.c ============================================================================== --- head/sys/sun4v/sun4v/pmap.c Mon May 31 05:35:46 2010 (r208666) +++ head/sys/sun4v/sun4v/pmap.c Mon May 31 06:06:10 2010 (r208667) @@ -1133,10 +1133,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, else if (!wired && (otte_data & VTD_WIRED)) pmap->pm_stats.wired_count--; - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. - */ if (otte_data & VTD_MANAGED) { om = m; tte_data |= VTD_MANAGED; From owner-svn-src-head@FreeBSD.ORG Mon May 31 09:06:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 908CA1065676; Mon, 31 May 2010 09:06:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 801C58FC13; Mon, 31 May 2010 09:06: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 o4V963h9020342; Mon, 31 May 2010 09:06:03 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4V963LD020340; Mon, 31 May 2010 09:06:03 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201005310906.o4V963LD020340@svn.freebsd.org> From: Andriy Gapon Date: Mon, 31 May 2010 09:06: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: r208669 - head/sys/boot/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 09:06:03 -0000 Author: avg Date: Mon May 31 09:06:03 2010 New Revision: 208669 URL: http://svn.freebsd.org/changeset/base/208669 Log: zfs boot: fix error handling in zfs_readdir Found by: clang static analyzer MFC after: 4 days Modified: head/sys/boot/zfs/zfs.c Modified: head/sys/boot/zfs/zfs.c ============================================================================== --- head/sys/boot/zfs/zfs.c Mon May 31 07:14:40 2010 (r208668) +++ head/sys/boot/zfs/zfs.c Mon May 31 09:06:03 2010 (r208669) @@ -265,6 +265,8 @@ zfs_readdir(struct open_file *f, struct rc = dnode_read(spa, &fp->f_dnode, fp->f_seekp, &mze, sizeof(mze)); + if (rc) + return (rc); fp->f_seekp += sizeof(mze); if (!mze.mze_name[0]) From owner-svn-src-head@FreeBSD.ORG Mon May 31 09:07:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9B901065670; Mon, 31 May 2010 09:07:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B93BF8FC1A; Mon, 31 May 2010 09:07: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 o4V97N87020677; Mon, 31 May 2010 09:07:23 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4V97NBr020675; Mon, 31 May 2010 09:07:23 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201005310907.o4V97NBr020675@svn.freebsd.org> From: Andriy Gapon Date: Mon, 31 May 2010 09:07: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: r208670 - head/sys/dev/amdsbwd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 09:07:23 -0000 Author: avg Date: Mon May 31 09:07:23 2010 New Revision: 208670 URL: http://svn.freebsd.org/changeset/base/208670 Log: amdsbwd: fix nonsensical timeout calculations in case when sub-second interval is being programmed Found by: clang static analyzer MFC after: 4 days Modified: head/sys/dev/amdsbwd/amdsbwd.c Modified: head/sys/dev/amdsbwd/amdsbwd.c ============================================================================== --- head/sys/dev/amdsbwd/amdsbwd.c Mon May 31 09:06:03 2010 (r208669) +++ head/sys/dev/amdsbwd/amdsbwd.c Mon May 31 09:07:23 2010 (r208670) @@ -230,10 +230,10 @@ amdsbwd_event(void *arg, unsigned int cm cmd &= WD_INTERVAL; if (cmd < WD_TO_1SEC) cmd = 0; - timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick; - if (timeout > sc->max_ticks) - timeout = sc->max_ticks; if (cmd) { + timeout = ((uint64_t)1 << (cmd - WD_TO_1MS)) / sc->ms_per_tick; + if (timeout > sc->max_ticks) + timeout = sc->max_ticks; if (timeout != sc->timeout) { amdsbwd_tmr_set(sc, timeout); if (!sc->active) From owner-svn-src-head@FreeBSD.ORG Mon May 31 09:08:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0DE71065676; Mon, 31 May 2010 09:08:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B03318FC28; Mon, 31 May 2010 09:08: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 o4V98imw020979; Mon, 31 May 2010 09:08:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4V98ibF020977; Mon, 31 May 2010 09:08:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201005310908.o4V98ibF020977@svn.freebsd.org> From: Andriy Gapon Date: Mon, 31 May 2010 09:08: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: r208671 - head/sys/fs/udf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 09:08:44 -0000 Author: avg Date: Mon May 31 09:08:44 2010 New Revision: 208671 URL: http://svn.freebsd.org/changeset/base/208671 Log: udf_readlink: fix malloc call with uninitialized size parameter Found by: clang static analyzer MFC after: 4 days Modified: head/sys/fs/udf/udf_vnops.c Modified: head/sys/fs/udf/udf_vnops.c ============================================================================== --- head/sys/fs/udf/udf_vnops.c Mon May 31 09:07:23 2010 (r208670) +++ head/sys/fs/udf/udf_vnops.c Mon May 31 09:08:44 2010 (r208671) @@ -904,9 +904,9 @@ udf_readlink(struct vop_readlink_args *a vp = ap->a_vp; node = VTON(vp); len = le64toh(node->fentry->inf_len); + iov[0].iov_len = len; buf = malloc(iov[0].iov_len, M_DEVBUF, M_WAITOK); iov[0].iov_base = buf; - iov[0].iov_len = len; uio.uio_iov = iov; uio.uio_iovcnt = 1; uio.uio_offset = 0; From owner-svn-src-head@FreeBSD.ORG Mon May 31 09:10:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02EB21065673; Mon, 31 May 2010 09:10:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E67918FC17; Mon, 31 May 2010 09:10: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 o4V9AdHW021450; Mon, 31 May 2010 09:10:39 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4V9AdQU021448; Mon, 31 May 2010 09:10:39 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201005310910.o4V9AdQU021448@svn.freebsd.org> From: Andriy Gapon Date: Mon, 31 May 2010 09:10:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208672 - head/sys/geom/label X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 09:10:40 -0000 Author: avg Date: Mon May 31 09:10:39 2010 New Revision: 208672 URL: http://svn.freebsd.org/changeset/base/208672 Log: g_label: fix possible NULL pointer dereference in case glabel debug level is >= 1 and gp->provider list is empty for some reason Found by: clang static analyzer MFC after: 4 days Modified: head/sys/geom/label/g_label.c Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Mon May 31 09:08:44 2010 (r208671) +++ head/sys/geom/label/g_label.c Mon May 31 09:10:39 2010 (r208672) @@ -203,10 +203,8 @@ g_label_destroy(struct g_geom *gp, boole pp->acr, pp->acw, pp->ace); return (EBUSY); } - } else { - G_LABEL_DEBUG(1, "Label %s removed.", - LIST_FIRST(&gp->provider)->name); - } + } else if (pp != NULL) + G_LABEL_DEBUG(1, "Label %s removed.", pp->name); g_slice_spoiled(LIST_FIRST(&gp->consumer)); return (0); } From owner-svn-src-head@FreeBSD.ORG Mon May 31 23:11:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3FA11065675; Mon, 31 May 2010 23:11:43 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E381F8FC1E; Mon, 31 May 2010 23:11: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 o4VNBhLb050770; Mon, 31 May 2010 23:11:43 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4VNBhA7050768; Mon, 31 May 2010 23:11:43 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201005312311.o4VNBhA7050768@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 31 May 2010 23:11: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: r208682 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 23:11:44 -0000 Author: pjd Date: Mon May 31 23:11:43 2010 New Revision: 208682 URL: http://svn.freebsd.org/changeset/base/208682 Log: Fix panic when reading label from provider with non power of 2 sector size. Reported by: James R. Van Artsdalen MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c 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 Mon May 31 22:29:48 2010 (r208681) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon May 31 23:11:43 2010 (r208682) @@ -183,7 +183,7 @@ vdev_geom_io(struct g_consumer *cp, int { struct bio *bp; u_char *p; - off_t off; + off_t off, maxio; int error; ASSERT((offset % cp->provider->sectorsize) == 0); @@ -193,14 +193,15 @@ vdev_geom_io(struct g_consumer *cp, int off = offset; offset += size; p = data; + maxio = MAXPHYS - (MAXPHYS % cp->provider->sectorsize); error = 0; - for (; off < offset; off += MAXPHYS, p += MAXPHYS, size -= MAXPHYS) { + for (; off < offset; off += maxio, p += maxio, size -= maxio) { bzero(bp, sizeof(*bp)); bp->bio_cmd = cmd; bp->bio_done = NULL; bp->bio_offset = off; - bp->bio_length = MIN(size, MAXPHYS); + bp->bio_length = MIN(size, maxio); bp->bio_data = p; g_io_request(bp, cp); error = biowait(bp, "vdev_geom_io"); From owner-svn-src-head@FreeBSD.ORG Mon May 31 23:17:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5DF41065675; Mon, 31 May 2010 23:17:45 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 957238FC12; Mon, 31 May 2010 23:17: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 o4VNHjE5052112; Mon, 31 May 2010 23:17:45 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4VNHjRB052110; Mon, 31 May 2010 23:17:45 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201005312317.o4VNHjRB052110@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 31 May 2010 23:17: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: r208683 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 23:17:45 -0000 Author: pjd Date: Mon May 31 23:17:45 2010 New Revision: 208683 URL: http://svn.freebsd.org/changeset/base/208683 Log: Fix a bug where resilver is not started automatically on pool import or load. If disk was missing on pool load or import and on next pool load or import it was present, resilver wasn't started automatically and ZFS reported all disks as ONLINE and healthy. Then, when another disk died, pool became unaccessible, because if it was 2-way mirror or RAIDZ1 two vdevs were out of sync. To fix the problem, start resilver automatically on pool load or import. Obtained from: OpenSolaris MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon May 31 23:11:43 2010 (r208682) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Mon May 31 23:17:45 2010 (r208683) @@ -1425,6 +1425,12 @@ spa_load(spa_t *spa, nvlist_t *config, s */ if (need_update) spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE); + + /* + * Check all DTLs to see if anything needs resilvering. + */ + if (vdev_resilver_needed(rvd, NULL, NULL)) + spa_async_request(spa, SPA_ASYNC_RESILVER); } error = 0; From owner-svn-src-head@FreeBSD.ORG Mon May 31 23:29:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7F54106564A; Mon, 31 May 2010 23:29:56 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 979038FC13; Mon, 31 May 2010 23:29: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 o4VNTuDo054796; Mon, 31 May 2010 23:29:56 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4VNTubK054794; Mon, 31 May 2010 23:29:56 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201005312329.o4VNTubK054794@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 31 May 2010 23:29: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: r208684 - head/cddl/contrib/opensolaris/lib/libzfs/common X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2010 23:29:56 -0000 Author: pjd Date: Mon May 31 23:29:56 2010 New Revision: 208684 URL: http://svn.freebsd.org/changeset/base/208684 Log: Allow to use 'jailed' property again. Reported by: Eugene Mitrofanov MFC after: 3 days Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon May 31 23:17:45 2010 (r208683) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Mon May 31 23:29:56 2010 (r208684) @@ -1791,7 +1791,6 @@ zfs_prop_set(zfs_handle_t *zhp, const ch /* We don't support those properties on FreeBSD. */ switch (prop) { case ZFS_PROP_DEVICES: - case ZFS_PROP_ZONED: case ZFS_PROP_SHAREISCSI: case ZFS_PROP_ISCSIOPTIONS: case ZFS_PROP_XATTR: From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 04:38:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59174106564A; Tue, 1 Jun 2010 04:38:05 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 481CE8FC0A; Tue, 1 Jun 2010 04:38: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 o514c5XE022458; Tue, 1 Jun 2010 04:38:05 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o514c5Pd022456; Tue, 1 Jun 2010 04:38:05 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006010438.o514c5Pd022456@svn.freebsd.org> From: Alan Cox Date: Tue, 1 Jun 2010 04:38: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: r208686 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 04:38:05 -0000 Author: alc Date: Tue Jun 1 04:38:05 2010 New Revision: 208686 URL: http://svn.freebsd.org/changeset/base/208686 Log: Fix a KASSERT() that was broken in r208665. Reported by: jmallett Modified: head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Mon May 31 23:58:36 2010 (r208685) +++ head/sys/mips/mips/pmap.c Tue Jun 1 04:38:05 2010 (r208686) @@ -1418,7 +1418,8 @@ pmap_pvh_free(struct md_page *pvh, pmap_ pv = pmap_pvh_remove(pvh, pmap, va); KASSERT(pv != NULL, ("pmap_pvh_free: pv not found, pa %lx va %lx", - (u_long)VM_PAGE_TO_PHYS(m), (u_long)va)); + (u_long)VM_PAGE_TO_PHYS(member2struct(vm_page, md, pvh)), + (u_long)va)); free_pv_entry(pv); } From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 05:19:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD32E1068709; Tue, 1 Jun 2010 05:18:48 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB5248FC12; Tue, 1 Jun 2010 05:18: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 o515Imjq031326; Tue, 1 Jun 2010 05:18:48 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o515Im1v031324; Tue, 1 Jun 2010 05:18:48 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006010518.o515Im1v031324@svn.freebsd.org> From: Alan Cox Date: Tue, 1 Jun 2010 05:18: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: r208687 - head/sys/sun4v/sun4v X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 05:19:28 -0000 Author: alc Date: Tue Jun 1 05:18:48 2010 New Revision: 208687 URL: http://svn.freebsd.org/changeset/base/208687 Log: Merge portions of r208645 and supporting code from the i386 pmap: When I pushed down the page queues lock into pmap_is_modified(), I created an ordering dependence: A pmap operation that clears PG_WRITEABLE and calls vm_page_dirty() must perform the call first. Otherwise, pmap_is_modified() could return FALSE without acquiring the page queues lock because the page is not (currently) writeable, and the caller to pmap_is_modified() might believe that the page's dirty field is clear because it has not seen the effect of the vm_page_dirty() call. When I pushed down the page queues lock into pmap_is_modified(), I overlooked one place where this ordering dependence is violated: pmap_enter(). In a rare situation pmap_enter() can be called to replace a dirty mapping to one page with a mapping to another page. (I say rare because replacements generally occur as a result of a copy-on-write fault, and so the old page is not dirty.) This change delays clearing PG_WRITEABLE until after vm_page_dirty() has been called. Fixing the ordering dependency also makes it easy to introduce a small optimization: When pmap_enter() used to replace a mapping to one page with a mapping to another page, it freed the pv entry for the first mapping and later called the pv entry allocator for the new mapping. Now, pmap_enter() attempts to recycle the old pv entry, saving two calls to the pv entry allocator. There is no point in setting PG_WRITEABLE on unmanaged pages, so don't. Modified: head/sys/sun4v/sun4v/pmap.c Modified: head/sys/sun4v/sun4v/pmap.c ============================================================================== --- head/sys/sun4v/sun4v/pmap.c Tue Jun 1 04:38:05 2010 (r208686) +++ head/sys/sun4v/sun4v/pmap.c Tue Jun 1 05:18:48 2010 (r208687) @@ -189,6 +189,9 @@ if (pmap_debug) printf static void free_pv_entry(pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t locked_pmap); +static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); +static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, + vm_offset_t va); static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m); static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); @@ -1077,6 +1080,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, { vm_paddr_t pa, opa; uint64_t tte_data, otte_data; + pv_entry_t pv; vm_page_t om; int invlva; @@ -1103,6 +1107,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, pmap_add_tte(pmap, va, m, &tte_data, wired); } else if (pa != opa) { + pv = NULL; /* * Mapping has changed, handle validating new mapping. * @@ -1112,10 +1117,23 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if (otte_data & VTD_MANAGED) { om = PHYS_TO_VM_PAGE(opa); - pmap_remove_entry(pmap, om, va); + pv = pmap_pvh_remove(&om->md, pmap, va); } - pmap_add_tte(pmap, va, m, &tte_data, wired); + if (wired) + pmap->pm_stats.wired_count++; + + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { + if (pv == NULL) + pv = get_pv_entry(pmap); + pv->pv_va = va; + pv->pv_pmap = pmap; + TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); + TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); + m->md.pv_list_count++; + tte_data |= VTD_MANAGED; + } else if (pv != NULL) + free_pv_entry(pv); } else /* (pa == opa) */ { /* @@ -1144,7 +1162,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, */ if ((prot & VM_PROT_WRITE) != 0) { tte_data |= VTD_SW_W; - vm_page_flag_set(m, PG_WRITEABLE); + if ((tte_data & VTD_MANAGED) != 0) + vm_page_flag_set(m, PG_WRITEABLE); } if ((prot & VM_PROT_EXECUTE) != 0) tte_data |= VTD_X; @@ -1168,6 +1187,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, if ((pa & VTD_SW_W) != 0) invlva = TRUE; } + if ((otte_data & VTD_MANAGED) != 0 && + TAILQ_EMPTY(&om->md.pv_list)) + vm_page_flag_clear(om, PG_WRITEABLE); if (invlva) pmap_invalidate_page(pmap, va, TRUE); } @@ -2047,16 +2069,17 @@ pmap_remove_all(vm_page_t m) vm_page_unlock_queues(); } -static void -pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) +static pv_entry_t +pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va) { pv_entry_t pv; if (pmap != kernel_pmap) - DPRINTF("pmap_remove_entry(va=0x%lx, pa=0x%lx)\n", va, VM_PAGE_TO_PHYS(m)); + DPRINTF("pmap_pvh_remove(va=0x%lx, pa=0x%lx)\n", va, + VM_PAGE_TO_PHYS(member2struct(vm_page, md, pvh))); PMAP_LOCK_ASSERT(pmap, MA_OWNED); mtx_assert(&vm_page_queue_mtx, MA_OWNED); - if (m->md.pv_list_count < pmap->pm_stats.resident_count) { - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { + if (pvh->pv_list_count < pmap->pm_stats.resident_count) { + TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) { if (pmap == pv->pv_pmap && va == pv->pv_va) break; } @@ -2066,13 +2089,33 @@ pmap_remove_entry(pmap_t pmap, vm_page_t break; } } - KASSERT(pv != NULL, ("pmap_remove_entry: pv not found va=0x%lx pa=0x%lx", va, VM_PAGE_TO_PHYS(m))); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - m->md.pv_list_count--; + if (pv != NULL) { + TAILQ_REMOVE(&pvh->pv_list, pv, pv_list); + pvh->pv_list_count--; + TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); + } + return (pv); +} + +static void +pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va) +{ + pv_entry_t pv; + + pv = pmap_pvh_remove(pvh, pmap, va); + KASSERT(pv != NULL, ("pmap_pvh_free: pv not found va=0x%lx pa=0x%lx", + va, VM_PAGE_TO_PHYS(member2struct(vm_page, md, pvh)))); + free_pv_entry(pv); +} + +static void +pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) +{ + + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + pmap_pvh_free(&m->md, pmap, va); if (TAILQ_EMPTY(&m->md.pv_list)) vm_page_flag_clear(m, PG_WRITEABLE); - TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); - free_pv_entry(pv); } From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 05:33:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C1EC1065670; Tue, 1 Jun 2010 05:33:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F71A8FC22; Tue, 1 Jun 2010 05:33: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 o515X0cF034503; Tue, 1 Jun 2010 05:33:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o515X05Z034501; Tue, 1 Jun 2010 05:33:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006010533.o515X05Z034501@svn.freebsd.org> From: Alan Cox Date: Tue, 1 Jun 2010 05:33: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: r208688 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 05:33:00 -0000 Author: alc Date: Tue Jun 1 05:32:59 2010 New Revision: 208688 URL: http://svn.freebsd.org/changeset/base/208688 Log: In pmap_enter_locked(), don't require the vector page to be VPO_BUSY. Modified: head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Tue Jun 1 05:18:48 2010 (r208687) +++ head/sys/arm/arm/pmap.c Tue Jun 1 05:32:59 2010 (r208688) @@ -3318,15 +3318,16 @@ pmap_enter_locked(pmap_t pmap, vm_offset u_int oflags; vm_paddr_t pa; - KASSERT((m->oflags & VPO_BUSY) != 0 || (flags & M_NOWAIT) != 0, - ("pmap_enter_locked: page %p is not busy", m)); PMAP_ASSERT_LOCKED(pmap); mtx_assert(&vm_page_queue_mtx, MA_OWNED); if (va == vector_page) { pa = systempage.pv_pa; m = NULL; - } else + } else { + KASSERT((m->oflags & VPO_BUSY) != 0 || (flags & M_NOWAIT) != 0, + ("pmap_enter_locked: page %p is not busy", m)); pa = VM_PAGE_TO_PHYS(m); + } nflags = 0; if (prot & VM_PROT_WRITE) nflags |= PVF_WRITE; From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 08:43:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C659C1065676; Tue, 1 Jun 2010 08:43:46 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABE648FC14; Tue, 1 Jun 2010 08:43: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 o518hkiO076210; Tue, 1 Jun 2010 08:43:46 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o518hkZi076208; Tue, 1 Jun 2010 08:43:46 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201006010843.o518hkZi076208@svn.freebsd.org> From: Martin Matuska Date: Tue, 1 Jun 2010 08:43: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: r208689 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 08:43:47 -0000 Author: mm Date: Tue Jun 1 08:43:46 2010 New Revision: 208689 URL: http://svn.freebsd.org/changeset/base/208689 Log: Fix ZIL close when doing zfs rollback or zfs receive on a mounted dataset. The fix is a partial import and merge of OpenSolaris onnv revisions 8227:f7d7be9b1f56. and 9292:e112194b5b73 Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID 6798298) MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Jun 1 05:32:59 2010 (r208688) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Jun 1 08:43:46 2010 (r208689) @@ -499,6 +499,12 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t dmu_objset_set_user(zfsvfs->z_os, zfsvfs); mutex_exit(&zfsvfs->z_os->os->os_user_ptr_lock); + zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); + if (zil_disable) { + zil_destroy(zfsvfs->z_log, B_FALSE); + zfsvfs->z_log = NULL; + } + /* * If we are not mounting (ie: online recv), then we don't * have to worry about replaying the log as we blocked all @@ -512,21 +518,45 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t * allow replays to succeed. */ readonly = zfsvfs->z_vfs->vfs_flag & VFS_RDONLY; - zfsvfs->z_vfs->vfs_flag &= ~VFS_RDONLY; - - /* - * Parse and replay the intent log. - */ - zil_replay(zfsvfs->z_os, zfsvfs, &zfsvfs->z_assign, - zfs_replay_vector, zfs_unlinked_drain); + if (readonly != 0) + zfsvfs->z_vfs->vfs_flag &= ~VFS_RDONLY; + else + zfs_unlinked_drain(zfsvfs); - zfs_unlinked_drain(zfsvfs); + if (zfsvfs->z_log) { + /* + * Parse and replay the intent log. + * + * Because of ziltest, this must be done after + * zfs_unlinked_drain(). (Further note: ziltest + * doesn't use readonly mounts, where + * zfs_unlinked_drain() isn't called.) This is because + * ziltest causes spa_sync() to think it's committed, + * but actually it is not, so the intent log contains + * many txg's worth of changes. + * + * In particular, if object N is in the unlinked set in + * the last txg to actually sync, then it could be + * actually freed in a later txg and then reallocated + * in a yet later txg. This would write a "create + * object N" record to the intent log. Normally, this + * would be fine because the spa_sync() would have + * written out the fact that object N is free, before + * we could write the "create object N" intent log + * record. + * + * But when we are in ziltest mode, we advance the "open + * txg" without actually spa_sync()-ing the changes to + * disk. So we would see that object N is still + * allocated and in the unlinked set, and there is an + * intent log record saying to allocate it. + */ + zil_replay(zfsvfs->z_os, zfsvfs, &zfsvfs->z_assign, + zfs_replay_vector, zfs_unlinked_drain); + } zfsvfs->z_vfs->vfs_flag |= readonly; /* restore readonly bit */ } - if (!zil_disable) - zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); - return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 14:04:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 215E01065786; Tue, 1 Jun 2010 14:04:01 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10F508FC39; Tue, 1 Jun 2010 14:04: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 o51E40kl051164; Tue, 1 Jun 2010 14:04:00 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51E40hZ051161; Tue, 1 Jun 2010 14:04:00 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201006011404.o51E40hZ051161@svn.freebsd.org> From: Rui Paulo Date: Tue, 1 Jun 2010 14:04: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: r208693 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 14:04:01 -0000 Author: rpaulo Date: Tue Jun 1 14:04:00 2010 New Revision: 208693 URL: http://svn.freebsd.org/changeset/base/208693 Log: Properly initialize stack variable sr in setmlme_assoc_adhoc(). Found with: Coverity Prevent(tm) CID 4365 MFC after: 3 days Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Tue Jun 1 13:59:48 2010 (r208692) +++ head/sys/net80211/ieee80211_ioctl.c Tue Jun 1 14:04:00 2010 (r208693) @@ -1518,6 +1518,7 @@ setmlme_assoc_adhoc(struct ieee80211vap memcpy(vap->iv_des_ssid[0].ssid, ssid, ssid_len); vap->iv_des_nssid = 1; + memset(&sr, 0, sizeof(sr)); sr.sr_flags = IEEE80211_IOC_SCAN_ACTIVE | IEEE80211_IOC_SCAN_ONCE; sr.sr_duration = IEEE80211_IOC_SCAN_FOREVER; memcpy(sr.sr_ssid[0].ssid, ssid, ssid_len); From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 14:14:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F10E106566C; Tue, 1 Jun 2010 14:14:00 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EC258FC15; Tue, 1 Jun 2010 14:14: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 o51EE0ek053527; Tue, 1 Jun 2010 14:14:00 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51EE0v4053525; Tue, 1 Jun 2010 14:14:00 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201006011414.o51EE0v4053525@svn.freebsd.org> From: Rui Paulo Date: Tue, 1 Jun 2010 14:14: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: r208696 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 14:14:00 -0000 Author: rpaulo Date: Tue Jun 1 14:13:59 2010 New Revision: 208696 URL: http://svn.freebsd.org/changeset/base/208696 Log: Don't reference null pointer in hwmp_recv_preq(). Found with: Coverity Prevent(tm) CID: 3912 MFC after: 3 days Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Tue Jun 1 14:09:35 2010 (r208695) +++ head/sys/net80211/ieee80211_hwmp.c Tue Jun 1 14:13:59 2010 (r208696) @@ -707,6 +707,9 @@ hwmp_recv_preq(struct ieee80211vap *vap, rtorig = ieee80211_mesh_rt_find(vap, preq->preq_origaddr); if (rtorig == NULL) rtorig = ieee80211_mesh_rt_add(vap, preq->preq_origaddr); + if (rtorig == NULL) + /* XXX stat */ + return; hrorig = IEEE80211_MESH_ROUTE_PRIV(rtorig, struct ieee80211_hwmp_route); /* * Sequence number validation. From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 14:17:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DA88106566C; Tue, 1 Jun 2010 14:17:08 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D9A18FC1D; Tue, 1 Jun 2010 14:17: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 o51EH8Vt054274; Tue, 1 Jun 2010 14:17:08 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51EH8wo054272; Tue, 1 Jun 2010 14:17:08 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201006011417.o51EH8wo054272@svn.freebsd.org> From: Rui Paulo Date: Tue, 1 Jun 2010 14:17: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: r208697 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 14:17:08 -0000 Author: rpaulo Date: Tue Jun 1 14:17:08 2010 New Revision: 208697 URL: http://svn.freebsd.org/changeset/base/208697 Log: Compare the address of the array, not the array. Found with: Coverity Prevent(tm) CID: 3690 MFC after: 3 days Modified: head/sys/net80211/ieee80211_scan_sta.c Modified: head/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sta.c Tue Jun 1 14:13:59 2010 (r208696) +++ head/sys/net80211/ieee80211_scan_sta.c Tue Jun 1 14:17:08 2010 (r208697) @@ -1013,7 +1013,7 @@ match_bss(struct ieee80211vap *vap, */ if (se->se_capinfo & (IEEE80211_CAPINFO_IBSS|IEEE80211_CAPINFO_ESS)) fail |= MATCH_CAPINFO; - else if (se->se_meshid == NULL) + else if (&se->se_meshid == NULL) fail |= MATCH_MESH_NOID; else if (ms->ms_idlen != 0 && match_id(se->se_meshid, ms->ms_id, ms->ms_idlen)) From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 14:20:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 321381065673; Tue, 1 Jun 2010 14:20:59 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 220FF8FC1A; Tue, 1 Jun 2010 14:20: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 o51EKx2R055221; Tue, 1 Jun 2010 14:20:59 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51EKxh9055219; Tue, 1 Jun 2010 14:20:59 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201006011420.o51EKxh9055219@svn.freebsd.org> From: Rui Paulo Date: Tue, 1 Jun 2010 14:20: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: r208699 - head/sys/net80211 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 14:20:59 -0000 Author: rpaulo Date: Tue Jun 1 14:20:58 2010 New Revision: 208699 URL: http://svn.freebsd.org/changeset/base/208699 Log: Fix resource leaks in ieee80211_ioctl_setchanlist() in case of error. Found with: Coverity Prevent(tm) CID: 4115 MFC after: 3 days Modified: head/sys/net80211/ieee80211_ioctl.c Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Tue Jun 1 14:18:44 2010 (r208698) +++ head/sys/net80211/ieee80211_ioctl.c Tue Jun 1 14:20:58 2010 (r208699) @@ -1628,8 +1628,10 @@ ieee80211_ioctl_setchanlist(struct ieee8 if (list == NULL) return ENOMEM; error = copyin(ireq->i_data, list, ireq->i_len); - if (error) + if (error) { + free(list, M_TEMP); return error; + } nchan = 0; chanlist = list + ireq->i_len; /* NB: zero'd already */ maxchan = ireq->i_len * NBBY; @@ -1645,8 +1647,10 @@ ieee80211_ioctl_setchanlist(struct ieee8 nchan++; } } - if (nchan == 0) + if (nchan == 0) { + free(list, M_TEMP); return EINVAL; + } if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && /* XXX */ isclr(chanlist, ic->ic_bsschan->ic_ieee)) ic->ic_bsschan = IEEE80211_CHAN_ANYC; From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 14:37:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70E55106568B; Tue, 1 Jun 2010 14:37:11 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B05298FC30; Tue, 1 Jun 2010 14:37: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 o51EbBjA058991; Tue, 1 Jun 2010 14:37:11 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51EbBeO058989; Tue, 1 Jun 2010 14:37:11 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201006011437.o51EbBeO058989@svn.freebsd.org> From: Rui Paulo Date: Tue, 1 Jun 2010 14:37: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: r208703 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 14:37:12 -0000 Author: rpaulo Date: Tue Jun 1 14:37:11 2010 New Revision: 208703 URL: http://svn.freebsd.org/changeset/base/208703 Log: Fix an off by one in ar9285SetPowerCalTable(). Found with: Coverity Prevent(tm) CID: 3979 MFC after: 3 days Modified: head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Tue Jun 1 14:29:26 2010 (r208702) +++ head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Tue Jun 1 14:37:11 2010 (r208703) @@ -634,7 +634,7 @@ ar9285SetPowerCalTable(struct ath_hal *a OS_REG_WRITE(ah, AR_PHY_TPCRG1, (OS_REG_READ(ah, AR_PHY_TPCRG1) & ~(AR_PHY_TPCRG1_NUM_PD_GAIN | AR_PHY_TPCRG1_PD_GAIN_1 | AR_PHY_TPCRG1_PD_GAIN_2 | AR_PHY_TPCRG1_PD_GAIN_3)) | SM(numXpdGain - 1, AR_PHY_TPCRG1_NUM_PD_GAIN) | SM(xpdGainValues[0], AR_PHY_TPCRG1_PD_GAIN_1 ) | - SM(xpdGainValues[1], AR_PHY_TPCRG1_PD_GAIN_2) | SM(xpdGainValues[2], AR_PHY_TPCRG1_PD_GAIN_3)); + SM(xpdGainValues[1], AR_PHY_TPCRG1_PD_GAIN_2) | SM(0, AR_PHY_TPCRG1_PD_GAIN_3)); for (i = 0; i < AR5416_MAX_CHAINS; i++) { From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 15:11:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 471F41065670; Tue, 1 Jun 2010 15:11:30 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 35F078FC12; Tue, 1 Jun 2010 15:11: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 o51FBUI4066816; Tue, 1 Jun 2010 15:11:30 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51FBTBj066804; Tue, 1 Jun 2010 15:11:29 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201006011511.o51FBTBj066804@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 1 Jun 2010 15:11: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: r208709 - head/crypto/openssh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 15:11:30 -0000 Author: des Date: Tue Jun 1 15:11:29 2010 New Revision: 208709 URL: http://svn.freebsd.org/changeset/base/208709 Log: Missing commas Modified: head/crypto/openssh/scp.1 head/crypto/openssh/sftp-server.8 head/crypto/openssh/sftp.1 head/crypto/openssh/ssh-add.1 head/crypto/openssh/ssh-agent.1 head/crypto/openssh/ssh-keygen.1 head/crypto/openssh/ssh-keyscan.1 head/crypto/openssh/ssh.1 head/crypto/openssh/ssh_config.5 head/crypto/openssh/sshd.8 head/crypto/openssh/sshd_config.5 Modified: head/crypto/openssh/scp.1 ============================================================================== --- head/crypto/openssh/scp.1 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/scp.1 Tue Jun 1 15:11:29 2010 (r208709) @@ -11,7 +11,7 @@ .\" .\" $OpenBSD: scp.1,v 1.50 2010/02/08 10:50:20 markus Exp $ .\" -.Dd February 8 2010 +.Dd February 8, 2010 .Dt SCP 1 .Os .Sh NAME Modified: head/crypto/openssh/sftp-server.8 ============================================================================== --- head/crypto/openssh/sftp-server.8 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/sftp-server.8 Tue Jun 1 15:11:29 2010 (r208709) @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 9 2010 +.Dd January 9, 2010 .Dt SFTP-SERVER 8 .Os .Sh NAME Modified: head/crypto/openssh/sftp.1 ============================================================================== --- head/crypto/openssh/sftp.1 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/sftp.1 Tue Jun 1 15:11:29 2010 (r208709) @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd February 8 2010 +.Dd February 8, 2010 .Dt SFTP 1 .Os .Sh NAME Modified: head/crypto/openssh/ssh-add.1 ============================================================================== --- head/crypto/openssh/ssh-add.1 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/ssh-add.1 Tue Jun 1 15:11:29 2010 (r208709) @@ -37,7 +37,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 5 2010 +.Dd March 5, 2010 .Dt SSH-ADD 1 .Os .Sh NAME Modified: head/crypto/openssh/ssh-agent.1 ============================================================================== --- head/crypto/openssh/ssh-agent.1 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/ssh-agent.1 Tue Jun 1 15:11:29 2010 (r208709) @@ -35,7 +35,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd January 17 2010 +.Dd January 17, 2010 .Dt SSH-AGENT 1 .Os .Sh NAME Modified: head/crypto/openssh/ssh-keygen.1 ============================================================================== --- head/crypto/openssh/ssh-keygen.1 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/ssh-keygen.1 Tue Jun 1 15:11:29 2010 (r208709) @@ -38,7 +38,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd March 13 2010 +.Dd March 13, 2010 .Dt SSH-KEYGEN 1 .Os .Sh NAME Modified: head/crypto/openssh/ssh-keyscan.1 ============================================================================== --- head/crypto/openssh/ssh-keyscan.1 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/ssh-keyscan.1 Tue Jun 1 15:11:29 2010 (r208709) @@ -7,7 +7,7 @@ .\" permitted provided that due credit is given to the author and the .\" OpenBSD project by leaving this copyright notice intact. .\" -.Dd January 9 2010 +.Dd January 9, 2010 .Dt SSH-KEYSCAN 1 .Os .Sh NAME Modified: head/crypto/openssh/ssh.1 ============================================================================== --- head/crypto/openssh/ssh.1 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/ssh.1 Tue Jun 1 15:11:29 2010 (r208709) @@ -36,7 +36,7 @@ .\" .\" $OpenBSD: ssh.1,v 1.303 2010/03/26 00:26:58 djm Exp $ .\" $FreeBSD$ -.Dd March 26 2010 +.Dd March 26, 2010 .Dt SSH 1 .Os .Sh NAME Modified: head/crypto/openssh/ssh_config.5 ============================================================================== --- head/crypto/openssh/ssh_config.5 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/ssh_config.5 Tue Jun 1 15:11:29 2010 (r208709) @@ -36,7 +36,7 @@ .\" .\" $OpenBSD: ssh_config.5,v 1.130 2010/03/26 01:06:13 dtucker Exp $ .\" $FreeBSD$ -.Dd March 26 2010 +.Dd March 26, 2010 .Dt SSH_CONFIG 5 .Os .Sh NAME Modified: head/crypto/openssh/sshd.8 ============================================================================== --- head/crypto/openssh/sshd.8 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/sshd.8 Tue Jun 1 15:11:29 2010 (r208709) @@ -36,7 +36,7 @@ .\" .\" $OpenBSD: sshd.8,v 1.255 2010/03/05 06:50:35 jmc Exp $ .\" $FreeBSD$ -.Dd March 5 2010 +.Dd March 5, 2010 .Dt SSHD 8 .Os .Sh NAME Modified: head/crypto/openssh/sshd_config.5 ============================================================================== --- head/crypto/openssh/sshd_config.5 Tue Jun 1 15:01:02 2010 (r208708) +++ head/crypto/openssh/sshd_config.5 Tue Jun 1 15:11:29 2010 (r208709) @@ -36,7 +36,7 @@ .\" .\" $OpenBSD: sshd_config.5,v 1.120 2010/03/04 23:17:25 djm Exp $ .\" $FreeBSD$ -.Dd March 4 2010 +.Dd March 4, 2010 .Dt SSHD_CONFIG 5 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 15:33:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A0DD1065672; Tue, 1 Jun 2010 15:33:11 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0884F8FC15; Tue, 1 Jun 2010 15:33: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 o51FXAu2071627; Tue, 1 Jun 2010 15:33:10 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51FXAcl071618; Tue, 1 Jun 2010 15:33:10 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201006011533.o51FXAcl071618@svn.freebsd.org> From: Rui Paulo Date: Tue, 1 Jun 2010 15:33: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: r208711 - in head/sys/dev/ath/ath_hal: . ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 15:33:11 -0000 Author: rpaulo Date: Tue Jun 1 15:33:10 2010 New Revision: 208711 URL: http://svn.freebsd.org/changeset/base/208711 Log: Bring in a couple of fixes from the Linux ath9k related to chip hangs. While there, try to make the register write pattern look like what's done by ath9k. MFC after: 3 days Modified: head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Tue Jun 1 15:24:19 2010 (r208710) +++ head/sys/dev/ath/ath_hal/ah.h Tue Jun 1 15:33:10 2010 (r208711) @@ -324,6 +324,7 @@ typedef enum { HAL_INT_RXORN = 0x00000020, HAL_INT_TX = 0x00000040, /* Non-common mapping */ HAL_INT_TXDESC = 0x00000080, + HAL_INT_TIM_TIMER= 0x00000100, HAL_INT_TXURN = 0x00000800, HAL_INT_MIB = 0x00001000, HAL_INT_RXPHY = 0x00004000, Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Tue Jun 1 15:24:19 2010 (r208710) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Tue Jun 1 15:33:10 2010 (r208711) @@ -38,11 +38,8 @@ v4kEepromGet(struct ath_hal *ah, int par int i; switch (param) { - case AR_EEP_NFTHRESH_5: - *(int16_t *)val = pModal[0].noiseFloorThreshCh[0]; - return HAL_OK; case AR_EEP_NFTHRESH_2: - *(int16_t *)val = pModal[1].noiseFloorThreshCh[0]; + *(int16_t *)val = pModal->noiseFloorThreshCh[0]; return HAL_OK; case AR_EEP_MACADDR: /* Get MAC Address */ sum = 0; @@ -67,14 +64,10 @@ v4kEepromGet(struct ath_hal *ah, int par return pBase->opCapFlags; case AR_EEP_RFSILENT: return pBase->rfSilent; - case AR_EEP_OB_5: - return pModal[CHAN_A_IDX].ob; - case AR_EEP_DB_5: - return pModal[CHAN_A_IDX].db; case AR_EEP_OB_2: - return pModal[CHAN_B_IDX].ob; + return pModal->ob; case AR_EEP_DB_2: - return pModal[CHAN_B_IDX].db; + return pModal->db; case AR_EEP_TXMASK: return pBase->txMask; case AR_EEP_RXMASK: @@ -84,11 +77,9 @@ v4kEepromGet(struct ath_hal *ah, int par case AR_EEP_TXGAIN_TYPE: return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ? pBase->txGainType : AR5416_EEP_TXGAIN_ORIG; -#if 0 case AR_EEP_OL_PWRCTRL: HALASSERT(val == AH_NULL); - return pBase->openLoopPwrCntl ? HAL_OK : HAL_EIO; -#endif + return HAL_EIO; case AR_EEP_AMODE: HALASSERT(val == AH_NULL); return pBase->opCapFlags & AR5416_OPFLAGS_11A ? @@ -110,15 +101,11 @@ v4kEepromGet(struct ath_hal *ah, int par case AR_EEP_AES: case AR_EEP_BURST: case AR_EEP_RFKILL: - case AR_EEP_TURBO5DISABLE: case AR_EEP_TURBO2DISABLE: HALASSERT(val == AH_NULL); return HAL_OK; case AR_EEP_ANTGAINMAX_2: - *(int8_t *) val = ee->ee_antennaGainMax[1]; - return HAL_OK; - case AR_EEP_ANTGAINMAX_5: - *(int8_t *) val = ee->ee_antennaGainMax[0]; + *(int8_t *) val = ee->ee_antennaGainMax; return HAL_OK; default: HALASSERT(0); @@ -136,10 +123,7 @@ v4kEepromSet(struct ath_hal *ah, int par switch (param) { case AR_EEP_ANTGAINMAX_2: - ee->ee_antennaGainMax[1] = (int8_t) v; - return HAL_OK; - case AR_EEP_ANTGAINMAX_5: - ee->ee_antennaGainMax[0] = (int8_t) v; + ee->ee_antennaGainMax = (int8_t) v; return HAL_OK; } return HAL_EINVAL; @@ -252,7 +236,7 @@ v4kEepromReadCTLInfo(struct ath_hal *ah, RD_EDGES_POWER *rep = ee->ee_rdEdgesPower; int i, j; - HALASSERT(AR5416_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); + HALASSERT(AR5416_4K_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR5416_4K_NUM_CTLS; i++) { for (j = 0; j < NUM_EDGES; j ++) { Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h Tue Jun 1 15:24:19 2010 (r208710) +++ head/sys/dev/ath/ath_hal/ah_eeprom_v4k.h Tue Jun 1 15:33:10 2010 (r208711) @@ -23,6 +23,8 @@ #include "ah_eeprom.h" #include "ah_eeprom_v14.h" +#define AR9285_RDEXT_DEFAULT 0x1F + #undef owl_eep_start_loc #ifdef __LINUX_ARM_ARCH__ /* AP71 */ #define owl_eep_start_loc 0 @@ -150,6 +152,6 @@ typedef struct { uint16_t ee_numCtls; RD_EDGES_POWER ee_rdEdgesPower[NUM_EDGES*AR5416_4K_NUM_CTLS]; /* XXX these are dynamically calculated for use by shared code */ - int8_t ee_antennaGainMax[2]; + int8_t ee_antennaGainMax; } HAL_EEPROM_v4k; #endif /* _AH_EEPROM_V4K_H_ */ Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Tue Jun 1 15:24:19 2010 (r208710) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Tue Jun 1 15:33:10 2010 (r208711) @@ -120,6 +120,13 @@ ar5416GetPendingInterrupts(struct ath_ha ahp->ah_intrTxqs |= MS(isr1, AR_ISR_S1_QCU_TXEOL); } + if (AR_SREV_MERLIN(ah) || AR_SREV_KITE(ah)) { + uint32_t isr5; + isr5 = OS_REG_READ(ah, AR_ISR_S5_S); + if (isr5 & AR_ISR_S5_TIM_TIMER) + *masked |= HAL_INT_TIM_TIMER; + } + /* Interrupt Mitigation on AR5416 */ #ifdef AR5416_INT_MITIGATION if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM)) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Tue Jun 1 15:24:19 2010 (r208710) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Tue Jun 1 15:33:10 2010 (r208711) @@ -170,7 +170,16 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO OS_REG_WRITE(ah, AR_RSSI_THR, rssiThrReg); OS_MARK(ah, AH_MARK_RESET_LINE, __LINE__); + if (AR_SREV_MERLIN_10_OR_LATER(ah)) + OS_REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); + if (AR_SREV_KITE(ah)) { + uint32_t val; + val = OS_REG_READ(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS); + val &= ~AR_PHY_RIFS_INIT_DELAY; + OS_REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val); + } + AH5416(ah)->ah_writeIni(ah, chan); /* Setup 11n MAC/Phy mode registers */ @@ -1019,8 +1028,11 @@ ar5416SetResetPowerOn(struct ath_hal *ah /* * RTC reset and clear */ + OS_REG_WRITE(ah, AR_RC, AR_RC_AHB); OS_REG_WRITE(ah, AR_RTC_RESET, 0); OS_DELAY(20); + OS_REG_WRITE(ah, AR_RC, 0); + OS_REG_WRITE(ah, AR_RTC_RESET, 1); /* Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Tue Jun 1 15:24:19 2010 (r208710) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h Tue Jun 1 15:33:10 2010 (r208711) @@ -111,6 +111,9 @@ #define AR_PHY_HEAVY_CLIP_ENABLE 0x99E0 +#define AR_PHY_HEAVY_CLIP_FACTOR_RIFS 0x99ec +#define AR_PHY_RIFS_INIT_DELAY 0x03ff0000 + #define AR_PHY_M_SLEEP 0x99f0 /* sleep control registers */ #define AR_PHY_REFCLKDLY 0x99f4 #define AR_PHY_REFCLKPD 0x99f8 Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Tue Jun 1 15:24:19 2010 (r208710) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Tue Jun 1 15:33:10 2010 (r208711) @@ -127,6 +127,7 @@ #define AR_EXTRCCNT 0x8328 /* extension channel rx clear count */ #define AR_SELFGEN_MASK 0x832c /* rx and cal chain masks */ #define AR_PCU_TXBUF_CTRL 0x8340 +#define AR_PCU_MISC_MODE2 0x8344 /* DMA & PCI Registers in PCI space (usable during sleep)*/ #define AR_RC_AHB 0x00000001 /* AHB reset */ @@ -244,6 +245,10 @@ #define AR_ISR_S2_GTT 0x00800000 /* Global transmit timeout */ #define AR_ISR_S2_TSFOOR 0x40000000 /* RX TSF out of range */ +#define AR_ISR_S5 0x0098 +#define AR_ISR_S5_S 0x00d8 +#define AR_ISR_S5_TIM_TIMER 0x00000010 + #define AR_INTR_SPURIOUS 0xffffffff #define AR_INTR_RTC_IRQ 0x00000001 /* rtc in shutdown state */ #define AR_INTR_MAC_IRQ 0x00000002 /* pending mac interrupt */ @@ -495,6 +500,8 @@ #define AR_PCU_CLEAR_VMF 0x01000000 /* clear vmf mode (fast cc)*/ #define AR_PCU_CLEAR_BA_VALID 0x04000000 /* clear ba state */ +#define AR_PCU_MISC_MODE2_HWWAR1 0x00100000 + /* GPIO Interrupt */ #define AR_INTR_GPIO 0x3FF00000 /* gpio interrupted */ #define AR_INTR_GPIO_S 20 @@ -521,6 +528,8 @@ #define AR_GPIO_INTR_POL_VAL 0x1FFF #define AR_GPIO_INTR_POL_VAL_S 0 +#define AR_GPIO_JTAG_DISABLE 0x00020000 + #define AR_2040_JOINED_RX_CLEAR 0x00000001 /* use ctl + ext rx_clear for cca */ #define AR_PCU_TXBUF_CTRL_SIZE_MASK 0x7FF Modified: head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c Tue Jun 1 15:24:19 2010 (r208710) +++ head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c Tue Jun 1 15:33:10 2010 (r208711) @@ -316,6 +316,16 @@ ar9285WriteIni(struct ath_hal *ah, const regWrites = ath_hal_ini_write(ah, &AH5212(ah)->ah_ini_common, 1, regWrites); + OS_REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); + + if (AR_SREV_MERLIN_10_OR_LATER(ah)) { + uint32_t val; + val = OS_REG_READ(ah, AR_PCU_MISC_MODE2) & + (~AR_PCU_MISC_MODE2_HWWAR1); + OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val); + OS_REG_WRITE(ah, 0x9800 + (651 << 2), 0x11); + } + } /* From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 15:47:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AF0D1065670; Tue, 1 Jun 2010 15:47:58 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 193C48FC1A; Tue, 1 Jun 2010 15:47: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 o51FlvNg074858; Tue, 1 Jun 2010 15:47:57 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51Flvkw074856; Tue, 1 Jun 2010 15:47:57 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201006011547.o51Flvkw074856@svn.freebsd.org> From: Rui Paulo Date: Tue, 1 Jun 2010 15:47:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208712 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 15:47:58 -0000 Author: rpaulo Date: Tue Jun 1 15:47:57 2010 New Revision: 208712 URL: http://svn.freebsd.org/changeset/base/208712 Log: Rewrite ar9285SetBoardValues() to match what ath9k does and fix out of bounds reads. MFC after: 3 days Modified: head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Tue Jun 1 15:33:10 2010 (r208711) +++ head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c Tue Jun 1 15:47:57 2010 (r208712) @@ -245,107 +245,60 @@ ar9285SetBoardValues(struct ath_hal *ah, const HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; const struct ar5416eeprom_4k *eep = &ee->ee_base; const MODAL_EEP4K_HEADER *pModal; - int i, regChainOffset; - uint8_t txRxAttenLocal; /* workaround for eeprom versions <= 14.2 */ + uint8_t txRxAttenLocal = 23; HALASSERT(AH_PRIVATE(ah)->ah_eeversion >= AR_EEPROM_VER14_1); pModal = &eep->modalHeader; - /* NB: workaround for eeprom versions <= 14.2 */ - txRxAttenLocal = 23; - OS_REG_WRITE(ah, AR_PHY_SWITCH_COM, pModal->antCtrlCommon); - for (i = 0; i < AR5416_4K_MAX_CHAINS; i++) { - if (AR_SREV_MERLIN(ah)) { - if (i >= 2) break; - } - if (AR_SREV_OWL_20_OR_LATER(ah) && - (AH5416(ah)->ah_rx_chainmask == 0x5 || - AH5416(ah)->ah_tx_chainmask == 0x5) && i != 0) { - /* Regs are swapped from chain 2 to 1 for 5416 2_0 with - * only chains 0 and 2 populated - */ - regChainOffset = (i == 1) ? 0x2000 : 0x1000; - } else { - regChainOffset = i * 0x1000; - } - - OS_REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset, pModal->antCtrlChain[i]); - OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4 + regChainOffset, - (OS_REG_READ(ah, AR_PHY_TIMING_CTRL4 + regChainOffset) & + OS_REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0, pModal->antCtrlChain[0]); + OS_REG_WRITE(ah, AR_PHY_TIMING_CTRL4, + (OS_REG_READ(ah, AR_PHY_TIMING_CTRL4) & ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF | AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) | - SM(pModal->iqCalICh[i], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) | - SM(pModal->iqCalQCh[i], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF)); - - /* - * Large signal upgrade. - * XXX update - */ + SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) | + SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF)); - if ((i == 0) || AR_SREV_OWL_20_OR_LATER(ah)) { - OS_REG_WRITE(ah, AR_PHY_RXGAIN + regChainOffset, - (OS_REG_READ(ah, AR_PHY_RXGAIN + regChainOffset) & ~AR_PHY_RXGAIN_TXRX_ATTEN) | - SM(IS_EEP_MINOR_V3(ah) ? pModal->txRxAttenCh[i] : txRxAttenLocal, - AR_PHY_RXGAIN_TXRX_ATTEN)); - - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + regChainOffset, - (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + regChainOffset) & ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) | - SM(pModal->rxTxMarginCh[i], AR_PHY_GAIN_2GHZ_RXTX_MARGIN)); - } - } - - OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, pModal->switchSettling); - OS_REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC, pModal->adcDesiredSize); - OS_REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_PGA, pModal->pgaDesiredSize); - OS_REG_WRITE(ah, AR_PHY_RF_CTL4, - SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF) - | SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF) - | SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON) - | SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON)); - - OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON, pModal->txEndToRxOn); - - OS_REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62, - pModal->thresh62); - OS_REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, AR_PHY_EXT_CCA0_THRESH62, - pModal->thresh62); - - /* Minor Version Specific application */ - if (IS_EEP_MINOR_V2(ah)) { - OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_FRAME_TO_DATA_START, pModal->txFrameToDataStart); - OS_REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_FRAME_TO_PA_ON, pModal->txFrameToPaOn); - } - if (IS_EEP_MINOR_V3(ah)) { if (IEEE80211_IS_CHAN_HT40(chan)) { /* Overwrite switch settling with HT40 value */ - OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, pModal->swSettleHt40); + OS_REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, + pModal->swSettleHt40); } - - if ((AR_SREV_OWL_20_OR_LATER(ah)) && - ( AH5416(ah)->ah_rx_chainmask == 0x5 || AH5416(ah)->ah_tx_chainmask == 0x5)){ - /* Reg Offsets are swapped for logical mapping */ - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x1000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x1000) & ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) | - SM(pModal->bswMargin[2], AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x1000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x1000) & ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) | - SM(pModal->bswAtten[2], AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x2000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x2000) & ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) | - SM(pModal->bswMargin[1], AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x2000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x2000) & ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) | - SM(pModal->bswAtten[1], AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - } else { - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x1000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x1000) & ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) | - SM(pModal->bswMargin[1], AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x1000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x1000) & ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) | - SM(pModal->bswAtten[1], AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x2000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x2000) & ~AR_PHY_GAIN_2GHZ_BSW_MARGIN) | - SM(pModal->bswMargin[2],AR_PHY_GAIN_2GHZ_BSW_MARGIN)); - OS_REG_WRITE(ah, AR_PHY_GAIN_2GHZ + 0x2000, (OS_REG_READ(ah, AR_PHY_GAIN_2GHZ + 0x2000) & ~AR_PHY_GAIN_2GHZ_BSW_ATTEN) | - SM(pModal->bswAtten[2], AR_PHY_GAIN_2GHZ_BSW_ATTEN)); - } - OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_BSW_MARGIN, pModal->bswMargin[0]); - OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_BSW_ATTEN, pModal->bswAtten[0]); - } + txRxAttenLocal = pModal->txRxAttenCh[0]; + + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, + pModal->bswMargin[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_XATTEN1_DB, + pModal->bswAtten[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN, + pModal->xatten2Margin[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ, AR_PHY_GAIN_2GHZ_XATTEN2_DB, + pModal->xatten2Db[0]); + + /* block 1 has the same values as block 0 */ + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, + AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, pModal->bswMargin[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, + AR_PHY_GAIN_2GHZ_XATTEN1_DB, pModal->bswAtten[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, + AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN, pModal->xatten2Margin[0]); + OS_REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + 0x1000, + AR_PHY_GAIN_2GHZ_XATTEN2_DB, pModal->xatten2Db[0]); + + } + OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN, + AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); + OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN, + AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]); + + OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000, + AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal); + OS_REG_RMW_FIELD(ah, AR_PHY_RXGAIN + 0x1000, + AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]); + + if (AR_SREV_KITE_11(ah)) + OS_REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14)); + return AH_TRUE; } From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 16:04:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 024F91065679; Tue, 1 Jun 2010 16:04:02 +0000 (UTC) (envelope-from zml@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBF6E8FC15; Tue, 1 Jun 2010 16:04: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 o51G41uu078563; Tue, 1 Jun 2010 16:04:01 GMT (envelope-from zml@svn.freebsd.org) Received: (from zml@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51G41jd078560; Tue, 1 Jun 2010 16:04:01 GMT (envelope-from zml@svn.freebsd.org) Message-Id: <201006011604.o51G41jd078560@svn.freebsd.org> From: Zachary Loafman Date: Tue, 1 Jun 2010 16:04: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: r208715 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 16:04:02 -0000 Author: zml Date: Tue Jun 1 16:04:01 2010 New Revision: 208715 URL: http://svn.freebsd.org/changeset/base/208715 Log: Revert taskqueue(9) related commits until mdf@ is approved and can resolve issues. This reverts commits r207439, r208623, r208624 Modified: head/sys/kern/subr_taskqueue.c head/sys/sys/_task.h Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Tue Jun 1 15:51:31 2010 (r208714) +++ head/sys/kern/subr_taskqueue.c Tue Jun 1 16:04:01 2010 (r208715) @@ -51,13 +51,12 @@ struct taskqueue { const char *tq_name; taskqueue_enqueue_fn tq_enqueue; void *tq_context; + struct task *tq_running; struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; int tq_spin; int tq_flags; - int tq_tasks_running; - int tq_task_waiters; }; #define TQ_FLAGS_ACTIVE (1 << 0) @@ -234,15 +233,14 @@ taskqueue_run(struct taskqueue *queue) STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); pending = task->ta_pending; task->ta_pending = 0; - queue->tq_tasks_running++; + queue->tq_running = task; TQ_UNLOCK(queue); task->ta_func(task->ta_context, pending); TQ_LOCK(queue); - queue->tq_tasks_running--; - if (queue->tq_task_waiters > 0) - wakeup(task); + queue->tq_running = NULL; + wakeup(task); } /* @@ -258,21 +256,15 @@ taskqueue_drain(struct taskqueue *queue, { if (queue->tq_spin) { /* XXX */ mtx_lock_spin(&queue->tq_mutex); - while (task->ta_pending != 0 || queue->tq_tasks_running > 0) { - queue->tq_task_waiters++; + while (task->ta_pending != 0 || task == queue->tq_running) msleep_spin(task, &queue->tq_mutex, "-", 0); - queue->tq_task_waiters--; - } mtx_unlock_spin(&queue->tq_mutex); } else { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); mtx_lock(&queue->tq_mutex); - while (task->ta_pending != 0 || queue->tq_tasks_running > 0) { - queue->tq_task_waiters++; + while (task->ta_pending != 0 || task == queue->tq_running) msleep(task, &queue->tq_mutex, PWAIT, "-", 0); - queue->tq_task_waiters--; - } mtx_unlock(&queue->tq_mutex); } } Modified: head/sys/sys/_task.h ============================================================================== --- head/sys/sys/_task.h Tue Jun 1 15:51:31 2010 (r208714) +++ head/sys/sys/_task.h Tue Jun 1 16:04:01 2010 (r208715) @@ -36,19 +36,15 @@ * taskqueue_run(). The first argument is taken from the 'ta_context' * field of struct task and the second argument is a count of how many * times the task was enqueued before the call to taskqueue_run(). - * - * List of locks - * (c) const after init - * (q) taskqueue lock */ typedef void task_fn_t(void *context, int pending); struct task { - STAILQ_ENTRY(task) ta_link; /* (q) link for queue */ - u_short ta_pending; /* (q) count times queued */ - u_short ta_priority; /* (c) Priority */ - task_fn_t *ta_func; /* (c) task handler */ - void *ta_context; /* (c) argument for handler */ + STAILQ_ENTRY(task) ta_link; /* link for queue */ + u_short ta_pending; /* count times queued */ + u_short ta_priority; /* Priority */ + task_fn_t *ta_func; /* task handler */ + void *ta_context; /* argument for handler */ }; #endif /* !_SYS__TASK_H_ */ From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 18:27:48 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C82761065670; Tue, 1 Jun 2010 18:27:48 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACA1E8FC1E; Tue, 1 Jun 2010 18:27: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 o51IRmPW010152; Tue, 1 Jun 2010 18:27:48 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51IRmO0010150; Tue, 1 Jun 2010 18:27:48 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201006011827.o51IRmO0010150@svn.freebsd.org> From: Attilio Rao Date: Tue, 1 Jun 2010 18:27: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: r208716 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 18:27:49 -0000 Author: attilio Date: Tue Jun 1 18:27:48 2010 New Revision: 208716 URL: http://svn.freebsd.org/changeset/base/208716 Log: Adjust the manpage after r207329. Sponsored by: Sandvine Incorporated Reviewed by: cpercival, emaste, marcel X-MFC: r207329 Modified: head/share/man/man4/io.4 Modified: head/share/man/man4/io.4 ============================================================================== --- head/share/man/man4/io.4 Tue Jun 1 16:04:01 2010 (r208715) +++ head/share/man/man4/io.4 Tue Jun 1 18:27:48 2010 (r208716) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2010 +.Dd June 01, 2010 .Dt IO 4 .Os .Sh NAME @@ -35,32 +35,89 @@ .Nd I/O privilege file .Sh SYNOPSIS .Cd "device io" +.Pp +.In sys/types.h +.In sys/ioctl.h +.In dev/io/iodev.h +.In machine/iodev.h +.Pp +.Bd -literal +struct iodev_pio_req { + u_int access; + u_int port; + u_int width; + u_int val; +}; .Sh DESCRIPTION The special file .Pa /dev/io is a controlled security hole that allows a process to gain I/O privileges (which are normally reserved for kernel-internal code). -Any process that holds a file descriptor on -.Pa /dev/io -open will get its -.Em IOPL -bits in the flag register set, thus allowing it to perform direct -I/O operations. This can be useful in order to write userland programs that handle some hardware directly. -Note that even read-only access will grant the full I/O privileges. +.Pp +The usual operations on the device are to open it via the +.Xr open 2 +interface and to send I/O requests to the file descriptor using the +.Xr ioctl 2 +syscall. +.Pp +The +.Xr ioctl 2 +requests available for +.Pa /dev/io +are mostly platform dependent, but there are also some in common between +all of them. +The +.Dv IODEV_PIO +is used by all the architectures in order to request that an I/O operation +be performed. It takes a 'struct iodev_pio_req' argument +that must be previously setup. +.Pp +The +.Fa access +member specifies the type of operation requested. It may be: +.Bl -tag -width IODEV_PIO_WRITE +.It Dv IODEV_PIO_READ +The operation is an "in" type. A value will be read from the specified port +(retrieved from the +.Fa port +member) and the result will be stored in the +.Fa val +member. +.It Dv IODEV_PIO_WRITE +The operation is a "out" type. The value will be fetched from the +.Fa val +member and will be written out to the specified port (defined as the +.Fa port +member). +.El +.Pp +Finally, the +.Fa width +member specifies the size of the operand to be read/written, expressed +in bytes. .Pp In addition to any file access permissions on .Pa /dev/io , the kernel enforces that only the super-user may open this device. -.Sh FILES -.Bl -tag -width Pa -compact -.It Pa /dev/io -.El +.Sh LEGACY +The +.Pa /dev/io +interface used to be very i386 specific and worked differently. The initial +implementation, in fact, simply raised the +.Em IOPL +of the current thread when +.Xr open 2 +was called on the file. This behaviour is retained in the current +implementation as legacy support for both i386 and amd64 architectures. .Sh SEE ALSO +.Xr close 2 , .Xr i386_get_ioperm 2 , .Xr i386_set_ioperm 2 , +.Xr ioctl 2 , +.Xr open 2 , .Xr mem 4 .Sh HISTORY The From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 18:57:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68B16106564A; Tue, 1 Jun 2010 18:57:21 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 573DA8FC08; Tue, 1 Jun 2010 18:57: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 o51IvL6n016771; Tue, 1 Jun 2010 18:57:21 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51IvLrv016769; Tue, 1 Jun 2010 18:57:21 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201006011857.o51IvLrv016769@svn.freebsd.org> From: Jaakko Heinonen Date: Tue, 1 Jun 2010 18:57: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: r208717 - head/sys/fs/devfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 18:57:21 -0000 Author: jh Date: Tue Jun 1 18:57:21 2010 New Revision: 208717 URL: http://svn.freebsd.org/changeset/base/208717 Log: Don't try to call cdevsw d_close() method when devfs_close() is called because of insmntque1() failure. Found with: stress2 Suggested and reviewed by: kib Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Tue Jun 1 18:27:48 2010 (r208716) +++ head/sys/fs/devfs/devfs_vnops.c Tue Jun 1 18:57:21 2010 (r208717) @@ -459,6 +459,13 @@ devfs_close(struct vop_close_args *ap) int vp_locked, error; /* + * XXX: Don't call d_close() if we were called because of + * XXX: insmntque1() failure. + */ + if (vp->v_data == NULL) + return (0); + + /* * Hack: a tty device that is a controlling terminal * has a reference from the session structure. * We cannot easily tell that a character device is From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 19:56:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3951D1065676; Tue, 1 Jun 2010 19:56:03 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E0C5D8FC13; Tue, 1 Jun 2010 19:56: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 o51Ju23W029721; Tue, 1 Jun 2010 19:56:02 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51Ju2XE029719; Tue, 1 Jun 2010 19:56:02 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006011956.o51Ju2XE029719@svn.freebsd.org> From: Alan Cox Date: Tue, 1 Jun 2010 19:56: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: r208720 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 19:56:03 -0000 Author: alc Date: Tue Jun 1 19:56:02 2010 New Revision: 208720 URL: http://svn.freebsd.org/changeset/base/208720 Log: In the case that mmu_booke_enter_locked() is changing the attributes of a mapping but not changing the physical page being mapped, the wrong flags were being inspected in order to determine whether or not to flush the instruction cache. The effect of looking at the wrong flags was that the instruction cache was never being flushed. Reviewed by: marcel Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Jun 1 19:39:27 2010 (r208719) +++ head/sys/powerpc/booke/pmap.c Tue Jun 1 19:56:02 2010 (r208720) @@ -1621,7 +1621,7 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t * are turning execute permissions on, icache should * be flushed. */ - if ((flags & (PTE_UX | PTE_SX)) == 0) + if ((pte->flags & (PTE_UX | PTE_SX)) == 0) sync++; } From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 21:15:05 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAAE51065670; Tue, 1 Jun 2010 21:15:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9845B8FC0A; Tue, 1 Jun 2010 21:15: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 o51LF5GS047209; Tue, 1 Jun 2010 21:15:05 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51LF5Va047207; Tue, 1 Jun 2010 21:15:05 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201006012115.o51LF5Va047207@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 1 Jun 2010 21:15: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: r208722 - head/sys/dev/acpica X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 21:15:05 -0000 Author: jkim Date: Tue Jun 1 21:15:05 2010 New Revision: 208722 URL: http://svn.freebsd.org/changeset/base/208722 Log: Remove unnecessary pointer type castings, shift operations and dead code. Modified: head/sys/dev/acpica/acpi_ec.c Modified: head/sys/dev/acpica/acpi_ec.c ============================================================================== --- head/sys/dev/acpica/acpi_ec.c Tue Jun 1 20:29:03 2010 (r208721) +++ head/sys/dev/acpica/acpi_ec.c Tue Jun 1 21:15:05 2010 (r208722) @@ -223,7 +223,7 @@ static ACPI_STATUS EcSpaceSetup(ACPI_HAN void *Context, void **return_Context); static ACPI_STATUS EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, - UINT32 width, UINT64 *Value, + UINT32 Width, UINT64 *Value, void *Context, void *RegionContext); static ACPI_STATUS EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count); @@ -231,7 +231,7 @@ static ACPI_STATUS EcCommand(struct acpi static ACPI_STATUS EcRead(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data); static ACPI_STATUS EcWrite(struct acpi_ec_softc *sc, UINT8 Address, - UINT8 *Data); + UINT8 Data); static int acpi_ec_probe(device_t dev); static int acpi_ec_attach(device_t dev); static int acpi_ec_suspend(device_t dev); @@ -717,25 +717,27 @@ EcSpaceSetup(ACPI_HANDLE Region, UINT32 } static ACPI_STATUS -EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, +EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 Width, UINT64 *Value, void *Context, void *RegionContext) { struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; ACPI_STATUS Status; - UINT8 EcAddr, EcData; - int i; + UINT8 *EcData; + UINT8 EcAddr; + int bytes, i; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Address); - if (width % 8 != 0 || Value == NULL || Context == NULL) + if (Width % 8 != 0 || Value == NULL || Context == NULL) return_ACPI_STATUS (AE_BAD_PARAMETER); - if (Address + (width / 8) - 1 > 0xFF) + bytes = Width / 8; + if (Address + bytes - 1 > 0xFF) return_ACPI_STATUS (AE_BAD_ADDRESS); if (Function == ACPI_READ) *Value = 0; EcAddr = Address; - Status = AE_ERROR; + EcData = (UINT8 *)Value; /* * If booting, check if we need to run the query handler. If so, we @@ -753,17 +755,14 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY if (ACPI_FAILURE(Status)) return_ACPI_STATUS (Status); - /* Perform the transaction(s), based on width. */ - for (i = 0; i < width; i += 8, EcAddr++) { + /* Perform the transaction(s), based on Width. */ + for (i = 0; i < bytes; i++, EcAddr++, EcData++) { switch (Function) { case ACPI_READ: - Status = EcRead(sc, EcAddr, &EcData); - if (ACPI_SUCCESS(Status)) - *Value |= ((UINT64)EcData) << i; + Status = EcRead(sc, EcAddr, EcData); break; case ACPI_WRITE: - EcData = (UINT8)((*Value) >> i); - Status = EcWrite(sc, EcAddr, &EcData); + Status = EcWrite(sc, EcAddr, *EcData); break; default: device_printf(sc->ec_dev, "invalid EcSpaceHandler function %d\n", @@ -986,14 +985,14 @@ EcRead(struct acpi_ec_softc *sc, UINT8 A } static ACPI_STATUS -EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data) +EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 Data) { ACPI_STATUS status; UINT8 data; u_int gen_count; ACPI_SERIAL_ASSERT(ec); - CTR2(KTR_ACPI, "ec write to %#x, data %#x", Address, *Data); + CTR2(KTR_ACPI, "ec write to %#x, data %#x", Address, Data); /* If we can't start burst mode, continue anyway. */ status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); @@ -1018,7 +1017,7 @@ EcWrite(struct acpi_ec_softc *sc, UINT8 } gen_count = sc->ec_gencount; - EC_SET_DATA(sc, *Data); + EC_SET_DATA(sc, Data); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, gen_count); if (ACPI_FAILURE(status)) { device_printf(sc->ec_dev, "EcWrite: failed waiting for sent data\n"); From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 21:53:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6889106566B; Tue, 1 Jun 2010 21:53:30 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 714538FC08; Tue, 1 Jun 2010 21:53:29 +0000 (UTC) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 546A32C2A8E; Tue, 1 Jun 2010 16:53:29 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ATNje++6sBZl; Tue, 1 Jun 2010 16:53:21 -0500 (CDT) Received: from [10.209.194.87] (unknown [10.209.194.87]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id A3B722C2A02; Tue, 1 Jun 2010 16:53:21 -0500 (CDT) Message-ID: <4C058145.3000707@cs.rice.edu> Date: Tue, 01 Jun 2010 16:53:09 -0500 From: Alan Cox User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: "Jayachandran C." References: <201005271005.o4RA5eVu032269@svn.freebsd.org> In-Reply-To: <201005271005.o4RA5eVu032269@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: r208589 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 21:53:31 -0000 On 5/27/2010 5:05 AM, Jayachandran C. wrote: > Author: jchandra > Date: Thu May 27 10:05:40 2010 > New Revision: 208589 > URL: http://svn.freebsd.org/changeset/base/208589 > > Log: > Call VM_WAIT in pmap_ptpgzone_allocf() if M_WAITOK is set. > Removed unused variable. > > Approved by: rrs (mentor) > > I'm afraid that this will work some of the time, but not all of the time. Specifically, there is no guarantee that any of the available free (or cached) pages after the VM_WAIT will fall within the range of suitable physical addresses. Moreover, and perhaps most worrisome, is that this function could do a lot of spinning. Every time this function sleeps and a single page is freed (or cached) by someone else, this function will be reawakened. With a little bad luck, you could spin indefinitely. For essentially this reason, contigmalloc(), kmem_alloc_contig(), and kmem_alloc_attr() don't use VM_WAIT, but instead a function called vm_contig_grow_cache(). Regards, Alan > Modified: > head/sys/mips/mips/pmap.c > > Modified: head/sys/mips/mips/pmap.c > ============================================================================== > --- head/sys/mips/mips/pmap.c Thu May 27 08:21:52 2010 (r208588) > +++ head/sys/mips/mips/pmap.c Thu May 27 10:05:40 2010 (r208589) > @@ -969,10 +969,15 @@ pmap_ptpgzone_allocf(uma_zone_t zone, in > ("pmap_ptpgzone_allocf: invalid allocation size %d", bytes)); > > *flags = UMA_SLAB_PRIV; > - m = vm_phys_alloc_contig(1, 0, MIPS_KSEG0_LARGEST_PHYS, > - PAGE_SIZE, PAGE_SIZE); > - if (m == NULL) > - return (NULL); > + for (;;) { > + m = vm_phys_alloc_contig(1, 0, MIPS_KSEG0_LARGEST_PHYS, > + PAGE_SIZE, PAGE_SIZE); > + if (m != NULL) > + break; > + if ((wait& M_WAITOK) == 0) > + return (NULL); > + VM_WAIT; > + } > > paddr = VM_PAGE_TO_PHYS(m); > return ((void *)MIPS_PHYS_TO_KSEG0(paddr)); > @@ -1039,8 +1044,10 @@ pmap_pinit(pmap_t pmap) > * allocate the page directory page > */ > ptdpg = pmap_alloc_pte_page(pmap, NUSERPGTBLS, M_WAITOK,&ptdva); > - pmap->pm_segtab = (pd_entry_t *)ptdva; > + if (ptdpg == NULL) > + return (0); > > + pmap->pm_segtab = (pd_entry_t *)ptdva; > pmap->pm_active = 0; > pmap->pm_ptphint = NULL; > for (i = 0; i< MAXCPU; i++) { > @@ -1062,13 +1069,11 @@ _pmap_allocpte(pmap_t pmap, unsigned pte > { > vm_offset_t pteva; > vm_page_t m; > - int req; > > KASSERT((flags& (M_NOWAIT | M_WAITOK)) == M_NOWAIT || > (flags& (M_NOWAIT | M_WAITOK)) == M_WAITOK, > ("_pmap_allocpte: flags is neither M_NOWAIT nor M_WAITOK")); > > - req = VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ; > /* > * Find or fabricate a new pagetable page > */ > From owner-svn-src-head@FreeBSD.ORG Tue Jun 1 22:46:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA46A106566C; Tue, 1 Jun 2010 22:46:57 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A97828FC19; Tue, 1 Jun 2010 22:46: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 o51Mkvwi067293; Tue, 1 Jun 2010 22:46:57 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o51MkvlD067290; Tue, 1 Jun 2010 22:46:57 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201006012246.o51MkvlD067290@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 1 Jun 2010 22:46:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208724 - head/crypto/openssh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2010 22:46:57 -0000 Author: des Date: Tue Jun 1 22:46:57 2010 New Revision: 208724 URL: http://svn.freebsd.org/changeset/base/208724 Log: More commas Modified: head/crypto/openssh/moduli.5 head/crypto/openssh/ssh-keysign.8 Modified: head/crypto/openssh/moduli.5 ============================================================================== --- head/crypto/openssh/moduli.5 Tue Jun 1 21:19:58 2010 (r208723) +++ head/crypto/openssh/moduli.5 Tue Jun 1 22:46:57 2010 (r208724) @@ -13,7 +13,7 @@ .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.Dd June 26 2008 +.Dd June 26, 2008 .Dt MODULI 5 .Os .Sh NAME Modified: head/crypto/openssh/ssh-keysign.8 ============================================================================== --- head/crypto/openssh/ssh-keysign.8 Tue Jun 1 21:19:58 2010 (r208723) +++ head/crypto/openssh/ssh-keysign.8 Tue Jun 1 22:46:57 2010 (r208724) @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 31 2007 +.Dd May 31, 2007 .Dt SSH-KEYSIGN 8 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 05:01:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 646281065673; Wed, 2 Jun 2010 05:01:06 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 297858FC17; Wed, 2 Jun 2010 05:01:05 +0000 (UTC) Received: by pxi7 with SMTP id 7so2945324pxi.13 for ; Tue, 01 Jun 2010 22:01:05 -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=WNKpbCZACsKhPY6qXqxdopHUB2ZikOcuDl+DEwkzJUA=; b=SH5714qy2gH4JXlA9Xcx6Ar6/TW7qnYvqVDXhNQ0EzO2e/nlj9Wb3b9O5RoClb9Bv/ 4WlzFovm/sKT+CiM1k6EgJQJwqvFOMCqM2Ff/8oVcwcGd72uAfOSHvuy7IaYy8pKBcBj Dv2KM0PffJ0Vlv6CO0X1QMVPwVNO4DX3sKB+w= 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=WtvGTI78uHO8sXUis9bxaf3SJO6f66y7FnQV16y1KAq0WDfkf7YT6EPZDPzEug9/SI lX2olqrWsMFgIpsn1twiT7KEfMNUgb3SMhnh3b6PjbIViDwR/LHahwZT599qfKWnPrG+ mrtk485fLsqLgUaZwQu05S2RlekeX8dYtHR2U= MIME-Version: 1.0 Received: by 10.140.251.5 with SMTP id y5mr5831487rvh.17.1275453338673; Tue, 01 Jun 2010 21:35:38 -0700 (PDT) Received: by 10.141.4.3 with HTTP; Tue, 1 Jun 2010 21:35:38 -0700 (PDT) In-Reply-To: <4C058145.3000707@cs.rice.edu> References: <201005271005.o4RA5eVu032269@svn.freebsd.org> <4C058145.3000707@cs.rice.edu> Date: Wed, 2 Jun 2010 10:05:38 +0530 Message-ID: From: "C. Jayachandran" To: Alan Cox Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "Jayachandran C." , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Randall Stewart Subject: Re: svn commit: r208589 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 05:01:06 -0000 On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox wrote: > On 5/27/2010 5:05 AM, Jayachandran C. wrote: >> >> Author: jchandra >> Date: Thu May 27 10:05:40 2010 >> New Revision: 208589 >> URL: http://svn.freebsd.org/changeset/base/208589 >> >> Log: >> =A0 Call VM_WAIT in pmap_ptpgzone_allocf() if =A0M_WAITOK is set. >> =A0 Removed unused variable. >> >> =A0 Approved by: rrs (mentor) >> >> > > I'm afraid that this will work some of the time, but not all of the time. > =A0Specifically, there is no guarantee that any of the available free (or > cached) pages after the VM_WAIT will fall within the range of suitable > physical addresses. =A0Moreover, and perhaps most worrisome, is that this > function could do a lot of spinning. =A0Every time this function sleeps a= nd a > single page is freed (or cached) by someone else, this function will be > reawakened. =A0With a little bad luck, you could spin indefinitely. > > For essentially this reason, contigmalloc(), kmem_alloc_contig(), and > kmem_alloc_attr() don't use VM_WAIT, but instead a function called > vm_contig_grow_cache(). I had seen the vm_contig_grow_cache() usage, but could not use it as it was defined as a static function. I did not want to use contigmalloc()/kmem_alloc_contig() either, because the pages in that memory region are already direct mapped and setting up another mapping is not necessary. The overall idea is to allocate pages in the direct mapped region for the page table entries so that we don't take a TLB exception while accessing page tables (which is costly as MIPS has a software TLB exception handler). Can you suggest the right way to do this? I will make the changes and send a patch for approval. Thanks, JC. From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 06:27:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4B8B106566C; Wed, 2 Jun 2010 06:27:19 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 686C78FC14; Wed, 2 Jun 2010 06:27:19 +0000 (UTC) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id DB81D2C2C55; Wed, 2 Jun 2010 01:27:18 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lKJ66GbA3SMz; Wed, 2 Jun 2010 01:27:11 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 263E52C2B02; Wed, 2 Jun 2010 01:27:09 -0500 (CDT) Message-ID: <4C05F9BC.40409@cs.rice.edu> Date: Wed, 02 Jun 2010 01:27:08 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.24 (X11/20100501) MIME-Version: 1.0 To: "C. Jayachandran" References: <201005271005.o4RA5eVu032269@svn.freebsd.org> <4C058145.3000707@cs.rice.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "Jayachandran C." , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Randall Stewart Subject: Re: svn commit: r208589 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 06:27:19 -0000 C. Jayachandran wrote: > On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox wrote: > >> On 5/27/2010 5:05 AM, Jayachandran C. wrote: >> >>> Author: jchandra >>> Date: Thu May 27 10:05:40 2010 >>> New Revision: 208589 >>> URL: http://svn.freebsd.org/changeset/base/208589 >>> >>> Log: >>> Call VM_WAIT in pmap_ptpgzone_allocf() if M_WAITOK is set. >>> Removed unused variable. >>> >>> Approved by: rrs (mentor) >>> >>> >>> >> I'm afraid that this will work some of the time, but not all of the time. >> Specifically, there is no guarantee that any of the available free (or >> cached) pages after the VM_WAIT will fall within the range of suitable >> physical addresses. Moreover, and perhaps most worrisome, is that this >> function could do a lot of spinning. Every time this function sleeps and a >> single page is freed (or cached) by someone else, this function will be >> reawakened. With a little bad luck, you could spin indefinitely. >> >> For essentially this reason, contigmalloc(), kmem_alloc_contig(), and >> kmem_alloc_attr() don't use VM_WAIT, but instead a function called >> vm_contig_grow_cache(). >> > > I had seen the vm_contig_grow_cache() usage, but could not use it as > it was defined as a static function. > > I did not want to use contigmalloc()/kmem_alloc_contig() either, > because the pages in that memory region are already direct mapped and > setting up another mapping is not necessary. The overall idea is to > allocate pages in the direct mapped region for the page table entries > so that we don't take a TLB exception while accessing page tables > (which is costly as MIPS has a software TLB exception handler). > > Can you suggest the right way to do this? I will make the changes and > send a patch for approval. > I would encourage you to make vm_contig_grow_cache() an extern function and use it. (vm/vm_pageout.h is probably the best place for the function prototype.) If you're interested in taking this a small step further, it would make sense to add two parameters to vm_contig_grow_cache() and vm_contig_launder(): a "low" and a "high" physical address. vm_contig_launder() could then skip pages that are outside the desired range. Regards, Alan From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 07:47:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF3E71065674; Wed, 2 Jun 2010 07:47:29 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD79C8FC08; Wed, 2 Jun 2010 07:47: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 o527lTZw086152; Wed, 2 Jun 2010 07:47:29 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o527lTkV086145; Wed, 2 Jun 2010 07:47:29 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201006020747.o527lTkV086145@svn.freebsd.org> From: Brian Somers Date: Wed, 2 Jun 2010 07:47: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: r208728 - in head: tools/regression/usr.bin/jot usr.bin/jot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 07:47:29 -0000 Author: brian Date: Wed Jun 2 07:47:29 2010 New Revision: 208728 URL: http://svn.freebsd.org/changeset/base/208728 Log: Fix stuttering sequences and reverse ranges PR: 123635 Submitted by: Ulrich Spörlein, uqs at spoerlein dot net Added: head/tools/regression/usr.bin/jot/regress.rand1.out (contents, props changed) head/tools/regression/usr.bin/jot/regress.rand2.out (contents, props changed) head/tools/regression/usr.bin/jot/regress.stutter2.out (contents, props changed) Modified: head/tools/regression/usr.bin/jot/regress.sh head/usr.bin/jot/jot.1 head/usr.bin/jot/jot.c Added: head/tools/regression/usr.bin/jot/regress.rand1.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/jot/regress.rand1.out Wed Jun 2 07:47:29 2010 (r208728) @@ -0,0 +1,10 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 Added: head/tools/regression/usr.bin/jot/regress.rand2.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/jot/regress.rand2.out Wed Jun 2 07:47:29 2010 (r208728) @@ -0,0 +1,10 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 Modified: head/tools/regression/usr.bin/jot/regress.sh ============================================================================== --- head/tools/regression/usr.bin/jot/regress.sh Wed Jun 2 07:28:12 2010 (r208727) +++ head/tools/regression/usr.bin/jot/regress.sh Wed Jun 2 07:47:29 2010 (r208728) @@ -1,6 +1,6 @@ # $FreeBSD$ -echo 1..57 +echo 1..60 REGRESSION_START($1) @@ -32,12 +32,15 @@ REGRESSION_TEST(`hddd2', `jot 30 - - -') REGRESSION_TEST(`dhhh2', `jot - 20 160 2') REGRESSION_TEST(`dhhd2', `jot - 20 160 -') REGRESSION_TEST(`ddhh2', `jot - - 160 2') +REGRESSION_TEST(`rand1', `jot -r 10000 0 9 | sort -u') +REGRESSION_TEST(`rand2', `jot -r 10000 9 0 | sort -u') REGRESSION_TEST(`n21', `jot 21 -1 1.00') REGRESSION_TEST(`ascii', `jot -c 128 0') REGRESSION_TEST(`xaa', `jot -w xa%c 26 a') REGRESSION_TEST(`yes', `jot -b yes 10') REGRESSION_TEST(`ed', `jot -w %ds/old/new/ 30 2 - 5') REGRESSION_TEST(`stutter', `jot - 9 0 -.5') +REGRESSION_TEST(`stutter2', `jot -w %d - 9.5 0 -.5') REGRESSION_TEST(`block', `jot -b x 512') REGRESSION_TEST(`tabs', `jot -s, - 10 132 4') REGRESSION_TEST(`grep', `jot -s "" -b . 80') Added: head/tools/regression/usr.bin/jot/regress.stutter2.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/usr.bin/jot/regress.stutter2.out Wed Jun 2 07:47:29 2010 (r208728) @@ -0,0 +1,20 @@ +9 +9 +8 +8 +7 +7 +6 +6 +5 +5 +4 +4 +3 +3 +2 +2 +1 +1 +0 +0 Modified: head/usr.bin/jot/jot.1 ============================================================================== --- head/usr.bin/jot/jot.1 Wed Jun 2 07:28:12 2010 (r208727) +++ head/usr.bin/jot/jot.1 Wed Jun 2 07:47:29 2010 (r208728) @@ -32,7 +32,7 @@ .\" @(#)jot.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd February 19, 2010 +.Dd June 2, 2010 .Dt JOT 1 .Os .Sh NAME @@ -167,6 +167,86 @@ The name derives in part from .Nm iota , a function in APL. +.Ss Rounding and truncation +The +.Nm +utility uses double precision floating point arithmetic internally. +Before printing a number, it is converted depending on the output +format used. +.Pp +If no output format is specified or the output format is a +floating point format +.Po +.Sq E , +.Sq G , +.Sq e , +.Sq f , +or +.Sq g +.Pc , +the value is rounded using the +.Xr printf 3 +function, taking into account the requested precision. +.Pp +If the output format is an integer format +.Po +.Sq D , +.Sq O , +.Sq U , +.Sq X , +.Sq c , +.Sq d , +.Sq i , +.Sq o , +.Sq u , +or +.Sq x +.Pc , +the value is converted to an integer value by truncation. +.Pp +As an illustration, consider the following command: +.Bd -literal -offset indent +$ jot 6 1 10 0.5 +1 +2 +2 +2 +3 +4 +.Ed +.Pp +By requesting an explicit precision of 1, the values generated before rounding +can be seen. +The .5 values are rounded down if the integer part is even, +up otherwise. +.Bd -literal -offset indent +$ jot -p 1 6 1 10 0.5 +1.0 +1.5 +2.0 +2.5 +3.0 +3.5 +.Ed +.Pp +By offsetting the values slightly, the values generated by the following +command are always rounded down: +.Bd -literal -offset indent +$ jot -p 0 6 .9999999999 10 0.5 +1 +1 +2 +2 +3 +3 +.Ed +.Pp +Another way of achieving the same result is to force truncation by +specifying an integer format: +.Bd -literal -offset indent +$ jot -w %d 6 1 10 0.5 +.Ed +.Pp .Sh EXIT STATUS .Ex -std .Sh EXAMPLES @@ -201,9 +281,9 @@ the result of .Dl jot -w %ds/old/new/ 30 2 - 5 .Pp The stuttering sequence 9, 9, 8, 8, 7, etc.\& can be -produced by suitable choice of step size, +produced by truncating the output precision and a suitable choice of step size, as in -.Dl jot - 9 0 -.5 +.Dl jot -w %d - 9.5 0 -.5 .Pp and a file containing exactly 1024 bytes is created with .Dl jot -b x 512 > block Modified: head/usr.bin/jot/jot.c ============================================================================== --- head/usr.bin/jot/jot.c Wed Jun 2 07:28:12 2010 (r208727) +++ head/usr.bin/jot/jot.c Wed Jun 2 07:47:29 2010 (r208728) @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); #define is_default(s) (*(s) == 0 || strcmp((s), "-") == 0) static bool boring; -static int prec; +static int prec = -1; static bool longdata; static bool intdata; static bool chardata; @@ -128,7 +128,7 @@ main(int argc, char **argv) break; case 'p': prec = atoi(optarg); - if (prec <= 0) + if (prec < 0) errx(1, "bad precision value"); have_format = true; break; @@ -159,7 +159,7 @@ main(int argc, char **argv) if (!sscanf(argv[2], "%lf", &ender)) ender = argv[2][strlen(argv[2])-1]; mask |= HAVE_ENDER; - if (!prec) + if (prec < 0) n = getprec(argv[2]); } /* FALLTHROUGH */ @@ -168,7 +168,7 @@ main(int argc, char **argv) if (!sscanf(argv[1], "%lf", &begin)) begin = argv[1][strlen(argv[1])-1]; mask |= HAVE_BEGIN; - if (!prec) + if (prec < 0) prec = getprec(argv[1]); if (n > prec) /* maximum precision */ prec = n; @@ -188,6 +188,10 @@ main(int argc, char **argv) argv[4]); } getformat(); + + if (prec == -1) + prec = 0; + while (mask) /* 4 bit mask has 1's where last 4 args were given */ switch (mask) { /* fill in the 0's by default or computation */ case HAVE_STEP: @@ -284,13 +288,16 @@ main(int argc, char **argv) if (!have_format && prec == 0 && begin >= 0 && begin < divisor && ender >= 0 && ender < divisor) { - ender += 1; + if (begin <= ender) + ender += 1; + else + begin += 1; nosign = true; intdata = true; (void)strlcpy(format, chardata ? "%c" : "%u", sizeof(format)); } - x = (ender - begin) * (ender > begin ? 1 : -1); + x = ender - begin; for (i = 1; i <= reps || infinity; i++) { if (use_random) y = random() / divisor; From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 08:43:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55469106566C; Wed, 2 Jun 2010 08:43:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 450F78FC13; Wed, 2 Jun 2010 08:43: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 o528hJ6E099020; Wed, 2 Jun 2010 08:43:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o528hJTn099018; Wed, 2 Jun 2010 08:43:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006020843.o528hJTn099018@svn.freebsd.org> From: Alexander Motin Date: Wed, 2 Jun 2010 08:43: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: r208729 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 08:43:19 -0000 Author: mav Date: Wed Jun 2 08:43:18 2010 New Revision: 208729 URL: http://svn.freebsd.org/changeset/base/208729 Log: Recommend disabling LAPIC timer instead whole APIC for fixing C3 state. PR: docs/147180 Submitted by: Tobias Rehbein Modified: head/share/man/man4/acpi.4 Modified: head/share/man/man4/acpi.4 ============================================================================== --- head/share/man/man4/acpi.4 Wed Jun 2 07:47:29 2010 (r208728) +++ head/share/man/man4/acpi.4 Wed Jun 2 08:43:18 2010 (r208729) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2010 +.Dd June 2, 2010 .Dt ACPI 4 .Os .Sh NAME @@ -599,10 +599,8 @@ The .Nm CPU idle power management drive conflicts with the local APIC (LAPIC) timer. -Disable APIC mode with -.Va hint.apic.0.disabled +Disable the local APIC timer with +.Va hint.apic.0.clock=0 or do not use the -.Li C2 -and .Li C3 -states if APIC mode is enabled. +and deeper states if the local APIC timer is enabled. From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 09:34:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 754351065674; Wed, 2 Jun 2010 09:34:42 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 653548FC1B; Wed, 2 Jun 2010 09:34: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 o529Yg5M010518; Wed, 2 Jun 2010 09:34:42 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o529Ygti010516; Wed, 2 Jun 2010 09:34:42 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201006020934.o529Ygti010516@svn.freebsd.org> From: Ulrich Spoerlein Date: Wed, 2 Jun 2010 09:34: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: r208730 - head/bin/chio X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 09:34:42 -0000 Author: uqs Date: Wed Jun 2 09:34:41 2010 New Revision: 208730 URL: http://svn.freebsd.org/changeset/base/208730 Log: Zero struct before reading from it PR: 140384 Found by: clang static analyzer MFC after: 3 weeks Modified: head/bin/chio/chio.c Modified: head/bin/chio/chio.c ============================================================================== --- head/bin/chio/chio.c Wed Jun 2 08:43:18 2010 (r208729) +++ head/bin/chio/chio.c Wed Jun 2 09:34:41 2010 (r208730) @@ -1072,6 +1072,7 @@ find_element(char *voltag, uint16_t *et, /* Read in the changer slots */ if (cp.cp_nslots > 0) { + (void) memset(&cesr, 0, sizeof(cesr)); cesr.cesr_element_type = CHET_ST; cesr.cesr_element_base = 0; cesr.cesr_element_count = cp.cp_nslots; From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 09:59:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAF1D1065674; Wed, 2 Jun 2010 09:59:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA57C8FC22; Wed, 2 Jun 2010 09:59: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 o529x5dV015889; Wed, 2 Jun 2010 09:59:05 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o529x5Ct015885; Wed, 2 Jun 2010 09:59:05 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006020959.o529x5Ct015885@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 2 Jun 2010 09:59: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: r208731 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 09:59:06 -0000 Author: kib Date: Wed Jun 2 09:59:05 2010 New Revision: 208731 URL: http://svn.freebsd.org/changeset/base/208731 Log: Add a facility to dynamically adjust or unconfigure p1003_1b mib. Use it to allow to tune sem_nsem_max at runtime, only when sem.ko module is present in kernel. Requested and tested by: amdmi3 Reviewed by: jhb MFC after: 3 days Modified: head/sys/kern/posix4_mib.c head/sys/kern/uipc_sem.c head/sys/sys/posix4.h Modified: head/sys/kern/posix4_mib.c ============================================================================== --- head/sys/kern/posix4_mib.c Wed Jun 2 09:34:41 2010 (r208730) +++ head/sys/kern/posix4_mib.c Wed Jun 2 09:59:05 2010 (r208731) @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); static int facility[CTL_P1003_1B_MAXID - 1]; static int facility_initialized[CTL_P1003_1B_MAXID - 1]; +static int p31b_sysctl_proc(SYSCTL_HANDLER_ARGS); + /* OID_AUTO isn't working with sysconf(3). I guess I'd have to * modify it to do a lookup by name from the index. * For now I've left it a top-level sysctl. @@ -55,16 +57,21 @@ static int facility_initialized[CTL_P100 SYSCTL_DECL(_p1003_1b); #define P1B_SYSCTL(num, name) \ -SYSCTL_INT(_p1003_1b, num, \ - name, CTLFLAG_RD, facility + num - 1, 0, ""); + SYSCTL_INT(_p1003_1b, num, name, CTLFLAG_RD, facility + num - 1, 0, ""); +#define P1B_SYSCTL_RW(num, name) \ + SYSCTL_PROC(_p1003_1b, num, name, CTLTYPE_INT | CTLFLAG_RW, NULL, num, \ + p31b_sysctl_proc, "I", ""); #else SYSCTL_DECL(_kern_p1003_1b); #define P1B_SYSCTL(num, name) \ -SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \ - name, CTLFLAG_RD, facility + num - 1, 0, ""); + SYSCTL_INT(_kern_p1003_1b, OID_AUTO, name, CTLFLAG_RD, \ + facility + num - 1, 0, ""); +#define P1B_SYSCTL_RW(num, name) \ + SYSCTL_PROC(_p1003_1b, OID_AUTO, name, CTLTYPE_INT | CTLFLAG_RW, NULL, \ + num, p31b_sysctl_proc, "I", ""); SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B"); #endif @@ -91,13 +98,28 @@ P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max); P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize); P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max); -P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); +P1B_SYSCTL_RW(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max); P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max); P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max); P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max); #define P31B_VALID(num) ((num) >= 1 && (num) < CTL_P1003_1B_MAXID) +static int +p31b_sysctl_proc(SYSCTL_HANDLER_ARGS) +{ + int error, num, val; + + num = arg2; + if (!P31B_VALID(num)) + return (EINVAL); + val = facility_initialized[num] ? facility[num - 1] : 0; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error == 0 && req->newptr != NULL && facility_initialized[num]) + facility[num - 1] = val; + return (error); +} + /* p31b_setcfg: Set the configuration */ void @@ -110,6 +132,14 @@ p31b_setcfg(int num, int value) } } +void +p31b_unsetcfg(int num) +{ + + facility[num - 1] = 0; + facility_initialized[num -1] = 0; +} + int p31b_getcfg(int num) { Modified: head/sys/kern/uipc_sem.c ============================================================================== --- head/sys/kern/uipc_sem.c Wed Jun 2 09:34:41 2010 (r208730) +++ head/sys/kern/uipc_sem.c Wed Jun 2 09:59:05 2010 (r208731) @@ -976,6 +976,8 @@ ksem_module_destroy(void) sx_destroy(&ksem_dict_lock); mtx_destroy(&ksem_count_lock); mtx_destroy(&sem_lock); + p31b_unsetcfg(CTL_P1003_1B_SEM_VALUE_MAX); + p31b_unsetcfg(CTL_P1003_1B_SEM_NSEMS_MAX); } static int Modified: head/sys/sys/posix4.h ============================================================================== --- head/sys/sys/posix4.h Wed Jun 2 09:34:41 2010 (r208730) +++ head/sys/sys/posix4.h Wed Jun 2 09:59:05 2010 (r208731) @@ -64,6 +64,7 @@ int p31b_proc(struct proc *, pid_t, stru void p31b_setcfg(int, int); int p31b_getcfg(int); int p31b_iscfg(int); +void p31b_unsetcfg(int); #ifdef _KPOSIX_PRIORITY_SCHEDULING From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 10:20:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B58B106566C; Wed, 2 Jun 2010 10:20:24 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 097258FC0C; Wed, 2 Jun 2010 10:20: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 o52AKN1n025117; Wed, 2 Jun 2010 10:20:23 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52AKNF2025109; Wed, 2 Jun 2010 10:20:23 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201006021020.o52AKNF2025109@svn.freebsd.org> From: Ulrich Spoerlein Date: Wed, 2 Jun 2010 10:20:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208732 - in head: games/pom lib/libgssapi lib/libpmc share/man/man4 share/man/man9 usr.bin/join usr.bin/newkey X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 10:20:24 -0000 Author: uqs Date: Wed Jun 2 10:20:23 2010 New Revision: 208732 URL: http://svn.freebsd.org/changeset/base/208732 Log: mdoc cleanup Garbage collect unused sections, macros and arguments. Fix prologue and remove empty lines. Found by: mdocml Modified: head/games/pom/pom.6 head/lib/libgssapi/gss_compare_name.3 head/lib/libpmc/pmc.ucf.3 head/share/man/man4/mpt.4 head/share/man/man9/make_dev.9 head/usr.bin/join/join.1 head/usr.bin/newkey/newkey.8 Modified: head/games/pom/pom.6 ============================================================================== --- head/games/pom/pom.6 Wed Jun 2 09:59:05 2010 (r208731) +++ head/games/pom/pom.6 Wed Jun 2 10:20:23 2010 (r208732) @@ -34,6 +34,7 @@ .\" .Dd May 31, 1993 .Dt POM 6 +.Os .Sh NAME .Nm pom .Nd display the phase of the moon Modified: head/lib/libgssapi/gss_compare_name.3 ============================================================================== --- head/lib/libgssapi/gss_compare_name.3 Wed Jun 2 09:59:05 2010 (r208731) +++ head/lib/libgssapi/gss_compare_name.3 Wed Jun 2 10:20:23 2010 (r208732) @@ -28,7 +28,7 @@ .\" .\" The following commands are required for all man pages. .Dd January 26, 2010 -.Dt GSS_COMPARE_NAME PRM +.Dt GSS_COMPARE_NAME 3 PRM .Os .Sh NAME .Nm gss_compare_name Modified: head/lib/libpmc/pmc.ucf.3 ============================================================================== --- head/lib/libpmc/pmc.ucf.3 Wed Jun 2 09:59:05 2010 (r208731) +++ head/lib/libpmc/pmc.ucf.3 Wed Jun 2 10:20:23 2010 (r208732) @@ -111,5 +111,3 @@ The library was written by .An "Joseph Koshy" .Aq jkoshy@FreeBSD.org . - - Modified: head/share/man/man4/mpt.4 ============================================================================== --- head/share/man/man4/mpt.4 Wed Jun 2 09:59:05 2010 (r208731) +++ head/share/man/man4/mpt.4 Wed Jun 2 10:20:23 2010 (r208732) @@ -183,4 +183,3 @@ by and .An Scott Long Aq scottl@FreeBSD.org have made more substantial improvements. -.Sh BUGS Modified: head/share/man/man9/make_dev.9 ============================================================================== --- head/share/man/man9/make_dev.9 Wed Jun 2 09:59:05 2010 (r208731) +++ head/share/man/man9/make_dev.9 Wed Jun 2 10:20:23 2010 (r208732) @@ -158,14 +158,14 @@ The function is equivalent to the call .Bd -literal -offset indent make_dev_credf(0, cdevsw, unit, cr, uid, gid, perms, fmt, ...); -.Ed . +.Ed .Pp The .Fn make_dev function call is the same as .Bd -literal -offset indent make_dev_credf(0, cdevsw, unit, NULL, uid, gid, perms, fmt, ...); -.Ed . +.Ed .Pp The .Fn make_dev_alias @@ -245,7 +245,7 @@ The function is the same as .Bd -literal -offset indent destroy_dev_sched(cdev, NULL, NULL); -.Ed . +.Ed .Pp The .Fn d_close Modified: head/usr.bin/join/join.1 ============================================================================== --- head/usr.bin/join/join.1 Wed Jun 2 09:59:05 2010 (r208731) +++ head/usr.bin/join/join.1 Wed Jun 2 10:20:23 2010 (r208732) @@ -48,8 +48,6 @@ .Oc .Op Fl e Ar string .Op Fl o Ar list -.Bk -words -.Ek .Op Fl t Ar char .Op Fl 1 Ar field .Op Fl 2 Ar field Modified: head/usr.bin/newkey/newkey.8 ============================================================================== --- head/usr.bin/newkey/newkey.8 Wed Jun 2 09:59:05 2010 (r208731) +++ head/usr.bin/newkey/newkey.8 Wed Jun 2 10:20:23 2010 (r208732) @@ -16,13 +16,13 @@ The .Nm utility is normally run by the network administrator on the Network Interface Service -(\s-1NIS\s0) +.Pq NIS master machine in order to establish public keys for users and super-users on the network. These keys are needed for using secure RPC or secure -NFS\s0. +NFS . .Pp The .Nm @@ -52,8 +52,8 @@ password of the given username. .Xr keyserv 8 .Sh NOTES The Network Information Service -(\s-1NIS\s0) +.Pq NIS was formerly known as Sun Yellow Pages -(\s-1YP\s0). +.Pq YP . The functionality of the two remains the same; only the name has changed. From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 10:20:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16B4F1065677; Wed, 2 Jun 2010 10:20:32 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 069268FC1A; Wed, 2 Jun 2010 10:20: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 o52AKVCA025184; Wed, 2 Jun 2010 10:20:31 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52AKVdR025182; Wed, 2 Jun 2010 10:20:31 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201006021020.o52AKVdR025182@svn.freebsd.org> From: Ulrich Spoerlein Date: Wed, 2 Jun 2010 10:20: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: r208733 - head/libexec/rbootd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 10:20:32 -0000 Author: uqs Date: Wed Jun 2 10:20:31 2010 New Revision: 208733 URL: http://svn.freebsd.org/changeset/base/208733 Log: mdoc: use literal text, not a column table to present the configuration file snippet. Modified: head/libexec/rbootd/rbootd.8 Modified: head/libexec/rbootd/rbootd.8 ============================================================================== --- head/libexec/rbootd/rbootd.8 Wed Jun 2 10:20:23 2010 (r208732) +++ head/libexec/rbootd/rbootd.8 Wed Jun 2 10:20:31 2010 (r208733) @@ -103,14 +103,14 @@ and/or comma characters. A pound sign causes the remainder of a line to be ignored. .Pp Here is a sample configuration file: -.Bl -column 08:00:09:0:66:ad SYSHPBSD,SYSHPUX -.It # -.It "# ethernet addr boot file(s) comments -.It # -.It "08:00:09:0:66:ad SYSHPBSD # snake (4.3BSD) -.It "08:00:09:0:59:5b # vandy (anything) -.It "8::9:1:C6:75 SYSHPBSD,SYSHPUX # jaguar (either) -.El +.Bd -literal +# +# ethernet addr boot file(s) comments +# +08:00:09:0:66:ad SYSHPBSD # snake (4.3BSD) +08:00:09:0:59:5b # vandy (anything) +8::9:1:C6:75 SYSHPBSD,SYSHPUX # jaguar (either) +.Ed .Pp The .Nm From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 10:20:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A915C106574A; Wed, 2 Jun 2010 10:20:38 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EBA48FC08; Wed, 2 Jun 2010 10:20: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 o52AKcCl025252; Wed, 2 Jun 2010 10:20:38 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52AKc8w025248; Wed, 2 Jun 2010 10:20:38 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201006021020.o52AKc8w025248@svn.freebsd.org> From: Ulrich Spoerlein Date: Wed, 2 Jun 2010 10:20: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: r208734 - in head/lib: libc/gen msun/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 10:20:38 -0000 Author: uqs Date: Wed Jun 2 10:20:38 2010 New Revision: 208734 URL: http://svn.freebsd.org/changeset/base/208734 Log: mdoc: spell macros correctly, there's no need for the backslash escape Modified: head/lib/libc/gen/scandir.3 head/lib/msun/man/atan2.3 head/lib/msun/man/remainder.3 Modified: head/lib/libc/gen/scandir.3 ============================================================================== --- head/lib/libc/gen/scandir.3 Wed Jun 2 10:20:31 2010 (r208733) +++ head/lib/libc/gen/scandir.3 Wed Jun 2 10:20:38 2010 (r208734) @@ -40,7 +40,7 @@ .Sh SYNOPSIS .In dirent.h .Ft int -.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpconst struct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst struct dirent **, const struct dirent **\\*(rp" +.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp" "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp" .Ft int .Fn alphasort "const struct dirent **d1" "const struct dirent **d2" .Sh DESCRIPTION Modified: head/lib/msun/man/atan2.3 ============================================================================== --- head/lib/msun/man/atan2.3 Wed Jun 2 10:20:31 2010 (r208733) +++ head/lib/msun/man/atan2.3 Wed Jun 2 10:20:38 2010 (r208734) @@ -114,7 +114,7 @@ if .Ar x > 0, .It Ta sign( Ns Ar y Ns )*(\*(Pi - -.Fn atan "\\*(Bay/x\\*(Ba" ) Ta +.Fn atan "\*(Bay/x\*(Ba" ) Ta if .Ar x < 0, @@ -122,7 +122,7 @@ if .No 0 Ta if x = y = 0, or .It Ta -.Pf sign( Ar y Ns )*\\*(Pi/2 Ta +.Pf sign( Ar y Ns )*\*(Pi/2 Ta if .Ar x = 0 \(!= Modified: head/lib/msun/man/remainder.3 ============================================================================== --- head/lib/msun/man/remainder.3 Wed Jun 2 10:20:31 2010 (r208733) +++ head/lib/msun/man/remainder.3 Wed Jun 2 10:20:38 2010 (r208734) @@ -76,10 +76,10 @@ is the integer nearest the exact value o .Fa x Ns / Ns Fa y ; .Ek moreover if -.Pf \\*(Ba Fa n +.Pf \*(Ba Fa n \- .Sm off -.Fa x No / Fa y No \\*(Ba +.Fa x No / Fa y No \*(Ba .Sm on = 1/2 @@ -89,11 +89,11 @@ is even. Consequently the remainder is computed exactly and .Sm off -.Pf \\*(Ba Fa r No \\*(Ba +.Pf \*(Ba Fa r No \*(Ba .Sm on \*(Le .Sm off -.Pf \\*(Ba Fa y No \\*(Ba/2 . +.Pf \*(Ba Fa y No \*(Ba/2 . .Sm on But attempting to take the remainder when .Fa y From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 11:06:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3BAC1065670; Wed, 2 Jun 2010 11:06:03 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ED348FC20; Wed, 2 Jun 2010 11:06: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 o52B63sf035370; Wed, 2 Jun 2010 11:06:03 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52B63PZ035362; Wed, 2 Jun 2010 11:06:03 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006021106.o52B63PZ035362@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 11:06: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: r208737 - in head: contrib/binutils/bfd contrib/binutils/gas/config contrib/binutils/include/elf contrib/binutils/include/opcode contrib/binutils/opcodes contrib/gcc/config contrib/gcc/... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 11:06:03 -0000 Author: jmallett Date: Wed Jun 2 11:06:03 2010 New Revision: 208737 URL: http://svn.freebsd.org/changeset/base/208737 Log: Add/improve mips64r2, Octeon, n32 and n64 support in the toolchain. o) Add TARGET_ABI to the MIPS toolchain build process. This sets the default ABI to one of o32, n32 or n64. If it is not set, o32 is assumed as that is the current default. o) Set the default GCC cpu type to any specified TARGET_CPUTYPE. This is necessary to have a working "cc" if e.g. mips64 is specified, as binutils will refuse to link objects using different ISAs in some cases. o) Add support for n32 and n64 ABIs to binutils and GCC. o) Add additional required libgcc2 stubs for n32 and n64. o) Add support for the "mips64r2" architecture to GCC. Add the "octeon" o) When static linking, wrap default libraries in --start-group and --end-group. This is required for static linking to work on n64 with the interdependencies between libraries there. This is what other OSes that support n64 seem to do, as well. o) Fix our GCC spec to define __mips64 for 64-bit targets, not __mips64__, the former being what libgcc, etc., check and the latter seemingly being a misspelling of a hand merge from a Linux spec. o) When no TARGET_CPUTYPE is specified at build time, make GCC take the default ISA from the ABI. Our old defaults were too liberal and assumed that 64-bit ABIs should default to the MIPS64 ISA and that 32-bit ABIs should default to the MIPS32 ISA, when we are supporting or will support some systems based on earlier 32-bit and 64-bit ISAs, most notably MIPS-III. o) Merge a new opcode file (and support code) from a later version of binutils and add flags and code necessary to support Octeon-specific instructions. This should also make merging opcodes for other modern architectures easier. Reviewed by: imp Added: head/contrib/gcc/config/fixdfdi.c head/contrib/gcc/config/fixsfdi.c head/contrib/gcc/config/fixunsdfsi.c head/contrib/gcc/config/fixunssfsi.c head/contrib/gcc/config/floatdidf.c head/contrib/gcc/config/floatdisf.c head/contrib/gcc/config/floatundidf.c head/contrib/gcc/config/floatundisf.c Modified: head/contrib/binutils/bfd/archures.c head/contrib/binutils/bfd/bfd-in2.h head/contrib/binutils/bfd/cpu-mips.c head/contrib/binutils/bfd/elfxx-mips.c head/contrib/binutils/gas/config/tc-mips.c head/contrib/binutils/gas/config/tc-mips.h head/contrib/binutils/include/elf/mips.h head/contrib/binutils/include/opcode/mips.h head/contrib/binutils/opcodes/mips-dis.c head/contrib/binutils/opcodes/mips-opc.c head/contrib/binutils/opcodes/mips16-opc.c head/contrib/gcc/config/mips/freebsd.h head/contrib/gcc/config/mips/mips.c head/contrib/gcc/config/mips/mips.h head/contrib/gcc/config/mips/mips.md head/gnu/lib/libgcc/Makefile head/gnu/lib/libgomp/Makefile head/gnu/usr.bin/binutils/Makefile.inc0 head/gnu/usr.bin/binutils/ld/Makefile.mips head/gnu/usr.bin/binutils/libbfd/Makefile.mips head/gnu/usr.bin/binutils/libbfd/bfd.h head/gnu/usr.bin/cc/Makefile.inc Modified: head/contrib/binutils/bfd/archures.c ============================================================================== --- head/contrib/binutils/bfd/archures.c Wed Jun 2 10:28:26 2010 (r208736) +++ head/contrib/binutils/bfd/archures.c Wed Jun 2 11:06:03 2010 (r208737) @@ -1,6 +1,6 @@ /* BFD library support routines for architectures. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Hacked by John Gilmore and Steve Chamberlain of Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -141,10 +141,12 @@ DESCRIPTION .#define bfd_mach_mips6000 6000 .#define bfd_mach_mips7000 7000 .#define bfd_mach_mips8000 8000 +.#define bfd_mach_mips9000 9000 .#define bfd_mach_mips10000 10000 .#define bfd_mach_mips12000 12000 .#define bfd_mach_mips16 16 .#define bfd_mach_mips5 5 +.#define bfd_mach_mips_octeon 6502 .#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *} .#define bfd_mach_mipsisa32 32 .#define bfd_mach_mipsisa32r2 33 Modified: head/contrib/binutils/bfd/bfd-in2.h ============================================================================== --- head/contrib/binutils/bfd/bfd-in2.h Wed Jun 2 10:28:26 2010 (r208736) +++ head/contrib/binutils/bfd/bfd-in2.h Wed Jun 2 11:06:03 2010 (r208737) @@ -8,7 +8,8 @@ /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -26,7 +27,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ Modified: head/contrib/binutils/bfd/cpu-mips.c ============================================================================== --- head/contrib/binutils/bfd/cpu-mips.c Wed Jun 2 10:28:26 2010 (r208736) +++ head/contrib/binutils/bfd/cpu-mips.c Wed Jun 2 11:06:03 2010 (r208737) @@ -1,6 +1,6 @@ /* bfd back-end for mips support Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ GNU General Public License for more deta You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -76,6 +76,7 @@ enum I_mips6000, I_mips7000, I_mips8000, + I_mips9000, I_mips10000, I_mips12000, I_mips16, @@ -84,6 +85,7 @@ enum I_mipsisa32r2, I_mipsisa64, I_mipsisa64r2, + I_mipsocteon, I_sb1, }; @@ -108,6 +110,7 @@ static const bfd_arch_info_type arch_inf N (32, 32, bfd_mach_mips6000, "mips:6000", FALSE, NN(I_mips6000)), N (64, 64, bfd_mach_mips7000, "mips:7000", FALSE, NN(I_mips7000)), N (64, 64, bfd_mach_mips8000, "mips:8000", FALSE, NN(I_mips8000)), + N (64, 64, bfd_mach_mips9000, "mips:9000", FALSE, NN(I_mips9000)), N (64, 64, bfd_mach_mips10000,"mips:10000", FALSE, NN(I_mips10000)), N (64, 64, bfd_mach_mips12000,"mips:12000", FALSE, NN(I_mips12000)), N (64, 64, bfd_mach_mips16, "mips:16", FALSE, NN(I_mips16)), @@ -116,6 +119,7 @@ static const bfd_arch_info_type arch_inf N (32, 32, bfd_mach_mipsisa32r2,"mips:isa32r2", FALSE, NN(I_mipsisa32r2)), N (64, 64, bfd_mach_mipsisa64, "mips:isa64", FALSE, NN(I_mipsisa64)), N (64, 64, bfd_mach_mipsisa64r2,"mips:isa64r2", FALSE, NN(I_mipsisa64r2)), + N (64, 64, bfd_mach_mips_octeon,"mips:octeon", FALSE, NN(I_mipsocteon)), N (64, 64, bfd_mach_mips_sb1, "mips:sb1", FALSE, 0), }; Modified: head/contrib/binutils/bfd/elfxx-mips.c ============================================================================== --- head/contrib/binutils/bfd/elfxx-mips.c Wed Jun 2 10:28:26 2010 (r208736) +++ head/contrib/binutils/bfd/elfxx-mips.c Wed Jun 2 11:06:03 2010 (r208737) @@ -1,6 +1,6 @@ /* MIPS-specific support for ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, . @@ -23,7 +23,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file handles functionality common to the different MIPS ABI's. */ @@ -4088,6 +4088,12 @@ _bfd_elf_mips_mach (flagword flags) case E_MIPS_MACH_5500: return bfd_mach_mips5500; + case E_MIPS_MACH_9000: + return bfd_mach_mips9000; + + case E_MIPS_MACH_OCTEON: + return bfd_mach_mips_octeon; + case E_MIPS_MACH_SB1: return bfd_mach_mips_sb1; @@ -7142,6 +7148,10 @@ mips_set_isa_flags (bfd *abfd) val = E_MIPS_ARCH_4 | E_MIPS_MACH_5500; break; + case bfd_mach_mips9000: + val = E_MIPS_ARCH_4 | E_MIPS_MACH_9000; + break; + case bfd_mach_mips5000: case bfd_mach_mips7000: case bfd_mach_mips8000: @@ -7154,6 +7164,10 @@ mips_set_isa_flags (bfd *abfd) val = E_MIPS_ARCH_5; break; + case bfd_mach_mips_octeon: + val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_OCTEON; + break; + case bfd_mach_mips_sb1: val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1; break; @@ -8856,6 +8870,9 @@ struct mips_mach_extension { are ordered topologically with MIPS I extensions listed last. */ static const struct mips_mach_extension mips_mach_extensions[] = { + /* MIPS64r2 extensions. */ + { bfd_mach_mips_octeon, bfd_mach_mipsisa64r2 }, + /* MIPS64 extensions. */ { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 }, { bfd_mach_mips_sb1, bfd_mach_mipsisa64 }, @@ -8879,6 +8896,7 @@ static const struct mips_mach_extension { bfd_mach_mips10000, bfd_mach_mips8000 }, { bfd_mach_mips5000, bfd_mach_mips8000 }, { bfd_mach_mips7000, bfd_mach_mips8000 }, + { bfd_mach_mips9000, bfd_mach_mips8000 }, /* VR4100 extensions. */ { bfd_mach_mips4120, bfd_mach_mips4100 }, @@ -8913,11 +8931,26 @@ mips_mach_extends_p (unsigned long base, { size_t i; - for (i = 0; extension != base && i < ARRAY_SIZE (mips_mach_extensions); i++) + if (extension == base) + return TRUE; + + if (base == bfd_mach_mipsisa32 + && mips_mach_extends_p (bfd_mach_mipsisa64, extension)) + return TRUE; + + if (base == bfd_mach_mipsisa32r2 + && mips_mach_extends_p (bfd_mach_mipsisa64r2, extension)) + return TRUE; + + for (i = 0; i < ARRAY_SIZE (mips_mach_extensions); i++) if (extension == mips_mach_extensions[i].extension) - extension = mips_mach_extensions[i].base; + { + extension = mips_mach_extensions[i].base; + if (extension == base) + return TRUE; + } - return extension == base; + return FALSE; } Modified: head/contrib/binutils/gas/config/tc-mips.c ============================================================================== --- head/contrib/binutils/gas/config/tc-mips.c Wed Jun 2 10:28:26 2010 (r208736) +++ head/contrib/binutils/gas/config/tc-mips.c Wed Jun 2 11:06:03 2010 (r208737) @@ -1,6 +1,6 @@ /* tc-mips.c -- assemble code for a MIPS chip. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by the OSF and Ralph Campbell. Written by Keith Knowles and Ralph Campbell, working independently. Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus @@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" #include "config.h" @@ -33,6 +33,7 @@ #include "opcode/mips.h" #include "itbl-ops.h" #include "dwarf2dbg.h" +#include "dw2gencfi.h" #ifdef DEBUG #define DBG(x) printf x @@ -83,6 +84,25 @@ int mips_flag_pdr = FALSE; int mips_flag_pdr = TRUE; #endif +/* Control generation of error message for unsupported instructions in + Octeon. Octeon does not have floating point, and all the instructions + that use floating point registers are not allowed in Elf targets but + are allowed in Linux targets by default. */ +#ifdef OCTEON_ERROR_ON_UNSUPPORTED +static int octeon_error_on_unsupported = 1; +#else +static int octeon_error_on_unsupported = 0; +#endif + +/* Control generation of Octeon/MIPS unaligned load/store instructions. + For ELF target, default to Octeon load/store instructions. + For Linux target, default to MIPS load/store instructions. */ +#ifdef OCTEON_USE_UNALIGN +static int octeon_use_unalign = 1; +#else +static int octeon_use_unalign = 0; +#endif + #include "ecoff.h" #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) @@ -111,9 +131,7 @@ static char *mips_regmask_frag; extern int target_big_endian; /* The name of the readonly data section. */ -#define RDATA_SECTION_NAME (OUTPUT_FLAVOR == bfd_target_aout_flavour \ - ? ".data" \ - : OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ +#define RDATA_SECTION_NAME (OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ ? ".rdata" \ : OUTPUT_FLAVOR == bfd_target_coff_flavour \ ? ".rdata" \ @@ -121,6 +139,43 @@ extern int target_big_endian; ? ".rodata" \ : (abort (), "")) +/* Information about an instruction, including its format, operands + and fixups. */ +struct mips_cl_insn +{ + /* The opcode's entry in mips_opcodes or mips16_opcodes. */ + const struct mips_opcode *insn_mo; + + /* True if this is a mips16 instruction and if we want the extended + form of INSN_MO. */ + bfd_boolean use_extend; + + /* The 16-bit extension instruction to use when USE_EXTEND is true. */ + unsigned short extend; + + /* The 16-bit or 32-bit bitstring of the instruction itself. This is + a copy of INSN_MO->match with the operands filled in. */ + unsigned long insn_opcode; + + /* The frag that contains the instruction. */ + struct frag *frag; + + /* The offset into FRAG of the first instruction byte. */ + long where; + + /* The relocs associated with the instruction, if any. */ + fixS *fixp[3]; + + /* True if this entry cannot be moved from its current position. */ + unsigned int fixed_p : 1; + + /* True if this instruction occured in a .set noreorder block. */ + unsigned int noreorder_p : 1; + + /* True for mips16 instructions that jump to an absolute address. */ + unsigned int mips16_absolute_jump_p : 1; +}; + /* The ABI to use. */ enum mips_abi_level { @@ -138,6 +193,10 @@ static enum mips_abi_level mips_abi = NO /* Whether or not we have code that can call pic code. */ int mips_abicalls = FALSE; +/* Whether or not we have code which can be put into a shared + library. */ +static bfd_boolean mips_in_shared = TRUE; + /* This is the set of options which may be modified by the .set pseudo-op. We use a struct so that .set push and .set pop are more reliable. */ @@ -153,6 +212,8 @@ struct mips_set_options command line options, and based on the default architecture. */ int ase_mips3d; int ase_mdmx; + int ase_dsp; + int ase_mt; /* Whether we are assembling for the mips16 processor. 0 if we are not, 1 if we are, and -1 if the value has not been initialized. Changed by `.set mips16' and `.set nomips16', and the -mips16 and @@ -187,6 +248,8 @@ struct mips_set_options /* MIPS architecture (CPU) type. Changed by .set arch=FOO, the -march command line option, and the default CPU. */ int arch; + /* True if ".set sym32" is in effect. */ + bfd_boolean sym32; }; /* True if -mgp32 was passed. */ @@ -201,7 +264,7 @@ static int file_mips_fp32 = -1; static struct mips_set_options mips_opts = { - ISA_UNKNOWN, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, CPU_UNKNOWN + ISA_UNKNOWN, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, CPU_UNKNOWN, FALSE }; /* These variables are filled in with the masks of registers used. @@ -225,6 +288,14 @@ static int file_ase_mips3d; command line (e.g., by -march). */ static int file_ase_mdmx; +/* True if -mdsp was passed or implied by arguments passed on the + command line (e.g., by -march). */ +static int file_ase_dsp; + +/* True if -mmt was passed or implied by arguments passed on the + command line (e.g., by -march). */ +static int file_ase_mt; + /* The argument of the -march= flag. The architecture we are assembling. */ static int file_mips_arch = CPU_UNKNOWN; static const char *mips_arch_string; @@ -268,6 +339,12 @@ static int mips_32bitmode = 0; || (ISA) == ISA_MIPS64R2 \ ) +/* Return true if ISA supports ins instructions. */ +#define ISA_HAS_INS(ISA) ( \ + (ISA) == ISA_MIPS32R2 \ + || (ISA) == ISA_MIPS64R2 \ + ) + #define HAVE_32BIT_GPRS \ (mips_opts.gp32 || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) @@ -284,15 +361,16 @@ static int mips_32bitmode = 0; /* True if relocations are stored in-place. */ #define HAVE_IN_PLACE_ADDENDS (!HAVE_NEWABI) -/* We can only have 64bit addresses if the object file format - supports it. */ -#define HAVE_32BIT_ADDRESSES \ - (HAVE_32BIT_GPRS \ - || ((bfd_arch_bits_per_address (stdoutput) == 32 \ - || ! HAVE_64BIT_OBJECTS) \ - && mips_pic != EMBEDDED_PIC)) - -#define HAVE_64BIT_ADDRESSES (! HAVE_32BIT_ADDRESSES) +/* The ABI-derived address size. */ +#define HAVE_64BIT_ADDRESSES \ + (HAVE_64BIT_GPRS && (mips_abi == EABI_ABI || mips_abi == N64_ABI)) +#define HAVE_32BIT_ADDRESSES (!HAVE_64BIT_ADDRESSES) + +/* The size of symbolic constants (i.e., expressions of the form + "SYMBOL" or "SYMBOL + OFFSET"). */ +#define HAVE_32BIT_SYMBOLS \ + (HAVE_32BIT_ADDRESSES || !HAVE_64BIT_OBJECTS || mips_opts.sym32) +#define HAVE_64BIT_SYMBOLS (!HAVE_32BIT_SYMBOLS) /* Addresses are loaded in different ways, depending on the address size in use. The n32 ABI Documentation also mandates the use of additions @@ -322,6 +400,14 @@ static int mips_32bitmode = 0; #define CPU_HAS_MDMX(cpu) (FALSE \ ) +/* Return true if the given CPU supports the DSP ASE. */ +#define CPU_HAS_DSP(cpu) (FALSE \ + ) + +/* Return true if the given CPU supports the MT ASE. */ +#define CPU_HAS_MT(cpu) (FALSE \ + ) + /* True if CPU has a dror instruction. */ #define CPU_HAS_DROR(CPU) ((CPU) == CPU_VR5400 || (CPU) == CPU_VR5500) @@ -349,7 +435,6 @@ static int mips_32bitmode = 0; || mips_opts.arch == CPU_R10000 \ || mips_opts.arch == CPU_R12000 \ || mips_opts.arch == CPU_RM7000 \ - || mips_opts.arch == CPU_SB1 \ || mips_opts.arch == CPU_VR5500 \ ) @@ -360,8 +445,6 @@ static int mips_32bitmode = 0; level I. */ #define gpr_interlocks \ (mips_opts.isa != ISA_MIPS1 \ - || mips_opts.arch == CPU_VR5400 \ - || mips_opts.arch == CPU_VR5500 \ || mips_opts.arch == CPU_R3900) /* Whether the processor uses hardware interlocks to avoid delays @@ -377,9 +460,6 @@ static int mips_32bitmode = 0; && mips_opts.isa != ISA_MIPS2 \ && mips_opts.isa != ISA_MIPS3) \ || mips_opts.arch == CPU_R4300 \ - || mips_opts.arch == CPU_VR5400 \ - || mips_opts.arch == CPU_VR5500 \ - || mips_opts.arch == CPU_SB1 \ ) /* Whether the processor uses hardware interlocks to protect reads @@ -521,44 +601,27 @@ static int mips_optimize = 2; equivalent to seeing no -g option at all. */ static int mips_debug = 0; -/* The previous instruction. */ -static struct mips_cl_insn prev_insn; - -/* The instruction before prev_insn. */ -static struct mips_cl_insn prev_prev_insn; +/* The maximum number of NOPs needed to avoid the VR4130 mflo/mfhi errata. */ +#define MAX_VR4130_NOPS 4 -/* If we don't want information for prev_insn or prev_prev_insn, we - point the insn_mo field at this dummy integer. */ -static const struct mips_opcode dummy_opcode = { NULL, NULL, 0, 0, 0, 0 }; +/* The maximum number of NOPs needed to fill delay slots. */ +#define MAX_DELAY_NOPS 2 -/* Non-zero if prev_insn is valid. */ -static int prev_insn_valid; +/* The maximum number of NOPs needed for any purpose. */ +#define MAX_NOPS 4 -/* The frag for the previous instruction. */ -static struct frag *prev_insn_frag; +/* A list of previous instructions, with index 0 being the most recent. + We need to look back MAX_NOPS instructions when filling delay slots + or working around processor errata. We need to look back one + instruction further if we're thinking about using history[0] to + fill a branch delay slot. */ +static struct mips_cl_insn history[1 + MAX_NOPS]; -/* The offset into prev_insn_frag for the previous instruction. */ -static long prev_insn_where; +/* Nop instructions used by emit_nop. */ +static struct mips_cl_insn nop_insn, mips16_nop_insn; -/* The reloc type for the previous instruction, if any. */ -static bfd_reloc_code_real_type prev_insn_reloc_type[3]; - -/* The reloc for the previous instruction, if any. */ -static fixS *prev_insn_fixp[3]; - -/* Non-zero if the previous instruction was in a delay slot. */ -static int prev_insn_is_delay_slot; - -/* Non-zero if the previous instruction was in a .set noreorder. */ -static int prev_insn_unreordered; - -/* Non-zero if the previous instruction uses an extend opcode (if - mips16). */ -static int prev_insn_extended; - -/* Non-zero if the previous previous instruction was in a .set - noreorder. */ -static int prev_prev_insn_unreordered; +/* The appropriate nop for the current mode. */ +#define NOP_INSN (mips_opts.mips16 ? &mips16_nop_insn : &nop_insn) /* If this is set, it points to a frag holding nop instructions which were inserted before the start of a noreorder section. If those @@ -625,8 +688,29 @@ static const unsigned int mips16_to_32_r 16, 17, 2, 3, 4, 5, 6, 7 }; +/* Classifies the kind of instructions we're interested in when + implementing -mfix-vr4120. */ +enum fix_vr4120_class { + FIX_VR4120_MACC, + FIX_VR4120_DMACC, + FIX_VR4120_MULT, + FIX_VR4120_DMULT, + FIX_VR4120_DIV, + FIX_VR4120_MTHILO, + NUM_FIX_VR4120_CLASSES +}; + +/* Given two FIX_VR4120_* values X and Y, bit Y of element X is set if + there must be at least one other instruction between an instruction + of type X and an instruction of type Y. */ +static unsigned int vr4120_conflicts[NUM_FIX_VR4120_CLASSES]; + +/* True if -mfix-vr4120 is in force. */ static int mips_fix_vr4120; +/* ...likewise -mfix-vr4130. */ +static int mips_fix_vr4130; + /* We don't relax branches by default, since this causes us to expand `la .l2 - .l1' if there's a branch between .l1 and .l2, because we fail to compute the offset before expanding the macro to the most @@ -820,6 +904,41 @@ static int mips_relax_branch; (((x) &~ (offsetT) 0x7fff) == 0 \ || (((x) &~ (offsetT) 0x7fff) == ~ (offsetT) 0x7fff)) +/* Is the given value a zero-extended 32-bit value? Or a negated one? */ +#define IS_ZEXT_32BIT_NUM(x) \ + (((x) &~ (offsetT) 0xffffffff) == 0 \ + || (((x) &~ (offsetT) 0xffffffff) == ~ (offsetT) 0xffffffff)) + +/* Replace bits MASK << SHIFT of STRUCT with the equivalent bits in + VALUE << SHIFT. VALUE is evaluated exactly once. */ +#define INSERT_BITS(STRUCT, VALUE, MASK, SHIFT) \ + (STRUCT) = (((STRUCT) & ~((MASK) << (SHIFT))) \ + | (((VALUE) & (MASK)) << (SHIFT))) + +/* Extract bits MASK << SHIFT from STRUCT and shift them right + SHIFT places. */ +#define EXTRACT_BITS(STRUCT, MASK, SHIFT) \ + (((STRUCT) >> (SHIFT)) & (MASK)) + +/* Change INSN's opcode so that the operand given by FIELD has value VALUE. + INSN is a mips_cl_insn structure and VALUE is evaluated exactly once. + + include/opcode/mips.h specifies operand fields using the macros + OP_MASK_ and OP_SH_. The MIPS16 equivalents start + with "MIPS16OP" instead of "OP". */ +#define INSERT_OPERAND(FIELD, INSN, VALUE) \ + INSERT_BITS ((INSN).insn_opcode, VALUE, OP_MASK_##FIELD, OP_SH_##FIELD) +#define MIPS16_INSERT_OPERAND(FIELD, INSN, VALUE) \ + INSERT_BITS ((INSN).insn_opcode, VALUE, \ + MIPS16OP_MASK_##FIELD, MIPS16OP_SH_##FIELD) + +/* Extract the operand given by FIELD from mips_cl_insn INSN. */ +#define EXTRACT_OPERAND(FIELD, INSN) \ + EXTRACT_BITS ((INSN).insn_opcode, OP_MASK_##FIELD, OP_SH_##FIELD) +#define MIPS16_EXTRACT_OPERAND(FIELD, INSN) \ + EXTRACT_BITS ((INSN).insn_opcode, \ + MIPS16OP_MASK_##FIELD, \ + MIPS16OP_SH_##FIELD) /* Global variables used when generating relaxable macros. See the comment above RELAX_ENCODE for more details about how relaxation @@ -866,7 +985,7 @@ enum mips_regclass { MIPS_GR_REG, MIPS_F static void append_insn (struct mips_cl_insn *ip, expressionS *p, bfd_reloc_code_real_type *r); -static void mips_no_prev_insn (int); +static void mips_no_prev_insn (void); static void mips16_macro_build (expressionS *, const char *, const char *, va_list); static void load_register (int, expressionS *, int); @@ -1092,8 +1211,6 @@ mips_target_format (void) { switch (OUTPUT_FLAVOR) { - case bfd_target_aout_flavour: - return target_big_endian ? "a.out-mips-big" : "a.out-mips-little"; case bfd_target_ecoff_flavour: return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT; case bfd_target_coff_flavour: @@ -1127,6 +1244,174 @@ mips_target_format (void) } } +/* Return the length of instruction INSN. */ + +static inline unsigned int +insn_length (const struct mips_cl_insn *insn) +{ + if (!mips_opts.mips16) + return 4; + return insn->mips16_absolute_jump_p || insn->use_extend ? 4 : 2; +} + +/* Initialise INSN from opcode entry MO. Leave its position unspecified. */ + +static void +create_insn (struct mips_cl_insn *insn, const struct mips_opcode *mo) +{ + size_t i; + + insn->insn_mo = mo; + insn->use_extend = FALSE; + insn->extend = 0; + insn->insn_opcode = mo->match; + insn->frag = NULL; + insn->where = 0; + for (i = 0; i < ARRAY_SIZE (insn->fixp); i++) + insn->fixp[i] = NULL; + insn->fixed_p = (mips_opts.noreorder > 0); + insn->noreorder_p = (mips_opts.noreorder > 0); + insn->mips16_absolute_jump_p = 0; +} + +/* Install INSN at the location specified by its "frag" and "where" fields. */ + +static void +install_insn (const struct mips_cl_insn *insn) +{ + char *f = insn->frag->fr_literal + insn->where; + if (!mips_opts.mips16) + md_number_to_chars (f, insn->insn_opcode, 4); + else if (insn->mips16_absolute_jump_p) + { + md_number_to_chars (f, insn->insn_opcode >> 16, 2); + md_number_to_chars (f + 2, insn->insn_opcode & 0xffff, 2); + } + else + { + if (insn->use_extend) + { + md_number_to_chars (f, 0xf000 | insn->extend, 2); + f += 2; + } + md_number_to_chars (f, insn->insn_opcode, 2); + } +} + +/* Move INSN to offset WHERE in FRAG. Adjust the fixups accordingly + and install the opcode in the new location. */ + +static void +move_insn (struct mips_cl_insn *insn, fragS *frag, long where) +{ + size_t i; + + insn->frag = frag; + insn->where = where; + for (i = 0; i < ARRAY_SIZE (insn->fixp); i++) + if (insn->fixp[i] != NULL) + { + insn->fixp[i]->fx_frag = frag; + insn->fixp[i]->fx_where = where; + } + install_insn (insn); +} + +/* Add INSN to the end of the output. */ + +static void +add_fixed_insn (struct mips_cl_insn *insn) +{ + char *f = frag_more (insn_length (insn)); + move_insn (insn, frag_now, f - frag_now->fr_literal); +} + +/* Start a variant frag and move INSN to the start of the variant part, + marking it as fixed. The other arguments are as for frag_var. */ + +static void +add_relaxed_insn (struct mips_cl_insn *insn, int max_chars, int var, + relax_substateT subtype, symbolS *symbol, offsetT offset) +{ + frag_grow (max_chars); + move_insn (insn, frag_now, frag_more (0) - frag_now->fr_literal); + insn->fixed_p = 1; + frag_var (rs_machine_dependent, max_chars, var, + subtype, symbol, offset, NULL); +} + +/* Insert N copies of INSN into the history buffer, starting at + position FIRST. Neither FIRST nor N need to be clipped. */ + +static void +insert_into_history (unsigned int first, unsigned int n, + const struct mips_cl_insn *insn) +{ + if (mips_relax.sequence != 2) + { + unsigned int i; + + for (i = ARRAY_SIZE (history); i-- > first;) + if (i >= first + n) + history[i] = history[i - n]; + else + history[i] = *insn; + } +} + +/* Emit a nop instruction, recording it in the history buffer. */ + +static void +emit_nop (void) +{ + add_fixed_insn (NOP_INSN); + insert_into_history (0, 1, NOP_INSN); +} + +/* Initialize vr4120_conflicts. There is a bit of duplication here: + the idea is to make it obvious at a glance that each errata is + included. */ + +static void +init_vr4120_conflicts (void) +{ +#define CONFLICT(FIRST, SECOND) \ + vr4120_conflicts[FIX_VR4120_##FIRST] |= 1 << FIX_VR4120_##SECOND + + /* Errata 21 - [D]DIV[U] after [D]MACC */ + CONFLICT (MACC, DIV); + CONFLICT (DMACC, DIV); + + /* Errata 23 - Continuous DMULT[U]/DMACC instructions. */ + CONFLICT (DMULT, DMULT); + CONFLICT (DMULT, DMACC); + CONFLICT (DMACC, DMULT); + CONFLICT (DMACC, DMACC); + + /* Errata 24 - MT{LO,HI} after [D]MACC */ + CONFLICT (MACC, MTHILO); + CONFLICT (DMACC, MTHILO); + + /* VR4181A errata MD(1): "If a MULT, MULTU, DMULT or DMULTU + instruction is executed immediately after a MACC or DMACC + instruction, the result of [either instruction] is incorrect." */ + CONFLICT (MACC, MULT); + CONFLICT (MACC, DMULT); + CONFLICT (DMACC, MULT); + CONFLICT (DMACC, DMULT); + + /* VR4181A errata MD(4): "If a MACC or DMACC instruction is + executed immediately after a DMULT, DMULTU, DIV, DIVU, + DDIV or DDIVU instruction, the result of the MACC or + DMACC instruction is incorrect.". */ + CONFLICT (DMULT, MACC); + CONFLICT (DMULT, DMACC); + CONFLICT (DIV, MACC); + CONFLICT (DIV, DMACC); + +#undef CONFLICT +} + /* This function is called once, at assembler startup time. It should set up all the tables, etc. that the MD part of the assembler will need. */ @@ -1137,6 +1422,13 @@ md_begin (void) int i = 0; int broken = 0; + if (mips_pic != NO_PIC) + { + if (g_switch_seen && g_switch_value != 0) + as_bad (_("-G may not be used in position-independent code")); + g_switch_value = 0; + } + if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_arch)) as_warn (_("Could not set architecture and machine")); @@ -1160,6 +1452,11 @@ md_begin (void) { if (!validate_mips_insn (&mips_opcodes[i])) broken = 1; + if (nop_insn.insn_mo == NULL && strcmp (name, "nop") == 0) + { + create_insn (&nop_insn, mips_opcodes + i); + nop_insn.fixed_p = 1; + } } ++i; } @@ -1187,6 +1484,11 @@ md_begin (void) mips16_opcodes[i].name, mips16_opcodes[i].args); broken = 1; } + if (mips16_nop_insn.insn_mo == NULL && strcmp (name, "nop") == 0) + { + create_insn (&mips16_nop_insn, mips16_opcodes + i); + mips16_nop_insn.fixed_p = 1; + } ++i; } while (i < bfd_mips16_num_opcodes @@ -1239,7 +1541,7 @@ md_begin (void) &zero_address_frag)); } - mips_no_prev_insn (FALSE); + mips_no_prev_insn (); mips_gprmask = 0; mips_cprmask[0] = 0; @@ -1250,15 +1552,15 @@ md_begin (void) /* set the default alignment for the text section (2**2) */ record_alignment (text_section, 2); - if (USE_GLOBAL_POINTER_OPT) - bfd_set_gp_size (stdoutput, g_switch_value); + bfd_set_gp_size (stdoutput, g_switch_value); if (OUTPUT_FLAVOR == bfd_target_elf_flavour) { /* On a native system, sections must be aligned to 16 byte - boundaries. When configured for an embedded ELF target, we + boundaries. When configured for an embedded ELF target, we don't bother. */ - if (strcmp (TARGET_OS, "elf") != 0) + if (strcmp (TARGET_OS, "elf") != 0 + && strcmp (TARGET_OS, "vxworks") != 0) { (void) bfd_set_section_alignment (stdoutput, text_section, 4); (void) bfd_set_section_alignment (stdoutput, data_section, 4); @@ -1346,6 +1648,9 @@ md_begin (void) if (! ECOFF_DEBUGGING) md_obj_begin (); + + if (mips_fix_vr4120) + init_vr4120_conflicts (); } void @@ -1408,8 +1713,8 @@ md_assemble (char *str) } /* Return true if the given relocation might need a matching %lo(). - Note that R_MIPS_GOT16 relocations only need a matching %lo() when - applied to local symbols. */ + This is only "might" because SVR4 R_MIPS_GOT16 relocations only + need a matching %lo() when applied to local symbols. */ static inline bfd_boolean reloc_needs_lo_p (bfd_reloc_code_real_type reloc) @@ -1434,7 +1739,7 @@ fixup_has_matching_lo_p (fixS *fixp) of register. */ static int -insn_uses_reg (struct mips_cl_insn *ip, unsigned int reg, +insn_uses_reg (const struct mips_cl_insn *ip, unsigned int reg, enum mips_regclass class) { if (class == MIPS16_REG) @@ -1459,38 +1764,33 @@ insn_uses_reg (struct mips_cl_insn *ip, because there is no instruction that sets both $f0 and $f1 and requires a delay. */ if ((ip->insn_mo->pinfo & INSN_READ_FPR_S) - && ((((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS) &~(unsigned)1) + && ((EXTRACT_OPERAND (FS, *ip) & ~(unsigned) 1) == (reg &~ (unsigned) 1))) return 1; if ((ip->insn_mo->pinfo & INSN_READ_FPR_T) - && ((((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT) &~(unsigned)1) + && ((EXTRACT_OPERAND (FT, *ip) & ~(unsigned) 1) == (reg &~ (unsigned) 1))) return 1; } else if (! mips_opts.mips16) { if ((ip->insn_mo->pinfo & INSN_READ_GPR_S) - && ((ip->insn_opcode >> OP_SH_RS) & OP_MASK_RS) == reg) + && EXTRACT_OPERAND (RS, *ip) == reg) return 1; if ((ip->insn_mo->pinfo & INSN_READ_GPR_T) - && ((ip->insn_opcode >> OP_SH_RT) & OP_MASK_RT) == reg) + && EXTRACT_OPERAND (RT, *ip) == reg) return 1; } else { if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_X) - && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RX) - & MIPS16OP_MASK_RX)] - == reg)) + && mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, *ip)] == reg) return 1; if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Y) - && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RY) - & MIPS16OP_MASK_RY)] - == reg)) + && mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RY, *ip)] == reg) return 1; if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Z) - && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_MOVE32Z) - & MIPS16OP_MASK_MOVE32Z)] + && (mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (MOVE32Z, *ip)] == reg)) return 1; if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_T) && reg == TREG) @@ -1500,8 +1800,7 @@ insn_uses_reg (struct mips_cl_insn *ip, if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_31) && reg == RA) return 1; if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_GPR_X) - && ((ip->insn_opcode >> MIPS16OP_SH_REGR32) - & MIPS16OP_MASK_REGR32) == reg) + && MIPS16_EXTRACT_OPERAND (REGR32, *ip) == reg) return 1; } @@ -1516,7 +1815,7 @@ reg_needs_delay (unsigned int reg) { unsigned long prev_pinfo; - prev_pinfo = prev_insn.insn_mo->pinfo; + prev_pinfo = history[0].insn_mo->pinfo; if (! mips_opts.noreorder && (((prev_pinfo & INSN_LOAD_MEMORY_DELAY) && ! gpr_interlocks) @@ -1527,13 +1826,33 @@ reg_needs_delay (unsigned int reg) delay the use of general register rt for one instruction. */ /* Itbl support may require additional care here. */ know (prev_pinfo & INSN_WRITE_GPR_T); - if (reg == ((prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT)) + if (reg == EXTRACT_OPERAND (RT, history[0])) return 1; } return 0; } +/* Move all labels in insn_labels to the current insertion point. */ + +static void +mips_move_labels (void) +{ + struct insn_label_list *l; + valueT val; + + for (l = insn_labels; l != NULL; l = l->next) + { + assert (S_GET_SEGMENT (l->label) == now_seg); + symbol_set_frag (l->label, frag_now); + val = (valueT) frag_now_fix (); + /* mips16 text labels are stored as odd. */ + if (mips_opts.mips16) + ++val; + S_SET_VALUE (l->label, val); + } +} + /* Mark instruction labels in mips16 mode. This permits the linker to handle them specially, such as generating jalx instructions when needed. We also make them odd for the duration of the assembly, in @@ -1609,6 +1928,273 @@ relax_end (void) mips_relax.sequence = 0; } +/* Classify an instruction according to the FIX_VR4120_* enumeration. + Return NUM_FIX_VR4120_CLASSES if the instruction isn't affected + by VR4120 errata. */ + +static unsigned int +classify_vr4120_insn (const char *name) +{ + if (strncmp (name, "macc", 4) == 0) + return FIX_VR4120_MACC; + if (strncmp (name, "dmacc", 5) == 0) + return FIX_VR4120_DMACC; + if (strncmp (name, "mult", 4) == 0) + return FIX_VR4120_MULT; + if (strncmp (name, "dmult", 5) == 0) + return FIX_VR4120_DMULT; + if (strstr (name, "div")) + return FIX_VR4120_DIV; + if (strcmp (name, "mtlo") == 0 || strcmp (name, "mthi") == 0) + return FIX_VR4120_MTHILO; + return NUM_FIX_VR4120_CLASSES; +} + +/* Return the number of instructions that must separate INSN1 and INSN2, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 12:17:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 104A11065675; Wed, 2 Jun 2010 12:17:02 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id C11298FC17; Wed, 2 Jun 2010 12:17:01 +0000 (UTC) Received: by pwj1 with SMTP id 1so1290194pwj.13 for ; Wed, 02 Jun 2010 05:17:01 -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=WZVpKJipn/bi54y3AS8mws9k3kzcGwnQ+QzvLOute5g=; b=YoVFB34ZfLeSOUcR5H4quLvj004fdYcoK8JWMKR/du+I4Xk1mZ09VymBmZdGWG6O3C zSkcqj8Va+SApFRI7czKMLXygI5xYoXpKZgyPBHjHu5QCb1pUsZ+fXC0CKdZPzv13o0x cB1Sqx4a8tf47LtzMwqwwr4cCPnaDB34iOTRs= 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=W895eVpXcGTb6or4vb2K5rT7wI4H5Nc/uqJeC4zFGBiMe/2zG6w0awOmw28PhduV3w dYB4A+/htoOmV39wkaT3TXvpgslCP5++MljrENdAxR/v09yDvl+Hug0lTRPUIHtaoMkO 6H7rGQiVnbbqn9U5Iceu7PGRGUnEmq6wsHW78= MIME-Version: 1.0 Received: by 10.141.53.3 with SMTP id f3mr6280935rvk.195.1275481021282; Wed, 02 Jun 2010 05:17:01 -0700 (PDT) Received: by 10.141.4.3 with HTTP; Wed, 2 Jun 2010 05:17:01 -0700 (PDT) In-Reply-To: <4C05F9BC.40409@cs.rice.edu> References: <201005271005.o4RA5eVu032269@svn.freebsd.org> <4C058145.3000707@cs.rice.edu> <4C05F9BC.40409@cs.rice.edu> Date: Wed, 2 Jun 2010 17:47:01 +0530 Message-ID: From: "C. Jayachandran" To: Alan Cox Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "Jayachandran C." , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Randall Stewart Subject: Re: svn commit: r208589 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 12:17:02 -0000 On Wed, Jun 2, 2010 at 11:57 AM, Alan Cox wrote: > C. Jayachandran wrote: >> >> On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox wrote: >> >>> >>> On 5/27/2010 5:05 AM, Jayachandran C. wrote: >>> >>>> >>>> Author: jchandra >>>> Date: Thu May 27 10:05:40 2010 >>>> New Revision: 208589 >>>> URL: http://svn.freebsd.org/changeset/base/208589 >>>> >>>> Log: >>>> =A0Call VM_WAIT in pmap_ptpgzone_allocf() if =A0M_WAITOK is set. >>>> =A0Removed unused variable. >>>> >>>> =A0Approved by: rrs (mentor) >>>> >>>> >>>> >>> >>> I'm afraid that this will work some of the time, but not all of the tim= e. >>> =A0Specifically, there is no guarantee that any of the available free (= or >>> cached) pages after the VM_WAIT will fall within the range of suitable >>> physical addresses. =A0Moreover, and perhaps most worrisome, is that th= is >>> function could do a lot of spinning. =A0Every time this function sleeps= and >>> a >>> single page is freed (or cached) by someone else, this function will be >>> reawakened. =A0With a little bad luck, you could spin indefinitely. >>> >>> For essentially this reason, contigmalloc(), kmem_alloc_contig(), and >>> kmem_alloc_attr() don't use VM_WAIT, but instead a function called >>> vm_contig_grow_cache(). >>> >> >> I had seen the vm_contig_grow_cache() usage, but could not use it as >> it was defined as a static function. >> >> I did not want to use contigmalloc()/kmem_alloc_contig() either, >> because the pages in that memory region are already direct mapped and >> setting up another mapping is not necessary. The overall idea is to >> allocate pages in the direct mapped region for the page table entries >> so that we don't take a TLB exception while accessing page tables >> (which is costly as MIPS has a software TLB exception handler). >> >> Can you suggest the right way to do this? I will make the changes and >> send a patch for approval. >> > > I would encourage you to make vm_contig_grow_cache() an extern function a= nd > use it. =A0(vm/vm_pageout.h is probably the best place for the function > prototype.) I'll create a patch for this and related changes in mips/mips/pmap.c > If you're interested in taking this a small step further, it would make > sense to add two parameters to vm_contig_grow_cache() and > vm_contig_launder(): a "low" and a "high" physical address. > =A0vm_contig_launder() could then skip pages that are outside the desired > range. I am looking at this now, part of the logic which vm_phys_alloc_contig() uses to check pages address should work here. Will send out changes for this, if it works out. Thanks, JC. From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 14:01:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF2691065674; Wed, 2 Jun 2010 14:01:02 +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 7E51B8FC18; Wed, 2 Jun 2010 14:01:02 +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 2ACC346C0B; Wed, 2 Jun 2010 10:01:02 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 1A0428A01F; Wed, 2 Jun 2010 10:01:01 -0400 (EDT) From: John Baldwin To: Juli Mallett Date: Wed, 2 Jun 2010 08:42:49 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <201006021106.o52B63PZ035362@svn.freebsd.org> In-Reply-To: <201006021106.o52B63PZ035362@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201006020842.49509.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 02 Jun 2010 10:01:01 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 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: r208737 - in head: contrib/binutils/bfd contrib/binutils/gas/config contrib/binutils/include/elf contrib/binutils/include/opcode contrib/binutils/opcodes contrib/gcc/config contrib/gcc/... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 14:01:02 -0000 On Wednesday 02 June 2010 7:06:03 am Juli Mallett wrote: > Author: jmallett > Date: Wed Jun 2 11:06:03 2010 > New Revision: 208737 > URL: http://svn.freebsd.org/changeset/base/208737 > > Log: > Add/improve mips64r2, Octeon, n32 and n64 support in the toolchain. > > o) Fix our GCC spec to define __mips64 for 64-bit targets, not __mips64__, the > former being what libgcc, etc., check and the latter seemingly being a > misspelling of a hand merge from a Linux spec. I wonder if it would be useful to define both? The macros we check for architecture-specific code for other architectures all have both leading and trailing underscores (e.g. __i386__, __amd64__, etc.). Being able to use __mips64__ instead of __mips64 for that in kernel sources, etc. would be more consistent. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 15:09:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 074E41065670; Wed, 2 Jun 2010 15:09:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1A7A8FC15; Wed, 2 Jun 2010 15:09: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 o52F9a46089124; Wed, 2 Jun 2010 15:09:36 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52F9aJN089123; Wed, 2 Jun 2010 15:09:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201006021509.o52F9aJN089123@svn.freebsd.org> From: John Baldwin Date: Wed, 2 Jun 2010 15:09: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: r208742 - head/sys/i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 15:09:37 -0000 Author: jhb Date: Wed Jun 2 15:09:36 2010 New Revision: 208742 URL: http://svn.freebsd.org/changeset/base/208742 Log: MFamd64: Add a new macro PCPU_XEN_FIELDS to hold XEN-specific per-CPU fields that is always included in PCPU_MD_FIELDS. The macro is empty for non-XEN kernels. This avoids duplicating non-XEN per-CPU fields in two places. While here, remove several unused fields from the XEN-specific structure. Reviewed by: kmacy, gibbs MFC after: 1 month Modified: head/sys/i386/include/pcpu.h Modified: head/sys/i386/include/pcpu.h ============================================================================== --- head/sys/i386/include/pcpu.h Wed Jun 2 11:21:35 2010 (r208741) +++ head/sys/i386/include/pcpu.h Wed Jun 2 15:09:36 2010 (r208742) @@ -62,36 +62,20 @@ struct shadow_time_info { uint32_t version; }; - -#define PCPU_MD_FIELDS \ - char pc_monitorbuf[128] __aligned(128); /* cache line */ \ - struct pcpu *pc_prvspace; /* Self-reference */ \ - struct pmap *pc_curpmap; \ - struct i386tss pc_common_tss; \ - struct segment_descriptor pc_common_tssd; \ - struct segment_descriptor *pc_tss_gdt; \ - struct segment_descriptor *pc_fsgs_gdt; \ - vm_paddr_t *pc_pdir_shadow; \ - int pc_currentldt; \ - u_int pc_acpi_id; /* ACPI CPU id */ \ - u_int pc_apic_id; \ - int pc_private_tss; /* Flag indicating private tss*/\ - u_int pc_cmci_mask; /* MCx banks for CMCI */ \ - u_int pc_cr3; /* track cr3 for R1/R3*/ \ - u_int pc_pdir; \ - u_int pc_lazypmap; \ - u_int pc_rendezvous; \ - u_int pc_cpuast; \ - uint64_t pc_processed_system_time; \ +#define PCPU_XEN_FIELDS \ + ; \ + u_int pc_cr3; /* track cr3 for R1/R3*/ \ + vm_paddr_t *pc_pdir_shadow; \ + uint64_t pc_processed_system_time; \ struct shadow_time_info pc_shadow_time; \ int pc_resched_irq; \ int pc_callfunc_irq; \ - int pc_virq_to_irq[NR_VIRQS]; \ - int pc_ipi_to_irq[NR_IPIS] - - - + int pc_virq_to_irq[NR_VIRQS]; \ + int pc_ipi_to_irq[NR_IPIS] #else +#define PCPU_XEN_FIELDS +#endif + #define PCPU_MD_FIELDS \ char pc_monitorbuf[128] __aligned(128); /* cache line */ \ struct pcpu *pc_prvspace; /* Self-reference */ \ @@ -105,8 +89,7 @@ struct shadow_time_info { u_int pc_apic_id; \ int pc_private_tss; /* Flag indicating private tss*/\ u_int pc_cmci_mask /* MCx banks for CMCI */ \ - -#endif + PCPU_XEN_FIELDS #ifdef _KERNEL From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 15:29:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4E631065670; Wed, 2 Jun 2010 15:29:21 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B46B08FC18; Wed, 2 Jun 2010 15:29: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 o52FTL6K093437; Wed, 2 Jun 2010 15:29:21 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52FTLgn093435; Wed, 2 Jun 2010 15:29:21 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201006021529.o52FTLgn093435@svn.freebsd.org> From: Marko Zec Date: Wed, 2 Jun 2010 15:29: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: r208743 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 15:29:21 -0000 Author: zec Date: Wed Jun 2 15:29:21 2010 New Revision: 208743 URL: http://svn.freebsd.org/changeset/base/208743 Log: Provide a macro for registering a virtualized sysctl handler for VNET opaque data. MFC after: 30 days Modified: head/sys/net/vnet.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Wed Jun 2 15:09:36 2010 (r208742) +++ head/sys/net/vnet.h Wed Jun 2 15:29:21 2010 (r208743) @@ -245,6 +245,11 @@ int vnet_sysctl_handle_uint(SYSCTL_HANDL fmt, descr) \ SYSCTL_OID(parent, nbr, name, CTLFLAG_VNET|(access), ptr, arg, \ handler, fmt, descr) +#define SYSCTL_VNET_OPAQUE(parent, nbr, name, access, ptr, len, fmt, \ + descr) \ + SYSCTL_OID(parent, nbr, name, \ + CTLTYPE_OPAQUE|CTLFLAG_VNET|(access), ptr, len, \ + vnet_sysctl_handle_opaque, fmt, descr) #define SYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_STRING|CTLFLAG_VNET|(access), \ @@ -398,6 +403,9 @@ do { \ fmt, descr) \ SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, \ descr) +#define SYSCTL_VNET_OPAQUE(parent, nbr, name, access, ptr, len, fmt, \ + descr) \ + SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) #define SYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr) \ SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) #define SYSCTL_VNET_STRUCT(parent, nbr, name, access, ptr, type, descr) \ From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 15:44:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09A87106567B; Wed, 2 Jun 2010 15:44:44 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBC638FC23; Wed, 2 Jun 2010 15:44: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 o52FihJB096864; Wed, 2 Jun 2010 15:44:43 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52FihFL096861; Wed, 2 Jun 2010 15:44:43 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <201006021544.o52FihFL096861@svn.freebsd.org> From: Marko Zec Date: Wed, 2 Jun 2010 15:44: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: r208744 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 15:44:44 -0000 Author: zec Date: Wed Jun 2 15:44:43 2010 New Revision: 208744 URL: http://svn.freebsd.org/changeset/base/208744 Log: Virtualize the IPv4 multicast routing code. Submitted by: iprebeg Reviewed by: bms, bz, Pavlin Radoslavov MFC after: 30 days Modified: head/sys/netinet/ip_mroute.c head/sys/netinet/ip_mroute.h head/sys/netinet/pim_var.h Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Wed Jun 2 15:29:21 2010 (r208743) +++ head/sys/netinet/ip_mroute.c Wed Jun 2 15:44:43 2010 (r208744) @@ -121,6 +121,9 @@ __FBSDID("$FreeBSD$"); #define VIFI_INVALID ((vifi_t) -1) #define M_HASCL(m) ((m)->m_flags & M_EXT) +static VNET_DEFINE(uint32_t, last_tv_sec); /* last time we processed this */ +#define V_last_tv_sec VNET(last_tv_sec) + static MALLOC_DEFINE(M_MRTABLE, "mroutetbl", "multicast forwarding cache"); /* @@ -139,21 +142,28 @@ static struct mtx mrouter_mtx; mtx_init(&mrouter_mtx, "IPv4 multicast forwarding", NULL, MTX_DEF) #define MROUTER_LOCK_DESTROY() mtx_destroy(&mrouter_mtx) -static struct mrtstat mrtstat; -SYSCTL_STRUCT(_net_inet_ip, OID_AUTO, mrtstat, CTLFLAG_RW, - &mrtstat, mrtstat, +static int ip_mrouter_cnt; /* # of vnets with active mrouters */ +static int ip_mrouter_unloading; /* Allow no more V_ip_mrouter sockets */ + +static VNET_DEFINE(struct mrtstat, mrtstat); +#define V_mrtstat VNET(mrtstat) +SYSCTL_VNET_STRUCT(_net_inet_ip, OID_AUTO, mrtstat, CTLFLAG_RW, + &VNET_NAME(mrtstat), mrtstat, "IPv4 Multicast Forwarding Statistics (struct mrtstat, " "netinet/ip_mroute.h)"); -static u_long mfchash; -#define MFCHASH(a, g) \ +static VNET_DEFINE(u_long, mfchash); +#define V_mfchash VNET(mfchash) +#define MFCHASH(a, g) \ ((((a).s_addr >> 20) ^ ((a).s_addr >> 10) ^ (a).s_addr ^ \ - ((g).s_addr >> 20) ^ ((g).s_addr >> 10) ^ (g).s_addr) & mfchash) -#define MFCHASHSIZE 256 + ((g).s_addr >> 20) ^ ((g).s_addr >> 10) ^ (g).s_addr) & V_mfchash) +#define MFCHASHSIZE 256 -static u_char *nexpire; /* 0..mfchashsize-1 */ -static u_long mfchashsize; /* Hash size */ -LIST_HEAD(mfchashhdr, mfc) *mfchashtbl; +static u_long mfchashsize; /* Hash size */ +static VNET_DEFINE(u_char *, nexpire); /* 0..mfchashsize-1 */ +#define V_nexpire VNET(nexpire) +static VNET_DEFINE(LIST_HEAD(mfchashhdr, mfc)*, mfchashtbl); +#define V_mfchashtbl VNET(mfchashtbl) static struct mtx mfc_mtx; #define MFC_LOCK() mtx_lock(&mfc_mtx) @@ -163,10 +173,12 @@ static struct mtx mfc_mtx; mtx_init(&mfc_mtx, "IPv4 multicast forwarding cache", NULL, MTX_DEF) #define MFC_LOCK_DESTROY() mtx_destroy(&mfc_mtx) -static vifi_t numvifs; -static struct vif viftable[MAXVIFS]; -SYSCTL_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_RD, - &viftable, sizeof(viftable), "S,vif[MAXVIFS]", +static VNET_DEFINE(vifi_t, numvifs); +#define V_numvifs VNET(numvifs) +static VNET_DEFINE(struct vif, viftable[MAXVIFS]); +#define V_viftable VNET(viftable) +SYSCTL_VNET_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_RD, + &VNET_NAME(viftable), sizeof(V_viftable), "S,vif[MAXVIFS]", "IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)"); static struct mtx vif_mtx; @@ -179,7 +191,9 @@ static struct mtx vif_mtx; static eventhandler_tag if_detach_event_tag = NULL; -static struct callout expire_upcalls_ch; +static VNET_DEFINE(struct callout, expire_upcalls_ch); +#define V_expire_upcalls_ch VNET(expire_upcalls_ch) + #define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ #define UPCALL_EXPIRE 6 /* number of timeouts */ @@ -191,25 +205,32 @@ static MALLOC_DEFINE(M_BWMETER, "bwmeter * Pending timeouts are stored in a hash table, the key being the * expiration time. Periodically, the entries are analysed and processed. */ -#define BW_METER_BUCKETS 1024 -static struct bw_meter *bw_meter_timers[BW_METER_BUCKETS]; -static struct callout bw_meter_ch; -#define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ +#define BW_METER_BUCKETS 1024 +static VNET_DEFINE(struct bw_meter*, bw_meter_timers[BW_METER_BUCKETS]); +#define V_bw_meter_timers VNET(bw_meter_timers) +static VNET_DEFINE(struct callout, bw_meter_ch); +#define V_bw_meter_ch VNET(bw_meter_ch) +#define BW_METER_PERIOD (hz) /* periodical handling of bw meters */ /* * Pending upcalls are stored in a vector which is flushed when * full, or periodically */ -static struct bw_upcall bw_upcalls[BW_UPCALLS_MAX]; -static u_int bw_upcalls_n; /* # of pending upcalls */ -static struct callout bw_upcalls_ch; +static VNET_DEFINE(struct bw_upcall, bw_upcalls[BW_UPCALLS_MAX]); +#define V_bw_upcalls VNET(bw_upcalls) +static VNET_DEFINE(u_int, bw_upcalls_n); /* # of pending upcalls */ +#define V_bw_upcalls_n VNET(bw_upcalls_n) +static VNET_DEFINE(struct callout, bw_upcalls_ch); +#define V_bw_upcalls_ch VNET(bw_upcalls_ch) + #define BW_UPCALLS_PERIOD (hz) /* periodical flush of bw upcalls */ -static struct pimstat pimstat; +static VNET_DEFINE(struct pimstat, pimstat); +#define V_pimstat VNET(pimstat) SYSCTL_NODE(_net_inet, IPPROTO_PIM, pim, CTLFLAG_RW, 0, "PIM"); -SYSCTL_STRUCT(_net_inet_pim, PIMCTL_STATS, stats, CTLFLAG_RD, - &pimstat, pimstat, +SYSCTL_VNET_STRUCT(_net_inet_pim, PIMCTL_STATS, stats, CTLFLAG_RD, + &VNET_NAME(pimstat), pimstat, "PIM Statistics (struct pimstat, netinet/pim_var.h)"); static u_long pim_squelch_wholepkt = 0; @@ -275,8 +296,10 @@ static struct pim_encap_pimhdr pim_encap 0 /* flags */ }; -static struct ifnet multicast_register_if; -static vifi_t reg_vif_num = VIFI_INVALID; +static VNET_DEFINE(vifi_t, reg_vif_num) = VIFI_INVALID; +#define V_reg_vif_num VNET(reg_vif_num) +static VNET_DEFINE(struct ifnet, multicast_register_if); +#define V_multicast_register_if VNET(multicast_register_if) /* * Private variables. @@ -344,9 +367,10 @@ static const uint32_t mrt_api_support = MRT_MFC_FLAGS_BORDER_VIF | MRT_MFC_RP | MRT_MFC_BW_UPCALL); -static uint32_t mrt_api_config = 0; - -static int pim_assert_enabled; +static VNET_DEFINE(uint32_t, mrt_api_config); +#define V_mrt_api_config VNET(mrt_api_config) +static VNET_DEFINE(int, pim_assert_enabled); +#define V_pim_assert_enabled VNET(pim_assert_enabled) static struct timeval pim_assert_interval = { 3, 0 }; /* Rate limit */ /* @@ -360,7 +384,7 @@ mfc_find(struct in_addr *o, struct in_ad MFC_LOCK_ASSERT(); - LIST_FOREACH(rt, &mfchashtbl[MFCHASH(*o, *g)], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[MFCHASH(*o, *g)], mfc_hash) { if (in_hosteq(rt->mfc_origin, *o) && in_hosteq(rt->mfc_mcastgrp, *g) && TAILQ_EMPTY(&rt->mfc_stall)) @@ -419,7 +443,7 @@ X_ip_mrouter_set(struct socket *so, stru * select data size depending on API version. */ if (sopt->sopt_name == MRT_ADD_MFC && - mrt_api_config & MRT_API_FLAGS_ALL) { + V_mrt_api_config & MRT_API_FLAGS_ALL) { error = sooptcopyin(sopt, &mfc, sizeof(struct mfcctl2), sizeof(struct mfcctl2)); } else { @@ -484,8 +508,8 @@ X_ip_mrouter_get(struct socket *so, stru break; case MRT_ASSERT: - error = sooptcopyout(sopt, &pim_assert_enabled, - sizeof pim_assert_enabled); + error = sooptcopyout(sopt, &V_pim_assert_enabled, + sizeof V_pim_assert_enabled); break; case MRT_API_SUPPORT: @@ -493,7 +517,7 @@ X_ip_mrouter_get(struct socket *so, stru break; case MRT_API_CONFIG: - error = sooptcopyout(sopt, &mrt_api_config, sizeof mrt_api_config); + error = sooptcopyout(sopt, &V_mrt_api_config, sizeof V_mrt_api_config); break; default: @@ -566,36 +590,21 @@ get_vif_cnt(struct sioc_vif_req *req) vifi_t vifi = req->vifi; VIF_LOCK(); - if (vifi >= numvifs) { + if (vifi >= V_numvifs) { VIF_UNLOCK(); return EINVAL; } - req->icount = viftable[vifi].v_pkt_in; - req->ocount = viftable[vifi].v_pkt_out; - req->ibytes = viftable[vifi].v_bytes_in; - req->obytes = viftable[vifi].v_bytes_out; + req->icount = V_viftable[vifi].v_pkt_in; + req->ocount = V_viftable[vifi].v_pkt_out; + req->ibytes = V_viftable[vifi].v_bytes_in; + req->obytes = V_viftable[vifi].v_bytes_out; VIF_UNLOCK(); return 0; } static void -ip_mrouter_reset(void) -{ - - pim_assert_enabled = 0; - mrt_api_config = 0; - - callout_init(&expire_upcalls_ch, CALLOUT_MPSAFE); - - bw_upcalls_n = 0; - bzero((caddr_t)bw_meter_timers, sizeof(bw_meter_timers)); - callout_init(&bw_upcalls_ch, CALLOUT_MPSAFE); - callout_init(&bw_meter_ch, CALLOUT_MPSAFE); -} - -static void if_detached_event(void *arg __unused, struct ifnet *ifp) { vifi_t vifi; @@ -619,12 +628,12 @@ if_detached_event(void *arg __unused, st * 3. Expire any matching multicast forwarding cache entries. * 4. Free vif state. This should disable ALLMULTI on the interface. */ - for (vifi = 0; vifi < numvifs; vifi++) { - if (viftable[vifi].v_ifp != ifp) + for (vifi = 0; vifi < V_numvifs; vifi++) { + if (V_viftable[vifi].v_ifp != ifp) continue; for (i = 0; i < mfchashsize; i++) { struct mfc *rt, *nrt; - for (rt = LIST_FIRST(&mfchashtbl[i]); rt; rt = nrt) { + for (rt = LIST_FIRST(&V_mfchashtbl[i]); rt; rt = nrt) { nrt = LIST_NEXT(rt, mfc_hash); if (rt->mfc_parent == vifi) { expire_mfc(rt); @@ -658,27 +667,28 @@ ip_mrouter_init(struct socket *so, int v MROUTER_LOCK(); - if (V_ip_mrouter != NULL) { + if (ip_mrouter_unloading) { MROUTER_UNLOCK(); - return EADDRINUSE; + return ENOPROTOOPT; } - if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event, - if_detached_event, NULL, EVENTHANDLER_PRI_ANY); - if (if_detach_event_tag == NULL) { + if (V_ip_mrouter != NULL) { MROUTER_UNLOCK(); - return (ENOMEM); + return EADDRINUSE; } - mfchashtbl = hashinit_flags(mfchashsize, M_MRTABLE, &mfchash, HASH_NOWAIT); - - callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); + V_mfchashtbl = hashinit_flags(mfchashsize, M_MRTABLE, &V_mfchash, + HASH_NOWAIT); - callout_reset(&bw_upcalls_ch, BW_UPCALLS_PERIOD, - expire_bw_upcalls_send, NULL); - callout_reset(&bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, NULL); + callout_reset(&V_expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, + curvnet); + callout_reset(&V_bw_upcalls_ch, BW_UPCALLS_PERIOD, expire_bw_upcalls_send, + curvnet); + callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, + curvnet); V_ip_mrouter = so; + ip_mrouter_cnt++; MROUTER_UNLOCK(); @@ -709,7 +719,8 @@ X_ip_mrouter_done(void) * Detach/disable hooks to the reset of the system. */ V_ip_mrouter = NULL; - mrt_api_config = 0; + ip_mrouter_cnt--; + V_mrt_api_config = 0; VIF_LOCK(); @@ -717,29 +728,27 @@ X_ip_mrouter_done(void) * For each phyint in use, disable promiscuous reception of all IP * multicasts. */ - for (vifi = 0; vifi < numvifs; vifi++) { - if (!in_nullhost(viftable[vifi].v_lcl_addr) && - !(viftable[vifi].v_flags & (VIFF_TUNNEL | VIFF_REGISTER))) { + for (vifi = 0; vifi < V_numvifs; vifi++) { + if (!in_nullhost(V_viftable[vifi].v_lcl_addr) && + !(V_viftable[vifi].v_flags & (VIFF_TUNNEL | VIFF_REGISTER))) { struct sockaddr_in *so = (struct sockaddr_in *)&(ifr.ifr_addr); so->sin_len = sizeof(struct sockaddr_in); so->sin_family = AF_INET; so->sin_addr.s_addr = INADDR_ANY; - ifp = viftable[vifi].v_ifp; + ifp = V_viftable[vifi].v_ifp; if_allmulti(ifp, 0); } } - bzero((caddr_t)viftable, sizeof(viftable)); - numvifs = 0; - pim_assert_enabled = 0; - + bzero((caddr_t)V_viftable, sizeof(V_viftable)); + V_numvifs = 0; + V_pim_assert_enabled = 0; + VIF_UNLOCK(); - EVENTHANDLER_DEREGISTER(ifnet_departure_event, if_detach_event_tag); - - callout_stop(&expire_upcalls_ch); - callout_stop(&bw_upcalls_ch); - callout_stop(&bw_meter_ch); + callout_stop(&V_expire_upcalls_ch); + callout_stop(&V_bw_upcalls_ch); + callout_stop(&V_bw_meter_ch); MFC_LOCK(); @@ -749,22 +758,22 @@ X_ip_mrouter_done(void) */ for (i = 0; i < mfchashsize; i++) { struct mfc *rt, *nrt; - for (rt = LIST_FIRST(&mfchashtbl[i]); rt; rt = nrt) { + for (rt = LIST_FIRST(&V_mfchashtbl[i]); rt; rt = nrt) { nrt = LIST_NEXT(rt, mfc_hash); expire_mfc(rt); } } - free(mfchashtbl, M_MRTABLE); - mfchashtbl = NULL; + free(V_mfchashtbl, M_MRTABLE); + V_mfchashtbl = NULL; - bzero(nexpire, sizeof(nexpire[0]) * mfchashsize); + bzero(V_nexpire, sizeof(V_nexpire[0]) * mfchashsize); - bw_upcalls_n = 0; - bzero(bw_meter_timers, sizeof(bw_meter_timers)); + V_bw_upcalls_n = 0; + bzero(V_bw_meter_timers, sizeof(V_bw_meter_timers)); MFC_UNLOCK(); - reg_vif_num = VIFI_INVALID; + V_reg_vif_num = VIFI_INVALID; MROUTER_UNLOCK(); @@ -782,7 +791,7 @@ set_assert(int i) if ((i != 1) && (i != 0)) return EINVAL; - pim_assert_enabled = i; + V_pim_assert_enabled = i; return 0; } @@ -802,11 +811,11 @@ set_api_config(uint32_t *apival) * - pim_assert is not enabled * - the MFC table is empty */ - if (numvifs > 0) { + if (V_numvifs > 0) { *apival = 0; return EPERM; } - if (pim_assert_enabled) { + if (V_pim_assert_enabled) { *apival = 0; return EPERM; } @@ -814,7 +823,7 @@ set_api_config(uint32_t *apival) MFC_LOCK(); for (i = 0; i < mfchashsize; i++) { - if (LIST_FIRST(&mfchashtbl[i]) != NULL) { + if (LIST_FIRST(&V_mfchashtbl[i]) != NULL) { *apival = 0; return EPERM; } @@ -822,8 +831,8 @@ set_api_config(uint32_t *apival) MFC_UNLOCK(); - mrt_api_config = *apival & mrt_api_support; - *apival = mrt_api_config; + V_mrt_api_config = *apival & mrt_api_support; + *apival = V_mrt_api_config; return 0; } @@ -834,7 +843,7 @@ set_api_config(uint32_t *apival) static int add_vif(struct vifctl *vifcp) { - struct vif *vifp = viftable + vifcp->vifc_vifi; + struct vif *vifp = V_viftable + vifcp->vifc_vifi; struct sockaddr_in sin = {sizeof sin, AF_INET}; struct ifaddr *ifa; struct ifnet *ifp; @@ -884,12 +893,12 @@ add_vif(struct vifctl *vifcp) VIF_UNLOCK(); return EOPNOTSUPP; } else if (vifcp->vifc_flags & VIFF_REGISTER) { - ifp = &multicast_register_if; + ifp = &V_multicast_register_if; CTR2(KTR_IPMF, "%s: add register vif for ifp %p", __func__, ifp); - if (reg_vif_num == VIFI_INVALID) { - if_initname(&multicast_register_if, "register_vif", 0); - multicast_register_if.if_flags = IFF_LOOPBACK; - reg_vif_num = vifcp->vifc_vifi; + if (V_reg_vif_num == VIFI_INVALID) { + if_initname(&V_multicast_register_if, "register_vif", 0); + V_multicast_register_if.if_flags = IFF_LOOPBACK; + V_reg_vif_num = vifcp->vifc_vifi; } } else { /* Make sure the interface supports multicast */ if ((ifp->if_flags & IFF_MULTICAST) == 0) { @@ -918,8 +927,8 @@ add_vif(struct vifctl *vifcp) bzero(&vifp->v_route, sizeof(vifp->v_route)); /* Adjust numvifs up if the vifi is higher than numvifs */ - if (numvifs <= vifcp->vifc_vifi) - numvifs = vifcp->vifc_vifi + 1; + if (V_numvifs <= vifcp->vifc_vifi) + V_numvifs = vifcp->vifc_vifi + 1; VIF_UNLOCK(); @@ -940,10 +949,10 @@ del_vif_locked(vifi_t vifi) VIF_LOCK_ASSERT(); - if (vifi >= numvifs) { + if (vifi >= V_numvifs) { return EINVAL; } - vifp = &viftable[vifi]; + vifp = &V_viftable[vifi]; if (in_nullhost(vifp->v_lcl_addr)) { return EADDRNOTAVAIL; } @@ -952,17 +961,17 @@ del_vif_locked(vifi_t vifi) if_allmulti(vifp->v_ifp, 0); if (vifp->v_flags & VIFF_REGISTER) - reg_vif_num = VIFI_INVALID; + V_reg_vif_num = VIFI_INVALID; bzero((caddr_t)vifp, sizeof (*vifp)); CTR2(KTR_IPMF, "%s: delete vif %d", __func__, (int)vifi); /* Adjust numvifs down */ - for (vifi = numvifs; vifi > 0; vifi--) - if (!in_nullhost(viftable[vifi-1].v_lcl_addr)) + for (vifi = V_numvifs; vifi > 0; vifi--) + if (!in_nullhost(V_viftable[vifi-1].v_lcl_addr)) break; - numvifs = vifi; + V_numvifs = vifi; return 0; } @@ -988,13 +997,13 @@ update_mfc_params(struct mfc *rt, struct int i; rt->mfc_parent = mfccp->mfcc_parent; - for (i = 0; i < numvifs; i++) { + for (i = 0; i < V_numvifs; i++) { rt->mfc_ttls[i] = mfccp->mfcc_ttls[i]; - rt->mfc_flags[i] = mfccp->mfcc_flags[i] & mrt_api_config & + rt->mfc_flags[i] = mfccp->mfcc_flags[i] & V_mrt_api_config & MRT_MFC_FLAGS_ALL; } /* set the RP address */ - if (mrt_api_config & MRT_MFC_RP) + if (V_mrt_api_config & MRT_MFC_RP) rt->mfc_rp = mfccp->mfcc_rp; else rt->mfc_rp.s_addr = INADDR_ANY; @@ -1070,7 +1079,7 @@ add_mfc(struct mfcctl2 *mfccp) */ nstl = 0; hash = MFCHASH(mfccp->mfcc_origin, mfccp->mfcc_mcastgrp); - LIST_FOREACH(rt, &mfchashtbl[hash], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) { if (in_hosteq(rt->mfc_origin, mfccp->mfcc_origin) && in_hosteq(rt->mfc_mcastgrp, mfccp->mfcc_mcastgrp) && !TAILQ_EMPTY(&rt->mfc_stall)) { @@ -1085,7 +1094,7 @@ add_mfc(struct mfcctl2 *mfccp) init_mfc_params(rt, mfccp); rt->mfc_expire = 0; /* Don't clean this guy up */ - nexpire[hash]--; + V_nexpire[hash]--; /* Free queued packets, but attempt to forward them first. */ TAILQ_FOREACH_SAFE(rte, &rt->mfc_stall, rte_link, nrte) { @@ -1104,12 +1113,12 @@ add_mfc(struct mfcctl2 *mfccp) */ if (nstl == 0) { CTR1(KTR_IPMF, "%s: adding mfc w/o upcall", __func__); - LIST_FOREACH(rt, &mfchashtbl[hash], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) { if (in_hosteq(rt->mfc_origin, mfccp->mfcc_origin) && in_hosteq(rt->mfc_mcastgrp, mfccp->mfcc_mcastgrp)) { init_mfc_params(rt, mfccp); if (rt->mfc_expire) - nexpire[hash]--; + V_nexpire[hash]--; rt->mfc_expire = 0; break; /* XXX */ } @@ -1131,7 +1140,7 @@ add_mfc(struct mfcctl2 *mfccp) rt->mfc_bw_meter = NULL; /* insert new entry at head of hash chain */ - LIST_INSERT_HEAD(&mfchashtbl[hash], rt, mfc_hash); + LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); } } @@ -1238,7 +1247,7 @@ X_ip_mforward(struct ip *ip, struct ifne VIF_LOCK(); MFC_LOCK(); - if (imo && ((vifi = imo->imo_multicast_vif) < numvifs)) { + if (imo && ((vifi = imo->imo_multicast_vif) < V_numvifs)) { if (ip->ip_ttl < MAXTTL) ip->ip_ttl++; /* compensate for -1 in *_send routines */ error = ip_mdq(m, ifp, NULL, vifi); @@ -1310,7 +1319,7 @@ X_ip_mforward(struct ip *ip, struct ifne /* is there an upcall waiting for this flow ? */ hash = MFCHASH(ip->ip_src, ip->ip_dst); - LIST_FOREACH(rt, &mfchashtbl[hash], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) { if (in_hosteq(ip->ip_src, rt->mfc_origin) && in_hosteq(ip->ip_dst, rt->mfc_mcastgrp) && !TAILQ_EMPTY(&rt->mfc_stall)) @@ -1327,10 +1336,10 @@ X_ip_mforward(struct ip *ip, struct ifne * Locate the vifi for the incoming interface for this packet. * If none found, drop packet. */ - for (vifi = 0; vifi < numvifs && - viftable[vifi].v_ifp != ifp; vifi++) + for (vifi = 0; vifi < V_numvifs && + V_viftable[vifi].v_ifp != ifp; vifi++) ; - if (vifi >= numvifs) /* vif not found, drop packet */ + if (vifi >= V_numvifs) /* vif not found, drop packet */ goto non_fatal; /* no upcall, so make a new entry */ @@ -1373,8 +1382,8 @@ fail: rt->mfc_origin.s_addr = ip->ip_src.s_addr; rt->mfc_mcastgrp.s_addr = ip->ip_dst.s_addr; rt->mfc_expire = UPCALL_EXPIRE; - nexpire[hash]++; - for (i = 0; i < numvifs; i++) { + V_nexpire[hash]++; + for (i = 0; i < V_numvifs; i++) { rt->mfc_ttls[i] = 0; rt->mfc_flags[i] = 0; } @@ -1394,7 +1403,7 @@ fail: rt->mfc_nstall = 0; /* link into table */ - LIST_INSERT_HEAD(&mfchashtbl[hash], rt, mfc_hash); + LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); TAILQ_INSERT_HEAD(&rt->mfc_stall, rte, rte_link); rt->mfc_nstall++; @@ -1427,19 +1436,21 @@ non_fatal: * Clean up the cache entry if upcall is not serviced */ static void -expire_upcalls(void *unused) +expire_upcalls(void *arg) { int i; + CURVNET_SET((struct vnet *) arg); + MFC_LOCK(); for (i = 0; i < mfchashsize; i++) { struct mfc *rt, *nrt; - if (nexpire[i] == 0) + if (V_nexpire[i] == 0) continue; - for (rt = LIST_FIRST(&mfchashtbl[i]); rt; rt = nrt) { + for (rt = LIST_FIRST(&V_mfchashtbl[i]); rt; rt = nrt) { nrt = LIST_NEXT(rt, mfc_hash); if (TAILQ_EMPTY(&rt->mfc_stall)) @@ -1469,7 +1480,10 @@ expire_upcalls(void *unused) MFC_UNLOCK(); - callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); + callout_reset(&V_expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, + curvnet); + + CURVNET_RESTORE(); } /* @@ -1489,11 +1503,11 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp * * (since vifi_t is u_short, -1 becomes MAXUSHORT, which > numvifs.) */ - if (xmt_vif < numvifs) { - if (viftable[xmt_vif].v_flags & VIFF_REGISTER) - pim_register_send(ip, viftable + xmt_vif, m, rt); + if (xmt_vif < V_numvifs) { + if (V_viftable[xmt_vif].v_flags & VIFF_REGISTER) + pim_register_send(ip, V_viftable + xmt_vif, m, rt); else - phyint_send(ip, viftable + xmt_vif, m); + phyint_send(ip, V_viftable + xmt_vif, m); return 1; } @@ -1501,9 +1515,9 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp * Don't forward if it didn't arrive from the parent vif for its origin. */ vifi = rt->mfc_parent; - if ((vifi >= numvifs) || (viftable[vifi].v_ifp != ifp)) { + if ((vifi >= V_numvifs) || (V_viftable[vifi].v_ifp != ifp)) { CTR4(KTR_IPMF, "%s: rx on wrong ifp %p (vifi %d, v_ifp %p)", - __func__, ifp, (int)vifi, viftable[vifi].v_ifp); + __func__, ifp, (int)vifi, V_viftable[vifi].v_ifp); MRTSTAT_INC(mrts_wrong_if); ++rt->mfc_wrong_if; /* @@ -1514,15 +1528,17 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp * can complete the SPT switch, regardless of the type * of the iif (broadcast media, GRE tunnel, etc). */ - if (pim_assert_enabled && (vifi < numvifs) && viftable[vifi].v_ifp) { + if (V_pim_assert_enabled && (vifi < V_numvifs) && + V_viftable[vifi].v_ifp) { - if (ifp == &multicast_register_if) + if (ifp == &V_multicast_register_if) PIMSTAT_INC(pims_rcv_registers_wrongiif); /* Get vifi for the incoming packet */ - for (vifi=0; vifi < numvifs && viftable[vifi].v_ifp != ifp; vifi++) + for (vifi = 0; vifi < V_numvifs && V_viftable[vifi].v_ifp != ifp; + vifi++) ; - if (vifi >= numvifs) + if (vifi >= V_numvifs) return 0; /* The iif is not found: ignore the packet. */ if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_DISABLE_WRONGVIF) @@ -1559,12 +1575,12 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp /* If I sourced this packet, it counts as output, else it was input. */ - if (in_hosteq(ip->ip_src, viftable[vifi].v_lcl_addr)) { - viftable[vifi].v_pkt_out++; - viftable[vifi].v_bytes_out += plen; + if (in_hosteq(ip->ip_src, V_viftable[vifi].v_lcl_addr)) { + V_viftable[vifi].v_pkt_out++; + V_viftable[vifi].v_bytes_out += plen; } else { - viftable[vifi].v_pkt_in++; - viftable[vifi].v_bytes_in += plen; + V_viftable[vifi].v_pkt_in++; + V_viftable[vifi].v_bytes_in += plen; } rt->mfc_pkt_cnt++; rt->mfc_byte_cnt += plen; @@ -1575,14 +1591,14 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp * - the ttl exceeds the vif's threshold * - there are group members downstream on interface */ - for (vifi = 0; vifi < numvifs; vifi++) + for (vifi = 0; vifi < V_numvifs; vifi++) if ((rt->mfc_ttls[vifi] > 0) && (ip->ip_ttl > rt->mfc_ttls[vifi])) { - viftable[vifi].v_pkt_out++; - viftable[vifi].v_bytes_out += plen; - if (viftable[vifi].v_flags & VIFF_REGISTER) - pim_register_send(ip, viftable + vifi, m, rt); + V_viftable[vifi].v_pkt_out++; + V_viftable[vifi].v_bytes_out += plen; + if (V_viftable[vifi].v_flags & VIFF_REGISTER) + pim_register_send(ip, V_viftable + vifi, m, rt); else - phyint_send(ip, viftable + vifi, m); + phyint_send(ip, V_viftable + vifi, m); } /* @@ -1614,7 +1630,7 @@ X_legal_vif_num(int vif) return (ret); VIF_LOCK(); - if (vif < numvifs) + if (vif < V_numvifs) ret = 1; VIF_UNLOCK(); @@ -1634,8 +1650,8 @@ X_ip_mcast_src(int vifi) return (addr); VIF_LOCK(); - if (vifi < numvifs) - addr = viftable[vifi].v_lcl_addr.s_addr; + if (vifi < V_numvifs) + addr = V_viftable[vifi].v_lcl_addr.s_addr; VIF_UNLOCK(); return (addr); @@ -1688,7 +1704,7 @@ send_packet(struct vif *vifp, struct mbu */ error = ip_output(m, NULL, &vifp->v_route, IP_FORWARDING, &imo, NULL); CTR3(KTR_IPMF, "%s: vif %td err %d", __func__, - (ptrdiff_t)(vifp - viftable), error); + (ptrdiff_t)(vifp - V_viftable), error); } /* @@ -1757,7 +1773,7 @@ add_bw_upcall(struct bw_upcall *req) struct bw_meter *x; uint32_t flags; - if (!(mrt_api_config & MRT_MFC_BW_UPCALL)) + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; /* Test if the flags are valid */ @@ -1845,7 +1861,7 @@ del_bw_upcall(struct bw_upcall *req) struct mfc *mfc; struct bw_meter *x; - if (!(mrt_api_config & MRT_MFC_BW_UPCALL)) + if (!(V_mrt_api_config & MRT_MFC_BW_UPCALL)) return EOPNOTSUPP; MFC_LOCK(); @@ -2013,13 +2029,13 @@ bw_meter_prepare_upcall(struct bw_meter /* * If there are too many pending upcalls, deliver them now */ - if (bw_upcalls_n >= BW_UPCALLS_MAX) + if (V_bw_upcalls_n >= BW_UPCALLS_MAX) bw_upcalls_send(); /* * Set the bw_upcall entry */ - u = &bw_upcalls[bw_upcalls_n++]; + u = &V_bw_upcalls[V_bw_upcalls_n++]; u->bu_src = x->bm_mfc->mfc_origin; u->bu_dst = x->bm_mfc->mfc_mcastgrp; u->bu_threshold.b_time = x->bm_threshold.b_time; @@ -2046,7 +2062,7 @@ static void bw_upcalls_send(void) { struct mbuf *m; - int len = bw_upcalls_n * sizeof(bw_upcalls[0]); + int len = V_bw_upcalls_n * sizeof(V_bw_upcalls[0]); struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET }; static struct igmpmsg igmpmsg = { 0, /* unused1 */ 0, /* unused2 */ @@ -2059,10 +2075,10 @@ bw_upcalls_send(void) MFC_LOCK_ASSERT(); - if (bw_upcalls_n == 0) + if (V_bw_upcalls_n == 0) return; /* No pending upcalls */ - bw_upcalls_n = 0; + V_bw_upcalls_n = 0; /* * Allocate a new mbuf, initialize it with the header and @@ -2076,7 +2092,7 @@ bw_upcalls_send(void) m->m_len = m->m_pkthdr.len = 0; m_copyback(m, 0, sizeof(struct igmpmsg), (caddr_t)&igmpmsg); - m_copyback(m, sizeof(struct igmpmsg), len, (caddr_t)&bw_upcalls[0]); + m_copyback(m, sizeof(struct igmpmsg), len, (caddr_t)&V_bw_upcalls[0]); /* * Send the upcalls @@ -2129,8 +2145,8 @@ schedule_bw_meter(struct bw_meter *x, st * Compute the timeout hash value and insert the entry */ BW_METER_TIMEHASH(x, time_hash); - x->bm_time_next = bw_meter_timers[time_hash]; - bw_meter_timers[time_hash] = x; + x->bm_time_next = V_bw_meter_timers[time_hash]; + V_bw_meter_timers[time_hash] = x; x->bm_time_hash = time_hash; } @@ -2156,7 +2172,7 @@ unschedule_bw_meter(struct bw_meter *x) if (time_hash >= BW_METER_BUCKETS) return; /* Entry was not scheduled */ - for (prev = NULL, tmp = bw_meter_timers[time_hash]; + for (prev = NULL, tmp = V_bw_meter_timers[time_hash]; tmp != NULL; prev = tmp, tmp = tmp->bm_time_next) if (tmp == x) break; @@ -2167,7 +2183,7 @@ unschedule_bw_meter(struct bw_meter *x) if (prev != NULL) prev->bm_time_next = x->bm_time_next; else - bw_meter_timers[time_hash] = x->bm_time_next; + V_bw_meter_timers[time_hash] = x->bm_time_next; x->bm_time_next = NULL; x->bm_time_hash = BW_METER_BUCKETS; @@ -2186,18 +2202,16 @@ unschedule_bw_meter(struct bw_meter *x) static void bw_meter_process() { - static uint32_t last_tv_sec; /* last time we processed this */ - uint32_t loops; int i; struct timeval now, process_endtime; microtime(&now); - if (last_tv_sec == now.tv_sec) + if (V_last_tv_sec == now.tv_sec) return; /* nothing to do */ - loops = now.tv_sec - last_tv_sec; - last_tv_sec = now.tv_sec; + loops = now.tv_sec - V_last_tv_sec; + V_last_tv_sec = now.tv_sec; if (loops > BW_METER_BUCKETS) loops = BW_METER_BUCKETS; @@ -2214,8 +2228,8 @@ bw_meter_process() i = 0; /* Disconnect the list of bw_meter entries from the bin */ - tmp_list = bw_meter_timers[i]; - bw_meter_timers[i] = NULL; + tmp_list = V_bw_meter_timers[i]; + V_bw_meter_timers[i] = NULL; /* Process the list of bw_meter entries */ while (tmp_list != NULL) { @@ -2238,8 +2252,8 @@ bw_meter_process() if (++time_hash >= BW_METER_BUCKETS) time_hash = 0; } - x->bm_time_next = bw_meter_timers[time_hash]; - bw_meter_timers[time_hash] = x; + x->bm_time_next = V_bw_meter_timers[time_hash]; + V_bw_meter_timers[time_hash] = x; x->bm_time_hash = time_hash; continue; @@ -2273,14 +2287,17 @@ bw_meter_process() * A periodic function for sending all upcalls that are pending delivery */ static void -expire_bw_upcalls_send(void *unused) +expire_bw_upcalls_send(void *arg) { + CURVNET_SET((struct vnet *) arg); + MFC_LOCK(); bw_upcalls_send(); MFC_UNLOCK(); - callout_reset(&bw_upcalls_ch, BW_UPCALLS_PERIOD, - expire_bw_upcalls_send, NULL); + callout_reset(&V_bw_upcalls_ch, BW_UPCALLS_PERIOD, expire_bw_upcalls_send, + curvnet); + CURVNET_RESTORE(); } /* @@ -2288,12 +2305,16 @@ expire_bw_upcalls_send(void *unused) * table for processing all "<=" bw_meter entries. */ static void -expire_bw_meter_process(void *unused) +expire_bw_meter_process(void *arg) { - if (mrt_api_config & MRT_MFC_BW_UPCALL) + CURVNET_SET((struct vnet *) arg); + + if (V_mrt_api_config & MRT_MFC_BW_UPCALL) bw_meter_process(); - callout_reset(&bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, NULL); + callout_reset(&V_bw_meter_ch, BW_METER_PERIOD, expire_bw_meter_process, + curvnet); + CURVNET_RESTORE(); } /* @@ -2314,7 +2335,7 @@ pim_register_send(struct ip *ip, struct * Do not send IGMP_WHOLEPKT notifications to userland, if the * rendezvous point was unspecified, and we were told not to. */ - if (pim_squelch_wholepkt != 0 && (mrt_api_config & MRT_MFC_RP) && + if (pim_squelch_wholepkt != 0 && (V_mrt_api_config & MRT_MFC_RP) && in_nullhost(rt->mfc_rp)) return 0; @@ -2332,7 +2353,7 @@ pim_register_send(struct ip *ip, struct mm = m_pullup(mm, sizeof(struct ip)); if (mm != NULL) { ip = mtod(mm, struct ip *); - if ((mrt_api_config & MRT_MFC_RP) && !in_nullhost(rt->mfc_rp)) { + if ((V_mrt_api_config & MRT_MFC_RP) && !in_nullhost(rt->mfc_rp)) { pim_register_send_rp(ip, vifp, mm, rt); } else { pim_register_send_upcall(ip, vifp, mm, rt); @@ -2425,7 +2446,7 @@ pim_register_send_upcall(struct ip *ip, im = mtod(mb_first, struct igmpmsg *); im->im_msgtype = IGMPMSG_WHOLEPKT; im->im_mbz = 0; - im->im_vif = vifp - viftable; + im->im_vif = vifp - V_viftable; im->im_src = ip->ip_src; im->im_dst = ip->ip_dst; @@ -2461,7 +2482,7 @@ pim_register_send_rp(struct ip *ip, stru VIF_LOCK_ASSERT(); - if ((vifi >= numvifs) || in_nullhost(viftable[vifi].v_lcl_addr)) { + if ((vifi >= V_numvifs) || in_nullhost(V_viftable[vifi].v_lcl_addr)) { m_freem(mb_copy); return EADDRNOTAVAIL; /* The iif vif is invalid */ } @@ -2487,7 +2508,7 @@ pim_register_send_rp(struct ip *ip, stru *ip_outer = pim_encap_iphdr; ip_outer->ip_id = ip_newid(); ip_outer->ip_len = len + sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr); - ip_outer->ip_src = viftable[vifi].v_lcl_addr; + ip_outer->ip_src = V_viftable[vifi].v_lcl_addr; ip_outer->ip_dst = rt->mfc_rp; /* * Copy the inner header TOS to the outer header, and take care of the @@ -2500,7 +2521,7 @@ pim_register_send_rp(struct ip *ip, stru + sizeof(pim_encap_iphdr)); *pimhdr = pim_encap_pimhdr; /* If the iif crosses a border, set the Border-bit */ - if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_BORDER_VIF & mrt_api_config) + if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_BORDER_VIF & V_mrt_api_config) pimhdr->flags |= htonl(PIM_BORDER_REGISTER); mb_first->m_data += sizeof(pim_encap_iphdr); @@ -2637,15 +2658,15 @@ pim_input(struct mbuf *m, int off) struct ifnet *vifp; VIF_LOCK(); - if ((reg_vif_num >= numvifs) || (reg_vif_num == VIFI_INVALID)) { + if ((V_reg_vif_num >= V_numvifs) || (V_reg_vif_num == VIFI_INVALID)) { VIF_UNLOCK(); CTR2(KTR_IPMF, "%s: register vif not set: %d", __func__, - (int)reg_vif_num); + (int)V_reg_vif_num); m_freem(m); return; } /* XXX need refcnt? */ - vifp = viftable[reg_vif_num].v_ifp; + vifp = V_viftable[V_reg_vif_num].v_ifp; VIF_UNLOCK(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 15:46:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB76D106575A; Wed, 2 Jun 2010 15:46:37 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAAAA8FC17; Wed, 2 Jun 2010 15:46: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 o52Fkbxt097340; Wed, 2 Jun 2010 15:46:37 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52FkbXi097335; Wed, 2 Jun 2010 15:46:37 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006021546.o52FkbXi097335@svn.freebsd.org> From: Alan Cox Date: Wed, 2 Jun 2010 15:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208745 - in head/sys: kern vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 15:46:38 -0000 Author: alc Date: Wed Jun 2 15:46:37 2010 New Revision: 208745 URL: http://svn.freebsd.org/changeset/base/208745 Log: Minimize the use of the page queues lock for synchronizing access to the page's dirty field. With the exception of one case, access to this field is now synchronized by the object lock. Modified: head/sys/kern/uipc_shm.c head/sys/kern/vfs_bio.c head/sys/vm/vm_page.c head/sys/vm/vnode_pager.c Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Wed Jun 2 15:44:43 2010 (r208744) +++ head/sys/kern/uipc_shm.c Wed Jun 2 15:46:37 2010 (r208745) @@ -304,9 +304,7 @@ shm_dotruncate(struct shmfd *shmfd, off_ */ base = roundup2(base, DEV_BSIZE); - vm_page_lock_queues(); vm_page_clear_dirty(m, base, PAGE_SIZE - base); - vm_page_unlock_queues(); } else if ((length & PAGE_MASK) && __predict_false(object->cache != NULL)) { vm_page_cache_free(object, OFF_TO_IDX(length), Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Jun 2 15:44:43 2010 (r208744) +++ head/sys/kern/vfs_bio.c Wed Jun 2 15:46:37 2010 (r208745) @@ -3630,7 +3630,6 @@ vfs_clean_pages(struct buf *bp) KASSERT(bp->b_offset != NOOFFSET, ("vfs_clean_pages: no buffer offset")); VM_OBJECT_LOCK(bp->b_bufobj->bo_object); - vm_page_lock_queues(); for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; noff = (foff + PAGE_SIZE) & ~(off_t)PAGE_MASK; @@ -3642,7 +3641,6 @@ vfs_clean_pages(struct buf *bp) /* vm_page_clear_dirty(m, foff & PAGE_MASK, eoff - foff); */ foff = noff; } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Jun 2 15:44:43 2010 (r208744) +++ head/sys/vm/vm_page.c Wed Jun 2 15:46:37 2010 (r208745) @@ -170,6 +170,7 @@ TUNABLE_INT("vm.boot_pages", &boot_pages SYSCTL_INT(_vm, OID_AUTO, boot_pages, CTLFLAG_RD, &boot_pages, 0, "number of pages allocated for bootstrapping the VM system"); +static void vm_page_clear_dirty_mask(vm_page_t m, int pagebits); static void vm_page_queue_remove(int queue, vm_page_t m); static void vm_page_enqueue(int queue, vm_page_t m); @@ -2073,6 +2074,28 @@ vm_page_set_valid(vm_page_t m, int base, } /* + * Clear the given bits from the specified page's dirty field. + */ +static __inline void +vm_page_clear_dirty_mask(vm_page_t m, int pagebits) +{ + + /* + * If the object is locked and the page is neither VPO_BUSY nor + * PG_WRITEABLE, then the page's dirty field cannot possibly be + * modified by a concurrent pmap operation. + */ + VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + if ((m->oflags & VPO_BUSY) == 0 && (m->flags & PG_WRITEABLE) == 0) + m->dirty &= ~pagebits; + else { + vm_page_lock_queues(); + m->dirty &= ~pagebits; + vm_page_unlock_queues(); + } +} + +/* * vm_page_set_validclean: * * Sets portions of a page valid and clean. The arguments are expected @@ -2087,9 +2110,8 @@ vm_page_set_valid(vm_page_t m, int base, void vm_page_set_validclean(vm_page_t m, int base, int size) { - int pagebits; - int frag; - int endoff; + u_int oldvalid; + int endoff, frag, pagebits; VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if (size == 0) /* handle degenerate case */ @@ -2126,6 +2148,7 @@ vm_page_set_validclean(vm_page_t m, int * clear dirty bits for DEV_BSIZE chunks that are fully within * the range. */ + oldvalid = m->valid; pagebits = vm_page_bits(base, size); m->valid |= pagebits; #if 0 /* NOT YET */ @@ -2138,21 +2161,35 @@ vm_page_set_validclean(vm_page_t m, int } pagebits = vm_page_bits(base, size & (DEV_BSIZE - 1)); #endif - m->dirty &= ~pagebits; if (base == 0 && size == PAGE_SIZE) { - pmap_clear_modify(m); + /* + * The page can only be modified within the pmap if it is + * mapped, and it can only be mapped if it was previously + * fully valid. + */ + if (oldvalid == VM_PAGE_BITS_ALL) + /* + * Perform the pmap_clear_modify() first. Otherwise, + * a concurrent pmap operation, such as + * pmap_protect(), could clear a modification in the + * pmap and set the dirty field on the page before + * pmap_clear_modify() had begun and after the dirty + * field was cleared here. + */ + pmap_clear_modify(m); + m->dirty = 0; m->oflags &= ~VPO_NOSYNC; - } + } else if (oldvalid != VM_PAGE_BITS_ALL) + m->dirty &= ~pagebits; + else + vm_page_clear_dirty_mask(m, pagebits); } void vm_page_clear_dirty(vm_page_t m, int base, int size) { - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); - if ((m->flags & PG_WRITEABLE) != 0) - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - m->dirty &= ~vm_page_bits(base, size); + vm_page_clear_dirty_mask(m, vm_page_bits(base, size)); } /* Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Wed Jun 2 15:44:43 2010 (r208744) +++ head/sys/vm/vnode_pager.c Wed Jun 2 15:46:37 2010 (r208745) @@ -429,9 +429,7 @@ vnode_pager_setsize(vp, nsize) * bits. This would prevent bogus_page * replacement from working properly. */ - vm_page_lock_queues(); vm_page_clear_dirty(m, base, PAGE_SIZE - base); - vm_page_unlock_queues(); } else if ((nsize & PAGE_MASK) && __predict_false(object->cache != NULL)) { vm_page_cache_free(object, OFF_TO_IDX(nsize), From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 17:17:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68AAD1065675; Wed, 2 Jun 2010 17:17:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4EB298FC20; Wed, 2 Jun 2010 17:17: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 o52HHBti017376; Wed, 2 Jun 2010 17:17:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52HHB9V017373; Wed, 2 Jun 2010 17:17:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201006021717.o52HHB9V017373@svn.freebsd.org> From: Marius Strobl Date: Wed, 2 Jun 2010 17:17: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: r208746 - head/sys/geom/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 17:17:11 -0000 Author: marius Date: Wed Jun 2 17:17:11 2010 New Revision: 208746 URL: http://svn.freebsd.org/changeset/base/208746 Log: Don't leak memory on destruction. Reviewed by: marcel MFC after: 3 days Modified: head/sys/geom/part/g_part_bsd.c head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_bsd.c ============================================================================== --- head/sys/geom/part/g_part_bsd.c Wed Jun 2 15:46:37 2010 (r208745) +++ head/sys/geom/part/g_part_bsd.c Wed Jun 2 17:17:11 2010 (r208746) @@ -240,6 +240,12 @@ g_part_bsd_create(struct g_part_table *b static int g_part_bsd_destroy(struct g_part_table *basetable, struct g_part_parms *gpp) { + struct g_part_bsd_table *table; + + table = (struct g_part_bsd_table *)basetable; + if (table->bbarea != NULL) + g_free(table->bbarea); + table->bbarea = NULL; /* Wipe the second sector to clear the partitioning. */ basetable->gpt_smhead |= 2; Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Wed Jun 2 15:46:37 2010 (r208745) +++ head/sys/geom/part/g_part_gpt.c Wed Jun 2 17:17:11 2010 (r208746) @@ -486,6 +486,12 @@ g_part_gpt_create(struct g_part_table *b static int g_part_gpt_destroy(struct g_part_table *basetable, struct g_part_parms *gpp) { + struct g_part_gpt_table *table; + + table = (struct g_part_gpt_table *)basetable; + if (table->hdr != NULL) + g_free(table->hdr); + table->hdr = NULL; /* * Wipe the first 2 sectors as well as the last to clear the From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 17:17:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E82D1065786; Wed, 2 Jun 2010 17:17:45 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C8D18FC12; Wed, 2 Jun 2010 17:17: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 o52HHjV8017543; Wed, 2 Jun 2010 17:17:45 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52HHjfW017538; Wed, 2 Jun 2010 17:17:45 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201006021717.o52HHjfW017538@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 2 Jun 2010 17:17: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: r208747 - head/sys/dev/fdt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 17:17:45 -0000 Author: raj Date: Wed Jun 2 17:17:45 2010 New Revision: 208747 URL: http://svn.freebsd.org/changeset/base/208747 Log: Import the common Flattened Device Tree infrastructure. o fdtbus(4) - the main abstract bus driver for all FDT-compliant systems. This is a direct replacement for the many incompatible bus drivers grouping integrated peripherals on embedded platforms (like obio(4), ocpbus(4) etc.) o simplebus(4) - bus driver representing ePAPR style 'simple-bus' node, which is an umbrella device for most of the integrated peripherals on a typical system-on-chip device. o Other components (common routines library, PCI node processing helper functions) Reviewed by: imp Sponsored by: The FreeBSD Foundation Added: head/sys/dev/fdt/ head/sys/dev/fdt/fdt_common.c (contents, props changed) head/sys/dev/fdt/fdt_common.h (contents, props changed) head/sys/dev/fdt/fdt_pci.c (contents, props changed) head/sys/dev/fdt/fdt_static_dtb.S (contents, props changed) head/sys/dev/fdt/fdtbus.c (contents, props changed) head/sys/dev/fdt/simplebus.c (contents, props changed) Added: head/sys/dev/fdt/fdt_common.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/fdt/fdt_common.c Wed Jun 2 17:17:45 2010 (r208747) @@ -0,0 +1,629 @@ +/*- + * Copyright (c) 2009-2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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 +#include + +#include +#include +#include +#include + +#include "ofw_bus_if.h" + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +#define FDT_COMPAT_LEN 255 +#define FDT_TYPE_LEN 64 + +#define FDT_REG_CELLS 4 + +vm_paddr_t fdt_immr_pa; +vm_offset_t fdt_immr_va; +vm_offset_t fdt_immr_size; + +int +fdt_immr_addr(void) +{ + pcell_t ranges[6], *rangesptr; + phandle_t node; + u_long base, size; + pcell_t addr_cells, size_cells, par_addr_cells; + int len, tuple_size, tuples; + + /* + * Try to access the SOC node directly i.e. through /aliases/. + */ + if ((node = OF_finddevice("soc")) != 0) + if (fdt_is_compatible_strict(node, "simple-bus")) + goto moveon; + /* + * Find the node the long way. + */ + if ((node = OF_finddevice("/")) == 0) + return (ENXIO); + + if ((node = fdt_find_compatible(node, "simple-bus", 1)) == 0) + return (ENXIO); + +moveon: + if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0) + return (ENXIO); + /* + * Process 'ranges' property. + */ + par_addr_cells = fdt_parent_addr_cells(node); + if (par_addr_cells > 2) + return (ERANGE); + + len = OF_getproplen(node, "ranges"); + if (len > sizeof(ranges)) + return (ENOMEM); + + if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0) + return (EINVAL); + + tuple_size = sizeof(pcell_t) * (addr_cells + par_addr_cells + + size_cells); + tuples = len / tuple_size; + + if (fdt_ranges_verify(ranges, tuples, par_addr_cells, + addr_cells, size_cells)) { + return (ERANGE); + } + base = 0; + size = 0; + rangesptr = &ranges[0]; + + base = fdt_data_get((void *)rangesptr, addr_cells); + rangesptr += addr_cells; + base += fdt_data_get((void *)rangesptr, par_addr_cells); + rangesptr += par_addr_cells; + size = fdt_data_get((void *)rangesptr, size_cells); + + fdt_immr_pa = base; + fdt_immr_va = FDT_IMMR_VA; + fdt_immr_size = size; + + return (0); +} + +/* + * This routine is an early-usage version of the ofw_bus_is_compatible() when + * the ofw_bus I/F is not available (like early console routines and similar). + * Note the buffer has to be on the stack since malloc() is usually not + * available in such cases either. + */ +int +fdt_is_compatible(phandle_t node, const char *compatstr) +{ + char buf[FDT_COMPAT_LEN]; + char *compat; + int len, onelen, l, rv; + + if ((len = OF_getproplen(node, "compatible")) <= 0) + return (0); + + compat = (char *)&buf; + bzero(compat, FDT_COMPAT_LEN); + + if (OF_getprop(node, "compatible", compat, FDT_COMPAT_LEN) < 0) + return (0); + + onelen = strlen(compatstr); + rv = 0; + while (len > 0) { + if (strncasecmp(compat, compatstr, onelen) == 0) { + /* Found it. */ + rv = 1; + break; + } + /* Slide to the next sub-string. */ + l = strlen(compat) + 1; + compat += l; + len -= l; + } + + return (rv); +} + +int +fdt_is_compatible_strict(phandle_t node, const char *compatible) +{ + char compat[FDT_COMPAT_LEN]; + + if (OF_getproplen(node, "compatible") <= 0) + return (0); + + if (OF_getprop(node, "compatible", compat, FDT_COMPAT_LEN) < 0) + return (0); + + if (strncasecmp(compat, compatible, FDT_COMPAT_LEN) == 0) + /* This fits. */ + return (1); + + return (0); +} + +phandle_t +fdt_find_compatible(phandle_t start, const char *compat, int strict) +{ + phandle_t child; + + /* + * Traverse all children of 'start' node, and find first with + * matching 'compatible' property. + */ + for (child = OF_child(start); child != 0; child = OF_peer(child)) + if (fdt_is_compatible(child, compat)) { + if (strict) + if (!fdt_is_compatible_strict(child, compat)) + continue; + return (child); + } + return (0); +} + +int +fdt_is_enabled(phandle_t node) +{ + char *stat; + int ena, len; + + len = OF_getprop_alloc(node, "status", sizeof(char), + (void **)&stat); + + if (len <= 0) + /* It is OK if no 'status' property. */ + return (1); + + /* Anything other than 'okay' means disabled. */ + ena = 0; + if (strncmp((char *)stat, "okay", len) == 0) + ena = 1; + + free(stat, M_OFWPROP); + return (ena); +} + +int +fdt_is_type(phandle_t node, const char *typestr) +{ + char type[FDT_TYPE_LEN]; + + if (OF_getproplen(node, "device_type") <= 0) + return (0); + + if (OF_getprop(node, "device_type", type, FDT_TYPE_LEN) < 0) + return (0); + + if (strncasecmp(type, typestr, FDT_TYPE_LEN) == 0) + /* This fits. */ + return (1); + + return (0); +} + +int +fdt_parent_addr_cells(phandle_t node) +{ + pcell_t addr_cells; + + /* Find out #address-cells of the superior bus. */ + if (OF_searchprop(OF_parent(node), "#address-cells", &addr_cells, + sizeof(addr_cells)) <= 0) + addr_cells = 2; + + return ((int)fdt32_to_cpu(addr_cells)); +} + +int +fdt_data_verify(void *data, int cells) +{ + uint64_t d64; + + if (cells > 1) { + d64 = fdt64_to_cpu(*((uint64_t *)data)); + if (((d64 >> 32) & 0xffffffffull) != 0 || cells > 2) + return (ERANGE); + } + + return (0); +} + +int +fdt_pm_is_enabled(phandle_t node) +{ + int ret; + + ret = 1; + +#if defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY) + ret = fdt_pm(node); +#endif + return (ret); +} + +u_long +fdt_data_get(void *data, int cells) +{ + + if (cells == 1) + return (fdt32_to_cpu(*((uint32_t *)data))); + + return (fdt64_to_cpu(*((uint64_t *)data))); +} + +int +fdt_addrsize_cells(phandle_t node, int *addr_cells, int *size_cells) +{ + pcell_t cell; + int cell_size; + + /* + * Retrieve #{address,size}-cells. + */ + cell_size = sizeof(cell); + if (OF_getprop(node, "#address-cells", &cell, cell_size) < cell_size) + cell = 2; + *addr_cells = fdt32_to_cpu((int)cell); + + if (OF_getprop(node, "#size-cells", &cell, cell_size) < cell_size) + cell = 1; + *size_cells = fdt32_to_cpu((int)cell); + + if (*addr_cells > 3 || *size_cells > 2) + return (ERANGE); + return (0); +} + +int +fdt_ranges_verify(pcell_t *ranges, int tuples, int par_addr_cells, + int this_addr_cells, int this_size_cells) +{ + int i, rv, ulsz; + + if (par_addr_cells > 2 || this_addr_cells > 2 || this_size_cells > 2) + return (ERANGE); + + /* + * This is the max size the resource manager can handle for addresses + * and sizes. + */ + ulsz = sizeof(u_long); + if (par_addr_cells <= ulsz && this_addr_cells <= ulsz && + this_size_cells <= ulsz) + /* We can handle everything */ + return (0); + + rv = 0; + for (i = 0; i < tuples; i++) { + + if (fdt_data_verify((void *)ranges, par_addr_cells)) + goto err; + ranges += par_addr_cells; + + if (fdt_data_verify((void *)ranges, this_addr_cells)) + goto err; + ranges += this_addr_cells; + + if (fdt_data_verify((void *)ranges, this_size_cells)) + goto err; + ranges += this_size_cells; + } + + return (0); + +err: + debugf("using address range >%d-bit not supported\n", ulsz * 8); + return (ERANGE); +} + +int +fdt_data_to_res(pcell_t *data, int addr_cells, int size_cells, u_long *start, + u_long *count) +{ + + /* Address portion. */ + if (fdt_data_verify((void *)data, addr_cells)) + return (ERANGE); + + *start = fdt_data_get((void *)data, addr_cells); + data += addr_cells; + + /* Size portion. */ + if (fdt_data_verify((void *)data, size_cells)) + return (ERANGE); + + *count = fdt_data_get((void *)data, size_cells); + return (0); +} + +int +fdt_regsize(phandle_t node, u_long *base, u_long *size) +{ + pcell_t reg[4]; + int addr_cells, len, size_cells; + + if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells)) + return (ENXIO); + + if ((sizeof(pcell_t) * (addr_cells + size_cells)) > sizeof(reg)) + return (ENOMEM); + + len = OF_getprop(node, "reg", ®, sizeof(reg)); + if (len <= 0) + return (EINVAL); + + *base = fdt_data_get(®[0], addr_cells); + *size = fdt_data_get(®[addr_cells], size_cells); + return (0); +} + +int +fdt_reg_to_rl(phandle_t node, struct resource_list *rl, u_long base) +{ + u_long start, end, count; + pcell_t *reg, *regptr; + pcell_t addr_cells, size_cells; + int tuple_size, tuples; + int i, rv; + + if (fdt_addrsize_cells(OF_parent(node), &addr_cells, &size_cells) != 0) + return (ENXIO); + + tuple_size = sizeof(pcell_t) * (addr_cells + size_cells); + tuples = OF_getprop_alloc(node, "reg", tuple_size, (void **)®); + debugf("addr_cells = %d, size_cells = %d\n", addr_cells, size_cells); + debugf("tuples = %d, tuple size = %d\n", tuples, tuple_size); + if (tuples <= 0) + /* No 'reg' property in this node. */ + return (0); + + regptr = reg; + for (i = 0; i < tuples; i++) { + + rv = fdt_data_to_res(reg, addr_cells, size_cells, &start, + &count); + if (rv != 0) { + resource_list_free(rl); + goto out; + } + reg += addr_cells + size_cells; + + /* Calculate address range relative to base. */ + start &= 0x000ffffful; + start = base + start; + end = start + count - 1; + + debugf("reg addr start = %lx, end = %lx, count = %lx\n", start, + end, count); + + resource_list_add(rl, SYS_RES_MEMORY, i, start, end, + count); + } + rv = 0; + +out: + free(regptr, M_OFWPROP); + return (rv); +} + +int +fdt_intr_decode(phandle_t intr_parent, pcell_t *intr, int *interrupt, + int *trig, int *pol) +{ + fdt_pic_decode_t intr_decode; + int i, rv; + + for (i = 0; fdt_pic_table[i] != NULL; i++) { + + /* XXX check if pic_handle has interrupt-controller prop? */ + + intr_decode = fdt_pic_table[i]; + rv = intr_decode(intr_parent, intr, interrupt, trig, pol); + + if (rv == 0) + /* This was recognized as our PIC and decoded. */ + return (0); + } + + return (ENXIO); +} + +int +fdt_intr_to_rl(phandle_t node, struct resource_list *rl, + struct fdt_sense_level *intr_sl) +{ + phandle_t intr_par; + ihandle_t iph; + pcell_t *intr; + pcell_t intr_cells; + int interrupt, trig, pol; + int i, intr_num, rv; + + if (OF_getproplen(node, "interrupts") <= 0) + /* Node does not have 'interrupts' property. */ + return (0); + + /* + * Find #interrupt-cells of the interrupt domain. + */ + if (OF_getprop(node, "interrupt-parent", &iph, sizeof(iph)) <= 0) { + debugf("no intr-parent phandle\n"); + intr_par = OF_parent(node); + } else { + iph = fdt32_to_cpu(iph); + intr_par = OF_instance_to_package(iph); + } + + if (OF_getprop(intr_par, "#interrupt-cells", &intr_cells, + sizeof(intr_cells)) <= 0) { + debugf("no intr-cells defined, defaulting to 1\n"); + intr_cells = 1; + } + intr_cells = fdt32_to_cpu(intr_cells); + + intr_num = OF_getprop_alloc(node, "interrupts", + intr_cells * sizeof(pcell_t), (void **)&intr); + if (intr_num <= 0 || intr_num > DI_MAX_INTR_NUM) + return (ERANGE); + + rv = 0; + for (i = 0; i < intr_num; i++) { + + interrupt = -1; + trig = pol = 0; + + if (fdt_intr_decode(intr_par, &intr[i * intr_cells], + &interrupt, &trig, &pol) != 0) { + rv = ENXIO; + goto out; + } + + if (interrupt < 0) { + rv = ERANGE; + goto out; + } + + debugf("decoded intr = %d, trig = %d, pol = %d\n", interrupt, + trig, pol); + + intr_sl[intr_num].trig = trig; + intr_sl[intr_num].pol = pol; + + resource_list_add(rl, SYS_RES_IRQ, i, interrupt, interrupt, 1); + } + +out: + free(intr, M_OFWPROP); + return (rv); +} + +int +fdt_get_phyaddr(phandle_t node, int *phy_addr) +{ + phandle_t phy_node; + ihandle_t phy_ihandle; + pcell_t phy_handle, phy_reg; + + if (OF_getprop(node, "phy-handle", (void *)&phy_handle, + sizeof(phy_handle)) <= 0) + return (ENXIO); + + phy_ihandle = (ihandle_t)phy_handle; + phy_ihandle = fdt32_to_cpu(phy_ihandle); + phy_node = OF_instance_to_package(phy_ihandle); + + if (OF_getprop(phy_node, "reg", (void *)&phy_reg, + sizeof(phy_reg)) <= 0) + return (ENXIO); + + *phy_addr = fdt32_to_cpu(phy_reg); + return (0); +} + +int +fdt_get_mem_regions(struct mem_region *mr, int *mrcnt, uint32_t *memsize) +{ + pcell_t reg[FDT_REG_CELLS * FDT_MEM_REGIONS]; + pcell_t *regp; + phandle_t memory; + uint32_t memory_size; + int addr_cells, size_cells; + int i, max_size, reg_len, rv, tuple_size, tuples; + + max_size = sizeof(reg); + memory = OF_finddevice("/memory"); + if (memory <= 0) { + rv = ENXIO; + goto out; + } + + if ((rv = fdt_addrsize_cells(OF_parent(memory), &addr_cells, + &size_cells)) != 0) + goto out; + + if (addr_cells > 2) { + rv = ERANGE; + goto out; + } + + tuple_size = sizeof(pcell_t) * (addr_cells + size_cells); + reg_len = OF_getproplen(memory, "reg"); + if (reg_len <= 0 || reg_len > sizeof(reg)) { + rv = ERANGE; + goto out; + } + + if (OF_getprop(memory, "reg", reg, reg_len) <= 0) { + rv = ENXIO; + goto out; + } + + memory_size = 0; + tuples = reg_len / tuple_size; + regp = (pcell_t *)® + for (i = 0; i < tuples; i++) { + + rv = fdt_data_to_res(regp, addr_cells, size_cells, + (u_long *)&mr[i].mr_start, (u_long *)&mr[i].mr_size); + + if (rv != 0) + goto out; + + regp += addr_cells + size_cells; + memory_size += mr[i].mr_size; + } + + if (memory_size == 0) { + rv = ERANGE; + goto out; + } + + *mrcnt = i; + *memsize = memory_size; + rv = 0; +out: + return (rv); +} Added: head/sys/dev/fdt/fdt_common.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/fdt/fdt_common.h Wed Jun 2 17:17:45 2010 (r208747) @@ -0,0 +1,112 @@ +/*- + * Copyright (c) 2009-2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _FDT_COMMON_H_ +#define _FDT_COMMON_H_ + +#include +#include +#include + +#define FDT_MEM_REGIONS 8 + +#define DI_MAX_INTR_NUM 8 + +struct fdt_pci_range { + u_long base_pci; + u_long base_parent; + u_long len; +}; + +struct fdt_pci_intr { + int addr_cells; + int intr_cells; + int map_len; + pcell_t *map; + pcell_t *mask; +}; + +struct fdt_sense_level { + enum intr_trigger trig; + enum intr_polarity pol; +}; + +typedef int (*fdt_pic_decode_t)(phandle_t, pcell_t *, int *, int *, int *); +extern fdt_pic_decode_t fdt_pic_table[]; + +typedef void (*fdt_fixup_t)(phandle_t); +struct fdt_fixup_entry { + char *model; + fdt_fixup_t handler; +}; +extern struct fdt_fixup_entry fdt_fixup_table[]; + +extern vm_paddr_t fdt_immr_pa; +extern vm_offset_t fdt_immr_va; +extern vm_offset_t fdt_immr_size; + +struct fdt_pm_mask_entry { + char *compat; + uint32_t mask; +}; +extern struct fdt_pm_mask_entry fdt_pm_mask_table[]; + +#if defined(FDT_DTB_STATIC) +extern u_char fdt_static_dtb; +#endif + +int fdt_addrsize_cells(phandle_t, int *, int *); +u_long fdt_data_get(void *, int); +int fdt_data_to_res(pcell_t *, int, int, u_long *, u_long *); +int fdt_data_verify(void *, int); +phandle_t fdt_find_compatible(phandle_t, const char *, int); +int fdt_get_mem_regions(struct mem_region *, int *, uint32_t *); +int fdt_get_phyaddr(phandle_t node, int *); +int fdt_immr_addr(void); +int fdt_regsize(phandle_t, u_long *, u_long *); +int fdt_intr_decode(phandle_t, pcell_t *, int *, int *, int *); +int fdt_intr_to_rl(phandle_t, struct resource_list *, struct fdt_sense_level *); +int fdt_is_compatible(phandle_t, const char *); +int fdt_is_compatible_strict(phandle_t, const char *); +int fdt_is_enabled(phandle_t); +int fdt_pm_is_enabled(phandle_t); +int fdt_is_type(phandle_t, const char *); +int fdt_parent_addr_cells(phandle_t); +int fdt_pci_intr_info(phandle_t, struct fdt_pci_intr *); +int fdt_pci_ranges(phandle_t, struct fdt_pci_range *, struct fdt_pci_range *); +int fdt_pci_ranges_decode(phandle_t, struct fdt_pci_range *, + struct fdt_pci_range *); +int fdt_pci_route_intr(int, int, int, int, struct fdt_pci_intr *, int *); +int fdt_ranges_verify(pcell_t *, int, int, int, int); +int fdt_reg_to_rl(phandle_t, struct resource_list *, u_long); +int fdt_pm(phandle_t); + +#endif /* _FDT_COMMON_H_ */ Added: head/sys/dev/fdt/fdt_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/fdt/fdt_pci.c Wed Jun 2 17:17:45 2010 (r208747) @@ -0,0 +1,365 @@ +/*- + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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 +#include + +#include + +#include + +#include "ofw_bus_if.h" + +#define DEBUG +#undef DEBUG + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); \ + printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +#define FDT_RANGES_CELLS ((3 + 3 + 2) * 2) + +static void +fdt_pci_range_dump(struct fdt_pci_range *range) +{ +#ifdef DEBUG + printf("\n"); + printf(" base_pci = 0x%08lx\n", range->base_pci); + printf(" base_par = 0x%08lx\n", range->base_parent); + printf(" len = 0x%08lx\n", range->len); +#endif +} + +int +fdt_pci_ranges_decode(phandle_t node, struct fdt_pci_range *io_space, + struct fdt_pci_range *mem_space) +{ + pcell_t ranges[FDT_RANGES_CELLS]; + struct fdt_pci_range *pci_space; + pcell_t addr_cells, size_cells, par_addr_cells; + pcell_t *rangesptr; + pcell_t cell0, cell1, cell2; + int tuple_size, tuples, i, rv, offset_cells, len; + + /* + * Retrieve 'ranges' property. + */ + if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0) + return (EINVAL); + if (addr_cells != 3 || size_cells != 2) + return (ERANGE); + + par_addr_cells = fdt_parent_addr_cells(node); + if (par_addr_cells > 3) + return (ERANGE); + + len = OF_getproplen(node, "ranges"); + if (len > sizeof(ranges)) + return (ENOMEM); + + if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0) + return (EINVAL); + + tuple_size = sizeof(pcell_t) * (addr_cells + par_addr_cells + + size_cells); + tuples = len / tuple_size; + + rangesptr = &ranges[0]; + offset_cells = 0; + for (i = 0; i < tuples; i++) { + cell0 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + cell1 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + cell2 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + + if (cell0 & 0x02000000) { + pci_space = mem_space; + } else if (cell0 & 0x01000000) { + pci_space = io_space; + } else { + rv = ERANGE; + goto out; + } + + if (par_addr_cells == 3) { + /* + * This is a PCI subnode 'ranges'. Skip cell0 and + * cell1 of this entry and only use cell2. + */ + offset_cells = 2; + rangesptr += offset_cells; + } + + if (fdt_data_verify((void *)rangesptr, par_addr_cells - + offset_cells)) { + rv = ERANGE; + goto out; + } + pci_space->base_parent = fdt_data_get((void *)rangesptr, + par_addr_cells - offset_cells); + rangesptr += par_addr_cells - offset_cells; + + if (fdt_data_verify((void *)rangesptr, size_cells)) { + rv = ERANGE; + goto out; + } + pci_space->len = fdt_data_get((void *)rangesptr, size_cells); + rangesptr += size_cells; + + pci_space->base_pci = cell2; + } + rv = 0; +out: + return (rv); +} + +int +fdt_pci_ranges(phandle_t node, struct fdt_pci_range *io_space, + struct fdt_pci_range *mem_space) +{ + struct fdt_pci_range par_io_space, par_mem_space; + u_long base; + int err; + + debugf("Processing parent PCI node: %x\n", node); + if ((err = fdt_pci_ranges_decode(OF_parent(node), &par_io_space, + &par_mem_space)) != 0) { + debugf("could not decode parent PCI node 'ranges'\n"); + return (err); + } + + debugf("Processing PCI sub node: %x\n", node); + if ((err = fdt_pci_ranges_decode(node, io_space, mem_space)) != 0) { + debugf("could not decode PCI subnode 'ranges'\n"); + return (err); + } + + base = io_space->base_parent & 0x000fffff; + base += par_io_space.base_parent; + io_space->base_parent = base; + + base = mem_space->base_parent & 0x000fffff; + base += par_mem_space.base_parent; + mem_space->base_parent = base; + + debugf("Post fixup dump:\n"); + fdt_pci_range_dump(io_space); + fdt_pci_range_dump(mem_space); + + return (0); +} + +static int +fdt_addr_cells(phandle_t node, int *addr_cells) +{ + pcell_t cell; + int cell_size; + + cell_size = sizeof(cell); + if (OF_getprop(node, "#address-cells", &cell, cell_size) < cell_size) + return (EINVAL); + *addr_cells = fdt32_to_cpu((int)cell); + + if (*addr_cells > 3) + return (ERANGE); + return (0); +} + +static int +fdt_interrupt_cells(phandle_t node) +{ + pcell_t intr_cells; + + if (OF_getprop(node, "#interrupt-cells", &intr_cells, + sizeof(intr_cells)) <= 0) { + debugf("no intr-cells defined, defaulting to 1\n"); + intr_cells = 1; + } + intr_cells = fdt32_to_cpu(intr_cells); + + return ((int)intr_cells); +} + +int +fdt_pci_intr_info(phandle_t node, struct fdt_pci_intr *intr_info) +{ + void *map, *mask; + phandle_t pci_par; + int intr_cells, addr_cells; + int len; + + addr_cells = fdt_parent_addr_cells(node); + + pci_par = OF_parent(node); + intr_cells = fdt_interrupt_cells(pci_par); + + /* + * Retrieve the interrupt map and mask properties. + */ + len = OF_getprop_alloc(pci_par, "interrupt-map-mask", 1, &mask); + if (len / sizeof(pcell_t) != (addr_cells + intr_cells)) { + debugf("bad mask len = %d\n", len); + goto err; + } + + len = OF_getprop_alloc(pci_par, "interrupt-map", 1, &map); + if (len <= 0) { + debugf("bad map len = %d\n", len); + goto err; + } + + intr_info->map_len = len; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 17:20:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E62041065676; Wed, 2 Jun 2010 17:20:00 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4C988FC1D; Wed, 2 Jun 2010 17:20: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 o52HK0GN018065; Wed, 2 Jun 2010 17:20:00 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52HK0Ek018035; Wed, 2 Jun 2010 17:20:00 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201006021720.o52HK0Ek018035@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 2 Jun 2010 17:20: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: r208748 - head/sys/dev/uart X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 17:20:01 -0000 Author: raj Date: Wed Jun 2 17:20:00 2010 New Revision: 208748 URL: http://svn.freebsd.org/changeset/base/208748 Log: FDT (simplebus) compatible attachment for uart(4). This will be a single uart(4) attachment code shared by all FDT-enabled platforms. Reviewed by: imp Sponsored by: The FreeBSD Foundation Added: head/sys/dev/uart/uart_bus_fdt.c (contents, props changed) Added: head/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/uart/uart_bus_fdt.c Wed Jun 2 17:20:00 2010 (r208748) @@ -0,0 +1,200 @@ +/*- + * Copyright (c) 2009-2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Semihalf under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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 + +#include +#include +#include +#include +#include +#include + +static int uart_fdt_probe(device_t); + +static device_method_t uart_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, uart_fdt_probe), + DEVMETHOD(device_attach, uart_bus_attach), + DEVMETHOD(device_detach, uart_bus_detach), + { 0, 0 } +}; + +static driver_t uart_fdt_driver = { + uart_driver_name, + uart_fdt_methods, + sizeof(struct uart_softc), +}; + +static int +uart_fdt_get_clock(phandle_t node, pcell_t *cell) +{ + pcell_t clock; + + if ((OF_getprop(node, "clock-frequency", &clock, + sizeof(clock))) <= 0) + return (ENXIO); + + if (clock == 0) + /* Try to retrieve parent 'bus-frequency' */ + /* XXX this should go to simple-bus fixup or so */ + if ((OF_getprop(OF_parent(node), "bus-frequency", &clock, + sizeof(clock))) <= 0) + clock = 0; + + *cell = fdt32_to_cpu(clock); + return (0); +} + +static int +uart_fdt_get_shift(phandle_t node, pcell_t *cell) +{ + pcell_t shift; + + if ((OF_getprop(node, "reg-shift", &shift, sizeof(shift))) <= 0) + shift = 0; + *cell = fdt32_to_cpu(shift); + return (0); +} + +static int +uart_fdt_probe(device_t dev) +{ + struct uart_softc *sc; + phandle_t node; + pcell_t clock, shift; + int err; + + if (!ofw_bus_is_compatible(dev, "ns16550")) + return (ENXIO); + + sc = device_get_softc(dev); + sc->sc_class = &uart_ns8250_class; + + node = ofw_bus_get_node(dev); + + if ((err = uart_fdt_get_clock(node, &clock)) != 0) + return (err); + uart_fdt_get_shift(node, &shift); + + return (uart_bus_probe(dev, (int)shift, (int)clock, 0, 0)); +} + +DRIVER_MODULE(uart, simplebus, uart_fdt_driver, uart_devclass, 0, 0); + +/* + * UART console routines. + */ +bus_space_tag_t uart_bus_space_io; +bus_space_tag_t uart_bus_space_mem; + +int +uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) +{ + + return ((b1->bsh == b2->bsh && b1->bst == b2->bst) ? 1 : 0); +} + +int +uart_cpu_getdev(int devtype, struct uart_devinfo *di) +{ + char buf[64]; + struct uart_class *class; + phandle_t node, chosen; + pcell_t shift, br, rclk; + u_long start, size; + int err; + + if (devtype != UART_DEV_CONSOLE) + return (ENXIO); + + /* + * Retrieve /chosen/std{in,out}. + */ + if ((chosen = OF_finddevice("/chosen")) == 0) + return (ENXIO); + if (OF_getprop(chosen, "stdin", buf, sizeof(buf)) <= 0) + return (ENXIO); + if ((node = OF_finddevice(buf)) == 0) + return (ENXIO); + if (OF_getprop(chosen, "stdout", buf, sizeof(buf)) <= 0) + return (ENXIO); + if (OF_finddevice(buf) != node) + /* Only stdin == stdout is supported. */ + return (ENXIO); + /* + * Retrieve serial attributes. + */ + uart_fdt_get_shift(node, &shift); + + if (OF_getprop(node, "current-speed", &br, sizeof(br)) <= 0) + br = 0; + br = fdt32_to_cpu(br); + + if ((err = uart_fdt_get_clock(node, &rclk)) != 0) + return (err); + /* + * Finalize configuration. + */ + class = &uart_quicc_class; + if (fdt_is_compatible(node, "ns16550")) + class = &uart_ns8250_class; + + di->bas.chan = 0; + di->bas.regshft = (u_int)shift; + di->baudrate = 0; + di->bas.rclk = (u_int)rclk; + di->ops = uart_getops(class); + di->databits = 8; + di->stopbits = 1; + di->parity = UART_PARITY_NONE; + di->bas.bst = fdtbus_bs_tag; + + err = fdt_regsize(node, &start, &size); + if (err) + return (ENXIO); + start += FDT_IMMR_VA; + + uart_bus_space_mem = fdtbus_bs_tag; + uart_bus_space_io = NULL; + + if (bus_space_map(di->bas.bst, start, size, 0, &di->bas.bsh) != 0) + return (ENXIO); + + return (0); +} From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 17:22:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D568A1065675; Wed, 2 Jun 2010 17:22:38 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4B6B8FC1B; Wed, 2 Jun 2010 17:22: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 o52HMc6f018669; Wed, 2 Jun 2010 17:22:38 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52HMcMs018666; Wed, 2 Jun 2010 17:22:38 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201006021722.o52HMcMs018666@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 2 Jun 2010 17:22: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: r208749 - head/sys/tools/fdt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 17:22:38 -0000 Author: raj Date: Wed Jun 2 17:22:38 2010 New Revision: 208749 URL: http://svn.freebsd.org/changeset/base/208749 Log: Flattened Device Tree helper scripts. Reviewed by: imp Sponsored by: The FreeBSD Foundation Added: head/sys/tools/fdt/ head/sys/tools/fdt/embed_dtb.sh (contents, props changed) head/sys/tools/fdt/make_dtbh.sh (contents, props changed) Added: head/sys/tools/fdt/embed_dtb.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/tools/fdt/embed_dtb.sh Wed Jun 2 17:22:38 2010 (r208749) @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Copyright (c) 2010 The FreeBSD Foundation +# All rights reserved. +# +# This software was developed by Semihalf under sponsorship from +# the FreeBSD Foundation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +# $1: kernel filename +# $2: device tree blob filename + +dtbsize=`ls -l $2 | awk '{print $5}'` +obs=`strings -at d $1 | grep "Device Tree Blob STARTS here" | awk '{print $1}'` +eol=`strings -at d $1 | grep "Device Tree Blob STOPS here" | awk '{print $1}'` +sz=$((eol - obs)); +if [ $sz -lt $dtbsize ] +then + echo "Selected blob is too big to reembed. Please rebuild the kernel." + exit +fi +dd if=$2 ibs=${dtbsize} of=$1 obs=${obs} oseek=1 conv=notrunc 2> /dev/null Added: head/sys/tools/fdt/make_dtbh.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/tools/fdt/make_dtbh.sh Wed Jun 2 17:22:38 2010 (r208749) @@ -0,0 +1,8 @@ +#!/bin/sh +# +# $FreeBSD$ + +# Script generates a $2/fdt_static_dtb.h file. + +dtb_base_name=`basename $1 .dts` +echo '#define FDT_DTB_FILE "'${dtb_base_name}.dtb'"' > $2/fdt_static_dtb.h From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 17:24:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63247106566C; Wed, 2 Jun 2010 17:24:41 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 52CDB8FC21; Wed, 2 Jun 2010 17:24: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 o52HOfFj019178; Wed, 2 Jun 2010 17:24:41 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52HOfAw019176; Wed, 2 Jun 2010 17:24:41 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201006021724.o52HOfAw019176@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 2 Jun 2010 17:24: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: r208750 - head/sys/contrib/libfdt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 17:24:41 -0000 Author: raj Date: Wed Jun 2 17:24:41 2010 New Revision: 208750 URL: http://svn.freebsd.org/changeset/base/208750 Log: Provide kernel level headers for the libfdt code. Reviewed by: imp Sponsored by: The FreeBSD Foundation Modified: head/sys/contrib/libfdt/libfdt_env.h Modified: head/sys/contrib/libfdt/libfdt_env.h ============================================================================== --- head/sys/contrib/libfdt/libfdt_env.h Wed Jun 2 17:22:38 2010 (r208749) +++ head/sys/contrib/libfdt/libfdt_env.h Wed Jun 2 17:24:41 2010 (r208750) @@ -1,9 +1,17 @@ #ifndef _LIBFDT_ENV_H #define _LIBFDT_ENV_H +#ifdef _KERNEL +#include +#include +#include +#include +#include +#else #include #include #include +#endif #define _B(n) ((unsigned long long)((uint8_t *)&x)[n]) static inline uint32_t fdt32_to_cpu(uint32_t x) From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 17:27:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AF5F106564A; Wed, 2 Jun 2010 17:27:24 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A1538FC18; Wed, 2 Jun 2010 17:27: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 o52HROTv019817; Wed, 2 Jun 2010 17:27:24 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52HROx0019814; Wed, 2 Jun 2010 17:27:24 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201006021727.o52HROx0019814@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 2 Jun 2010 17:27: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: r208751 - in head/sys: libkern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 17:27:24 -0000 Author: raj Date: Wed Jun 2 17:27:23 2010 New Revision: 208751 URL: http://svn.freebsd.org/changeset/base/208751 Log: Provide memchr() in the libkern. This is required by libfdt and will be compiled in conditionally only for FDT-enabled platforms. Reviewed by: imp Sponsored by: The FreeBSD Foundation Added: head/sys/libkern/memchr.c (contents, props changed) Modified: head/sys/sys/libkern.h Added: head/sys/libkern/memchr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/libkern/memchr.c Wed Jun 2 17:27:23 2010 (r208751) @@ -0,0 +1,51 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * 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. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 + +void * +memchr(const void *s, int c, size_t n) +{ + if (n != 0) { + const unsigned char *p = s; + + do { + if (*p++ == (unsigned char)c) + return ((void *)(uintptr_t)(p - 1)); + } while (--n != 0); + } + return (NULL); +} Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Wed Jun 2 17:24:41 2010 (r208750) +++ head/sys/sys/libkern.h Wed Jun 2 17:27:23 2010 (r208751) @@ -92,6 +92,7 @@ int flsl(long); int fnmatch(const char *, const char *, int); void gets(char *, size_t, int); int locc(int, char *, u_int); +void *memchr(const void *s, int c, size_t n); int memcmp(const void *b1, const void *b2, size_t len); void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 18:06:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7302D106567E; Wed, 2 Jun 2010 18:06:32 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6202A8FC1B; Wed, 2 Jun 2010 18:06: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 o52I6W8A028470; Wed, 2 Jun 2010 18:06:32 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52I6Wri028466; Wed, 2 Jun 2010 18:06:32 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201006021806.o52I6Wri028466@svn.freebsd.org> From: Matt Jacob Date: Wed, 2 Jun 2010 18:06: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: r208752 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 18:06:32 -0000 Author: mjacob Date: Wed Jun 2 18:06:32 2010 New Revision: 208752 URL: http://svn.freebsd.org/changeset/base/208752 Log: Protect periph drivers list and rearrange things to minimize the chance of stepping oneself during probing. Don't blindly decrement a periph probe count. Reviewed by: scsi@ Obtained from: Alexander Motin, Atillio Rao, Others MFC after: 1 month Modified: head/sys/cam/cam_periph.c head/sys/cam/cam_xpt.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Wed Jun 2 17:27:23 2010 (r208751) +++ head/sys/cam/cam_periph.c Wed Jun 2 18:06:32 2010 (r208752) @@ -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: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Jun 2 17:27:23 2010 (r208751) +++ head/sys/cam/cam_xpt.c Wed Jun 2 18:06:32 2010 (r208752) @@ -2138,6 +2138,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) { @@ -2145,9 +2146,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); } @@ -2323,7 +2327,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: { @@ -2670,7 +2673,9 @@ xpt_action_default(union ccb *start_ccb) xptedtmatch(cdm); break; case CAM_DEV_POS_PDRV: + xpt_lock_buses(); xptperiphlistmatch(cdm); + xpt_unlock_buses(); break; default: cdm->status = CAM_DEV_MATCH_ERROR; From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 18:31:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E03C9106564A; Wed, 2 Jun 2010 18:31:04 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFFA28FC08; Wed, 2 Jun 2010 18:31: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 o52IV4f8033845; Wed, 2 Jun 2010 18:31:04 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52IV4Rw033843; Wed, 2 Jun 2010 18:31:04 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201006021831.o52IV4Rw033843@svn.freebsd.org> From: Ulrich Spoerlein Date: Wed, 2 Jun 2010 18:31: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: r208753 - head/contrib/gdtoa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 18:31:05 -0000 Author: uqs Date: Wed Jun 2 18:31:04 2010 New Revision: 208753 URL: http://svn.freebsd.org/changeset/base/208753 Log: Add required header for isalnum(3) to quench compiler warnings Forgotten in: r174678 Submitted by: Alexander Best alexbestms at wwu.de Approved by: das Modified: head/contrib/gdtoa/hexnan.c Modified: head/contrib/gdtoa/hexnan.c ============================================================================== --- head/contrib/gdtoa/hexnan.c Wed Jun 2 18:06:32 2010 (r208752) +++ head/contrib/gdtoa/hexnan.c Wed Jun 2 18:31:04 2010 (r208753) @@ -31,6 +31,8 @@ THIS SOFTWARE. /* $FreeBSD$ */ +#include + #include "gdtoaimp.h" static void From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 18:58:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09FA81065673 for ; Wed, 2 Jun 2010 18:58:15 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 8DE368FC1C for ; Wed, 2 Jun 2010 18:58:14 +0000 (UTC) Received: (qmail 20152 invoked by uid 399); 2 Jun 2010 18:58:12 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 2 Jun 2010 18:58:12 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4C06A9C3.8070902@FreeBSD.org> Date: Wed, 02 Jun 2010 11:58:11 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.9) Gecko/20100330 Thunderbird/3.0.4 MIME-Version: 1.0 To: Rafal Jaworowski References: <201006021717.o52HHjfW017538@svn.freebsd.org> In-Reply-To: <201006021717.o52HHjfW017538@svn.freebsd.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=1A1ABC84 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: r208747 - head/sys/dev/fdt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 18:58:15 -0000 On 06/02/10 10:17, Rafal Jaworowski wrote: > o simplebus(4) - bus driver representing ePAPR Do we write on it with eINK? Doug -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 19:16:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCAC6106568C; Wed, 2 Jun 2010 19:16:58 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1AF58FC19; Wed, 2 Jun 2010 19:16: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 o52JGwnT044071; Wed, 2 Jun 2010 19:16:58 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52JGwkU044066; Wed, 2 Jun 2010 19:16:58 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201006021916.o52JGwkU044066@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 2 Jun 2010 19:16:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208755 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 19:16:59 -0000 Author: jilles Date: Wed Jun 2 19:16:58 2010 New Revision: 208755 URL: http://svn.freebsd.org/changeset/base/208755 Log: sh: Pass TERM changes to libedit. I have changed the patch slightly to ignore TERM changes in subshells. PR: bin/146916 Submitted by: Guy Yur Obtained from: NetBSD Modified: head/bin/sh/histedit.c head/bin/sh/myhistedit.h head/bin/sh/var.c head/bin/sh/var.h Modified: head/bin/sh/histedit.c ============================================================================== --- head/bin/sh/histedit.c Wed Jun 2 18:46:12 2010 (r208754) +++ head/bin/sh/histedit.c Wed Jun 2 19:16:58 2010 (r208755) @@ -98,6 +98,8 @@ histedit(void) /* * turn editing on */ + char *term; + INTOFF; if (el_in == NULL) el_in = fdopen(0, "r"); @@ -107,6 +109,11 @@ histedit(void) el_out = fdopen(2, "w"); if (el_in == NULL || el_err == NULL || el_out == NULL) goto bad; + term = lookupvar("TERM"); + if (term) + setenv("TERM", term, 1); + else + unsetenv("TERM"); el = el_init(arg0, el_in, el_out, el_err); if (el != NULL) { if (hist) @@ -160,6 +167,13 @@ sethistsize(hs) } } +void +setterm(const char *term) +{ + if (rootshell && el != NULL && term != NULL) + el_set(el, EL_TERMINAL, term); +} + int histcmd(int argc, char **argv) { Modified: head/bin/sh/myhistedit.h ============================================================================== --- head/bin/sh/myhistedit.h Wed Jun 2 18:46:12 2010 (r208754) +++ head/bin/sh/myhistedit.h Wed Jun 2 19:16:58 2010 (r208755) @@ -38,6 +38,7 @@ extern int displayhist; void histedit(void); void sethistsize(const char *); +void setterm(const char *); int histcmd(int, char **); int not_fcnumber(const char *); int str_to_event(const char *, int); Modified: head/bin/sh/var.c ============================================================================== --- head/bin/sh/var.c Wed Jun 2 18:46:12 2010 (r208754) +++ head/bin/sh/var.c Wed Jun 2 19:16:58 2010 (r208755) @@ -80,6 +80,7 @@ struct varinit { #ifndef NO_HISTORY struct var vhistsize; +struct var vterm; #endif struct var vifs; struct var vmail; @@ -114,6 +115,10 @@ STATIC const struct varinit varinit[] = NULL }, { &vps4, 0, "PS4=+ ", NULL }, +#ifndef NO_HISTORY + { &vterm, VUNSET, "TERM=", + setterm }, +#endif { &voptind, 0, "OPTIND=1", getoptsreset }, { NULL, 0, NULL, Modified: head/bin/sh/var.h ============================================================================== --- head/bin/sh/var.h Wed Jun 2 18:46:12 2010 (r208754) +++ head/bin/sh/var.h Wed Jun 2 19:16:58 2010 (r208755) @@ -77,6 +77,7 @@ extern struct var vps2; extern struct var vps4; #ifndef NO_HISTORY extern struct var vhistsize; +extern struct var vterm; #endif /* @@ -96,6 +97,7 @@ extern struct var vhistsize; #define optindval() (voptind.text + 7) #ifndef NO_HISTORY #define histsizeval() (vhistsize.text + 9) +#define termval() (vterm.text + 5) #endif #define mpathset() ((vmpath.flags & VUNSET) == 0) From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 20:01:52 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CC16106566C; Wed, 2 Jun 2010 20:01:52 +0000 (UTC) (envelope-from juli@clockworksquid.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 03D7E8FC0A; Wed, 2 Jun 2010 20:01:51 +0000 (UTC) Received: by vws12 with SMTP id 12so90504vws.13 for ; Wed, 02 Jun 2010 13:01:51 -0700 (PDT) Received: by 10.220.157.134 with SMTP id b6mr5967003vcx.203.1275508911157; Wed, 02 Jun 2010 13:01:51 -0700 (PDT) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.220.199.70 with HTTP; Wed, 2 Jun 2010 13:01:31 -0700 (PDT) In-Reply-To: <201006020842.49509.jhb@freebsd.org> References: <201006021106.o52B63PZ035362@svn.freebsd.org> <201006020842.49509.jhb@freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 13:01:31 -0700 X-Google-Sender-Auth: UFI9Qaqz3S08Qbnry8m2RFSjQ1I Message-ID: 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: r208737 - in head: contrib/binutils/bfd contrib/binutils/gas/config contrib/binutils/include/elf contrib/binutils/include/opcode contrib/binutils/opcodes contrib/gcc/config contrib/gcc/... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 20:01:52 -0000 On Wed, Jun 2, 2010 at 05:42, John Baldwin wrote: > On Wednesday 02 June 2010 7:06:03 am Juli Mallett wrote: >> =A0 o) Fix our GCC spec to define __mips64 for 64-bit targets, not __mip= s64__, the >> =A0 =A0 =A0former being what libgcc, etc., check and the latter seemingl= y being a >> =A0 =A0 =A0misspelling of a hand merge from a Linux spec. > > I wonder if it would be useful to define both? =A0The macros we check for > architecture-specific code for other architectures all have both leading = and > trailing underscores (e.g. __i386__, __amd64__, etc.). =A0Being able to u= se > __mips64__ instead of __mips64 for that in kernel sources, etc. would be > more consistent. __mips64 is a mistake and adding __mips64__ and using it would be a bigger one, I think, since it's kind of confusing and not actually useful enough to use consistently. MIPS64 is the name of a particular ISA, but not all 64-bit ISAs (indeed, the earliest 64-bit ISA is MIPS-III) are derived from it. __mips64 implies a 64-bit ABI, but there isn't a clean split between non-__mips64 ABIs and __mips64 ABIs such that those are the only two things you'd ever need to check for. We intend to support the n32 ABI in userland, which has 64-bit registers. Conditionals related to that kind of thing would become (__mips64__ || __mips_n32). I think it makes more sense to be consistent and use macros related to specific ABIs, macros related to specific ISAs and sometimes the macros related to the length of long and the size of a pointer, since there are some ABIs that we might support (o64) which can support strange combinations of those. Thanks, Juli. From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 21:15:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57F48106566B; Wed, 2 Jun 2010 21:15:01 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 478A48FC08; Wed, 2 Jun 2010 21:15: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 o52LF0PS070333; Wed, 2 Jun 2010 21:15:00 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52LF0Aj070329; Wed, 2 Jun 2010 21:15:00 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006022115.o52LF0Aj070329@svn.freebsd.org> From: Juli Mallett Date: Wed, 2 Jun 2010 21:15: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: r208758 - head/gnu/usr.bin/cc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 21:15:01 -0000 Author: jmallett Date: Wed Jun 2 21:15:00 2010 New Revision: 208758 URL: http://svn.freebsd.org/changeset/base/208758 Log: Fix build for O32 systems without a TARGET_CPUTYPE defined. We must default to MIPS-III because FreeBSD relies on a number of MIPS-III features; the ABI default would be MIPS-I which we don't intend to support. Our old default before I switched to using the ABI default was MIPS32. Modified: head/gnu/usr.bin/cc/Makefile.inc Modified: head/gnu/usr.bin/cc/Makefile.inc ============================================================================== --- head/gnu/usr.bin/cc/Makefile.inc Wed Jun 2 21:00:18 2010 (r208757) +++ head/gnu/usr.bin/cc/Makefile.inc Wed Jun 2 21:15:00 2010 (r208758) @@ -49,6 +49,14 @@ MIPS_ABI_DEFAULT=ABI_64 MIPS_ABI_DEFAULT?=ABI_32 CFLAGS += -DMIPS_ABI_DEFAULT=${MIPS_ABI_DEFAULT} +# If we are compiling for the O32 ABI, we need to default to MIPS-III rather +# than taking the ISA from the ABI requirements, since FreeBSD is built with +# a number of MIPS-III features/instructions and that is the minimum ISA we +# support, not the O32 default MIPS-I. +.if ${MIPS_ABI_DEFAULT} == "ABI_32" +TARGET_CPUTYPE?=mips3 +.endif + # GCC by default takes the ISA from the ABI's requirements. If world is built # with a superior ISA, since we lack multilib, we have to set the right # default ISA to be able to link against what's in /usr/lib. Terrible stuff. From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 21:25:23 2010 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C4461065674; Wed, 2 Jun 2010 21:25:23 +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 9449B8FC08; Wed, 2 Jun 2010 21:25:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o52LJ3EY044192; Wed, 2 Jun 2010 15:19:03 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 02 Jun 2010 15:19:15 -0600 (MDT) Message-Id: <20100602.151915.496568814199104007.imp@bsdimp.com> To: jmallett@FreeBSD.org From: "M. Warner Losh" In-Reply-To: References: <201006021106.o52B63PZ035362@svn.freebsd.org> <201006020842.49509.jhb@freebsd.org> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 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, jhb@FreeBSD.org Subject: Re: svn commit: r208737 - in head: contrib/binutils/bfd contrib/binutils/gas/config contrib/binutils/include/elf contrib/binutils/include/opcode contrib/binutils/opcodes contrib/gcc/config contrib/gcc/... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 21:25:23 -0000 In message: Juli Mallett writes: : On Wed, Jun 2, 2010 at 05:42, John Baldwin wrote: : > On Wednesday 02 June 2010 7:06:03 am Juli Mallett wrote: : >> =A0 o) Fix our GCC spec to define __mips64 for 64-bit targets, not= __mips64__, the : >> =A0 =A0 =A0former being what libgcc, etc., check and the latter se= emingly being a : >> =A0 =A0 =A0misspelling of a hand merge from a Linux spec. : > : > I wonder if it would be useful to define both? =A0The macros we che= ck for : > architecture-specific code for other architectures all have both le= ading and : > trailing underscores (e.g. __i386__, __amd64__, etc.). =A0Being abl= e to use : > __mips64__ instead of __mips64 for that in kernel sources, etc. wou= ld be : > more consistent. : = : __mips64 is a mistake and adding __mips64__ and using it would be a : bigger one, I think, since it's kind of confusing and not actually : useful enough to use consistently. MIPS64 is the name of a particula= r : ISA, but not all 64-bit ISAs (indeed, the earliest 64-bit ISA is : MIPS-III) are derived from it. __mips64 implies a 64-bit ABI, but : there isn't a clean split between non-__mips64 ABIs and __mips64 ABIs= : such that those are the only two things you'd ever need to check for.= : We intend to support the n32 ABI in userland, which has 64-bit : registers. Conditionals related to that kind of thing would become : (__mips64__ || __mips_n32). I think it makes more sense to be : consistent and use macros related to specific ABIs, macros related to= : specific ISAs and sometimes the macros related to the length of long : and the size of a pointer, since there are some ABIs that we might : support (o64) which can support strange combinations of those. What Juli said and __mips64 is neither an architecture nor a machine. All the other examples you gave are architectures. Warner From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 21:28:08 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45B431065670; Wed, 2 Jun 2010 21:28:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 356AA8FC16; Wed, 2 Jun 2010 21: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 o52LS814073234; Wed, 2 Jun 2010 21:28:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52LS8AI073232; Wed, 2 Jun 2010 21:28:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201006022128.o52LS8AI073232@svn.freebsd.org> From: Martin Matuska Date: Wed, 2 Jun 2010 21: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: r208759 - head/release/doc/en_US.ISO8859-1/relnotes X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 21:28:08 -0000 Author: mm Date: Wed Jun 2 21:28:07 2010 New Revision: 208759 URL: http://svn.freebsd.org/changeset/base/208759 Log: Document import of xz. Approved by: delphij (mentor) Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Jun 2 21:15:00 2010 (r208758) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Wed Jun 2 21:28:07 2010 (r208759) @@ -491,6 +491,10 @@ WPA Supplicant has been updated from 0.5.8 to 0.5.10. + A snapshot of xz as of + 12 April 2010 has been added. More information can be found in the + &man.xz.1;, &man.xzdec.1; and &man.lzmainfo.1; manual pages. + From owner-svn-src-head@FreeBSD.ORG Wed Jun 2 23:31:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01C091065672; Wed, 2 Jun 2010 23:31:28 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBE4C8FC1C; Wed, 2 Jun 2010 23:31: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 o52NVR4x000438; Wed, 2 Jun 2010 23:31:27 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o52NVRHY000433; Wed, 2 Jun 2010 23:31:27 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201006022331.o52NVRHY000433@svn.freebsd.org> From: Matt Jacob Date: Wed, 2 Jun 2010 23:31: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: r208761 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2010 23:31:28 -0000 Author: mjacob Date: Wed Jun 2 23:31:27 2010 New Revision: 208761 URL: http://svn.freebsd.org/changeset/base/208761 Log: Various minor and not so minor fixes suggested by Coverity. In at least one case, it's amazing that target mode worked at all. Found by: Coverity. MFC after: 2 weeks Modified: head/sys/dev/isp/isp.c head/sys/dev/isp/isp_freebsd.c head/sys/dev/isp/isp_library.c head/sys/dev/isp/isp_pci.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Wed Jun 2 21:59:13 2010 (r208760) +++ head/sys/dev/isp/isp.c Wed Jun 2 23:31:27 2010 (r208761) @@ -3936,14 +3936,18 @@ isp_login_device(ispsoftc_t *isp, int ch i = lim; } break; - } else if (r != MBOX_LOOP_ID_USED) { + } else if ((r & 0xffff) == MBOX_LOOP_ID_USED) { + /* + * Try the next loop id. + */ + *ohp = handle; + handle = isp_nxt_handle(isp, chan, handle); + } else { + /* + * Give up. + */ i = lim; break; - } else if (r == MBOX_TIMEOUT) { - return (-1); - } else { - *ohp = handle; - handle = isp_nxt_handle(isp, chan, *ohp); } } @@ -4313,8 +4317,7 @@ isp_start(XS_T *xs) reqp->req_header.rqs_entry_type = RQSTYPE_REQUEST; } } - /* reqp->req_header.rqs_flags = 0; */ - /* reqp->req_header.rqs_seqno = 0; */ + if (IS_24XX(isp)) { int ttype; if (XS_TAG_P(xs)) { @@ -4363,37 +4366,45 @@ isp_start(XS_T *xs) reqp->req_flags = XS_TAG_TYPE(xs); } } - cdbp = reqp->req_cdb; + tptr = &reqp->req_time; if (IS_SCSI(isp)) { reqp->req_target = target | (XS_CHANNEL(xs) << 7); reqp->req_lun_trn = XS_LUN(xs); reqp->req_cdblen = XS_CDBLEN(xs); + cdbp = reqp->req_cdb; } else if (IS_24XX(isp)) { + ispreqt7_t *t7 = (ispreqt7_t *)local; fcportdb_t *lp; lp = &FCPARAM(isp, XS_CHANNEL(xs))->portdb[hdlidx]; - ((ispreqt7_t *)reqp)->req_nphdl = target; - ((ispreqt7_t *)reqp)->req_tidlo = lp->portid; - ((ispreqt7_t *)reqp)->req_tidhi = lp->portid >> 16; - ((ispreqt7_t *)reqp)->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs)); + t7->req_nphdl = target; + t7->req_tidlo = lp->portid; + t7->req_tidhi = lp->portid >> 16; + t7->req_vpidx = ISP_GET_VPIDX(isp, XS_CHANNEL(xs)); if (XS_LUN(xs) > 256) { - ((ispreqt7_t *)reqp)->req_lun[0] = XS_LUN(xs) >> 8; - ((ispreqt7_t *)reqp)->req_lun[0] |= 0x40; + t7->req_lun[0] = XS_LUN(xs) >> 8; + t7->req_lun[0] |= 0x40; } - ((ispreqt7_t *)reqp)->req_lun[1] = XS_LUN(xs); - cdbp = ((ispreqt7_t *)reqp)->req_cdb; - tptr = &((ispreqt7_t *)reqp)->req_time; + t7->req_lun[1] = XS_LUN(xs); + cdbp = t7->req_cdb; + tptr = &t7->req_time; } else if (ISP_CAP_2KLOGIN(isp)) { - ((ispreqt2e_t *)reqp)->req_target = target; - ((ispreqt2e_t *)reqp)->req_scclun = XS_LUN(xs); + ispreqt2e_t *t2e = (ispreqt2e_t *)local; + t2e->req_target = target; + t2e->req_scclun = XS_LUN(xs); + cdbp = t2e->req_cdb; } else if (ISP_CAP_SCCFW(isp)) { - ((ispreqt2_t *)reqp)->req_target = target; - ((ispreqt2_t *)reqp)->req_scclun = XS_LUN(xs); + ispreqt2_t *t2 = (ispreqt2_t *)local; + t2->req_target = target; + t2->req_scclun = XS_LUN(xs); + cdbp = t2->req_cdb; } else { - ((ispreqt2_t *)reqp)->req_target = target; - ((ispreqt2_t *)reqp)->req_lun_trn = XS_LUN(xs); + ispreqt2_t *t2 = (ispreqt2_t *)local; + t2->req_target = target; + t2->req_lun_trn = XS_LUN(xs); + cdbp = t2->req_cdb; } ISP_MEMCPY(cdbp, XS_CDBP(xs), XS_CDBLEN(xs)); Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Wed Jun 2 21:59:13 2010 (r208760) +++ head/sys/dev/isp/isp_freebsd.c Wed Jun 2 23:31:27 2010 (r208761) @@ -284,7 +284,7 @@ isp_detach(ispsoftc_t *isp) config_intrhook_disestablish(&isp->isp_osinfo.ehook); isp->isp_osinfo.ehook_active = 0; } - if (isp->isp_osinfo.devq == NULL) { + if (isp->isp_osinfo.devq != NULL) { cam_simq_free(isp->isp_osinfo.devq); isp->isp_osinfo.devq = NULL; } @@ -1910,7 +1910,7 @@ isp_handle_platform_atio2(ispsoftc_t *is tstate_t *tptr; struct ccb_accept_tio *atiop; uint16_t nphdl; - atio_private_data_t *atp = NULL; + atio_private_data_t *atp; inot_private_data_t *ntp; /* @@ -2063,9 +2063,6 @@ isp_handle_platform_atio2(ispsoftc_t *is rls_lun_statep(isp, tptr); return; noresrc: - if (atp) { - isp_put_atpd(isp, tptr, atp); - } ntp = isp_get_ntpd(isp, tptr); if (ntp == NULL) { rls_lun_statep(isp, tptr); @@ -2500,7 +2497,7 @@ isp_handle_platform_notify_fc(ispsoftc_t lun = inp->in_lun; } if (ISP_CAP_2KLOGIN(isp)) { - loopid = ((in_fcentry_e_t *)inot)->in_iid; + loopid = ((in_fcentry_e_t *)inp)->in_iid; } else { loopid = inp->in_iid; } Modified: head/sys/dev/isp/isp_library.c ============================================================================== --- head/sys/dev/isp/isp_library.c Wed Jun 2 21:59:13 2010 (r208760) +++ head/sys/dev/isp/isp_library.c Wed Jun 2 23:31:27 2010 (r208761) @@ -1338,7 +1338,7 @@ isp_put_vp_ctrl_info(ispsoftc_t *isp, vp ISP_IOXPUT_16(isp, src->vp_ctrl_idmap[i], &dst->vp_ctrl_idmap[i]); } for (i = 0; i < ASIZE(src->vp_ctrl_reserved); i++) { - ISP_IOXPUT_8(isp, src->vp_ctrl_idmap[i], &dst->vp_ctrl_idmap[i]); + ISP_IOXPUT_8(isp, src->vp_ctrl_reserved[i], &dst->vp_ctrl_reserved[i]); } } Modified: head/sys/dev/isp/isp_pci.c ============================================================================== --- head/sys/dev/isp/isp_pci.c Wed Jun 2 21:59:13 2010 (r208760) +++ head/sys/dev/isp/isp_pci.c Wed Jun 2 23:31:27 2010 (r208761) @@ -641,7 +641,7 @@ isp_pci_attach(device_t dev) int isp_nvports = 0; uint32_t data, cmd, linesz, did; struct isp_pcisoftc *pcs; - ispsoftc_t *isp = NULL; + ispsoftc_t *isp; size_t psize, xsize; char fwname[32]; @@ -966,30 +966,28 @@ isp_pci_attach(device_t dev) return (0); bad: - if (pcs && pcs->ih) { + if (pcs->ih) { (void) bus_teardown_intr(dev, irq, pcs->ih); } - if (locksetup && isp) { + if (locksetup) { mtx_destroy(&isp->isp_osinfo.lock); } if (irq) { (void) bus_release_resource(dev, SYS_RES_IRQ, iqd, irq); } - if (pcs && pcs->msicount) { + if (pcs->msicount) { pci_release_msi(dev); } if (regs) { (void) bus_release_resource(dev, rtp, rgd, regs); } - if (pcs) { - if (pcs->pci_isp.isp_param) { - free(pcs->pci_isp.isp_param, M_DEVBUF); - pcs->pci_isp.isp_param = NULL; - } - if (pcs->pci_isp.isp_osinfo.pc.ptr) { - free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); - pcs->pci_isp.isp_osinfo.pc.ptr = NULL; - } + if (pcs->pci_isp.isp_param) { + free(pcs->pci_isp.isp_param, M_DEVBUF); + pcs->pci_isp.isp_param = NULL; + } + if (pcs->pci_isp.isp_osinfo.pc.ptr) { + free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); + pcs->pci_isp.isp_osinfo.pc.ptr = NULL; } return (ENXIO); } @@ -1725,6 +1723,8 @@ tdma2(void *arg, bus_dma_segment_t *dm_s bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; } else { + dm_segs = NULL; + nseg = 0; ddir = ISP_NOXFR; } } else { From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 00:00:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 128EB106564A; Thu, 3 Jun 2010 00:00:46 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01D578FC1F; Thu, 3 Jun 2010 00:00: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 o5300j3N006893; Thu, 3 Jun 2010 00:00:45 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5300jxD006889; Thu, 3 Jun 2010 00:00:45 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201006030000.o5300jxD006889@svn.freebsd.org> From: Jack F Vogel Date: Thu, 3 Jun 2010 00:00: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: r208762 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 00:00:46 -0000 Author: jfv Date: Thu Jun 3 00:00:45 2010 New Revision: 208762 URL: http://svn.freebsd.org/changeset/base/208762 Log: Fixes for panic experienced in test at Intel, when doing bidirectional stress traffic on 82598. Also a couple bug fixes from Michael Tuexen, thank you!! Add a workaround into the header so that 8 REL can use the driver (adds local copy of ALTQ fix). MFC: in a few days Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Wed Jun 2 23:31:27 2010 (r208761) +++ head/sys/dev/ixgbe/ixgbe.c Thu Jun 3 00:00:45 2010 (r208762) @@ -46,7 +46,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "2.2.0"; +char ixgbe_driver_version[] = "2.2.1"; /********************************************************************* * PCI Device ID Table @@ -107,7 +107,7 @@ static void ixgbe_qflush(struct ifnet *) #endif static int ixgbe_ioctl(struct ifnet *, u_long, caddr_t); static void ixgbe_init(void *); -static int ixgbe_init_locked(struct adapter *); +static void ixgbe_init_locked(struct adapter *); static void ixgbe_stop(void *); static void ixgbe_media_status(struct ifnet *, struct ifmediareq *); static int ixgbe_media_change(struct ifnet *); @@ -255,10 +255,10 @@ static int ixgbe_enable_msix = 1; TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix); /* - * Header split has seemed to be beneficial in - * most circumstances tested, so its on by default - * however this variable will allow it to be disabled - * for some debug purposes. + * Header split: this causes the hardware to DMA + * the header into a seperate mbuf from the payload, + * it can be a performance win in some workloads, but + * in others it actually hurts, its off by default. */ static bool ixgbe_header_split = FALSE; TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe_header_split); @@ -795,6 +795,7 @@ static int ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m) { struct adapter *adapter = ifp->if_softc; + struct ix_queue *que; struct tx_ring *txr; int i = 0, err = 0; @@ -803,12 +804,15 @@ ixgbe_mq_start(struct ifnet *ifp, struct i = m->m_pkthdr.flowid % adapter->num_queues; txr = &adapter->tx_rings[i]; + que = &adapter->queues[i]; if (IXGBE_TX_TRYLOCK(txr)) { err = ixgbe_mq_start_locked(ifp, txr, m); IXGBE_TX_UNLOCK(txr); - } else + } else { err = drbr_enqueue(ifp, txr->br, m); + taskqueue_enqueue(que->tq, &que->que_task); + } return (err); } @@ -913,7 +917,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c ifp->if_mtu = ifr->ifr_mtu; adapter->max_frame_size = ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; - error = ixgbe_init_locked(adapter); + ixgbe_init_locked(adapter); IXGBE_CORE_UNLOCK(adapter); } break; @@ -928,7 +932,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c ixgbe_set_promisc(adapter); } } else - error = ixgbe_init_locked(adapter); + ixgbe_init_locked(adapter); } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) ixgbe_stop(adapter); @@ -965,7 +969,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { IXGBE_CORE_LOCK(adapter); - error = ixgbe_init_locked(adapter); + ixgbe_init_locked(adapter); IXGBE_CORE_UNLOCK(adapter); } VLAN_CAPABILITIES(ifp); @@ -993,7 +997,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c **********************************************************************/ #define IXGBE_MHADD_MFS_SHIFT 16 -static int +static void ixgbe_init_locked(struct adapter *adapter) { struct ifnet *ifp = adapter->ifp; @@ -1004,7 +1008,6 @@ ixgbe_init_locked(struct adapter *adapte mtx_assert(&adapter->core_mtx, MA_OWNED); INIT_DEBUGOUT("ixgbe_init: begin"); - ixgbe_reset_hw(hw); hw->adapter_stopped = FALSE; ixgbe_stop_adapter(hw); callout_stop(&adapter->timer); @@ -1022,10 +1025,10 @@ ixgbe_init_locked(struct adapter *adapte if (ixgbe_setup_transmit_structures(adapter)) { device_printf(dev,"Could not setup transmit structures\n"); ixgbe_stop(adapter); - return (ENOMEM); + return; } - ixgbe_init_hw(hw); + ixgbe_reset_hw(hw); ixgbe_initialize_transmit_units(adapter); /* Setup Multicast table */ @@ -1044,7 +1047,7 @@ ixgbe_init_locked(struct adapter *adapte if (ixgbe_setup_receive_structures(adapter)) { device_printf(dev,"Could not setup receive structures\n"); ixgbe_stop(adapter); - return (ENOMEM); + return; } /* Configure RX settings */ @@ -1073,12 +1076,14 @@ ixgbe_init_locked(struct adapter *adapte ifp->if_hwassist = 0; if (ifp->if_capenable & IFCAP_TSO4) ifp->if_hwassist |= CSUM_TSO; - if (ifp->if_capenable & IFCAP_TXCSUM) + if (ifp->if_capenable & IFCAP_TXCSUM) { ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); #if __FreeBSD_version >= 800000 - if (hw->mac.type == ixgbe_mac_82599EB) - ifp->if_hwassist |= CSUM_SCTP; + if (hw->mac.type == ixgbe_mac_82599EB) + ifp->if_hwassist |= CSUM_SCTP; #endif + } + /* Set MTU size */ if (ifp->if_mtu > ETHERMTU) { mhadd = IXGBE_READ_REG(hw, IXGBE_MHADD); @@ -1164,7 +1169,7 @@ ixgbe_init_locked(struct adapter *adapte if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { device_printf(dev, "Unsupported SFP+ module type was detected.\n"); - return (EIO); + return; } } @@ -1181,7 +1186,7 @@ ixgbe_init_locked(struct adapter *adapte ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - return (0); + return; } static void @@ -3632,9 +3637,11 @@ ixgbe_setup_receive_ring(struct rx_ring goto skip_head; /* First the header */ - rxbuf->m_head = m_gethdr(M_DONTWAIT, MT_DATA); - if (rxbuf->m_head == NULL) + rxbuf->m_head = m_gethdr(M_WAITOK, MT_DATA); + if (rxbuf->m_head == NULL) { + error = ENOBUFS; goto fail; + } m_adj(rxbuf->m_head, ETHER_ALIGN); mh = rxbuf->m_head; mh->m_len = mh->m_pkthdr.len = MHLEN; @@ -3652,10 +3659,12 @@ ixgbe_setup_receive_ring(struct rx_ring skip_head: /* Now the payload cluster */ - rxbuf->m_pack = m_getjcl(M_DONTWAIT, MT_DATA, + rxbuf->m_pack = m_getjcl(M_WAITOK, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); - if (rxbuf->m_pack == NULL) + if (rxbuf->m_pack == NULL) { + error = ENOBUFS; goto fail; + } mp = rxbuf->m_pack; mp->m_pkthdr.len = mp->m_len = adapter->rx_mbuf_sz; /* Get the memory mapping */ @@ -4036,16 +4045,16 @@ ixgbe_rxeof(struct ix_queue *que, int co IXGBE_RX_LOCK(rxr); - /* Sync the ring. */ - bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - for (i = rxr->next_to_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; u32 rsc, ptype; u16 hlen, plen, hdr, vtag; bool eop; + /* Sync the ring. */ + bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + cur = &rxr->rx_base[i]; staterr = le32toh(cur->wb.upper.status_error); Modified: head/sys/dev/ixgbe/ixgbe.h ============================================================================== --- head/sys/dev/ixgbe/ixgbe.h Wed Jun 2 23:31:27 2010 (r208761) +++ head/sys/dev/ixgbe/ixgbe.h Thu Jun 3 00:00:45 2010 (r208762) @@ -473,4 +473,17 @@ ixgbe_is_sfp(struct ixgbe_hw *hw) } } +/* Workaround to make 8.0 buildable */ +#if __FreeBSD_version < 800504 +static __inline int +drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + return (1); +#endif + return (!buf_ring_empty(br)); +} +#endif + #endif /* _IXGBE_H_ */ From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 00:25:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 430C41065673; Thu, 3 Jun 2010 00:25:44 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 334998FC17; Thu, 3 Jun 2010 00:25: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 o530Pi0O012340; Thu, 3 Jun 2010 00:25:44 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o530PijR012338; Thu, 3 Jun 2010 00:25:44 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201006030025.o530PijR012338@svn.freebsd.org> From: Alexander Kabaev Date: Thu, 3 Jun 2010 00:25: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: r208763 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 00:25:44 -0000 Author: kan Date: Thu Jun 3 00:25:43 2010 New Revision: 208763 URL: http://svn.freebsd.org/changeset/base/208763 Log: Plug possible memory leak. Found by: Coverity MFC after: 2 weeks Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Thu Jun 3 00:00:45 2010 (r208762) +++ head/libexec/rtld-elf/rtld.c Thu Jun 3 00:25:43 2010 (r208763) @@ -1530,8 +1530,10 @@ load_object(const char *name, const Obj_ close(fd); return obj; } - if (flags & RTLD_LO_NOLOAD) + if (flags & RTLD_LO_NOLOAD) { + free(path); return (NULL); + } /* First use of this object, so we must map it in */ obj = do_load_object(fd, name, path, &sb, flags); From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 02:24:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0016A1065675; Thu, 3 Jun 2010 02:24:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E45D48FC16; Thu, 3 Jun 2010 02:24: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 o532OrH9038392; Thu, 3 Jun 2010 02:24:53 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o532Ordq038390; Thu, 3 Jun 2010 02:24:53 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006030224.o532Ordq038390@svn.freebsd.org> From: Alan Cox Date: Thu, 3 Jun 2010 02:24: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: r208764 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 02:24:54 -0000 Author: alc Date: Thu Jun 3 02:24:53 2010 New Revision: 208764 URL: http://svn.freebsd.org/changeset/base/208764 Log: Maintain the pretense that we support 32KB pages for the sake of the ia64 LINT build. Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Jun 3 00:25:43 2010 (r208763) +++ head/sys/vm/vm_page.c Thu Jun 3 02:24:53 2010 (r208764) @@ -2110,7 +2110,7 @@ vm_page_clear_dirty_mask(vm_page_t m, in void vm_page_set_validclean(vm_page_t m, int base, int size) { - u_int oldvalid; + u_long oldvalid; int endoff, frag, pagebits; VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 03:55:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83A8F106566C; Thu, 3 Jun 2010 03:55:23 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 724AA8FC0A; Thu, 3 Jun 2010 03:55: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 o533tN1t058322; Thu, 3 Jun 2010 03:55:23 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o533tNrY058320; Thu, 3 Jun 2010 03:55:23 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006030355.o533tNrY058320@svn.freebsd.org> From: Alan Cox Date: Thu, 3 Jun 2010 03:55: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: r208765 - head/sys/i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 03:55:23 -0000 Author: alc Date: Thu Jun 3 03:55:22 2010 New Revision: 208765 URL: http://svn.freebsd.org/changeset/base/208765 Log: In the unlikely event that pmap_ts_referenced() demoted five superpage mappings to the same underlying physical page, the calling thread would be left forever pinned to the same processor. MFC after: 3 days Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Thu Jun 3 02:24:53 2010 (r208764) +++ head/sys/i386/i386/pmap.c Thu Jun 3 03:55:22 2010 (r208765) @@ -4540,7 +4540,7 @@ pmap_ts_referenced(vm_page_t m) rtval++; if (rtval > 4) { PMAP_UNLOCK(pmap); - return (rtval); + goto out; } } } @@ -4569,6 +4569,7 @@ pmap_ts_referenced(vm_page_t m) PMAP_UNLOCK(pmap); } while ((pv = pvn) != NULL && pv != pvf); } +out: sched_unpin(); return (rtval); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 04:38:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9799F106566C; Thu, 3 Jun 2010 04:38:07 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 589218FC0A; Thu, 3 Jun 2010 04:38:07 +0000 (UTC) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 4A9C22C2A8E; Wed, 2 Jun 2010 23:38:06 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4cWBr5zj89Rg; Wed, 2 Jun 2010 23:37:58 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 132042C2A81; Wed, 2 Jun 2010 23:37:58 -0500 (CDT) Message-ID: <4C0731A5.7090301@cs.rice.edu> Date: Wed, 02 Jun 2010 23:37:57 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.24 (X11/20100501) MIME-Version: 1.0 To: "C. Jayachandran" References: <201005271005.o4RA5eVu032269@svn.freebsd.org> <4C058145.3000707@cs.rice.edu> <4C05F9BC.40409@cs.rice.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "Jayachandran C." , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Randall Stewart Subject: Re: svn commit: r208589 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 04:38:07 -0000 C. Jayachandran wrote: > On Wed, Jun 2, 2010 at 11:57 AM, Alan Cox wrote: > >> C. Jayachandran wrote: >> >>> On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox wrote: >>> >>> >>>> On 5/27/2010 5:05 AM, Jayachandran C. wrote: >>>> >>>> >>>>> Author: jchandra >>>>> Date: Thu May 27 10:05:40 2010 >>>>> New Revision: 208589 >>>>> URL: http://svn.freebsd.org/changeset/base/208589 >>>>> >>>>> Log: >>>>> Call VM_WAIT in pmap_ptpgzone_allocf() if M_WAITOK is set. >>>>> Removed unused variable. >>>>> >>>>> Approved by: rrs (mentor) >>>>> >>>>> >>>>> >>>>> >>>> I'm afraid that this will work some of the time, but not all of the time. >>>> Specifically, there is no guarantee that any of the available free (or >>>> cached) pages after the VM_WAIT will fall within the range of suitable >>>> physical addresses. Moreover, and perhaps most worrisome, is that this >>>> function could do a lot of spinning. Every time this function sleeps and >>>> a >>>> single page is freed (or cached) by someone else, this function will be >>>> reawakened. With a little bad luck, you could spin indefinitely. >>>> >>>> For essentially this reason, contigmalloc(), kmem_alloc_contig(), and >>>> kmem_alloc_attr() don't use VM_WAIT, but instead a function called >>>> vm_contig_grow_cache(). >>>> >>>> >>> I had seen the vm_contig_grow_cache() usage, but could not use it as >>> it was defined as a static function. >>> >>> I did not want to use contigmalloc()/kmem_alloc_contig() either, >>> because the pages in that memory region are already direct mapped and >>> setting up another mapping is not necessary. The overall idea is to >>> allocate pages in the direct mapped region for the page table entries >>> so that we don't take a TLB exception while accessing page tables >>> (which is costly as MIPS has a software TLB exception handler). >>> >>> Can you suggest the right way to do this? I will make the changes and >>> send a patch for approval. >>> >>> >> I would encourage you to make vm_contig_grow_cache() an extern function and >> use it. (vm/vm_pageout.h is probably the best place for the function >> prototype.) >> > > I'll create a patch for this and related changes in mips/mips/pmap.c > > Great. Thanks! >> If you're interested in taking this a small step further, it would make >> sense to add two parameters to vm_contig_grow_cache() and >> vm_contig_launder(): a "low" and a "high" physical address. >> vm_contig_launder() could then skip pages that are outside the desired >> range. >> > > I am looking at this now, part of the logic which > vm_phys_alloc_contig() uses to check pages address should work here. > Will send out changes for this, if it works out. > > I suspect that you'll just need to add two or three lines to vm_contig_launder(). If something doesn't make sense, just e-mail me. Regards, Alan From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 04:50:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0941106566B; Thu, 3 Jun 2010 04:50:44 +0000 (UTC) (envelope-from c.jayachandran@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 94A7B8FC1F; Thu, 3 Jun 2010 04:50:44 +0000 (UTC) Received: by pvh11 with SMTP id 11so412094pvh.13 for ; Wed, 02 Jun 2010 21:50:44 -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; bh=JPw3JxMrCpgllN0QR1JBvmYYIDjJlMl2FPi487fnGpI=; b=iJLc2VO/qjJXciYDpZRLO9c0LCHWiQgx7IeG2Z7OJAZyL6XPSdykOlbsqASw9jEr5w I7oCj1/T679Ve/hWwzXwonuNA99wDh1+nZzJ6uDj+xZv2BsrjkPbZDPG3WF1WareHRYN u5URxWQ7qnlNWA1DljrYvLCoi+yVVPpIjoaV4= 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; b=SZKRJ23r94duu+b3QvgXF6NjA6Znl0rWUV53EBvcSqVlCVNA2P25dbrLQUlaUDfXuH IAB/tbWNva8xQ0hZ1wVsuB5+31/ClK8wLfkQmJ7Yg1439KmXG7Neu4qtI1/fsWOKe8ND YHwz8ZnggddjrX2qLMjIzWPDMiQ7p7wgJ/i2I= MIME-Version: 1.0 Received: by 10.141.188.4 with SMTP id q4mr7635207rvp.147.1275540643905; Wed, 02 Jun 2010 21:50:43 -0700 (PDT) Received: by 10.141.4.3 with HTTP; Wed, 2 Jun 2010 21:50:43 -0700 (PDT) In-Reply-To: <4C0731A5.7090301@cs.rice.edu> References: <201005271005.o4RA5eVu032269@svn.freebsd.org> <4C058145.3000707@cs.rice.edu> <4C05F9BC.40409@cs.rice.edu> <4C0731A5.7090301@cs.rice.edu> Date: Thu, 3 Jun 2010 10:20:43 +0530 Message-ID: From: "C. Jayachandran" To: Alan Cox Content-Type: multipart/mixed; boundary=000e0cd1aa3efa00ac048818f237 Cc: "Jayachandran C." , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Randall Stewart Subject: Re: svn commit: r208589 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 04:50:45 -0000 --000e0cd1aa3efa00ac048818f237 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Jun 3, 2010 at 10:07 AM, Alan Cox wrote: > C. Jayachandran wrote: >> >> On Wed, Jun 2, 2010 at 11:57 AM, Alan Cox wrote: >> >>> >>> C. Jayachandran wrote: >>> >>>> >>>> On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox wrote: >>>> >>>> >>>>> >>>>> On 5/27/2010 5:05 AM, Jayachandran C. wrote: >>>>> >>>>> >>>>>> >>>>>> Author: jchandra >>>>>> Date: Thu May 27 10:05:40 2010 >>>>>> New Revision: 208589 >>>>>> URL: http://svn.freebsd.org/changeset/base/208589 >>>>>> >>>>>> Log: >>>>>> =A0Call VM_WAIT in pmap_ptpgzone_allocf() if =A0M_WAITOK is set. >>>>>> =A0Removed unused variable. >>>>>> >>>>>> =A0Approved by: rrs (mentor) >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> I'm afraid that this will work some of the time, but not all of the >>>>> time. >>>>> =A0Specifically, there is no guarantee that any of the available free= (or >>>>> cached) pages after the VM_WAIT will fall within the range of suitabl= e >>>>> physical addresses. =A0Moreover, and perhaps most worrisome, is that = this >>>>> function could do a lot of spinning. =A0Every time this function slee= ps >>>>> and >>>>> a >>>>> single page is freed (or cached) by someone else, this function will = be >>>>> reawakened. =A0With a little bad luck, you could spin indefinitely. >>>>> >>>>> For essentially this reason, contigmalloc(), kmem_alloc_contig(), and >>>>> kmem_alloc_attr() don't use VM_WAIT, but instead a function called >>>>> vm_contig_grow_cache(). >>>>> >>>>> >>>> >>>> I had seen the vm_contig_grow_cache() usage, but could not use it as >>>> it was defined as a static function. >>>> >>>> I did not want to use contigmalloc()/kmem_alloc_contig() either, >>>> because the pages in that memory region are already direct mapped and >>>> setting up another mapping is not necessary. The overall idea is to >>>> allocate pages in the direct mapped region for the page table entries >>>> so that we don't take a TLB exception while accessing page tables >>>> (which is costly as MIPS has a software TLB exception handler). >>>> >>>> Can you suggest the right way to do this? I will make the changes and >>>> send a patch for approval. >>>> >>>> >>> >>> I would encourage you to make vm_contig_grow_cache() an extern function >>> and >>> use it. =A0(vm/vm_pageout.h is probably the best place for the function >>> prototype.) >>> >> >> I'll create a patch for this and related changes in mips/mips/pmap.c >> >> > > Great. =A0Thanks! > >>> If you're interested in taking this a small step further, it would make >>> sense to add two parameters to vm_contig_grow_cache() and >>> vm_contig_launder(): a "low" and a "high" physical address. >>> =A0vm_contig_launder() could then skip pages that are outside the desir= ed >>> range. >>> >> >> I am looking at this now, =A0part of the logic which >> vm_phys_alloc_contig() uses to check pages address should work here. >> Will send out changes for this, if it works out. >> >> > > I suspect that you'll just need to add two or three lines to > vm_contig_launder(). =A0If something doesn't make sense, just e-mail me. The current changes I have is attached - still testing it. JC. --000e0cd1aa3efa00ac048818f237 Content-Type: text/x-diff; charset=US-ASCII; name="vm_contig_grow_cache.patch" Content-Disposition: attachment; filename="vm_contig_grow_cache.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g9z3vczo0 SW5kZXg6IHN5cy9taXBzL21pcHMvcG1hcC5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9taXBzL21pcHMv cG1hcC5jCShyZXZpc2lvbiAyMDg3NTMpCisrKyBzeXMvbWlwcy9taXBzL3BtYXAuYwkod29ya2lu ZyBjb3B5KQpAQCAtOTY3LDE5ICs5NjcsMjMgQEAKIHsKIAl2bV9wYWdlX3QgbTsKIAl2bV9wYWRk cl90IHBhZGRyOworCWludCB0cmllczsKIAkKIAlLQVNTRVJUKGJ5dGVzID09IFBBR0VfU0laRSwK IAkJKCJwbWFwX3B0cGd6b25lX2FsbG9jZjogaW52YWxpZCBhbGxvY2F0aW9uIHNpemUgJWQiLCBi eXRlcykpOwogCiAJKmZsYWdzID0gVU1BX1NMQUJfUFJJVjsKLQlmb3IgKDs7KSB7Ci0JCW0gPSB2 bV9waHlzX2FsbG9jX2NvbnRpZygxLCAwLCBNSVBTX0tTRUcwX0xBUkdFU1RfUEhZUywKLQkJICAg IFBBR0VfU0laRSwgUEFHRV9TSVpFKTsKLQkJaWYgKG0gIT0gTlVMTCkKLQkJCWJyZWFrOwotCQlp ZiAoKHdhaXQgJiBNX1dBSVRPSykgPT0gMCkKKwl0cmllcyA9IDA7CityZXRyeToKKwltID0gdm1f cGh5c19hbGxvY19jb250aWcoMSwgMCwgTUlQU19LU0VHMF9MQVJHRVNUX1BIWVMsCisJICAgIFBB R0VfU0laRSwgUEFHRV9TSVpFKTsKKwlpZiAobSA9PSBOVUxMKSB7CisgICAgICAgICAgICAgICAg aWYgKHRyaWVzIDwgKCh3YWl0ICYgTV9OT1dBSVQpICE9IDAgPyAxIDogMykpIHsKKwkJCXZtX2Nv bnRpZ19ncm93X2NhY2hlKHRyaWVzLCAwLCBNSVBTX0tTRUcwX0xBUkdFU1RfUEhZUyk7CisJCQl0 cmllcysrOworCQkJZ290byByZXRyeTsKKwkJfSBlbHNlCiAJCQlyZXR1cm4gKE5VTEwpOwotCQlW TV9XQUlUOwogCX0KIAogCXBhZGRyID0gVk1fUEFHRV9UT19QSFlTKG0pOwpJbmRleDogc3lzL3Zt L3ZtX3BhZ2VvdXQuaAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvdm0vdm1fcGFnZW91dC5oCShyZXZpc2lv biAyMDg3NTMpCisrKyBzeXMvdm0vdm1fcGFnZW91dC5oCSh3b3JraW5nIGNvcHkpCkBAIC0xMDUs NSArMTA1LDYgQEAKIGludCB2bV9wYWdlb3V0X2ZsdXNoKHZtX3BhZ2VfdCAqLCBpbnQsIGludCk7 CiB2b2lkIHZtX3BhZ2VvdXRfb29tKGludCBzaG9ydGFnZSk7CiBib29sZWFuX3Qgdm1fcGFnZW91 dF9wYWdlX2xvY2sodm1fcGFnZV90LCB2bV9wYWdlX3QgKik7Cit2b2lkIHZtX2NvbnRpZ19ncm93 X2NhY2hlKGludCwgdm1fcGFkZHJfdCwgdm1fcGFkZHJfdCk7CiAjZW5kaWYKICNlbmRpZgkvKiBf Vk1fVk1fUEFHRU9VVF9IXyAqLwpJbmRleDogc3lzL3ZtL3ZtX2NvbnRpZy5jCj09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0K LS0tIHN5cy92bS92bV9jb250aWcuYwkocmV2aXNpb24gMjA4NzUzKQorKysgc3lzL3ZtL3ZtX2Nv bnRpZy5jCSh3b3JraW5nIGNvcHkpCkBAIC04Nyw4ICs4Nyw2IEBACiAjaW5jbHVkZSA8dm0vdm1f cGh5cy5oPgogI2luY2x1ZGUgPHZtL3ZtX2V4dGVybi5oPgogCi1zdGF0aWMgdm9pZCB2bV9jb250 aWdfZ3Jvd19jYWNoZShpbnQgdHJpZXMpOwotCiBzdGF0aWMgaW50CiB2bV9jb250aWdfbGF1bmRl cl9wYWdlKHZtX3BhZ2VfdCBtLCB2bV9wYWdlX3QgKm5leHQpCiB7CkBAIC0xNTcsOSArMTU1LDEw IEBACiB9CiAKIHN0YXRpYyBpbnQKLXZtX2NvbnRpZ19sYXVuZGVyKGludCBxdWV1ZSkKK3ZtX2Nv bnRpZ19sYXVuZGVyKGludCBxdWV1ZSwgdm1fcGFkZHJfdCBsb3csIHZtX3BhZGRyX3QgaGlnaCkK IHsKIAl2bV9wYWdlX3QgbSwgbmV4dDsKKwl2bV9wYWRkcl90IHBhOwogCWludCBlcnJvcjsKIAog CVRBSUxRX0ZPUkVBQ0hfU0FGRShtLCAmdm1fcGFnZV9xdWV1ZXNbcXVldWVdLnBsLCBwYWdlcSwg bmV4dCkgewpAQCAtMTY4LDggKzE2NywxMyBAQAogCQlpZiAoKG0tPmZsYWdzICYgUEdfTUFSS0VS KSAhPSAwKQogCQkJY29udGludWU7CiAKKwkJcGEgPSBWTV9QQUdFX1RPX1BIWVMobSk7CisJCWlm IChwYSA8IGxvdyAmJiBwYSArIFBBR0VfU0laRSA+IGhpZ2gpCisJCQljb250aW51ZTsKKwogCQlp ZiAoIXZtX3BhZ2VvdXRfcGFnZV9sb2NrKG0sICZuZXh0KSkKIAkJCWNvbnRpbnVlOworCiAJCUtB U1NFUlQoVk1fUEFHRV9JTlFVRVVFMihtLCBxdWV1ZSksCiAJCSAgICAoInZtX2NvbnRpZ19sYXVu ZGVyOiBwYWdlICVwJ3MgcXVldWUgaXMgbm90ICVkIiwgbSwgcXVldWUpKTsKIAkJZXJyb3IgPSB2 bV9jb250aWdfbGF1bmRlcl9wYWdlKG0sICZuZXh0KTsKQEAgLTIwMSw4ICsyMDUsOCBAQAogLyoK ICAqIEluY3JlYXNlIHRoZSBudW1iZXIgb2YgY2FjaGVkIHBhZ2VzLgogICovCi1zdGF0aWMgdm9p ZAotdm1fY29udGlnX2dyb3dfY2FjaGUoaW50IHRyaWVzKQordm9pZAordm1fY29udGlnX2dyb3df Y2FjaGUoaW50IHRyaWVzLCB2bV9wYWRkcl90IGxvdywgdm1fcGFkZHJfdCBoaWdoKQogewogCWlu dCBhY3RsLCBhY3RtYXgsIGluYWN0bCwgaW5hY3RtYXg7CiAKQEAgLTIxMiwxMSArMjE2LDExIEBA CiAJYWN0bCA9IDA7CiAJYWN0bWF4ID0gdHJpZXMgPCAyID8gMCA6IGNudC52X2FjdGl2ZV9jb3Vu dDsKIGFnYWluOgotCWlmIChpbmFjdGwgPCBpbmFjdG1heCAmJiB2bV9jb250aWdfbGF1bmRlcihQ UV9JTkFDVElWRSkpIHsKKwlpZiAoaW5hY3RsIDwgaW5hY3RtYXggJiYgdm1fY29udGlnX2xhdW5k ZXIoUFFfSU5BQ1RJVkUsIGxvdywgaGlnaCkpIHsKIAkJaW5hY3RsKys7CiAJCWdvdG8gYWdhaW47 CiAJfQotCWlmIChhY3RsIDwgYWN0bWF4ICYmIHZtX2NvbnRpZ19sYXVuZGVyKFBRX0FDVElWRSkp IHsKKwlpZiAoYWN0bCA8IGFjdG1heCAmJiB2bV9jb250aWdfbGF1bmRlcihQUV9BQ1RJVkUsIGxv dywgaGlnaCkpIHsKIAkJYWN0bCsrOwogCQlnb3RvIGFnYWluOwogCX0KQEAgLTI1OSw3ICsyNjMs NyBAQAogCQkJaWYgKHRyaWVzIDwgKChmbGFncyAmIE1fTk9XQUlUKSAhPSAwID8gMSA6IDMpKSB7 CiAJCQkJVk1fT0JKRUNUX1VOTE9DSyhvYmplY3QpOwogCQkJCXZtX21hcF91bmxvY2sobWFwKTsK LQkJCQl2bV9jb250aWdfZ3Jvd19jYWNoZSh0cmllcyk7CisJCQkJdm1fY29udGlnX2dyb3dfY2Fj aGUodHJpZXMsIGxvdywgaGlnaCk7CiAJCQkJdm1fbWFwX2xvY2sobWFwKTsKIAkJCQlWTV9PQkpF Q1RfTE9DSyhvYmplY3QpOwogCQkJCWdvdG8gcmV0cnk7CkBAIC0zNjYsNyArMzcwLDcgQEAKIAlw YWdlcyA9IHZtX3BoeXNfYWxsb2NfY29udGlnKG5wZ3MsIGxvdywgaGlnaCwgYWxpZ25tZW50LCBi b3VuZGFyeSk7CiAJaWYgKHBhZ2VzID09IE5VTEwpIHsKIAkJaWYgKHRyaWVzIDwgKChmbGFncyAm IE1fTk9XQUlUKSAhPSAwID8gMSA6IDMpKSB7Ci0JCQl2bV9jb250aWdfZ3Jvd19jYWNoZSh0cmll cyk7CisJCQl2bV9jb250aWdfZ3Jvd19jYWNoZSh0cmllcywgbG93LCBoaWdoKTsKIAkJCXRyaWVz Kys7CiAJCQlnb3RvIHJldHJ5OwogCQl9Cg== --000e0cd1aa3efa00ac048818f237-- From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 09:29:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F56F106564A; Thu, 3 Jun 2010 09:29:54 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EF798FC29; Thu, 3 Jun 2010 09:29: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 o539TsJZ032174; Thu, 3 Jun 2010 09:29:54 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o539Tsio032172; Thu, 3 Jun 2010 09:29:54 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201006030929.o539Tsio032172@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 3 Jun 2010 09:29: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: r208770 - head/sys/modules/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 09:29:54 -0000 Author: pjd Date: Thu Jun 3 09:29:54 2010 New Revision: 208770 URL: http://svn.freebsd.org/changeset/base/208770 Log: opensolaris_kmem.c is already part of opensolaris.ko which zfs.ko depends on. Reported by: avg MFC after: 3 days Modified: head/sys/modules/zfs/Makefile Modified: head/sys/modules/zfs/Makefile ============================================================================== --- head/sys/modules/zfs/Makefile Thu Jun 3 09:15:52 2010 (r208769) +++ head/sys/modules/zfs/Makefile Thu Jun 3 09:29:54 2010 (r208770) @@ -17,7 +17,6 @@ SRCS+= u8_textprep.c .PATH: ${.CURDIR}/../../cddl/compat/opensolaris/kern SRCS+= opensolaris_acl.c -SRCS+= opensolaris_kmem.c SRCS+= opensolaris_kobj.c SRCS+= opensolaris_kstat.c SRCS+= opensolaris_lookup.c From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 09:54:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1A3C1065672; Thu, 3 Jun 2010 09:54:53 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7C678FC1B; Thu, 3 Jun 2010 09:54: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 o539srGJ037664; Thu, 3 Jun 2010 09:54:53 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o539srvJ037662; Thu, 3 Jun 2010 09:54:53 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201006030954.o539srvJ037662@svn.freebsd.org> From: Attilio Rao Date: Thu, 3 Jun 2010 09:54: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: r208771 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 09:54:54 -0000 Author: attilio Date: Thu Jun 3 09:54:53 2010 New Revision: 208771 URL: http://svn.freebsd.org/changeset/base/208771 Log: [0] Improve wording. [1] Following style for manpages, just do carriage return after a sentence. Sponsored by: Sandvine Incorporated [0] Submitted by: emaste [1] Submitted by: rwatson Modified: head/share/man/man4/io.4 Modified: head/share/man/man4/io.4 ============================================================================== --- head/share/man/man4/io.4 Thu Jun 3 09:29:54 2010 (r208770) +++ head/share/man/man4/io.4 Thu Jun 3 09:54:53 2010 (r208771) @@ -72,22 +72,25 @@ all of them. The .Dv IODEV_PIO is used by all the architectures in order to request that an I/O operation -be performed. It takes a 'struct iodev_pio_req' argument -that must be previously setup. +be performed. +It takes a 'struct iodev_pio_req' argument that must be previously setup. .Pp The .Fa access -member specifies the type of operation requested. It may be: +member specifies the type of operation requested. +It may be: .Bl -tag -width IODEV_PIO_WRITE .It Dv IODEV_PIO_READ -The operation is an "in" type. A value will be read from the specified port +The operation is an "in" type. +A value will be read from the specified port (retrieved from the .Fa port member) and the result will be stored in the .Fa val member. .It Dv IODEV_PIO_WRITE -The operation is a "out" type. The value will be fetched from the +The operation is a "out" type. +The value will be fetched from the .Fa val member and will be written out to the specified port (defined as the .Fa port @@ -105,13 +108,14 @@ the kernel enforces that only the super- .Sh LEGACY The .Pa /dev/io -interface used to be very i386 specific and worked differently. The initial -implementation, in fact, simply raised the +interface used to be very i386 specific and worked differently. +The initial implementation simply raised the .Em IOPL of the current thread when .Xr open 2 -was called on the file. This behaviour is retained in the current -implementation as legacy support for both i386 and amd64 architectures. +was called on the device. +This behaviour is retained in the current implementation as legacy +support for both i386 and amd64 architectures. .Sh SEE ALSO .Xr close 2 , .Xr i386_get_ioperm 2 , From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 10:11:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A4691065674; Thu, 3 Jun 2010 10:11:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A4E88FC1C; Thu, 3 Jun 2010 10:11: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 o53ABk2X041468; Thu, 3 Jun 2010 10:11:46 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53ABk0x041466; Thu, 3 Jun 2010 10:11:46 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006031011.o53ABk0x041466@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 3 Jun 2010 10:11: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: r208772 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 10:11:46 -0000 Author: kib Date: Thu Jun 3 10:11:45 2010 New Revision: 208772 URL: http://svn.freebsd.org/changeset/base/208772 Log: Add assertion and comment in vm_page_flag_set() describing the expectations when the PG_WRITEABLE flag is set. Reviewed by: alc Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Jun 3 09:54:53 2010 (r208771) +++ head/sys/vm/vm_page.c Thu Jun 3 10:11:45 2010 (r208772) @@ -486,6 +486,14 @@ vm_page_flag_set(vm_page_t m, unsigned s { mtx_assert(&vm_page_queue_mtx, MA_OWNED); + /* + * For a managed page, the PG_WRITEABLE flag can be set only if + * the page is VPO_BUSY. Currently this flag is only set by + * pmap_enter(). + */ + KASSERT((bits & PG_WRITEABLE) == 0 || + (m->flags & (PG_UNMANAGED | PG_FICTITIOUS)) != 0 || + (m->oflags & VPO_BUSY) != 0, ("PG_WRITEABLE and !VPO_BUSY")); m->flags |= bits; } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 10:20:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 482331065672; Thu, 3 Jun 2010 10:20:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37DFA8FC15; Thu, 3 Jun 2010 10:20: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 o53AK9Od043311; Thu, 3 Jun 2010 10:20:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53AK9uM043309; Thu, 3 Jun 2010 10:20:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006031020.o53AK9uM043309@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 3 Jun 2010 10:20: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: r208773 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 10:20:09 -0000 Author: kib Date: Thu Jun 3 10:20:08 2010 New Revision: 208773 URL: http://svn.freebsd.org/changeset/base/208773 Log: Sometimes vnodes share the lock despite being different vnodes on different mount points, e.g. the nullfs vnode and the covered vnode from the lower filesystem. In this case, existing assertion in vop_rename_pre() may be triggered. Check for vnode locks equiality instead of the vnodes itself to not trip over the situation. Submitted by: Mikolaj Golub Tested by: pho MFC after: 2 weeks Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Jun 3 10:11:45 2010 (r208772) +++ head/sys/kern/vfs_subr.c Thu Jun 3 10:20:08 2010 (r208773) @@ -3793,9 +3793,10 @@ vop_rename_pre(void *ap) ASSERT_VI_UNLOCKED(a->a_fdvp, "VOP_RENAME"); /* Check the source (from). */ - if (a->a_tdvp != a->a_fdvp && a->a_tvp != a->a_fdvp) + if (a->a_tdvp->v_vnlock != a->a_fdvp->v_vnlock && + (a->a_tvp == NULL || a->a_tvp->v_vnlock != a->a_fdvp->v_vnlock)) ASSERT_VOP_UNLOCKED(a->a_fdvp, "vop_rename: fdvp locked"); - if (a->a_tvp != a->a_fvp) + if (a->a_tvp == NULL || a->a_tvp->v_vnlock != a->a_fvp->v_vnlock) ASSERT_VOP_UNLOCKED(a->a_fvp, "vop_rename: fvp locked"); /* Check the target. */ From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 10:24:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A25FC1065673; Thu, 3 Jun 2010 10:24:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91DDA8FC0A; Thu, 3 Jun 2010 10:24: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 o53AOrGE044396; Thu, 3 Jun 2010 10:24:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53AOr0g044394; Thu, 3 Jun 2010 10:24:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006031024.o53AOr0g044394@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 3 Jun 2010 10:24: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: r208774 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 10:24:53 -0000 Author: kib Date: Thu Jun 3 10:24:53 2010 New Revision: 208774 URL: http://svn.freebsd.org/changeset/base/208774 Log: Extend the scope of the lock on the quota file vnode in quotaon() to cover the initial read by dqopen(). Assert that vnode is locked in dqopen(). Remove VFS_LOCK_GIANT() from dqopen(), since quotaon() keeps Giant locked if needed around the call. Modified: head/sys/ufs/ufs/ufs_quota.c Modified: head/sys/ufs/ufs/ufs_quota.c ============================================================================== --- head/sys/ufs/ufs/ufs_quota.c Thu Jun 3 10:20:08 2010 (r208773) +++ head/sys/ufs/ufs/ufs_quota.c Thu Jun 3 10:24:53 2010 (r208774) @@ -522,8 +522,8 @@ quotaon(struct thread *td, struct mount vfslocked = NDHASGIANT(&nd); NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; - VOP_UNLOCK(vp, 0); if (vp->v_type != VREG) { + VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); return (EACCES); @@ -532,6 +532,7 @@ quotaon(struct thread *td, struct mount UFS_LOCK(ump); if ((ump->um_qflags[type] & (QTF_OPENING|QTF_CLOSING)) != 0) { UFS_UNLOCK(ump); + VOP_UNLOCK(vp, 0); (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); VFS_UNLOCK_GIANT(vfslocked); return (EALREADY); @@ -539,6 +540,7 @@ quotaon(struct thread *td, struct mount ump->um_qflags[type] |= QTF_OPENING|QTF_CLOSING; UFS_UNLOCK(ump); if ((error = dqopen(vp, ump, type)) != 0) { + VOP_UNLOCK(vp, 0); UFS_LOCK(ump); ump->um_qflags[type] &= ~(QTF_OPENING|QTF_CLOSING); UFS_UNLOCK(ump); @@ -546,6 +548,7 @@ quotaon(struct thread *td, struct mount VFS_UNLOCK_GIANT(vfslocked); return (error); } + VOP_UNLOCK(vp, 0); MNT_ILOCK(mp); mp->mnt_flag |= MNT_QUOTA; MNT_IUNLOCK(mp); @@ -1169,8 +1172,9 @@ dqopen(struct vnode *vp, struct ufsmount struct dqhdr64 dqh; struct iovec aiov; struct uio auio; - int error, vfslocked; + int error; + ASSERT_VOP_LOCKED(vp, "dqopen"); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; aiov.iov_base = &dqh; @@ -1180,9 +1184,7 @@ dqopen(struct vnode *vp, struct ufsmount auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_READ; auio.uio_td = (struct thread *)0; - vfslocked = VFS_LOCK_GIANT(vp->v_mount); error = VOP_READ(vp, &auio, 0, ump->um_cred[type]); - VFS_UNLOCK_GIANT(vfslocked); if (error != 0) return (error); From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 11:08:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 056091065673; Thu, 3 Jun 2010 11:08:47 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E868F8FC1B; Thu, 3 Jun 2010 11:08: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 o53B8ktl060626; Thu, 3 Jun 2010 11:08:46 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53B8k1J060624; Thu, 3 Jun 2010 11:08:46 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201006031108.o53B8k1J060624@svn.freebsd.org> From: Martin Matuska Date: Thu, 3 Jun 2010 11:08: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: r208775 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 11:08:47 -0000 Author: mm Date: Thu Jun 3 11:08:46 2010 New Revision: 208775 URL: http://svn.freebsd.org/changeset/base/208775 Log: Fix freeing space after deleting large files with holes. OpenSolaris onnv revision: 9950:78fc41aa9bc5 Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID 6792701) MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jun 3 10:24:53 2010 (r208774) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jun 3 11:08:46 2010 (r208775) @@ -371,56 +371,51 @@ dmu_prefetch(objset_t *os, uint64_t obje dnode_rele(dn, FTAG); } +/* + * Get the next "chunk" of file data to free. We traverse the file from + * the end so that the file gets shorter over time (if we crashes in the + * middle, this will leave us in a better state). We find allocated file + * data by simply searching the allocated level 1 indirects. + */ static int -get_next_chunk(dnode_t *dn, uint64_t *offset, uint64_t limit) +get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t limit) { - uint64_t len = *offset - limit; - uint64_t chunk_len = dn->dn_datablksz * DMU_MAX_DELETEBLKCNT; - uint64_t subchunk = + uint64_t len = *start - limit; + uint64_t blkcnt = 0; + uint64_t maxblks = DMU_MAX_ACCESS / (1ULL << (dn->dn_indblkshift + 1)); + uint64_t iblkrange = dn->dn_datablksz * EPB(dn->dn_indblkshift, SPA_BLKPTRSHIFT); - ASSERT(limit <= *offset); + ASSERT(limit <= *start); - if (len <= chunk_len) { - *offset = limit; + if (len <= iblkrange * maxblks) { + *start = limit; return (0); } + ASSERT(ISP2(iblkrange)); - ASSERT(ISP2(subchunk)); - - while (*offset > limit) { - uint64_t initial_offset = P2ROUNDUP(*offset, subchunk); - uint64_t delta; + while (*start > limit && blkcnt < maxblks) { int err; - /* skip over allocated data */ + /* find next allocated L1 indirect */ err = dnode_next_offset(dn, - DNODE_FIND_HOLE|DNODE_FIND_BACKWARDS, offset, 1, 1, 0); - if (err == ESRCH) - *offset = limit; - else if (err) - return (err); + DNODE_FIND_BACKWARDS, start, 2, 1, 0); - ASSERT3U(*offset, <=, initial_offset); - *offset = P2ALIGN(*offset, subchunk); - delta = initial_offset - *offset; - if (delta >= chunk_len) { - *offset += delta - chunk_len; + /* if there are no more, then we are done */ + if (err == ESRCH) { + *start = limit; return (0); - } - chunk_len -= delta; - - /* skip over unallocated data */ - err = dnode_next_offset(dn, - DNODE_FIND_BACKWARDS, offset, 1, 1, 0); - if (err == ESRCH) - *offset = limit; - else if (err) + } else if (err) { return (err); + } + blkcnt += 1; - if (*offset < limit) - *offset = limit; - ASSERT3U(*offset, <, initial_offset); + /* reset offset to end of "next" block back */ + *start = P2ALIGN(*start, iblkrange); + if (*start <= limit) + *start = limit; + else + *start -= 1; } return (0); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Thu Jun 3 10:24:53 2010 (r208774) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Thu Jun 3 11:08:46 2010 (r208775) @@ -1239,6 +1239,22 @@ dnode_willuse_space(dnode_t *dn, int64_t dmu_tx_willuse_space(tx, space); } +/* + * This function scans a block at the indicated "level" looking for + * a hole or data (depending on 'flags'). If level > 0, then we are + * scanning an indirect block looking at its pointers. If level == 0, + * then we are looking at a block of dnodes. If we don't find what we + * are looking for in the block, we return ESRCH. Otherwise, return + * with *offset pointing to the beginning (if searching forwards) or + * end (if searching backwards) of the range covered by the block + * pointer we matched on (or dnode). + * + * The basic search algorithm used below by dnode_next_offset() is to + * use this function to search up the block tree (widen the search) until + * we find something (i.e., we don't return ESRCH) and then search back + * down the tree (narrow the search) until we reach our original search + * level. + */ static int dnode_next_offset_level(dnode_t *dn, int flags, uint64_t *offset, int lvl, uint64_t blkfill, uint64_t txg) @@ -1318,6 +1334,7 @@ dnode_next_offset_level(dnode_t *dn, int error = ESRCH; } else { blkptr_t *bp = data; + uint64_t start = *offset; span = (lvl - 1) * epbs + dn->dn_datablkshift; minfill = 0; maxfill = blkfill << ((lvl - 1) * epbs); @@ -1327,18 +1344,25 @@ dnode_next_offset_level(dnode_t *dn, int else minfill++; - for (i = (*offset >> span) & ((1ULL << epbs) - 1); + *offset = *offset >> span; + for (i = BF64_GET(*offset, 0, epbs); i >= 0 && i < epb; i += inc) { if (bp[i].blk_fill >= minfill && bp[i].blk_fill <= maxfill && (hole || bp[i].blk_birth > txg)) break; - if (inc < 0 && *offset < (1ULL << span)) - *offset = 0; - else - *offset += (1ULL << span) * inc; + if (inc > 0 || *offset > 0) + *offset += inc; + } + *offset = *offset << span; + if (inc < 0) { + /* traversing backwards; position offset at the end */ + ASSERT3U(*offset, <=, start); + *offset = MIN(*offset + (1ULL << span) - 1, start); + } else if (*offset < start) { + *offset = start; } - if (i < 0 || i == epb) + if (i < 0 || i >= epb) error = ESRCH; } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 11:21:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8D6E1065678; Thu, 3 Jun 2010 11:21:51 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id 5FFD48FC19; Thu, 3 Jun 2010 11:21:51 +0000 (UTC) Received: from localhost (unknown [213.17.239.109]) by smtp.semihalf.com (Postfix) with ESMTP id 6F2B5C42DB; Thu, 3 Jun 2010 13:26:49 +0200 (CEST) X-Virus-Scanned: by amavisd-new at semihalf.com Received: from smtp.semihalf.com ([213.17.239.109]) by localhost (smtp.semihalf.com [213.17.239.109]) (amavisd-new, port 10024) with ESMTP id oN0ddBEYAckx; Thu, 3 Jun 2010 13:26:49 +0200 (CEST) Received: from [192.168.133.14] (nat3-133.ghnet.pl [91.150.222.133]) by smtp.semihalf.com (Postfix) with ESMTPSA id E5D22C42D5; Thu, 3 Jun 2010 13:26:48 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: Rafal Jaworowski In-Reply-To: <4C06A9C3.8070902@FreeBSD.org> Date: Thu, 3 Jun 2010 13:21:49 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201006021717.o52HHjfW017538@svn.freebsd.org> <4C06A9C3.8070902@FreeBSD.org> To: Doug Barton X-Mailer: Apple Mail (2.1078) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r208747 - head/sys/dev/fdt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 11:21:51 -0000 On 2010-06-02, at 20:58, Doug Barton wrote: > On 06/02/10 10:17, Rafal Jaworowski wrote: >> o simplebus(4) - bus driver representing ePAPR >=20 > Do we write on it with eINK? Hm, it's been eAPPROVED already = (http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf), = but maybe with the next update or so.. Rafal From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 12:09:02 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 782571065677; Thu, 3 Jun 2010 12:09:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4ECA08FC0A; Thu, 3 Jun 2010 12:09: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 o53C92IU073792; Thu, 3 Jun 2010 12:09:02 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53C92o7073790; Thu, 3 Jun 2010 12:09:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201006031209.o53C92o7073790@svn.freebsd.org> From: Marius Strobl Date: Thu, 3 Jun 2010 12:09: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: r208776 - head/sys/dev/cas X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 12:09:02 -0000 Author: marius Date: Thu Jun 3 12:09:02 2010 New Revision: 208776 URL: http://svn.freebsd.org/changeset/base/208776 Log: Avoid possible NULL-dereferences. Found with: Coverity Prevent(tm) CID: 3428 MFC after: 3 days Modified: head/sys/dev/cas/if_cas.c Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Thu Jun 3 11:08:46 2010 (r208775) +++ head/sys/dev/cas/if_cas.c Thu Jun 3 12:09:02 2010 (r208776) @@ -1787,6 +1787,7 @@ cas_rint(struct cas_softc *sc) } } idx2 = 0; + m2 = NULL; rxds2 = NULL; if ((word1 & CAS_RC1_SPLIT_PKT) != 0) { KASSERT((word1 & CAS_RC1_RELEASE_NEXT) != 0, @@ -1799,32 +1800,39 @@ cas_rint(struct cas_softc *sc) __func__, idx2); #endif rxds2 = &sc->sc_rxdsoft[idx2]; - MGET(m2, M_DONTWAIT, MT_DATA); - if (m2 != NULL) { - refcount_acquire( - &rxds2->rxds_refcount); - m2->m_len = len - m->m_len; - bus_dmamap_sync(sc->sc_rdmatag, - rxds2->rxds_dmamap, - BUS_DMASYNC_POSTREAD); + if (m != NULL) { + MGET(m2, M_DONTWAIT, MT_DATA); + if (m2 != NULL) { + refcount_acquire( + &rxds2->rxds_refcount); + m2->m_len = len - m->m_len; + bus_dmamap_sync( + sc->sc_rdmatag, + rxds2->rxds_dmamap, + BUS_DMASYNC_POSTREAD); #if __FreeBSD_version < 800016 - MEXTADD(m2, (caddr_t)rxds2->rxds_buf, - m2->m_len, cas_free, rxds2, - M_RDONLY, EXT_NET_DRV); + MEXTADD(m2, + (caddr_t)rxds2->rxds_buf, + m2->m_len, cas_free, + rxds2, M_RDONLY, + EXT_NET_DRV); #else - MEXTADD(m2, (caddr_t)rxds2->rxds_buf, - m2->m_len, cas_free, - sc, (void *)(uintptr_t)idx2, - M_RDONLY, EXT_NET_DRV); + MEXTADD(m2, + (caddr_t)rxds2->rxds_buf, + m2->m_len, cas_free, sc, + (void *)(uintptr_t)idx2, + M_RDONLY, EXT_NET_DRV); #endif - if ((m2->m_flags & M_EXT) == 0) { - m_freem(m2); - m2 = NULL; + if ((m2->m_flags & M_EXT) == + 0) { + m_freem(m2); + m2 = NULL; + } } } if (m2 != NULL) m->m_next = m2; - else { + else if (m != NULL) { m_freem(m); m = NULL; } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 12:42:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00B771065673; Thu, 3 Jun 2010 12:42:40 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id ABD448FC0A; Thu, 3 Jun 2010 12:42:38 +0000 (UTC) Received: by pxi7 with SMTP id 7so20909pxi.13 for ; Thu, 03 Jun 2010 05:42:38 -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; bh=hCm8z02EbvNBK1aSCIM3n1bF6yUyfhpUCTcJS5u3IfQ=; b=Ic6Jrq3s/uozsm44ubBxfWk12AKDMbfCG7gkWJMtiwzf6mJMrp4EuWRT0Cm4GTfcbi 76d0Ne3JooDHKQTRO1UBtvqctcNRvxj/oPLA3CHmA+pb6r+bbYPBZ8JbxDehvDU+xThv aN/yttHpTI+XeawTWbUR4zixorPk/1VQRLij8= 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; b=aUxMBexCqTJUUKJN8Pj/GIepXJb9PjidSWwXD6Kz9GXKEf/ysfQI3jHiJR3vfxMgyt rBEg30zgz6pseVwZh9KrsBwvVADG7up/tD2M64e8RnheH3clJG3wkWXG3DiDe3AfB1pR RKKhWur95CcHokjuY0aICQDwy+6M/rwGi3Ct8= MIME-Version: 1.0 Received: by 10.141.105.21 with SMTP id h21mr8089726rvm.160.1275568958140; Thu, 03 Jun 2010 05:42:38 -0700 (PDT) Received: by 10.141.4.3 with HTTP; Thu, 3 Jun 2010 05:42:37 -0700 (PDT) In-Reply-To: References: <201005271005.o4RA5eVu032269@svn.freebsd.org> <4C058145.3000707@cs.rice.edu> <4C05F9BC.40409@cs.rice.edu> <4C0731A5.7090301@cs.rice.edu> Date: Thu, 3 Jun 2010 18:12:37 +0530 Message-ID: From: "C. Jayachandran" To: Alan Cox Content-Type: multipart/mixed; boundary=000e0cd13bbaa2f17b04881f8a67 Cc: src-committers@freebsd.org, "Jayachandran C." , svn-src-all@freebsd.org, Randall Stewart , Konstantin Belousov , svn-src-head@freebsd.org Subject: Re: svn commit: r208589 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 12:42:40 -0000 --000e0cd13bbaa2f17b04881f8a67 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Jun 3, 2010 at 10:20 AM, C. Jayachandran wrote: > On Thu, Jun 3, 2010 at 10:07 AM, Alan Cox wrote: >> C. Jayachandran wrote: >>> >>> On Wed, Jun 2, 2010 at 11:57 AM, Alan Cox wrote: >>> >>>> >>>> C. Jayachandran wrote: >>>> >>>>> >>>>> On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox wrote: >>>>> >>>>> >>>>>> >>>>>> On 5/27/2010 5:05 AM, Jayachandran C. wrote: >>>>>> >>>>>> >>>>>>> >>>>>>> Author: jchandra >>>>>>> Date: Thu May 27 10:05:40 2010 >>>>>>> New Revision: 208589 >>>>>>> URL: http://svn.freebsd.org/changeset/base/208589 >>>>>>> >>>>>>> Log: >>>>>>> =A0Call VM_WAIT in pmap_ptpgzone_allocf() if =A0M_WAITOK is set. >>>>>>> =A0Removed unused variable. >>>>>>> >>>>>>> =A0Approved by: rrs (mentor) >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> I'm afraid that this will work some of the time, but not all of the >>>>>> time. >>>>>> =A0Specifically, there is no guarantee that any of the available fre= e (or >>>>>> cached) pages after the VM_WAIT will fall within the range of suitab= le >>>>>> physical addresses. =A0Moreover, and perhaps most worrisome, is that= this >>>>>> function could do a lot of spinning. =A0Every time this function sle= eps >>>>>> and >>>>>> a >>>>>> single page is freed (or cached) by someone else, this function will= be >>>>>> reawakened. =A0With a little bad luck, you could spin indefinitely. >>>>>> >>>>>> For essentially this reason, contigmalloc(), kmem_alloc_contig(), an= d >>>>>> kmem_alloc_attr() don't use VM_WAIT, but instead a function called >>>>>> vm_contig_grow_cache(). >>>>>> >>>>>> >>>>> >>>>> I had seen the vm_contig_grow_cache() usage, but could not use it as >>>>> it was defined as a static function. >>>>> >>>>> I did not want to use contigmalloc()/kmem_alloc_contig() either, >>>>> because the pages in that memory region are already direct mapped and >>>>> setting up another mapping is not necessary. The overall idea is to >>>>> allocate pages in the direct mapped region for the page table entries >>>>> so that we don't take a TLB exception while accessing page tables >>>>> (which is costly as MIPS has a software TLB exception handler). >>>>> >>>>> Can you suggest the right way to do this? I will make the changes and >>>>> send a patch for approval. >>>>> >>>>> >>>> >>>> I would encourage you to make vm_contig_grow_cache() an extern functio= n >>>> and >>>> use it. =A0(vm/vm_pageout.h is probably the best place for the functio= n >>>> prototype.) >>>> >>> >>> I'll create a patch for this and related changes in mips/mips/pmap.c >>> >>> >> >> Great. =A0Thanks! >> >>>> If you're interested in taking this a small step further, it would mak= e >>>> sense to add two parameters to vm_contig_grow_cache() and >>>> vm_contig_launder(): a "low" and a "high" physical address. >>>> =A0vm_contig_launder() could then skip pages that are outside the desi= red >>>> range. >>>> >>> >>> I am looking at this now, =A0part of the logic which >>> vm_phys_alloc_contig() uses to check pages address should work here. >>> Will send out changes for this, if it works out. >>> >>> >> >> I suspect that you'll just need to add two or three lines to >> vm_contig_launder(). =A0If something doesn't make sense, just e-mail me. > > The current changes I have is attached - still testing it. I've attached the patch for review, but I was not able trigger the condition in which vm_contig_grow_cache() is called during testing so far. But if you are okay with the patch I can commit it. Thanks, JC. --000e0cd13bbaa2f17b04881f8a67 Content-Type: text/plain; charset=US-ASCII; name="vm_contig_grow_cache.patch" Content-Disposition: attachment; filename="vm_contig_grow_cache.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_g9zkrsvk1 SW5kZXg6IHN5cy9taXBzL21pcHMvcG1hcC5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIHN5cy9taXBzL21pcHMv cG1hcC5jCShyZXZpc2lvbiAyMDg3NTMpCisrKyBzeXMvbWlwcy9taXBzL3BtYXAuYwkod29ya2lu ZyBjb3B5KQpAQCAtOTY3LDE5ICs5NjcsMjMgQEAKIHsKIAl2bV9wYWdlX3QgbTsKIAl2bV9wYWRk cl90IHBhZGRyOworCWludCB0cmllczsKIAkKIAlLQVNTRVJUKGJ5dGVzID09IFBBR0VfU0laRSwK IAkJKCJwbWFwX3B0cGd6b25lX2FsbG9jZjogaW52YWxpZCBhbGxvY2F0aW9uIHNpemUgJWQiLCBi eXRlcykpOwogCiAJKmZsYWdzID0gVU1BX1NMQUJfUFJJVjsKLQlmb3IgKDs7KSB7Ci0JCW0gPSB2 bV9waHlzX2FsbG9jX2NvbnRpZygxLCAwLCBNSVBTX0tTRUcwX0xBUkdFU1RfUEhZUywKLQkJICAg IFBBR0VfU0laRSwgUEFHRV9TSVpFKTsKLQkJaWYgKG0gIT0gTlVMTCkKLQkJCWJyZWFrOwotCQlp ZiAoKHdhaXQgJiBNX1dBSVRPSykgPT0gMCkKKwl0cmllcyA9IDA7CityZXRyeToKKwltID0gdm1f cGh5c19hbGxvY19jb250aWcoMSwgMCwgTUlQU19LU0VHMF9MQVJHRVNUX1BIWVMsCisJICAgIFBB R0VfU0laRSwgUEFHRV9TSVpFKTsKKwlpZiAobSA9PSBOVUxMKSB7CisgICAgICAgICAgICAgICAg aWYgKHRyaWVzIDwgKCh3YWl0ICYgTV9OT1dBSVQpICE9IDAgPyAxIDogMykpIHsKKwkJCXZtX2Nv bnRpZ19ncm93X2NhY2hlKHRyaWVzLCAwLCBNSVBTX0tTRUcwX0xBUkdFU1RfUEhZUyk7CisJCQl0 cmllcysrOworCQkJZ290byByZXRyeTsKKwkJfSBlbHNlCiAJCQlyZXR1cm4gKE5VTEwpOwotCQlW TV9XQUlUOwogCX0KIAogCXBhZGRyID0gVk1fUEFHRV9UT19QSFlTKG0pOwpJbmRleDogc3lzL3Zt L3ZtX3BhZ2VvdXQuaAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzeXMvdm0vdm1fcGFnZW91dC5oCShyZXZpc2lv biAyMDg3NTMpCisrKyBzeXMvdm0vdm1fcGFnZW91dC5oCSh3b3JraW5nIGNvcHkpCkBAIC0xMDUs NSArMTA1LDYgQEAKIGludCB2bV9wYWdlb3V0X2ZsdXNoKHZtX3BhZ2VfdCAqLCBpbnQsIGludCk7 CiB2b2lkIHZtX3BhZ2VvdXRfb29tKGludCBzaG9ydGFnZSk7CiBib29sZWFuX3Qgdm1fcGFnZW91 dF9wYWdlX2xvY2sodm1fcGFnZV90LCB2bV9wYWdlX3QgKik7Cit2b2lkIHZtX2NvbnRpZ19ncm93 X2NhY2hlKGludCwgdm1fcGFkZHJfdCwgdm1fcGFkZHJfdCk7CiAjZW5kaWYKICNlbmRpZgkvKiBf Vk1fVk1fUEFHRU9VVF9IXyAqLwpJbmRleDogc3lzL3ZtL3ZtX2NvbnRpZy5jCj09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0K LS0tIHN5cy92bS92bV9jb250aWcuYwkocmV2aXNpb24gMjA4NzUzKQorKysgc3lzL3ZtL3ZtX2Nv bnRpZy5jCSh3b3JraW5nIGNvcHkpCkBAIC04Nyw4ICs4Nyw2IEBACiAjaW5jbHVkZSA8dm0vdm1f cGh5cy5oPgogI2luY2x1ZGUgPHZtL3ZtX2V4dGVybi5oPgogCi1zdGF0aWMgdm9pZCB2bV9jb250 aWdfZ3Jvd19jYWNoZShpbnQgdHJpZXMpOwotCiBzdGF0aWMgaW50CiB2bV9jb250aWdfbGF1bmRl cl9wYWdlKHZtX3BhZ2VfdCBtLCB2bV9wYWdlX3QgKm5leHQpCiB7CkBAIC0xNTcsOSArMTU1LDEw IEBACiB9CiAKIHN0YXRpYyBpbnQKLXZtX2NvbnRpZ19sYXVuZGVyKGludCBxdWV1ZSkKK3ZtX2Nv bnRpZ19sYXVuZGVyKGludCBxdWV1ZSwgdm1fcGFkZHJfdCBsb3csIHZtX3BhZGRyX3QgaGlnaCkK IHsKIAl2bV9wYWdlX3QgbSwgbmV4dDsKKwl2bV9wYWRkcl90IHBhOwogCWludCBlcnJvcjsKIAog CVRBSUxRX0ZPUkVBQ0hfU0FGRShtLCAmdm1fcGFnZV9xdWV1ZXNbcXVldWVdLnBsLCBwYWdlcSwg bmV4dCkgewpAQCAtMTY4LDYgKzE2NywxMCBAQAogCQlpZiAoKG0tPmZsYWdzICYgUEdfTUFSS0VS KSAhPSAwKQogCQkJY29udGludWU7CiAKKwkJcGEgPSBWTV9QQUdFX1RPX1BIWVMobSk7CisJCWlm IChwYSA8IGxvdyB8fCBwYSArIFBBR0VfU0laRSA+IGhpZ2gpCisJCQljb250aW51ZTsKKwogCQlp ZiAoIXZtX3BhZ2VvdXRfcGFnZV9sb2NrKG0sICZuZXh0KSkKIAkJCWNvbnRpbnVlOwogCQlLQVNT RVJUKFZNX1BBR0VfSU5RVUVVRTIobSwgcXVldWUpLApAQCAtMjAxLDggKzIwNCw4IEBACiAvKgog ICogSW5jcmVhc2UgdGhlIG51bWJlciBvZiBjYWNoZWQgcGFnZXMuCiAgKi8KLXN0YXRpYyB2b2lk Ci12bV9jb250aWdfZ3Jvd19jYWNoZShpbnQgdHJpZXMpCit2b2lkCit2bV9jb250aWdfZ3Jvd19j YWNoZShpbnQgdHJpZXMsIHZtX3BhZGRyX3QgbG93LCB2bV9wYWRkcl90IGhpZ2gpCiB7CiAJaW50 IGFjdGwsIGFjdG1heCwgaW5hY3RsLCBpbmFjdG1heDsKIApAQCAtMjEyLDExICsyMTUsMTEgQEAK IAlhY3RsID0gMDsKIAlhY3RtYXggPSB0cmllcyA8IDIgPyAwIDogY250LnZfYWN0aXZlX2NvdW50 OwogYWdhaW46Ci0JaWYgKGluYWN0bCA8IGluYWN0bWF4ICYmIHZtX2NvbnRpZ19sYXVuZGVyKFBR X0lOQUNUSVZFKSkgeworCWlmIChpbmFjdGwgPCBpbmFjdG1heCAmJiB2bV9jb250aWdfbGF1bmRl cihQUV9JTkFDVElWRSwgbG93LCBoaWdoKSkgewogCQlpbmFjdGwrKzsKIAkJZ290byBhZ2FpbjsK IAl9Ci0JaWYgKGFjdGwgPCBhY3RtYXggJiYgdm1fY29udGlnX2xhdW5kZXIoUFFfQUNUSVZFKSkg eworCWlmIChhY3RsIDwgYWN0bWF4ICYmIHZtX2NvbnRpZ19sYXVuZGVyKFBRX0FDVElWRSwgbG93 LCBoaWdoKSkgewogCQlhY3RsKys7CiAJCWdvdG8gYWdhaW47CiAJfQpAQCAtMjU5LDcgKzI2Miw3 IEBACiAJCQlpZiAodHJpZXMgPCAoKGZsYWdzICYgTV9OT1dBSVQpICE9IDAgPyAxIDogMykpIHsK IAkJCQlWTV9PQkpFQ1RfVU5MT0NLKG9iamVjdCk7CiAJCQkJdm1fbWFwX3VubG9jayhtYXApOwot CQkJCXZtX2NvbnRpZ19ncm93X2NhY2hlKHRyaWVzKTsKKwkJCQl2bV9jb250aWdfZ3Jvd19jYWNo ZSh0cmllcywgbG93LCBoaWdoKTsKIAkJCQl2bV9tYXBfbG9jayhtYXApOwogCQkJCVZNX09CSkVD VF9MT0NLKG9iamVjdCk7CiAJCQkJZ290byByZXRyeTsKQEAgLTM2Niw3ICszNjksNyBAQAogCXBh Z2VzID0gdm1fcGh5c19hbGxvY19jb250aWcobnBncywgbG93LCBoaWdoLCBhbGlnbm1lbnQsIGJv dW5kYXJ5KTsKIAlpZiAocGFnZXMgPT0gTlVMTCkgewogCQlpZiAodHJpZXMgPCAoKGZsYWdzICYg TV9OT1dBSVQpICE9IDAgPyAxIDogMykpIHsKLQkJCXZtX2NvbnRpZ19ncm93X2NhY2hlKHRyaWVz KTsKKwkJCXZtX2NvbnRpZ19ncm93X2NhY2hlKHRyaWVzLCBsb3csIGhpZ2gpOwogCQkJdHJpZXMr KzsKIAkJCWdvdG8gcmV0cnk7CiAJCX0K --000e0cd13bbaa2f17b04881f8a67-- From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 13:01:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 386CE1065672; Thu, 3 Jun 2010 13:01:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 270218FC17; Thu, 3 Jun 2010 13:01: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 o53D1u4x085432; Thu, 3 Jun 2010 13:01:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53D1uFZ085429; Thu, 3 Jun 2010 13:01:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201006031301.o53D1uFZ085429@svn.freebsd.org> From: Marius Strobl Date: Thu, 3 Jun 2010 13:01: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: r208777 - in head: sbin/geom/class/part sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 13:01:56 -0000 Author: marius Date: Thu Jun 3 13:01:55 2010 New Revision: 208777 URL: http://svn.freebsd.org/changeset/base/208777 Log: - In gpart_bootfile_read() fix an off-by-one error preventing the bootstrap file to be of maximum size. - Add special handling required for SMI/VTOC8 disklabel partcode, i.e. avoid overwriting the label when writing the bootstrap code to the partition starting at 0 and install it to all partitions when the -i option is omitted just like geom_sunlabel(4) and sunlabel(8) do by default. - Add missing prototypes. - Add const where applicable. Reviewed by: marcel MFC after: 3 days Modified: head/sbin/geom/class/part/geom_part.c head/sys/sys/vtoc.h Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Thu Jun 3 12:09:02 2010 (r208776) +++ head/sbin/geom/class/part/geom_part.c Thu Jun 3 13:01:55 2010 (r208777) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -59,13 +60,27 @@ static char autofill[] = "*"; static char optional[] = ""; static char flags[] = "C"; -static char bootcode_param[] = "bootcode"; -static char index_param[] = "index"; -static char partcode_param[] = "partcode"; - +static const char const bootcode_param[] = "bootcode"; +static const char const index_param[] = "index"; +static const char const partcode_param[] = "partcode"; + +static struct gclass *find_class(struct gmesh *, const char *); +static struct ggeom * find_geom(struct gclass *, const char *); +static const char *find_geomcfg(struct ggeom *, const char *); +static const char *find_provcfg(struct gprovider *, const char *); +static struct gprovider *find_provider(struct ggeom *, + unsigned long long); +static const char *fmtsize(int64_t); +static int gpart_autofill(struct gctl_req *); +static int gpart_autofill_resize(struct gctl_req *); static void gpart_bootcode(struct gctl_req *, unsigned int); +static void *gpart_bootfile_read(const char *, ssize_t *); static void gpart_issue(struct gctl_req *, unsigned int); static void gpart_show(struct gctl_req *, unsigned int); +static void gpart_show_geom(struct ggeom *, const char *); +static int gpart_show_hasopt(struct gctl_req *, const char *, const char *); +static void gpart_write_partcode(struct ggeom *, int, void *, ssize_t); +static void gpart_write_partcode_vtoc8(struct ggeom *, int, void *); struct g_command PUBSYM(class_commands)[] = { { "add", 0, gpart_issue, { @@ -132,7 +147,7 @@ struct g_command PUBSYM(class_commands)[ { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL - }, + }, { "resize", 0, gpart_issue, { { 's', "size", autofill, G_TYPE_ASCLBA }, { 'i', index_param, NULL, G_TYPE_ASCNUM }, @@ -605,7 +620,7 @@ gpart_bootfile_read(const char *bootfile errx(EXIT_FAILURE, "%s: not a regular file", bootfile); if (sb.st_size == 0) errx(EXIT_FAILURE, "%s: empty file", bootfile); - if (*size > 0 && sb.st_size >= *size) + if (*size > 0 && sb.st_size > *size) errx(EXIT_FAILURE, "%s: file too big (%zu limit)", bootfile, *size); @@ -625,35 +640,14 @@ gpart_bootfile_read(const char *bootfile } static void -gpart_write_partcode(struct gctl_req *req, int idx, void *code, ssize_t size) +gpart_write_partcode(struct ggeom *gp, int idx, void *code, ssize_t size) { char dsf[128]; - struct gmesh mesh; - struct gclass *classp; - struct ggeom *gp; struct gprovider *pp; const char *s; char *buf; off_t bsize; - int error, fd; - - s = gctl_get_ascii(req, "class"); - if (s == NULL) - abort(); - error = geom_gettree(&mesh); - if (error != 0) - errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); - classp = find_class(&mesh, s); - if (classp == NULL) { - geom_deletetree(&mesh); - errx(EXIT_FAILURE, "Class %s not found.", s); - } - s = gctl_get_ascii(req, "geom"); - if (s == NULL) - abort(); - gp = find_geom(classp, s); - if (gp == NULL) - errx(EXIT_FAILURE, "No such geom: %s.", s); + int fd; LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { s = find_provcfg(pp, "index"); @@ -690,18 +684,63 @@ gpart_write_partcode(struct gctl_req *re close(fd); } else errx(EXIT_FAILURE, "invalid partition index"); +} - geom_deletetree(&mesh); +static void +gpart_write_partcode_vtoc8(struct ggeom *gp, int idx, void *code) +{ + char dsf[128]; + struct gprovider *pp; + const char *s; + int installed, fd; + + installed = 0; + LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { + s = find_provcfg(pp, "index"); + if (s == NULL) + continue; + if (idx != 0 && atoi(s) != idx) + continue; + snprintf(dsf, sizeof(dsf), "/dev/%s", pp->lg_name); + if (pp->lg_sectorsize != sizeof(struct vtoc8)) + errx(EXIT_FAILURE, "%s: unexpected sector " + "size (%d)\n", dsf, pp->lg_sectorsize); + fd = open(dsf, O_WRONLY); + if (fd == -1) + err(EXIT_FAILURE, "%s", dsf); + if (lseek(fd, VTOC_BOOTSIZE, SEEK_SET) != VTOC_BOOTSIZE) + continue; + /* + * We ignore the first VTOC_BOOTSIZE bytes of boot code in + * order to avoid overwriting the label. + */ + if (lseek(fd, sizeof(struct vtoc8), SEEK_SET) != + sizeof(struct vtoc8)) + err(EXIT_FAILURE, "%s", dsf); + if (write(fd, (caddr_t)code + sizeof(struct vtoc8), + VTOC_BOOTSIZE - sizeof(struct vtoc8)) != VTOC_BOOTSIZE - + sizeof(struct vtoc8)) + err(EXIT_FAILURE, "%s", dsf); + installed++; + close(fd); + if (idx != 0 && atoi(s) == idx) + break; + } + if (installed == 0) + errx(EXIT_FAILURE, "%s: no partitions", gp->lg_name); } static void gpart_bootcode(struct gctl_req *req, unsigned int fl) { + struct gmesh mesh; + struct gclass *classp; + struct ggeom *gp; const char *s; char *sp; void *bootcode, *partcode; size_t bootsize, partsize; - int error, idx; + int error, idx, vtoc8; if (gctl_has_param(req, bootcode_param)) { s = gctl_get_ascii(req, bootcode_param); @@ -716,9 +755,31 @@ gpart_bootcode(struct gctl_req *req, uns bootsize = 0; } + s = gctl_get_ascii(req, "class"); + if (s == NULL) + abort(); + error = geom_gettree(&mesh); + if (error != 0) + errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); + classp = find_class(&mesh, s); + if (classp == NULL) { + geom_deletetree(&mesh); + errx(EXIT_FAILURE, "Class %s not found.", s); + } + s = gctl_get_ascii(req, "geom"); + if (s == NULL) + abort(); + gp = find_geom(classp, s); + if (gp == NULL) + errx(EXIT_FAILURE, "No such geom: %s.", s); + s = find_geomcfg(gp, "scheme"); + vtoc8 = 0; + if (strcmp(s, "VTOC8") == 0) + vtoc8 = 1; + if (gctl_has_param(req, partcode_param)) { s = gctl_get_ascii(req, partcode_param); - partsize = bootsize * 1024; + partsize = vtoc8 != 0 ? VTOC_BOOTSIZE : bootsize * 1024; partcode = gpart_bootfile_read(s, &partsize); error = gctl_delete_param(req, partcode_param); if (error) @@ -742,16 +803,20 @@ gpart_bootcode(struct gctl_req *req, uns idx = 0; if (partcode != NULL) { - if (idx == 0) - errx(EXIT_FAILURE, "missing -i option"); - gpart_write_partcode(req, idx, partcode, partsize); - } else { + if (vtoc8 == 0) { + if (idx == 0) + errx(EXIT_FAILURE, "missing -i option"); + gpart_write_partcode(gp, idx, partcode, partsize); + } else + gpart_write_partcode_vtoc8(gp, idx, partcode); + } else if (bootcode == NULL) errx(EXIT_FAILURE, "no -b nor -p"); - } if (bootcode != NULL) gpart_issue(req, fl); + + geom_deletetree(&mesh); } static void Modified: head/sys/sys/vtoc.h ============================================================================== --- head/sys/sys/vtoc.h Thu Jun 3 12:09:02 2010 (r208776) +++ head/sys/sys/vtoc.h Thu Jun 3 13:01:55 2010 (r208777) @@ -53,9 +53,10 @@ #define VTOC_TAG_FREEBSD_ZFS 0x0904 #define VTOC_FLAG_UNMNT 0x01 /* unmountable partition */ -#define VTOC_FLAG_RDONLY 0x10 /* partition is read/only */ +#define VTOC_FLAG_RDONLY 0x10 /* partition is read/only */ #define VTOC_ASCII_LEN 128 +#define VTOC_BOOTSIZE 8192 /* 16 sectors */ #define VTOC_MAGIC 0xdabe #define VTOC_RAW_PART 2 #define VTOC_SANITY 0x600ddeee From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 13:04:57 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5AFE106567B; Thu, 3 Jun 2010 13:04:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4BC38FC2F; Thu, 3 Jun 2010 13:04: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 o53D4uvO086128; Thu, 3 Jun 2010 13:04:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53D4uoV086126; Thu, 3 Jun 2010 13:04:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201006031304.o53D4uoV086126@svn.freebsd.org> From: Marius Strobl Date: Thu, 3 Jun 2010 13:04:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208778 - head/sbin/geom/class/part X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 13:04:57 -0000 Author: marius Date: Thu Jun 3 13:04:56 2010 New Revision: 208778 URL: http://svn.freebsd.org/changeset/base/208778 Log: - Mention that VTOC8 labels are found in Fujitsu SPARC64 machines as well. - Add information regarding VTOC8 bootrstrap code and how it's handled with r208777 in place. - Document the mapping of partition types to VTOC8 tags. - Add examples for VTOC8 to the respective section. - Eliminated hard sentence breaks. Reviewed by: marcel (slightly buggy version) MFC after: 3 days Modified: head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/gpart.8 ============================================================================== --- head/sbin/geom/class/part/gpart.8 Thu Jun 3 13:01:55 2010 (r208777) +++ head/sbin/geom/class/part/gpart.8 Thu Jun 3 13:04:56 2010 (r208778) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 22, 2010 +.Dd June 3, 2010 .Dt GPART 8 .Os .Sh NAME @@ -72,7 +72,10 @@ NEC PC-98 computers. The .Dv GEOM_PART_VTOC8 option adds support for Sun's SMI VTOC8 label as -found on UltraSPARC-based computers. +found on computers based on +.Tn SPARC64 +and +.Tn UltraSPARC. .Pp Usage of the .Ns Nm @@ -221,9 +224,15 @@ The .Fl p Ar partcode option specifies a file that contains the bootstrap code intended to be written to a partition. +For the VTOC8 scheme, it is a 8192 byte file of which the last 7680 bytes +are installed as bootstrap code. The partition is specified by the .Fl i Ar index option. +For the VTOC8 scheme, if the +.Fl i Ar index +option is omitted, the bootstrap code is written to all sufficiently large +partitions. The size of the file must be smaller than the size of the partition. .Pp Additional options include: @@ -343,10 +352,12 @@ Resize a partition from geom .Ar geom and further identified by the .Fl i Ar index -option. New partition size is expressed in logical block -numbers and can be given by the +option. +New partition size is expressed in logical block +numbers and can be given by the .Fl s Ar size -option. If +option. +If .Fl s option is ommited then new size is automatically calculated to maximum available from given geom @@ -448,36 +459,36 @@ A partition dedicated to swap space. The scheme-specific types are .Qq Li "!FreeBSD-swap" -for APM, and +for APM, .Qq Li "!516e7cb5-6ecf-11d6-8ff8-00022d09712b" -for GPT. +for GPT, and tag 0x0901 for VTOC8. .It Cm freebsd-ufs A .Fx partition that contains a UFS or UFS2 file system. The scheme-specific types are .Qq Li "!FreeBSD-UFS" -for APM, and +for APM, .Qq Li "!516e7cb6-6ecf-11d6-8ff8-00022d09712b" -for GPT. +for GPT, and tag 0x0902 for VTOC8. .It Cm freebsd-vinum A .Fx partition that contains a Vinum volume. The scheme-specific types are .Qq Li "!FreeBSD-Vinum" -for APM, and +for APM, .Qq Li "!516e7cb8-6ecf-11d6-8ff8-00022d09712b" -for GPT. +for GPT, and tag 0x0903 for VTOC8. .It Cm freebsd-zfs A .Fx partition that contains a ZFS volume. The scheme-specific types are .Qq Li "!FreeBSD-ZFS" -for APM, and +for APM, .Qq Li "!516e7cba-6ecf-11d6-8ff8-00022d09712b" -for GPT. +for GPT, and 0x0904 for VTOC8. .It Cm mbr A partition that is sub-partitioned by a master boot record (MBR). This type is known as @@ -543,10 +554,28 @@ future need (e.g.\& from a ZFS partition .Pp Create a 512MB-sized .Cm freebsd-ufs -partition that would contain UFS where the system boot from. +partition that would contain UFS where the system boots from. .Bd -literal -offset indent /sbin/gpart add -b 162 -s 1048576 -t freebsd-ufs ad0 .Ed +.Pp +Create VTOC8 scheme on +.Pa da0 . +.Bd -literal -offset indent +/sbin/gpart create -s VTOC8 da0 +.Ed +.Pp +Create a 512MB-sized +.Cm freebsd-ufs +partition that would contain UFS where the system boots from. +.Bd -literal -offset indent +/sbin/gpart add -b 0 -s 1048576 -t freebsd-ufs da0 +.Ed +.Pp +After having created all required partitions, embed bootstrap code into them. +.Bd -literal -offset indent +/sbin/gpart bootcode -p /boot/boot1 da0 +.Ed .Sh SEE ALSO .Xr geom 4 , .Xr geom 8 From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 13:41:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AB2C106567A; Thu, 3 Jun 2010 13:41:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A8EC8FC2C; Thu, 3 Jun 2010 13:41: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 o53DftYJ094271; Thu, 3 Jun 2010 13:41:55 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53DftKm094269; Thu, 3 Jun 2010 13:41:55 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031341.o53DftKm094269@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 13:41: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: r208779 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 13:41:55 -0000 Author: trasz Date: Thu Jun 3 13:41:55 2010 New Revision: 208779 URL: http://svn.freebsd.org/changeset/base/208779 Log: The acl_cnt field is unsigned; no point in checking if it's >= 0. Found with: Coverity Prevent CID: 3683 Modified: head/sys/kern/subr_acl_nfs4.c Modified: head/sys/kern/subr_acl_nfs4.c ============================================================================== --- head/sys/kern/subr_acl_nfs4.c Thu Jun 3 13:04:56 2010 (r208778) +++ head/sys/kern/subr_acl_nfs4.c Thu Jun 3 13:41:55 2010 (r208779) @@ -342,7 +342,6 @@ acl_nfs4_sync_acl_from_mode(struct acl * const int WRITE = 02; const int EXEC = 01; - KASSERT(aclp->acl_cnt >= 0, ("aclp->acl_cnt >= 0")); KASSERT(aclp->acl_cnt <= ACL_MAX_ENTRIES, ("aclp->acl_cnt <= ACL_MAX_ENTRIES")); From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 13:43:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41982106566B; Thu, 3 Jun 2010 13:43:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 316CC8FC16; Thu, 3 Jun 2010 13:43: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 o53Dhxx1094765; Thu, 3 Jun 2010 13:43:59 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53Dhxem094763; Thu, 3 Jun 2010 13:43:59 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031343.o53Dhxem094763@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 13:43: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: r208780 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 13:43:59 -0000 Author: trasz Date: Thu Jun 3 13:43:58 2010 New Revision: 208780 URL: http://svn.freebsd.org/changeset/base/208780 Log: The 'acl_cnt' field is unsigned; no point in checking if it's >= 0. Found with: Coverity Prevent CID: 3684 Modified: head/sys/kern/subr_acl_posix1e.c Modified: head/sys/kern/subr_acl_posix1e.c ============================================================================== --- head/sys/kern/subr_acl_posix1e.c Thu Jun 3 13:41:55 2010 (r208779) +++ head/sys/kern/subr_acl_posix1e.c Thu Jun 3 13:43:58 2010 (r208780) @@ -558,7 +558,7 @@ acl_posix1e_check(struct acl *acl) */ num_acl_user_obj = num_acl_user = num_acl_group_obj = num_acl_group = num_acl_mask = num_acl_other = 0; - if (acl->acl_cnt > ACL_MAX_ENTRIES || acl->acl_cnt < 0) + if (acl->acl_cnt > ACL_MAX_ENTRIES) return (EINVAL); for (i = 0; i < acl->acl_cnt; i++) { /* From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 13:45:28 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C1361065674; Thu, 3 Jun 2010 13:45:28 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C4118FC18; Thu, 3 Jun 2010 13:45: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 o53DjSOO095147; Thu, 3 Jun 2010 13:45:28 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53DjSJB095145; Thu, 3 Jun 2010 13:45:28 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031345.o53DjSJB095145@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 13:45: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: r208781 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 13:45:28 -0000 Author: trasz Date: Thu Jun 3 13:45:27 2010 New Revision: 208781 URL: http://svn.freebsd.org/changeset/base/208781 Log: The 'acl_cnt' field is unsigned; no point in checking if it's >= 0. Found with: Coverity Prevent CID: 3688 Modified: head/sys/kern/vfs_acl.c Modified: head/sys/kern/vfs_acl.c ============================================================================== --- head/sys/kern/vfs_acl.c Thu Jun 3 13:43:58 2010 (r208780) +++ head/sys/kern/vfs_acl.c Thu Jun 3 13:45:27 2010 (r208781) @@ -92,7 +92,7 @@ acl_copy_acl_into_oldacl(const struct ac { int i; - if (source->acl_cnt < 0 || source->acl_cnt > OLDACL_MAX_ENTRIES) + if (source->acl_cnt > OLDACL_MAX_ENTRIES) return (EINVAL); bzero(dest, sizeof(*dest)); From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 14:15:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 340A81065676; Thu, 3 Jun 2010 14:15:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BF6C8FC12; Thu, 3 Jun 2010 14:15: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 o53EF8Za001811; Thu, 3 Jun 2010 14:15:08 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53EF8Ku001809; Thu, 3 Jun 2010 14:15:08 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031415.o53EF8Ku001809@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 14:15: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: r208782 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 14:15:09 -0000 Author: trasz Date: Thu Jun 3 14:15:08 2010 New Revision: 208782 URL: http://svn.freebsd.org/changeset/base/208782 Log: The 'acl_cnt' field is unsigned; no point in checking if it's >= 0. Found with: Coverity Prevent CID: 6193 Modified: head/lib/libc/posix1e/acl_entry.c Modified: head/lib/libc/posix1e/acl_entry.c ============================================================================== --- head/lib/libc/posix1e/acl_entry.c Thu Jun 3 13:45:27 2010 (r208781) +++ head/lib/libc/posix1e/acl_entry.c Thu Jun 3 14:15:08 2010 (r208782) @@ -87,7 +87,7 @@ acl_create_entry_np(acl_t *acl_p, acl_en acl_int = &(*acl_p)->ats_acl; - if ((acl_int->acl_cnt + 1 >= ACL_MAX_ENTRIES) || (acl_int->acl_cnt < 0)) { + if (acl_int->acl_cnt + 1 >= ACL_MAX_ENTRIES) { errno = EINVAL; return (-1); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 14:16:58 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68D281065691; Thu, 3 Jun 2010 14:16:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58A278FC22; Thu, 3 Jun 2010 14:16: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 o53EGwmV002234; Thu, 3 Jun 2010 14:16:58 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53EGw6F002232; Thu, 3 Jun 2010 14:16:58 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031416.o53EGw6F002232@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 14:16:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208783 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 14:16:58 -0000 Author: trasz Date: Thu Jun 3 14:16:58 2010 New Revision: 208783 URL: http://svn.freebsd.org/changeset/base/208783 Log: The 'acl_cnt' field is unsigned; no point in checking if it's >= 0. Found with: Coverity Prevent CID: 6192 Modified: head/lib/libc/posix1e/acl_entry.c Modified: head/lib/libc/posix1e/acl_entry.c ============================================================================== --- head/lib/libc/posix1e/acl_entry.c Thu Jun 3 14:15:08 2010 (r208782) +++ head/lib/libc/posix1e/acl_entry.c Thu Jun 3 14:16:58 2010 (r208783) @@ -55,8 +55,7 @@ acl_create_entry(acl_t *acl_p, acl_entry * +1, because we are checking if there is space left for one more * entry. */ - if ((acl_int->acl_cnt + 1 >= ACL_MAX_ENTRIES) || - (acl_int->acl_cnt < 0)) { + if (acl_int->acl_cnt + 1 >= ACL_MAX_ENTRIES) { errno = EINVAL; return (-1); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 14:27:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE8DF1065670; Thu, 3 Jun 2010 14:27:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE2408FC17; Thu, 3 Jun 2010 14:27: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 o53ERIJE004529; Thu, 3 Jun 2010 14:27:18 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53ERIZv004527; Thu, 3 Jun 2010 14:27:18 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031427.o53ERIZv004527@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 14:27: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: r208784 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 14:27:18 -0000 Author: trasz Date: Thu Jun 3 14:27:18 2010 New Revision: 208784 URL: http://svn.freebsd.org/changeset/base/208784 Log: Fix usage of uninitialized variable. Found with: Coverity Prevent CID: 7517 MFC after: 2 weeks Modified: head/lib/libc/posix1e/acl_strip.c Modified: head/lib/libc/posix1e/acl_strip.c ============================================================================== --- head/lib/libc/posix1e/acl_strip.c Thu Jun 3 14:16:58 2010 (r208783) +++ head/lib/libc/posix1e/acl_strip.c Thu Jun 3 14:27:18 2010 (r208784) @@ -46,7 +46,7 @@ static acl_t _nfs4_acl_strip_np(const acl_t aclp, int recalculate_mask) { acl_t newacl; - mode_t mode; + mode_t mode = 0; newacl = acl_init(ACL_MAX_ENTRIES); if (newacl == NULL) { From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 14:29:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E5DD106566B; Thu, 3 Jun 2010 14:29:18 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3308E8FC20; Thu, 3 Jun 2010 14:29: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 o53ETIv5004990; Thu, 3 Jun 2010 14:29:18 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53ETITc004985; Thu, 3 Jun 2010 14:29:18 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031429.o53ETITc004985@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 14:29: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: r208785 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 14:29:18 -0000 Author: trasz Date: Thu Jun 3 14:29:17 2010 New Revision: 208785 URL: http://svn.freebsd.org/changeset/base/208785 Log: _posix1e_acl_sort() never returns anything other than 0; change its return type to void and update callers. This simplifies code and fixes one place where the returned value was not actually checked. Found with: Coverity Prevent CID: 4791 Modified: head/lib/libc/posix1e/acl_set.c head/lib/libc/posix1e/acl_support.c head/lib/libc/posix1e/acl_support.h head/lib/libc/posix1e/acl_valid.c Modified: head/lib/libc/posix1e/acl_set.c ============================================================================== --- head/lib/libc/posix1e/acl_set.c Thu Jun 3 14:27:18 2010 (r208784) +++ head/lib/libc/posix1e/acl_set.c Thu Jun 3 14:29:17 2010 (r208785) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); int acl_set_file(const char *path_p, acl_type_t type, acl_t acl) { - int error; if (acl == NULL || path_p == NULL) { errno = EINVAL; @@ -64,13 +63,8 @@ acl_set_file(const char *path_p, acl_typ errno = EINVAL; return (-1); } - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } + if (_posix1e_acl(acl, type)) + _posix1e_acl_sort(acl); acl->ats_cur_entry = 0; @@ -80,7 +74,6 @@ acl_set_file(const char *path_p, acl_typ int acl_set_link_np(const char *path_p, acl_type_t type, acl_t acl) { - int error; if (acl == NULL || path_p == NULL) { errno = EINVAL; @@ -91,13 +84,8 @@ acl_set_link_np(const char *path_p, acl_ errno = EINVAL; return (-1); } - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } + if (_posix1e_acl(acl, type)) + _posix1e_acl_sort(acl); acl->ats_cur_entry = 0; @@ -117,7 +105,6 @@ acl_set_fd(int fd, acl_t acl) int acl_set_fd_np(int fd, acl_t acl, acl_type_t type) { - int error; if (acl == NULL) { errno = EINVAL; @@ -128,13 +115,8 @@ acl_set_fd_np(int fd, acl_t acl, acl_typ errno = EINVAL; return (-1); } - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } + if (_posix1e_acl(acl, type)) + _posix1e_acl_sort(acl); acl->ats_cur_entry = 0; Modified: head/lib/libc/posix1e/acl_support.c ============================================================================== --- head/lib/libc/posix1e/acl_support.c Thu Jun 3 14:27:18 2010 (r208784) +++ head/lib/libc/posix1e/acl_support.c Thu Jun 3 14:29:17 2010 (r208785) @@ -127,11 +127,9 @@ _posix1e_acl_entry_compare(struct acl_en } /* - * _posix1e_acl_sort -- sort ACL entries in POSIX.1e-formatted ACLs - * Give the opportunity to fail, although we don't currently have a way - * to fail. + * _posix1e_acl_sort -- sort ACL entries in POSIX.1e-formatted ACLs. */ -int +void _posix1e_acl_sort(acl_t acl) { struct acl *acl_int; @@ -140,8 +138,6 @@ _posix1e_acl_sort(acl_t acl) qsort(&acl_int->acl_entry[0], acl_int->acl_cnt, sizeof(struct acl_entry), (compare) _posix1e_acl_entry_compare); - - return (0); } /* Modified: head/lib/libc/posix1e/acl_support.h ============================================================================== --- head/lib/libc/posix1e/acl_support.h Thu Jun 3 14:27:18 2010 (r208784) +++ head/lib/libc/posix1e/acl_support.h Thu Jun 3 14:29:17 2010 (r208785) @@ -50,7 +50,7 @@ int _nfs4_format_access_mask(char *str, int _nfs4_parse_flags(const char *str, acl_flag_t *var); int _nfs4_parse_access_mask(const char *str, acl_perm_t *var); int _posix1e_acl_check(acl_t acl); -int _posix1e_acl_sort(acl_t acl); +void _posix1e_acl_sort(acl_t acl); int _posix1e_acl(acl_t acl, acl_type_t type); int _posix1e_acl_id_to_name(acl_tag_t tag, uid_t id, ssize_t buf_len, char *buf, int flags); Modified: head/lib/libc/posix1e/acl_valid.c ============================================================================== --- head/lib/libc/posix1e/acl_valid.c Thu Jun 3 14:27:18 2010 (r208784) +++ head/lib/libc/posix1e/acl_valid.c Thu Jun 3 14:29:17 2010 (r208785) @@ -79,20 +79,14 @@ acl_valid(acl_t acl) int acl_valid_file_np(const char *pathp, acl_type_t type, acl_t acl) { - int error; if (pathp == NULL || acl == NULL) { errno = EINVAL; return (-1); } type = _acl_type_unold(type); - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } + if (_posix1e_acl(acl, type)) + _posix1e_acl_sort(acl); return (__acl_aclcheck_file(pathp, type, &acl->ats_acl)); } @@ -100,20 +94,14 @@ acl_valid_file_np(const char *pathp, acl int acl_valid_link_np(const char *pathp, acl_type_t type, acl_t acl) { - int error; if (pathp == NULL || acl == NULL) { errno = EINVAL; return (-1); } type = _acl_type_unold(type); - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } + if (_posix1e_acl(acl, type)) + _posix1e_acl_sort(acl); return (__acl_aclcheck_link(pathp, type, &acl->ats_acl)); } @@ -121,20 +109,14 @@ acl_valid_link_np(const char *pathp, acl int acl_valid_fd_np(int fd, acl_type_t type, acl_t acl) { - int error; if (acl == NULL) { errno = EINVAL; return (-1); } type = _acl_type_unold(type); - if (_posix1e_acl(acl, type)) { - error = _posix1e_acl_sort(acl); - if (error) { - errno = error; - return (-1); - } - } + if (_posix1e_acl(acl, type)) + _posix1e_acl_sort(acl); acl->ats_cur_entry = 0; From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 14:45:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 762281065787; Thu, 3 Jun 2010 14:45:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3]) by mx1.freebsd.org (Postfix) with ESMTP id 32A058FC0A; Thu, 3 Jun 2010 14:45:07 +0000 (UTC) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 35B1741C64A; Thu, 3 Jun 2010 16:45:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([192.168.74.103]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id 7uwkmfE+eADO; Thu, 3 Jun 2010 16:45:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 7279941C677; Thu, 3 Jun 2010 16:45:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id E93814448EC; Thu, 3 Jun 2010 14:43:34 +0000 (UTC) Date: Thu, 3 Jun 2010 14:43:34 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Attilio Rao In-Reply-To: <201006030954.o539srvJ037662@svn.freebsd.org> Message-ID: <20100603144315.Y43852@maildrop.int.zabbadoz.net> References: <201006030954.o539srvJ037662@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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: r208771 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 14:45:07 -0000 On Thu, 3 Jun 2010, Attilio Rao wrote: > Author: attilio > Date: Thu Jun 3 09:54:53 2010 > New Revision: 208771 > URL: http://svn.freebsd.org/changeset/base/208771 > > Log: > [0] Improve wording. > [1] Following style for manpages, just do carriage return after a > sentence. > > Sponsored by: Sandvine Incorporated > [0] Submitted by: emaste > [1] Submitted by: rwatson > > Modified: > head/share/man/man4/io.4 > > Modified: head/share/man/man4/io.4 > ============================================================================== > --- head/share/man/man4/io.4 Thu Jun 3 09:29:54 2010 (r208770) > +++ head/share/man/man4/io.4 Thu Jun 3 09:54:53 2010 (r208771) You are missing a .Dd update here. -- Bjoern A. Zeeb I will let you know once I escaped from my bird cage and learnt to fly again. -- Ottawa, ON, Canada, 21st May 2010 From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 14:51:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83CF91065677; Thu, 3 Jun 2010 14:51:29 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7380A8FC14; Thu, 3 Jun 2010 14: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 o53EpTxp009907; Thu, 3 Jun 2010 14:51:29 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53EpTmM009905; Thu, 3 Jun 2010 14:51:29 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006031451.o53EpTmM009905@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 14:51: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: r208786 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 14:51:29 -0000 Author: trasz Date: Thu Jun 3 14:51:29 2010 New Revision: 208786 URL: http://svn.freebsd.org/changeset/base/208786 Log: Don't forget to free the string in error case. Found with: Coverity Prevent CID: 6585 Modified: head/lib/libc/posix1e/acl_to_text_nfs4.c Modified: head/lib/libc/posix1e/acl_to_text_nfs4.c ============================================================================== --- head/lib/libc/posix1e/acl_to_text_nfs4.c Thu Jun 3 14:29:17 2010 (r208785) +++ head/lib/libc/posix1e/acl_to_text_nfs4.c Thu Jun 3 14:51:29 2010 (r208786) @@ -246,6 +246,7 @@ _nfs4_acl_to_text_np(const acl_t aclp, s error = format_entry(str + off, size - off, entry, flags); if (error) { + free(str); errno = EINVAL; return (NULL); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 15:34:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E31B81065670; Thu, 3 Jun 2010 15:34:34 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yw0-f176.google.com (mail-yw0-f176.google.com [209.85.211.176]) by mx1.freebsd.org (Postfix) with ESMTP id 5B9EA8FC1A; Thu, 3 Jun 2010 15:34:33 +0000 (UTC) Received: by ywh6 with SMTP id 6so242205ywh.16 for ; Thu, 03 Jun 2010 08:34:33 -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=HDBi0xTbG7gD3pAw5pRrQhiDS1jFn0H6jLEDAxuPaWA=; b=jmz64VproLSGsCZiqP76NVSxGf2IHXkXaUmrTa+bNm1k1mZ7u9IOIT6Xfh5WUIAhDO OoT0ivKWFcOeEXLQKWTKEy00exiD4SacaBUuBRq4C8pwTBQrre/KmYxk2r/TNlx64J/D Rz0JmJRjtgvw+PpBWII8DwjB9EOLjjI56KhAs= 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=U1nRIaqPwopWWHoh8sAQI+mqkrViDJ/VXUYWKWsat7mFfQiIxYdmovYBii0xP6PGWy w5cH/NXUUgAXVR0o6kRc5lWM4jvDA7bnGT0M8/hsLJrdg2xotDV1rIU0VcuW430GixXZ rzIV8t3oEeencB3aVXGY3iuD417xWNP4xC91A= MIME-Version: 1.0 Received: by 10.229.249.145 with SMTP id mk17mr1971200qcb.163.1275579272963; Thu, 03 Jun 2010 08:34:32 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.229.183.213 with HTTP; Thu, 3 Jun 2010 08:34:32 -0700 (PDT) In-Reply-To: <20100603144315.Y43852@maildrop.int.zabbadoz.net> References: <201006030954.o539srvJ037662@svn.freebsd.org> <20100603144315.Y43852@maildrop.int.zabbadoz.net> Date: Thu, 3 Jun 2010 17:34:32 +0200 X-Google-Sender-Auth: vxgqTvu2P9NFMgYYItzuVkmD0BE Message-ID: From: Attilio Rao To: "Bjoern A. Zeeb" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r208771 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 15:34:35 -0000 2010/6/3 Bjoern A. Zeeb : > On Thu, 3 Jun 2010, Attilio Rao wrote: > >> Author: attilio >> Date: Thu Jun =C2=A03 09:54:53 2010 >> New Revision: 208771 >> URL: http://svn.freebsd.org/changeset/base/208771 >> >> Log: >> =C2=A0[0] Improve wording. >> =C2=A0[1] Following style for manpages, just do carriage return after a >> =C2=A0 =C2=A0 sentence. >> >> =C2=A0Sponsored by: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Sandvine Incorpora= ted >> =C2=A0[0] Submitted by: =C2=A0 =C2=A0 =C2=A0emaste >> =C2=A0[1] Submitted by: =C2=A0 =C2=A0 =C2=A0rwatson >> >> Modified: >> =C2=A0head/share/man/man4/io.4 >> >> Modified: head/share/man/man4/io.4 >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/share/man/man4/io.4 =C2=A0 =C2=A0Thu Jun =C2=A03 09:29:54 2010 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r208770) >> +++ head/share/man/man4/io.4 =C2=A0 =C2=A0Thu Jun =C2=A03 09:54:53 2010 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(r208771) > > > You are missing a .Dd update here. Well, while I think you may be tecnically right, I don't think it is worthy as long as the content of the manpage didn't change at all and shifting the date of 2 days might not really buy anything. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 16:02:12 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F67C106564A; Thu, 3 Jun 2010 16:02:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F1548FC1E; Thu, 3 Jun 2010 16:02: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 o53G2C6A025505; Thu, 3 Jun 2010 16:02:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53G2BBO025502; Thu, 3 Jun 2010 16:02:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201006031602.o53G2BBO025502@svn.freebsd.org> From: John Baldwin Date: Thu, 3 Jun 2010 16:02: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: r208787 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 16:02:12 -0000 Author: jhb Date: Thu Jun 3 16:02:11 2010 New Revision: 208787 URL: http://svn.freebsd.org/changeset/base/208787 Log: Assert that the thread lock is held in sched_pctcpu() instead of recursively acquiring it. All of the current callers already hold the lock. MFC after: 1 month Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Thu Jun 3 14:51:29 2010 (r208786) +++ head/sys/kern/sched_4bsd.c Thu Jun 3 16:02:11 2010 (r208787) @@ -1523,6 +1523,7 @@ sched_pctcpu(struct thread *td) { struct td_sched *ts; + THREAD_LOCK_ASSERT(td, MA_OWNED); ts = td->td_sched; return (ts->ts_pctcpu); } Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Thu Jun 3 14:51:29 2010 (r208786) +++ head/sys/kern/sched_ule.c Thu Jun 3 16:02:11 2010 (r208787) @@ -2367,7 +2367,7 @@ sched_pctcpu(struct thread *td) if (ts == NULL) return (0); - thread_lock(td); + THREAD_LOCK_ASSERT(td, MA_OWNED); if (ts->ts_ticks) { int rtick; @@ -2376,7 +2376,6 @@ sched_pctcpu(struct thread *td) rtick = min(SCHED_TICK_HZ(ts) / SCHED_TICK_SECS, hz); pctcpu = (FSCALE * ((FSCALE * rtick)/hz)) >> FSHIFT; } - thread_unlock(td); return (pctcpu); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 16:33:07 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA2CF1065675; Thu, 3 Jun 2010 16:33:07 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 5F39D8FC1A; Thu, 3 Jun 2010 16:33:07 +0000 (UTC) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id B0C2D2C2BF0; Thu, 3 Jun 2010 11:33:06 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6MVur+C+vsFV; Thu, 3 Jun 2010 11:32:59 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 495E62C2AEB; Thu, 3 Jun 2010 11:32:58 -0500 (CDT) Message-ID: <4C07D939.6010008@cs.rice.edu> Date: Thu, 03 Jun 2010 11:32:57 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.24 (X11/20100501) MIME-Version: 1.0 To: "C. Jayachandran" References: <201005271005.o4RA5eVu032269@svn.freebsd.org> <4C058145.3000707@cs.rice.edu> <4C05F9BC.40409@cs.rice.edu> <4C0731A5.7090301@cs.rice.edu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, "Jayachandran C." , svn-src-all@freebsd.org, Randall Stewart , Konstantin Belousov , svn-src-head@freebsd.org Subject: Re: svn commit: r208589 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 16:33:07 -0000 C. Jayachandran wrote: > On Thu, Jun 3, 2010 at 10:20 AM, C. Jayachandran > wrote: > >> On Thu, Jun 3, 2010 at 10:07 AM, Alan Cox wrote: >> >>> C. Jayachandran wrote: >>> >>>> On Wed, Jun 2, 2010 at 11:57 AM, Alan Cox wrote: >>>> >>>> >>>>> C. Jayachandran wrote: >>>>> >>>>> >>>>>> On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox wrote: >>>>>> >>>>>> >>>>>> >>>>>>> On 5/27/2010 5:05 AM, Jayachandran C. wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> Author: jchandra >>>>>>>> Date: Thu May 27 10:05:40 2010 >>>>>>>> New Revision: 208589 >>>>>>>> URL: http://svn.freebsd.org/changeset/base/208589 >>>>>>>> >>>>>>>> Log: >>>>>>>> Call VM_WAIT in pmap_ptpgzone_allocf() if M_WAITOK is set. >>>>>>>> Removed unused variable. >>>>>>>> >>>>>>>> Approved by: rrs (mentor) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> I'm afraid that this will work some of the time, but not all of the >>>>>>> time. >>>>>>> Specifically, there is no guarantee that any of the available free (or >>>>>>> cached) pages after the VM_WAIT will fall within the range of suitable >>>>>>> physical addresses. Moreover, and perhaps most worrisome, is that this >>>>>>> function could do a lot of spinning. Every time this function sleeps >>>>>>> and >>>>>>> a >>>>>>> single page is freed (or cached) by someone else, this function will be >>>>>>> reawakened. With a little bad luck, you could spin indefinitely. >>>>>>> >>>>>>> For essentially this reason, contigmalloc(), kmem_alloc_contig(), and >>>>>>> kmem_alloc_attr() don't use VM_WAIT, but instead a function called >>>>>>> vm_contig_grow_cache(). >>>>>>> >>>>>>> >>>>>>> >>>>>> I had seen the vm_contig_grow_cache() usage, but could not use it as >>>>>> it was defined as a static function. >>>>>> >>>>>> I did not want to use contigmalloc()/kmem_alloc_contig() either, >>>>>> because the pages in that memory region are already direct mapped and >>>>>> setting up another mapping is not necessary. The overall idea is to >>>>>> allocate pages in the direct mapped region for the page table entries >>>>>> so that we don't take a TLB exception while accessing page tables >>>>>> (which is costly as MIPS has a software TLB exception handler). >>>>>> >>>>>> Can you suggest the right way to do this? I will make the changes and >>>>>> send a patch for approval. >>>>>> >>>>>> >>>>>> >>>>> I would encourage you to make vm_contig_grow_cache() an extern function >>>>> and >>>>> use it. (vm/vm_pageout.h is probably the best place for the function >>>>> prototype.) >>>>> >>>>> >>>> I'll create a patch for this and related changes in mips/mips/pmap.c >>>> >>>> >>>> >>> Great. Thanks! >>> >>> >>>>> If you're interested in taking this a small step further, it would make >>>>> sense to add two parameters to vm_contig_grow_cache() and >>>>> vm_contig_launder(): a "low" and a "high" physical address. >>>>> vm_contig_launder() could then skip pages that are outside the desired >>>>> range. >>>>> >>>>> >>>> I am looking at this now, part of the logic which >>>> vm_phys_alloc_contig() uses to check pages address should work here. >>>> Will send out changes for this, if it works out. >>>> >>>> >>>> >>> I suspect that you'll just need to add two or three lines to >>> vm_contig_launder(). If something doesn't make sense, just e-mail me. >>> >> The current changes I have is attached - still testing it. >> > > I've attached the patch for review, but I was not able trigger the > condition in which vm_contig_grow_cache() is called during testing so > far. > > But if you are okay with the patch I can commit it. > The patch looks good. Please go ahead and commit it. Thanks, Alan From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 17:42:32 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D29A106566B; Thu, 3 Jun 2010 17:42:32 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 893C18FC20; Thu, 3 Jun 2010 17:42: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 o53HgW4o047573; Thu, 3 Jun 2010 17:42:32 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53HgWfG047560; Thu, 3 Jun 2010 17:42:32 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201006031742.o53HgWfG047560@svn.freebsd.org> From: Ed Schouten Date: Thu, 3 Jun 2010 17:42: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: r208789 - in head/sys/boot: i386/boot0 i386/btx/btx i386/btx/btxldr i386/cdboot i386/mbr i386/pmbr pc98/boot0 pc98/boot0.5 pc98/btx/btx pc98/btx/btxldr pc98/cdboot sparc64/boot1 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 17:42:32 -0000 Author: ed Date: Thu Jun 3 17:42:32 2010 New Revision: 208789 URL: http://svn.freebsd.org/changeset/base/208789 Log: Use -Wl,-N instead of the undocumented -N option for GCC. GCC forwards the -N flag directly to ld. This flag is not documented and not supported by (for example) Clang. Just use -Wl,-N. Submitted by: Pawel Worach Modified: head/sys/boot/i386/boot0/Makefile head/sys/boot/i386/btx/btx/Makefile head/sys/boot/i386/btx/btxldr/Makefile head/sys/boot/i386/cdboot/Makefile head/sys/boot/i386/mbr/Makefile head/sys/boot/i386/pmbr/Makefile head/sys/boot/pc98/boot0.5/Makefile head/sys/boot/pc98/boot0/Makefile head/sys/boot/pc98/btx/btx/Makefile head/sys/boot/pc98/btx/btxldr/Makefile head/sys/boot/pc98/cdboot/Makefile head/sys/boot/sparc64/boot1/Makefile Modified: head/sys/boot/i386/boot0/Makefile ============================================================================== --- head/sys/boot/i386/boot0/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/i386/boot0/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -74,6 +74,6 @@ CFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \ -DTICKS=${BOOT_BOOT0_TICKS} \ -DCOMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED} -LDFLAGS=-N -e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/i386/btx/btx/Makefile ============================================================================== --- head/sys/boot/i386/btx/btx/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/i386/btx/btx/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -24,6 +24,6 @@ CFLAGS+=-DBTX_SERIAL -DSIOPRT=${BOOT_COM ORG= 0x9000 -LDFLAGS=-N -e start -Ttext ${ORG} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/i386/btx/btxldr/Makefile ============================================================================== --- head/sys/boot/i386/btx/btxldr/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/i386/btx/btxldr/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -11,6 +11,6 @@ CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRES CFLAGS+=-DBTXLDR_VERBOSE .endif -LDFLAGS=-N -e start -Ttext ${LOADER_ADDRESS} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${LOADER_ADDRESS} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/i386/cdboot/Makefile ============================================================================== --- head/sys/boot/i386/cdboot/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/i386/cdboot/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -8,6 +8,6 @@ SRCS= ${PROG}.s ORG= 0x7c00 -LDFLAGS=-N -e start -Ttext ${ORG} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/i386/mbr/Makefile ============================================================================== --- head/sys/boot/i386/mbr/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/i386/mbr/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -12,6 +12,6 @@ BOOT_MBR_FLAGS?= 0x80 ORG= 0x600 AFLAGS+=--defsym FLAGS=${BOOT_MBR_FLAGS} -LDFLAGS=-N -e start -Ttext ${ORG} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/i386/pmbr/Makefile ============================================================================== --- head/sys/boot/i386/pmbr/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/i386/pmbr/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -9,6 +9,6 @@ SRCS= ${PROG}.s ORG= 0x600 AFLAGS+=--defsym FLAGS=${BOOT_MBR_FLAGS} -LDFLAGS=-N -e start -Ttext ${ORG} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/pc98/boot0.5/Makefile ============================================================================== --- head/sys/boot/pc98/boot0.5/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/pc98/boot0.5/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -14,7 +14,7 @@ BOOT= boot0.5 # unless you are glutton for punishment. BOOT_BOOT0_ORG?= 0x0000 -LDFLAGS=-N -e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-T,${.CURDIR}/ldscript +LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-T,${.CURDIR}/ldscript # The size of boot0.5 must be 7168 bytes ${BOOT}: ${BOOT}.bin Modified: head/sys/boot/pc98/boot0/Makefile ============================================================================== --- head/sys/boot/pc98/boot0/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/pc98/boot0/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -13,7 +13,7 @@ BOOT= boot0 # unless you are glutton for punishment. BOOT_BOOT0_ORG?= 0x0000 -LDFLAGS=-N -e start -Ttext ${BOOT_BOOT0_ORG} +LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N ${BOOT}: ${BOOT}.out objcopy -S -O binary ${BOOT}.out ${.TARGET} Modified: head/sys/boot/pc98/btx/btx/Makefile ============================================================================== --- head/sys/boot/pc98/btx/btx/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/pc98/btx/btx/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -24,6 +24,6 @@ CFLAGS+=-DBTX_SERIAL -DSIOPRT=${BOOT_COM ORG= 0x9000 -LDFLAGS=-N -e start -Ttext ${ORG} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/pc98/btx/btxldr/Makefile ============================================================================== --- head/sys/boot/pc98/btx/btxldr/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/pc98/btx/btxldr/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -11,6 +11,6 @@ CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRES CFLAGS+=-DBTXLDR_VERBOSE .endif -LDFLAGS=-N -e start -Ttext ${LOADER_ADDRESS} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${LOADER_ADDRESS} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/pc98/cdboot/Makefile ============================================================================== --- head/sys/boot/pc98/cdboot/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/pc98/cdboot/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -8,6 +8,6 @@ SRCS= ${PROG}.s ORG= 0x0000 -LDFLAGS=-N -e start -Ttext ${ORG} -Wl,-S,--oformat,binary +LDFLAGS=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary .include Modified: head/sys/boot/sparc64/boot1/Makefile ============================================================================== --- head/sys/boot/sparc64/boot1/Makefile Thu Jun 3 17:20:27 2010 (r208788) +++ head/sys/boot/sparc64/boot1/Makefile Thu Jun 3 17:42:32 2010 (r208789) @@ -9,7 +9,7 @@ SRCS= _start.s boot1.c BOOTBLOCKBASE= 0x4000 CFLAGS= -mcmodel=medlow -Os -I${.CURDIR}/../../common -LDFLAGS=-N -Ttext ${BOOTBLOCKBASE} +LDFLAGS=-Ttext ${BOOTBLOCKBASE} -Wl,-N # Construct boot1. sunlabel expects it to contain zeroed-out space for the # label, and to be of the correct size. From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 17:46:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C2E1106566C; Thu, 3 Jun 2010 17:46:18 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2001:4dd0:ff41::b23f:aa]) by mx1.freebsd.org (Postfix) with ESMTP id 4A2248FC16; Thu, 3 Jun 2010 17:46:18 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 860EE2A28CB8; Thu, 3 Jun 2010 19:46:14 +0200 (CEST) Date: Thu, 3 Jun 2010 19:46:14 +0200 From: Ed Schouten To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20100603174614.GK56080@hoeg.nl> References: <201006031742.o53HgWfG047560@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3FmRlnZT3MJ0iQxE" Content-Disposition: inline In-Reply-To: <201006031742.o53HgWfG047560@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Subject: Re: svn commit: r208789 - in head/sys/boot: i386/boot0 i386/btx/btx i386/btx/btxldr i386/cdboot i386/mbr i386/pmbr pc98/boot0 pc98/boot0.5 pc98/btx/btx pc98/btx/btxldr pc98/cdboot sparc64/boot1 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 17:46:18 -0000 --3FmRlnZT3MJ0iQxE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Ed Schouten wrote: > Author: ed > Date: Thu Jun 3 17:42:32 2010 > New Revision: 208789 > URL: http://svn.freebsd.org/changeset/base/208789 >=20 > Log: > Use -Wl,-N instead of the undocumented -N option for GCC. > =20 > GCC forwards the -N flag directly to ld. This flag is not documented and > not supported by (for example) Clang. Just use -Wl,-N. > =20 > Submitted by: Pawel Worach Written by: rdivacky ;-) --=20 Ed Schouten WWW: http://80386.nl/ --3FmRlnZT3MJ0iQxE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkwH6mYACgkQ52SDGA2eCwUZ1QCfe6Cbn2cWsDW5LD8NzuHVyhiD AEYAn353uI+N3ZCFOqy/KbVUMVEAIArZ =5rMI -----END PGP SIGNATURE----- --3FmRlnZT3MJ0iQxE-- From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 17:53:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70CD71065670; Thu, 3 Jun 2010 17:53:10 +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 D8D408FC08; Thu, 3 Jun 2010 17:53:09 +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 o53HrA7R037364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Jun 2010 20:53:10 +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 o53HquC0087594; Thu, 3 Jun 2010 20:52:56 +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 o53Hqu4i087593; Thu, 3 Jun 2010 20:52:56 +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, 3 Jun 2010 20:52:56 +0300 From: Kostik Belousov To: Ed Schouten Message-ID: <20100603175256.GK83316@deviant.kiev.zoral.com.ua> References: <201006031742.o53HgWfG047560@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7yOawlA+vXT2u9S7" Content-Disposition: inline In-Reply-To: <201006031742.o53HgWfG047560@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.4 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: r208789 - in head/sys/boot: i386/boot0 i386/btx/btx i386/btx/btxldr i386/cdboot i386/mbr i386/pmbr pc98/boot0 pc98/boot0.5 pc98/btx/btx pc98/btx/btxldr pc98/cdboot sparc64/boot1 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 17:53:10 -0000 --7yOawlA+vXT2u9S7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 03, 2010 at 05:42:32PM +0000, Ed Schouten wrote: > Author: ed > Date: Thu Jun 3 17:42:32 2010 > New Revision: 208789 > URL: http://svn.freebsd.org/changeset/base/208789 >=20 > Log: > Use -Wl,-N instead of the undocumented -N option for GCC. > =20 > GCC forwards the -N flag directly to ld. This flag is not documented and > not supported by (for example) Clang. Just use -Wl,-N. This is strange. Traditionally, cc(1) forwards any switches or file names it does not understand, to the linker. Similarly, file names with extensions not recognized by cc, are passed to the linker. --7yOawlA+vXT2u9S7 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkwH6/gACgkQC3+MBN1Mb4jwrwCgn1KiqCTYE9tIiieB4NbFw9mr x+UAn2b1crKXfOzhiTeVZFGmyfBMzEuI =NI1Q -----END PGP SIGNATURE----- --7yOawlA+vXT2u9S7-- From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 18:34:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 231C9106566C; Thu, 3 Jun 2010 18:34:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 121688FC12; Thu, 3 Jun 2010 18:34: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 o53IYYAC059221; Thu, 3 Jun 2010 18:34:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53IYYEB059219; Thu, 3 Jun 2010 18:34:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006031834.o53IYYEB059219@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 3 Jun 2010 18:34: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: r208791 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 18:34:35 -0000 Author: kib Date: Thu Jun 3 18:34:34 2010 New Revision: 208791 URL: http://svn.freebsd.org/changeset/base/208791 Log: Do not leak vm page lock in vm_contig_launder(), vm_pageout_page_lock() always returns with the page locked. Submitted by: alc Pointy hat to: kib Modified: head/sys/vm/vm_contig.c Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Thu Jun 3 17:55:42 2010 (r208790) +++ head/sys/vm/vm_contig.c Thu Jun 3 18:34:34 2010 (r208791) @@ -168,8 +168,10 @@ vm_contig_launder(int queue) if ((m->flags & PG_MARKER) != 0) continue; - if (!vm_pageout_page_lock(m, &next)) + if (!vm_pageout_page_lock(m, &next)) { + vm_page_unlock(m); continue; + } KASSERT(VM_PAGE_INQUEUE2(m, queue), ("vm_contig_launder: page %p's queue is not %d", m, queue)); error = vm_contig_launder_page(m, &next); From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 20:46:24 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40E261065674; Thu, 3 Jun 2010 20:46:24 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FE6E8FC1F; Thu, 3 Jun 2010 20:46: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 o53KkO7p088510; Thu, 3 Jun 2010 20:46:24 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53KkO8a088508; Thu, 3 Jun 2010 20:46:24 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006032046.o53KkO8a088508@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 3 Jun 2010 20:46: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: r208792 - head/usr.sbin/chown X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 20:46:24 -0000 Author: trasz Date: Thu Jun 3 20:46:23 2010 New Revision: 208792 URL: http://svn.freebsd.org/changeset/base/208792 Log: Make chown(1) emit more useful error message when user/group name is invalid. Modified: head/usr.sbin/chown/chown.c Modified: head/usr.sbin/chown/chown.c ============================================================================== --- head/usr.sbin/chown/chown.c Thu Jun 3 18:34:34 2010 (r208791) +++ head/usr.sbin/chown/chown.c Thu Jun 3 20:46:23 2010 (r208792) @@ -262,9 +262,7 @@ id(const char *name, const char *type) */ errno = 0; val = strtoul(name, &ep, 10); - if (errno) - err(1, "%s", name); - if (*ep != '\0') + if (errno || *ep != '\0') errx(1, "%s: illegal %s name", name, type); return (val); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 21:12:51 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1C78106566C; Thu, 3 Jun 2010 21:12:51 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9312C8FC19; Thu, 3 Jun 2010 21:12: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 o53LCpBZ095495; Thu, 3 Jun 2010 21:12:51 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53LCptL095492; Thu, 3 Jun 2010 21:12:51 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201006032112.o53LCptL095492@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 3 Jun 2010 21:12: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: r208793 - in head: share/misc usr.bin/calendar/calendars X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2010 21:12:51 -0000 Author: ae Date: Thu Jun 3 21:12:51 2010 New Revision: 208793 URL: http://svn.freebsd.org/changeset/base/208793 Log: - Add myself to committers-src.dot - Add myself to calendar.freebsd Approved by: kib (mentor) Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Thu Jun 3 20:46:23 2010 (r208792) +++ head/share/misc/committers-src.dot Thu Jun 3 21:12:51 2010 (r208793) @@ -53,6 +53,7 @@ node [color=lightblue2, style=filled, bg # Current src committers go here. Try to keep things sorted. ache [label="Andrey Chernov\nache@FreeBSD.org\n1993/10/31"] +ae [label="Andrey V. Elsukov\nae@FreeBSD.org\n2010/06/03"] akiyama [label="Shunsuke Akiyama\nakiyama@FreeBSD.org\n2000/06/19"] ambrisko [label="Doug Ambrisko\nambrisko@FreeBSD.org\n2001/12/19"] anchie [label="Ana Kukec\nanchie@FreeBSD.org\n2010/04/14"] @@ -366,6 +367,7 @@ julian -> zec kan -> kib +kib -> ae kib -> dchagin kib -> lulf kib -> pho @@ -381,6 +383,8 @@ marcel -> nwhitehorn markm -> sheldonh +mav -> ae + mdodd -> jake mlaier -> benjsc Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Thu Jun 3 20:46:23 2010 (r208792) +++ head/usr.bin/calendar/calendars/calendar.freebsd Thu Jun 3 21:12:51 2010 (r208793) @@ -202,6 +202,7 @@ 07/19 Masafumi NAKANE born in Okazaki, Aichi, Japan, 1972 07/19 Simon L. Nielsen born in Copenhagen, Denmark, 1980 07/19 Gleb Smirnoff born in Kharkov, USSR, 1981 +07/20 Andrey V. Elsukov born in Kotelnich, Russian Federation, 1981 07/22 James Housley born in Chicago, Illinois, United States, 1965 07/22 Jens Schweikhardt born in Waiblingen, Baden-Wuerttemberg, Germany, 1967 07/22 Lukas Ertl born in Weissenbach/Enns, Steiermark, Austria, 1976 From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 06:35:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A808106566B; Fri, 4 Jun 2010 06:35:37 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 092158FC12; Fri, 4 Jun 2010 06:35: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 o546Za8I018743; Fri, 4 Jun 2010 06:35:36 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o546Zapf018739; Fri, 4 Jun 2010 06:35:36 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201006040635.o546Zapf018739@svn.freebsd.org> From: "Jayachandran C." Date: Fri, 4 Jun 2010 06:35: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: r208794 - in head/sys: mips/mips vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 06:35:37 -0000 Author: jchandra Date: Fri Jun 4 06:35:36 2010 New Revision: 208794 URL: http://svn.freebsd.org/changeset/base/208794 Log: Make vm_contig_grow_cache() extern, and use it when vm_phys_alloc_contig() fails to allocate MIPS page table pages. The current usage of VM_WAIT in case of vm_phys_alloc_contig() failure is not correct, because: "There is no guarantee that any of the available free (or cached) pages after the VM_WAIT will fall within the range of suitable physical addresses. Every time this function sleeps and a single page is freed (or cached) by someone else, this function will be reawakened. With a little bad luck, you could spin indefinitely." We also add low and high parameters to vm_contig_grow_cache() and vm_contig_launder() so that we restrict vm_contig_launder() to the range of pages we are interested in. Reported by: alc Reviewed by: alc Approved by: rrs (mentor) Modified: head/sys/mips/mips/pmap.c head/sys/vm/vm_contig.c head/sys/vm/vm_pageout.h Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Thu Jun 3 21:12:51 2010 (r208793) +++ head/sys/mips/mips/pmap.c Fri Jun 4 06:35:36 2010 (r208794) @@ -967,19 +967,23 @@ pmap_ptpgzone_allocf(uma_zone_t zone, in { vm_page_t m; vm_paddr_t paddr; + int tries; KASSERT(bytes == PAGE_SIZE, ("pmap_ptpgzone_allocf: invalid allocation size %d", bytes)); *flags = UMA_SLAB_PRIV; - for (;;) { - m = vm_phys_alloc_contig(1, 0, MIPS_KSEG0_LARGEST_PHYS, - PAGE_SIZE, PAGE_SIZE); - if (m != NULL) - break; - if ((wait & M_WAITOK) == 0) + tries = 0; +retry: + m = vm_phys_alloc_contig(1, 0, MIPS_KSEG0_LARGEST_PHYS, + PAGE_SIZE, PAGE_SIZE); + if (m == NULL) { + if (tries < ((wait & M_NOWAIT) != 0 ? 1 : 3)) { + vm_contig_grow_cache(tries, 0, MIPS_KSEG0_LARGEST_PHYS); + tries++; + goto retry; + } else return (NULL); - VM_WAIT; } paddr = VM_PAGE_TO_PHYS(m); Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Thu Jun 3 21:12:51 2010 (r208793) +++ head/sys/vm/vm_contig.c Fri Jun 4 06:35:36 2010 (r208794) @@ -87,8 +87,6 @@ __FBSDID("$FreeBSD$"); #include #include -static void vm_contig_grow_cache(int tries); - static int vm_contig_launder_page(vm_page_t m, vm_page_t *next) { @@ -157,9 +155,10 @@ vm_contig_launder_page(vm_page_t m, vm_p } static int -vm_contig_launder(int queue) +vm_contig_launder(int queue, vm_paddr_t low, vm_paddr_t high) { vm_page_t m, next; + vm_paddr_t pa; int error; TAILQ_FOREACH_SAFE(m, &vm_page_queues[queue].pl, pageq, next) { @@ -168,6 +167,10 @@ vm_contig_launder(int queue) if ((m->flags & PG_MARKER) != 0) continue; + pa = VM_PAGE_TO_PHYS(m); + if (pa < low || pa + PAGE_SIZE > high) + continue; + if (!vm_pageout_page_lock(m, &next)) { vm_page_unlock(m); continue; @@ -203,8 +206,8 @@ vm_page_release_contig(vm_page_t m, vm_p /* * Increase the number of cached pages. */ -static void -vm_contig_grow_cache(int tries) +void +vm_contig_grow_cache(int tries, vm_paddr_t low, vm_paddr_t high) { int actl, actmax, inactl, inactmax; @@ -214,11 +217,11 @@ vm_contig_grow_cache(int tries) actl = 0; actmax = tries < 2 ? 0 : cnt.v_active_count; again: - if (inactl < inactmax && vm_contig_launder(PQ_INACTIVE)) { + if (inactl < inactmax && vm_contig_launder(PQ_INACTIVE, low, high)) { inactl++; goto again; } - if (actl < actmax && vm_contig_launder(PQ_ACTIVE)) { + if (actl < actmax && vm_contig_launder(PQ_ACTIVE, low, high)) { actl++; goto again; } @@ -261,7 +264,7 @@ retry: if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { VM_OBJECT_UNLOCK(object); vm_map_unlock(map); - vm_contig_grow_cache(tries); + vm_contig_grow_cache(tries, low, high); vm_map_lock(map); VM_OBJECT_LOCK(object); goto retry; @@ -368,7 +371,7 @@ retry: pages = vm_phys_alloc_contig(npgs, low, high, alignment, boundary); if (pages == NULL) { if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { - vm_contig_grow_cache(tries); + vm_contig_grow_cache(tries, low, high); tries++; goto retry; } Modified: head/sys/vm/vm_pageout.h ============================================================================== --- head/sys/vm/vm_pageout.h Thu Jun 3 21:12:51 2010 (r208793) +++ head/sys/vm/vm_pageout.h Fri Jun 4 06:35:36 2010 (r208794) @@ -105,5 +105,6 @@ boolean_t vm_pageout_fallback_object_loc int vm_pageout_flush(vm_page_t *, int, int); void vm_pageout_oom(int shortage); boolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *); +void vm_contig_grow_cache(int, vm_paddr_t, vm_paddr_t); #endif #endif /* _VM_VM_PAGEOUT_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 06:56:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 054B110656C7; Fri, 4 Jun 2010 06:56:59 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E90BD8FC3E; Fri, 4 Jun 2010 06:56: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 o546uw9X023425; Fri, 4 Jun 2010 06:56:58 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o546uw4R023423; Fri, 4 Jun 2010 06:56:58 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <201006040656.o546uw4R023423@svn.freebsd.org> From: Brian Somers Date: Fri, 4 Jun 2010 06:56:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208795 - head/bin/date X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 06:56:59 -0000 Author: brian Date: Fri Jun 4 06:56:58 2010 New Revision: 208795 URL: http://svn.freebsd.org/changeset/base/208795 Log: Explain that setting an absolute day value can fail and that the month should usually be set first when using -v. Adjust an example that sets the day to 30 before setting the month to 3 in accordance with this approach as the example would always fail in February! PR: 147354 MFC after: 2 weeks Modified: head/bin/date/date.1 Modified: head/bin/date/date.1 ============================================================================== --- head/bin/date/date.1 Fri Jun 4 06:35:36 2010 (r208794) +++ head/bin/date/date.1 Fri Jun 4 06:56:58 2010 (r208795) @@ -32,7 +32,7 @@ .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd June 2, 2007 +.Dd June 3, 2010 .Dt DATE 1 .Os .Sh NAME @@ -219,6 +219,14 @@ When the date is adjusted to a specific the resulting timezone will be set so that the date matches the earlier of the two times. .Pp +It is not possible to adjust a date to an invalid absolute day, so using +the switches +.Fl v No 31d Fl v No 12m +will simply fail five months of the year. +It is therefore usual to set the month before setting the day; using +.Fl v No 12m Fl v No 31d +always works. +.Pp Adjusting the date by months is inherently ambiguous because a month is a unit of variable length depending on the current date. This kind of date adjustment is applied in the most intuitive way. @@ -339,9 +347,9 @@ will display the last day of February in .Pp .Dl "Tue Feb 29 03:18:00 GMT 2000" .Pp -So will do the command: +So will the command: .Pp -.Dl "date -v30d -v3m -v0y -v-1m" +.Dl "date -v3m -v30d -v0y -v-1m" .Pp because there is no such date as the 30th of February. .Pp From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 07:36:00 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1651B1065676; Fri, 4 Jun 2010 07:36:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E01B58FC13; Fri, 4 Jun 2010 07:35: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 o547ZxLx031990; Fri, 4 Jun 2010 07:35:59 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o547ZxA2031988; Fri, 4 Jun 2010 07:35:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006040735.o547ZxA2031988@svn.freebsd.org> From: Alexander Motin Date: Fri, 4 Jun 2010 07:35: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: r208796 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 07:36:00 -0000 Author: mav Date: Fri Jun 4 07:35:59 2010 New Revision: 208796 URL: http://svn.freebsd.org/changeset/base/208796 Log: Fix PCH chipset IDs. They are 0x3bxx, not 0x3axx. Pointy hat to: me Modified: head/sys/dev/ata/chipsets/ata-intel.c Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Fri Jun 4 06:56:58 2010 (r208795) +++ head/sys/dev/ata/chipsets/ata-intel.c Fri Jun 4 07:35:59 2010 (r208796) @@ -140,22 +140,22 @@ 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" }, - { 0x3a208086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a218086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a228086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a238086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a248086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a258086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a268086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a278086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a288086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a298086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a2a8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a2b8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a2c8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a2d8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a2e8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, - { 0x3a2f8086, 0, INTEL_AHCI, 0, ATA_SA300, "PCH" }, + { 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_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-head@FreeBSD.ORG Fri Jun 4 08:14:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 651F41065670; Fri, 4 Jun 2010 08:14:30 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 544608FC0C; Fri, 4 Jun 2010 08:14: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 o548EU4W040380; Fri, 4 Jun 2010 08:14:30 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o548EU1b040378; Fri, 4 Jun 2010 08:14:30 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201006040814.o548EU1b040378@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 4 Jun 2010 08:14: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: r208797 - head/tools/regression/usr.bin/make/syntax/directive-t0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 08:14:30 -0000 Author: maxim Date: Fri Jun 4 08:14:30 2010 New Revision: 208797 URL: http://svn.freebsd.org/changeset/base/208797 Log: o Fix typo: .uudef -> .undef. PR: misc/147462 Submitted by: Erik Cederstrand Modified: head/tools/regression/usr.bin/make/syntax/directive-t0/Makefile Modified: head/tools/regression/usr.bin/make/syntax/directive-t0/Makefile ============================================================================== --- head/tools/regression/usr.bin/make/syntax/directive-t0/Makefile Fri Jun 4 07:35:59 2010 (r208796) +++ head/tools/regression/usr.bin/make/syntax/directive-t0/Makefile Fri Jun 4 08:14:30 2010 (r208797) @@ -3,6 +3,6 @@ # A typo'ed directive. # -.uudef foo +.undef foo all: From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 08:19:43 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8EBA106566C; Fri, 4 Jun 2010 08:19:43 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D88908FC25; Fri, 4 Jun 2010 08:19: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 o548JhF1041575; Fri, 4 Jun 2010 08:19:43 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o548JhkP041573; Fri, 4 Jun 2010 08:19:43 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201006040819.o548JhkP041573@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 4 Jun 2010 08:19: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: r208798 - head/tools/regression/fstest X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 08:19:44 -0000 Author: maxim Date: Fri Jun 4 08:19:43 2010 New Revision: 208798 URL: http://svn.freebsd.org/changeset/base/208798 Log: o Makefile BSDfication. PR: misc/147461 (with my changes) Submitted by: Erik Cederstrand Modified: head/tools/regression/fstest/Makefile Modified: head/tools/regression/fstest/Makefile ============================================================================== --- head/tools/regression/fstest/Makefile Fri Jun 4 08:14:30 2010 (r208797) +++ head/tools/regression/fstest/Makefile Fri Jun 4 08:19:43 2010 (r208798) @@ -1,31 +1,25 @@ # $FreeBSD$ -OSTYPE=$(shell uname) +PROG= fstest +NO_MAN= -ifeq "${OSTYPE}" "FreeBSD" -CFLAGS += -D__OS_FreeBSD__ -CFLAGS += -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -endif - -ifeq "${OSTYPE}" "SunOS" -CFLAGS += -D__OS_Solaris__ -CFLAGS += -DHAS_TRUNCATE64 -DHAS_STAT64 -endif - -ifeq "${OSTYPE}" "Darwin" -CFLAGS += -D__OS_Darwin__ -CFLAGS += -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS -endif - -ifeq "${OSTYPE}" "Linux" -CFLAGS += -D__OS_Linux__ -CFLAGS += -D_GNU_SOURCE -endif +OSTYPE!= uname -all: fstest +.if ${OSTYPE} == "FreeBSD" +CFLAGS+= -D__OS_FreeBSD__ +CFLAGS+= -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -fstest: fstest.c - gcc -Wall ${CFLAGS} fstest.c -o fstest +.elif ${OSTYPE} == "SunOS" +CFLAGS+= -D__OS_Solaris__ +CFLAGS+= -DHAS_TRUNCATE64 -DHAS_STAT64 -clean: - rm -f fstest +.elif ${OSTYPE} == "Darwin" +CFLAGS+= -D__OS_Darwin__ +CFLAGS+= -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_LCHFLAGS + +.elif ${OSTYPE} == "Linux" +CFLAGS+= -D__OS_Linux__ +CFLAGS+= -D_GNU_SOURCE +.endif + +.include From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 13:55:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E121A1065673; Fri, 4 Jun 2010 13:55:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0D868FC0C; Fri, 4 Jun 2010 13:55: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 o54Dttde020019; Fri, 4 Jun 2010 13:55:55 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o54DttWq020017; Fri, 4 Jun 2010 13:55:55 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201006041355.o54DttWq020017@svn.freebsd.org> From: Andriy Gapon Date: Fri, 4 Jun 2010 13:55: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: r208800 - head/sys/cam/scsi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 13:55:56 -0000 Author: avg Date: Fri Jun 4 13:55:55 2010 New Revision: 208800 URL: http://svn.freebsd.org/changeset/base/208800 Log: scsi_cd: pass correct pointer to free() Found with: Coverity Prevent(tm) CID: 2986 MFC after: 4 days Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Fri Jun 4 08:46:26 2010 (r208799) +++ head/sys/cam/scsi/scsi_cd.c Fri Jun 4 13:55:55 2010 (r208800) @@ -2528,7 +2528,7 @@ cdioctl(struct disk *dp, u_long cmd, voi error = cdgetmode(periph, ¶ms, AUDIO_PAGE); if (error) { - free(¶ms.mode_buf, M_SCSICD); + free(params.mode_buf, M_SCSICD); cam_periph_unlock(periph); break; } From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 14:22:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17E791065676; Fri, 4 Jun 2010 14:22:50 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06D908FC25; Fri, 4 Jun 2010 14:22: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 o54EMnpF026039; Fri, 4 Jun 2010 14:22:49 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o54EMnun026037; Fri, 4 Jun 2010 14:22:49 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <201006041422.o54EMnun026037@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 4 Jun 2010 14:22: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: r208802 - head/tools/regression/usr.bin/make/syntax/directive-t0 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 14:22:50 -0000 Author: maxim Date: Fri Jun 4 14:22:49 2010 New Revision: 208802 URL: http://svn.freebsd.org/changeset/base/208802 Log: o The typo was intended as it stated in the comment. Revert last. Spotted by: dfr Modified: head/tools/regression/usr.bin/make/syntax/directive-t0/Makefile Modified: head/tools/regression/usr.bin/make/syntax/directive-t0/Makefile ============================================================================== --- head/tools/regression/usr.bin/make/syntax/directive-t0/Makefile Fri Jun 4 14:06:59 2010 (r208801) +++ head/tools/regression/usr.bin/make/syntax/directive-t0/Makefile Fri Jun 4 14:22:49 2010 (r208802) @@ -3,6 +3,6 @@ # A typo'ed directive. # -.undef foo +.uudef foo all: From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 14:38:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E0AF1065675; Fri, 4 Jun 2010 14:38:25 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F18718FC08; Fri, 4 Jun 2010 14:38: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 o54EcOLJ029451; Fri, 4 Jun 2010 14:38:24 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o54EcO3a029449; Fri, 4 Jun 2010 14:38:24 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201006041438.o54EcO3a029449@svn.freebsd.org> From: Colin Percival Date: Fri, 4 Jun 2010 14:38: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: r208803 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 14:38:25 -0000 Author: cperciva Date: Fri Jun 4 14:38:24 2010 New Revision: 208803 URL: http://svn.freebsd.org/changeset/base/208803 Log: Declare ip6 as (struct in6_addr *) instead of (struct in_addr *). This is a harmless bug since we never actually use ip6 as anything other than an opaque pointer. Found with: Coverty Prevent(tm) CID: 4319 MFC after: 1 month Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Fri Jun 4 14:22:49 2010 (r208802) +++ head/sys/kern/kern_jail.c Fri Jun 4 14:38:24 2010 (r208803) @@ -3941,7 +3941,7 @@ sysctl_jail_list(SYSCTL_HANDLER_ARGS) int ip4s = 0; #endif #ifdef INET6 - struct in_addr *ip6 = NULL; + struct in6_addr *ip6 = NULL; int ip6s = 0; #endif int descend, error; From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 14:40:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0E121065677; Fri, 4 Jun 2010 14:40:03 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 7D07E8FC12; Fri, 4 Jun 2010 14:40:03 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 2447146B9D; Fri, 4 Jun 2010 10:40:03 -0400 (EDT) Date: Fri, 4 Jun 2010 15:40:02 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Edward Tomasz Napierala In-Reply-To: <201006031341.o53DftKm094269@svn.freebsd.org> Message-ID: References: <201006031341.o53DftKm094269@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r208779 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 14:40:03 -0000 On Thu, 3 Jun 2010, Edward Tomasz Napierala wrote: > Author: trasz > Date: Thu Jun 3 13:41:55 2010 > New Revision: 208779 > URL: http://svn.freebsd.org/changeset/base/208779 > > Log: > The acl_cnt field is unsigned; no point in checking if it's >= 0. I'd originally left these checks in despite the Coverity warnings to make the code robust against developer changes that might include making acl_cnt signed. I'd prefer to put a compile-time assertion in, needless to say, and recommend that, since they've been removed, we add one. Robert > > Found with: Coverity Prevent > CID: 3683 > > Modified: > head/sys/kern/subr_acl_nfs4.c > > Modified: head/sys/kern/subr_acl_nfs4.c > ============================================================================== > --- head/sys/kern/subr_acl_nfs4.c Thu Jun 3 13:04:56 2010 (r208778) > +++ head/sys/kern/subr_acl_nfs4.c Thu Jun 3 13:41:55 2010 (r208779) > @@ -342,7 +342,6 @@ acl_nfs4_sync_acl_from_mode(struct acl * > const int WRITE = 02; > const int EXEC = 01; > > - KASSERT(aclp->acl_cnt >= 0, ("aclp->acl_cnt >= 0")); > KASSERT(aclp->acl_cnt <= ACL_MAX_ENTRIES, > ("aclp->acl_cnt <= ACL_MAX_ENTRIES")); > > From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 16:31:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C98AD1065764 for ; Fri, 4 Jun 2010 16:31:11 +0000 (UTC) (envelope-from alexbestms@uni-muenster.de) Received: from SECMAIL.UNI-MUENSTER.DE (SECMAIL.UNI-MUENSTER.DE [128.176.192.141]) by mx1.freebsd.org (Postfix) with ESMTP id 87E958FC22 for ; Fri, 4 Jun 2010 16:31:11 +0000 (UTC) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTP id 863F1BF407; Fri, 4 Jun 2010 18:31:09 +0200 (CEST) Received: by gwj23 with SMTP id 23so1340893gwj.13 for ; Fri, 04 Jun 2010 09:31:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.117.41 with SMTP id p41mr8262273ybc.439.1275669066749; Fri, 04 Jun 2010 09:31:06 -0700 (PDT) Received: by 10.150.178.13 with HTTP; Fri, 4 Jun 2010 09:31:06 -0700 (PDT) Date: Fri, 4 Jun 2010 18:31:06 +0200 Message-ID: From: Alexander Best To: svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: Ulrich Spoerlein Subject: svn commit: r208753 - head/contrib/gdtoa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 16:31:11 -0000 thanks a lot. :) -- Alexander Best From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 17:11:34 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 203BB1065677; Fri, 4 Jun 2010 17:11:34 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F4578FC18; Fri, 4 Jun 2010 17:11: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 o54HBXIi063296; Fri, 4 Jun 2010 17:11:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o54HBXlK063294; Fri, 4 Jun 2010 17:11:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201006041711.o54HBXlK063294@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 4 Jun 2010 17:11: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: r208806 - head/sys/dev/sge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 17:11:34 -0000 Author: yongari Date: Fri Jun 4 17:11:33 2010 New Revision: 208806 URL: http://svn.freebsd.org/changeset/base/208806 Log: Don't blindly set IFF_DRV_OACTIVE when sge_encap() fails. If there is no queued frame, IFF_DRV_OACTIVE would never be cleared. Submitted by: Nikolay Denev < ndenev <> gmail at com > MFC after: 4 days Modified: head/sys/dev/sge/if_sge.c Modified: head/sys/dev/sge/if_sge.c ============================================================================== --- head/sys/dev/sge/if_sge.c Fri Jun 4 17:02:12 2010 (r208805) +++ head/sys/dev/sge/if_sge.c Fri Jun 4 17:11:33 2010 (r208806) @@ -1588,8 +1588,9 @@ sge_start_locked(struct ifnet *ifp) if (m_head == NULL) break; if (sge_encap(sc, &m_head)) { - if (m_head != NULL) - IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (m_head == NULL) + break; + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } From owner-svn-src-head@FreeBSD.ORG Fri Jun 4 17:54:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6840C106567C; Fri, 4 Jun 2010 17:54:31 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 332188FC27; Fri, 4 Jun 2010 17:54: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 o54HsUXE072736; Fri, 4 Jun 2010 17:54:30 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o54HsU07072733; Fri, 4 Jun 2010 17:54:30 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201006041754.o54HsU07072733@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 4 Jun 2010 17:54: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: r208807 - in head: share/misc usr.bin/calendar/calendars X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2010 17:54:31 -0000 Author: mdf Date: Fri Jun 4 17:54:30 2010 New Revision: 208807 URL: http://svn.freebsd.org/changeset/base/208807 Log: - Add myself to committers-src.dot - Add myself to calendar.freebsd Approved by: zml (mentor) Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Fri Jun 4 17:11:33 2010 (r208806) +++ head/share/misc/committers-src.dot Fri Jun 4 17:54:30 2010 (r208807) @@ -142,6 +142,7 @@ markus [label="Markus Brueffer\nmarkus@F matteo [label="Matteo Riondato\nmatteo@FreeBSD.org\n2006/01/18"] mav [label="Alexander Motin\nmav@FreeBSD.org\n2007/04/12"] maxim [label="Maxim Konovalov\nmaxim@FreeBSD.org\n2002/02/07"] +mdf [label="Matthew Fleming\nmdf@FreeBSD.org\n2010/06/04"] mjacob [label="Matt Jacob\nmjacob@FreeBSD.org\n1997/08/13"] mlaier [label="Max Laier\nmlaier@FreeBSD.org\n2004/02/10"] mr [label="Michael Reifenberger\nmr@FreeBSD.org\n2001/09/30"] @@ -486,4 +487,6 @@ wes -> scf wollman -> gad +zml -> mdf + } Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Jun 4 17:11:33 2010 (r208806) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Jun 4 17:54:30 2010 (r208807) @@ -254,6 +254,7 @@ 09/12 Benedict Christopher Reuschling born in Darmstadt, Germany, 1981 09/15 Dima Panov born in Khabarovsk, Russian Federation, 1978 09/17 Maxim Bolotin born in Rostov-on-Don, Russian Federation, 1976 +09/18 Matthew Fleming born in Cleveland, Ohio, United States, 1975 09/20 Kevin Lo born in Taipei, Taiwan, Republic of China, 1972 09/27 Neil Blakey-Milner born in Port Elizabeth, South Africa, 1978 09/27 Renato Botelho born in Araras, Sao Paulo, Brazil, 1979 From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 00:55:22 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84AC4106566C; Sat, 5 Jun 2010 00:55:22 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7572F8FC0A; Sat, 5 Jun 2010 00:55: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 o550tMR0064800; Sat, 5 Jun 2010 00:55:22 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o550tMuA064798; Sat, 5 Jun 2010 00:55:22 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201006050055.o550tMuA064798@svn.freebsd.org> From: Matt Jacob Date: Sat, 5 Jun 2010 00:55: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: r208808 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 00:55:22 -0000 Author: mjacob Date: Sat Jun 5 00:55:21 2010 New Revision: 208808 URL: http://svn.freebsd.org/changeset/base/208808 Log: I was getting panics in sleepq_add for the second sleep in isp_kthread. I don't know why- but it occurred to me in looking at the second sleep is that all I want is a pause- not an actual sleep. So do that instead. MFC after: 2 weeks Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Fri Jun 4 17:54:30 2010 (r208807) +++ head/sys/dev/isp/isp_freebsd.c Sat Jun 5 00:55:21 2010 (r208808) @@ -4139,7 +4139,9 @@ isp_kthread(void *arg) */ if (slp == 0 && fc->hysteresis) { isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "%s: Chan %d sleep hysteresis ticks %d", __func__, chan, fc->hysteresis * hz); - (void) msleep(&isp_fabric_hysteresis, &isp->isp_osinfo.lock, PRIBIO, "ispT", (fc->hysteresis * hz)); + mtx_unlock(&isp->isp_osinfo.lock); + pause("ispt", fc->hysteresis * hz); + mtx_lock(&isp->isp_osinfo.lock); } } mtx_unlock(&isp->isp_osinfo.lock); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 00:56:15 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFF281065672; Sat, 5 Jun 2010 00:56:15 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D11EF8FC0A; Sat, 5 Jun 2010 00:56: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 o550uFT0065032; Sat, 5 Jun 2010 00:56:15 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o550uFS4065030; Sat, 5 Jun 2010 00:56:15 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201006050056.o550uFS4065030@svn.freebsd.org> From: Matt Jacob Date: Sat, 5 Jun 2010 00:56: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: r208809 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 00:56:16 -0000 Author: mjacob Date: Sat Jun 5 00:56:15 2010 New Revision: 208809 URL: http://svn.freebsd.org/changeset/base/208809 Log: Make the internal target > SPC2 (so REPORT LUNS can be tested). Give the NIL inquiry data real values other than just plain 0x7f in the first byte. MFC after: 2 weeks Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Sat Jun 5 00:55:21 2010 (r208808) +++ head/sys/dev/isp/isp_freebsd.c Sat Jun 5 00:56:15 2010 (r208809) @@ -3039,9 +3039,15 @@ isptargnotify(ispsoftc_t *isp, union ccb static void isptargstart(struct cam_periph *periph, union ccb *iccb) { - const uint8_t niliqd[SHORT_INQUIRY_LENGTH] = { 0x7f }; + const uint8_t niliqd[SHORT_INQUIRY_LENGTH] = { + 0x7f, 0x0, 0x5, 0x2, 32, 0, 0, 0x32, + 'F', 'R', 'E', 'E', 'B', 'S', 'D', ' ', + 'S', 'C', 'S', 'I', ' ', 'N', 'U', 'L', + 'L', ' ', 'D', 'E', 'V', 'I', 'C', 'E', + '0', '0', '0', '1' + }; const uint8_t iqd[SHORT_INQUIRY_LENGTH] = { - 0, 0x0, 0x2, 0x2, 32, 0, 0, 0x32, + 0, 0x0, 0x5, 0x2, 32, 0, 0, 0x32, 'F', 'R', 'E', 'E', 'B', 'S', 'D', ' ', 'S', 'C', 'S', 'I', ' ', 'M', 'E', 'M', 'O', 'R', 'Y', ' ', 'D', 'I', 'S', 'K', From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 06:56:06 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1E8D1065675; Sat, 5 Jun 2010 06:56:06 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B1778FC14; Sat, 5 Jun 2010 06:56: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 o556u6pm043692; Sat, 5 Jun 2010 06:56:06 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o556u6Sh043689; Sat, 5 Jun 2010 06:56:06 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006050656.o556u6Sh043689@svn.freebsd.org> From: Alan Cox Date: Sat, 5 Jun 2010 06:56: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: r208810 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 06:56:06 -0000 Author: alc Date: Sat Jun 5 06:56:06 2010 New Revision: 208810 URL: http://svn.freebsd.org/changeset/base/208810 Log: Don't set PG_WRITEABLE in pmap_enter() unless the page is managed. Modified: head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Sat Jun 5 00:56:15 2010 (r208809) +++ head/sys/powerpc/aim/mmu_oea.c Sat Jun 5 06:56:06 2010 (r208810) @@ -1140,7 +1140,8 @@ moea_enter_locked(pmap_t pmap, vm_offset if (prot & VM_PROT_WRITE) { pte_lo |= PTE_BW; - if (pmap_bootstrapped) + if (pmap_bootstrapped && + (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) vm_page_flag_set(m, PG_WRITEABLE); } else pte_lo |= PTE_BR; Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Jun 5 00:56:15 2010 (r208809) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Jun 5 06:56:06 2010 (r208810) @@ -1249,7 +1249,8 @@ moea64_enter_locked(pmap_t pmap, vm_offs if (prot & VM_PROT_WRITE) { pte_lo |= LPTE_BW; - if (pmap_bootstrapped) + if (pmap_bootstrapped && + (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) vm_page_flag_set(m, PG_WRITEABLE); } else pte_lo |= LPTE_BR; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 07:40:33 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FF9C106564A; Sat, 5 Jun 2010 07:40:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F4E58FC13; Sat, 5 Jun 2010 07:40: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 o557eX1E053375; Sat, 5 Jun 2010 07:40:33 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o557eX2O053373; Sat, 5 Jun 2010 07:40:33 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006050740.o557eX2O053373@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 5 Jun 2010 07:40: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: r208811 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 07:40:33 -0000 Author: trasz Date: Sat Jun 5 07:40:32 2010 New Revision: 208811 URL: http://svn.freebsd.org/changeset/base/208811 Log: Don't use pointer to 64 bit value (id_t) to point to 32 bit value (uid_t). Found with: Coverity Prevent CID: 7466, 7467 MFC after: 2 weeks Modified: head/lib/libc/posix1e/acl_to_text_nfs4.c Modified: head/lib/libc/posix1e/acl_to_text_nfs4.c ============================================================================== --- head/lib/libc/posix1e/acl_to_text_nfs4.c Sat Jun 5 06:56:06 2010 (r208810) +++ head/lib/libc/posix1e/acl_to_text_nfs4.c Sat Jun 5 07:40:32 2010 (r208811) @@ -50,7 +50,7 @@ format_who(char *str, size_t size, const acl_tag_t tag; struct passwd *pwd; struct group *grp; - id_t *id; + uid_t *id; error = acl_get_tag_type(entry, &tag); if (error) @@ -62,7 +62,7 @@ format_who(char *str, size_t size, const break; case ACL_USER: - id = (id_t *)acl_get_qualifier(entry); + id = (uid_t *)acl_get_qualifier(entry); if (id == NULL) return (-1); /* XXX: Thread-unsafe. */ @@ -81,7 +81,7 @@ format_who(char *str, size_t size, const break; case ACL_GROUP: - id = (id_t *)acl_get_qualifier(entry); + id = (uid_t *)acl_get_qualifier(entry); if (id == NULL) return (-1); /* XXX: Thread-unsafe. */ @@ -141,7 +141,7 @@ format_additional_id(char *str, size_t s { int error; acl_tag_t tag; - id_t *id; + uid_t *id; error = acl_get_tag_type(entry, &tag); if (error) @@ -155,7 +155,7 @@ format_additional_id(char *str, size_t s break; default: - id = (id_t *)acl_get_qualifier(entry); + id = (uid_t *)acl_get_qualifier(entry); if (id == NULL) return (-1); snprintf(str, size, ":%d", (unsigned int)*id); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:00:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42F04106564A; Sat, 5 Jun 2010 08:00:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 328718FC0C; Sat, 5 Jun 2010 08:00: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 o5580rsP058018; Sat, 5 Jun 2010 08:00:53 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5580rr7058016; Sat, 5 Jun 2010 08:00:53 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006050800.o5580rr7058016@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 5 Jun 2010 08:00: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: r208812 - head/sys/geom/mountver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:00:53 -0000 Author: trasz Date: Sat Jun 5 08:00:52 2010 New Revision: 208812 URL: http://svn.freebsd.org/changeset/base/208812 Log: Make sure not to pass NULL to g_orphan_provider(). Found with: Coverity Prevent CID: 3411 Modified: head/sys/geom/mountver/g_mountver.c Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Sat Jun 5 07:40:32 2010 (r208811) +++ head/sys/geom/mountver/g_mountver.c Sat Jun 5 08:00:52 2010 (r208812) @@ -343,7 +343,8 @@ g_mountver_destroy(struct g_geom *gp, bo } else { G_MOUNTVER_DEBUG(0, "Device %s removed.", gp->name); } - g_orphan_provider(pp, ENXIO); + if (pp != NULL) + g_orphan_provider(pp, ENXIO); g_mountver_discard_queued(gp); g_free(sc->sc_provider_name); g_free(gp->softc); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:02:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0DBA106566C; Sat, 5 Jun 2010 08:02:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90B6B8FC16; Sat, 5 Jun 2010 08:02: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 o5582JlS058366; Sat, 5 Jun 2010 08:02:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5582JuT058363; Sat, 5 Jun 2010 08:02:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050802.o5582JuT058363@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:02: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: r208813 - head/sys/dev/ahci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:02:19 -0000 Author: mav Date: Sat Jun 5 08:02:19 2010 New Revision: 208813 URL: http://svn.freebsd.org/changeset/base/208813 Log: Fix attach errors handling. Found with: Coverity Prevent(tm) CID: 3424 Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sat Jun 5 08:00:52 2010 (r208812) +++ head/sys/dev/ahci/ahci.c Sat Jun 5 08:02:19 2010 (r208813) @@ -898,9 +898,9 @@ ahci_ch_attach(device_t dev) rid = ATA_IRQ_RID; if (!(ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE))) { - bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); device_printf(dev, "Unable to map interrupt\n"); - return (ENXIO); + error = ENXIO; + goto err0; } if ((bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL, ahci_ch_intr_locked, dev, &ch->ih))) { @@ -934,9 +934,10 @@ ahci_ch_attach(device_t dev) (ch->caps & AHCI_CAP_SNCQ) ? ch->numslots : 0, devq); if (ch->sim == NULL) { + cam_simq_free(devq); device_printf(dev, "unable to allocate sim\n"); error = ENOMEM; - goto err2; + goto err1; } if (xpt_bus_register(ch->sim, dev, 0) != CAM_SUCCESS) { device_printf(dev, "unable to register xpt bus\n"); @@ -963,6 +964,7 @@ err2: cam_sim_free(ch->sim, /*free_devq*/TRUE); err1: bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); +err0: bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); mtx_unlock(&ch->mtx); return (error); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:07:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCF731065679; Sat, 5 Jun 2010 08:07:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACD5B8FC22; Sat, 5 Jun 2010 08:07: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 o5587spu059616; Sat, 5 Jun 2010 08:07:54 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5587sQ7059614; Sat, 5 Jun 2010 08:07:54 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050807.o5587sQ7059614@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:07: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: r208814 - head/sys/dev/ahci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:07:54 -0000 Author: mav Date: Sat Jun 5 08:07:54 2010 New Revision: 208814 URL: http://svn.freebsd.org/changeset/base/208814 Log: Plug memory leak to silent Coverity. Error is still not really handled. Found with: Coverity Prevent(tm) CID: 4130 Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Sat Jun 5 08:02:19 2010 (r208813) +++ head/sys/dev/ahci/ahci.c Sat Jun 5 08:07:54 2010 (r208814) @@ -2047,6 +2047,7 @@ ahci_issue_read_log(device_t dev) ataio = &ccb->ataio; ataio->data_ptr = malloc(512, M_AHCI, M_NOWAIT); if (ataio->data_ptr == NULL) { + xpt_free_ccb(ccb); device_printf(dev, "Unable allocate memory for READ LOG command"); return; /* XXX */ } From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:11:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F90F106564A; Sat, 5 Jun 2010 08:11:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F7CD8FC22; Sat, 5 Jun 2010 08:11: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 o558BB3x060396; Sat, 5 Jun 2010 08:11:11 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558BB1w060394; Sat, 5 Jun 2010 08:11:11 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006050811.o558BB1w060394@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 5 Jun 2010 08:11: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: r208815 - head/usr.sbin/chown X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:11:11 -0000 Author: trasz Date: Sat Jun 5 08:11:11 2010 New Revision: 208815 URL: http://svn.freebsd.org/changeset/base/208815 Log: Plug resource leak. Found with: Coverity Prevent CID: 7040 Modified: head/usr.sbin/chown/chown.c Modified: head/usr.sbin/chown/chown.c ============================================================================== --- head/usr.sbin/chown/chown.c Sat Jun 5 08:07:54 2010 (r208814) +++ head/usr.sbin/chown/chown.c Sat Jun 5 08:11:11 2010 (r208815) @@ -290,6 +290,7 @@ chownerr(const char *file) err(1, "malloc"); ngroups = getgroups(ngroups_max, groups); while (--ngroups >= 0 && gid != groups[ngroups]); + free(groups); if (ngroups < 0) { warnx("you are not a member of group %s", gname); return; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:14:19 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B5D11065674; Sat, 5 Jun 2010 08:14:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B4968FC1C; Sat, 5 Jun 2010 08:14: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 o558EJhX061179; Sat, 5 Jun 2010 08:14:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558EJ9K061177; Sat, 5 Jun 2010 08:14:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050814.o558EJ9K061177@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:14:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208816 - head/sys/dev/siis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:14:19 -0000 Author: mav Date: Sat Jun 5 08:14:19 2010 New Revision: 208816 URL: http://svn.freebsd.org/changeset/base/208816 Log: Fix attach errors handling. Found with: Coverity Prevent(tm) CID: 3477 Modified: head/sys/dev/siis/siis.c Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Sat Jun 5 08:11:11 2010 (r208815) +++ head/sys/dev/siis/siis.c Sat Jun 5 08:14:19 2010 (r208816) @@ -478,9 +478,9 @@ siis_ch_attach(device_t dev) rid = ATA_IRQ_RID; if (!(ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE))) { - bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); device_printf(dev, "Unable to map interrupt\n"); - return (ENXIO); + error = ENXIO; + goto err0; } if ((bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL, siis_ch_intr_locked, dev, &ch->ih))) { @@ -499,9 +499,10 @@ siis_ch_attach(device_t dev) ch->sim = cam_sim_alloc(siisaction, siispoll, "siisch", ch, device_get_unit(dev), &ch->mtx, 2, SIIS_MAX_SLOTS, devq); if (ch->sim == NULL) { + cam_simq_free(devq); device_printf(dev, "unable to allocate sim\n"); error = ENOMEM; - goto err2; + goto err1; } if (xpt_bus_register(ch->sim, dev, 0) != CAM_SUCCESS) { device_printf(dev, "unable to register xpt bus\n"); @@ -523,6 +524,7 @@ err2: cam_sim_free(ch->sim, /*free_devq*/TRUE); err1: bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); +err0: bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem); mtx_unlock(&ch->mtx); return (error); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:16:21 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAF88106566C; Sat, 5 Jun 2010 08:16:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B18D8FC16; Sat, 5 Jun 2010 08:16: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 o558GLjd061690; Sat, 5 Jun 2010 08:16:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558GLhb061688; Sat, 5 Jun 2010 08:16:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050816.o558GLhb061688@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:16: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: r208817 - head/sys/dev/siis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:16:21 -0000 Author: mav Date: Sat Jun 5 08:16:21 2010 New Revision: 208817 URL: http://svn.freebsd.org/changeset/base/208817 Log: Plug memory leak to silent Coverity. Error is still not really handled. Found with: Coverity Prevent(tm) CID: 4196 Modified: head/sys/dev/siis/siis.c Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Sat Jun 5 08:14:19 2010 (r208816) +++ head/sys/dev/siis/siis.c Sat Jun 5 08:16:21 2010 (r208817) @@ -1338,6 +1338,7 @@ siis_issue_read_log(device_t dev) ataio = &ccb->ataio; ataio->data_ptr = malloc(512, M_SIIS, M_NOWAIT); if (ataio->data_ptr == NULL) { + xpt_free_ccb(ccb); device_printf(dev, "Unable allocate memory for READ LOG command"); return; /* XXX */ } From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:21:18 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 899A3106566B; Sat, 5 Jun 2010 08:21:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 79C948FC1B; Sat, 5 Jun 2010 08:21: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 o558LI1Q062794; Sat, 5 Jun 2010 08:21:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558LIDP062792; Sat, 5 Jun 2010 08:21:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050821.o558LIDP062792@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:21: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: r208818 - head/sys/dev/mvs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:21:18 -0000 Author: mav Date: Sat Jun 5 08:21:18 2010 New Revision: 208818 URL: http://svn.freebsd.org/changeset/base/208818 Log: Plug memory leak to silent Coverity. Error is still not really handled. Found with: Coverity Prevent(tm) CID: 4137 Modified: head/sys/dev/mvs/mvs.c Modified: head/sys/dev/mvs/mvs.c ============================================================================== --- head/sys/dev/mvs/mvs.c Sat Jun 5 08:16:21 2010 (r208817) +++ head/sys/dev/mvs/mvs.c Sat Jun 5 08:21:18 2010 (r208818) @@ -1727,6 +1727,7 @@ mvs_issue_read_log(device_t dev) ataio = &ccb->ataio; ataio->data_ptr = malloc(512, M_MVS, M_NOWAIT); if (ataio->data_ptr == NULL) { + xpt_free_ccb(ccb); device_printf(dev, "Unable allocate memory for READ LOG command"); return; /* XXX */ } From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:36:38 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CD8C1065670; Sat, 5 Jun 2010 08:36:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CD0D8FC14; Sat, 5 Jun 2010 08:36: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 o558acjk066161; Sat, 5 Jun 2010 08:36:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558acgp066159; Sat, 5 Jun 2010 08:36:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050836.o558acgp066159@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208819 - head/sys/cam/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:36:38 -0000 Author: mav Date: Sat Jun 5 08:36:37 2010 New Revision: 208819 URL: http://svn.freebsd.org/changeset/base/208819 Log: Fix double free on error. Found with: Coverity Prevent(tm) CID: 4573 Modified: head/sys/cam/ata/ata_pmp.c Modified: head/sys/cam/ata/ata_pmp.c ============================================================================== --- head/sys/cam/ata/ata_pmp.c Sat Jun 5 08:21:18 2010 (r208818) +++ head/sys/cam/ata/ata_pmp.c Sat Jun 5 08:36:37 2010 (r208819) @@ -737,10 +737,8 @@ pmpdone(struct cam_periph *periph, union if (xpt_create_path(&dpath, periph, xpt_path_path_id(periph->path), i, 0) != CAM_REQ_CMP) { - printf("pmpdone: xpt_create_path failed" - ", bus scan halted\n"); - xpt_free_ccb(done_ccb); - goto done; + printf("pmpdone: xpt_create_path failed\n"); + continue; } /* If we did hard reset to this device, inform XPT. */ if ((softc->reset & softc->found & (1 << i)) != 0) From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:44:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D1661065674; Sat, 5 Jun 2010 08:44:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D2A48FC1A; Sat, 5 Jun 2010 08:44: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 o558iefH068053; Sat, 5 Jun 2010 08:44:40 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558iepw068051; Sat, 5 Jun 2010 08:44:40 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050844.o558iepw068051@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:44: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: r208820 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:44:40 -0000 Author: mav Date: Sat Jun 5 08:44:40 2010 New Revision: 208820 URL: http://svn.freebsd.org/changeset/base/208820 Log: Fix use after free on error. Found with: Coverity Prevent(tm) CID: 4722 Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Sat Jun 5 08:36:37 2010 (r208819) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Sat Jun 5 08:44:40 2010 (r208820) @@ -133,6 +133,7 @@ ata_ali_chipinit(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(i), res->bars[i]); free(res, M_TEMP); + return ENXIO; } } ctlr->chipset_data = res; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:50:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AF241065672; Sat, 5 Jun 2010 08:50:39 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B19D8FC15; Sat, 5 Jun 2010 08:50: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 o558od9j069366; Sat, 5 Jun 2010 08:50:39 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558odbn069364; Sat, 5 Jun 2010 08:50:39 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201006050850.o558odbn069364@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 5 Jun 2010 08:50:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208821 - head/bin/cp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:50:39 -0000 Author: trasz Date: Sat Jun 5 08:50:39 2010 New Revision: 208821 URL: http://svn.freebsd.org/changeset/base/208821 Log: Don't try to copy a socket after "xxx is a socket (not copied)." message. Previously, it would either try to copy it anyway and fail (without -R), or create fifo instead of the socket (with -R). Found with: Coverity Prevent CID: 5623 MFC after: 2 weeks Modified: head/bin/cp/cp.c Modified: head/bin/cp/cp.c ============================================================================== --- head/bin/cp/cp.c Sat Jun 5 08:44:40 2010 (r208820) +++ head/bin/cp/cp.c Sat Jun 5 08:50:39 2010 (r208821) @@ -466,6 +466,7 @@ copy(char *argv[], enum op type, int fts case S_IFSOCK: warnx("%s is a socket (not copied).", curr->fts_path); + break; case S_IFIFO: if (Rflag) { if (copy_fifo(curr->fts_statp, !dne)) From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 08:58:04 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01CDB106566C; Sat, 5 Jun 2010 08:58:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5FE68FC16; Sat, 5 Jun 2010 08:58: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 o558w3fC071039; Sat, 5 Jun 2010 08:58:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o558w3ZE071036; Sat, 5 Jun 2010 08:58:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050858.o558w3ZE071036@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 08:58: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: r208822 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 08:58:04 -0000 Author: mav Date: Sat Jun 5 08:58:03 2010 New Revision: 208822 URL: http://svn.freebsd.org/changeset/base/208822 Log: Fix possible use after free. Found with: Coverity Prevent(tm) CID: 4634 Modified: head/sys/dev/ata/atapi-cam.c Modified: head/sys/dev/ata/atapi-cam.c ============================================================================== --- head/sys/dev/ata/atapi-cam.c Sat Jun 5 08:50:39 2010 (r208821) +++ head/sys/dev/ata/atapi-cam.c Sat Jun 5 08:58:03 2010 (r208822) @@ -868,11 +868,11 @@ free_hcb(struct atapi_hcb *hcb) static void free_softc(struct atapi_xpt_softc *scp) { - struct atapi_hcb *hcb; + struct atapi_hcb *hcb, *thcb; if (scp != NULL) { mtx_lock(&scp->state_lock); - TAILQ_FOREACH(hcb, &scp->pending_hcbs, chain) { + TAILQ_FOREACH_SAFE(hcb, &scp->pending_hcbs, chain, thcb) { free_hcb_and_ccb_done(hcb, CAM_UNREC_HBA_ERROR); } if (scp->path != NULL) { From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 09:31:13 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F13511065670; Sat, 5 Jun 2010 09:31:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E13328FC14; Sat, 5 Jun 2010 09:31: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 o559VD3G078234; Sat, 5 Jun 2010 09:31:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o559VD5L078232; Sat, 5 Jun 2010 09:31:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006050931.o559VD5L078232@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 09:31: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: r208823 - head/sys/cam/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 09:31:14 -0000 Author: mav Date: Sat Jun 5 09:31:13 2010 New Revision: 208823 URL: http://svn.freebsd.org/changeset/base/208823 Log: Add allocation error hadling. Found with: Coverity Prevent(tm) CID: 3897 Modified: head/sys/cam/ata/ata_xpt.c Modified: head/sys/cam/ata/ata_xpt.c ============================================================================== --- head/sys/cam/ata/ata_xpt.c Sat Jun 5 08:58:03 2010 (r208822) +++ head/sys/cam/ata/ata_xpt.c Sat Jun 5 09:31:13 2010 (r208823) @@ -1210,6 +1210,12 @@ ata_scan_bus(struct cam_periph *periph, !(work_ccb->cpi.hba_misc & PIM_NOBUSRESET) && !timevalisset(&request_ccb->ccb_h.path->bus->last_reset)) { reset_ccb = xpt_alloc_ccb_nowait(); + if (reset_ccb == NULL) { + request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + xpt_free_ccb(work_ccb); + xpt_done(request_ccb); + return; + } xpt_setup_ccb(&reset_ccb->ccb_h, request_ccb->ccb_h.path, CAM_PRIORITY_NONE); reset_ccb->ccb_h.func_code = XPT_RESET_BUS; @@ -1229,6 +1235,7 @@ ata_scan_bus(struct cam_periph *periph, malloc(sizeof(ata_scan_bus_info), M_CAMXPT, M_NOWAIT); if (scan_info == NULL) { request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + xpt_free_ccb(work_ccb); xpt_done(request_ccb); return; } From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 10:16:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1BF0106566B; Sat, 5 Jun 2010 10:16:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1DF68FC19; Sat, 5 Jun 2010 10:16: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 o55AGN09088140; Sat, 5 Jun 2010 10:16:23 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55AGNET088138; Sat, 5 Jun 2010 10:16:23 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006051016.o55AGNET088138@svn.freebsd.org> From: Alexander Motin Date: Sat, 5 Jun 2010 10:16: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: r208824 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 10:16:23 -0000 Author: mav Date: Sat Jun 5 10:16:23 2010 New Revision: 208824 URL: http://svn.freebsd.org/changeset/base/208824 Log: Remove some dead and incorrect code. Found with: Coverity Prevent(tm) CID: 4562 Modified: head/sys/netgraph/ng_pppoe.c Modified: head/sys/netgraph/ng_pppoe.c ============================================================================== --- head/sys/netgraph/ng_pppoe.c Sat Jun 5 09:31:13 2010 (r208823) +++ head/sys/netgraph/ng_pppoe.c Sat Jun 5 10:16:23 2010 (r208824) @@ -1281,7 +1281,7 @@ ng_pppoe_rcvdata_ether(hook_p hook, item { node_p node = NG_HOOK_NODE(hook); const priv_p privp = NG_NODE_PRIVATE(node); - sessp sp = NG_HOOK_PRIVATE(hook); + sessp sp; const struct pppoe_tag *utag = NULL, *tag = NULL; const struct pppoe_full_hdr *wh; const struct pppoe_hdr *ph; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 11:06:56 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93D5A106566B; Sat, 5 Jun 2010 11:06:56 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 839B88FC2B; Sat, 5 Jun 2010 11:06: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 o55B6uRQ004775; Sat, 5 Jun 2010 11:06:56 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55B6uKV004773; Sat, 5 Jun 2010 11:06:56 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201006051106.o55B6uKV004773@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 5 Jun 2010 11:06: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: r208825 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 11:06:56 -0000 Author: edwin Date: Sat Jun 5 11:06:56 2010 New Revision: 208825 URL: http://svn.freebsd.org/changeset/base/208825 Log: Properly check the return value of chdir, even if it is a "this should not happen" case. Found with: Coverity Prevent(tm) CID: 4932 Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Sat Jun 5 10:16:23 2010 (r208824) +++ head/usr.bin/calendar/io.c Sat Jun 5 11:06:56 2010 (r208825) @@ -226,7 +226,8 @@ opencal(void) char *home = getenv("HOME"); if (home == NULL || *home == '\0') errx(1, "cannot get home directory"); - chdir(home); + if (chdir(home) != 0) + errx(1, "cannot enter home directory"); for (found = i = 0; i < sizeof(calendarHomes) / sizeof(calendarHomes[0]); i++) if (chdir(calendarHomes[i]) == 0 && From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 11:12:35 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 693E31065676; Sat, 5 Jun 2010 11:12:35 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58E408FC14; Sat, 5 Jun 2010 11:12: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 o55BCZcw006049; Sat, 5 Jun 2010 11:12:35 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55BCZp7006047; Sat, 5 Jun 2010 11:12:35 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201006051112.o55BCZp7006047@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 5 Jun 2010 11:12: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: r208826 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 11:12:35 -0000 Author: edwin Date: Sat Jun 5 11:12:35 2010 New Revision: 208826 URL: http://svn.freebsd.org/changeset/base/208826 Log: Fix memory-leak at the processing of multiple calendars. Found with: Coverity Prevent(tm) CID: 7085 Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Sat Jun 5 11:06:56 2010 (r208825) +++ head/usr.bin/calendar/io.c Sat Jun 5 11:12:35 2010 (r208826) @@ -107,8 +107,10 @@ cal(void) tm.tm_wday = 0; count = 0; - if ((fp = opencal()) == NULL) + if ((fp = opencal()) == NULL) { + free(extradata); return; + } while (fgets(buf, sizeof(buf), stdin) != NULL) { if ((pp = strchr(buf, '\n')) != NULL) *pp = '\0'; @@ -203,6 +205,7 @@ cal(void) event_print_all(fp); closecal(fp); + free(extradata); } FILE * From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 11:32:31 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A29B3106566C; Sat, 5 Jun 2010 11:32:31 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 924728FC0C; Sat, 5 Jun 2010 11:32: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 o55BWVLj010385; Sat, 5 Jun 2010 11:32:31 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55BWVBG010383; Sat, 5 Jun 2010 11:32:31 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201006051132.o55BWVBG010383@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 5 Jun 2010 11:32: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: r208827 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 11:32:31 -0000 Author: edwin Date: Sat Jun 5 11:32:31 2010 New Revision: 208827 URL: http://svn.freebsd.org/changeset/base/208827 Log: Fix: when unable to parse the sequence string, erase everything. Found with: Coverity Prevent(tm) CID: 7888 Modified: head/usr.bin/calendar/locale.c Modified: head/usr.bin/calendar/locale.c ============================================================================== --- head/usr.bin/calendar/locale.c Sat Jun 5 11:12:35 2010 (r208826) +++ head/usr.bin/calendar/locale.c Sat Jun 5 11:32:31 2010 (r208827) @@ -141,12 +141,12 @@ setnsequences(char *seq) for (i = 0; i < 5; i++) { nsequences[i].name = p; if ((p = strchr(p, ' ')) == NULL) { + /* Oh oh there is something wrong. Erase! Erase! */ for (i = 0; i < 5; i++) { nsequences[i].name = NULL; nsequences[i].len = 0; - return; } - + return; } *p = '\0'; p++; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 11:41:46 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCEF4106564A; Sat, 5 Jun 2010 11:41:46 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCB7D8FC24; Sat, 5 Jun 2010 11:41: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 o55Bfk7p012418; Sat, 5 Jun 2010 11:41:46 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55BfkBk012416; Sat, 5 Jun 2010 11:41:46 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201006051141.o55BfkBk012416@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 5 Jun 2010 11:41: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: r208828 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 11:41:46 -0000 Author: edwin Date: Sat Jun 5 11:41:46 2010 New Revision: 208828 URL: http://svn.freebsd.org/changeset/base/208828 Log: Fix warnings about uninitialized variables. It was mostly harmless since strftime() only used %a and %b anyway. Found with: Coverity Prevent(tm) CID: 7769 Modified: head/usr.bin/calendar/locale.c Modified: head/usr.bin/calendar/locale.c ============================================================================== --- head/usr.bin/calendar/locale.c Sat Jun 5 11:32:31 2010 (r208827) +++ head/usr.bin/calendar/locale.c Sat Jun 5 11:41:46 2010 (r208828) @@ -76,6 +76,7 @@ setnnames(void) int i, l; struct tm tm; + memset(&tm, sizeof(struct tm), 0); for (i = 0; i < 7; i++) { tm.tm_wday = i; strftime(buf, sizeof(buf), "%a", &tm); @@ -103,6 +104,7 @@ setnnames(void) fndays[i].len = strlen(buf); } + memset(&tm, sizeof(struct tm), 0); for (i = 0; i < 12; i++) { tm.tm_mon = i; strftime(buf, sizeof(buf), "%b", &tm); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 12:31:09 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8313A106566B; Sat, 5 Jun 2010 12:31:09 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67BED8FC12; Sat, 5 Jun 2010 12:31: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 o55CV9G6023339; Sat, 5 Jun 2010 12:31:09 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55CV9jl023337; Sat, 5 Jun 2010 12:31:09 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201006051231.o55CV9jl023337@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 5 Jun 2010 12:31: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: r208829 - head/usr.bin/calendar X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 12:31:09 -0000 Author: edwin Date: Sat Jun 5 12:31:08 2010 New Revision: 208829 URL: http://svn.freebsd.org/changeset/base/208829 Log: Make clang happier by removing unused assignments. Modified: head/usr.bin/calendar/sunpos.c Modified: head/usr.bin/calendar/sunpos.c ============================================================================== --- head/usr.bin/calendar/sunpos.c Sat Jun 5 11:41:46 2010 (r208828) +++ head/usr.bin/calendar/sunpos.c Sat Jun 5 12:31:08 2010 (r208829) @@ -226,26 +226,24 @@ fequinoxsolstice(int year, double UTCoff * It happens when the returned value "dec" goes from * [350 ... 360> -> [0 ... 10] */ - found = 0; - prevdec = 350; for (d = 18; d < 31; d++) { -// printf("Comparing day %d to %d.\n", d, d+1); + /* printf("Comparing day %d to %d.\n", d, d+1); */ sunpos(year, 3, d, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decleft); sunpos(year, 3, d + 1, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decright); -// printf("Found %g and %g.\n", decleft, decright); + /* printf("Found %g and %g.\n", decleft, decright); */ if (SIGN(decleft) == SIGN(decright)) continue; dial = SECSPERDAY; s = SECSPERDAY / 2; while (s > 0) { -// printf("Obtaining %d (%02d:%02d)\n", -// dial, SHOUR(dial), SMIN(dial)); + /* printf("Obtaining %d (%02d:%02d)\n", + dial, SHOUR(dial), SMIN(dial)); */ sunpos(year, 3, d, UTCoffset, SHOUR(dial), SMIN(dial), SSEC(dial), 0.0, 0.0, &L, &decmiddle); -// printf("Found %g\n", decmiddle); + /* printf("Found %g\n", decmiddle); */ if (SIGN(decleft) == SIGN(decmiddle)) { decleft = decmiddle; dial += s; @@ -253,7 +251,9 @@ fequinoxsolstice(int year, double UTCoff decright = decmiddle; dial -= s; } -// printf("New boundaries: %g - %g\n", decleft, decright); + /* + printf("New boundaries: %g - %g\n", decleft, decright); + */ s /= 2; } @@ -265,26 +265,24 @@ fequinoxsolstice(int year, double UTCoff * It happens when the returned value "dec" goes from * [10 ... 0] -> <360 ... 350] */ - found = 0; - prevdec = 10; for (d = 18; d < 31; d++) { -// printf("Comparing day %d to %d.\n", d, d+1); + /* printf("Comparing day %d to %d.\n", d, d+1); */ sunpos(year, 9, d, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decleft); sunpos(year, 9, d + 1, UTCoffset, 0, 0, 0, 0.0, 0.0, &L, &decright); -// printf("Found %g and %g.\n", decleft, decright); + /* printf("Found %g and %g.\n", decleft, decright); */ if (SIGN(decleft) == SIGN(decright)) continue; dial = SECSPERDAY; s = SECSPERDAY / 2; while (s > 0) { -// printf("Obtaining %d (%02d:%02d)\n", -// dial, SHOUR(dial), SMIN(dial)); + /* printf("Obtaining %d (%02d:%02d)\n", + dial, SHOUR(dial), SMIN(dial)); */ sunpos(year, 9, d, UTCoffset, SHOUR(dial), SMIN(dial), SSEC(dial), 0.0, 0.0, &L, &decmiddle); -// printf("Found %g\n", decmiddle); + /* printf("Found %g\n", decmiddle); */ if (SIGN(decleft) == SIGN(decmiddle)) { decleft = decmiddle; dial += s; @@ -292,7 +290,9 @@ fequinoxsolstice(int year, double UTCoff decright = decmiddle; dial -= s; } -// printf("New boundaries: %g - %g\n", decleft, decright); + /* + printf("New boundaries: %g - %g\n", decleft, decright); + */ s /= 2; } From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 12:49:39 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4A6510656E8; Sat, 5 Jun 2010 12:49:39 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9432F8FC15; Sat, 5 Jun 2010 12:49: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 o55Cndh4027386; Sat, 5 Jun 2010 12:49:39 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55CndPA027384; Sat, 5 Jun 2010 12:49:39 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201006051249.o55CndPA027384@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 5 Jun 2010 12:49:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208830 - head/usr.sbin/tzsetup X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 12:49:39 -0000 Author: edwin Date: Sat Jun 5 12:49:39 2010 New Revision: 208830 URL: http://svn.freebsd.org/changeset/base/208830 Log: When there is a problem with writing, also bail out. Found with the clang checker. Modified: head/usr.sbin/tzsetup/tzsetup.c Modified: head/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.c Sat Jun 5 12:31:08 2010 (r208829) +++ head/usr.sbin/tzsetup/tzsetup.c Sat Jun 5 12:49:39 2010 (r208830) @@ -564,7 +564,8 @@ install_zoneinfo_file(const char *zonein } while ((len = read(fd1, buf, sizeof(buf))) > 0) - len = write(fd2, buf, len); + if ((len = write(fd2, buf, len)) < 0) + break; if (len == -1) { snprintf(title, sizeof(title), "Error"); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 12:53:45 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E24011065672; Sat, 5 Jun 2010 12:53:44 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9B948FC35; Sat, 5 Jun 2010 12:53: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 o55Cri6k028301; Sat, 5 Jun 2010 12:53:44 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55Crix9028299; Sat, 5 Jun 2010 12:53:44 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201006051253.o55Crix9028299@svn.freebsd.org> From: Edwin Groothuis Date: Sat, 5 Jun 2010 12:53: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: r208831 - head/usr.sbin/tzsetup X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 12:53:46 -0000 Author: edwin Date: Sat Jun 5 12:53:44 2010 New Revision: 208831 URL: http://svn.freebsd.org/changeset/base/208831 Log: Add comment that this value is unused. It is obvious that it isn't used, but both clang and Coverity talk about it. Found with: Coverity Prevent(tm) CID: 8066 Modified: head/usr.sbin/tzsetup/tzsetup.c Modified: head/usr.sbin/tzsetup/tzsetup.c ============================================================================== --- head/usr.sbin/tzsetup/tzsetup.c Sat Jun 5 12:49:39 2010 (r208830) +++ head/usr.sbin/tzsetup/tzsetup.c Sat Jun 5 12:53:44 2010 (r208831) @@ -358,7 +358,7 @@ read_zones(void) if (strlen(tlc) != 2) errx(1, "%s:%d: invalid country code `%s'", path_zonetab, lineno, tlc); - coord = strsep(&line, "\t"); + coord = strsep(&line, "\t"); /* Unused */ file = strsep(&line, "\t"); p = strchr(file, '/'); if (p == 0) From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 16:00:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61B7B1065670; Sat, 5 Jun 2010 16:00:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 444118FC13; Sat, 5 Jun 2010 16:00: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 o55G00le068882; Sat, 5 Jun 2010 16:00:00 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55G00Gr068861; Sat, 5 Jun 2010 16:00:00 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006051600.o55G00Gr068861@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 5 Jun 2010 16:00: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: r208833 - in head/sys: amd64/acpica amd64/amd64 amd64/ia32 amd64/include i386/i386 i386/include i386/isa i386/linux pc98/pc98 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 16:00:16 -0000 Author: kib Date: Sat Jun 5 15:59:59 2010 New Revision: 208833 URL: http://svn.freebsd.org/changeset/base/208833 Log: Introduce the x86 kernel interfaces to allow kernel code to use FPU/SSE hardware. Caller should provide a save area that is chained into the stack of the areas; pcb save_area for usermode FPU state is on top. The pcb now contains a pointer to the current FPU saved area, used during FPUDNA handling and context switches. There is also a facility to allow the kernel thread to use pcb save_area. Change the dreaded warnings "npxdna in kernel mode!" into the panics when FPU usage is not registered. KPI discussed with: fabient Tested by: pho, fabient Hardware provided by: Sentex Communications MFC after: 1 month Modified: head/sys/amd64/acpica/acpi_wakeup.c head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/fpu.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/trap.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/ia32/ia32_reg.c head/sys/amd64/include/fpu.h head/sys/amd64/include/pcb.h head/sys/i386/i386/machdep.c head/sys/i386/i386/ptrace_machdep.c head/sys/i386/i386/swtch.s head/sys/i386/i386/trap.c head/sys/i386/i386/vm_machdep.c head/sys/i386/include/npx.h head/sys/i386/include/pcb.h head/sys/i386/isa/npx.c head/sys/i386/linux/linux_ptrace.c head/sys/pc98/pc98/machdep.c Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/acpica/acpi_wakeup.c Sat Jun 5 15:59:59 2010 (r208833) @@ -245,7 +245,7 @@ acpi_sleep_machdep(struct acpi_softc *sc cr3 = rcr3(); load_cr3(KPML4phys); - stopfpu = &stopxpcbs[0]->xpcb_pcb.pcb_save; + stopfpu = stopxpcbs[0]->xpcb_pcb.pcb_save; if (acpi_savecpu(stopxpcbs[0])) { fpugetregs(curthread, stopfpu); Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/amd64/cpu_switch.S Sat Jun 5 15:59:59 2010 (r208833) @@ -116,7 +116,7 @@ done_store_dr: /* have we used fp, and need a save? */ cmpq %rdi,PCPU(FPCURTHREAD) jne 1f - addq $PCB_SAVEFPU,%r8 + movq PCB_SAVEFPU(%r8),%r8 clts fxsave (%r8) smsw %ax @@ -341,7 +341,7 @@ ENTRY(savectx) je 1f movq TD_PCB(%rax),%rdi - leaq PCB_SAVEFPU(%rdi),%rdi + movq PCB_SAVEFPU(%rdi),%rdi clts fxsave (%rdi) smsw %ax @@ -349,7 +349,7 @@ ENTRY(savectx) lmsw %ax movq $PCB_SAVEFPU_SIZE,%rdx /* arg 3 */ - leaq PCB_SAVEFPU(%rcx),%rsi /* arg 2 */ + movq PCB_SAVEFPU(%rcx),%rsi /* arg 2 */ /* arg 1 (%rdi) already loaded */ call bcopy 1: Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/amd64/fpu.c Sat Jun 5 15:59:59 2010 (r208833) @@ -91,8 +91,8 @@ void stop_emulating(void); #endif /* __GNUCLIKE_ASM && !lint */ -#define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save.sv_env.en_cw) -#define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save.sv_env.en_sw) +#define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_cw) +#define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save->sv_env.en_sw) typedef u_char bool_t; @@ -146,7 +146,7 @@ fpuexit(struct thread *td) savecrit = intr_disable(); if (curthread == PCPU_GET(fpcurthread)) { stop_emulating(); - fxsave(&PCPU_GET(curpcb)->pcb_save); + fxsave(PCPU_GET(curpcb)->pcb_save); start_emulating(); PCPU_SET(fpcurthread, 0); } @@ -424,8 +424,10 @@ fpudna(void) if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) fldcw(&pcb->pcb_initial_fpucw); pcb->pcb_flags |= PCB_FPUINITDONE; + if (PCB_USER_FPU(pcb)) + pcb->pcb_flags |= PCB_USERFPUINITDONE; } else - fxrstor(&pcb->pcb_save); + fxrstor(pcb->pcb_save); intr_restore(s); } @@ -449,13 +451,39 @@ fpudrop() * It returns the FPU ownership status. */ int +fpugetuserregs(struct thread *td, struct savefpu *addr) +{ + register_t s; + struct pcb *pcb; + + pcb = td->td_pcb; + if ((pcb->pcb_flags & PCB_USERFPUINITDONE) == 0) { + bcopy(&fpu_initialstate, addr, sizeof(fpu_initialstate)); + addr->sv_env.en_cw = pcb->pcb_initial_fpucw; + return (_MC_FPOWNED_NONE); + } + s = intr_disable(); + if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { + fxsave(addr); + intr_restore(s); + return (_MC_FPOWNED_FPU); + } else { + intr_restore(s); + bcopy(&pcb->pcb_user_save, addr, sizeof(*addr)); + return (_MC_FPOWNED_PCB); + } +} + +int fpugetregs(struct thread *td, struct savefpu *addr) { register_t s; + struct pcb *pcb; - if ((td->td_pcb->pcb_flags & PCB_FPUINITDONE) == 0) { + pcb = td->td_pcb; + if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) { bcopy(&fpu_initialstate, addr, sizeof(fpu_initialstate)); - addr->sv_env.en_cw = td->td_pcb->pcb_initial_fpucw; + addr->sv_env.en_cw = pcb->pcb_initial_fpucw; return (_MC_FPOWNED_NONE); } s = intr_disable(); @@ -465,7 +493,7 @@ fpugetregs(struct thread *td, struct sav return (_MC_FPOWNED_FPU); } else { intr_restore(s); - bcopy(&td->td_pcb->pcb_save, addr, sizeof(*addr)); + bcopy(pcb->pcb_save, addr, sizeof(*addr)); return (_MC_FPOWNED_PCB); } } @@ -474,19 +502,44 @@ fpugetregs(struct thread *td, struct sav * Set the state of the FPU. */ void +fpusetuserregs(struct thread *td, struct savefpu *addr) +{ + register_t s; + struct pcb *pcb; + + pcb = td->td_pcb; + s = intr_disable(); + if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { + fxrstor(addr); + intr_restore(s); + pcb->pcb_flags |= PCB_FPUINITDONE | PCB_USERFPUINITDONE; + } else { + intr_restore(s); + bcopy(addr, &td->td_pcb->pcb_user_save, sizeof(*addr)); + if (PCB_USER_FPU(pcb)) + pcb->pcb_flags |= PCB_FPUINITDONE; + pcb->pcb_flags |= PCB_USERFPUINITDONE; + } +} + +void fpusetregs(struct thread *td, struct savefpu *addr) { register_t s; + struct pcb *pcb; + pcb = td->td_pcb; s = intr_disable(); if (td == PCPU_GET(fpcurthread)) { fxrstor(addr); intr_restore(s); } else { intr_restore(s); - bcopy(addr, &td->td_pcb->pcb_save, sizeof(*addr)); + bcopy(addr, td->td_pcb->pcb_save, sizeof(*addr)); } - curthread->td_pcb->pcb_flags |= PCB_FPUINITDONE; + if (PCB_USER_FPU(pcb)) + pcb->pcb_flags |= PCB_USERFPUINITDONE; + pcb->pcb_flags |= PCB_FPUINITDONE; } /* @@ -575,3 +628,74 @@ static devclass_t fpupnp_devclass; DRIVER_MODULE(fpupnp, acpi, fpupnp_driver, fpupnp_devclass, 0, 0); #endif /* DEV_ISA */ + +int +fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) +{ + struct pcb *pcb; + + pcb = td->td_pcb; + KASSERT(!PCB_USER_FPU(pcb) || pcb->pcb_save == &pcb->pcb_user_save, + ("mangled pcb_save")); + ctx->flags = 0; + if ((pcb->pcb_flags & PCB_FPUINITDONE) != 0) + ctx->flags |= FPU_KERN_CTX_FPUINITDONE; + fpuexit(td); + ctx->prev = pcb->pcb_save; + pcb->pcb_save = &ctx->hwstate; + pcb->pcb_flags |= PCB_KERNFPU; + pcb->pcb_flags &= ~PCB_FPUINITDONE; + return (0); +} + +int +fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx) +{ + struct pcb *pcb; + register_t savecrit; + + pcb = td->td_pcb; + savecrit = intr_disable(); + if (curthread == PCPU_GET(fpcurthread)) + fpudrop(); + intr_restore(savecrit); + pcb->pcb_save = ctx->prev; + if (pcb->pcb_save == &pcb->pcb_user_save) { + if ((pcb->pcb_flags & PCB_USERFPUINITDONE) != 0) + pcb->pcb_flags |= PCB_FPUINITDONE; + else + pcb->pcb_flags &= ~PCB_FPUINITDONE; + pcb->pcb_flags &= ~PCB_KERNFPU; + } else { + if ((ctx->flags & FPU_KERN_CTX_FPUINITDONE) != 0) + pcb->pcb_flags |= PCB_FPUINITDONE; + else + pcb->pcb_flags &= ~PCB_FPUINITDONE; + KASSERT(!PCB_USER_FPU(pcb), ("unpaired fpu_kern_leave")); + } + return (0); +} + +int +fpu_kern_thread(u_int flags) +{ + struct pcb *pcb; + + pcb = PCPU_GET(curpcb); + KASSERT((curthread->td_pflags & TDP_KTHREAD) != 0, + ("Only kthread may use fpu_kern_thread")); + KASSERT(pcb->pcb_save == &pcb->pcb_user_save, ("mangled pcb_save")); + KASSERT(PCB_USER_FPU(pcb), ("recursive call")); + + pcb->pcb_flags |= PCB_KERNFPU; + return (0); +} + +int +is_fpu_kern_thread(u_int flags) +{ + + if ((curthread->td_pflags & TDP_KTHREAD) == 0) + return (0); + return ((PCPU_GET(curpcb)->pcb_flags & PCB_KERNFPU) != 0); +} Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/amd64/machdep.c Sat Jun 5 15:59:59 2010 (r208833) @@ -1960,7 +1960,7 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { - fill_fpregs_xmm(&td->td_pcb->pcb_save, fpregs); + fill_fpregs_xmm(&td->td_pcb->pcb_user_save, fpregs); return (0); } @@ -1969,7 +1969,7 @@ int set_fpregs(struct thread *td, struct fpreg *fpregs) { - set_fpregs_xmm(fpregs, &td->td_pcb->pcb_save); + set_fpregs_xmm(fpregs, &td->td_pcb->pcb_user_save); return (0); } @@ -2084,7 +2084,8 @@ static void get_fpcontext(struct thread *td, mcontext_t *mcp) { - mcp->mc_ownedfp = fpugetregs(td, (struct savefpu *)&mcp->mc_fpstate); + mcp->mc_ownedfp = fpugetuserregs(td, + (struct savefpu *)&mcp->mc_fpstate); mcp->mc_fpformat = fpuformat(); } @@ -2109,7 +2110,7 @@ set_fpcontext(struct thread *td, const m */ fpstate = (struct savefpu *)&mcp->mc_fpstate; fpstate->sv_env.en_mxcsr &= cpu_mxcsr_mask; - fpusetregs(td, fpstate); + fpusetuserregs(td, fpstate); } else return (EINVAL); return (0); @@ -2120,6 +2121,7 @@ fpstate_drop(struct thread *td) { register_t s; + KASSERT(PCB_USER_FPU(td->td_pcb), ("fpstate_drop: kernel-owned fpu")); s = intr_disable(); if (PCPU_GET(fpcurthread) == td) fpudrop(); @@ -2133,7 +2135,8 @@ fpstate_drop(struct thread *td) * sendsig() is the only caller of fpugetregs()... perhaps we just * have too many layers. */ - curthread->td_pcb->pcb_flags &= ~PCB_FPUINITDONE; + curthread->td_pcb->pcb_flags &= ~(PCB_FPUINITDONE | + PCB_USERFPUINITDONE); intr_restore(s); } Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/amd64/mp_machdep.c Sat Jun 5 15:59:59 2010 (r208833) @@ -1247,7 +1247,7 @@ cpususpend_handler(void) rf = intr_disable(); cr3 = rcr3(); - stopfpu = &stopxpcbs[cpu]->xpcb_pcb.pcb_save; + stopfpu = stopxpcbs[cpu]->xpcb_pcb.pcb_save; if (savectx2(stopxpcbs[cpu])) { fpugetregs(curthread, stopfpu); wbinvd(); Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/amd64/trap.c Sat Jun 5 15:59:59 2010 (r208833) @@ -425,6 +425,8 @@ trap(struct trapframe *frame) case T_DNA: /* transparent fault (due to context switch "late") */ + KASSERT(PCB_USER_FPU(td->td_pcb), + ("kernel FPU ctx has leaked")); fpudna(); goto userout; @@ -449,16 +451,19 @@ trap(struct trapframe *frame) goto out; case T_DNA: + KASSERT(!PCB_USER_FPU(td->td_pcb), + ("Unregistered use of FPU in kernel")); + fpudna(); + goto out; + + case T_ARITHTRAP: /* arithmetic trap */ + case T_XMMFLT: /* SIMD floating-point exception */ + case T_FPOPFLT: /* FPU operand fetch fault */ /* - * The kernel is apparently using fpu for copying. - * XXX this should be fatal unless the kernel has - * registered such use. + * XXXKIB for now disable any FPU traps in kernel + * handler registration seems to be overkill */ - printf("fpudna in kernel mode!\n"); -#ifdef KDB - kdb_backtrace(); -#endif - fpudna(); + trap_fatal(frame, 0); goto out; case T_STKFLT: /* stack fault */ @@ -603,6 +608,8 @@ trap(struct trapframe *frame) user: userret(td, frame); mtx_assert(&Giant, MA_NOTOWNED); + KASSERT(PCB_USER_FPU(td->td_pcb), + ("Return from trap with kernel FPU ctx leaked")); userout: out: return; @@ -891,5 +898,12 @@ syscall(struct trapframe *frame) trapsignal(td, &ksi); } + KASSERT(PCB_USER_FPU(td->td_pcb), + ("System call %s returing with kernel FPU ctx leaked", + syscallname(td->td_proc, sa.code))); + KASSERT(td->td_pcb->pcb_save == &td->td_pcb->pcb_user_save, + ("System call %s returning with mangled pcb_save", + syscallname(td->td_proc, sa.code))); + syscallret(td, error, &sa); } Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/amd64/vm_machdep.c Sat Jun 5 15:59:59 2010 (r208833) @@ -122,7 +122,7 @@ cpu_fork(td1, p2, td2, flags) return; } - /* Ensure that p1's pcb is up to date. */ + /* Ensure that td1's pcb is up to date. */ fpuexit(td1); /* Point the pcb to the top of the stack */ @@ -130,9 +130,12 @@ cpu_fork(td1, p2, td2, flags) td2->td_kstack_pages * PAGE_SIZE) - 1; td2->td_pcb = pcb2; - /* Copy p1's pcb */ + /* Copy td1's pcb */ bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + /* Properly initialize pcb_save */ + pcb2->pcb_save = &pcb2->pcb_user_save; + /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); @@ -308,6 +311,7 @@ cpu_thread_alloc(struct thread *td) td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE) - 1; td->td_frame = (struct trapframe *)td->td_pcb - 1; + td->td_pcb->pcb_save = &td->td_pcb->pcb_user_save; } void @@ -381,7 +385,8 @@ cpu_set_upcall(struct thread *td, struct * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_flags &= ~PCB_FPUINITDONE; + pcb2->pcb_flags &= ~(PCB_FPUINITDONE | PCB_USERFPUINITDONE); + pcb2->pcb_save = &pcb2->pcb_user_save; pcb2->pcb_full_iret = 1; /* Modified: head/sys/amd64/ia32/ia32_reg.c ============================================================================== --- head/sys/amd64/ia32/ia32_reg.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/ia32/ia32_reg.c Sat Jun 5 15:59:59 2010 (r208833) @@ -147,7 +147,7 @@ fill_fpregs32(struct thread *td, struct { struct save87 *sv_87 = (struct save87 *)regs; struct env87 *penv_87 = &sv_87->sv_env; - struct savefpu *sv_fpu = &td->td_pcb->pcb_save; + struct savefpu *sv_fpu = &td->td_pcb->pcb_user_save; struct envxmm *penv_xmm = &sv_fpu->sv_env; int i; @@ -182,7 +182,7 @@ set_fpregs32(struct thread *td, struct f { struct save87 *sv_87 = (struct save87 *)regs; struct env87 *penv_87 = &sv_87->sv_env; - struct savefpu *sv_fpu = &td->td_pcb->pcb_save; + struct savefpu *sv_fpu = &td->td_pcb->pcb_user_save; struct envxmm *penv_xmm = &sv_fpu->sv_env; int i; Modified: head/sys/amd64/include/fpu.h ============================================================================== --- head/sys/amd64/include/fpu.h Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/include/fpu.h Sat Jun 5 15:59:59 2010 (r208833) @@ -73,6 +73,17 @@ struct savefpu { u_char sv_pad[96]; } __aligned(16); +#ifdef _KERNEL +struct fpu_kern_ctx { + struct savefpu hwstate; + struct savefpu *prev; + uint32_t flags; +}; +#define FPU_KERN_CTX_FPUINITDONE 0x01 + +#define PCB_USER_FPU(pcb) (((pcb)->pcb_flags & PCB_KERNFPU) == 0) +#endif + /* * The hardware default control word for i387's and later coprocessors is * 0x37F, giving: @@ -102,9 +113,22 @@ void fpudrop(void); void fpuexit(struct thread *td); int fpuformat(void); int fpugetregs(struct thread *td, struct savefpu *addr); +int fpugetuserregs(struct thread *td, struct savefpu *addr); void fpuinit(void); void fpusetregs(struct thread *td, struct savefpu *addr); +void fpusetuserregs(struct thread *td, struct savefpu *addr); int fputrap(void); +int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, + u_int flags); +int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); +int fpu_kern_thread(u_int flags); +int is_fpu_kern_thread(u_int flags); + +/* + * Flags for fpu_kern_enter() and fpu_kern_thread(). + */ +#define FPU_KERN_NORMAL 0x0000 + #endif #endif /* !_MACHINE_FPU_H_ */ Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/amd64/include/pcb.h Sat Jun 5 15:59:59 2010 (r208833) @@ -57,7 +57,9 @@ struct pcb { register_t pcb_gsbase; u_long pcb_flags; #define PCB_DBREGS 0x02 /* process using debug registers */ +#define PCB_KERNFPU 0x04 /* kernel uses fpu */ #define PCB_FPUINITDONE 0x08 /* fpu state is initialized */ +#define PCB_USERFPUINITDONE 0x10 /* fpu user state is initialized */ #define PCB_GS32BIT 0x20 /* linux gs switch */ #define PCB_32BIT 0x40 /* process has 32 bit context (segs etc) */ #define PCB_FULLCTX 0x80 /* full context restore on sysret */ @@ -69,7 +71,7 @@ struct pcb { u_int64_t pcb_dr6; u_int64_t pcb_dr7; - struct savefpu pcb_save; + struct savefpu pcb_user_save; uint16_t pcb_initial_fpucw; caddr_t pcb_onfault; /* copyin/out fault recovery */ @@ -78,6 +80,7 @@ struct pcb { struct user_segment_descriptor pcb_gs32sd; /* local tss, with i/o bitmap; NULL for common */ struct amd64tss *pcb_tssp; + struct savefpu *pcb_save; char pcb_full_iret; }; Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/i386/i386/machdep.c Sat Jun 5 15:59:59 2010 (r208833) @@ -3185,12 +3185,12 @@ fill_fpregs(struct thread *td, struct fp { #ifdef CPU_ENABLE_SSE if (cpu_fxsr) { - fill_fpregs_xmm(&td->td_pcb->pcb_save.sv_xmm, + fill_fpregs_xmm(&td->td_pcb->pcb_user_save.sv_xmm, (struct save87 *)fpregs); return (0); } #endif /* CPU_ENABLE_SSE */ - bcopy(&td->td_pcb->pcb_save.sv_87, fpregs, sizeof *fpregs); + bcopy(&td->td_pcb->pcb_user_save.sv_87, fpregs, sizeof *fpregs); return (0); } @@ -3200,11 +3200,11 @@ set_fpregs(struct thread *td, struct fpr #ifdef CPU_ENABLE_SSE if (cpu_fxsr) { set_fpregs_xmm((struct save87 *)fpregs, - &td->td_pcb->pcb_save.sv_xmm); + &td->td_pcb->pcb_user_save.sv_xmm); return (0); } #endif /* CPU_ENABLE_SSE */ - bcopy(fpregs, &td->td_pcb->pcb_save.sv_87, sizeof *fpregs); + bcopy(fpregs, &td->td_pcb->pcb_user_save.sv_87, sizeof *fpregs); return (0); } @@ -3331,7 +3331,7 @@ get_fpcontext(struct thread *td, mcontex addr = (void *)((char *)addr + 4); while ((uintptr_t)(void *)addr & 0xF); } - mcp->mc_ownedfp = npxgetregs(td, addr); + mcp->mc_ownedfp = npxgetuserregs(td, addr); if (addr != (union savefpu *)&mcp->mc_fpstate) { bcopy(addr, &mcp->mc_fpstate, sizeof(mcp->mc_fpstate)); bzero(&mcp->mc_spare2, sizeof(mcp->mc_spare2)); @@ -3376,7 +3376,7 @@ set_fpcontext(struct thread *td, const m * XXX we violate the dubious requirement that npxsetregs() * be called with interrupts disabled. */ - npxsetregs(td, addr); + npxsetuserregs(td, addr); #endif /* * Don't bother putting things back where they were in the @@ -3393,6 +3393,7 @@ fpstate_drop(struct thread *td) { register_t s; + KASSERT(PCB_USER_FPU(td->td_pcb), ("fpstate_drop: kernel-owned fpu")); s = intr_disable(); #ifdef DEV_NPX if (PCPU_GET(fpcurthread) == td) @@ -3408,7 +3409,8 @@ fpstate_drop(struct thread *td) * sendsig() is the only caller of npxgetregs()... perhaps we just * have too many layers. */ - curthread->td_pcb->pcb_flags &= ~PCB_NPXINITDONE; + curthread->td_pcb->pcb_flags &= ~(PCB_NPXINITDONE | + PCB_NPXUSERINITDONE); intr_restore(s); } Modified: head/sys/i386/i386/ptrace_machdep.c ============================================================================== --- head/sys/i386/i386/ptrace_machdep.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/i386/i386/ptrace_machdep.c Sat Jun 5 15:59:59 2010 (r208833) @@ -51,7 +51,7 @@ cpu_ptrace(struct thread *td, int req, v if (!cpu_fxsr) return (EINVAL); - fpstate = &td->td_pcb->pcb_save.sv_xmm; + fpstate = &td->td_pcb->pcb_user_save.sv_xmm; switch (req) { case PT_GETXMMREGS: error = copyout(fpstate, addr, sizeof(*fpstate)); Modified: head/sys/i386/i386/swtch.s ============================================================================== --- head/sys/i386/i386/swtch.s Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/i386/i386/swtch.s Sat Jun 5 15:59:59 2010 (r208833) @@ -156,8 +156,7 @@ ENTRY(cpu_switch) /* have we used fp, and need a save? */ cmpl %ecx,PCPU(FPCURTHREAD) jne 1f - addl $PCB_SAVEFPU,%edx /* h/w bugs make saving complicated */ - pushl %edx + pushl PCB_SAVEFPU(%edx) /* h/w bugs make saving complicated */ call npxsave /* do it in a big C function */ popl %eax 1: @@ -408,7 +407,7 @@ ENTRY(savectx) pushl %ecx movl TD_PCB(%eax),%eax - leal PCB_SAVEFPU(%eax),%eax + movl PCB_SAVEFPU(%eax),%eax pushl %eax pushl %eax call npxsave @@ -417,7 +416,7 @@ ENTRY(savectx) popl %ecx pushl $PCB_SAVEFPU_SIZE - leal PCB_SAVEFPU(%ecx),%ecx + movl PCB_SAVEFPU(%ecx),%ecx pushl %ecx pushl %eax call bcopy Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/i386/i386/trap.c Sat Jun 5 15:59:59 2010 (r208833) @@ -501,6 +501,8 @@ trap(struct trapframe *frame) case T_DNA: #ifdef DEV_NPX + KASSERT(PCB_USER_FPU(td->td_pcb), + ("kernel FPU ctx has leaked")); /* transparent fault (due to context switch "late") */ if (npxdna()) goto userout; @@ -533,20 +535,23 @@ trap(struct trapframe *frame) case T_DNA: #ifdef DEV_NPX - /* - * The kernel is apparently using npx for copying. - * XXX this should be fatal unless the kernel has - * registered such use. - */ - printf("npxdna in kernel mode!\n"); -#ifdef KDB - kdb_backtrace(); -#endif + KASSERT(!PCB_USER_FPU(td->td_pcb), + ("Unregistered use of FPU in kernel")); if (npxdna()) goto out; #endif break; + case T_ARITHTRAP: /* arithmetic trap */ + case T_XMMFLT: /* SIMD floating-point exception */ + case T_FPOPFLT: /* FPU operand fetch fault */ + /* + * XXXKIB for now disable any FPU traps in kernel + * handler registration seems to be overkill + */ + trap_fatal(frame, 0); + goto out; + /* * The following two traps can happen in * vm86 mode, and, if so, we want to handle @@ -752,6 +757,8 @@ trap(struct trapframe *frame) user: userret(td, frame); mtx_assert(&Giant, MA_NOTOWNED); + KASSERT(PCB_USER_FPU(td->td_pcb), + ("Return from trap with kernel FPU ctx leaked")); userout: out: return; @@ -1064,5 +1071,12 @@ syscall(struct trapframe *frame) trapsignal(td, &ksi); } + KASSERT(PCB_USER_FPU(td->td_pcb), + ("System call %s returning with kernel FPU ctx leaked", + syscallname(td->td_proc, sa.code))); + KASSERT(td->td_pcb->pcb_save == &td->td_pcb->pcb_user_save, + ("System call %s returning with mangled pcb_save", + syscallname(td->td_proc, sa.code))); + syscallret(td, error, &sa); } Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/i386/i386/vm_machdep.c Sat Jun 5 15:59:59 2010 (r208833) @@ -176,13 +176,13 @@ cpu_fork(td1, p2, td2, flags) return; } - /* Ensure that p1's pcb is up to date. */ + /* Ensure that td1's pcb is up to date. */ if (td1 == curthread) td1->td_pcb->pcb_gs = rgs(); #ifdef DEV_NPX savecrit = intr_disable(); if (PCPU_GET(fpcurthread) == td1) - npxsave(&td1->td_pcb->pcb_save); + npxsave(td1->td_pcb->pcb_save); intr_restore(savecrit); #endif @@ -191,9 +191,12 @@ cpu_fork(td1, p2, td2, flags) td2->td_kstack_pages * PAGE_SIZE) - 1; td2->td_pcb = pcb2; - /* Copy p1's pcb */ + /* Copy td1's pcb */ bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + /* Properly initialize pcb_save */ + pcb2->pcb_save = &pcb2->pcb_user_save; + /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); @@ -372,6 +375,7 @@ cpu_thread_alloc(struct thread *td) td->td_kstack_pages * PAGE_SIZE) - 1; td->td_frame = (struct trapframe *)((caddr_t)td->td_pcb - 16) - 1; td->td_pcb->pcb_ext = NULL; + td->td_pcb->pcb_save = &td->td_pcb->pcb_user_save; } void @@ -437,7 +441,8 @@ cpu_set_upcall(struct thread *td, struct * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_flags &= ~(PCB_NPXTRAP|PCB_NPXINITDONE); + pcb2->pcb_flags &= ~(PCB_NPXTRAP|PCB_NPXINITDONE|PCB_NPXUSERINITDONE); + pcb2->pcb_save = &pcb2->pcb_user_save; /* * Create a new fresh stack for the new thread. Modified: head/sys/i386/include/npx.h ============================================================================== --- head/sys/i386/include/npx.h Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/i386/include/npx.h Sat Jun 5 15:59:59 2010 (r208833) @@ -143,6 +143,15 @@ union savefpu { #define IRQ_NPX 13 +struct fpu_kern_ctx { + union savefpu hwstate; + union savefpu *prev; + uint32_t flags; +}; +#define FPU_KERN_CTX_NPXINITDONE 0x01 + +#define PCB_USER_FPU(pcb) (((pcb)->pcb_flags & PCB_KERNNPX) == 0) + /* full reset on some systems, NOP on others */ #define npx_full_reset() outb(IO_NPX + 1, 0) @@ -151,10 +160,22 @@ void npxdrop(void); void npxexit(struct thread *td); int npxformat(void); int npxgetregs(struct thread *td, union savefpu *addr); +int npxgetuserregs(struct thread *td, union savefpu *addr); void npxinit(void); void npxsave(union savefpu *addr); void npxsetregs(struct thread *td, union savefpu *addr); +void npxsetuserregs(struct thread *td, union savefpu *addr); int npxtrap(void); +int fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, + u_int flags); +int fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); +int fpu_kern_thread(u_int flags); +int is_fpu_kern_thread(u_int flags); + +/* + * Flags for fpu_kern_enter() and fpu_kern_thread(). + */ +#define FPU_KERN_NORMAL 0x0000 #endif Modified: head/sys/i386/include/pcb.h ============================================================================== --- head/sys/i386/include/pcb.h Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/i386/include/pcb.h Sat Jun 5 15:59:59 2010 (r208833) @@ -60,7 +60,7 @@ struct pcb { int pcb_dr6; int pcb_dr7; - union savefpu pcb_save; + union savefpu pcb_user_save; uint16_t pcb_initial_npxcw; u_int pcb_flags; #define FP_SOFTFP 0x01 /* process using software fltng pnt emulator */ @@ -68,6 +68,8 @@ struct pcb { #define PCB_NPXTRAP 0x04 /* npx trap pending */ #define PCB_NPXINITDONE 0x08 /* fpu state is initialized */ #define PCB_VM86CALL 0x10 /* in vm86 call */ +#define PCB_NPXUSERINITDONE 0x20 /* user fpu state is initialized */ +#define PCB_KERNNPX 0x40 /* kernel uses npx */ caddr_t pcb_onfault; /* copyin/out fault recovery */ int pcb_gs; @@ -76,6 +78,7 @@ struct pcb { struct pcb_ext *pcb_ext; /* optional pcb extension */ int pcb_psl; /* process status long */ u_long pcb_vm86[2]; /* vm86bios scratch space */ + union savefpu *pcb_save; }; #ifdef _KERNEL Modified: head/sys/i386/isa/npx.c ============================================================================== --- head/sys/i386/isa/npx.c Sat Jun 5 14:53:34 2010 (r208832) +++ head/sys/i386/isa/npx.c Sat Jun 5 15:59:59 2010 (r208833) @@ -135,12 +135,12 @@ void stop_emulating(void); #ifdef CPU_ENABLE_SSE #define GET_FPU_CW(thread) \ (cpu_fxsr ? \ - (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_cw : \ - (thread)->td_pcb->pcb_save.sv_87.sv_env.en_cw) + (thread)->td_pcb->pcb_save->sv_xmm.sv_env.en_cw : \ + (thread)->td_pcb->pcb_save->sv_87.sv_env.en_cw) #define GET_FPU_SW(thread) \ (cpu_fxsr ? \ - (thread)->td_pcb->pcb_save.sv_xmm.sv_env.en_sw : \ - (thread)->td_pcb->pcb_save.sv_87.sv_env.en_sw) + (thread)->td_pcb->pcb_save->sv_xmm.sv_env.en_sw : \ + (thread)->td_pcb->pcb_save->sv_87.sv_env.en_sw) #define SET_FPU_CW(savefpu, value) do { \ if (cpu_fxsr) \ (savefpu)->sv_xmm.sv_env.en_cw = (value); \ @@ -149,9 +149,9 @@ void stop_emulating(void); } while (0) #else /* CPU_ENABLE_SSE */ #define GET_FPU_CW(thread) \ - (thread->td_pcb->pcb_save.sv_87.sv_env.en_cw) + (thread->td_pcb->pcb_save->sv_87.sv_env.en_cw) #define GET_FPU_SW(thread) \ - (thread->td_pcb->pcb_save.sv_87.sv_env.en_sw) + (thread->td_pcb->pcb_save->sv_87.sv_env.en_sw) #define SET_FPU_CW(savefpu, value) \ (savefpu)->sv_87.sv_env.en_cw = (value) #endif /* CPU_ENABLE_SSE */ @@ -502,7 +502,7 @@ npxexit(td) savecrit = intr_disable(); if (curthread == PCPU_GET(fpcurthread)) - npxsave(&PCPU_GET(curpcb)->pcb_save); + npxsave(PCPU_GET(curpcb)->pcb_save); intr_restore(savecrit); #ifdef NPX_DEBUG if (npx_exists) { @@ -809,6 +809,8 @@ npxdna(void) if (pcb->pcb_initial_npxcw != __INITIAL_NPXCW__) fldcw(&pcb->pcb_initial_npxcw); pcb->pcb_flags |= PCB_NPXINITDONE; + if (PCB_USER_FPU(pcb)) + pcb->pcb_flags |= PCB_NPXUSERINITDONE; } else { /* * The following fpurstor() may cause an IRQ13 when the @@ -824,7 +826,7 @@ npxdna(void) * fnclex if it is the first FPU instruction after a context * switch. */ - fpurstor(&pcb->pcb_save); + fpurstor(pcb->pcb_save); } intr_restore(s); @@ -895,18 +897,18 @@ npxdrop() * It returns the FPU ownership status. */ int -npxgetregs(td, addr) - struct thread *td; - union savefpu *addr; +npxgetregs(struct thread *td, union savefpu *addr) { + struct pcb *pcb; register_t s; if (!npx_exists) return (_MC_FPOWNED_NONE); - if ((td->td_pcb->pcb_flags & PCB_NPXINITDONE) == 0) { + pcb = td->td_pcb; + if ((pcb->pcb_flags & PCB_NPXINITDONE) == 0) { bcopy(&npx_initialstate, addr, sizeof(npx_initialstate)); - SET_FPU_CW(addr, td->td_pcb->pcb_initial_npxcw); + SET_FPU_CW(addr, pcb->pcb_initial_npxcw); return (_MC_FPOWNED_NONE); } s = intr_disable(); @@ -925,7 +927,43 @@ npxgetregs(td, addr) return (_MC_FPOWNED_FPU); } else { intr_restore(s); - bcopy(&td->td_pcb->pcb_save, addr, sizeof(*addr)); + bcopy(pcb->pcb_save, addr, sizeof(*addr)); + return (_MC_FPOWNED_PCB); + } +} + +int +npxgetuserregs(struct thread *td, union savefpu *addr) +{ + struct pcb *pcb; + register_t s; + + if (!npx_exists) + return (_MC_FPOWNED_NONE); + + pcb = td->td_pcb; + if ((pcb->pcb_flags & PCB_NPXUSERINITDONE) == 0) { + bcopy(&npx_initialstate, addr, sizeof(npx_initialstate)); + SET_FPU_CW(addr, pcb->pcb_initial_npxcw); + return (_MC_FPOWNED_NONE); + } + s = intr_disable(); + if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { + fpusave(addr); +#ifdef CPU_ENABLE_SSE + if (!cpu_fxsr) +#endif + /* + * fnsave initializes the FPU and destroys whatever + * context it contains. Make sure the FPU owner + * starts with a clean state next time. + */ + npxdrop(); + intr_restore(s); + return (_MC_FPOWNED_FPU); + } else { + intr_restore(s); + bcopy(&pcb->pcb_user_save, addr, sizeof(*addr)); return (_MC_FPOWNED_PCB); } } @@ -934,15 +972,15 @@ npxgetregs(td, addr) * Set the state of the FPU. */ void -npxsetregs(td, addr) - struct thread *td; - union savefpu *addr; +npxsetregs(struct thread *td, union savefpu *addr) { + struct pcb *pcb; register_t s; if (!npx_exists) return; + pcb = td->td_pcb; s = intr_disable(); if (td == PCPU_GET(fpcurthread)) { #ifdef CPU_ENABLE_SSE @@ -953,9 +991,39 @@ npxsetregs(td, addr) intr_restore(s); } else { intr_restore(s); - bcopy(addr, &td->td_pcb->pcb_save, sizeof(*addr)); + bcopy(addr, pcb->pcb_save, sizeof(*addr)); + } + if (PCB_USER_FPU(pcb)) + pcb->pcb_flags |= PCB_NPXUSERINITDONE; + pcb->pcb_flags |= PCB_NPXINITDONE; +} + +void +npxsetuserregs(struct thread *td, union savefpu *addr) +{ + struct pcb *pcb; + register_t s; + + if (!npx_exists) + return; + + pcb = td->td_pcb; + s = intr_disable(); + if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { +#ifdef CPU_ENABLE_SSE + if (!cpu_fxsr) +#endif + fnclex(); /* As in npxdrop(). */ + fpurstor(addr); + intr_restore(s); + pcb->pcb_flags |= PCB_NPXUSERINITDONE | PCB_NPXINITDONE; + } else { + intr_restore(s); + bcopy(addr, &pcb->pcb_user_save, sizeof(*addr)); + if (PCB_USER_FPU(pcb)) + pcb->pcb_flags |= PCB_NPXINITDONE; + pcb->pcb_flags |= PCB_NPXUSERINITDONE; } - curthread->td_pcb->pcb_flags |= PCB_NPXINITDONE; } static void @@ -1124,3 +1192,74 @@ DRIVER_MODULE(npxisa, isa, npxisa_driver DRIVER_MODULE(npxisa, acpi, npxisa_driver, npxisa_devclass, 0, 0); #endif #endif /* DEV_ISA */ + +int +fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) +{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 16:00:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4354410656CA; Sat, 5 Jun 2010 16:00:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 282B28FC12; Sat, 5 Jun 2010 16:00: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 o55G0sPq069160; Sat, 5 Jun 2010 16:00:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55G0rfp069153; Sat, 5 Jun 2010 16:00:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201006051600.o55G0rfp069153@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 5 Jun 2010 16:00: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: r208834 - in head/sys: crypto/via dev/random opencrypto X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 16:00:54 -0000 Author: kib Date: Sat Jun 5 16:00:53 2010 New Revision: 208834 URL: http://svn.freebsd.org/changeset/base/208834 Log: Use the fpu_kern_enter() interface to properly separate usermode FPU context from in-kernel execution of padlock instructions and to handle spurious FPUDNA exceptions that sometime are raised when doing padlock calculations. Globally mark crypto(9) kthread as using FPU. Reviewed by: pjd Hardware provided by: Sentex Communications Tested by: pho PR: amd64/135014 MFC after: 1 month Modified: head/sys/crypto/via/padlock.c head/sys/crypto/via/padlock.h head/sys/crypto/via/padlock_cipher.c head/sys/crypto/via/padlock_hash.c head/sys/dev/random/nehemiah.c head/sys/opencrypto/crypto.c Modified: head/sys/crypto/via/padlock.c ============================================================================== --- head/sys/crypto/via/padlock.c Sat Jun 5 15:59:59 2010 (r208833) +++ head/sys/crypto/via/padlock.c Sat Jun 5 16:00:53 2010 (r208834) @@ -169,6 +169,7 @@ padlock_newsession(device_t dev, uint32_ struct padlock_softc *sc = device_get_softc(dev); struct padlock_session *ses = NULL; struct cryptoini *encini, *macini; + struct thread *td; int error; if (sidp == NULL || cri == NULL) @@ -236,7 +237,12 @@ padlock_newsession(device_t dev, uint32_ } if (macini != NULL) { - error = padlock_hash_setup(ses, macini); + td = curthread; + error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); + if (error == 0) { + error = padlock_hash_setup(ses, macini); + fpu_kern_leave(td, &ses->ses_fpu_ctx); + } if (error != 0) { padlock_freesession_one(sc, ses, 0); return (error); Modified: head/sys/crypto/via/padlock.h ============================================================================== --- head/sys/crypto/via/padlock.h Sat Jun 5 15:59:59 2010 (r208833) +++ head/sys/crypto/via/padlock.h Sat Jun 5 16:00:53 2010 (r208834) @@ -32,6 +32,12 @@ #include #include +#if defined(__i386__) +#include +#elif defined(__amd64__) +#include +#endif + union padlock_cw { uint64_t raw; struct { @@ -70,6 +76,7 @@ struct padlock_session { int ses_used; uint32_t ses_id; TAILQ_ENTRY(padlock_session) ses_next; + struct fpu_kern_ctx ses_fpu_ctx; }; #define PADLOCK_ALIGN(p) (void *)(roundup2((uintptr_t)(p), 16)) Modified: head/sys/crypto/via/padlock_cipher.c ============================================================================== --- head/sys/crypto/via/padlock_cipher.c Sat Jun 5 15:59:59 2010 (r208833) +++ head/sys/crypto/via/padlock_cipher.c Sat Jun 5 16:00:53 2010 (r208834) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -201,9 +202,10 @@ padlock_cipher_process(struct padlock_se struct cryptop *crp) { union padlock_cw *cw; + struct thread *td; u_char *buf, *abuf; uint32_t *key; - int allocated; + int allocated, error; buf = padlock_cipher_alloc(enccrd, crp, &allocated); if (buf == NULL) @@ -247,9 +249,16 @@ padlock_cipher_process(struct padlock_se enccrd->crd_len, abuf); } + td = curthread; + error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); + if (error != 0) + goto out; + padlock_cbc(abuf, abuf, enccrd->crd_len / AES_BLOCK_LEN, key, cw, ses->ses_iv); + fpu_kern_leave(td, &ses->ses_fpu_ctx); + if (allocated) { crypto_copyback(crp->crp_flags, crp->crp_buf, enccrd->crd_skip, enccrd->crd_len, abuf); @@ -262,9 +271,10 @@ padlock_cipher_process(struct padlock_se AES_BLOCK_LEN, ses->ses_iv); } + out: if (allocated) { bzero(buf, enccrd->crd_len + 16); free(buf, M_PADLOCK); } - return (0); + return (error); } Modified: head/sys/crypto/via/padlock_hash.c ============================================================================== --- head/sys/crypto/via/padlock_hash.c Sat Jun 5 15:59:59 2010 (r208833) +++ head/sys/crypto/via/padlock_hash.c Sat Jun 5 16:00:53 2010 (r208834) @@ -34,12 +34,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) #include #include #include #include #endif +#include #include #include /* for hmac_ipad_buffer and hmac_opad_buffer */ @@ -363,12 +365,18 @@ int padlock_hash_process(struct padlock_session *ses, struct cryptodesc *maccrd, struct cryptop *crp) { + struct thread *td; int error; + td = curthread; + error = fpu_kern_enter(td, &ses->ses_fpu_ctx, FPU_KERN_NORMAL); + if (error != 0) + return (error); if ((maccrd->crd_flags & CRD_F_KEY_EXPLICIT) != 0) padlock_hash_key_setup(ses, maccrd->crd_key, maccrd->crd_klen); error = padlock_authcompute(ses, maccrd, crp->crp_buf, crp->crp_flags); + fpu_kern_leave(td, &ses->ses_fpu_ctx); return (error); } Modified: head/sys/dev/random/nehemiah.c ============================================================================== --- head/sys/dev/random/nehemiah.c Sat Jun 5 15:59:59 2010 (r208833) +++ head/sys/dev/random/nehemiah.c Sat Jun 5 16:00:53 2010 (r208834) @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #define RANDOM_BLOCK_SIZE 256 @@ -82,6 +84,8 @@ static uint8_t out[RANDOM_BLOCK_SIZE+7] static union VIA_ACE_CW acw __aligned(16); +static struct fpu_kern_ctx fpu_ctx_save; + static struct mtx random_nehemiah_mtx; /* ARGSUSED */ @@ -142,11 +146,16 @@ random_nehemiah_deinit(void) static int random_nehemiah_read(void *buf, int c) { - int i; + int i, error; size_t count, ret; uint8_t *p; mtx_lock(&random_nehemiah_mtx); + error = fpu_kern_enter(curthread, &fpu_ctx_save, FPU_KERN_NORMAL); + if (error != 0) { + mtx_unlock(&random_nehemiah_mtx); + return (0); + } /* Get a random AES key */ count = 0; @@ -187,6 +196,7 @@ random_nehemiah_read(void *buf, int c) c = MIN(RANDOM_BLOCK_SIZE, c); memcpy(buf, out, (size_t)c); + fpu_kern_leave(curthread, &fpu_ctx_save); mtx_unlock(&random_nehemiah_mtx); return (c); } Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Sat Jun 5 15:59:59 2010 (r208833) +++ head/sys/opencrypto/crypto.c Sat Jun 5 16:00:53 2010 (r208834) @@ -82,6 +82,10 @@ __FBSDID("$FreeBSD$"); #include #include "cryptodev_if.h" +#if defined(__i386__) || defined(__amd64__) +#include +#endif + SDT_PROVIDER_DEFINE(opencrypto); /* @@ -1241,6 +1245,10 @@ crypto_proc(void) u_int32_t hid; int result, hint; +#if defined(__i386__) || defined(__amd64__) + fpu_kern_thread(FPU_KERN_NORMAL); +#endif + CRYPTO_Q_LOCK(); for (;;) { /* From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 16:21:55 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8ACF106567D; Sat, 5 Jun 2010 16:21:55 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97A658FC21; Sat, 5 Jun 2010 16:21: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 o55GLtB4073806; Sat, 5 Jun 2010 16:21:55 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55GLtah073804; Sat, 5 Jun 2010 16:21:55 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006051621.o55GLtah073804@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 5 Jun 2010 16:21: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: r208835 - head/sys/powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 16:21:55 -0000 Author: nwhitehorn Date: Sat Jun 5 16:21:55 2010 New Revision: 208835 URL: http://svn.freebsd.org/changeset/base/208835 Log: Make sure that interrupt sense settings set after interrupts are enabled are respected. This fixes loading the Apple onboard audio driver (snd_ai2s) as a module after boot, which would previously cause a panic. PR: powerpc/146888 MFC after: 5 days Modified: head/sys/powerpc/powerpc/intr_machdep.c Modified: head/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/intr_machdep.c Sat Jun 5 16:00:53 2010 (r208834) +++ head/sys/powerpc/powerpc/intr_machdep.c Sat Jun 5 16:21:55 2010 (r208835) @@ -164,6 +164,7 @@ intr_lookup(u_int irq) i->trig = INTR_TRIGGER_CONFORM; i->pol = INTR_POLARITY_CONFORM; i->irq = irq; + i->pic = NULL; i->vector = -1; mtx_lock(&intr_table_lock); @@ -325,6 +326,11 @@ powerpc_setup_intr(const char *name, u_i if (!cold) { error = powerpc_map_irq(i); + + if (!error && (i->trig != INTR_TRIGGER_CONFORM || + i->pol != INTR_POLARITY_CONFORM)) + PIC_CONFIG(i->pic, i->intline, i->trig, i->pol); + if (!error && enable) PIC_ENABLE(i->pic, i->intline, i->vector); } @@ -350,7 +356,7 @@ powerpc_config_intr(int irq, enum intr_t i->trig = trig; i->pol = pol; - if (!cold) + if (!cold && i->pic != NULL) PIC_CONFIG(i->pic, i->intline, trig, pol); return (0); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 16:25:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A406106566C; Sat, 5 Jun 2010 16:25:26 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 096768FC14; Sat, 5 Jun 2010 16:25: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 o55GPPGf074694; Sat, 5 Jun 2010 16:25:25 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55GPPvR074692; Sat, 5 Jun 2010 16:25:25 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006051625.o55GPPvR074692@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 5 Jun 2010 16: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: r208836 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 16:25:26 -0000 Author: nwhitehorn Date: Sat Jun 5 16:25:25 2010 New Revision: 208836 URL: http://svn.freebsd.org/changeset/base/208836 Log: Partially revert r208162 while waiting for review on a more comprehensive fix. On Apple OpenPICs, the low/high bit of the interrupt sense is only respected for interrupt 0. We currently erroneously program all OpenPIC interrupts level high instead of level low by default, which only matters for some G5 systems where the SATA controllers use IRQ 0. This change is a quick fix that will be reverted once the effect of changing the default interrupt sense on embedded systems is known. MFC after: 3 days Modified: head/sys/dev/ata/chipsets/ata-serverworks.c Modified: head/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c Sat Jun 5 16:21:55 2010 (r208835) +++ head/sys/dev/ata/chipsets/ata-serverworks.c Sat Jun 5 16:25:25 2010 (r208836) @@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef __powerpc__ +#include +#endif #include #include #include @@ -217,6 +220,10 @@ ata_serverworks_ch_attach(device_t dev) ch->hw.tf_write = ata_serverworks_tf_write; #ifdef __powerpc__ ch->hw.status = ata_serverworks_status; + + /* Make sure that our interrupt is edge triggered */ + powerpc_config_intr(bus_get_resource_start(device_get_parent(dev), + SYS_RES_IRQ, 0), INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); #endif if (ctlr->chip->chipid == ATA_K2) { From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 16:27:16 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27C821065674; Sat, 5 Jun 2010 16:27:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 170308FC17; Sat, 5 Jun 2010 16:27: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 o55GRFKZ075158; Sat, 5 Jun 2010 16:27:15 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55GRFJq075156; Sat, 5 Jun 2010 16:27:15 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006051627.o55GRFJq075156@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 5 Jun 2010 16:27: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: r208837 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 16:27:16 -0000 Author: nwhitehorn Date: Sat Jun 5 16:27:15 2010 New Revision: 208837 URL: http://svn.freebsd.org/changeset/base/208837 Log: Correct the comment. We now use level low instead of edge high for this interrupt. Modified: head/sys/dev/ata/chipsets/ata-serverworks.c Modified: head/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c Sat Jun 5 16:25:25 2010 (r208836) +++ head/sys/dev/ata/chipsets/ata-serverworks.c Sat Jun 5 16:27:15 2010 (r208837) @@ -221,7 +221,7 @@ ata_serverworks_ch_attach(device_t dev) #ifdef __powerpc__ ch->hw.status = ata_serverworks_status; - /* Make sure that our interrupt is edge triggered */ + /* Make sure that our interrupt is level low */ powerpc_config_intr(bus_get_resource_start(device_get_parent(dev), SYS_RES_IRQ, 0), INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); #endif From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 17:48:26 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EEF21065675; Sat, 5 Jun 2010 17:48:26 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E74F8FC12; Sat, 5 Jun 2010 17:48: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 o55HmQ4u092985; Sat, 5 Jun 2010 17:48:26 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55HmQE1092983; Sat, 5 Jun 2010 17:48:26 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006051748.o55HmQE1092983@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 5 Jun 2010 17:48: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: r208839 - head/sys/dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 17:48:26 -0000 Author: nwhitehorn Date: Sat Jun 5 17:48:26 2010 New Revision: 208839 URL: http://svn.freebsd.org/changeset/base/208839 Log: Add two new flags (IIC_M_NOSTOP and IIC_M_NOSTART) to struct iic_msg to allow consumers of iicbus_transfer() to send messages with repeated starts. Reviewed by: imp Modified: head/sys/dev/iicbus/iic.h Modified: head/sys/dev/iicbus/iic.h ============================================================================== --- head/sys/dev/iicbus/iic.h Sat Jun 5 17:22:17 2010 (r208838) +++ head/sys/dev/iicbus/iic.h Sat Jun 5 17:48:26 2010 (r208839) @@ -38,6 +38,8 @@ struct iic_msg uint16_t flags; #define IIC_M_WR 0 /* Fake flag for write */ #define IIC_M_RD 0x0001 /* read vs write */ +#define IIC_M_NOSTOP 0x0002 /* do not send a I2C stop after message */ +#define IIC_M_NOSTART 0x0004 /* do not send a I2C start before message */ uint16_t len; /* msg legnth */ uint8_t * buf; }; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 17:49:40 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A7471065670; Sat, 5 Jun 2010 17:49:40 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 895088FC23; Sat, 5 Jun 2010 17:49: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 o55HnewF093293; Sat, 5 Jun 2010 17:49:40 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55HneTs093291; Sat, 5 Jun 2010 17:49:40 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006051749.o55HneTs093291@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 5 Jun 2010 17:49: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: r208840 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 17:49:40 -0000 Author: nwhitehorn Date: Sat Jun 5 17:49:40 2010 New Revision: 208840 URL: http://svn.freebsd.org/changeset/base/208840 Log: Utilize the Keywest I2C combined mode for messages with repeated starts. Modified: head/sys/powerpc/powermac/kiic.c Modified: head/sys/powerpc/powermac/kiic.c ============================================================================== --- head/sys/powerpc/powermac/kiic.c Sat Jun 5 17:48:26 2010 (r208839) +++ head/sys/powerpc/powermac/kiic.c Sat Jun 5 17:49:40 2010 (r208840) @@ -107,6 +107,7 @@ struct kiic_softc { u_int sc_flags; u_char *sc_data; int sc_resid; + uint16_t sc_i2c_base; device_t sc_iicbus; }; @@ -114,6 +115,7 @@ static int kiic_probe(device_t dev); static int kiic_attach(device_t dev); static void kiic_writereg(struct kiic_softc *sc, u_int, u_int); static u_int kiic_readreg(struct kiic_softc *, u_int); +static void kiic_setport(struct kiic_softc *, u_int); static void kiic_setmode(struct kiic_softc *, u_int); static void kiic_setspeed(struct kiic_softc *, u_int); static void kiic_intr(void *xsc); @@ -196,12 +198,25 @@ kiic_attach(device_t self) * underneath them. Some have a single 'iicbus' child with the * devices underneath that. Sort this out, and make sure that the * OFW I2C layer has the correct node. + * + * Note: the I2C children of the Uninorth bridges have two ports. + * In general, the port is designated in the 9th bit of the I2C + * address. However, for kiic devices with children attached below + * an i2c-bus node, the port is indicated in the 'reg' property + * of the i2c-bus node. */ - sc->sc_node = OF_child(node); - if (OF_getprop(sc->sc_node,"name",name,sizeof(name)) > 0) { - if (strcmp(name,"i2c-bus") != 0) + sc->sc_node = node; + + node = OF_child(node); + if (OF_getprop(node, "name", name, sizeof(name)) > 0) { + if (strcmp(name,"i2c-bus") == 0) { + phandle_t reg; + if (OF_getprop(node, "reg", ®, sizeof(reg)) > 0) + sc->sc_i2c_base = reg << 8; + sc->sc_node = node; + } } mtx_init(&sc->sc_mutex, "kiic", NULL, MTX_DEF); @@ -211,8 +226,8 @@ kiic_attach(device_t self) bus_setup_intr(self, sc->sc_irq, INTR_TYPE_MISC | INTR_MPSAFE, NULL, kiic_intr, sc, &sc->sc_ih); + kiic_writereg(sc, ISR, kiic_readreg(sc, ISR)); kiic_writereg(sc, STATUS, 0); - kiic_writereg(sc, ISR, 0); kiic_writereg(sc, IER, 0); kiic_setmode(sc, I2C_STDMODE); @@ -252,6 +267,18 @@ kiic_setmode(struct kiic_softc *sc, u_in } static void +kiic_setport(struct kiic_softc *sc, u_int port) +{ + u_int x; + + KASSERT(port == 1 || port == 0, ("bad port")); + x = kiic_readreg(sc, MODE); + x &= ~I2C_PORT; + x |= (port << 4); + kiic_writereg(sc, MODE, x); +} + +static void kiic_setspeed(struct kiic_softc *sc, u_int speed) { u_int x; @@ -294,7 +321,8 @@ kiic_intr(void *xsc) *sc->sc_data++ = kiic_readreg(sc, DATA); sc->sc_resid--; } - + if (sc->sc_resid == 0) /* done */ + kiic_writereg(sc, CONTROL, 0); } else { if (sc->sc_resid == 0) { x = kiic_readreg(sc, CONTROL); @@ -322,10 +350,12 @@ kiic_transfer(device_t dev, struct iic_m { struct kiic_softc *sc; int i, x, timo, err; - uint8_t addr; + uint16_t addr; + uint8_t subaddr; sc = device_get_softc(dev); timo = 100; + subaddr = 0; mtx_lock(&sc->sc_mutex); @@ -339,7 +369,23 @@ kiic_transfer(device_t dev, struct iic_m sc->sc_flags = I2C_BUSY; + /* Clear pending interrupts, and reset controller */ + kiic_writereg(sc, ISR, kiic_readreg(sc, ISR)); + kiic_writereg(sc, STATUS, 0); + for (i = 0; i < nmsgs; i++) { + if (msgs[i].flags & IIC_M_NOSTOP) { + if (msgs[i+1].flags & IIC_M_RD) + kiic_setmode(sc, I2C_COMBMODE); + else + kiic_setmode(sc, I2C_STDSUBMODE); + KASSERT(msgs[i].len == 1, ("oversize I2C message")); + subaddr = msgs[i].buf[0]; + i++; + } else { + kiic_setmode(sc, I2C_STDMODE); + } + sc->sc_data = msgs[i].buf; sc->sc_resid = msgs[i].len; sc->sc_flags = I2C_BUSY; @@ -352,8 +398,11 @@ kiic_transfer(device_t dev, struct iic_m addr |= 1; } - kiic_writereg(sc, ADDR, addr); - kiic_writereg(sc, SUBADDR, 0x04); + addr |= sc->sc_i2c_base; + + kiic_setport(sc, (addr & 0x100) >> 8); + kiic_writereg(sc, ADDR, addr & 0xff); + kiic_writereg(sc, SUBADDR, subaddr); x = kiic_readreg(sc, CONTROL) | I2C_CT_ADDR; kiic_writereg(sc, CONTROL, x); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 17:50:20 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFE621065676; Sat, 5 Jun 2010 17:50:20 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DE958FC1C; Sat, 5 Jun 2010 17:50: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 o55HoKjP093497; Sat, 5 Jun 2010 17:50:20 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55HoKMO093495; Sat, 5 Jun 2010 17:50:20 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006051750.o55HoKMO093495@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 5 Jun 2010 17:50: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: r208841 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 17:50:20 -0000 Author: nwhitehorn Date: Sat Jun 5 17:50:20 2010 New Revision: 208841 URL: http://svn.freebsd.org/changeset/base/208841 Log: Add support for the I2C busses hanging off Apple system management chips. Modified: head/sys/powerpc/powermac/smu.c Modified: head/sys/powerpc/powermac/smu.c ============================================================================== --- head/sys/powerpc/powermac/smu.c Sat Jun 5 17:49:40 2010 (r208840) +++ head/sys/powerpc/powermac/smu.c Sat Jun 5 17:50:20 2010 (r208841) @@ -47,12 +47,16 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include +#include #include #include "clock_if.h" +#include "iicbus_if.h" struct smu_cmd { volatile uint8_t cmd; @@ -137,6 +141,8 @@ struct smu_softc { static int smu_probe(device_t); static int smu_attach(device_t); +static const struct ofw_bus_devinfo * + smu_get_devinfo(device_t bus, device_t dev); /* cpufreq notification hooks */ @@ -151,6 +157,7 @@ static int smu_settime(device_t dev, str static int smu_run_cmd(device_t dev, struct smu_cmd *cmd, int wait); static int smu_get_datablock(device_t dev, int8_t id, uint8_t *buf, size_t len); +static void smu_attach_i2c(device_t dev, phandle_t i2croot); static void smu_attach_fans(device_t dev, phandle_t fanroot); static void smu_attach_sensors(device_t dev, phandle_t sensroot); static void smu_fan_management_proc(void *xdev); @@ -171,6 +178,16 @@ static device_method_t smu_methods[] = /* Clock interface */ DEVMETHOD(clock_gettime, smu_gettime), DEVMETHOD(clock_settime, smu_settime), + + /* ofw_bus interface */ + DEVMETHOD(bus_child_pnpinfo_str,ofw_bus_gen_child_pnpinfo_str), + DEVMETHOD(ofw_bus_get_devinfo, smu_get_devinfo), + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + { 0, 0 }, }; @@ -300,8 +317,14 @@ smu_attach(device_t dev) if (strncmp(name, "sensors", 8) == 0) smu_attach_sensors(dev, child); + + if (strncmp(name, "smu-i2c-control", 15) == 0) + smu_attach_i2c(dev, child); } + /* Some SMUs have the I2C children directly under the bus. */ + smu_attach_i2c(dev, node); + /* * Collect calibration constants. */ @@ -368,7 +391,14 @@ smu_attach(device_t dev) */ clock_register(dev, 1000); - return (0); + return (bus_generic_attach(dev)); +} + +static const struct ofw_bus_devinfo * +smu_get_devinfo(device_t bus, device_t dev) +{ + + return (device_get_ivars(dev)); } static void @@ -787,8 +817,8 @@ smu_attach_fans(device_t dev, phandle_t CTLTYPE_INT | CTLFLAG_RD, &fan->max_rpm, sizeof(cell_t), "Maximum allowed RPM"); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "rpm", - CTLTYPE_INT | CTLFLAG_RW, dev, sc->sc_nfans, - smu_fanrpm_sysctl, "I", "Fan RPM"); + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, dev, + sc->sc_nfans, smu_fanrpm_sysctl, "I", "Fan RPM"); fan++; sc->sc_nfans++; @@ -951,8 +981,8 @@ smu_attach_sensors(device_t dev, phandle sprintf(sysctl_desc,"%s (%s)", sens->location, units); SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, - sysctl_name, CTLTYPE_INT | CTLFLAG_RD, dev, sc->sc_nsensors, - smu_sensor_sysctl, "I", sysctl_desc); + sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + dev, sc->sc_nsensors, smu_sensor_sysctl, "I", sysctl_desc); sens++; sc->sc_nsensors++; @@ -988,13 +1018,6 @@ smu_manage_fans(device_t smu) maxtemp = temp; } - if (maxtemp < 10) { /* Bail if no good sensors */ - for (i = 0; i < sc->sc_nfans; i++) - smu_fan_set_rpm(smu, &sc->sc_fans[i], - sc->sc_fans[i].unmanaged_rpm); - return; - } - if (maxtemp > sc->sc_critical_temp) { device_printf(smu, "WARNING: Current system temperature (%d C) " "exceeds critical temperature (%d C)! Shutting down!\n", @@ -1016,6 +1039,13 @@ smu_manage_fans(device_t smu) return; } + if (maxtemp < 10) { /* Bail if no good sensors */ + for (i = 0; i < sc->sc_nfans; i++) + smu_fan_set_rpm(smu, &sc->sc_fans[i], + sc->sc_fans[i].unmanaged_rpm); + return; + } + if (maxtemp - sc->sc_target_temp > 4) factor = 110; else if (maxtemp - sc->sc_target_temp > 1) @@ -1133,3 +1163,202 @@ smu_settime(device_t dev, struct timespe return (smu_run_cmd(dev, &cmd, 1)); } +/* SMU I2C Interface */ + +static int smuiic_probe(device_t dev); +static int smuiic_attach(device_t dev); +static int smuiic_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs); +static phandle_t smuiic_get_node(device_t bus, device_t dev); + +static device_method_t smuiic_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, smuiic_probe), + DEVMETHOD(device_attach, smuiic_attach), + + /* iicbus interface */ + DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_transfer, smuiic_transfer), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, smuiic_get_node), + + { 0, 0 } +}; + +struct smuiic_softc { + struct mtx sc_mtx; + volatile int sc_iic_inuse; + int sc_busno; +}; + +static driver_t smuiic_driver = { + "iichb", + smuiic_methods, + sizeof(struct smuiic_softc) +}; +static devclass_t smuiic_devclass; + +DRIVER_MODULE(smuiic, smu, smuiic_driver, smuiic_devclass, 0, 0); + +static void +smu_attach_i2c(device_t smu, phandle_t i2croot) +{ + phandle_t child; + device_t cdev; + struct ofw_bus_devinfo *dinfo; + char name[32]; + + for (child = OF_child(i2croot); child != 0; child = OF_peer(child)) { + if (OF_getprop(child, "name", name, sizeof(name)) <= 0) + continue; + + if (strcmp(name, "i2c-bus") != 0 && strcmp(name, "i2c") != 0) + continue; + + dinfo = malloc(sizeof(struct ofw_bus_devinfo), M_SMU, + M_WAITOK | M_ZERO); + if (ofw_bus_gen_setup_devinfo(dinfo, child) != 0) { + free(dinfo, M_SMU); + continue; + } + + cdev = device_add_child(smu, NULL, -1); + if (cdev == NULL) { + device_printf(smu, "<%s>: device_add_child failed\n", + dinfo->obd_name); + ofw_bus_gen_destroy_devinfo(dinfo); + free(dinfo, M_SMU); + continue; + } + device_set_ivars(cdev, dinfo); + } +} + +static int +smuiic_probe(device_t dev) +{ + const char *name; + + name = ofw_bus_get_name(dev); + if (name == NULL) + return (ENXIO); + + if (strcmp(name, "i2c-bus") == 0 || strcmp(name, "i2c") == 0) { + device_set_desc(dev, "SMU I2C controller"); + return (0); + } + + return (ENXIO); +} + +static int +smuiic_attach(device_t dev) +{ + struct smuiic_softc *sc = device_get_softc(dev); + mtx_init(&sc->sc_mtx, "smuiic", NULL, MTX_DEF); + sc->sc_iic_inuse = 0; + + /* Get our bus number */ + OF_getprop(ofw_bus_get_node(dev), "reg", &sc->sc_busno, + sizeof(sc->sc_busno)); + + /* Add the IIC bus layer */ + device_add_child(dev, "iicbus", -1); + + return (bus_generic_attach(dev)); +} + +static int +smuiic_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) +{ + struct smuiic_softc *sc = device_get_softc(dev); + struct smu_cmd cmd; + int i, j, error; + + mtx_lock(&sc->sc_mtx); + while (sc->sc_iic_inuse) + mtx_sleep(sc, &sc->sc_mtx, 0, "smuiic", 100); + + sc->sc_iic_inuse = 1; + error = 0; + + for (i = 0; i < nmsgs; i++) { + cmd.cmd = SMU_I2C; + cmd.data[0] = sc->sc_busno; + if (msgs[i].flags & IIC_M_NOSTOP) + cmd.data[1] = SMU_I2C_COMBINED; + else + cmd.data[1] = SMU_I2C_SIMPLE; + + cmd.data[2] = msgs[i].slave; + if (msgs[i].flags & IIC_M_RD) + cmd.data[2] |= 1; + + if (msgs[i].flags & IIC_M_NOSTOP) { + KASSERT(msgs[i].len < 4, + ("oversize I2C combined message")); + + cmd.data[3] = min(msgs[i].len, 3); + memcpy(&cmd.data[4], msgs[i].buf, min(msgs[i].len, 3)); + i++; /* Advance to next part of message */ + } else { + cmd.data[3] = 0; + memset(&cmd.data[4], 0, 3); + } + + cmd.data[7] = msgs[i].slave; + if (msgs[i].flags & IIC_M_RD) + cmd.data[7] |= 1; + + cmd.data[8] = msgs[i].len; + if (msgs[i].flags & IIC_M_RD) { + memset(&cmd.data[9], 0xff, msgs[i].len); + cmd.len = 9; + } else { + memcpy(&cmd.data[9], msgs[i].buf, msgs[i].len); + cmd.len = 9 + msgs[i].len; + } + + mtx_unlock(&sc->sc_mtx); + smu_run_cmd(device_get_parent(dev), &cmd, 1); + mtx_lock(&sc->sc_mtx); + + for (j = 0; j < 10; j++) { + cmd.cmd = SMU_I2C; + cmd.len = 1; + cmd.data[0] = 0; + memset(&cmd.data[1], 0xff, msgs[i].len); + + mtx_unlock(&sc->sc_mtx); + smu_run_cmd(device_get_parent(dev), &cmd, 1); + mtx_lock(&sc->sc_mtx); + + if (!(cmd.data[0] & 0x80)) + break; + + mtx_sleep(sc, &sc->sc_mtx, 0, "smuiic", 10); + } + + if (cmd.data[0] & 0x80) { + error = EIO; + msgs[i].len = 0; + goto exit; + } + memcpy(msgs[i].buf, &cmd.data[1], msgs[i].len); + msgs[i].len = cmd.len - 1; + } + + exit: + sc->sc_iic_inuse = 0; + mtx_unlock(&sc->sc_mtx); + wakeup(sc); + return (error); +} + +static phandle_t +smuiic_get_node(device_t bus, device_t dev) +{ + + return (ofw_bus_get_node(bus)); +} + From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 17:51:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BDD9106567A; Sat, 5 Jun 2010 17:51:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A2B68FC24; Sat, 5 Jun 2010 17:51: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 o55HpbjD093796; Sat, 5 Jun 2010 17:51:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55Hpbck093793; Sat, 5 Jun 2010 17:51:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006051751.o55Hpbck093793@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 5 Jun 2010 17:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208842 - in head/sys: conf powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 17:51:37 -0000 Author: nwhitehorn Date: Sat Jun 5 17:51:37 2010 New Revision: 208842 URL: http://svn.freebsd.org/changeset/base/208842 Log: Add a driver for the CPU temperature sensors attached over I2C on the PowerMac 11,2. Added: head/sys/powerpc/powermac/smusat.c (contents, props changed) Modified: head/sys/conf/files.powerpc Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Jun 5 17:50:20 2010 (r208841) +++ head/sys/conf/files.powerpc Sat Jun 5 17:51:37 2010 (r208842) @@ -139,6 +139,7 @@ powerpc/powermac/openpic_macio.c optiona powerpc/powermac/pswitch.c optional powermac pswitch powerpc/powermac/pmu.c optional powermac pmu powerpc/powermac/smu.c optional powermac smu +powerpc/powermac/smusat.c optional powermac smu powerpc/powermac/uninorth.c optional powermac powerpc/powermac/uninorthpci.c optional powermac pci powerpc/powermac/vcoregpio.c optional powermac Added: head/sys/powerpc/powermac/smusat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powermac/smusat.c Sat Jun 5 17:51:37 2010 (r208842) @@ -0,0 +1,262 @@ +/*- + * Copyright (c) 2010 Nathan Whitehorn + * 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 ``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 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 +#include +#include +#include + +#include +#include +#include +#include + +struct smu_sensor { + cell_t reg; + char location[32]; + enum { + SMU_CURRENT_SENSOR, + SMU_VOLTAGE_SENSOR, + SMU_POWER_SENSOR, + SMU_TEMP_SENSOR + } type; +}; + +static int smusat_probe(device_t); +static int smusat_attach(device_t); +static int smusat_sensor_sysctl(SYSCTL_HANDLER_ARGS); + +MALLOC_DEFINE(M_SMUSAT, "smusat", "SMU Sattelite Sensors"); + +static device_method_t smusat_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, smusat_probe), + DEVMETHOD(device_attach, smusat_attach), + { 0, 0 }, +}; + +struct smusat_softc { + struct smu_sensor *sc_sensors; + int sc_nsensors; + + uint8_t sc_cache[16]; + time_t sc_last_update; +}; + +static driver_t smusat_driver = { + "smusat", + smusat_methods, + sizeof(struct smusat_softc) +}; + +static devclass_t smusat_devclass; + +DRIVER_MODULE(smusat, iicbus, smusat_driver, smusat_devclass, 0, 0); + +static int +smusat_probe(device_t dev) +{ + const char *compat = ofw_bus_get_compat(dev); + + if (compat == NULL || strcmp(compat, "smu-sat") != 0) + return (ENXIO); + + device_set_desc(dev, "SMU Satellite Sensors"); + return (0); +} + +static int +smusat_attach(device_t dev) +{ + phandle_t child; + struct smu_sensor *sens; + struct smusat_softc *sc; + struct sysctl_oid *sensroot_oid; + struct sysctl_ctx_list *ctx; + char type[32]; + int i; + + sc = device_get_softc(dev); + sc->sc_nsensors = 0; + sc->sc_last_update = 0; + + for (child = OF_child(ofw_bus_get_node(dev)); child != 0; + child = OF_peer(child)) + sc->sc_nsensors++; + + if (sc->sc_nsensors == 0) { + device_printf(dev, "WARNING: No sensors detected!\n"); + return (-1); + } + + sc->sc_sensors = malloc(sc->sc_nsensors * sizeof(struct smu_sensor), + M_SMUSAT, M_WAITOK | M_ZERO); + + sens = sc->sc_sensors; + sc->sc_nsensors = 0; + + ctx = device_get_sysctl_ctx(dev); + sensroot_oid = device_get_sysctl_tree(dev); + + for (child = OF_child(ofw_bus_get_node(dev)); child != 0; + child = OF_peer(child)) { + char sysctl_name[40], sysctl_desc[40]; + const char *units; + + sens->reg = 0; + OF_getprop(child, "reg", &sens->reg, sizeof(sens->reg)); + if (sens->reg < 0x30) + continue; + + sens->reg -= 0x30; + OF_getprop(child, "location", sens->location, + sizeof(sens->location)); + + OF_getprop(child, "device_type", type, sizeof(type)); + + if (strcmp(type, "current-sensor") == 0) { + sens->type = SMU_CURRENT_SENSOR; + units = "mA"; + } else if (strcmp(type, "temp-sensor") == 0) { + sens->type = SMU_TEMP_SENSOR; + units = "C"; + } else if (strcmp(type, "voltage-sensor") == 0) { + sens->type = SMU_VOLTAGE_SENSOR; + units = "mV"; + } else if (strcmp(type, "power-sensor") == 0) { + sens->type = SMU_POWER_SENSOR; + units = "mW"; + } else { + continue; + } + + for (i = 0; i < strlen(sens->location); i++) { + sysctl_name[i] = tolower(sens->location[i]); + if (isspace(sysctl_name[i])) + sysctl_name[i] = '_'; + } + sysctl_name[i] = 0; + + sprintf(sysctl_desc,"%s (%s)", sens->location, units); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(sensroot_oid), OID_AUTO, + sysctl_name, CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, + sc->sc_nsensors, smusat_sensor_sysctl, "I", sysctl_desc); + + sens++; + sc->sc_nsensors++; + } + + return (0); +} + +static int +smusat_updatecache(device_t dev) +{ + uint8_t reg = 0x3f; + struct smusat_softc *sc = device_get_softc(dev); + struct iic_msg msgs[2] = { + {0, IIC_M_WR | IIC_M_NOSTOP, 1, ®}, + {0, IIC_M_RD, 16, sc->sc_cache}, + }; + + msgs[0].slave = msgs[1].slave = iicbus_get_addr(dev); + sc->sc_last_update = time_uptime; + + return (iicbus_transfer(dev, msgs, 2)); +} + +static int +smusat_sensor_read(device_t dev, struct smu_sensor *sens, int *val) +{ + int value; + struct smusat_softc *sc; + + sc = device_get_softc(dev); + + if (time_uptime - sc->sc_last_update > 1) + smusat_updatecache(dev); + + value = (sc->sc_cache[sens->reg*2] << 8) + + sc->sc_cache[sens->reg*2 + 1]; + + switch (sens->type) { + case SMU_TEMP_SENSOR: + /* 16.16 */ + value <<= 10; + /* Kill the .16 */ + value >>= 16; + break; + case SMU_VOLTAGE_SENSOR: + /* 16.16 */ + value <<= 4; + /* Kill the .16 */ + value >>= 16; + break; + case SMU_CURRENT_SENSOR: + /* 16.16 */ + value <<= 8; + /* Kill the .16 */ + value >>= 16; + break; + case SMU_POWER_SENSOR: + /* Doesn't exist */ + break; + } + + *val = value; + return (0); +} + +static int +smusat_sensor_sysctl(SYSCTL_HANDLER_ARGS) +{ + device_t dev; + struct smusat_softc *sc; + struct smu_sensor *sens; + int value, error; + + dev = arg1; + sc = device_get_softc(dev); + sens = &sc->sc_sensors[arg2]; + + error = smusat_sensor_read(dev, sens, &value); + if (error != 0) + return (error); + + error = sysctl_handle_int(oidp, &value, 0, req); + + return (error); +} + From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 18:20:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4839F1065672; Sat, 5 Jun 2010 18:20:10 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D3548FC13; Sat, 5 Jun 2010 18: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 o55IK9TG000343; Sat, 5 Jun 2010 18:20:09 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55IK9YR000339; Sat, 5 Jun 2010 18:20:09 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201006051820.o55IK9YR000339@svn.freebsd.org> From: Alan Cox Date: Sat, 5 Jun 2010 18:20: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: r208846 - in head/sys: arm/arm powerpc/booke sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 18:20:10 -0000 Author: alc Date: Sat Jun 5 18:20:09 2010 New Revision: 208846 URL: http://svn.freebsd.org/changeset/base/208846 Log: Don't set PG_WRITEABLE in pmap_enter() unless the page is managed. Correct a typo in a nearby comment on sparc64. Modified: head/sys/arm/arm/pmap.c head/sys/powerpc/booke/pmap.c head/sys/sparc64/sparc64/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Sat Jun 5 18:01:34 2010 (r208845) +++ head/sys/arm/arm/pmap.c Sat Jun 5 18:20:09 2010 (r208846) @@ -3412,7 +3412,8 @@ do_l2b_alloc: if (prot & VM_PROT_WRITE) { npte |= L2_S_PROT_W; - if (m != NULL) + if (m != NULL && + (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) vm_page_flag_set(m, PG_WRITEABLE); } npte |= pte_l2_s_cache_mode; Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sat Jun 5 18:01:34 2010 (r208845) +++ head/sys/powerpc/booke/pmap.c Sat Jun 5 18:20:09 2010 (r208846) @@ -1596,7 +1596,8 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t if (!su) flags |= PTE_UW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((flags & PTE_MANAGED) != 0) + vm_page_flag_set(m, PG_WRITEABLE); } else { /* Handle modified pages, sense modify status. */ @@ -1662,7 +1663,8 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t if (!su) flags |= PTE_UW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + vm_page_flag_set(m, PG_WRITEABLE); } if (prot & VM_PROT_EXECUTE) { Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Sat Jun 5 18:01:34 2010 (r208845) +++ head/sys/sparc64/sparc64/pmap.c Sat Jun 5 18:20:09 2010 (r208846) @@ -1409,7 +1409,8 @@ pmap_enter_locked(pmap_t pm, vm_offset_t tp->tte_data |= TD_SW; if (wired) tp->tte_data |= TD_W; - vm_page_flag_set(m, PG_WRITEABLE); + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + vm_page_flag_set(m, PG_WRITEABLE); } else if ((data & TD_W) != 0) vm_page_dirty(m); @@ -1429,7 +1430,7 @@ pmap_enter_locked(pmap_t pm, vm_offset_t } else { /* * If there is an existing mapping, but its for a different - * phsyical address, delete the old mapping. + * physical address, delete the old mapping. */ if (tp != NULL) { CTR0(KTR_PMAP, "pmap_enter_locked: replace"); @@ -1449,7 +1450,8 @@ pmap_enter_locked(pmap_t pm, vm_offset_t data |= TD_P; if ((prot & VM_PROT_WRITE) != 0) { data |= TD_SW; - vm_page_flag_set(m, PG_WRITEABLE); + if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) + vm_page_flag_set(m, PG_WRITEABLE); } if (prot & VM_PROT_EXECUTE) { data |= TD_EXEC; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 18:24:42 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B0DC1065674; Sat, 5 Jun 2010 18:24:42 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39F928FC0A; Sat, 5 Jun 2010 18:24: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 o55IOfN0001386; Sat, 5 Jun 2010 18:24:41 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55IOfDr001384; Sat, 5 Jun 2010 18:24:41 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201006051824.o55IOfDr001384@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 5 Jun 2010 18:24: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: r208847 - head/sys/powerpc/aim X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 18:24:42 -0000 Author: nwhitehorn Date: Sat Jun 5 18:24:41 2010 New Revision: 208847 URL: http://svn.freebsd.org/changeset/base/208847 Log: Correct a harmless typo introduced when copying code from mmu_oea64. Submitted by: alc MFC after: 8.1-RELEASE Modified: head/sys/powerpc/aim/mmu_oea.c Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Sat Jun 5 18:20:09 2010 (r208846) +++ head/sys/powerpc/aim/mmu_oea.c Sat Jun 5 18:24:41 2010 (r208847) @@ -1786,7 +1786,7 @@ moea_remove_all(mmu_t mmu, vm_page_t m) PMAP_UNLOCK(pmap); } if ((m->flags & PG_WRITEABLE) && moea_is_modified(mmu, m)) { - moea_attr_clear(m, LPTE_CHG); + moea_attr_clear(m, PTE_CHG); vm_page_dirty(m); } vm_page_flag_clear(m, PG_WRITEABLE); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 20:37:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 218A1106567A; Sat, 5 Jun 2010 20:37:41 +0000 (UTC) (envelope-from mjacob@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB0088FC1E; Sat, 5 Jun 2010 20:37: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 o55Kbe0t031311; Sat, 5 Jun 2010 20:37:40 GMT (envelope-from mjacob@svn.freebsd.org) Received: (from mjacob@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55Kbe4g031309; Sat, 5 Jun 2010 20:37:40 GMT (envelope-from mjacob@svn.freebsd.org) Message-Id: <201006052037.o55Kbe4g031309@svn.freebsd.org> From: Matt Jacob Date: Sat, 5 Jun 2010 20:37: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: r208849 - head/sys/dev/isp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 20:37:41 -0000 Author: mjacob Date: Sat Jun 5 20:37:40 2010 New Revision: 208849 URL: http://svn.freebsd.org/changeset/base/208849 Log: Be more specific about which CDB length we're going to use. Not really a likely bug but we might as well be clearer. Found with: Coverity Prevent(tm) CID: 3981 MFC after: 2 weeks Modified: head/sys/dev/isp/isp.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Sat Jun 5 18:30:42 2010 (r208848) +++ head/sys/dev/isp/isp.c Sat Jun 5 20:37:40 2010 (r208849) @@ -4184,7 +4184,7 @@ int isp_start(XS_T *xs) { ispsoftc_t *isp; - uint32_t handle; + uint32_t handle, cdblen; uint8_t local[QENTRY_LEN]; ispreq_t *reqp; void *cdbp, *qep; @@ -4369,11 +4369,17 @@ isp_start(XS_T *xs) tptr = &reqp->req_time; + /* + * NB: we do not support long CDBs + */ + cdblen = XS_CDBLEN(xs); + if (IS_SCSI(isp)) { reqp->req_target = target | (XS_CHANNEL(xs) << 7); reqp->req_lun_trn = XS_LUN(xs); - reqp->req_cdblen = XS_CDBLEN(xs); + cdblen = MIN(cdblen, sizeof (reqp->req_cdb)); cdbp = reqp->req_cdb; + reqp->req_cdblen = cdblen; } else if (IS_24XX(isp)) { ispreqt7_t *t7 = (ispreqt7_t *)local; fcportdb_t *lp; @@ -4388,25 +4394,29 @@ isp_start(XS_T *xs) t7->req_lun[0] |= 0x40; } t7->req_lun[1] = XS_LUN(xs); - cdbp = t7->req_cdb; tptr = &t7->req_time; + cdbp = t7->req_cdb; + cdblen = MIN(cdblen, sizeof (t7->req_cdb)); } else if (ISP_CAP_2KLOGIN(isp)) { ispreqt2e_t *t2e = (ispreqt2e_t *)local; t2e->req_target = target; t2e->req_scclun = XS_LUN(xs); cdbp = t2e->req_cdb; + cdblen = MIN(cdblen, sizeof (t2e->req_cdb)); } else if (ISP_CAP_SCCFW(isp)) { ispreqt2_t *t2 = (ispreqt2_t *)local; t2->req_target = target; t2->req_scclun = XS_LUN(xs); cdbp = t2->req_cdb; + cdblen = MIN(cdblen, sizeof (t2->req_cdb)); } else { ispreqt2_t *t2 = (ispreqt2_t *)local; t2->req_target = target; t2->req_lun_trn = XS_LUN(xs); cdbp = t2->req_cdb; + cdblen = MIN(cdblen, sizeof (t2->req_cdb)); } - ISP_MEMCPY(cdbp, XS_CDBP(xs), XS_CDBLEN(xs)); + ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen); *tptr = XS_TIME(xs) / 1000; if (*tptr == 0 && XS_TIME(xs)) { From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 21:17:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 595671065674; Sat, 5 Jun 2010 21:17:24 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 483748FC13; Sat, 5 Jun 2010 21:17: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 o55LHOg7040369; Sat, 5 Jun 2010 21:17:24 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55LHOci040367; Sat, 5 Jun 2010 21:17:24 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201006052117.o55LHOci040367@svn.freebsd.org> From: Randall Stewart Date: Sat, 5 Jun 2010 21:17: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: r208852 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 21:17:25 -0000 Author: rrs Date: Sat Jun 5 21:17:23 2010 New Revision: 208852 URL: http://svn.freebsd.org/changeset/base/208852 Log: This fixes a bug in the close up of a socket that had un-accepted assoc's. Basically the assoc (and inp) would get stuck and never get cleaned up. MFC after: 1 week Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Jun 5 20:51:56 2010 (r208851) +++ head/sys/netinet/sctp_pcb.c Sat Jun 5 21:17:23 2010 (r208852) @@ -3164,8 +3164,17 @@ sctp_inpcb_free(struct sctp_inpcb *inp, nasoc = LIST_NEXT(asoc, sctp_tcblist); if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { /* Skip guys being freed */ - /* asoc->sctp_socket = NULL; FIXME MT */ cnt_in_sd++; + if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) { + /* + * Special case - we did not start a + * kill timer on the asoc due to it + * was not closed. So go ahead and + * start it now. + */ + asoc->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE; + sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, asoc, NULL); + } SCTP_TCB_UNLOCK(asoc); continue; } @@ -4590,8 +4599,12 @@ sctp_free_assoc(struct sctp_inpcb *inp, * Someone holds a reference OR the socket is unaccepted * yet. */ - if (stcb->asoc.refcnt) + if ((stcb->asoc.refcnt) || + (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) { + stcb->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE; sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL); + } SCTP_TCB_UNLOCK(stcb); if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 21:20:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26B5A106566B; Sat, 5 Jun 2010 21:20:29 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F06A48FC1A; Sat, 5 Jun 2010 21:20: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 o55LKSdH041092; Sat, 5 Jun 2010 21:20:28 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55LKSLA041089; Sat, 5 Jun 2010 21:20:28 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201006052120.o55LKSLA041089@svn.freebsd.org> From: Randall Stewart Date: Sat, 5 Jun 2010 21:20: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: r208853 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 21:20:29 -0000 Author: rrs Date: Sat Jun 5 21:20:28 2010 New Revision: 208853 URL: http://svn.freebsd.org/changeset/base/208853 Log: This does two changes: 1) Makes it so that the INVARIANT function validate nolocks is available anywhere. 2) Fixes a BUG where a close has been done on a collision socket and the cookie processing would return leaving a lock held. MFC after: 1 week Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_pcb.h Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Jun 5 21:17:23 2010 (r208852) +++ head/sys/netinet/sctp_input.c Sat Jun 5 21:20:28 2010 (r208853) @@ -3067,7 +3067,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; @@ -4861,6 +4861,9 @@ process_control_chunks: } else { if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ + if (stcb) { + SCTP_TCB_UNLOCK(stcb); + } *offset = length; return (NULL); } @@ -5408,13 +5411,16 @@ sctp_process_ecn_marked_b(struct sctp_tc } #ifdef INVARIANTS -static void -sctp_validate_no_locks(struct sctp_inpcb *inp) +#ifdef __GNUC__ +__attribute__((noinline)) +#endif + void + sctp_validate_no_locks(struct sctp_inpcb *inp) { - struct sctp_tcb *stcb; + struct sctp_tcb *lstcb; - LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { - if (mtx_owned(&stcb->tcb_mtx)) { + LIST_FOREACH(lstcb, &inp->sctp_asoc_list, sctp_tcblist) { + if (mtx_owned(&lstcb->tcb_mtx)) { panic("Own lock on stcb at return from input"); } } Modified: head/sys/netinet/sctp_pcb.h ============================================================================== --- head/sys/netinet/sctp_pcb.h Sat Jun 5 21:17:23 2010 (r208852) +++ head/sys/netinet/sctp_pcb.h Sat Jun 5 21:20:28 2010 (r208853) @@ -621,5 +621,11 @@ sctp_initiate_iterator(inp_func inpf, struct sctp_inpcb *, uint8_t co_off); +#ifdef INVARIANTS +void + sctp_validate_no_locks(struct sctp_inpcb *inp); + +#endif + #endif /* _KERNEL */ #endif /* !__sctp_pcb_h__ */ From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 21:22:59 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D28A106566B; Sat, 5 Jun 2010 21:22:59 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D97DF8FC16; Sat, 5 Jun 2010 21: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 o55LMwI9041716; Sat, 5 Jun 2010 21:22:58 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55LMwIZ041714; Sat, 5 Jun 2010 21:22:58 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201006052122.o55LMwIZ041714@svn.freebsd.org> From: Randall Stewart Date: Sat, 5 Jun 2010 21:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208854 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 21:22:59 -0000 Author: rrs Date: Sat Jun 5 21:22:58 2010 New Revision: 208854 URL: http://svn.freebsd.org/changeset/base/208854 Log: Use the proper increment macro when increasing the number on sent_queue_retran_cnt. MFC after: 1 week Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sat Jun 5 21:20:28 2010 (r208853) +++ head/sys/netinet/sctp_indata.c Sat Jun 5 21:22:58 2010 (r208854) @@ -3849,7 +3849,8 @@ sctp_window_probe_recovery(struct sctp_t sctp_total_flight_decrease(stcb, tp1); /* Now mark for resend */ tp1->sent = SCTP_DATAGRAM_RESEND; - asoc->sent_queue_retran_cnt++; + sctp_ucount_incr(asoc->sent_queue_retran_cnt); + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_WP, tp1->whoTo->flight_size, @@ -4262,7 +4263,7 @@ again: sctp_flight_size_increase(tp1); sctp_total_flight_increase(stcb, tp1); } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { - asoc->sent_queue_retran_cnt++; + sctp_ucount_incr(asoc->sent_queue_retran_cnt); } } } @@ -5263,7 +5264,7 @@ again: sctp_flight_size_increase(tp1); sctp_total_flight_increase(stcb, tp1); } else if (tp1->sent == SCTP_DATAGRAM_RESEND) { - asoc->sent_queue_retran_cnt++; + sctp_ucount_incr(asoc->sent_queue_retran_cnt); } } } From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 21:27:44 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 549191065679; Sat, 5 Jun 2010 21:27:44 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4311B8FC08; Sat, 5 Jun 2010 21:27: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 o55LRhOC042815; Sat, 5 Jun 2010 21:27:43 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55LRh7w042813; Sat, 5 Jun 2010 21:27:43 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201006052127.o55LRh7w042813@svn.freebsd.org> From: Randall Stewart Date: Sat, 5 Jun 2010 21:27: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: r208855 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 21:27:44 -0000 Author: rrs Date: Sat Jun 5 21:27:43 2010 New Revision: 208855 URL: http://svn.freebsd.org/changeset/base/208855 Log: This change does the following: 1) Fix the alignment of a comment. 2) Fix a BUG where we were NOT paying attention to the RESEND marking on retransmitting control chunks.. and worse we were not decrementing the retran count that could cause us to loop forever. 3) Add in the valdiate_no_lock function on invariants so that we will really check all ways out to be sure a lock does not slip out locked. MFC after: 1 week. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Jun 5 21:22:58 2010 (r208854) +++ head/sys/netinet/sctp_output.c Sat Jun 5 21:27:43 2010 (r208855) @@ -3053,32 +3053,32 @@ sctp_source_address_selection(struct sct * it out * zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz * For V4 - *------------------------------------------ + * ------------------------------------------ * source * dest * result * ----------------------------------------- * Private * Global * NAT * ----------------------------------------- * Private * Private * No problem * ----------------------------------------- - * Global * Private * Huh, How will this work? + * Global * Private * Huh, How will this work? * ----------------------------------------- - * Global * Global * No Problem - *------------------------------------------ + * Global * Global * No Problem + *------------------------------------------ * zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz * For V6 - *------------------------------------------ + *------------------------------------------ * source * dest * result * ----------------------------------------- * Linklocal * Global * * ----------------------------------------- * Linklocal * Linklocal * No problem * ----------------------------------------- - * Global * Linklocal * Huh, How will this work? + * Global * Linklocal * Huh, How will this work? * ----------------------------------------- - * Global * Global * No Problem - *------------------------------------------ + * Global * Global * No Problem + *------------------------------------------ * zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz - * + * * And then we add to that what happens if there are multiple addresses * assigned to an interface. Remember the ifa on a ifn is a linked * list of addresses. So one interface can have more than one IP @@ -3091,13 +3091,13 @@ sctp_source_address_selection(struct sct * Decisions: * * - count the number of addresses on the interface. - * - if it is one, no problem except case . - * For we will assume a NAT out there. + * - if it is one, no problem except case . + * For we will assume a NAT out there. * - if there are more than one, then we need to worry about scope P * or G. We should prefer G -> G and P -> P if possible. * Then as a secondary fall back to mixed types G->P being a last * ditch one. - * - The above all works for bound all, but bound specific we need to + * - The above all works for bound all, but bound specific we need to * use the same concept but instead only consider the bound * addresses. If the bound set is NOT assigned to the interface then * we must use rotation amongst the bound addresses.. @@ -8913,6 +8913,9 @@ sctp_chunk_retransmission(struct sctp_in if ((chk->rec.chunk_id.id == SCTP_COOKIE_ECHO) || (chk->rec.chunk_id.id == SCTP_STREAM_RESET) || (chk->rec.chunk_id.id == SCTP_FORWARD_CUM_TSN)) { + if (chk->sent != SCTP_DATAGRAM_RESEND) { + continue; + } if (chk->rec.chunk_id.id == SCTP_STREAM_RESET) { if (chk != asoc->str_reset) { /* @@ -8973,7 +8976,7 @@ sctp_chunk_retransmission(struct sctp_in /* (void)SCTP_GETTIME_TIMEVAL(&chk->whoTo->last_sent_time); */ *cnt_out += 1; chk->sent = SCTP_DATAGRAM_SENT; - /* sctp_ucount_decr(asoc->sent_queue_retran_cnt); */ + sctp_ucount_decr(stcb->asoc.sent_queue_retran_cnt); if (fwd_tsn == 0) { return (0); } else { @@ -13427,6 +13430,13 @@ out_unlocked: } } #endif +#ifdef INVARIANTS + if (inp) { + sctp_validate_no_locks(inp); + } else { + printf("Warning - inp is NULL so cant validate locks\n"); + } +#endif if (top) { sctp_m_freem(top); } From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 21:33:17 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BCC01065678; Sat, 5 Jun 2010 21:33:17 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EEC3D8FC1D; Sat, 5 Jun 2010 21: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 o55LXG6i044155; Sat, 5 Jun 2010 21:33:16 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55LXGJ5044152; Sat, 5 Jun 2010 21:33:16 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201006052133.o55LXGJ5044152@svn.freebsd.org> From: Randall Stewart Date: Sat, 5 Jun 2010 21:33: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: r208856 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 21:33:17 -0000 Author: rrs Date: Sat Jun 5 21:33:16 2010 New Revision: 208856 URL: http://svn.freebsd.org/changeset/base/208856 Log: Spacing issues MFC after: 1 Week Modified: head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_bsd_addr.c Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sat Jun 5 21:27:43 2010 (r208855) +++ head/sys/netinet/sctp_auth.c Sat Jun 5 21:33:16 2010 (r208856) @@ -895,9 +895,9 @@ static inline int sctp_get_hmac_block_len(uint16_t hmac_algo) { switch (hmac_algo) { - case SCTP_AUTH_HMAC_ID_SHA1: + case SCTP_AUTH_HMAC_ID_SHA1: #ifdef HAVE_SHA224 - case SCTP_AUTH_HMAC_ID_SHA224: + case SCTP_AUTH_HMAC_ID_SHA224: #endif return (64); #ifdef HAVE_SHA2 @@ -918,7 +918,7 @@ static void sctp_hmac_init(uint16_t hmac_algo, sctp_hash_context_t * ctx) { switch (hmac_algo) { - case SCTP_AUTH_HMAC_ID_SHA1: + case SCTP_AUTH_HMAC_ID_SHA1: SHA1_Init(&ctx->sha1); break; #ifdef HAVE_SHA224 @@ -948,7 +948,7 @@ sctp_hmac_update(uint16_t hmac_algo, sct uint8_t * text, uint32_t textlen) { switch (hmac_algo) { - case SCTP_AUTH_HMAC_ID_SHA1: + case SCTP_AUTH_HMAC_ID_SHA1: SHA1_Update(&ctx->sha1, text, textlen); break; #ifdef HAVE_SHA224 @@ -978,7 +978,7 @@ sctp_hmac_final(uint16_t hmac_algo, sctp uint8_t * digest) { switch (hmac_algo) { - case SCTP_AUTH_HMAC_ID_SHA1: + case SCTP_AUTH_HMAC_ID_SHA1: SHA1_Final(digest, &ctx->sha1); break; #ifdef HAVE_SHA224 Modified: head/sys/netinet/sctp_bsd_addr.c ============================================================================== --- head/sys/netinet/sctp_bsd_addr.c Sat Jun 5 21:27:43 2010 (r208855) +++ head/sys/netinet/sctp_bsd_addr.c Sat Jun 5 21:33:16 2010 (r208856) @@ -140,7 +140,6 @@ sctp_startup_iterator(void) SCTP_KTRHEAD_NAME); } - #ifdef INET6 void From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 21:39:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 384791065679; Sat, 5 Jun 2010 21:39:53 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2725D8FC17; Sat, 5 Jun 2010 21:39: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 o55Ldrv7045697; Sat, 5 Jun 2010 21:39:53 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55LdrBK045695; Sat, 5 Jun 2010 21:39:53 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <201006052139.o55LdrBK045695@svn.freebsd.org> From: Randall Stewart Date: Sat, 5 Jun 2010 21:39: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: r208857 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 21:39:53 -0000 Author: rrs Date: Sat Jun 5 21:39:52 2010 New Revision: 208857 URL: http://svn.freebsd.org/changeset/base/208857 Log: Purge out a Windows def that somehow slipped past the scrubber. MFC after: 1 Week Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Sat Jun 5 21:33:16 2010 (r208856) +++ head/sys/netinet/sctputil.c Sat Jun 5 21:39:52 2010 (r208857) @@ -53,15 +53,9 @@ __FBSDID("$FreeBSD$"); #define NUMBER_OF_MTU_SIZES 18 -#if defined(__Windows__) && !defined(SCTP_LOCAL_TRACE_BUF) -#include "eventrace_netinet.h" -#include "sctputil.tmh" /* this is the file that will be auto - * generated */ -#else #ifndef KTR_SCTP #define KTR_SCTP KTR_SUBSYS #endif -#endif void sctp_sblog(struct sockbuf *sb, @@ -4207,7 +4201,7 @@ void sctp_print_address_pkt(struct ip *iph, struct sctphdr *sh) { switch (iph->ip_v) { - case IPVERSION: + case IPVERSION: { struct sockaddr_in lsa, fsa; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 22:57:54 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 695A1106566B; Sat, 5 Jun 2010 22:57:54 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F1748FC1E; Sat, 5 Jun 2010 22:57: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 o55Mvsjv062965; Sat, 5 Jun 2010 22:57:54 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55Mvsvc062961; Sat, 5 Jun 2010 22:57:54 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201006052257.o55Mvsvc062961@svn.freebsd.org> From: Fabien Thomas Date: Sat, 5 Jun 2010 22:57: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: r208858 - head/usr.sbin/pmcstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 22:57:54 -0000 Author: fabient Date: Sat Jun 5 22:57:53 2010 New Revision: 208858 URL: http://svn.freebsd.org/changeset/base/208858 Log: Fix warnings found by Coverity. Found with: Coverity Prevent(tm) MFC after: 1 month Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat_log.c Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c ============================================================================== --- head/usr.sbin/pmcstat/pmcpl_calltree.c Sat Jun 5 21:39:52 2010 (r208857) +++ head/usr.sbin/pmcstat/pmcpl_calltree.c Sat Jun 5 22:57:53 2010 (r208858) @@ -896,10 +896,12 @@ pmcpl_ct_node_printchild(struct pmcpl_ct /* Call address, line, sample. */ addr = ct->pct_image->pi_vaddr + ct->pct_func; line = 0; - pmcstat_image_addr2line(ct->pct_image, addr, sourcefile, + if (pmcstat_image_addr2line(ct->pct_image, addr, sourcefile, sizeof(sourcefile), &line, - funcname, sizeof(funcname)); - fprintf(args.pa_graphfile, "%p %u", (void *)addr, line); + funcname, sizeof(funcname))) + fprintf(args.pa_graphfile, "%p %u", (void *)addr, line); + else + fprintf(args.pa_graphfile, "* *"); } else fprintf(args.pa_graphfile, "* *"); Modified: head/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.c Sat Jun 5 21:39:52 2010 (r208857) +++ head/usr.sbin/pmcstat/pmcstat.c Sat Jun 5 22:57:53 2010 (r208858) @@ -292,7 +292,8 @@ pmcstat_find_targets(const char *spec) 0, &nproc)) == NULL) err(EX_OSERR, "ERROR: Cannot get process list: %s", kvm_geterr(pmcstat_kvm)); - } + } else + nproc = 0; if ((rv = regcomp(®, spec, REG_EXTENDED|REG_NOSUB)) != 0) { regerror(rv, ®, errbuf, sizeof(errbuf)); Modified: head/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat_log.c Sat Jun 5 21:39:52 2010 (r208857) +++ head/usr.sbin/pmcstat/pmcstat_log.c Sat Jun 5 22:57:53 2010 (r208858) @@ -1957,6 +1957,7 @@ pmcstat_keypress_log(void) case 'q': wprintw(w, "exiting..."); ret = 1; + break; default: if (plugins[args.pa_plugin].pl_topkeypress != NULL) if (plugins[args.pa_plugin].pl_topkeypress(c, w)) From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 22:59:37 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80453106567C; Sat, 5 Jun 2010 22:59:37 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6EFFD8FC1F; Sat, 5 Jun 2010 22:59: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 o55MxbEZ063395; Sat, 5 Jun 2010 22:59:37 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55MxbwQ063389; Sat, 5 Jun 2010 22:59:37 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201006052259.o55MxbwQ063389@svn.freebsd.org> From: Robert Watson Date: Sat, 5 Jun 2010 22:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208859 - head/tools/tools/netrate/tcpp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 22:59:37 -0000 Author: rwatson Date: Sat Jun 5 22:59:37 2010 New Revision: 208859 URL: http://svn.freebsd.org/changeset/base/208859 Log: Although we currently don't compile in CPU-pinning support by default, add a -P to enable it if it were. MFC after: 1 week Sponsored by: Juniper Networks Modified: head/tools/tools/netrate/tcpp/README head/tools/tools/netrate/tcpp/tcpp.c head/tools/tools/netrate/tcpp/tcpp.h head/tools/tools/netrate/tcpp/tcpp_client.c head/tools/tools/netrate/tcpp/tcpp_server.c Modified: head/tools/tools/netrate/tcpp/README ============================================================================== --- head/tools/tools/netrate/tcpp/README Sat Jun 5 22:57:53 2010 (r208858) +++ head/tools/tools/netrate/tcpp/README Sat Jun 5 22:59:37 2010 (r208859) @@ -39,6 +39,7 @@ The client has more to configure, with t -c Select client mode, and specific dest IP -C Print connections/second instead of GBps + -P Pin each worker to a CPU -M Number of sequential local IPs to use; req. -l -T Include CPU use summary in stats at end of run -b Data bytes per connection Modified: head/tools/tools/netrate/tcpp/tcpp.c ============================================================================== --- head/tools/tools/netrate/tcpp/tcpp.c Sat Jun 5 22:57:53 2010 (r208858) +++ head/tools/tools/netrate/tcpp/tcpp.c Sat Jun 5 22:59:37 2010 (r208859) @@ -51,7 +51,7 @@ struct sockaddr_in remoteip; /* Base target address. */ struct sockaddr_in localipbase; /* Base local address, if -l. */ -int cflag, lflag, mflag, pflag, sflag, tflag, Cflag, Mflag, Tflag; +int cflag, lflag, mflag, pflag, sflag, tflag, Cflag, Mflag, Pflag, Tflag; uint64_t bflag; u_short rflag; @@ -61,24 +61,27 @@ usage(void) fprintf(stderr, "client: tcpp" " -c remoteIP" - " [-CT]" + " [-CPT]" " [-M localIPcount]" " [-l localIPbase]" + "\n\t" " [-b bytespertcp]" " [-m maxtcpsatonce]" - "\n" - "\t" " [-p procs]" " [-t tcpsperproc]" + "\n" + "\t" " [-r baseport]" "\n"); fprintf(stderr, "server: tcpp" " -s" - " [-T]" + " [-PT]" " [-l localIPbase]" " [-m maxtcpsatonce]" " [-p procs]" + "\n" + "\t" " [-r baseport]" "\n"); exit(EX_USAGE); @@ -109,7 +112,7 @@ main(int argc, char *argv[]) rflag = BASEPORT_DEFAULT; tflag = TCPS_DEFAULT; Mflag = 1; - while ((ch = getopt(argc, argv, "b:c:l:m:p:r:st:CM:T")) != -1) { + while ((ch = getopt(argc, argv, "b:c:l:m:p:r:st:CM:PT")) != -1) { switch (ch) { case 'b': ll = strtoll(optarg, &dummy, 10); @@ -173,6 +176,14 @@ main(int argc, char *argv[]) Mflag = ll; break; + case 'P': +#if defined(CPU_SETSIZE) && 0 + Pflag++; + break; +#else + errx(EX_USAGE, "-P current unsupported"); +#endif + case 'T': Tflag++; break; Modified: head/tools/tools/netrate/tcpp/tcpp.h ============================================================================== --- head/tools/tools/netrate/tcpp/tcpp.h Sat Jun 5 22:57:53 2010 (r208858) +++ head/tools/tools/netrate/tcpp/tcpp.h Sat Jun 5 22:59:37 2010 (r208859) @@ -31,7 +31,7 @@ extern struct sockaddr_in localipbase, remoteip; extern int cflag, lflag, mflag, pflag, sflag, tflag; -extern int Cflag, Iflag, Mflag, Tflag; +extern int Cflag, Iflag, Mflag, Pflag, Tflag; extern uint64_t bflag; extern u_short rflag; Modified: head/tools/tools/netrate/tcpp/tcpp_client.c ============================================================================== --- head/tools/tools/netrate/tcpp/tcpp_client.c Sat Jun 5 22:57:53 2010 (r208858) +++ head/tools/tools/netrate/tcpp/tcpp_client.c Sat Jun 5 22:59:37 2010 (r208859) @@ -224,17 +224,19 @@ tcpp_client_worker(int workernum) int ncpus; size_t len; - len = sizeof(ncpus); - if (sysctlbyname(SYSCTLNAME_CPUS, &ncpus, &len, NULL, 0) < 0) - err(-1, "sysctlbyname: %s", SYSCTLNAME_CPUS); - if (len != sizeof(ncpus)) - errx(-1, "sysctlbyname: %s: len %jd", SYSCTLNAME_CPUS, - (intmax_t)len); - - CPU_ZERO(&mask); - CPU_SET(workernum % ncpus, &mask); - if (sched_setaffinity(0, CPU_SETSIZE, &mask) < 0) - err(-1, "sched_setaffinity"); + if (Pflag) { + len = sizeof(ncpus); + if (sysctlbyname(SYSCTLNAME_CPUS, &ncpus, &len, NULL, 0) < 0) + err(-1, "sysctlbyname: %s", SYSCTLNAME_CPUS); + if (len != sizeof(ncpus)) + errx(-1, "sysctlbyname: %s: len %jd", SYSCTLNAME_CPUS, + (intmax_t)len); + + CPU_ZERO(&mask); + CPU_SET(workernum % ncpus, &mask); + if (sched_setaffinity(0, CPU_SETSIZE, &mask) < 0) + err(-1, "sched_setaffinity"); + } #endif setproctitle("tcpp_client %d", workernum); Modified: head/tools/tools/netrate/tcpp/tcpp_server.c ============================================================================== --- head/tools/tools/netrate/tcpp/tcpp_server.c Sat Jun 5 22:57:53 2010 (r208858) +++ head/tools/tools/netrate/tcpp/tcpp_server.c Sat Jun 5 22:59:37 2010 (r208859) @@ -201,17 +201,19 @@ tcpp_server_worker(int workernum) int ncpus; ssize_t len; - len = sizeof(ncpus); - if (sysctlbyname(SYSCTLNAME_CPUS, &ncpus, &len, NULL, 0) < 0) - err(-1, "sysctlbyname: %s", SYSCTLNAME_CPUS); - if (len != sizeof(ncpus)) - errx(-1, "sysctlbyname: %s: len %jd", SYSCTLNAME_CPUS, - (intmax_t)len); - - CPU_ZERO(&mask); - CPU_SET(workernum % ncpus, &mask); - if (sched_setaffinity(0, CPU_SETSIZE, &mask) < 0) - err(-1, "sched_setaffinity"); + if (Pflag) { + len = sizeof(ncpus); + if (sysctlbyname(SYSCTLNAME_CPUS, &ncpus, &len, NULL, 0) < 0) + err(-1, "sysctlbyname: %s", SYSCTLNAME_CPUS); + if (len != sizeof(ncpus)) + errx(-1, "sysctlbyname: %s: len %jd", SYSCTLNAME_CPUS, + (intmax_t)len); + + CPU_ZERO(&mask); + CPU_SET(workernum % ncpus, &mask); + if (sched_setaffinity(0, CPU_SETSIZE, &mask) < 0) + err(-1, "sched_setaffinity"); + } #endif setproctitle("tcpp_server %d", workernum); From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 23:00:03 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F19401065674; Sat, 5 Jun 2010 23:00:02 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D87D48FC1B; Sat, 5 Jun 2010 23:00: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 o55N02DD063540; Sat, 5 Jun 2010 23:00:02 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55N02BX063539; Sat, 5 Jun 2010 23:00:02 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201006052300.o55N02BX063539@svn.freebsd.org> From: Fabien Thomas Date: Sat, 5 Jun 2010 23:00: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: r208860 - head/lib/libpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 23:00:03 -0000 Author: fabient Date: Sat Jun 5 23:00:02 2010 New Revision: 208860 URL: http://svn.freebsd.org/changeset/base/208860 Log: Fix memory leak on error. Found with: Coverity Prevent(tm) MFC after: 1 month Modified: head/lib/libpmc/pmclog.c Modified: head/lib/libpmc/pmclog.c ============================================================================== --- head/lib/libpmc/pmclog.c Sat Jun 5 22:59:37 2010 (r208859) +++ head/lib/libpmc/pmclog.c Sat Jun 5 23:00:02 2010 (r208860) @@ -549,8 +549,10 @@ pmclog_open(int fd) /* allocate space for a work area */ if (ps->ps_fd != PMCLOG_FD_NONE) { - if ((ps->ps_buffer = malloc(PMCLOG_BUFFER_SIZE)) == NULL) + if ((ps->ps_buffer = malloc(PMCLOG_BUFFER_SIZE)) == NULL) { + free(ps); return NULL; + } } return ps; From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 23:05:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81F6C106567B; Sat, 5 Jun 2010 23:05:10 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57A248FC1D; Sat, 5 Jun 2010 23: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 o55N58Er064666; Sat, 5 Jun 2010 23:05:08 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55N58av064663; Sat, 5 Jun 2010 23:05:08 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201006052305.o55N58av064663@svn.freebsd.org> From: Fabien Thomas Date: Sat, 5 Jun 2010 23:05: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: r208861 - in head/sys: dev/hwpmc sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 23:05:10 -0000 Author: fabient Date: Sat Jun 5 23:05:08 2010 New Revision: 208861 URL: http://svn.freebsd.org/changeset/base/208861 Log: Convert pm_runcount to int to correctly check for negative value. Remove uncessary check for error. Found with: Coverity Prevent(tm) MFC after: 1 month Modified: head/sys/dev/hwpmc/hwpmc_mod.c head/sys/sys/pmc.h Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Sat Jun 5 23:00:02 2010 (r208860) +++ head/sys/dev/hwpmc/hwpmc_mod.c Sat Jun 5 23:05:08 2010 (r208861) @@ -1248,7 +1248,7 @@ pmc_process_csw_in(struct thread *td) continue; /* increment PMC runcount */ - atomic_add_rel_32(&pm->pm_runcount, 1); + atomic_add_rel_int(&pm->pm_runcount, 1); /* configure the HWPMC we are going to use. */ pcd = pmc_ri_to_classdep(md, ri, &adjri); @@ -1387,7 +1387,7 @@ pmc_process_csw_out(struct thread *td) pcd->pcd_stop_pmc(cpu, adjri); /* reduce this PMC's runcount */ - atomic_subtract_rel_32(&pm->pm_runcount, 1); + atomic_subtract_rel_int(&pm->pm_runcount, 1); /* * If this PMC is associated with this process, @@ -3252,9 +3252,6 @@ pmc_syscall_handler(struct thread *td, v } } - if (error) - break; - /* * Look for valid values for 'pm_flags' */ @@ -4045,7 +4042,7 @@ pmc_process_interrupt(int cpu, struct pm ("[pmc,%d] pm=%p runcount %d", __LINE__, (void *) pm, pm->pm_runcount)); - atomic_add_rel_32(&pm->pm_runcount, 1); /* hold onto PMC */ + atomic_add_rel_int(&pm->pm_runcount, 1); /* hold onto PMC */ ps->ps_pmc = pm; if ((td = curthread) && td->td_proc) ps->ps_pid = td->td_proc->p_pid; @@ -4246,7 +4243,7 @@ pmc_process_samples(int cpu) entrydone: ps->ps_nsamples = 0; /* mark entry as free */ - atomic_subtract_rel_32(&pm->pm_runcount, 1); + atomic_subtract_rel_int(&pm->pm_runcount, 1); /* increment read pointer, modulo sample size */ if (++ps == psb->ps_fence) @@ -4418,7 +4415,7 @@ pmc_process_exit(void *arg __unused, str mtx_pool_unlock_spin(pmc_mtxpool, pm); } - atomic_subtract_rel_32(&pm->pm_runcount,1); + atomic_subtract_rel_int(&pm->pm_runcount,1); KASSERT((int) pm->pm_runcount >= 0, ("[pmc,%d] runcount is %d", __LINE__, ri)); Modified: head/sys/sys/pmc.h ============================================================================== --- head/sys/sys/pmc.h Sat Jun 5 23:00:02 2010 (r208860) +++ head/sys/sys/pmc.h Sat Jun 5 23:05:08 2010 (r208861) @@ -680,7 +680,7 @@ struct pmc { enum pmc_event pm_event; /* event being measured */ uint32_t pm_flags; /* additional flags PMC_F_... */ struct pmc_owner *pm_owner; /* owner thread state */ - uint32_t pm_runcount; /* #cpus currently on */ + int pm_runcount; /* #cpus currently on */ enum pmc_state pm_state; /* current PMC state */ /* From owner-svn-src-head@FreeBSD.ORG Sat Jun 5 23:29:25 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C659106566C; Sat, 5 Jun 2010 23:29:25 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4AF0E8FC08; Sat, 5 Jun 2010 23:29: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 o55NTPLM069958; Sat, 5 Jun 2010 23:29:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o55NTP3W069955; Sat, 5 Jun 2010 23:29:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201006052329.o55NTP3W069955@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 5 Jun 2010 23:29: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: r208862 - head/sys/dev/bge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 23:29:25 -0000 Author: yongari Date: Sat Jun 5 23:29:24 2010 New Revision: 208862 URL: http://svn.freebsd.org/changeset/base/208862 Log: Fix a bug introduced in r199011. When bge(4) reuses loaded RX buffers it should also reinitialize RX descriptors otherwise some stale data could be passed to controller. This could end up with mbuf double free or unexpected NULL pointer dereference in upper stack. To fix the issue, save loaded buffer's length and reinitialize RX descriptors with the saved value whenever bge(4) reuses the loaded RX buffers. While I'm here, increase the number of RX buffers to 512 from 256. This simplifies RX buffer handling as well as giving more RX buffers. Controller supports just fixed number of RX buffers (i.e. 512) and bge(4) used to rely on hope that our CPU is fast enough to keep up with the controller. With this change, bge(4) will use 1MB for RX buffers but I don't think it would cause problems in these days. Reported by: marcel 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 Sat Jun 5 23:05:08 2010 (r208861) +++ head/sys/dev/bge/if_bge.c Sat Jun 5 23:29:24 2010 (r208862) @@ -400,6 +400,8 @@ static void bge_setpromisc(struct bge_so static void bge_setmulti(struct bge_softc *); static void bge_setvlan(struct bge_softc *); +static __inline void bge_rxreuse_std(struct bge_softc *, int); +static __inline void bge_rxreuse_jumbo(struct bge_softc *, int); static int bge_newbuf_std(struct bge_softc *, int); static int bge_newbuf_jumbo(struct bge_softc *, int); static int bge_init_rx_ring_std(struct bge_softc *); @@ -922,6 +924,7 @@ bge_newbuf_std(struct bge_softc *sc, int sc->bge_cdata.bge_rx_std_dmamap[i] = sc->bge_cdata.bge_rx_std_sparemap; sc->bge_cdata.bge_rx_std_sparemap = map; sc->bge_cdata.bge_rx_std_chain[i] = m; + sc->bge_cdata.bge_rx_std_seglen[i] = segs[0].ds_len; r = &sc->bge_ldata.bge_rx_std_ring[sc->bge_std]; r->bge_addr.bge_addr_lo = BGE_ADDR_LO(segs[0].ds_addr); r->bge_addr.bge_addr_hi = BGE_ADDR_HI(segs[0].ds_addr); @@ -979,6 +982,11 @@ bge_newbuf_jumbo(struct bge_softc *sc, i sc->bge_cdata.bge_rx_jumbo_sparemap; sc->bge_cdata.bge_rx_jumbo_sparemap = map; sc->bge_cdata.bge_rx_jumbo_chain[i] = m; + sc->bge_cdata.bge_rx_jumbo_seglen[i][0] = 0; + sc->bge_cdata.bge_rx_jumbo_seglen[i][1] = 0; + sc->bge_cdata.bge_rx_jumbo_seglen[i][2] = 0; + sc->bge_cdata.bge_rx_jumbo_seglen[i][3] = 0; + /* * Fill in the extended RX buffer descriptor. */ @@ -991,18 +999,22 @@ bge_newbuf_jumbo(struct bge_softc *sc, i r->bge_addr3.bge_addr_lo = BGE_ADDR_LO(segs[3].ds_addr); r->bge_addr3.bge_addr_hi = BGE_ADDR_HI(segs[3].ds_addr); r->bge_len3 = segs[3].ds_len; + sc->bge_cdata.bge_rx_jumbo_seglen[i][3] = segs[3].ds_len; case 3: r->bge_addr2.bge_addr_lo = BGE_ADDR_LO(segs[2].ds_addr); r->bge_addr2.bge_addr_hi = BGE_ADDR_HI(segs[2].ds_addr); r->bge_len2 = segs[2].ds_len; + sc->bge_cdata.bge_rx_jumbo_seglen[i][2] = segs[2].ds_len; case 2: r->bge_addr1.bge_addr_lo = BGE_ADDR_LO(segs[1].ds_addr); r->bge_addr1.bge_addr_hi = BGE_ADDR_HI(segs[1].ds_addr); r->bge_len1 = segs[1].ds_len; + sc->bge_cdata.bge_rx_jumbo_seglen[i][1] = segs[1].ds_len; case 1: r->bge_addr0.bge_addr_lo = BGE_ADDR_LO(segs[0].ds_addr); r->bge_addr0.bge_addr_hi = BGE_ADDR_HI(segs[0].ds_addr); r->bge_len0 = segs[0].ds_len; + sc->bge_cdata.bge_rx_jumbo_seglen[i][0] = segs[0].ds_len; break; default: panic("%s: %d segments\n", __func__, nsegs); @@ -1014,12 +1026,6 @@ bge_newbuf_jumbo(struct bge_softc *sc, i return (0); } -/* - * The standard receive ring has 512 entries in it. At 2K per mbuf cluster, - * that's 1MB or memory, which is a lot. For now, we fill only the first - * 256 ring entries and hope that our CPU is fast enough to keep up with - * the NIC. - */ static int bge_init_rx_ring_std(struct bge_softc *sc) { @@ -1027,7 +1033,7 @@ bge_init_rx_ring_std(struct bge_softc *s bzero(sc->bge_ldata.bge_rx_std_ring, BGE_STD_RX_RING_SZ); sc->bge_std = 0; - for (i = 0; i < BGE_SSLOTS; i++) { + for (i = 0; i < BGE_STD_RX_RING_CNT; i++) { if ((error = bge_newbuf_std(sc, i)) != 0) return (error); BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT); @@ -1036,8 +1042,8 @@ bge_init_rx_ring_std(struct bge_softc *s bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE); - sc->bge_std = i - 1; - bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); + sc->bge_std = 0; + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, BGE_STD_RX_RING_CNT - 1); return (0); } @@ -1079,14 +1085,14 @@ bge_init_rx_ring_jumbo(struct bge_softc bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); - sc->bge_jumbo = i - 1; + sc->bge_jumbo = 0; rcb = &sc->bge_ldata.bge_info.bge_jumbo_rx_rcb; rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); - bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, BGE_JUMBO_RX_RING_CNT - 1); return (0); } @@ -3273,6 +3279,33 @@ bge_reset(struct bge_softc *sc) return(0); } +static __inline void +bge_rxreuse_std(struct bge_softc *sc, int i) +{ + struct bge_rx_bd *r; + + r = &sc->bge_ldata.bge_rx_std_ring[sc->bge_std]; + r->bge_flags = BGE_RXBDFLAG_END; + r->bge_len = sc->bge_cdata.bge_rx_std_seglen[i]; + r->bge_idx = i; + BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT); +} + +static __inline void +bge_rxreuse_jumbo(struct bge_softc *sc, int i) +{ + struct bge_extrx_bd *r; + + r = &sc->bge_ldata.bge_rx_jumbo_ring[sc->bge_jumbo]; + r->bge_flags = BGE_RXBDFLAG_JUMBO_RING | BGE_RXBDFLAG_END; + r->bge_len0 = sc->bge_cdata.bge_rx_jumbo_seglen[i][0]; + r->bge_len1 = sc->bge_cdata.bge_rx_jumbo_seglen[i][1]; + r->bge_len2 = sc->bge_cdata.bge_rx_jumbo_seglen[i][2]; + r->bge_len3 = sc->bge_cdata.bge_rx_jumbo_seglen[i][3]; + r->bge_idx = i; + BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT); +} + /* * Frame reception handling. This is called if there's a frame * on the receive return list. @@ -3336,24 +3369,24 @@ bge_rxeof(struct bge_softc *sc, uint16_t jumbocnt++; m = sc->bge_cdata.bge_rx_jumbo_chain[rxidx]; if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) { - BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT); + bge_rxreuse_jumbo(sc, rxidx); continue; } if (bge_newbuf_jumbo(sc, rxidx) != 0) { - BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT); + bge_rxreuse_jumbo(sc, rxidx); ifp->if_iqdrops++; continue; } BGE_INC(sc->bge_jumbo, BGE_JUMBO_RX_RING_CNT); } else { stdcnt++; + m = sc->bge_cdata.bge_rx_std_chain[rxidx]; if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) { - BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT); + bge_rxreuse_std(sc, rxidx); continue; } - m = sc->bge_cdata.bge_rx_std_chain[rxidx]; if (bge_newbuf_std(sc, rxidx) != 0) { - BGE_INC(sc->bge_std, BGE_STD_RX_RING_CNT); + bge_rxreuse_std(sc, rxidx); ifp->if_iqdrops++; continue; } Modified: head/sys/dev/bge/if_bgereg.h ============================================================================== --- head/sys/dev/bge/if_bgereg.h Sat Jun 5 23:05:08 2010 (r208861) +++ head/sys/dev/bge/if_bgereg.h Sat Jun 5 23:29:24 2010 (r208862) @@ -2561,6 +2561,8 @@ struct bge_chain_data { struct mbuf *bge_tx_chain[BGE_TX_RING_CNT]; struct mbuf *bge_rx_std_chain[BGE_STD_RX_RING_CNT]; struct mbuf *bge_rx_jumbo_chain[BGE_JUMBO_RX_RING_CNT]; + int bge_rx_std_seglen[BGE_STD_RX_RING_CNT]; + int bge_rx_jumbo_seglen[BGE_JUMBO_RX_RING_CNT][4]; }; struct bge_dmamap_arg {